feat: smart nudge gating — soft-block + recommendation filtering - #142
Merged
Merged
Conversation
…racking Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
…y succeeds Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
…dominated recommendations Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
…compat Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
…parameter Switches from two-attempt state tracking (lastSegmentConfirmAttempts) to explicit opt-in via `dangerous: true` parameter. Removing all state infrastructure for the soft-block — the check is now completely stateless. Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
…rous flag Replaces old rules (5x huge threshold, single-msg filter, protected dominance checks) with a single coherent design: - Last segment: excluded if < 2x growth threshold; included with dangerous flag if >= 2x - Gate: effective compressible = non-last + max(0, last - 2x floor); suppress all if < growth threshold - Protected ranges no longer affect filtering logic - formatCompressibleRanges uses dangerous flag instead of position for annotation Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
…ve compressible gate) smart-nudge-gating.test.ts: complete rewrite with 17 tests covering last-segment floor, effective compressible gate, dangerous flag propagation, and 200K proportional thresholds. inject.test.ts: increase tool output data from 120K to 320K chars so ranges pass the new 100K last-segment floor. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
FiltersRecommendedRanges now logs input ranges, thresholds, last-segment analysis, effective compressible, and final suppression decision to the daily debug log. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
…age when debug=true Uses the existing sendIgnoredMessage mechanism (ignored: true, noReply: true) to display the filter decision in the conversation UI without sending it to the model. Shows input ranges, thresholds, last-segment analysis, effective compressible, and suppression decision. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
…rwrite on restart opencode resolves @latest against the npm registry on startup. If the local cache version is older than npm's latest, it re-downloads and silently overwrites local deploys. The deploy script now queries npm view and bumps the deployed package.json version to npm+1patch when local <= npm. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three improvements to compression recommendation behavior:
Soft-block on last segment (Req 1) — First compress attempt covering the most recent message is rejected with a confirmation prompt. The
lastMessageIdis persisted inNudges.lastSegmentConfirmAttempts. Retry (same lastMessageId) succeeds. Configurable viacompress.lastSegmentSoftBlock(default: true).Single-message range filtering (Req 2) — Single-message ranges excluded from recommendation unless tokens > 5× growth threshold (25% of context at 5% config).
Protected dominance filtering (Req 3) — Suppresses all recommendations when: besides last range all others protected, 70%+ protected, or remaining compressible < 5% of context. Huge single segment (> 25%) overrides.
Files Changed
lib/state/{types,state,persistence,utils}.ts—lastSegmentConfirmAttemptsfieldlib/config.ts—lastSegmentSoftBlock?: booleanoptionlib/compress/{pipeline,range,message}.ts— soft-block logiclib/messages/inject/{utils,inject}.ts—filterRecommendedRanges()Test Results