Parent epic: #11912
Context
#11912 is being reshaped into an epic with grouped cleanup subissues. This subissue owns the Knowledge Base, Graph, and ingestion-service source-comment group.
Current grouped baseline on origin/dev:
ai/services/knowledge-base/**/*.mjs: 113 diagnostic matches.
ai/services/graph/**/*.mjs plus ai/graph/**/*.mjs: 41 diagnostic matches.
ai/mcp/server/knowledge-base/**/*.mjs: 16 diagnostic matches.
ai/services/ingestion/**/*.mjs appears in the residual high-noise list and belongs with this Brain-data-service group.
The Problem
Knowledge Base and Graph comments often encode implementation history rather than durable ingestion, embedding, graph, and Golden Path contracts. That makes living code read like a PR transcript and trains reviewers to accept the same pattern.
The Architectural Reality
This group is the Brain data substrate: KB ingestion, vector provider selection, document lifecycle, graph inference, Golden Path synthesis, identity roots, and ingestion bridges. The cleanup must preserve why a projection, metric, or graph edge exists while moving away from ticket/AC/cycle phrasing.
The Fix
Clean KB, Graph, and ingestion source comments in grouped batches:
- Rewrite historical anchors into durable service contracts and stable symbol references.
- Keep comments that explain non-obvious graph/embedding invariants, but remove or re-home PR archaeology.
- Separate runtime/test/schema changes into their own tickets if discovered.
- Provide before/after counts per PR.
Contract Ledger Matrix
| Target Surface |
Source of Authority |
Proposed Behavior |
Fallback |
Docs |
Evidence |
| KB service comments/JSDoc |
#11912 source-comment cleanup epic |
Comments explain ingestion/provider/storage contracts, not ticket chronology |
Stable docs may receive load-bearing rationale if source would become too long |
PR bodies |
Before/after focused diagnostics |
| Graph/identity comments/JSDoc |
#11912 source-comment cleanup epic |
Comments explain graph-edge semantics and synthesis boundaries in stable terms |
File separate bug/substrate ticket if cleanup exposes a contract mismatch |
PR bodies |
Before/after focused diagnostics |
| Ingestion bridge comments/JSDoc |
#11912 source-comment cleanup epic |
Comments explain handoff contracts between Memory/KB/Graph surfaces |
Defer non-.mjs generated surfaces |
PR bodies |
Before/after focused diagnostics |
Decision Record Impact
Aligned with ADR 0005 and ADR 0008. No ADR amendment expected.
Acceptance Criteria
Out of Scope
- Memory Core, GitHub Workflow, daemon/script, and residual config groups.
- Runtime behavior changes.
- Rewriting issue/PR/discussion history.
Related
Origin Session ID: 019e5bac-15f3-7830-a59c-72772c757f9a
Handoff Retrieval Hint: query_raw_memories("11912 knowledge-base graph ingestion source-comment archaeology")
Parent epic: #11912
Context
#11912 is being reshaped into an epic with grouped cleanup subissues. This subissue owns the Knowledge Base, Graph, and ingestion-service source-comment group.
Current grouped baseline on
origin/dev:ai/services/knowledge-base/**/*.mjs: 113 diagnostic matches.ai/services/graph/**/*.mjsplusai/graph/**/*.mjs: 41 diagnostic matches.ai/mcp/server/knowledge-base/**/*.mjs: 16 diagnostic matches.ai/services/ingestion/**/*.mjsappears in the residual high-noise list and belongs with this Brain-data-service group.The Problem
Knowledge Base and Graph comments often encode implementation history rather than durable ingestion, embedding, graph, and Golden Path contracts. That makes living code read like a PR transcript and trains reviewers to accept the same pattern.
The Architectural Reality
This group is the Brain data substrate: KB ingestion, vector provider selection, document lifecycle, graph inference, Golden Path synthesis, identity roots, and ingestion bridges. The cleanup must preserve why a projection, metric, or graph edge exists while moving away from ticket/AC/cycle phrasing.
The Fix
Clean KB, Graph, and ingestion source comments in grouped batches:
Contract Ledger Matrix
.mjsgenerated surfacesDecision Record Impact
Aligned with ADR 0005 and ADR 0008. No ADR amendment expected.
Acceptance Criteria
ai/services/knowledge-base/**/*.mjscomments/JSDoc to durable intent phrasing.ai/services/graph/**/*.mjsandai/graph/**/*.mjscomments/JSDoc to durable intent phrasing.ai/services/ingestion/**/*.mjscomments/JSDoc under the same rule.git diff --check.Out of Scope
Related
Origin Session ID: 019e5bac-15f3-7830-a59c-72772c757f9a
Handoff Retrieval Hint:
query_raw_memories("11912 knowledge-base graph ingestion source-comment archaeology")