DEC-AIC-0064: Group the vault domain and application by the MCP tool groups and move pure reading and climb rules into the domain
Status: accepted · 2026-12-03
Context
DEC-AIC-0052 split the vault into hexagonal domain and application libraries. Since then the same vault features are grouped four different ways (observed: repository @ 2026-12-03):
libs/vault/domain:note/,vault/,sessions/,planning/.libs/vault/application: 13 side-by-side folders (scan,search,filing,note-edits,convert,distill,concept,climb,climb-writes,record,plans,harvest,vault).- The
Vaultfacade's slices:sessions,filing,planning,climb, wherefilingheld most reading operations andsessionsbacked the server's climb tools. apps/vault-mcp-server/src/mcp/, which users see as tools:notes,reading,climb,planning.
Several application modules were pure rules with no I/O and no planning: the climb's evidence, progress and structure rules, quote location and passage checks, mark parsing and reading progress, the concept-note format, and plan periods. They sat in the application only because the domain had no reading or climb folder, and other application folders reached across to them, so climb, search and record depended on concept and distill, and convert, concept and climb-writes depended on filing only for safeName.
Decision
- Both libraries use the vault server's four tool groups as their vocabulary: notes, reading, climb and planning.
libs/vault/domaingainsreading/andclimb/:reading/: raw-resource paths, mark parsing and editing, reading progress, quote location and passage checks, and the concept-note format, moved from the application.climb/: the formersessions/(sessions, mastery, the Tier 2 payload) plus the climb's evidence, progress and structure rules, moved from the application.planning/gains the period rules (isoWeekOf,periodOf,nextPeriod, …). Domain folders depend one way:note←vault←reading←climb, andplanningonnoteandvaultonly.
libs/vault/applicationis grouped intonotes/,reading/,climb/,planning/,shared/,ports/andvault/.shared/holds what several groups write with:safeName, note writes and version checks, generic note-edit plumbing, frontmatter edits and plan templates. Each group depends only onshared/,ports/and the domain, never on another group.vault/is the composition:createVault, its runtime and one slice per group (notes,reading,climb,planning).- Every folder is re-exported through its own
index.ts. The 105 names that moved stay public, now exported by@ai-coach/vault-domaininstead of@ai-coach/vault-application, and their consumers import them from there.
DEC-AIC-0052's architecture otherwise holds: the domain is pure, the application has no npm or Node imports, planners read a VaultTree snapshot, and only the execute step writes.
Consequences
- A change to one tool group touches the same-named folder in the server, the application and, for its rules, the domain.
- The application groups can be read and tested on their own; a cross-group dependency now shows up as an import from another group and fails review.
- Pure rules are tested in the domain without a
NoteStore. - Code that imported the moved rules from
@ai-coach/vault-application(vault-mcp-server and vault-adapter-view) imports them from@ai-coach/vault-domain. - Three placements differ from the server's tool groups:
extend_conceptis served under reading but its planner lives in the application'sclimb/, because it refreshes climbs;create_workstreamis served under notes but lives inplanning/, because it edits the planning model; andset_frontmatterlives inshared/, because planning's harvest uses it too.
Alternatives Considered
- Regroup only the application and leave the rules where they are. Rejected:
climb,notesandreadingwould keep depending on each other through pure rules, so the groups would not be independent. - Keep
sessions/as its own domain folder next to a newclimb/. Rejected: sessions, mastery and the Tier 2 payload serve the climb tools (record_session,due_for_review,tier2_payload), and a separate folder would split one group in two. - Re-export the moved names from
@ai-coach/vault-applicationtoo. Rejected: two packages exporting the same rule hides which layer owns it.