feat: add adaptive compression candidates - #341
Conversation
|
Hey, I really like your idea, and ACP has been very helpful. It’s a really good project. The only issue I’ve run into is that it can sometimes over-compress. When that happens, the agent may compress information it still needs, which can cause it to redo work or lose track of the current task. I wanted to explore a way to compress only things that are genuinely no longer needed, while also allowing compression in different parts of the conversation instead of being limited to one broad range. The goal is to reduce context without making the agent lose its place. I’ve been testing this approach, and it has been working really well so far. I think it could complement the core project nicely. Thanks for building such a useful tool. |
|
review |
Review: feat: add adaptive compression candidates (agent review 1/2 — AGENTS.md §5.3 requires a second independent review before merge) Verdict: approve with minor findings — no blockers. Verified locally (branch
Design — strong points:
Findings (all minor, non-blocking):
Performance note (observation, no action needed): candidate planning runs on every message transform (every LLM call). |
|
简述这个修复思路 以以及为什么过度压缩 |
为什么会出现过度压缩(根因)
这个 PR 的修复思路 核心一句话:把"命令你压这些范围"改成"给你一批结构上保证可提交、彼此独立的候选,你自己判断哪些真的不需要了再压"。
为什么这样能抑制过度压缩:粒度上,模型可以只压掉那个过期的工具输出(MICRO),不动相邻还有用的推理;结构上,pair-safe 边界让"只压一半"第一次变得安全可行;语义上,"什么还需要"的判断权交还给模型,系统只负责保证"列出来的东西提交了一定有效"。 |
|
这个问题也提交到内核一份 应该有一样的问题 拆分出两个 一个是候选算法 候选算法支持拔插 一个是压缩提示词 提交两个 issue 到 acp kernel |
内核仓库确认为 Issue 1 Title: Issue 2 Title: 两点说明:① 两个 issue 都引用本 PR 作为参考实现(未合并前是 prior art,合并后可直接摘代码);② 候选算法的"拔插"沿用了内核里 quality-gate 已有的 registry 模式(register/get/list),保持内核 API 风格一致。 |
收到,更正:内核是 沙箱内仍无创建 issue 的工具权限,两个 issue 内容如下,可直接创建: Issue 1 Title: Issue 2 Title: 与上一条的差异:① 目标仓库改为 acp-kernel;② 候选算法的拔插对齐内核已有的 |
|
再试试 你可以提交的 |
已提交,两个 issue 都在
两个 issue 均引用本 PR #341 作为参考实现,验收标准含"不破坏现有导出"。 |
|
Performance follow-up pushed in After the first compression, OpenCode still sends ACP the full raw transcript every transform. I found that the adaptive planner was validating candidates on turns where a nudge could not fire, and block sync rebuilt per-message membership arrays on every transform. This follow-up:
Validation: independent full suite |
增量审查: 本地独立验证(pr-341-review @ a04876e): 逐项核查:
测试质量(§5.6):"no-nudge turns skip candidate planning" 用 Proxy 计数属性访问断言规划确实没跑( 遗留提醒(均非本次引入):
|
|
Final update: I merged current I also finished the post-compression performance follow-up:
The final regression proves an old large tool output appears as Final local validation: |
Reviewed the merge commit What I verified
Minor notes (non-blocking)
Nice work on the truncation-parity catch — that was the subtlest interaction in the merge. |
|
ework帮忙看看为啥ci失败,另外看看这个有对应的issue追踪吗?如果没有搞一个 |
查完了,CI 失败原因明确: 根因:fork PR 拿不到
没有现成的追踪 issue(按 fork / NPM_TOKEN / build-artifact 搜过 open+closed),已新建: 👉 #366 fix(ci): build-artifact fails on fork PRs — NPM_TOKEN secret unavailable to pull_request from forks 里面附了证据、影响面和修复建议:给 publish 步骤加 guard( |
Summary
This PR adds executor-safe adaptive compression candidates while preserving ACPs existing range compression lifecycle.
acp_statusoutput.Motivation
Broad contiguous recommendations can force the model to compress useful reasoning together with a stale tool artifact. DCP-style message priority signaling is useful, but independent message compression can break tool call/result context. This approach improves target precision without introducing a new mode, tool, persisted state format, or automatic compression.
Compatibility
Existing
compressrange calls, arbitrary ranges, batch behavior, protection rules, quality gates, persisted block state, decompression, search, and T1/T2/T3 behavior remain available. No new runtime dependencies or config migrations are introduced.Validation
npm test: 1045 passednpm run typecheck: passednpm run build: passedSKIP_BUILD=1 ./scripts/e2e/run-e2e.sh: 13 passedgit diff --check: passedAuthor: Drex