feat(desktop,agent): compaction threshold slider, real-occupancy thresholds and live context capacity pins - #8256
Conversation
…sholds and live context capacity pins
…copy The compaction slider, context capacity pins, and real-occupancy plumbing add ~9 KiB of always-loaded JS and ~1.6 KiB per zh/zh-TW locale dictionary over the upstream baseline, plus a few lines of Go and TS that nudge file-size budgets. Record the growth in the repolint baseline and raise the two bundle budgets by the same amount, keeping their guard value. Separate from the feature commit so the functional diff stays reviewable.
|
Thank you. I will start the review once you are ready. |
|
Thanks for the thoughtful UI work and focused tests. I reviewed this branch against the latest #8244 has now landed and intentionally replaced the former multi-threshold maintenance path with one cache-first
This also exposes a semantic mismatch in the current four-thumb UI: in this branch, Snip is not an independent trigger at 60%. Tool-result cleanup starts only when Compact is reached (80% by default), and Snip is the target the cleanup result must fall below to avoid summary compaction. Presenting it as a separate cleanup trigger would therefore be misleading. A mechanical rebase would either leave three slider thumbs disconnected from runtime behavior or require reverting #8244's cache-first contract, which could cause earlier prompt rewrites and lower prompt-cache reuse. #8265 has also removed the ContextPanel short-view block, so that block should not be reintroduced during conflict resolution. The parts that still fit the current architecture are valuable:
Could you please re-scope this PR around the current single-threshold architecture and preserve #8265's ContextPanel deletion? If four independently configurable thresholds are still desired, that should be a separate product/architecture proposal because it changes the behavior and cache guarantees established by #8244. |



What
Turns the single
compact_ratioknob into four explicit, independentlyconfigurable compaction thresholds (soft / snip / compact / force), exposes
real context occupancy end-to-end, and renders all four as live pins on the
desktop context gauge with a draggable settings slider.
compactThresholds()now computes soft/snip/compact/forceboundaries from the four ratios; the existing prune-then-summarize tiered
pipeline keys off the real context shape (
ContextPromptTokens) withbillable-token fallback. Config re-validation keeps the chain
soft < snip < compact < forcelegal on every change.reasonix config compact-ratio [--local] [VALUE]accepts10–95%; new
snip-ratiocommand accepts 5–95%. Project-local valuesoverride the shared user config used by desktop and new CLI sessions.
SessionHistory.CompactThresholds()andContextInfo's soft/snip/force ratios feed the desktop gauge; thesettings view exposes the slider.
occupancy ring (
ContextReport+ maintenance), context capacity pins inthe overview, and per-threshold copy in zh/zh-TW.
Docs:
docs/SPEC.mdcontext-maintenance section rewritten for the tieredthresholds (removed the "65–85%" single-threshold description).
Commit 2 is the ratchet/budget bookkeeping only (repolint baseline growth +
bundle budgets for the added code and locale copy), kept separate from the
feature diff for review.
Verification
go build ./internal/...andgo build ./...(desktop) passgo vetclean oninternal/agent,internal/control,internal/configgo test ./internal/agent/ ./internal/control/ ./internal/config/passpnpm exec tsc --noEmitcleannode scripts/check-bundle-budget.mjsall PASSgo run ./tools/repolintclean (1958 baselined findings)Cache-impact: none - compact* changes are threshold getters/computation only; the provider-visible prefix stays byte-identical
Cache-guard: no prefix-assembly path changed; run
go test ./internal/boot/(prefix stability effect tests) plus the agent/control/config suites aboveSystem-prompt-review: complyue (author) - internal/config threshold keys feed the config surface but do not alter the byte-stable system-prompt prefix
Documentation-impact: updated - docs/SPEC.md context-maintenance section rewritten for the four tiered thresholds