feat(prompts): per-summary length-budget guidance in rules and nudges (billion-context#888) - #321
ranxianglei wants to merge 1 commit into
Conversation
… (billion-context#888)
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)In your adapter project: npm install acp-kernel@pr-321Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf acp-kernel-pr321.tgz
npm install ./packageThis comment is automatically updated on each push. |
[bot] 🏷 收到。这是 [PR] 类型 issue,我先拉取对应 PR 分支核对代码、跑本地验证(typecheck/test/build)、确认 CI 状态,然后给出审查结论。稍等片刻。 |
[bot] 🏷 PR #321 审查结论:可以合并(按仓库规则合并操作由人类执行)。 核对过程(非重做,仅验证):
两个非阻塞观察(均为存量问题,不在本 PR 范围,仅在此线程记录):
中文摘要: 逐行核对了 PR 代码并本地复跑 typecheck/test(807/807)/build 全绿、GitHub CI 四项全过,改动干净且只动 Prompt 文案层(属人工合并范畴,无 wire/状态/依赖变更),可以合并。 |
|
简述改了什么提示词 |
[bot] 🏷 本 PR 新增的提示词共三处(均为纯文案,不硬编码任何数字): 1.
2. Nudge 里的即时提醒(默认 ~136 字符,gentle / emergency / tier 三条 nudge 路径都会带;
3. Lean pack 的精简版一行(
设计意图:完整规则只在 #1 写一次(承重规则层),#2 只是"当下提醒",#3 给紧凑面用;三者都不带具体数字,所以 |
|
Owner redirect in ranxianglei/billion-context#888: constraining the model into shorter/split summaries degrades summary quality (opencode-acp lesson). The agreed root-cause fix is instead to expand the summary length limit so it scales with the compressed range size. This PR's approach is superseded — closing without merge. Branch kept for reference. |
Problem (ranxianglei/billion-context#888)
Dense subagent workloads repeatedly hit:
validateCompressionRangerejects the WHOLE compress call atomically when any single summary exceedsmaxSummaryLength. Dense ranges tempt the model into one giant monolithic summary, and no prompt surface ever mentioned the per-summary cap or that large/dense ranges should be split — so retries repeated the same failure.The original stopgap appended a hardcoded note at the host (billion-context) after kernel rendering. Per owner review in #888, the guidance belongs in the kernel: it must ride the prompt governance layer (configurable via
compress.prompts.*, overridable per prompt-pack) instead of bypassing it.Changes
src/compression-rules.ts— append aPER-SUMMARY LENGTH BUDGETparagraph toHOW_TO_COMPRESS_RULES: hard cap exists; one oversized summary fails the whole call; large/dense range → split into several smaller ranges at logical boundaries, each with its own concise summary, batched in one call; prefer several tight blocks. No number is hardcoded (stays correct under any cap configuration); byte-stable for the prefix cache. All three system-prompt builders inherit it viaprompts.howToCompressRules, so every host using the kernel builders gets it, including preflight-style summarization prompts.src/nudge-text.ts— new tri-state nudge sectionsummaryBudget(string replaces / null removes), defaulting to a ~140-char at-the-moment reminder emitted on all three paths (gentle, emergency, tier). Kept deliberately short so lean surfaces don't need to override it; the full rule lives once in HOW_TO_COMPRESS_RULES.src/packs.ts—summaryBudgetadded toNUDGE_SECTION_KEYSso packs can replace/disable it; lean pack's condensed contract (LEAN_HOW_TO_COMPRESS) gains a one-line budget rule (~130 chars vs ~700 full).summaryBudget; lean length cap raised 2600→2800 for the added line; golden prompt fixtures re-baselined (diff is exactly the appended paragraph, verified by inspection).Design notes
howToCompressRulesrather thancompressPhilosophy— this is a HOW-TO rule, not philosophy; both are embedded in nudges anyway, so nudge cost is identical either way.resolvePrompts({howToCompressRules}, {acknowledgeRisk:true})already overrides the whole rule text, and packsurface.prompts.howToCompressRules/nudgeSections.summaryBudgetnow cover both carriers.Verification
npm run typecheck— cleannpm test— 807/807 passnpm run build— successFollow-up
After this publishes: billion-context PR ranxianglei/billion-context#889 will drop its local stopgap note and bump the acp-kernel pin to this version.