Skip to content

compress: add blockIds for non-contiguous block distillation (T2/T3) - #83

Open
ranxianglei wants to merge 3 commits into
masterfrom
2026-08-08_compress-blockids
Open

compress: add blockIds for non-contiguous block distillation (T2/T3)#83
ranxianglei wants to merge 3 commits into
masterfrom
2026-08-08_compress-blockids

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

What

Adds a blockIds field to the compress tool 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=bN resolves 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. b3 and b7) into T2, it had no way to express that, so it dropped boundaries and stuffed the block list into the summary text. blockIds fixes this: it consumes exactly the listed blocks and leaves everything between them visible.

Changes

  • src/compress-tool.ts: RangeSpec gains optional blockIds: string[]; startId/endId now optional. Handler passes blockIds through to acp-kernel. Tool description / promptSnippet / promptGuidelines updated.
  • src/system-prompt.ts: T2/T3 block-distill guidance now recommends blockIds (primary) and explains the startId/endId span alternative.
  • tests/compress-blockids.test.ts: schema accepts blockIds-only entry; end-to-end distillation of two non-contiguous T1 blocks into a T2 block.

Depends on

acp-kernel PR #41 (blockIds support in applyCompression). The acp-kernel version 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). typecheck clean, 72/72 tests pass, build OK (397 KB).

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
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