# BAT-010 Backend core layering (Phase 0~3) - Profile: standard - Status: release-candidate - Included REQ: REQ-013, REQ-014 - Discovery: dcy-010 - Owner: 렛저장인 - Date (KST): 2026-07-03 ## 목표 REQ-013/REQ-014에 따라 `service.py` giant implementation과 `db.py` persistence 집중을 application / infrastructure / adapter seam으로 분리한다. 동시에 top-level facade/shim 호환, MCP tool contract, Streamlit 핵심 화면, additive migration discipline을 유지해 Phase 4+ 분리의 안전한 기반을 만든다. ## 산출물 - `jarca_ledger_mcp/application/` phase-0~3 service modules + shared helpers - `jarca_ledger_mcp/infrastructure/sqlite/` connection/schema/migration split - `jarca_ledger_mcp/adapters/mcp/server.py` + top-level `server.py` shim - `jarca_ledger_mcp/adapters/streamlit/service_gateway.py` + dashboard import seam 정렬 - `service.py` / `db.py` compatibility facade & shim - full pytest / MCP discovery / browser smoke evidence - `docs/project-structure.md`, `docs/runtime-flows.md` baseline updates - BAT-010 planning/design/implementation/verification documents ## 범위 제한 - Phase 4+ transactional write/import/advanced workflow 분리 - 신규 HTTP adapter 추가 - response envelope, tool names, dashboard IA 재설계 - destructive DB migration ## 문서 - `planning.md`: Phase 0~3 delivery plan, risks, validation gate - `design.md`: layering/seam/shim design - `implementation.md`: changed files, execution log, validation commands - `verification.md`: AC mapping, PASS/FAIL, REQ Implemented decision