Repository navigation
feat: Claude Code compactions become compaction spans, with the summary that replaced the history (RIUS-1543) - #67
Conversation
…ry that replaced the history (RIUS-1543) A compact_boundary entry is exported as a compaction span (kind summarize, executor client, trigger, tokens before/after/dropped, messages kept, id, summary bytes, and the summary text when content capture is on). The first LLM call after it carries gen_ai.conversation.compacted. The isCompactSummary entry is no longer a user turn. Re-vendors rius-semconv v1.8.0. Signed-off-by: Kiran <nkirandroid@gmail.com>
factory/review: PASS @ f97620dReviewed RIUS-1543 at head Verified
Good call: sending the boundary span at once and filling in the summary under the same span id. It follows the existing pattern for a response that grows, and a hook that reads between the two lines loses nothing. Findings (non-blocking)
A Sonnet challenger was used. It agreed with F1 and raised F2 and F3; I checked both against the code, and F2 against real transcripts. Not verified
|
Ticket: RIUS-1543
What changed
scripts/sync-semconv.sh(--checkok).compact_boundarytranscript entry becomes acompactionCHAIN span: parent the open turn, else the root; end = boundary timestamp, start = end -durationMs; id fromcompaction:<uuid>. Attributes: kind=summarize, executor=client, trigger, tokens.before/after/dropped, messages.kept, id, summary.bytes. The summary text is added only whencapture_contentis on for the folder, scrubbed and capped atmax_attr_bytes.gen_ai.conversation.compacted = true. Replaying or re-reading old boundaries re-arms nothing.isCompactSummaryuser entry no longer opens a turn; its text is attached to the compaction span (re-emitted with the same span id if it arrives in a later hook).continuation.py).docs/how-it-works.mdhas a short paragraph on the span.Checks
python -m pytest -q: py3.12 1840 passed, 1 skipped; py3.13 1840 passed, 1 skipped; py3.9 without proto 1812 passed, 9 skipped.scripts/sync-semconv.sh --check: matches v1.8.0.tests/test_compaction.py(29) were each shown to fail against broken code.--plugin-dir, loopback collector, isolated home): after about 72k tokens of context,/compactexported a compaction span with trigger=manual, tokens.before=72250, after=14036, dropped=58214, messages.kept=3, summary.bytes=5448, summary.text present. The next LLM span carriedgen_ai.conversation.compacted = true, the one after did not. Recorded in the ticket's Progress.Assumptions
/clearevent) is skipped: RIUS-1535 shows/clearstarts a new transcript and session id.Notes for the reviewer
/compact, Claude Code writes the boundary and summary before the/compactcommand entries, so no turn is open at the boundary and the span's parent is the root (a sibling of the command turn).README.md; no overlap.