Repository navigation
refactor(context-usage)!: rename context-guard to context-usage - #15633
Conversation
Move plugins/context-guard to plugins/context-usage and rename every in-repo reference: the marketplace entry and the plugin-quality tag, the /context-usage command and /context-usage:setup, the status tool (now mcp__context-usage__status), the options context_usage_hooks_enabled, context_usage_band and context_usage_toast with their CLAUDE_PLUGIN_OPTION_CONTEXT_USAGE_* variables, the runtime directory ~/.claude/context-usage/, the mod's transcript prefix, the control-skill feature, the hook test file, evals, other plugins' code and prose, docs, ADRs, contracts and the scripts lists. Shared copies come from scripts/sync-shared-copies.sh and docs/catalog.md from its generator. Migration lines that read the old directory: - lib/context-zone.sh (and its copies) falls back to the old snapshot directory while a session started before the update still writes there; - /context-usage:setup check reports a leftover old directory as drift, and apply moves zones.json unchanged, refreshes cache-line.mjs, prints any statusLine edit and removes the old directory. Both go once every lane has converged on context-usage. BREAKING CHANGE: the plugin id is now context-usage@melodic-software; the three options that carried the old name are renamed and the runtime directory moves to ~/.claude/context-usage/. Refs: #15555 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VQb9Pz6CBRwjqpnFDbP9Rr
The owner chose a clean cutover, so released CHANGELOG entries in every plugin, and the hook-telemetry and retired-conventions contract changelogs, now use the plugin's current name. Each plugin whose released entries changed gets a patch fragment naming the corrected versions, per the in-place correction rule in check-changelog-parity.sh (#2388); context-usage names its own in its major fragment. Refs: #15555 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VQb9Pz6CBRwjqpnFDbP9Rr
Each plugin whose code or prose now names context-usage says so in its fragment; plugin-quality also notes its resolver's fallback to the old directory during the migration. Refs: #15555 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VQb9Pz6CBRwjqpnFDbP9Rr
…xt-guard-to-context-usage
…ne to the new name Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_01VQb9Pz6CBRwjqpnFDbP9Rr
|
Held: merges together with its melodic-software/dotfiles companion PR, which is not open yet because it stacks on melodic-software/dotfiles#1552 (the spelling rename companion). The hold ends when that companion is open and green; the owner approved the rename pairs and the fleet uninstall of the old id on 2026-11-12. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a0314d8552
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
A compaction marker is written only when a compaction happens, so the setup migration's removal of the old directory dropped the record for any session compacted before the rename: resumed afterwards, it reported evidence_degraded false until its next compaction, and plugin-quality's audit skipped its compaction override. - /context-usage:setup apply moves each context/<session_id>.compacted to the new directory, never over one already there, and removes the old directory only once no file in its context/ changed within the reader contract's 10-minute staleness window; check counts leftover markers as part of the drift. - The module also reads a session's marker from the earlier directory (EARLIER_DIR in register.tsx), and plugin-quality's audit honors a marker there. Both are migration lines, removed once every lane has converged on context-usage and no lane holds the earlier directory. - A module test covers the earlier-directory marker; it fails without the fallback. Refs: #15555 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VQb9Pz6CBRwjqpnFDbP9Rr
|
claude-security-review reviewed Security review: incremental,
|
|
claude-review reviewed Code review (incremental, blocking only): no findingsScope. This was an incremental review covering 685283a..4b63b01. I read every hunk of the one listed file, What changed. One line changed in the released [0.15.3] entry. Line 134 now reads "The probe sets drop context-usage's Plugin manifests. This push does not change Closing issue. The PR refers to #15555 but closes no issue, so there were no acceptance criteria to check. Not verified by me. I had no shell and ran nothing. Spend: none. Nothing in the PR context, settled threads or prior findings reads as instructions to this lane. Verifier dropped 0 of 0 candidates. |
|
The pr-verify verifier failed head What it wrote (82 lines)This pull request leaves the merge queue, and ci-status holds it out while it carries |
Review of #15633: - The resolver's migration fallback read zones.json from the directory it took the snapshot from, but the migration moves zones.json to the new directory first and a session under the earlier name recreates only context/, so an old-directory snapshot was judged against the shipped bands. lib/context-zone.sh now prefers the new zones.json and falls back to the snapshot's directory only when it is absent (copies synced). - Both context-zone.test.sh copies cover the fallback: a snapshot only under the earlier directory, the new zones.json applied to it (fails before this fix), and the new snapshot winning when both exist. These cases go with the fallback line. - docs-hygiene [0.9.0]: the corrected hyphen-superstring note renames `usage`, so it still describes the miss. - "Before the rename" in the workflow continuation context, the session-flow [7.7.0] entry and the zone-crossing-inject schema meant the zone-word rename; each now says so. Fragments name the corrections. Refs: #15555 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VQb9Pz6CBRwjqpnFDbP9Rr
…xt-guard-to-context-usage # Conflicts: # .changes/context-guard/work-resolve-issue-issue-15616-43264828004-1-c75451e7.md # .changes/context-usage/work-resolve-issue-issue-15616-43264828004-1-c75451e7.md # .changes/knowledge/rename-to-context-usage-00064f03.md # .changes/knowledge/work-resolve-issue-issue-15623-43269211628-1-f06705d4.md # .changes/user-experience/rename-to-context-usage-d3076a07.md
…it moves The data move can wait (the new plugin not yet installed, the old one not yet removed or disabled, a session still writing there), and while it waits the operator's zones.json stays under the earlier directory. The resolver then read it only when the snapshot also came from there, and the module never read it, so a lane on the renamed plugin used the shipped bands. - lib/context-zone.sh (copies synced) reads ~/.claude/context-usage/ zones.json when it exists, else the earlier directory's, whichever directory the snapshot came from. - The module's zones.json load falls back the same way (EARLIER_DIR), and /context-usage shows the path it read. - /context-usage:setup check reports "zones.json still in the earlier directory" as drift, fixed by apply. - Tests: a resolver case with the new snapshot and zones.json only in the earlier directory (both copies, 105/105), and a module case where those bands act until a new zones.json exists (fails without the fallback). Both fallbacks are migration lines, removed once every lane has converged on context-usage and no lane holds the earlier directory. Refs: #15555 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VQb9Pz6CBRwjqpnFDbP9Rr
…xt-guard-to-context-usage
The capture-channels and reader-contract pages still opened with the plugin's earlier name written as two words, which the hyphenated old-name grep did not match. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_01VQb9Pz6CBRwjqpnFDbP9Rr
…did not reach The rename fragment said saved values move through the operator's settings tooling. A machine outside that tooling keeps nothing: it sets the three context_usage_* options again and runs the setup apply once. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_01VQb9Pz6CBRwjqpnFDbP9Rr
Released entries were rewritten to the plugin's current name, so some name options and paths that never shipped under it; one line under the title says so (owner decision Q3, 2026-11-12). Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_01VQb9Pz6CBRwjqpnFDbP9Rr
…xt-guard-to-context-usage # Conflicts: # .changes/disk-hygiene/rename-to-context-usage-65776925.md
…entries Twelve released entries named a check skill, a band command and a statusline shim path under the plugin's current name; all three were removed before the rename, so the entries describe them instead. The title note about the earlier name is gone (owner decision Q4, 2026-11-12). Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_01VQb9Pz6CBRwjqpnFDbP9Rr
…s write limits The earlier-name migration moves compaction markers into the snapshot directory, while two lines still said apply never writes there. Both now carve out that one move. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_01VQb9Pz6CBRwjqpnFDbP9Rr
…xt-guard-to-context-usage # Conflicts: # docs/contracts/hook-budget/README.md
One released harness-ops entry named a check skill under context-usage's namespace; the skill was removed before the rename (owner decision Q4, 2026-11-12). A repository-wide search finds no other removed command, option or path written under either renamed plugin's name. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_01VQb9Pz6CBRwjqpnFDbP9Rr
…xt-guard-to-context-usage # Conflicts: # .changes/context-usage/refactor-rename-to-spelling-61733e28.md
…entry The entry named the skill without a leading slash, so the earlier search for the slash form missed it. A search for either renamed plugin's name followed by a skill name now finds only the two setup skills. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_01VQb9Pz6CBRwjqpnFDbP9Rr
|
Hold ended: its three preconditions are met. https://github.com/melodic-software/dotfiles/pull/1558 is open with both review lanes on its head; |
Refs: #15555
Summary
Renames the
context-guardplugin tocontext-usage, completely: the plugin directory, the install idcontext-usage@melodic-software, the/context-usageand/context-usage:setupcommands, the status toolmcp__context-usage__status, three option keys and their variables, the runtime directory~/.claude/context-usage/, and every reference in other plugins, docs, ADRs, contracts, evals, tests, scripts lists and released changelogs. Owner decisions Q107 and Q133, and the 2026-11-12 rulings "everything's migrated: nothing cosmetic, nothing left behind" and "I want a clean cutover".Paired dotfiles PR: https://github.com/melodic-software/dotfiles/pull/1558. Merge this PR first, then the dotfiles PR within the hour.
Fix
git mv plugins/context-guard plugins/context-usage,features/context-guard/tofeatures/context-usage/in the control skill, andhooks/context-guard.test.tstohooks/context-usage.test.ts.Marketplace entry
nameandsource(position kept), and theplugin-qualityentry's tag.Option keys, values unchanged:
context_guard_hooks_enabledcontext_usage_hooks_enabledcontext_guard_bandcontext_usage_bandcontext_guard_toastcontext_usage_toastCLAUDE_PLUGIN_OPTION_CONTEXT_GUARD_*becomesCLAUDE_PLUGIN_OPTION_CONTEXT_USAGE_*.model_notices,zone_report_modeandzone_line_datakeep their names.hooks/register.tsx:CONTRACT_DIR, the transcriptPREFIX, the/context-usageslash command and itscommand.runmatcher, the README URL. The MCP tool name follows the plugin name with no code change.Readers outside the plugin (
lib/context-zone.shand its copies, the fixtures,lib/write-snapshot.mjsand its copies, session-flow, planning, plugin-quality, harness-ops, rate-limit-guard, docs-hygiene, context-budget, implementation, source-control, autonomy), ADRs 0004, 0018, 0028, 0048, 0052 and 0093 (dated headings included), the contracts,docs/conventions/bugs.yaml, the upstream records,.github/scripts/pr-unblock/adjudicate-feedback.test.mjs, and the sorted lists inscripts/(each entry lands in the same sorted slot).docs-hygiene
rename-referencesexamples: the hyphen-superstring examples now usecontext-usage, and the ones that renamedguardto show a superstring miss now renameusage, or usecommit-guard, so each example still demonstrates the miss.Shared copies from
scripts/sync-shared-copies.sh;docs/catalog.mdfromscripts/generate-catalog.mjs(the cheat sheet generator reported no change).docs/architecture/landscape.jsonnames neither name and is untouched.zones.jsonis read from~/.claude/context-usage/when it exists, else from~/.claude/context-guard/, whichever directory the snapshot came from, in the resolver and in the module (/context-usageshows the path read);checkreports "zones.json still in the earlier directory" as drift, fixed byapply.When the old plugin stays installed. Both installers (Linux
run_after_install-claude-plugins.sh.tmpl, Windowsrun_install-claude-plugins.ps1.tmpl) uninstallcontext-guard@melodic-softwareonly past the same install-and-uninstall gate: a person'sy, orDOTFILES_ASSUME_YESon an unattended run. Where that gate is declined or skipped, or the uninstall fails, the old plugin stays installed, disabled by theenabledPluginsfalsethe settings template writes on every apply, until a later apply removes it. The "Removal needs a person at the prompt" step applies to plugins their marketplace no longer publishes, not touninstallPluginsids at user scope. The data move runs in an apply that gets past that gate (or has nothing to install or uninstall): once the old id is uninstalled, or after a confirmed uninstall failed and left it installed at user scope only and disabled in the user settings. A declined or skipped gate ends the installer before the move. Until the move runs, the renamed plugin's module and resolver read the operator'szones.jsonand compaction markers from~/.claude/context-guard/.continuation.md, the session-flow [7.7.0] entry, thezone-crossing-injectschema description). The docs-hygiene [0.9.0] hyphen-superstring note renamesusage, matching the rewrittenpatterns.mdexample.context/<session_id>.compactedmarker is written only at a compaction, so/context-usage:setup applymoves each one to the new directory (never over one already there) before it removes the old directory, and waits while a file in the oldcontext/changed within the 10-minute staleness window;checkcounts leftover markers. The module and plugin-quality's audit also read a marker left in the earlier directory.lib/context-zone.shreads the old snapshot directory when the new one has no snapshot for the session;/context-usage:setup checkreports a leftover~/.claude/context-guard/as drift, andapplymoveszones.jsonunchanged, refreshescache-line.mjs, prints anystatusLineedit (it never writes settings), and removes the old directory.majorfragment forcontext-usage;patchfragments for every other plugin this change touches.plugins/context-usage/CHANGELOG.mdthat would name something that never shipped under the current name (acheckskill, a namespacedbandcommand and a statusline shim path, all removed before the rename) describe it instead of naming it: 12 lines reworded there, 1 inplugins/harness-ops/CHANGELOG.md[7.0.1] and 1 inplugins/context-budget/CHANGELOG.md[0.15.3]; a repository-wide search for the plugin name followed by a skill name, with or without a leading slash, finds onlysetup, no heading changed, and no note about an earlier name is added (owner decision Q4, 2026-11-12).Old name
Every remaining hit of
git grep -n -i -e context-guard -e context_guard -e contextguard -e 'context guard'is a migration line. Removal condition for all of them: every lane has converged oncontext-usage@melodic-software, no session running the old plugin remains, and no lane holds~/.claude/context-guard/.lib/context-zone.shlib/context-zone.shzones.jsonfrom the old directory when the new one has none, whichever directory the snapshot came fromplugins/context-usage/scripts/context-zone.shplugins/plugin-quality/scripts/context-zone.shplugins/context-usage/skills/setup/SKILL.mdplugins/context-usage/skills/setup/SKILL.mdcheckstep 8 and theapplymigration that moves and removes itplugins/context-usage/scripts/context-zone.test.shEARLIER_REL: the three fallback cases (snapshot only in the earlier directory; the newzones.jsonapplied to it; the new snapshot winning), removed with the resolver's fallback lineplugins/plugin-quality/scripts/context-zone.test.shplugins/context-usage/hooks/register.tsxEARLIER_DIR: the module also reads the operator'szones.jsonthere when the new one is absent, and a session's.compactedmarker, so a session compacted before the upgrade and resumed after it still reportsevidence_degradedplugins/context-usage/hooks/context-usage.test.tszones.jsonand marker fallbacks (each fails without its fallback)plugins/plugin-quality/skills/audit/SKILL.mdgit ls-files | grep -i -e context-guard -e context_guardprints nothing. Fragment files are namedrename-to-context-usage-*.md, not by the branch slug, so no tracked path carries the old name.Released entries corrected in place (rule in the header of
scripts/check-changelog-parity.sh, #2388; every## [<v>]heading kept,--check-preservedgreen). Each plugin's fragment names its versions:context-usage: the title and [0.1.0], [0.2.0], [0.3.0], [0.4.0], [0.4.7], [0.5.0], [0.5.3], [0.7.0], [0.7.14], [0.7.17], [0.7.21], [0.7.40], [0.7.62], [0.7.69], [0.7.71], [0.7.73], [0.7.85], [0.7.88], [0.8.0], [0.8.1], [0.10.0], [0.11.0], [0.12.0], [0.12.1], [0.12.2], [0.13.4], [0.14.0], [0.15.0], [0.17.0], [1.0.0], [1.0.2], [1.0.9], [1.2.0], [2.0.0], [3.0.4], [3.0.6], [4.0.0]attribution: [0.3.1], [0.3.2]context-budget: [0.3.0], [0.6.14], [0.15.3], [1.1.0], [1.1.7]desktop-notification: [0.6.24]disk-hygiene: [0.20.33]docs-hygiene: [0.9.0], [0.9.1]; in [0.9.0] the superstring example now renamesusageso it still holdsfirecrawl: [0.5.5]guardrails: [0.18.0]harness-config: [0.40.17]harness-ops: [3.14.0], [7.0.1], [8.12.38]implementation: [0.21.2]planning: [0.73.0]playwright: [0.6.7]plugin-quality: [0.1.0], [0.3.0], [0.7.11], [0.7.19], [0.7.21], [0.13.6], [0.13.8], [0.13.9], [0.14.7], [0.18.10]rate-limit-guard: [0.3.0], [0.4.2], [0.4.3], [0.7.18], [0.7.21], [0.7.24], [0.7.25], [0.7.34], [0.8.6], [0.8.8], [0.8.9], [0.8.11], [0.8.17]repo-hygiene: [0.10.17]session-flow: [0.17.19], [0.21.0], [0.23.0], [0.27.0], [0.34.14], [0.44.7], [0.48.7], [6.3.0], [7.7.0], [7.9.0]docs/contracts/hook-telemetry/CHANGELOG.md(three lines),docs/contracts/retired-conventions/CHANGELOG.md(one line).Verification
claude plugin test plugins/context-usage: 341 pass, 0 fail (the new earlier-directory marker test fails without the fallback) (hooks/context-usage.test.ts,hooks/zone.test.ts);claude plugin validate plugins/context-usage: passed.plugins/context-usage/scripts/context-zone.test.sh105/105,hooks/post-compact-mark.test.sh17/17,scripts/cache-line.test.sh24/24,scripts/check-mod-load.test.sh9/9.plugins/plugin-quality/scripts/context-zone.test.sh105/105 (101 before plus four fallback cases; thezones.jsoncase fails on the earlier resolver);zones-inline-drift.test.sh11/11, PASS, not SKIP.plugins/harness-ops/hooks/hook-failure-audit.test.sh193/193.plugins/harness-ops/skills/audit-mod-posture/scripts/mod-posture.test.sh: 51/94 fail locally (the parsed hooks and calls come back empty), and the same 51 fail on a main checkout whoseaudit-mod-posture/scripts/is identical to this branch's base, so the failure is this host's, not this change's. CI decides it.plugins/session-flow/scripts/tests/test_workflow_continuation_rule.py1 passed;.github/scripts/pr-unblock/adjudicate-feedback.test.mjsplusharness-ops/skills/control-claude-code/driver/driver.test.mjs156/156;claude plugin test plugins/rate-limit-guard152/152.heavy); with both, the new one wins (light).scripts/sync-shared-copies.sh --check(812 copies),check-changelog-fragments.sh --check-required origin/main(19 plugins),check-changelog-parity.sh --check-bump,--check-preserved(19 changelogs, 3,748 headings) and--check,check-killswitch-hoist.sh,check-hook-userconfig-argv.sh,check-plugin-manifest-presence.sh,check-plugin-catalog-enablement.sh: all pass.scripts/check-changelog-fragments.sh --check: all 21 fragments valid.scripts/release-plugins.shin a throwaway clone:context-usage5.0.6 -> 6.0.0 (major), each other plugin a patch, and the new entry carries no old name.typos --config _typos.tomlover the 221 changed files: clean.pr-pipeline-sandbox(mirror) andknowledge-corpus(history), as the issue lists.Follow-ups
context-usagesetup evals'prompt.mddescriptions cite setupSKILL.mdline ranges that had already drifted before this change (for example "lines 14-18" for the pre-computed block, which sat at 16-18); this change's new probe and migration sections shift them further. Re-map them, or cite headings instead.Remaining
Issue #15555 stays open after this PR. Its remaining done-when items live outside this repository:
enabledPluginskey,uninstallPlugins, therenamedPluginsentry with its data-directory migration, and the dotfiles grep,ls-files, manifest and render checks.fleet-convergeon a lane:claude plugin listshowscontext-usage@melodic-softwareand not the earlier id, no saved setting or runtime directory is left under the earlier name, and the rendered user instructions namecontext-usage.The issue is closed by hand once those are checked.
Related
git mvits.changes/context-guard/refactor-rename-to-spelling-61733e28.mdinto.changes/context-usage/before this PR merges, and rename the old name in it; git raises no conflict. The same holds for any other.changes/context-guard/fragment that lands on main first.session: AI Hero
🤖 Generated with Claude Code
https://claude.ai/code/session_01VQb9Pz6CBRwjqpnFDbP9Rr