Skip to content

Commit 5bd3100

Browse files
authored
fix(compaction): bound checkpoint inputs (#37)
1 parent 04dde43 commit 5bd3100

4 files changed

Lines changed: 400 additions & 61 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "kit"
3-
version = "0.1.98"
3+
version = "0.1.99"
44
edition = "2024"
55
rust-version = "1.94.0"
66
publish = false

docs/user/tui-and-sessions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ A new session ID that already exists reports `session ... already exists; use --
142142

143143
Kit checks the latest provider-reported usage. When `context_used` reaches 80% of `context_window`, it automatically compacts mutable history. If the provider did not report a context window, automatic compaction stays disabled rather than guessing a limit.
144144

145-
Automatic compaction drops historical reasoning, summarizes an older prefix into a structured coding checkpoint, and preserves bootstrap `System` and `Context` items plus a recent tail targeting approximately 8,000 tokens (smaller for short context windows or large bootstrap instructions). An indivisible recent item or tool round can exceed that target so call/result pairs remain valid. The split never separates a tool call from its result, and oversized retained tool outputs are truncated to keep the continuation usable. Later checkpoints fold in the previous checkpoint while preferring newer facts. Manual `/compact` uses the same retention policy; optional text after the command becomes the next user input. A successful durable-session compaction is appended as a canonical transcript replacement, so resuming uses the compacted history. The TUI shows the lifecycle and adds `context compacted` after a real replacement.
145+
Automatic compaction drops historical reasoning, summarizes an older prefix into a structured coding checkpoint, and preserves bootstrap `System` and `Context` items plus a recent tail targeting approximately 8,000 tokens (smaller for short context windows or large bootstrap instructions). An indivisible recent item or tool round can exceed that target so call/result pairs remain valid. The split never separates a tool call from its result. Historical tool results are aggressively truncated, while the three newest results receive a larger bounded allowance. Inline media and file payloads are replaced with bounded placeholders in the summary request; durable URI and artifact references remain available to the summarizer without embedding their bytes. Each rendered item has a fixed byte limit, and the conversation prompt has a conservative byte budget that reserves at least half of the provider's context window for instructions, framing, and output. Later checkpoints fold in the previous checkpoint while preferring newer facts. Manual `/compact` uses the same retention policy; optional text after the command becomes the next user input. A successful durable-session compaction is appended as a canonical transcript replacement, so resuming uses the compacted history. The TUI shows the lifecycle and adds `context compacted` after a real replacement.
146146

147147
Compaction uses the selected model to produce the summary and can fail or be cancelled like other model work. An error such as `compaction agent returned an empty summary` leaves the previous transcript canonical; resolve the provider problem and retry `/compact`.
148148

0 commit comments

Comments
 (0)