Refactor: move shared orchestration into basic_memory/app/ services; keep adapters thin
Why
API routers and MCP tools often duplicate orchestration: resolve project → call services/repos → format response. Domain-ish orchestration should live in reusable application services.
Scope
- Create
basic_memory/app/ layer for shared orchestration returning typed results (not strings):
- e.g.
NotesAppService, ProjectsAppService, ContextAppService
- Keep adapters thin:
- API routers map to HTTP schemas
- MCP tools map to markdown/guidance strings
Acceptance criteria
- Reduced duplication between MCP and API.
- Application services are independently testable.
- Adapters remain small and focused.
Dependencies
- Works best after typed internal API clients + config injection.