feat(absorb): instant tool-result compression for small contexts (#14) - #208
Open
ranxianglei wants to merge 1 commit into
Open
feat(absorb): instant tool-result compression for small contexts (#14)#208ranxianglei wants to merge 1 commit into
ranxianglei wants to merge 1 commit into
Conversation
Registers the absorb tool when acp.json enables it (absorb: true or an
absorb object). Large tool results get a forced [ACP absorb] prompt via
the kernel pipeline; the model calls absorb({ ref, summary }) and the
original tool-call+result pair is hidden from later turns, the summary
becomes the durable record. Absorb calls stay ordinarily compressible.
- src/absorb-tool.ts: tool handler (kernel applyAbsorb, parseAbsorbInput)
- src/config.ts: AbsorbSettings + resolveAbsorb + resolveConfig mapping
- src/index.ts: registration, session-start re-registration, system prompt
- src/user-config.ts: acp.json key (boolean or object)
- tests/absorb-tool.test.ts: 6 tests (config, registration, prompt gating,
hide+keep-summary, error paths, system prompt section)
- CONFIGURATION.md / CONFIGURATION.zh-CN.md / CHANGELOG.md
Requires acp-kernel with the absorb API (branch 2026-08-23_absorb-tool,
to be released before the adapter release bumps its pin).
Merged
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.
Implements #14 (adapter side; kernel side is ranxianglei/acp-kernel#139).
What
Small-context setups (e.g. a 10K window) can't wait for the regular nudge-based compression — the model runs out of room. This adds the
absorbtool: when enabled, large tool results (default ≥1000 estimated tokens) get a forced[ACP absorb]suffix demanding the model immediately callabsorb({ ref, summary }). After absorption the original tool-call+result pair is hidden from later turns; the summary-carrying absorb call is the durable record. Absorb calls stay ordinary tool calls — the regular compression system can fold them into blocks later (orthogonal).Config (
acp.json){ "absorb": true }or tuned:
absorb.minToolTokens(1000),absorb.contextThresholdPct(0 = size alone decides),absorb.excludeTools([]),absorb.toolName("absorb"). Documented in CONFIGURATION.md + CONFIGURATION.zh-CN.md.Changes
src/absorb-tool.ts— tool handler (kernelapplyAbsorb+parseAbsorbInput), follows compress-tool patterns (throw on error so pi marks isError)src/config.ts—AbsorbSettings,resolveAbsorb(boolean shorthand + % parsing),resolveConfigmappingsrc/index.ts— registration when enabled, re-registration on session_start (acp.json reload), absorb system-prompt sectionsrc/user-config.ts—absorbkey (boolean or object)tests/absorb-tool.test.ts— 6 tests: config mapping, gated registration, forced prompt on large results only, hide-pair+keep-summary end-to-end, error paths, system prompt sectionNotes