Context
The foundation of #12073 (hierarchical-summarization for Tri-Vector extraction), split out as a safe, independently-landable primitive. The full sub requires a map→reduce refactor that separates extraction from graph-commit inside SemanticGraphExtractor.executeTriVectorExtraction (today the method interleaves LLM extraction with GraphService.upsertNode/linkNodes inline) — a sensitive core change. This leaf ships the pure, deterministic chunking primitive that the integration wraps, with zero change to the existing extraction path.
Live latest-open sweep: checked latest 20 open issues at ~2026-06-19T04:50Z; no equivalent — this is a clean sub of #12073.
Release classification: boardless (REM-pipeline epic lineage; post-v13).
The Problem
When session.document exceeds the local model's safeProcessingLimitTokens band, the consumer-friction guardrail in executeTriVectorExtraction skips invocation and extraction returns null — large sessions are silently lost. The map→reduce strategy needs a deterministic way to split a session into bounded, turn-aligned chunks first.
The Fix
New pure module ai/services/graph/sessionChunker.mjs (sibling of SemanticGraphExtractor.mjs; plain function module, no Neo import — same shape as consumerFrictionHelper):
chunkSession(turns, {sessionId, safeProcessingLimitTokens, estimate}) — greedy left-to-right turn-aligned packing; <sessionId>:chunk:<N> zero-indexed monotonic ids; turnIndices for source-coverage traceability; a single over-limit turn is kept intact and flagged oversizedTurn; small sessions return one chunk with chunked: false (single-pass preserved).
estimateTokens(text) — coarse, deterministic char-based estimate (no model round-trip → reproducible boundaries); injectable into chunkSession for guardrail parity.
Acceptance Criteria
Out of Scope (remains in #12073)
- The map→reduce integration into
executeTriVectorExtraction: per-chunk extraction (AC4), deterministic reduce (AC5), cross-chunk (type,name) dedup (AC6), per-chunk failure → REM run-state (AC7). These require separating extraction from graph-commit in the core method — the sensitive change this leaf deliberately defers.
Related
- Parent: #12073 (retains the integration + reduce/dedup/failure ACs).
- Epic: #12065.
Origin Session ID
045a6048-1e1d-44c1-9738-7f09b62cc998
Context
The foundation of #12073 (hierarchical-summarization for Tri-Vector extraction), split out as a safe, independently-landable primitive. The full sub requires a map→reduce refactor that separates extraction from graph-commit inside
SemanticGraphExtractor.executeTriVectorExtraction(today the method interleaves LLM extraction withGraphService.upsertNode/linkNodesinline) — a sensitive core change. This leaf ships the pure, deterministic chunking primitive that the integration wraps, with zero change to the existing extraction path.Live latest-open sweep: checked latest 20 open issues at ~2026-06-19T04:50Z; no equivalent — this is a clean sub of #12073.
Release classification: boardless (REM-pipeline epic lineage; post-v13).
The Problem
When
session.documentexceeds the local model'ssafeProcessingLimitTokensband, the consumer-friction guardrail inexecuteTriVectorExtractionskips invocation and extraction returnsnull— large sessions are silently lost. The map→reduce strategy needs a deterministic way to split a session into bounded, turn-aligned chunks first.The Fix
New pure module
ai/services/graph/sessionChunker.mjs(sibling ofSemanticGraphExtractor.mjs; plain function module, no Neo import — same shape asconsumerFrictionHelper):chunkSession(turns, {sessionId, safeProcessingLimitTokens, estimate})— greedy left-to-right turn-aligned packing;<sessionId>:chunk:<N>zero-indexed monotonic ids;turnIndicesfor source-coverage traceability; a single over-limit turn is kept intact and flaggedoversizedTurn; small sessions return one chunk withchunked: false(single-pass preserved).estimateTokens(text)— coarse, deterministic char-based estimate (no model round-trip → reproducible boundaries); injectable intochunkSessionfor guardrail parity.Acceptance Criteria
chunkId+turnIndices. (#12073 AC3)chunked: false). (#12073 AC8)Out of Scope (remains in #12073)
executeTriVectorExtraction: per-chunk extraction (AC4), deterministic reduce (AC5), cross-chunk(type,name)dedup (AC6), per-chunk failure → REM run-state (AC7). These require separating extraction from graph-commit in the core method — the sensitive change this leaf deliberately defers.Related
Origin Session ID
045a6048-1e1d-44c1-9738-7f09b62cc998