Context
While investigating the P0 Memory Core backup exportability incident in #13999, the operator surfaced an adjacent Knowledge Base sync log from 2026-06-25:
tenantId: 'neo-shared',
repoSlug: 'neo',
source: 'resources/content/issues/chunk-2/issue-12065.md',
inputBytes: 91892,
inputTokensEstimate: 30631,
safeProcessingLimitTokens: 28672,
contextLimitTokens: 32768
[WARN] [VectorService] Skipping over-budget embedding chunk before provider invocation.
V-B-A on the current checkout confirmed the operator's completeness concern:
resources/content/issues/chunk-2/issue-12065.md exists locally and is 91868 bytes.
- Read-only Chroma lookups against
neo-knowledge-base for that exact path under metadata keys sourcePath, source, path, file, and filePath returned 0 rows.
npm run ai:check-chroma-integrity -- --json --exportability-sample-size 10 --vector-coverage-sample-size 10 still shows KB sampled stored-embedding exportability as 10/10, so this is not the direct Memory Core backup root cause, but it is a real Knowledge Base completeness gap.
Duplicate sweep:
- Live latest-open sweep: checked the latest 20 open issues at 2026-06-25T11:04Z through the GitHub API; no equivalent open issue existed. The closest open related issue is #13999, which owns the Memory Core backup exportability repair, not KB source chunking.
- A2A in-flight claim sweep: checked latest 30 all-status messages at 2026-06-25T11:04Z; no competing
[lane-claim] or [lane-intent] for KB oversized-source chunking was present.
- Semantic ticket sweep:
ask_knowledge_base found no open ticket for splitting oversized KB raw files into embedding-safe chunks. It identified #13930 as the closest prior ticket, but that ticket is closed and explicitly scoped to skip-and-diagnose; its Out of Scope says automatic splitting/summarizing monster files was not included.
Release classification: boardless follow-up adjacent to #13999. This improves KB completeness but is not the immediate P0 Memory Core backup repair unless the operator promotes it.
The Problem
The current KB ingestion safety net prevents embedding-provider burn by skipping chunks whose final embedding input exceeds the local safe-processing band. That is correct as a last-resort guardrail, but it becomes lossy when the skipped item is a raw or parser-output chunk that could be safely split.
The verified example is resources/content/issues/chunk-2/issue-12065.md: the source exists in the repo, exceeded the embedding safe band, was skipped, and currently has no indexed KB row for the checked source-path metadata keys. The resulting KB corpus is incomplete even though the sync did not corrupt the vector store and the remaining KB sampled embeddings are exportable.
This is the work that #13930 deliberately deferred. #13930 made oversized skips visible and safe; it did not implement a chunking strategy to recover embeddable vectors for oversized sources.
The Architectural Reality
Relevant current surfaces:
ai/services/knowledge-base/KnowledgeBaseIngestionService.mjs collects parsed chunks, then calls filterEmbeddingInputBudget() before embedChunkGroups().
KnowledgeBaseIngestionService.filterEmbeddingInputBudget() drops local-provider over-budget chunks before writing the temp JSONL for VectorService and records KB_INGEST_INPUT_SIZE_EXCEEDED diagnostics.
KnowledgeBaseIngestionService.rawFileToParsedRecord() turns a raw fallback source into one parsed-chunk-v1 record whose content is the whole file.
ai/services/knowledge-base/VectorService.mjs remains the final safety net and skips any over-budget chunk that reaches embedChunks() before provider invocation.
ai/services/knowledge-base/parser/DocumentationParser.mjs, SourceParser.mjs, and TestParser.mjs are existing parser/chunking surfaces; this ticket should preserve their parser-specific behavior and focus on the generic oversized-source fallback/normalization gap.
The invariant to preserve: over-budget input must not be sent to the local embedding provider. The change is to split recoverable oversized sources before they hit the skip path, not to weaken the guardrail.
The Fix
Add deterministic, embedding-budget-aware chunking for oversized Knowledge Base source content before the final skip gate.
Expected shape:
- Detect when a raw fallback record or parser-produced textual chunk would exceed the active local embedding
safeProcessingLimitTokens band.
- Split recoverable textual content into stable sub-chunks below the budget, carrying source traceability such as
sourcePath, chunk index, and line or character range where available.
- Keep chunk identity deterministic so unchanged oversized sources do not churn KB IDs across syncs.
- Preserve the existing skip-and-diagnose behavior for genuinely unsplittable chunks, invalid input, or a single block that still exceeds the safe band after bounded splitting.
- Keep diagnostics bounded and non-secret; never emit raw source content.
- Add focused tests using the
issue-12065.md shape or an equivalent fixture so a future sync produces embeddable sub-chunks instead of zero vectors.
Implementation does not need a new module. If intake chooses to add a new .mjs helper, run structural-pre-flight first and place it under the existing KB parser/service ownership boundary.
Contract Ledger Matrix
| Target Surface |
Source of Authority |
Proposed Behavior |
Fallback |
Docs |
Evidence |
KnowledgeBaseIngestionService oversized-source normalization |
This ticket + #13930 deferred scope |
Recoverable oversized textual source chunks are split into deterministic embedding-safe sub-chunks before VectorService.embed() |
Existing KB_INGEST_INPUT_SIZE_EXCEEDED skip remains for unsplittable or still-over-budget chunks |
JSDoc near the split/skip boundary |
Unit test for oversized raw fallback and safe remainder |
| Parsed chunk identity |
Existing tenant-aware hash / parsed-chunk-v1 contract |
Sub-chunks carry stable identity inputs: original source path, parser id/version, chunk index, content slice, and trace range where available |
If trace range cannot be known, still use stable chunk index + content hash |
Inline comments only if needed |
Repeat-ingest test proves no ID churn for unchanged content |
| KB diagnostics |
#13930 summary/error contract |
Distinguish splitOversized/embedded sub-chunks from skippedOversized final failures without exposing raw content |
If response shape changes, update openapi.yaml; otherwise preserve existing summary fields |
OpenAPI/JSDoc as needed |
Unit/schema test if public response shape changes |
VectorService final guardrail |
PR #13929 and #13930 |
Continues to refuse over-budget embedding inputs before provider invocation |
No fallback to provider truncation or raised limits |
Existing service JSDoc |
Existing guardrail tests remain green plus a bypass test if applicable |
Decision Record impact
Aligned with ADR 0019: read resolved AiConfig leaves at use sites; do not introduce a second config-resolution path or hard-coded safe-token defaults.
Acceptance Criteria
Out of Scope
- Weakening the over-budget guardrail or sending oversized inputs to the embedding provider.
- Raising
safeProcessingLimitTokens or model context limits to mask the issue.
- Solving the Memory Core backup exportability failure from #13999.
- Full tenant-specific parser inventory or source-family coverage; this ticket is the generic oversized-source fallback.
- Emitting raw source content in logs, metrics, errors, or A2A.
Avoided Traps
- Do not treat
#13930 as complete coverage for this problem; it intentionally stopped at diagnostics and skip safety.
- Do not make
VectorService responsible for arbitrary parser semantics. It can remain the final guardrail; source/chunk normalization belongs earlier in KB ingestion.
- Do not split by bytes alone if it can produce unstable or semantically useless fragments. Prefer deterministic line/paragraph boundaries with a token-estimate backstop.
- Do not make this release-blocking by default. It is adjacent evidence from #13999, not the direct MC backup root.
Related
Related: #13999
Related: #13930
Related: #13929
Related: #13928
Origin Session ID: f4d00667-a65a-4285-83f5-6761f3aea394
Handoff Retrieval Hints
query_raw_memories("issue-12065 over-budget KB chunk skipped sourcePath zero rows")
query_raw_memories("KnowledgeBaseIngestionService skippedOversized split-document oversized raw fallback")
- Exact anchors:
KnowledgeBaseIngestionService.filterEmbeddingInputBudget, KnowledgeBaseIngestionService.rawFileToParsedRecord, VectorService.embedChunks, resources/content/issues/chunk-2/issue-12065.md
Context
While investigating the P0 Memory Core backup exportability incident in #13999, the operator surfaced an adjacent Knowledge Base sync log from 2026-06-25:
V-B-A on the current checkout confirmed the operator's completeness concern:
resources/content/issues/chunk-2/issue-12065.mdexists locally and is91868bytes.neo-knowledge-basefor that exact path under metadata keyssourcePath,source,path,file, andfilePathreturned0rows.npm run ai:check-chroma-integrity -- --json --exportability-sample-size 10 --vector-coverage-sample-size 10still shows KB sampled stored-embedding exportability as10/10, so this is not the direct Memory Core backup root cause, but it is a real Knowledge Base completeness gap.Duplicate sweep:
[lane-claim]or[lane-intent]for KB oversized-source chunking was present.ask_knowledge_basefound no open ticket for splitting oversized KB raw files into embedding-safe chunks. It identified#13930as the closest prior ticket, but that ticket is closed and explicitly scoped to skip-and-diagnose; its Out of Scope says automatic splitting/summarizing monster files was not included.Release classification: boardless follow-up adjacent to #13999. This improves KB completeness but is not the immediate P0 Memory Core backup repair unless the operator promotes it.
The Problem
The current KB ingestion safety net prevents embedding-provider burn by skipping chunks whose final embedding input exceeds the local safe-processing band. That is correct as a last-resort guardrail, but it becomes lossy when the skipped item is a raw or parser-output chunk that could be safely split.
The verified example is
resources/content/issues/chunk-2/issue-12065.md: the source exists in the repo, exceeded the embedding safe band, was skipped, and currently has no indexed KB row for the checked source-path metadata keys. The resulting KB corpus is incomplete even though the sync did not corrupt the vector store and the remaining KB sampled embeddings are exportable.This is the work that
#13930deliberately deferred.#13930made oversized skips visible and safe; it did not implement a chunking strategy to recover embeddable vectors for oversized sources.The Architectural Reality
Relevant current surfaces:
ai/services/knowledge-base/KnowledgeBaseIngestionService.mjscollects parsed chunks, then callsfilterEmbeddingInputBudget()beforeembedChunkGroups().KnowledgeBaseIngestionService.filterEmbeddingInputBudget()drops local-provider over-budget chunks before writing the temp JSONL forVectorServiceand recordsKB_INGEST_INPUT_SIZE_EXCEEDEDdiagnostics.KnowledgeBaseIngestionService.rawFileToParsedRecord()turns a raw fallback source into oneparsed-chunk-v1record whosecontentis the whole file.ai/services/knowledge-base/VectorService.mjsremains the final safety net and skips any over-budget chunk that reachesembedChunks()before provider invocation.ai/services/knowledge-base/parser/DocumentationParser.mjs,SourceParser.mjs, andTestParser.mjsare existing parser/chunking surfaces; this ticket should preserve their parser-specific behavior and focus on the generic oversized-source fallback/normalization gap.The invariant to preserve: over-budget input must not be sent to the local embedding provider. The change is to split recoverable oversized sources before they hit the skip path, not to weaken the guardrail.
The Fix
Add deterministic, embedding-budget-aware chunking for oversized Knowledge Base source content before the final skip gate.
Expected shape:
safeProcessingLimitTokensband.sourcePath, chunk index, and line or character range where available.issue-12065.mdshape or an equivalent fixture so a future sync produces embeddable sub-chunks instead of zero vectors.Implementation does not need a new module. If intake chooses to add a new
.mjshelper, runstructural-pre-flightfirst and place it under the existing KB parser/service ownership boundary.Contract Ledger Matrix
KnowledgeBaseIngestionServiceoversized-source normalization#13930deferred scopeVectorService.embed()KB_INGEST_INPUT_SIZE_EXCEEDEDskip remains for unsplittable or still-over-budget chunksparsed-chunk-v1contract#13930summary/error contractsplitOversized/embedded sub-chunks fromskippedOversizedfinal failures without exposing raw contentopenapi.yaml; otherwise preserve existing summary fieldsVectorServicefinal guardrail#13929and#13930Decision Record impact
Aligned with ADR 0019: read resolved AiConfig leaves at use sites; do not introduce a second config-resolution path or hard-coded safe-token defaults.
Acceptance Criteria
safeProcessingLimitTokensis split into deterministic sub-chunks beforeVectorService.embed().sourcePathand chunk/range.issue-12065.md-class shape or an equivalent oversized markdown fixture.ai/mcp/server/knowledge-base/openapi.yamlis updated and covered.Out of Scope
safeProcessingLimitTokensor model context limits to mask the issue.Avoided Traps
#13930as complete coverage for this problem; it intentionally stopped at diagnostics and skip safety.VectorServiceresponsible for arbitrary parser semantics. It can remain the final guardrail; source/chunk normalization belongs earlier in KB ingestion.Related
Related: #13999 Related: #13930 Related: #13929 Related: #13928
Origin Session ID: f4d00667-a65a-4285-83f5-6761f3aea394
Handoff Retrieval Hints
query_raw_memories("issue-12065 over-budget KB chunk skipped sourcePath zero rows")query_raw_memories("KnowledgeBaseIngestionService skippedOversized split-document oversized raw fallback")KnowledgeBaseIngestionService.filterEmbeddingInputBudget,KnowledgeBaseIngestionService.rawFileToParsedRecord,VectorService.embedChunks,resources/content/issues/chunk-2/issue-12065.md