zirvDocs

DocsSupervision (zirv ctx)

Signals and verdicts

README.md, lines 4709–4747View source

Five signals over the trailing window (default 10 turns):

  1. Context size (a gate, not a vote). The floor and ceiling scale with the model's real context window (issue #155): by default the floor sits at 50% of capacity and the ceiling at 80% (score.token_floor_ratio/ token_ceiling_ratio), so a 200k-token seat still gates at 100000/160000, the pre-ratio absolutes, and a 1M-token seat gates at 500000/800000 instead of restarting at the same 160000 tokens with 840k of headroom left. When no capacity is known (codex today), the absolute 100000/160000 fallbacks apply unchanged. score.token_floor/ token_ceiling still pin an exact number outright, overriding the ratio. Below the floor the verdict is always healthy; at or above the ceiling it is at least compact.
  2. Tool-failure rate (weight 40).
  3. Repetition loops, three or more identical tool calls with identical input (weight 30).
  4. Reply-marker misses on final answers (weight 30, active only when the marker hook is installed and the session is at least 10 turns old).
  5. Same-error loops (weight 120 by default, score.same_error_weight): the longest run of consecutive identical (normalized) tool-result errors across different attempts, distinct from the repetition signal above, which needs the identical call repeated. Trips at score. same_error_threshold repeats (default 3); 0.0 restores the pre-#763, fully inert behaviour. The default weight is calibrated, not measured, so that a freshly-tripped streak alone -- the ramp's lowest nonzero point, 1 / same_error_threshold -- raises an otherwise healthy score to exactly advise_at's default (40): the first action this signal can ever cause is an advisory ("the fix isn't landing, try a different approach"), never an immediate compact/restart. Further repeats ramp it the same way every other signal ramps, through the identical weighted-sum/threshold verdict below.

Verdicts: score 40 or more is advise, 60 or more is compact, 80 or more is restart. At the token ceiling a score of 60 or more escalates to restart. Without the marker signal (Claude without the prompt hook, or any agent that cannot carry one) behavioral signals top out at 70, so a restart there comes only from the token ceiling.

Try the rule#

Interactive, and not part of README.md: score_from and verdict_for from src/commands/ctx/rot.rs, with the shipped defaults. Move a control and the score, verdict and context gate recompute.

score = round(clamp(
    40 × tool_failure_rate     0.10  →    4.0
 +  30 × ramp(max_repeat, 3)      2  →    0.0
 +  30 × marker_miss_rate      0.00  →    0.0
 + 120 × ramp(same_error, 3)      3  →   40.0
 , 0, 100))                              =  44

ramp(n, t) = 0 if n < t, else min(1, (n + 1 − t) / t)
advise, score 44

Between the floor and the ceiling the score decides: 40 advises, 60 compacts, 80 restarts.

10%

Failed tool results in the last 10 turns.

2

Nothing below 3; full weight at 5.

0%
3

Trips at 3; weight 120, so 5 repeats saturate the score.

64%

The gate. Below 50% nothing escalates.

Load an example