compress: add blockIds for non-contiguous block distillation (T2/T3) - #83
Open
ranxianglei wants to merge 3 commits into
Open
compress: add blockIds for non-contiguous block distillation (T2/T3)#83ranxianglei wants to merge 3 commits into
ranxianglei wants to merge 3 commits into
Conversation
RangeSpec now accepts blockIds: ["b3","b7"] as an alternative to startId/endId. When blockIds is a non-empty array, the kernel consumes exactly those blocks (non-contiguous OK) and creates one higher-tier block, leaving intervening raw messages visible. startId/endId are now optional. System prompt + tool docs updated to recommend blockIds for T2/T3 distillation. Mirrors acp-kernel PR #41.
- e2e test now asserts T2 tier, b1/b2 consumed (active=false), effectiveMessageIds = exactly the two source blocks' messages, and intervening entry e3 stays visible (not folded into T2) - add boundary-less guard: handler rejects entries missing both startId/endId and blockIds with a clear message before the kernel surfaces the misleading 'content too small (0 chars)' error
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.
What
Adds a
blockIdsfield to thecompresstool so the model can distill specific non-contiguous blocks into a higher-tier block — the gap exposed by the T2-distill failure on issue #7.Why
startId=bN, endId=bNresolves to a contiguous span that consumes everything in the range (intervening raw messages included). When the model needs to distill a hand-picked set of T1 blocks (e.g.b3andb7) into T2, it had no way to express that, so it dropped boundaries and stuffed the block list into the summary text.blockIdsfixes this: it consumes exactly the listed blocks and leaves everything between them visible.Changes
src/compress-tool.ts:RangeSpecgains optionalblockIds: string[];startId/endIdnow optional. Handler passesblockIdsthrough toacp-kernel. Tool description / promptSnippet / promptGuidelines updated.src/system-prompt.ts: T2/T3 block-distill guidance now recommendsblockIds(primary) and explains thestartId/endIdspan alternative.tests/compress-blockids.test.ts: schema acceptsblockIds-only entry; end-to-end distillation of two non-contiguous T1 blocks into a T2 block.Depends on
acp-kernel PR #41 (
blockIdssupport inapplyCompression). Theacp-kernelversion pin is NOT bumped here — it will be bumped in a release commit once acp-kernel #41 is merged + published, per the cross-repo release workflow (AGENTS.md §5).Local validation: acp-kernel blockids build overlaid onto
node_modules/acp-kernel/dist(AGENTS.md §5 pre-validation).typecheckclean, 72/72 tests pass, build OK (397 KB).