Repository navigation
feat(parser): capture provider-recorded session lineage (CB-1 slice 1) - #1140
Merged
Merged
Conversation
Wire the SessionLineage field on SessionSummary and CachedFile. The relationship is captured ONLY when a provider writes it on disk in a durable form: a child file that names its parent (Claude's transcript-internal sessionId on a sidechain; Kimi Code's state.json agents[<id>].parentAgentId for any non-main agent), or a parent file whose spawn / child manifest names the children (Claude's agentSpawnLinks; Kimi Code's state.json agents map listing any non-main entry). The brief forbids inference from time adjacency or directory layout, so a parent whose only evidence is the child file living under its directory does not yet qualify, and stays lineage-less. Per provider: - claude: child (parentSessionId present) or root (agentSpawnLinks non-empty). Captured at install time and through the append-merge in scanProjectDirs, where lineage is sticky and cached-first. - kimicode: child (parentAgentId === 'main') or root (sibling non-main entry alongside the main agent). state.json is read by kimicodeLineageForSource, called from the per-provider install path. Bump PROVIDER_PARSE_VERSIONS for both providers to session-lineage-capture-v1 so already-cached sessions gain the new field on the next cold parse (env fingerprint change forces the re-parse; the field is purely additive, no cost / token / call total moves). Invariant: byte-identical report totals with and without the field. The new parser-lineage-capture test asserts this on a Claude corpus (parent + two children) and covers Claude two-sided linkage, Claude one-sided (child file names parent while parent's spawn result was compacted away), Kimi Code nested subagent (child and root variants), no-evidence (no lineage field at all, not 'unknown'), and the cache round-trip across a warm-disk reload.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First slice of CB-1 from the approved Teams boundary spec: the lineage evidence the parsers already see stops being discarded.
lineageon the parsed session model:{ parentSessionId?, role: root|child, evidence: 'provider-recorded' }- strictly provider-recorded, no inference, absent when no evidence exists (never an 'unknown' value).41 new tests; full suite 3705 green; tsc clean. Built by twin MiniMax-M3 builders with a MiniMax verifier comparison (winning candidate), validated independently. Wire fields and folding are later steps (CB-2/3); nothing here touches sync.
Baseline motivating this: docs/baselines in codeburn-teams - 5.1% of sessions carry direct lineage but 76% of 90-day spend.