Skip to content

feat(compaction): L1 tool-result overflow-to-disk as a cascade stage … - #26

Merged
wusijian007 merged 1 commit into
mainfrom
feat/m4.1-l1-overflow-spill
Jun 19, 2026
Merged

wusijian007 merged 1 commit into
mainfrom
feat/m4.1-l1-overflow-spill

Conversation

@wusijian007

Copy link
Copy Markdown
Owner

…(M4.1 / v4)

Layer 1 of the v4 pipeline: decouple the inline preview size from the spill threshold and keep a head+tail SMART preview instead of a pure prefix slice, so both the start (what the output is) and the end (the final line / error / summary) of a large tool output survive — a pure prefix throws the tail away. Full output is still spilled to an artifact and restorable via Read (zero loss).

  • smartPreview(content, maxChars): head ~70% + omitted-count marker + tail ~30%.
  • ToolContext.toolResultPreviewChars (default 2048), decoupled from the spill threshold (toolResultBudgetChars); budgetToolResult uses it at execution time.
  • createSpillStage: a request-time cascade stage (the cheapest layer) that spills any oversized, not-yet-spilled tool_result before the deeper layers run, preserving artifactPath; prepended to runCompactionPipeline's stages. Its threshold defaults to the execution budget, so it is dormant when no budget is set (the eval harness -> 120K) and active in the CLI (8192) — the eval fingerprint is unchanged, real usage gets active L1.
  • tests: smartPreview (head+tail + passthrough); createSpillStage (spills + restorable, leaves small/already-spilled untouched); the existing budget test hardened to assert the head+tail marker.
  • docs: CLAUDE.md artifact-spill + cascade-stages note (also dedup'd a stray duplicated paragraph in query-loop step 7); v4 roadmap M4.1 marked delivered.

230 tests pass (+4); all 10 eval tasks green, fingerprint unchanged.

…(M4.1 / v4)

Layer 1 of the v4 pipeline: decouple the inline preview size from the spill
threshold and keep a head+tail SMART preview instead of a pure prefix slice, so
both the start (what the output is) and the end (the final line / error /
summary) of a large tool output survive — a pure prefix throws the tail away.
Full output is still spilled to an artifact and restorable via Read (zero loss).

- smartPreview(content, maxChars): head ~70% + omitted-count marker + tail ~30%.
- ToolContext.toolResultPreviewChars (default 2048), decoupled from the spill
  threshold (toolResultBudgetChars); budgetToolResult uses it at execution time.
- createSpillStage: a request-time cascade stage (the cheapest layer) that
  spills any oversized, not-yet-spilled tool_result before the deeper layers
  run, preserving artifactPath; prepended to runCompactionPipeline's stages.
  Its threshold defaults to the execution budget, so it is dormant when no
  budget is set (the eval harness -> 120K) and active in the CLI (8192) — the
  eval fingerprint is unchanged, real usage gets active L1.
- tests: smartPreview (head+tail + passthrough); createSpillStage (spills +
  restorable, leaves small/already-spilled untouched); the existing budget test
  hardened to assert the head+tail marker.
- docs: CLAUDE.md artifact-spill + cascade-stages note (also dedup'd a stray
  duplicated paragraph in query-loop step 7); v4 roadmap M4.1 marked delivered.

230 tests pass (+4); all 10 eval tasks green, fingerprint unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@wusijian007
wusijian007 merged commit 5eeb07b into main Jun 19, 2026
3 checks passed
@wusijian007
wusijian007 deleted the feat/m4.1-l1-overflow-spill branch June 19, 2026 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant