feat: double soft-nudge growth step to 100K and log fold geometry on applied (#359) - #360
feat: double soft-nudge growth step to 100K and log fold geometry on applied (#359)#360ranxianglei wants to merge 2 commits into
Conversation
📦 Built Extension ArtifactBranch: Option A — Install from npm PR tag (recommended)pi install npm:billion-context-pi@pr-360Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pi-pr360.tgz
pi install ./packageThis comment is automatically updated on each push. |
69c4b83 to
21dc145
Compare
[bot] 🏷 Review complete — verified, two small issues fixed directly on the branch, mergeable. Duplicate screening. No duplicate. Lineage check: this PR closes #359, which was itself screened in its own triage against #343 (related-but-not-duplicate: #343 concluded the cache re-pay is inherent to in-place compression and locked by Diff hygiene. Pass. 8 files, all directly related to #359 ( Claim-by-claim verification (checked against acp-kernel 0.0.62 source, which is what this merges onto):
Fixed directly on the branch (commit
Mergeability. The branch had drifted behind master (#352/#353/#357/#358 landed since, including the kernel pin 0.0.60→0.0.62). I rebased it onto current master Verdict: ready to merge once CI checks pass. 中文摘要:核对并修复了两个小问题——补上了缺失的 CHANGELOG 条目、更正了重注入窗口边界注释(233K→正确的 ≤225K),并把分支 rebase 到最新 master(kernel 0.0.62)后全量验证通过(typecheck 干净、695/698 通过、构建正常),可以合并。 |
Closes #359
What
Two changes from #359 (fold-cadence cache economics), both adapter-level — no acp-kernel release needed:
1. Soft-nudge growth step default 50K → 100K (
src/config.ts)Per the corrected economics in #359 (fold re-pay is
(1−hit)×V', not~0.75V; summary output at ≈3–5× input price is a real per-fold cost), folds are net-positive even at the old cadence — so the rationale for raising the threshold is lowering interruption frequency and per-fold summary output overhead, not break-even. New defaultDEFAULT_NUDGE_GROWTH_TOKENS = 100_000applies when the user doesn't setcompress.nudgeGrowthTokens; explicit values still win. The kernel's own 50K default is untouched (other hosts keep their cadence); for windows ≤1M tokens the kernel's adaptive formula resolves the effective step togrowthFlooranyway, so this cleanly doubles the cadence.Side effect documented in CONFIGURATION.md(zh): the same-turn re-inject floor rises 22.5K → 45K tokens (
max(minGrowthFloor, minGrowthRatio × adaptiveGrowth)).2. Fold-geometry fields on
event=applied(src/compress-tool.ts)Each successful fold now logs its invalidation geometry straight from the log, no experiments needed:
firstFoldStartPct= token offset of the earliest fold start / pre-fold view ≈ expected first-round prompt-cache hit fraction after the fold (earliest newly-covered message, or the anchor of a block consumed by tier distillation); measured on the same list/scale asbeforeTokensretainedPctUpperBound= afterTokens/beforeTokens — an upper bound on prefix retention (longest common prefix of pre/post renders can never exceed the surviving token fraction)Invariant:
firstFoldStartPct ≤ retainedPctUpperBound. Fields only appear when blocks were actually created.Tests (653 total, 650 pass / 0 fail / 3 pre-existing skips)
firstFoldStartTokens(prefix scale, covered-id exclusion, null case)acp.logwith sane bounds on a real foldtests/nudge-reinject.test.tsrecalibrated: its scenarios were built around absolute deltas of the old 50K step; with the 45K re-inject floor and the 100K drop-reanchor span they become geometrically impossible under small windows, so the two affected tests run against 280K windows (the third, emergency-bypass, is unchanged)Diff hygiene
8 files, all directly related to #359:
src/config.ts,src/compress-tool.ts, 5 test files, 2 config docs. No version bump, no lockfile change, no unrelated churn.中文摘要:把 Pi host 的软压缩 nudge 步长默认值从 50K 提到 100K(降低折叠打断频率与每次折叠的摘要输出开销,内核默认值不动),并在
event=applied日志中新增firstFoldStartPct/retainedPctUpperBound两个失效几何观测字段,使缓存失效几何可从日志直读。测试全绿(650/650),可以合并。