DEC-AIC-0048: Keep the vault server in this repository, behind the same MCP boundary
Status: accepted · 2026-11-15 · supersedes DEC-AIC-0003
Context
DEC-AIC-0003 put every read and write of the vault behind the vault server of kb-template, a separate repository, and said ai-coach never changes kb-template. In practice the vault server was built for ai-coach alone: kb-template's vault-mode decisions (its Q-KI-0042 and DEC-KI-0058 to DEC-KI-0071) were all made to serve the coach, and that code sat unmerged on a branch, ar/ai-coach, of a repository that is otherwise a template for documentation workspaces.
This had costs:
- ai-coach ran only next to a built checkout of kb-template, found by an absolute path in
coach.config.jsonand.mcp.json, and kb-template is not public. - Most new coach features needed a change in both repositories, made, reviewed and released separately.
- CI could not run anything that needed the server (DEC-AIC-0010).
The vault code had few ties to the rest of kb-template. Its only imports from kb-template's own core were two frontmatter helpers, and the vault server was already a separate MCP server from kb-template's documentation server (observed: kb-template ar/ai-coach @ f184c18, 2026-11-15).
Decision
-
The vault lives in this repository. Three projects hold it:
packages/vault(@ai-coach/vault): the engine that reads and writes the vault.packages/vault-server(@ai-coach/vault-server): the MCP vault server and the graph view, run as thecoach-vaultbinary (serveandview).apps/climb-board: the Angular drawing board of the climb page. Its build is committed underpackages/vault/assets/climb-board/.
They were imported from kb-template
ar/ai-coach@ f184c18 with their git history. -
The boundary of DEC-AIC-0003 stays. ai-coach reads and writes the vault only through the vault server's tools, over MCP on stdio. It never opens vault files and never writes
Coach/directly.domain,application, the adapters andclinever import@ai-coach/vaultor@ai-coach/vault-server. The Nx tagstype:vaultandtype:vault-serverenforce this (DEC-AIC-0008): a vault project may depend only ontype:vault, and nothing else may depend on either. -
The server is started as before:
node <docsMcpBin> serve --vault <path>for each command, andnode <docsMcpBin> view --vault <path>forcoach view.docsMcpBinnow defaults topackages/vault-server/dist/main.jsin this checkout;DOCS_MCP_BINand the config still override it. The namesdocsMcpBin,DOCS_MCP_BIN,DOCS_MCP_VAULTand~/.config/docs-mcp/config.jsonare kept, so existing configurations keep working. -
New vault abilities are made here, in
packages/vaultandpackages/vault-server, and reach the coach as a server tool thatadapter-vault-mcpwraps. This replaces DEC-AIC-0003 Decision 2. -
The rest of DEC-AIC-0003 carries over unchanged:
- The vault path is configurable and never hard-coded.
- A sparred note is identified by its
coach_id. - Only notes under
3.Resourcesare sparred, and the server derives mastery from sessions. - Every write previews first and executes only with
execute: trueafter the user confirms (DEC-AIC-0009). - The session history for scheduling comes from
read_note(DEC-AIC-0007).
-
The imported code follows this repository's rules.
- Comments are removed (DEC-AIC-0011); a
catchthat held only a comment now says what it does. - It is formatted with this repository's Prettier.
- Six imported commit subjects were reworded to pass commitlint (DEC-AIC-0033).
- Comments are removed (DEC-AIC-0011); a
-
The reasons behind the vault's existing behaviour stay where they were made, in kb-template's DEC-KI-0058 to DEC-KI-0071, which this repository cites by ID. New decisions about the vault are recorded here.
Consequences
- ai-coach runs from one checkout, and kb-template is no longer needed.
- One
nx run-many -t lint test build typecheckcovers the coach and the vault, including the vault's own tests. - The reason DEC-AIC-0010 gave for dropping the server-dependent tests (CI lacks a kb-template checkout) no longer holds. Whether to bring those tests back is a separate decision.
- The import was checked against kb-template on a copy of a real vault (2026-11-15):
- The view's graph, note, plans and climb data were identical.
- The server offers the same 38 tools.
list_notes,due_for_review,vault_graph,searchandplanning_overviewreplied identically.- Only the JSON Schema spelling of nullable fields changed, from zod 4.3 to 4.6.
- The workspace now installs Angular for
apps/climb-board. CI does not build the board. After changing it, runnpm run build:board -w @ai-coach/climb-boardand commit the output. - The known server gap from DEC-AIC-0003 is now this repository's to fix: search folds
ż,ó,ę,śbut notł. - What happens to the vault code and DEC-KI-0058 to DEC-KI-0071 in kb-template is decided there (TBD).