diff --git a/docs/CATALOG.md b/docs/CATALOG.md index b74df0ba1a1..9679f629317 100644 --- a/docs/CATALOG.md +++ b/docs/CATALOG.md @@ -76,7 +76,7 @@ plugin manifests and kept in sync by CI — never hand-edit it; the category voc - [`claude-memory`](../plugins/claude-memory) — Keeps a repo's Claude Code memory layer healthy and under your control, against criteria derived from official Claude Code documentation. The audit skill checks the instruction/memory layer (CLAUDE.md, CLAUDE.local.md, .claude/rules/, auto-memory) with a deterministic script-backed spine plus judgment-tier checks. The stateless skill inspects, disables, and (confirm-gated) purges Claude-written auto memory across all settings scopes. - [`claude-ops`](../plugins/claude-ops) — Claude Code operations toolkit. Seven skills: observability (read locally captured telemetry — OTEL store, collector, hook-event JSONL, ccusage — with trend reports and store pruning), known-issues (search known Claude product GitHub bugs, check service health, maintain a persistent tracked-issue registry), changelog (ingest Claude Code changelog entries and integrate them into the current repo), plugins (bring a machine's plugin fleet current on demand — marketplace refresh, effective-scope updates including in-repo project/local installs, new-plugin install per policy, scope-divergence detection and explicit convergence), morning-brief (read-only gh-based operator morning view — queue-label counts, merge-ready PRs, parked decisions with their RECOMMENDED lines, and loop-lane telemetry freshness), lanes (start/restart/stop/status loop lanes as named background Claude Code sessions seeded from canonical prompt files, with per-lane model/effort, a repo-pull + marketplace-refresh launch step, and a consume-restarts action — an OS-schedulable reader that relaunches stopped lanes whose telemetry carries a restart_request), and a re-runnable setup action that settles where the known-issues registry lives. Plus a family of seven advisory *-audit telemetry-emitter hooks (API errors, config changes, instruction loads, permission denials, pre-compaction, skill usage, tool failures) that emit the shared hook-telemetry envelope, and a reference sink that maps envelopes into the hook-events.jsonl the observability skill reads. - [`rate-limit-guard`](../plugins/rate-limit-guard) — Shared rate-limit guard for loop lanes: a statusline wrapper tees the subscription rate-limit windows to a fixed machine-scope file, a StopFailure hook records rate-limit stops reactively, and a reader contract fixes how consuming sessions pause and resume. -- [`context-guard`](../plugins/context-guard) — Per-session context-window observability plus the first shipped consumer: a statusline wrapper tees each session's context_window fields to a per-session snapshot file, a zone resolver classifies usage into smart/acceptable/dumb bands (percentage bands plus window-class token bands, conservative-min combination, zones.json SSOT with shipped defaults), a reader contract fixes how consuming sessions interpret the snapshots, and zone-crossing hooks inject continuation guidance once per transition into a worse zone (advisory by default; an optional blocking mode gates new mutating work on a fresh dumb-zone snapshot with handoff-writing exempt), with a PostCompact hook persisting an evidence-degraded marker. +- [`context-guard`](../plugins/context-guard) — Per-session context-window observability plus the first shipped consumer: a statusline wrapper tees each session's context_window fields to a per-session snapshot file, a zone resolver classifies usage into smart/acceptable/dumb bands (percentage bands plus window-class token bands, conservative-min combination, zones.json SSOT with shipped defaults), a reader contract fixes how consuming sessions interpret the snapshots, and zone-crossing hooks report once per transition into a worse zone across two channels — the continuation menu to the operator, who owns that choice, and to the model only the zone determination plus the counter-steer that a zone word is not a decay signal (advisory by default; an optional blocking mode gates new mutating work on a fresh dumb-zone snapshot with handoff-writing exempt), with a PostCompact hook persisting an evidence-degraded marker. - [`plugin-quality`](../plugins/plugin-quality) — Post-use behavioral audit of Claude Code plugin components: a six-step audit workflow (evidence capture, grounded mapping in a fresh subagent, blindspot pass, interactive contract lock, presence-gated review seams, work-item emit with draft+confirm) over any skill, agent, hook, command, or config you have actually used — zone-informed by context-guard snapshots when present, conservative when not. - [`skill-quality`](../plugins/skill-quality) — Skill-authoring QA tooling: a static contract checker that runs twenty-two deterministic checks over a Claude Code skill (frontmatter, per-skill listing-entry cap, trigger-keyword preservation, line caps, broken internal refs, markdownlint, gotchas surface, evals presence, precompute opportunity, injection shell-declaration, fresh-eyes declaration conformance), a shared skill-listing budget reporter across a set of skills, and a bundled evals.json schema for validation. Runs against any repo's skills directory via the convention-resolution ladder — no baked layout. diff --git a/docs/conventions/hook-observability/README.md b/docs/conventions/hook-observability/README.md index 54e0b8954e8..64d8eab82b3 100644 --- a/docs/conventions/hook-observability/README.md +++ b/docs/conventions/hook-observability/README.md @@ -38,7 +38,7 @@ phrase naming what the hook is doing, specific to the tool or check (`"Formatting Go imports..."`, `"Checking for secrets..."`, `"Recording tool-failure telemetry..."`) — not a generic `"Running hook..."`. -### 2. `systemMessage` — user-visible, scoped to silently-skipped features +### 2. `systemMessage` — user-visible, scoped by who can act on the content An exit-0 JSON output field (`hookSpecificOutput` sibling), 10,000-character cap, shown to the user immediately. Composed via `hook::emit_channels` / `hook::emit_skip_notice` @@ -76,10 +76,40 @@ count, or the disclosure becomes the noise problem it was meant to prevent. - **Exit-2 blocking paths.** A `PreToolUse` hook that blocks a tool call via exit code 2 is already user-visible through Claude Code's own permission-denial UI. An additional `systemMessage` on top of a block would be redundant, not more observable. -- **Legitimate advisory findings.** A hook that surfaces a finding to Claude for it to act on - (e.g. a lint result, a suggested fix) belongs on `additionalContext` only — that is the correct - channel for agent-actionable content, not a gap. This is the case the content-mutation clause - above is deliberately distinguished from: reporting is agent-scoped, rewriting is not. +- **Legitimate advisory findings *the model can act on*.** A hook that surfaces a finding to Claude + for it to act on (e.g. a lint result, a suggested fix) belongs on `additionalContext` only — that + is the correct channel for agent-actionable content, not a gap. This is the case the + content-mutation clause above is deliberately distinguished from: reporting is agent-scoped, + rewriting is not. + + **The predicate is load-bearing, and it is *who can act*, not *how routine the content is*.** The + harm this bullet names is misrouting **agent-actionable** content to the user channel. Content the + model is *forbidden* to act on is not agent-actionable, so the bullet does not reach it — and + routing such content to `additionalContext` anyway is the mirror-image defect, because an + instruction the model cannot act on still shapes what it does. + + **Carve-out, admitted only on all three conditions together** — a conjunction, never a judgment + call, because a soft "when it seems important" is exactly the drift the closing bullet guards: + + 1. the payload states a **choice among actions whose only legitimate actor is the human** — + because a rule the consuming project holds forbids the model to act on it (a session-lifecycle + or harness-command choice is the usual shape), not merely because a human might also care; + 2. the model channel **separately carries the determination the model does need**, so nothing + agent-actionable is lost by keeping the choice off it; and + 3. the emission is keyed to a **state transition**, not to every invocation. + + **Delivery may never be asserted.** The model channel may state that a choice belongs to the + operator; it may **never** state that the operator has seen it. No documented behavior tells a hook + whether an operator is present — `systemMessage` is documented only as a message shown to the user, + and nothing upstream describes its behavior in non-interactive runs — so a delivery claim is a fact + the hook cannot know in *any* mode, not only headless ones. Emitting to an unread operator channel + is harmless; telling the model a human holds the choice when none does is not. + + **Honest limit.** The docs state that `additionalContext` is inserted into the conversation and + saved to the transcript, and say no such thing about `systemMessage`; that the latter stays out of + model context is *inferred from the asymmetry*, not stated. If that inference is ever falsified, + this carve-out collapses — content forbidden to the model would reach it either way — and the + correct response is to drop the payload, not to re-route it. **Repeat-notice discipline.** A missing-prerequisite notice behind a broad matcher (every `Write|Edit`, every `Bash` call) must not repeat on every invocation. Use `hook::require_jq` @@ -127,9 +157,10 @@ melodic-software/claude-code-plugins#930. - **Not a new telemetry schema.** The envelope shape is `hook-telemetry`'s concern; this doc only states the adoption requirement. - **Not a blanket "add systemMessage everywhere" rule.** Scoped narrowly to the - missing-prerequisite-skip case and the unrequested-content-mutation case; over-applying it to - blocking paths or advisory findings is itself a conformance defect (redundant user noise, or - misrouting agent-actionable content to the user channel). + missing-prerequisite-skip case, the unrequested-content-mutation case, and the three-condition + human-only-choice carve-out above; over-applying it to blocking paths or to advisory findings the + model can act on is itself a conformance defect (redundant user noise, or misrouting + agent-actionable content to the user channel). - **Not a UI feature.** No native "verbose hooks" toggle exists in Claude Code as of 2026-07-22 (confirmed against the same fresh fetch this doc cites) — `statusMessage` and `systemMessage` are the sanctioned surfaces available today. An upstream feature request for a native @@ -143,6 +174,12 @@ Fleet audits check, per wired producer hook: - Every missing-prerequisite skip path emits a `systemMessage` (via `hook::require_jq` or `hook::notice_once` + `hook::emit_skip_notice`), gated so it fires once per session on a broad matcher. +- Any `systemMessage` that is neither a prerequisite-skip notice nor a content-mutation notice + satisfies all three carve-out conditions, and its model-channel counterpart asserts no operator + presence. Not mechanically gated — reviewed per hook. As of this writing `context-guard`'s + `zone-crossing-inject.sh` is the only site in the fleet admitted this way; every other call site + is a prerequisite skip or a content-mutation notice, so a second one is a signal to re-read the + three conditions rather than to follow the precedent. - Every path on which the hook rewrote file content names what it changed on the user channel, bounded by a per-run cap with the remainder reported as a count. Not mechanically gated — reviewed per hook. The adopting reference is `plugins/typos-format/hooks/typos-format.sh`. diff --git a/plugins/claude-config/.claude-plugin/plugin.json b/plugins/claude-config/.claude-plugin/plugin.json index f39fde507ed..5fc6e4c9d70 100644 --- a/plugins/claude-config/.claude-plugin/plugin.json +++ b/plugins/claude-config/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/claude-code-plugin-manifest.json", "name": "claude-config", - "version": "0.25.0", + "version": "0.26.0", "description": "Six configuration-health skills (plus setup) for a repo's Claude Code configuration: audit (settings.json / .mcp.json / hooks / plugins / permissions drift), audit-automation-gaps (evidence-gated verdicts on automation gaps), audit-permission-grants (allow-rule / allowed-tools grants for auto-mode durability and portability), audit-instructions (locally-owned instruction surfaces vs current model capability — proposes removals/rewrites of instructions the model no longer needs, and detects cross-surface instruction conflicts), audit-pass (one coordinated, ordered, resumable pass over a named target — three-scope inventory, run-time-derived exclusion set, stable finding identity, suppression memory, resume, one human gate — delegating every check to the plugin that owns it), and unhobble (the empirical bare-baseline experiment: reversibly strip a repo's standing instructions, log real stumbles against the current model, re-add only what evidence earns).", "author": { "name": "Melodic Software", diff --git a/plugins/claude-config/CHANGELOG.md b/plugins/claude-config/CHANGELOG.md index 84edda620c5..0077e261add 100644 --- a/plugins/claude-config/CHANGELOG.md +++ b/plugins/claude-config/CHANGELOG.md @@ -3,6 +3,38 @@ All notable changes to the `claude-config` plugin are documented here. Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); this plugin uses semantic versioning. +## [0.26.0] + +### Added + +- **`audit-instructions`: I23 gains a pre-scan pattern, and the calibration it was waiting on is + now recorded** (catalog 1.20.0). The row shipped unseeded because the threshold and + window-position phrasings vary far more than the fixed shapes I8-b matches, and because a + continuation skill can barely be model-invocable without naming a context trigger somewhere — so + a loose pattern would have fired on every consumer's handoff skill. **What the seeding actually + waited on was a policy, not a regex.** It is now stated: three signals license a surface to route + into a handoff, a fork, or a new session — the user's own report, an instrument that measures the + window, and visible decay in the model's own output — and a self-estimated budget is none of the + three. Under that rule the population the blast-radius argument feared resolves into true + positives rather than noise. + + Two supporting clauses ship with it. **Residency is a severity input, not an admission test:** a + trigger in a `description` is resident whenever the skill listing admits it, which is the default + since `disable-model-invocation: true` also suppresses the description from context + (, verified 2026-08-08), while a body-borne trigger costs + context only on load or at subagent startup under preloading — both are findings, the resident one + merely costlier to leave. And **remediation moves the trigger rather than withdrawing the skill:** + flipping continuation skills to `disable-model-invocation: true` was considered and refused, since + it forfeits every model-side invocation the skill has to remove one clause. + +- **`instruction-scan.sh` emits `I23` candidate rows.** The pattern marks budget phrasing alone and + never the stop/summarize/hand-off verb it licenses, because the trigger and the action routinely + sit in different sentences; counter-steer text, documents about the pattern, and operator-facing + budgets therefore match too, on the same advisory over-production contract the I8 families carry. + It is deliberately not anchored to the bare term "context window" — ordinary vocabulary in any + surface discussing sessions, and matching it would return the corpus instead of a candidate set. + Measured over the marketplace's 193 skills the pattern yields 20 rows in 10 files. + ## [0.25.0] ### Added diff --git a/plugins/claude-config/skills/audit-instructions/SKILL.md b/plugins/claude-config/skills/audit-instructions/SKILL.md index 94f61920523..827e420cda1 100644 --- a/plugins/claude-config/skills/audit-instructions/SKILL.md +++ b/plugins/claude-config/skills/audit-instructions/SKILL.md @@ -270,12 +270,14 @@ instructed self-check, `I8-b` conservative-reporting, `I8-c` don't-think / don't tag-naming sub-detect is lane-only, not seeded, as are I8's base row and `I8-d` short-turn assumptions, whose phrasings are too varied for a pattern that would earn its false-positive rate; `I8-e` forced interim-status cadence is likewise unseeded, but on a narrower ground — its skeleton is -patternable, and it waits only on an attested instance to calibrate the interval forms against), and -I27 (effort-for-brevity: an effort-lowering directive paired with a brevity token on one line); -`--count` prints the row count. Advisory — a -grep cannot judge whether a rationale is genuinely present, whether a restraint clause is a -reporting gate, or which model a row targets, so the lane refines every candidate against the -catalog's fences and the run's resolved target model. +patternable, and it waits only on an attested instance to calibrate the interval forms against), I23 +(self-estimated context-budget phrasing — the budget clause alone, never the stop/summarize/hand-off +verb it licenses, which routinely sits in a different sentence), and I27 (effort-for-brevity: an +effort-lowering directive paired with a brevity token on one line); `--count` prints the row count. +Advisory — a grep cannot judge whether a rationale is genuinely present, whether a restraint clause +is a reporting gate, whether a budget mention is a directive or the counter-steer against one, or +which model a row targets, so the lane refines every candidate against the catalog's fences and the +run's resolved target model. Bound concurrency to 3–5 lanes at a time; the skills surface fans out one lane per skill. Before the total dispatch count (lanes plus Phase C verifiers) would exceed ~20, confirm with the user. diff --git a/plugins/claude-config/skills/audit-instructions/reference/criteria.md b/plugins/claude-config/skills/audit-instructions/reference/criteria.md index dbbfbd69670..6342503785b 100644 --- a/plugins/claude-config/skills/audit-instructions/reference/criteria.md +++ b/plugins/claude-config/skills/audit-instructions/reference/criteria.md @@ -1,5 +1,5 @@ --- -version: 1.19.0 +version: 1.20.0 last-updated: 2026-08-08 --- @@ -1356,16 +1356,38 @@ confident removals. that gates on a measured signal, or state the counter-steer plainly — that a count alone is not a decay signal, because decay shows up in the output rather than in the number. Where the harness genuinely must surface a count, pair it with a reassurance rather than with an exit menu. -- **No pre-scan pattern is seeded yet, and the reason is not I8-e's.** The phrasing is patternable - and an unfenced true positive **is** attested — a handoff skill whose own invocation triggers are - "context heavy (check `/context` output)", "quality degrading", and a window-position threshold, - which is the carve-back in the continuation fence above rather than the fence itself. So this row - is not waiting on an instance the way I8-e is; it is waiting on calibration of the threshold and - window-position phrasings, which vary far more than the shapes I8-b matches. **The blast radius is - why that calibration is owed before a pattern ships:** a continuation skill can barely be - model-invocable without naming a context trigger somewhere, and one such trigger lives in a - `description`, which is resident whenever the listing admits it rather than only when the body - loads. A pattern seeded before that line is drawn would fire on every consumer's handoff skill. +- **Which signals license a continuation, and which do not.** This is the calibration the row + shipped without, and it is a policy rather than a regex. Three signals license a skill or surface + to route into a handoff, a fork, or a new session: **the user's own report**, **an instrument that + measures the window**, and **visible decay in the model's own output** — drift, repetition, dropped + constraints. A **self-estimated budget is none of the three**, and a surface naming one as a + trigger is a finding wherever it sits. The third signal is the one the model reads for itself, and + it is legitimate precisely because it is the thing a count cannot see; a row that treated every + model-side continuation trigger as a defect would refuse it too, and refuse the guide's own + reasoning with it. +- **Residency is a severity input, not an admission test.** A trigger in a `description` is resident + whenever the skill listing admits it — the default, since `disable-model-invocation: true` also + suppresses the description from context ([Skills](https://code.claude.com/docs/en/skills), verified + 2026-08-08) — while a body-borne trigger costs context only once the skill loads, or at startup in + a subagent with the skill preloaded. Both are findings; the resident one is the more expensive to + leave. **Second-source recheck trigger:** that page's invocation-control table changing which + fields keep a description in context, which would re-rank the two residencies and is the only fact + this clause and the remediation below rest on. +- **Remediate by moving the trigger, never by withdrawing the skill.** Flipping continuation skills + to `disable-model-invocation: true` is the considered alternative and is refused: it costs every + model-side invocation the skill has — including the ones a user asks for in the words its + description exists to match — to remove one clause. Removing the clause costs only the behavior + the source counsels against. +- **Pre-scan seeded (`I23`).** The blast-radius argument that deferred the seeding — a continuation + skill can barely be model-invocable without naming a context trigger somewhere — was an argument + about a population whose disposition was unsettled. Under the licensing rule above that population + resolves: its members are true positives, not noise. **The pattern marks budget phrasing alone and + never the verb it governs**, because the trigger and the action it licenses routinely sit in + different sentences; the counter-steer text that forbids the behavior therefore matches too + (inverted polarity, exempt), as do documents about the pattern and operator-facing budgets. That + over-production is the same contract I8's families carry. It is deliberately **not** anchored to + the bare term "context window", which is ordinary vocabulary in any surface discussing sessions and + would return the corpus instead of a candidate set. - **Source:** Fable 5 guide, "Rare cases of context-budget concern" — "In very long sessions, Claude Fable 5 can occasionally suggest a new session, offer to summarize and hand off, or trim its own work. This is most often triggered when the harness shows a remaining-token countdown to the model. diff --git a/plugins/claude-config/skills/audit-instructions/scripts/instruction-scan.sh b/plugins/claude-config/skills/audit-instructions/scripts/instruction-scan.sh index 1f4f4b1ad6f..23ff53c9a72 100755 --- a/plugins/claude-config/skills/audit-instructions/scripts/instruction-scan.sh +++ b/plugins/claude-config/skills/audit-instructions/scripts/instruction-scan.sh @@ -26,6 +26,15 @@ # idiomatic uses ("do not think of this as…"), and substring near-misses # ("don't reasonably…") ARE emitted; the fences live in # reference/criteria.md, never here. +# I23 self-estimated context-budget trigger ("context is heavy", "running low +# on context", "remaining context", "check /context", "final third of the +# window"). The catalog's subject is a directive to judge one's own window +# and then stop, summarize, hand off, or trim on that basis — but the +# scanner marks the BUDGET PHRASING alone and never the verb it governs, +# because the two routinely sit in different sentences. It therefore also +# emits the counter-steer text that forbids the behavior (inverted +# polarity), documents ABOUT the pattern, and operator-facing budgets: +# all three are criteria-owned exemptions the model lane applies. # I27 effort-for-brevity candidates: a line pairing an effort-lowering # directive ("lower/reduce/decrease/drop … effort") with a brevity token # (short/brief/concise/terse/length/verbose/wordy). The model lane @@ -36,7 +45,8 @@ # # Rows are `file:line:check-id` (grep -n convention). With no rationale on a line # a prohibition surfaces as an I6 row; a line may surface once per matching check -# id (I6, I10, I27, and one of the I8 families). Nonexistent path arguments are +# id (I6, I10, I23, I27, and one of the I8 families). Nonexistent path arguments +# are # skipped, not errors. # # Usage: @@ -48,7 +58,7 @@ set -uo pipefail usage() { cat <<'EOF' -instruction-scan.sh — mark I6/I8/I10/I27 instruction candidates in given files. +instruction-scan.sh — mark I6/I8/I10/I23/I27 instruction candidates in given files. Usage: instruction-scan.sh [--count|--help] FILE... @@ -58,8 +68,9 @@ Usage: instruction-scan.sh [--count|--help] FILE... I8 pattern families (model-era candidates; model lane adjudicates): I8-a instructed self-check, I8-b conservative-reporting, I8-c don't-think / -don't-reason. I27 marks effort-for-brevity candidates (effort-lowering -directive paired with a brevity token on one line). +don't-reason. I23 marks self-estimated context-budget phrasing. I27 marks +effort-for-brevity candidates (effort-lowering directive paired with a brevity +token on one line). Advisory — always exits 0 (candidates never fail the run). Requires grep (exit 2 when absent). Seeds the candidate set of the audit-instructions @@ -110,6 +121,16 @@ I10_ERE="${I10_ERE}|think out loud|walk (me|us) through your (thinking|reasoning I8_A_ERE="double[- ]check|${WB_L}re[- ]?verif|final verification step|(sub)?agent to verify|have (a |an )?(sub)?agent verify|verifier (sub)?agent|verify your (own )?work" I8_B_ERE="be conservative|(only report|report only) (the )?(high|critical)|(don('|’)?t|do not) nitpick" I8_C_ERE="(do not|don('|’)?t) (think|reason)|without thinking|skip the reasoning" +# I23 self-estimated context-budget phrasing. Deliberately anchored to +# BUDGET-AS-TRIGGER forms, never to the bare term "context window" — that term +# is ordinary vocabulary in any instruction surface discussing sessions, and +# matching it would return the whole corpus rather than a candidate set. +I23_ERE="context (is |gets |getting |grows )?(heavy|tight|saturated|exhausted)|heavy context" +I23_ERE="${I23_ERE}|(running|runs|run) (out of|low on) context|low on context" +I23_ERE="${I23_ERE}|remaining[- ](context|window|tokens)|context[- ](budget|percentage|occupancy|countdown)|token[- ](budget|countdown)" +I23_ERE="${I23_ERE}|(check|checking|watch|watching|monitor|monitoring) (the |your )?/context|/context output" +I23_ERE="${I23_ERE}|(final|last) (third|quarter|half) of (the|your|its) window|window position" +I23_ERE="${I23_ERE}|(nearing|approaching) (the )?(context|token)[- ](limit|cap|budget|window)" # I27 effort-for-brevity: both patterns must hit the SAME line — the AND lives # in scan_file. Stem forms catch inflections (decrease/decreasing via the bare # stem, drop/dropped/dropping via the doubled-p form; verbos carries no left @@ -137,6 +158,12 @@ scan_file() { rows+=("$file:$lineno:I10") done < <(grep -niE "$I10_ERE" "$file" 2>/dev/null) + while IFS= read -r hit; do + [[ -n "$hit" ]] || continue + lineno="${hit%%:*}" + rows+=("$file:$lineno:I23") + done < <(grep -niE "$I23_ERE" "$file" 2>/dev/null) + local fam ere for fam in a b c; do case "$fam" in diff --git a/plugins/claude-config/skills/audit-instructions/scripts/instruction-scan.test.sh b/plugins/claude-config/skills/audit-instructions/scripts/instruction-scan.test.sh index ae31b44f3aa..d6b3e08179b 100755 --- a/plugins/claude-config/skills/audit-instructions/scripts/instruction-scan.test.sh +++ b/plugins/claude-config/skills/audit-instructions/scripts/instruction-scan.test.sh @@ -188,7 +188,44 @@ EOF OUT=$(bash "$SCRIPT" "$I8FP") assert_contains "restraint-clause text still emitted (advisory contract)" "$OUT" "$I8FP:1:I8-b" -# --- Case 12b: I27 effort-for-brevity candidates ----------------------------- +# --- Case 13: I23 self-estimated context-budget phrasing flagged ------------- +I23F="$TEST_TMPDIR/i23.md" +cat >"$I23F" <<'EOF' +Invoke this skill mid-task when context is heavy. +Hand off once you are running low on context. +Check the remaining context before starting a new phase. +Consult /context output and decide whether to fork. +Beyond the final third of the window, write a handoff instead. +Stop when you are approaching the context limit. +Fork when the user reports the session is heavy. +Never stop on your own estimate of the remaining context. +EOF +OUT=$(bash "$SCRIPT" "$I23F") +assert_contains "flags 'context is heavy'" "$OUT" "$I23F:1:I23" +assert_contains "flags 'running low on context'" "$OUT" "$I23F:2:I23" +assert_contains "flags 'remaining context'" "$OUT" "$I23F:3:I23" +assert_contains "flags '/context output'" "$OUT" "$I23F:4:I23" +assert_contains "flags 'final third of the window'" "$OUT" "$I23F:5:I23" +assert_contains "flags 'approaching the context limit'" "$OUT" "$I23F:6:I23" +assert_not_contains "a licensed trigger naming no budget is not an I23 row" "$OUT" ":7:I23" +# Advisory over-production, same contract as Case 12: the counter-steer states +# the budget phrase in order to forbid acting on it, and the scanner cannot see +# polarity. criteria.md's inverted-polarity exemption is the model lane's. +assert_contains "counter-steer text still emitted (advisory contract)" "$OUT" "$I23F:8:I23" + +# --- Case 14: I23 is not anchored to the bare term "context window" ---------- +# Matching it would return every surface that discusses sessions at all, which +# is a corpus rather than a candidate set. +I23N="$TEST_TMPDIR/i23-neutral.md" +cat >"$I23N" <<'EOF' +The subagent runs with its own context window and sees none of this conversation. +Compaction replaces the conversation history with a summary. +EOF +OUT=$(bash "$SCRIPT" "$I23N") +assert_not_contains "bare 'context window' is not an I23 row" "$OUT" ":1:I23" +assert_not_contains "compaction prose is not an I23 row" "$OUT" ":2:I23" + +# --- Case 15: I27 effort-for-brevity candidates ------------------------------ I27F="$TEST_TMPDIR/i27.md" cat >"$I27F" <<'EOF' Lower the effort level to keep responses short. @@ -222,7 +259,7 @@ assert_contains "flags third-person 'reduces effort … short'" "$OUT" "$I27F:12 assert_contains "flags third-person 'lowers effort … briefer'" "$OUT" "$I27F:13:I27" assert_contains "flags third-person 'drops effort … concise'" "$OUT" "$I27F:14:I27" -# --- Case 13: missing grep exits 2 ------------------------------------------- +# --- Case 16: missing grep exits 2 ------------------------------------------- real_bash=$(command -v bash) empty_path_dir="$TEST_TMPDIR/empty-path" mkdir -p "$empty_path_dir" diff --git a/plugins/context-guard/.claude-plugin/plugin.json b/plugins/context-guard/.claude-plugin/plugin.json index c664ef4fab6..1ef5f9418d8 100644 --- a/plugins/context-guard/.claude-plugin/plugin.json +++ b/plugins/context-guard/.claude-plugin/plugin.json @@ -1,8 +1,8 @@ { "$schema": "https://json.schemastore.org/claude-code-plugin-manifest.json", "name": "context-guard", - "version": "0.4.9", - "description": "Per-session context-window observability plus the first shipped consumer: a statusline wrapper tees each session's context_window fields to a per-session snapshot file, a zone resolver classifies usage into smart/acceptable/dumb bands (percentage bands plus window-class token bands, conservative-min combination, zones.json SSOT with shipped defaults), a reader contract fixes how consuming sessions interpret the snapshots, and zone-crossing hooks inject continuation guidance once per transition into a worse zone (advisory by default; an optional blocking mode gates new mutating work on a fresh dumb-zone snapshot with handoff-writing exempt), with a PostCompact hook persisting an evidence-degraded marker.", + "version": "0.5.0", + "description": "Per-session context-window observability plus the first shipped consumer: a statusline wrapper tees each session's context_window fields to a per-session snapshot file, a zone resolver classifies usage into smart/acceptable/dumb bands (percentage bands plus window-class token bands, conservative-min combination, zones.json SSOT with shipped defaults), a reader contract fixes how consuming sessions interpret the snapshots, and zone-crossing hooks report once per transition into a worse zone across two channels — the continuation menu to the operator, who owns that choice, and to the model only the zone determination plus the counter-steer that a zone word is not a decay signal (advisory by default; an optional blocking mode gates new mutating work on a fresh dumb-zone snapshot with handoff-writing exempt), with a PostCompact hook persisting an evidence-degraded marker.", "author": { "name": "Melodic Software", "email": "info@melodicsoftware.com" diff --git a/plugins/context-guard/CHANGELOG.md b/plugins/context-guard/CHANGELOG.md index 2c1b5721343..ef6546b8a8e 100644 --- a/plugins/context-guard/CHANGELOG.md +++ b/plugins/context-guard/CHANGELOG.md @@ -5,6 +5,57 @@ All notable changes to the `context-guard` plugin. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.5.0] + +### Changed + +- **The zone-crossing report is split by audience: the continuation menu goes to the operator, the + counter-steer goes to the model.** The hook injected one block into model context naming the zone + and then enumerating four continuation options — continue, `/clear`, handoff-then-`/clear`, + `/compact` — plus the `/session-flow:workflow` router. Those are precisely the behaviors a model + guide reports current models are already predisposed to volunteer, and handing them to the model + as a menu manufactures that initiative rather than replacing it: the measurement decides only + *when to ask*, while the model still decides *whether to stop*. That is a live finding under the + `claude-config` instruction-audit catalog's check I23, which this repository ships. + + The menu now renders on `systemMessage` — the operator channel, whose whole content is a human's + choice to make — and `additionalContext` carries the zone determination plus the counter-steer: + this is a measurement and not a decay signal, degradation shows up in the model's own output + rather than in a zone word, so do not volunteer to end the session, summarize, hand off, or trim + work on the strength of the reading. The `dumb` zone keeps its extra clause, restated as the + model-independent fact it always was — compaction distance is short, so write expensive + conclusions to a durable note as they stabilize. + + **The counter-steer is stated inline rather than delegated** to the `playbooks:fable-5` doctrine + that also carries it. The two plugins are independently installable with no dependency wiring, so + a `context-guard`-only install previously received the menu with nothing in context to interpret + it against. + + **The model channel states ownership, never delivery.** It says continuation is the operator's + call; it does not say the operator has seen the menu. No documented hook behavior tells a hook + whether an operator is present — `systemMessage` is documented only as a message shown to the + user, with nothing said about non-interactive runs — so a delivery claim would be a fact the hook + cannot know in *any* mode, not only headless ones. Emitting to an unread operator channel is + harmless; telling the model a human holds the choice when none does is not. A regression assertion + locks it, because the sentence is the kind that creeps back on a rewording pass. + + **The `hook-observability` convention is amended in the same change**, because this is the first + fleet payload that is neither a prerequisite-skip nor a content-mutation notice. Its + advisory-findings exclusion now names its own predicate — *who can act* — and admits a carve-out + only on three conditions together: the payload is a choice whose only legitimate actor is the + human, the model channel separately carries the determination the model does need, and the + emission is keyed to a state transition. The convention also now forbids any model-channel text + from asserting operator presence, fleet-wide. This **creates** an exception rather than codifying + practice — every other `systemMessage` site in the fleet is a prerequisite skip or a formatter's + content-mutation notice — and the conformance section says so, so a second site re-reads the + conditions instead of following the precedent. + + **Firing cadence is unchanged**, deliberately. Whether a four-option exit menu belonged on the + `smart → acceptable` crossing was an open calibration question; it dissolves rather than gets + answered, because the model-facing payload no longer carries a menu at any zone, and a budget + rendered to a human is outside I23's subject entirely. Zone mechanics, bands, state, kill switch, + and telemetry are untouched. + ## [0.4.9] ### Changed diff --git a/plugins/context-guard/README.md b/plugins/context-guard/README.md index 43b2aefb681..57735a97654 100644 --- a/plugins/context-guard/README.md +++ b/plugins/context-guard/README.md @@ -22,8 +22,14 @@ tool that needs it — so long-running workflows can route heavy work away from `~/.claude/context-guard/zones.json` when present and valid, else from the shipped defaults. Zones say *where you are*; consumers decide *what to do*. - **Zone-crossing hooks** (`hooks/`) — the first shipped consumer. Once per transition into a - worse zone, a PostToolBatch/UserPromptSubmit hook injects continuation guidance (advisory; - silent on unchanged, improving, or `unknown` zones). A PostCompact hook writes an + worse zone, a PostToolBatch/UserPromptSubmit hook reports the crossing (advisory; silent on + unchanged, improving, or `unknown` zones), **splitting the report by audience**: the + continuation menu — continue, `/clear`, handoff-then-`/clear`, `/compact` — renders to the + operator on `systemMessage`, because choosing among them is the human's call; the model's + channel carries the zone determination plus the counter-steer that a zone word is a measurement + and not a decay signal, and never an exit menu. An exit menu injected into model context + manufactures the model's own initiative to stop, summarize, or hand off, which the + instruction-audit catalog flags as check I23. A PostCompact hook writes an evidence-degraded marker next to the session's snapshot, and both zone consumers honor it: a compacted session's effective zone is dumb regardless of its post-compaction numbers. An optional **blocking** mode (`zone_hook_mode` userConfig) adds a PreToolUse gate that denies new diff --git a/plugins/context-guard/hooks/zone-crossing-inject.sh b/plugins/context-guard/hooks/zone-crossing-inject.sh index f02122e59a4..96a0f47068c 100755 --- a/plugins/context-guard/hooks/zone-crossing-inject.sh +++ b/plugins/context-guard/hooks/zone-crossing-inject.sh @@ -1,6 +1,32 @@ #!/usr/bin/env bash -# PostToolBatch + UserPromptSubmit hook: inject continuation guidance ONCE per -# transition into a WORSE context zone; stay silent otherwise. +# PostToolBatch + UserPromptSubmit hook: report a transition into a WORSE +# context zone ONCE; stay silent otherwise. +# +# TWO CHANNELS, TWO AUDIENCES — the split is load-bearing, not cosmetic. +# `systemMessage` renders to the operator; `additionalContext` lands in the +# model's context. The continuation menu (continue / clear / handoff / compact) +# is a HUMAN's choice and goes to the operator channel only. The model's channel +# carries the zone determination plus the counter-steer, and never an exit menu: +# a menu injected into model context manufactures the model's own initiative to +# stop, summarize, or hand off — the measurement decides only when to ask, while +# the model still decides whether to stop. That shape is a live finding under +# the instruction-audit catalog's I23 (claude-config, reference/criteria.md), +# whose Remediate clause prescribes exactly this: state the counter-steer +# plainly, and where the harness must surface a budget, pair it with a +# reassurance rather than with an exit menu. +# +# The counter-steer is stated INLINE rather than delegated to the `playbooks` +# doctrine that also carries it. Both plugins are independently installable with +# no dependency wiring, so a context-guard-only install would otherwise receive +# the zone word with nothing in context to interpret it against. +# +# The model channel states that continuation is the operator's CALL; it never +# states the operator has SEEN the menu. No documented hook behavior tells a +# hook whether an operator is present — `systemMessage` is documented only as a +# message shown to the user, with nothing said about non-interactive runs — so +# a delivery claim would be a fact this hook cannot know, in every mode rather +# than only headless ones. Emitting to an unread operator channel is harmless; +# telling the model a human has the menu when none does is not. # # Cadence contract: the session's zone is resolved from the plugin's # own snapshot seam via scripts/context-zone.sh (the single band/combination @@ -11,8 +37,8 @@ # updates state — no data is not a transition. Improvements update state # silently so a later relapse injects again. # -# ADVISORY-ONLY: this hook only ever exits 0 and only ever emits -# additionalContext. The blocking posture lives in the separate PreToolUse +# ADVISORY-ONLY: this hook only ever exits 0 and only ever emits context and a +# user-visible message. The blocking posture lives in the separate PreToolUse # gate (zone-gate.sh). PostToolBatch fires once per parallel tool batch # before the next model call — one injection point per model turn, no # per-tool dedupe needed; UserPromptSubmit covers turns that begin without a @@ -101,7 +127,7 @@ last_rank=$(rank "$last") # SILENTLY: proceeding past it would compare this turn's zone against the # same stale `last` again on the next call, re-emitting the ~1KB guidance # block every subsequent PostToolBatch/UserPromptSubmit instead of once per -# transition. "Silent" means no additionalContext is injected — the failure +# transition. "Silent" means neither channel emits — the failure # itself is still surfaced to operators as telemetry, never swallowed twice. umask 077 mkdir -p "$STATE_DIR" 2>/dev/null || exit 0 @@ -124,12 +150,19 @@ fi prev_label="${last:-unobserved}" zone_label="$zone" [[ -n "$degraded" ]] && zone_label="dumb (evidence-degraded: this session was compacted, so its context evidence is already lossy regardless of the snapshot's numbers)" -guidance="context-guard: this session crossed from the ${prev_label} into the ${zone_label} context zone (snapshot seam, conservative-min over percentage and token bands). On many models response quality degrades as context occupancy grows; onset varies by model — some vendor model guides state consistency through the full window — and the bands are tunable defaults (zones.json). Compaction distance shrinks regardless of model. Prefer finishing the current step, then choose the continuation mechanism deliberately: (1) continue in-session only if the remaining work is small or simple enough for degraded context; (2) /clear if this session's context is disposable; (3) write a durable handoff then /clear if state must survive — run /session-flow:handoff (if that plugin is installed; otherwise write a resume file by hand before clearing); (4) /compact only at a phase boundary, as a last resort. For the full continuation router, run /session-flow:workflow (if installed)." + +# Model channel: the determination, then the counter-steer. No exit menu, no +# continuation router, no invitation to end the turn — see the header. +guidance="context-guard: this session crossed from the ${prev_label} into the ${zone_label} context zone (snapshot seam, conservative-min over percentage and token bands). This is a measurement reported to you, not an instruction and not a decay signal: degradation shows up in your own output — drift, repetition, dropped constraints — never in a zone word. Do not volunteer to end the session, start a new one, summarize, hand off, or trim your work on the strength of this reading; keep working the task in hand. Continuation is the operator's call, and nothing here is being asked of you. Act on a continuation when the operator asks for one, when a mechanism gates on it, or when your own output shows the degradation this reading cannot see." if [[ "$zone" == "dumb" ]]; then - guidance+=" The dumb zone means degradation is likely already measurable on degradation-prone models: avoid starting new complex work in this window." + guidance+=" The dumb zone additionally means compaction distance is short, which is true regardless of model: write every expensive conclusion to a durable note as it stabilizes rather than at session end, so an unchosen compaction cannot take it." fi -hook::emit_channels "$EVENT" "$guidance" "" +# Operator channel: the same crossing, plus the continuation menu that is the +# human's call to make. +operator="context-guard: this session crossed from the ${prev_label} into the ${zone_label} context zone (snapshot seam, conservative-min over percentage and token bands). On many models response quality degrades as context occupancy grows; onset varies by model — some vendor model guides state consistency through the full window — and the bands are tunable defaults (zones.json). Compaction distance shrinks regardless of model. Continuation options, yours to choose: (1) continue in-session if the remaining work is small or simple enough for degraded context; (2) /clear if this session's context is disposable; (3) write a durable handoff then /clear if state must survive — /session-flow:handoff (if that plugin is installed; otherwise write a resume file by hand before clearing); (4) /compact only at a phase boundary, as a last resort. For the full continuation router, /session-flow:workflow (if installed)." + +hook::emit_channels "$EVENT" "$guidance" "$operator" hook::emit_telemetry "zone-crossing-inject" "$EVENT" "ok" "$START_EPOCH" \ '{"zone":"'"$zone"'","previous":"'"${last:-}"'","injected":true}' exit 0 diff --git a/plugins/context-guard/hooks/zone-crossing-inject.test.sh b/plugins/context-guard/hooks/zone-crossing-inject.test.sh index 5d7b5e7d9b5..9f94857a501 100755 --- a/plugins/context-guard/hooks/zone-crossing-inject.test.sh +++ b/plugins/context-guard/hooks/zone-crossing-inject.test.sh @@ -1,9 +1,11 @@ #!/usr/bin/env bash # Contract test for zone-crossing-inject.sh (PostToolBatch/UserPromptSubmit). # -# Contract: inject additionalContext ONCE per transition into a WORSE zone; -# silent while the zone is unchanged, improving, or unknown; unknown never -# updates state; kill switch honored; hostile ids fail open. Exit 0 always. +# Contract: emit ONCE per transition into a WORSE zone, splitting the report +# across two channels — the counter-steer to the model, the continuation menu to +# the operator; silent while the zone is unchanged, improving, or unknown; +# unknown never updates state; kill switch honored; hostile ids fail open. +# Exit 0 always. # # Self-contained: defines its own assertion helpers — installed plugins are # cache-isolated with no shared test lib. @@ -70,6 +72,36 @@ else fail "injection JSON invalid: $OUT" fi +# 1b. Channel separation. The continuation menu is the OPERATOR's choice +# and must reach systemMessage only; the model's channel carries the +# determination plus the counter-steer and never an exit menu, because an +# injected menu manufactures the model's own initiative to stop (catalog I23). +CTX=$(jq -r '.hookSpecificOutput.additionalContext // ""' <<<"$OUT" 2>/dev/null) +SYS=$(jq -r '.systemMessage // ""' <<<"$OUT" 2>/dev/null) +menu_free=1 +for token in "/compact" "/clear" "/session-flow:workflow" "/session-flow:handoff"; do + [[ "$CTX" == *"$token"* ]] && menu_free=0 +done +if ((menu_free)) && [[ "$CTX" == *"Do not volunteer"* ]]; then + ok "model channel carries the counter-steer and no exit menu" +else + fail "model channel leaked an exit menu or lost the counter-steer: $CTX" +fi +# The model channel may say the choice is the operator's; it may never say the +# operator has SEEN it. Nothing tells a hook whether an operator is present, so +# a delivery claim is unknowable in every mode. Asserted here so the sentence +# cannot creep back on a later rewording pass. +if [[ "$CTX" != *"has been shown"* && "$CTX" != *"shown to"* && "$CTX" == *"operator's call"* ]]; then + ok "model channel claims ownership without claiming delivery" +else + fail "model channel asserts operator receipt it cannot know: $CTX" +fi +if [[ "$SYS" == *"/compact"* && "$SYS" == *"/session-flow:handoff"* && "$SYS" == *"yours to choose"* ]]; then + ok "operator channel carries the continuation menu" +else + fail "operator channel missing the continuation menu: $SYS" +fi + # 2. Same zone again → silent (once per transition). run "$H" "$D" s1 if [[ $RC -eq 0 && -z "$OUT" ]]; then ok "unchanged zone is silent"; else fail "unchanged zone: rc=$RC out=$OUT"; fi diff --git a/plugins/implementation/.claude-plugin/plugin.json b/plugins/implementation/.claude-plugin/plugin.json index c642bfbc504..781e4d83ba4 100644 --- a/plugins/implementation/.claude-plugin/plugin.json +++ b/plugins/implementation/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/claude-code-plugin-manifest.json", "name": "implementation", - "version": "0.11.0", + "version": "0.12.0", "description": "Disciplined implementation stage: execute approved plans inline (`/implementation:implement`) or via orchestrated worker subagents (`/implementation:implement-dispatch`) with incremental validation, TDD-by-default cadence, green-checkpoint commits, scope-fence drift detection, and divergence detection that routes back to planning. Build/test/lint, testing, and outcome verification live in the companion `toolchain`, `testing`, and `verification` plugins, invoked when installed.", "author": { "name": "Melodic Software", diff --git a/plugins/implementation/CHANGELOG.md b/plugins/implementation/CHANGELOG.md index b71d812ea09..96080796479 100644 --- a/plugins/implementation/CHANGELOG.md +++ b/plugins/implementation/CHANGELOG.md @@ -3,6 +3,19 @@ All notable changes to the `implementation` plugin are documented here. Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); this plugin uses semantic versioning. +## [0.12.0] + +### Changed + +- **`implement`: the mid-phase handoff no longer triggers on a self-estimated context budget.** The + guidance read "Mid-phase handoff is still appropriate when context is heavy or a pause is + imminent", which asks the model to judge its own window and hand off on that judgement — the shape + the `claude-config` instruction-audit catalog's check I23 detects, and the same clause removed from + `session-flow`'s `handoff` in this pass. The licensed triggers are now an imminent pause, the + user's report, an instrument that measures the window, or visible drift in the responses; a budget + reading is a measurement, not a decay signal. Writing the ad-hoc note stays exactly as valuable as + before — only the trigger that invented the occasion is gone. + ## [0.11.0] ### Changed diff --git a/plugins/implementation/skills/implement/SKILL.md b/plugins/implementation/skills/implement/SKILL.md index aeddcd72cd3..81c6844c3fb 100644 --- a/plugins/implementation/skills/implement/SKILL.md +++ b/plugins/implementation/skills/implement/SKILL.md @@ -168,7 +168,7 @@ In-session task state lives in the harness and does not survive a context clear. **Why every phase, not just session-end:** clearing context between phases must be cheap. Without per-phase handoff entries, a resumed session has to read source diffs to reconstruct what was tried; with them, it reads the status summary plus the most-recent handoff entry and knows everything material. Cost: 30s-2min per phase boundary. Skip-cost: hours of rediscovery on the next resume. -**Mid-phase handoff is still appropriate** when context is heavy or a pause is imminent — write an ad-hoc handoff note (topic e.g. `wip-checkpoint`). The phase-boundary ritual above is the automatic baseline; ad-hoc handoffs add extra save points. +**Mid-phase handoff is still appropriate** when a pause is imminent, the user reports the session is heavy, a context-measuring mechanism says to fork, or the responses themselves are drifting — write an ad-hoc handoff note (topic e.g. `wip-checkpoint`). Not on your own estimate of the remaining window: a budget reading is a measurement, not a decay signal. The phase-boundary ritual above is the automatic baseline; ad-hoc handoffs add extra save points. In orchestrated runs, the orchestrator may stay resident across phase boundaries instead of clearing — criteria per `/implementation:implement-dispatch` "Resident-vs-clear at phase boundaries"; the ritual above is unchanged either way. diff --git a/plugins/session-flow/.claude-plugin/plugin.json b/plugins/session-flow/.claude-plugin/plugin.json index 98595aa1b04..96afef87b9f 100644 --- a/plugins/session-flow/.claude-plugin/plugin.json +++ b/plugins/session-flow/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/claude-code-plugin-manifest.json", "name": "session-flow", - "version": "0.20.0", + "version": "0.21.0", "description": "Session-lifecycle toolkit of thirteen skills: workflow (navigate a staged dev workflow and suggest the next stage), handoff (write a save-point and resume prompt for /clear-and-resume), continue-in-background (delegate the task to a fresh background agent that continues it now — same save-point engine as handoff, delivered by launching a detached claude --bg session seeded with the resume prompt; launches only on explicit user request), keep-going (recover and continue after any interruption OR when live off-thread work looks stalled — inventory off-thread work, inspect its real output, act only on evidence, then continue; after a usage limit lifts it continues rather than summarizing-and-stalling), find-handoff (recover a lost handoff after /clear — when the resume prompt was written but never copied — via a read-only detection ladder: known-location glob of the handoffs dir, then a bounded, recency-ranked transcript scan for the handoff directive and dashed-rail markers, then a confirm-before-resume gate; surfaces only the resume prompt + metadata, never raw transcript content), clean-stop (get to a durable, linked stopping point before the machine may go away — sweep every repo/worktree for uncommitted, unpushed, or PR-less work, push it durable, put breadcrumbs in PR/issue bodies, then give a free-and-clear verdict), retro (structured end-of-session retrospective with transcript metrics and learning codification), running-retro (in-flight retrospective checkpoints that spawn a subagent to analyze the transcript so far and append classified findings to a cumulative running ledger — capture and route only, the live counterpart to retro; also owns a detached-observer substrate that can watch a session out-of-band and run the checkpoint autonomously after the session ends), orient (read-only session orientation — synthesize where we stand, what we are doing, and why, from durable + off-thread state the built-in /recap never sees: ledgers, handoffs, workflow checklists, running-retro ledgers, open PRs and work-items, and git), orchestrate (arm a session or worker with proactive-orchestration imperatives), reanchor (verify a session's working assumptions are still true against live reality — referenced PRs/issues/branches, base-branch drift, renamed/version-drifted surfaces, stale memory-tier files, and the goal a handoff records, compared across the chain so a re-derived goal reports as drift — before building on them), reconcile (retire finished off-thread work and reconcile this session's task ledger with reality — the prune-and-reconcile counterpart to keep-going's resume: inventory the work this session spawned, inspect its real state, retire the finished and close proven-done tasks, auto-settling the finished and gating any kill of still-running work; sibling sessions in the project are reported read-only), and setup (check-centric verification of the observer's runtime prerequisites and configuration).", "author": { "name": "Melodic Software", diff --git a/plugins/session-flow/CHANGELOG.md b/plugins/session-flow/CHANGELOG.md index 6c524a3389a..61ee7a4f5e0 100644 --- a/plugins/session-flow/CHANGELOG.md +++ b/plugins/session-flow/CHANGELOG.md @@ -1,5 +1,28 @@ # Changelog — session-flow plugin +## [0.21.0] + +### Changed + +- **`handoff` no longer fires on a self-estimated context budget.** Its `description` listed + "context is heavy" among the triggers, and the body's "When to invoke" repeated it as "Mid-task, + context heavy (check `/context` output or user report)" — telling the model to judge its own + window and volunteer a handoff on that judgement. A description is resident in context by default + (, verified 2026-08-08), so that trigger was live in every + session with the plugin installed, and it is the shape the `claude-config` instruction-audit + catalog's check I23 detects. + + Three signals now license the skill, and a self-estimated budget is not among them: **the user's + own report**, **an instrument that measures the window** (`context-guard`'s zone report is one), + and **visible decay in the responses themselves** — drift, repetition, looping. The third is + explicitly the model's to read, because decay shows up in the output and never in a budget number. + Nothing about the save-point engine, the arguments, the STOP gate, or the emitted artifacts + changes, and the skill stays model-invocable: only the budget clause is gone. + + The "Fork beats compaction" section keeps its window-position threshold and gains a one-line + anchor saying what it always meant — it picks between two continuation mechanisms and never + licenses the continuation itself. + ## [0.20.0] ### Changed diff --git a/plugins/session-flow/skills/handoff/SKILL.md b/plugins/session-flow/skills/handoff/SKILL.md index 2074209a530..55882bedb87 100644 --- a/plugins/session-flow/skills/handoff/SKILL.md +++ b/plugins/session-flow/skills/handoff/SKILL.md @@ -1,6 +1,6 @@ --- name: handoff -description: "Write a mid-session save-point for /clear-and-resume — a durable handoff file (default) or a copy-paste resume prompt when follow-ups are small. Use when: 'handoff', 'save state', 'checkpoint this', 'pause', 'come back later', context is heavy, or quality is degrading. For delegating the continuation to a background agent, use the sibling continue-in-background skill." +description: "Write a mid-session save-point for /clear-and-resume — a durable handoff file (default) or a copy-paste resume prompt when follow-ups are small. Use when: 'handoff', 'save state', 'checkpoint this', 'pause', 'come back later', the user reports the session is heavy, a context-measuring mechanism says to fork, or your own responses are visibly drifting, repeating, or looping. Never on your own estimate of the remaining window — a budget reading is not a decay signal. For delegating the continuation to a background agent, use the sibling continue-in-background skill." argument-hint: "[file|prompt] [topic] (e.g., /handoff, /handoff prompt, /handoff file phase-3)" user-invocable: true disable-model-invocation: false @@ -26,9 +26,14 @@ the pre-compute block (#1687). ## Purpose -Context bloat is expensive and quality degrades as context rots. When a task has room left but -context is heavy, capture a save-point — a handoff document, or just a copy-paste resume prompt when -follow-ups are small — and `/clear`. +Context bloat is expensive and quality degrades as context rots. When a task has room left but the +session should fork anyway, capture a save-point — a handoff document, or just a copy-paste resume +prompt when follow-ups are small — and `/clear`. + +**What licenses that judgment matters as much as the judgment.** The trigger is the user's own +report, an instrument that measures the window, or visible decay in the responses themselves — +never a self-estimated budget. A remaining-context reading is a measurement, not a decay signal; +volunteering a handoff on the strength of one interrupts work that was fine. Based on the canonical pattern Anthropic recommends for the `/clear` workflow: put the rest of the plan in a handoff file; explain what you tried, what worked, and what didn't, so the next agent with @@ -81,8 +86,10 @@ specifically (e.g. "don't `/clear` between phases, keep going"). ## When to invoke -- Mid-task, context heavy (check `/context` output or user report) -- Quality degrading (context rot) — responses drifting, repeating, or looping +- Mid-task and the user reports the session is heavy, or a context-measuring mechanism says to + fork (`context-guard`'s zone report is one) — never your own estimate of the remaining window +- Quality degrading (context rot) — responses drifting, repeating, or looping. This is the signal + that is yours to read, because decay shows up in the output and never in a budget number - About to pause for hours/overnight; want a clean resume - About to switch to a different task; this one isn't done - Last turn had an unexpected compaction @@ -93,6 +100,10 @@ Going AFK but the work should keep moving → that is the sibling ## Fork beats compaction when the window is deep +This section picks between two continuation mechanisms; it never licenses the continuation itself. +That licence comes from "When to invoke" above, and the thresholds here apply only once it is +granted. + Two ways to keep going past a heavy context: fork (handoff file + `/clear` + fresh session) or continue in place over a compacted history. Compaction suits an intentional break between phases while the window is still mostly fresh — the summarized turns were genuinely disposable. Once the