Compact long sessions into fresh context windows - #471
Open
fazxes wants to merge 18 commits into
Open
Conversation
fazxes
marked this pull request as ready for review
August 28, 2026 06:43
Measure complete provider requests before removing settled tool result bodies. Preserve retrievable output and keep manual and no-save behavior explicit.
Use the active model to create bounded, tool-free handoffs for automatic and manual compaction. Preserve canonical history and result handles across restart and resume.
Skip automatic compaction when the current user prompt alone exceeds the compacted window. Leave the exact request unchanged for provider capacity handling.
Teach the existing 4 MiB permission fixtures to answer the handoff request before the final model response. Keep their approval and exact-byte assertions unchanged.
Replace selected-model Markdown summaries with a dedicated structured compactor. Preserve complete canonical history, exact recent context, result evidence, and verified operation lineage across repeated compaction and restart. Keep automatic continuation on the selected model and manual compaction idle after installation.
fazxes
force-pushed
the
fazxes/hybrid-context-compaction
branch
from
August 31, 2026 00:44
c76b352 to
6bc8ea8
Compare
Use the portable C allocator for concurrent block work, bound oversized tool-call evidence by byte count and SHA-256, and update maximum-write fixtures to the typed checkpoint contract.
iamken1204
added a commit
to iamken1204/fx
that referenced
this pull request
Aug 31, 2026
kfx/specs/context-budget.md holds where the 2026-08-29 session's input tokens went, the four levers ranked by measured savings, the comparison with Claude Code, Codex CLI, and Pi, and what was deliberately left alone: the terminal schema, the repo AGENTS.md, and a child-only step ceiling that was built and removed because fx ends a capped turn with no final answer. FORK.md gains the three inventory rows, the recommended setup with FX_KEEP_RECENT_RESULTS, FX_SKILL_SOURCES, and the max_tool_result_bytes setting, two post-rebase verification steps, and the note that the eviction projection must stay on the suffix argument when upstream PR vercel-labs#471 or the context-retention patches move prompt assembly. Claude-Session: https://claude.ai/code/session_01NJcKHYnFdSx9edVacBHEjn
iamken1204
added a commit
to iamken1204/fx
that referenced
this pull request
Aug 31, 2026
kfx/specs/context-budget.md holds where the 2026-08-29 session's input tokens went, the four levers ranked by measured savings, the comparison with Claude Code, Codex CLI, and Pi, and what was deliberately left alone: the terminal schema, the repo AGENTS.md, and a child-only step ceiling that was built and removed because fx ends a capped turn with no final answer. FORK.md gains the three inventory rows, the recommended setup with FX_KEEP_RECENT_RESULTS, FX_SKILL_SOURCES, and the max_tool_result_bytes setting, two post-rebase verification steps, and the note that the eviction projection must stay on the suffix argument when upstream PR vercel-labs#471 or the context-retention patches move prompt assembly. Claude-Session: https://claude.ai/code/session_01NJcKHYnFdSx9edVacBHEjn
Use provider-local compaction models and credentials across TUI, ask, ACP, and subagents. Keep typed provenance validation compatible with Gateway, Codex, and Grok responses.
Keep tool execution truth in a runtime-owned ledger and limit compactor models to conversation summary prose. Partition summary work by capacity and preserve provider-valid history tails.
Expect the model catalog lookup required to resolve compaction capacity while preserving the no-Vision text-only path.
Preserve complete turn boundaries, calibrate automatic thresholds from provider usage, and carry only the active context window into repeated compaction.
Use a dedicated worker task for manual compaction and share one transaction between manual and automatic paths. Keep authoritative state limited to structured operation records and remove obsolete structured-output plumbing.
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.
Summary
/compactinstall the same checkpoint and wait for the next prompt.