Repository navigation
Description
Problem
Rename the context-guard plugin to context-usage, completely. The new name says what the plugin reports, which is how much of the context window a session is using. "Guard" describes one behavior, the zone gate, not the concern.
When this is done:
- no current-state reference to the old name remains in this repository or its companion repositories;
- every lane runs
context-usage@melodic-software; - the runtime directory
~/.claude/context-guard/and the MCP toolmcp__context-guard__statusare gone, replaced by~/.claude/context-usage/andmcp__context-usage__status; - no saved setting or operator file is left under the old name.
This is the largest of the five renames. Locations were taken on main at 606fdf680205dc1f7039aab0531ea6043b5ed85f. Line numbers move, so find each location by its quote or by grep.
Why
Q107 and Q133 are the owner's decisions to rename five plugins after their concern rather than their tool or current behavior: typos-format to spelling, ruff-format to python-format, biome-format to javascript-format, context-guard to context-usage, and rate-limit-guard to rate-limits.
- Owner, 2026-11-11: "We do need to decouple ... low coupling, high cohesion".
- Owner, 2026-11-12: "we need to make sure everything's migrated: nothing cosmetic, nothing left behind. For rename, it needs to be a complete rename, and nothing left over with the old name."
Under the 2026-11-12 decision:
- Every item a previous rename treated as optional is required.
- The runtime directory and the MCP tool rename as well.
- Saved option values and operator files are migrated, not reset. #15372 sets the precedent for the changelog fragment's form only.
The playbook rule "no deprecation shim, alias, or pointer to the old name" (docs/migration-playbook.md, rename section) still holds. One-time migration code that moves data and then deletes it is not an alias. List each such line in the PR with its removal condition.
Scope in this repository
Identity
git mv plugins/context-guard plugins/context-usage..claude-plugin/marketplace.json: the entry'snameandsource. The plugin is also a tag on theplugin-qualityentry; change the tag too.plugin.json:name, and the keys below.- Commands:
/context-guard:setupand its other skill commands become/context-usage:…. The install id becomescontext-usage@melodic-software.
Option keys and environment variables
| Old key | New key |
|---|---|
context_guard_hooks_enabled |
context_usage_hooks_enabled |
context_guard_band |
context_usage_band |
context_guard_toast |
context_usage_toast |
These keep their names because they carry no plugin name: model_notices, zone_report_mode, zone_line_data. That follows #15372, which renamed only the key that carried the renamed name.
Each variable follows its key: CLAUDE_PLUGIN_OPTION_CONTEXT_GUARD_* becomes CLAUDE_PLUGIN_OPTION_CONTEXT_USAGE_*. The hook::check_enabled "CONTEXT_GUARD…" calls and the test variables follow the same way.
Runtime contracts
-
Directory.
~/.claude/context-guard/becomes~/.claude/context-usage/. It holds:context/<session_id>.json, the snapshot;context/<session_id>.compacted, the PostCompact marker;zones.json, an operator file thatsetup applywrites;cache-line.mjs, whichsetup apply cache-linecopies there.
The directory name is the
CONTRACT_DIR = 'context-guard'literal inhooks/register.tsx.reference/reader-contract.mdowns the documented paths. -
MCP tool.
mcp__context-guard__statusbecomesmcp__context-usage__statuswith no code change: the tool registers asname: 'status', and the server name comes from the plugin name. Update every caller and every mention:- the plugin's own
README.md,reference/reader-contract.md,reference/cloud-headless-capture.md,scripts/check-mod-load.shand its test,skills/setup/SKILL.md,hooks/context-guard.test.ts, and thesu-check-six-option-rows-read-onlyeval (case.yaml,samples/module-row.json); plugins/session-flow/skills/keep-going/SKILL.md,plugins/session-flow/skills/workflow/SKILL.md,plugins/session-flow/skills/workflow/context/continuation.mdandplugins/session-flow/skills/workflow/evals/evals.json;plugins/planning/skills/interview/context/routing.md;plugins/plugin-quality/skills/setup/SKILL.md;plugins/harness-ops/skills/lanes/SKILL.md;plugins/harness-ops/skills/audit-mod-posture/scripts/mod-posture.test.sh, which uses the long formmcp__plugin_context-guard_context-guard__status.
No
allowed-tools:or settings allow rule names the tool, in this repository, dotfiles or any orgsettings.json. Grep again before closing. - the plugin's own
-
Mod literals in
hooks/register.tsxthat the directory move does not change:CONTRACT_DIR;- the
PREFIXtranscript prefix; $.command.register({ name: 'context-guard' }), the/context-guardslash command, which becomes/context-usage;- the
command.runmatcher; - the README URL.
-
Readers outside the plugin. All of them must read the new path:
lib/context-zone.sh, two$HOME/.claude/context-guard/...lines, and its vendored copyplugins/plugin-quality/scripts/context-zone.sh;lib/context-zone.fixtures.mjsandplugins/plugin-quality/scripts/context-zone.fixtures.mjs;- the session-flow and planning skills above, which go through the MCP tool or the snapshot;
- the dotfiles statusline (see Companion changes).
Files whose names carry the old name
hooks/context-guard.test.tsbecomeshooks/context-usage.test.ts..claude/skills/control-claude-code-plugins/features/context-guard/becomesfeatures/context-usage/.- Grep the moved tree for any other file name containing the old name;
git ls-files | grep -i -e context-guard -e context_guardmust print nothing.
References inside the moved directory (about 58 files)
plugin.json, hooks/register.tsx (16 or more lines), hooks/context-guard.test.ts, hooks/post-compact-mark.sh, hooks/payload.sh, hooks/hooks.json, reference/reader-contract.md, reference/cloud-headless-capture.md, scripts/context-zone.sh, scripts/cache-line.mjs, scripts/check-mod-load.sh, scripts/context-zone.fixtures.mjs, lib/write-snapshot.mjs (vendored), skills/setup/SKILL.md, the evals, and README.md.
The README's #published-zone-for-status-lines anchor is linked from dotfiles. Keep the anchor text stable, or update the dotfiles link in the paired PR. The CHANGELOG.md title line and released sections change too (see "Owner ruling on released history" below).
References outside the moved directory (about 87 files)
- Other plugins' code:
plugins/plugin-quality/scripts/context-zone.sh(vendored fromlib/context-zone.sh) andcontext-zone.fixtures.mjs;plugins/plugin-quality/.claude-plugin/plugin.json, where both the description and a keyword name the plugin;plugins/plugin-quality/probes/audit.json,plugins/plugin-quality/probes/report.json;plugins/context-budget/probes/audit.json,plugins/context-budget/skills/audit/reference/levers.json;plugins/harness-ops/skills/lanes/scripts/lane-launcher.sh, a comment it shares with rate-limit-guard;plugins/rate-limit-guard/lib/write-snapshot.mjs(vendored).
- Other plugins' prose (24 files):
- plugin-quality:
README.md,skills/audit/SKILL.md,skills/setup/SKILL.md,skills/audit/reference/evidence-packet.md. - session-flow:
keep-going/SKILL.md,workflow/SKILL.md,workflow/context/continuation.md,orchestrate/SKILL.md,running-retro/SKILL.md,handoff/SKILL.md. - planning:
interview/context/routing.md, anddesign/reference/type-discipline/typescript.md, which citesplugins/context-guard/hooks/zone.tsandregister.tsxby path. - context-budget:
README.md,skills/audit/SKILL.md,skills/audit/reference/report.md. - docs-hygiene:
skills/rename-references/context/patterns.mdandtriage.mdusecontext-guardas the hyphen-superstring example. Change the example tocontext-usage. It still containscontext, so the examples keep working; re-read each one after the edit. - harness-ops:
skills/lanes/SKILL.md,skills/audit-skill-visibility/reference/usage-counters.md. - Others:
implementation/skills/implement-dispatch/SKILL.md,source-control/skills/worktree/SKILL.md,autonomy/reference/prerequisite-resolution.md,rate-limit-guard/README.mdandrate-limit-guard/skills/setup/SKILL.md.
- plugin-quality:
docs/(25 files):- ADRs 0018, 0028, 0052 and 0093. In ADR 0093, rename the dated review headings too and change the current-state carve-out paths. ADRs 0004 and 0048 hold dated history: rename each line too, per the owner ruling below.
- Contracts:
hook-telemetry/README.md;- the
descriptionfields ofhook-telemetry/data/post-compact-mark.schema.jsonandzone-crossing-inject.schema.json(their$idURLs carry no plugin name); hook-budget,hook-observability,config-cascadeandretired-conventions.
docs/conventions/bugs.yaml, which holds the globplugins/context-guard/scripts/*.sh.- Other docs:
docs/glossary.md,docs/finding-your-unknowns.md,docs/plugin-philosophy.md,docs/cursor-compatibility.md. - Upstream records that name the plugin in a current disposition:
docs/upstream/aihero-course.md,docs/upstream/claude-code.md,docs/upstream/claude-dev-sonnet-5-5-blog.md,docs/upstream/mattpocock-skills.md,docs/upstream/platform-claude-com-prompting-claude-fable-5-2.md,docs/upstream/typesafe-jev.md.
.github/:.github/scripts/pr-unblock/adjudicate-feedback.test.mjsusesdependencies: ["context-guard"]as a fixture value. Rename it.- Tests:
plugins/plugin-quality/scripts/context-zone.test.sh(24 lines);plugins/plugin-quality/scripts/zones-inline-drift.test.sh(see Traps);plugins/harness-ops/hooks/hook-failure-audit.test.sh. Its lines were copied from real error records namingplugins/context-guard/hooks/zone-gate.sh. Rewrite them with the new path; they are fixtures, not a record;plugins/harness-ops/skills/audit-mod-posture/scripts/mod-posture.test.sh;plugins/harness-ops/skills/control-claude-code/driver/driver.test.mjs;- eval prompts in session-flow
workflowandkeep-going, planninginterview, implementationimplement-dispatch, plugin-qualityauditandsetup, harness-opsaudit-skill-visibility, and docs-hygienerename-references; plugins/session-flow/scripts/tests/test_workflow_continuation_rule.py, which pins a sentence incontinuation.md, so change the two together;plugins/rate-limit-guard/hooks/rate-limit-guard.test.ts, one line.
- Root and scripts:
lib/context-zone.sh,lib/context-zone.fixtures.mjs,lib/write-snapshot.mjs;scripts/cross-plugin-source-registry.txt(four lines),scripts/affected-tests-no-suite.txt;- the control skill
SKILL.mdrow; - the sorted lists:
scripts/shared-copies.txt(several lines),scripts/em-dash-purged-paths.txt,scripts/fragment-plugins.txt,scripts/suite-seconds.txt. Moving the entry means re-sorting each list.
Generated files: regenerate, never hand-edit
docs/catalog.md:node scripts/generate-catalog.mjs.- The cheat sheet:
node scripts/generate-cheatsheet.mjs. docs/architecture/landscape.json:plugins/architecture/skills/map-landscape/scripts/landscape-record.sh.- Vendored copies (
lib/context-zone.sh,lib/write-snapshot.mjsand the others inscripts/shared-copies.txt):scripts/sync-shared-copies.sh.
Traps: do not run a blind sed
- Silent drift skip.
plugins/plugin-quality/scripts/zones-inline-drift.test.shhard-codes../../context-guard/reference/reader-contract.mdand prints SKIP when that path is missing. If the path is not updated, the drift lane goes inert without failing. Update it, and confirm the test reports PASS, not SKIP. - The rate-limit-guard plugin names this one. Change these in this PR, keeping rate-limit-guard's own name, which changes in the rate-limits issue:
plugins/rate-limit-guard/README.md;plugins/rate-limit-guard/skills/setup/SKILL.md;plugins/rate-limit-guard/lib/write-snapshot.mjs, throughscripts/sync-shared-copies.sh;rate-limit-guard.test.ts.
- Directory-only hits.
post-compact-mark.shandregister.tsxhold the path as a literal string, so a content grep that skips the moved directory misses them. - After the
git mv, run/docs-hygiene:rename-references context-guard context-usage.
Changelog
- Run
scripts/new-changelog-fragment.sh context-usage major, which writes.changes/context-usage/<slug>.mdwithbump: major. Write fragments for any other plugin the checks require, such as plugin-quality for its vendored copy and keyword. - The fragment names the new id, the new commands, keys, directory and MCP tool, and tells the operator what to re-run if the migration below did not reach their machine. The old-to-new mapping goes in the PR body.
- Rename the old name in the released
CHANGELOG.mdsections too. Released-entry body edits follow the in-place correction rule in the header ofscripts/check-changelog-parity.sh(Released CHANGELOG entries are being edited in place (#2312 rewrote two lines inside the shipped 0.51.12) — decide whether that is sanctioned #2388): name each edit in the PR body and in the new release entry.--check-preservedwatches version headings only; keep every heading and do not change the gate. - After merge, confirm the release PR releases
context-usageand records nothing undercontext-guard.
Companion changes in other repositories (each its own paired PR)
| Repo | Change |
|---|---|
melodic-software/dotfiles |
See below. Required. |
| others | No other org repository names context-guard in current state. Code search found only this repository and dotfiles. Re-grep before closing. |
Not edited, with the reason:
claude-lane-sandboxis archived.pr-pipeline-sandboxholds mirror copies, which refactor(source-control)!: rename worktree-add-claim-gate to worktree-add-claim #15372 left untouched.- The
knowledge-corpusresearch records are history.
dotfiles PR:
.chezmoidata/claude.json:- In
claudeSettings.force.enabledPlugins, replace"context-guard@melodic-software": truewith"context-usage@melodic-software": true, in sorted position. This plugin isdefaultEnabled: falsein the catalog, so it installs only when declared here. Without this edit the new id never installs. force.pluginConfigshas nocontext-guardentry today. If one exists at build time, move it to the new id under the new key names, values unchanged.- Add
"context-guard@melodic-software"toclaudeSettings.uninstallPlugins.
- In
- Saved-settings rename map: add
context-guard→context-usagewith the three key pairs. The map is built in the spelling issue's dotfiles PR. If that has not merged, build it here, the same way. dot_claude/CLAUDE.md.tmpl: change "context-guard names the context zone" to namecontext-usage. This file renders into the user CLAUDE.md.- Statusline:
dot_claude/statusline/lib/context-zones.sh: the header lines,CONTEXT_ZONE_SNAPSHOT_DIR="$HOME/.claude/context-guard/context"(which becomescontext-usage), and one more mention.dot_claude/statusline/README.md: the fallback note, and the section that links the ccp README URL and its anchor.dot_claude/statusline/tests/context-zones.test.sh(three places) anddot_claude/statusline/tests/bars-default.test.sh.
- Golden files: regenerate the affected
tools/chezmoi-template-lint/golden/*.sha256withGet-RenderHash.ps1 -Fixture <fixture>and log the regeneration ingolden/README.md. - Self-Modification: cite Q107/Q133 and the 2026-11-12 quote for the soft-deny on
.chezmoidata/claude.jsonanddot_claude/**. - Merge timing:
tools/check-plugin-manifest/check.shpasses only after the ccp PR merges. Merge right after it.
Migration: nothing left behind
-
Installed old id. It is uninstalled on every lane at the next
fleet-convergethroughuninstallPlugins, without--keep-data, so~/.claude/plugins/data/context-guard-melodic-software/goes too. -
Saved option values: migrate, do not reset.
dot_claude/modify_settings.jsoncopies each old-idpluginConfigsvalue to the new id under its new key, unless that key is already set, then deletes the old entry. The keys that keep their names (model_notices,zone_report_mode,zone_line_data) are copied as they are. -
On-disk data under
~/.claude/context-guard/: move it, regenerate the rest, then remove the old directory.zones.json, a custom operator file: move it to~/.claude/context-usage/zones.jsonunchanged. It must not reset to the shipped bands.context/*.jsonsnapshots and.compactedmarkers: per-session state. The new mod writes them fresh. Do not carry them over; they go with the old directory.cache-line.mjs: regenerate it under the new directory, the stepsetup apply cache-lineruns, and repoint anystatusLinecommand that references the old path.- Remove
~/.claude/context-guard/.
Run this unattended on every lane in the dotfiles plugin installer step that already handles
uninstallPlugins(.chezmoiscripts/run_after_install-claude-plugins.sh.tmplandrun_install-claude-plugins.ps1.tmpl). For a machine without dotfiles,/context-usage:setup checkreports a leftover~/.claude/context-guard/as drift and names the fix, and/context-usage:setup applyperforms the same move. Both are migration lines, listed in the PR with their removal condition: every lane has converged and the checks below pass.
Acceptance criteria
- On merged ccp
main,git grep -n -i -e 'context-guard' -e 'context_guard' -e 'contextguard' -e 'context guard'returns only the migration lines named in the PR, and the PR lists every remaining hit with its removal condition. - The same grep over dotfiles
mainreturns only theuninstallPluginsentry, the rename-map entry, the migration step, and the migration lines listed in its PR. -
git ls-files | grep -i -e context-guard -e context_guardprints nothing in either repository. - These tests pass:
plugins/context-usage/hooks/context-usage.test.ts;plugins/context-usage/scripts/check-mod-load.test.sh;plugins/plugin-quality/scripts/context-zone.test.sh;plugins/plugin-quality/scripts/zones-inline-drift.test.sh, reporting PASS and not SKIP;plugins/harness-ops/hooks/hook-failure-audit.test.sh;plugins/harness-ops/skills/audit-mod-posture/scripts/mod-posture.test.sh;plugins/session-flow/scripts/tests/test_workflow_continuation_rule.py;.github/scripts/pr-unblock/adjudicate-feedback.test.mjs.
-
ci-statusis green, including the changelog fragment and parity checks and the shared-copies drift check. - On the dotfiles PR, after the ccp merge,
tools/check-plugin-manifest/check.sh, the golden render check and the statusline tests pass. - After both PRs merge and one
fleet-convergeon a lane:claude plugin listshowscontext-usage@melodic-softwareand notcontext-guard@melodic-software;~/.claude/context-guard/does not exist;~/.claude/context-usage/zones.jsonholds the lane's previous custom bands, if it had any;- a new session lists
mcp__context-usage__statusand notmcp__context-guard__status; - the statusline shows the zone from the new snapshot directory;
~/.claude/settings.jsonhas nocontext-guard@melodic-softwareentry underpluginConfigs, and every saved value sits under its new key unchanged.
- The rendered user CLAUDE.md names
context-usage, notcontext-guard.
Order and dependencies
- This issue does not depend on the formatter renames. It goes before rate-limits: each plugin's directory and tests name the other, and both touch
lane-launcher.sh,harness-ops/skills/lanes/SKILL.mdand ADRs 0018, 0052 and 0093. Context-usage goes first because all of its outside readers fail soft and none of them is a loop lane. - Merge the ccp PR first, then the dotfiles PR within the same hour.
Open PRs to rebase around
Re-run gh pr list -R melodic-software/claude-code-plugins --state open before starting. These were open at filing time:
- #15504 adds
.changes/fragments for all five plugins. - #15505 edits context-budget, implement-dispatch and plugin-quality audit prose.
- #15536 edits
harness-ops/skills/lanes/SKILL.mdanddocs/contracts/loop-lane/README.md.
A fragment under .changes/context-guard/ that merges after this rename leaves a fragment for a plugin that no longer exists, and git raises no conflict. Before merging, git mv any such fragment into .changes/context-usage/.
Owner ruling on released history
Owner, 2026-11-12: "I want a clean cutover". Released CHANGELOG sections, ADR text and dated records are renamed to the new name too. The only old-name hits allowed after the rename are the dotfiles uninstallPlugins entry, the rename-map migration entry, and one-time migration lines that must read the old name, each listed in the PR with its removal condition.
Related
- Owner decisions Q107 and Q133 (2026-11-11), and the 2026-11-12 complete-rename decision.
- Precedent: #15372.
Metadata
Metadata
Assignees
Labels
Type
Fields
Work status
Priority
Activity
github-actions commentedon Nov 12, 2026
Size: Large
Complexity: Medium
Uncertainty: Known
Flags: none
Blocked by: none
Understood: a complete rename of the
context-guardplugin tocontext-usage. That covers the plugin directory, marketplace entry, option keys and env vars, the~/.claude/context-guard/runtime directory, the MCP tool name, outside readers, docs, tests and generated files. It also covers a paired dotfiles PR with settings and on-disk migration. The issue gives the scope, traps, acceptance criteria and owner rulings, so I found nothing missing.The work spans about 145 files plus a second repository, so it will probably need splitting into steps.
I found no open duplicate. #15552, #15553, #15554 and #15556 are the sibling renames, and #15372 is the precedent the issue names.
Automated triage. A maintainer reviews it.
melodic-automation-lanes commentedon Nov 12, 2026
The work-resolve-issue run that
agent-readystarted ended over 3 hours ago with no report and no pull request. work-unblock removed and addedagent-readyback to start a fresh run on main's workflow files. If this run ends the same way, it re-fires the issue again, waiting longer each time.github-actions commentedon Nov 12, 2026
The triage sweep dispatched intake triage for this issue (dispatch 1; 2 runs that reach intake, or 6 dispatches, hand it to a maintainer).
fix(context-usage): carry compaction markers across the rename
fix(context-usage): read the new zones.json during the migration window
fix(context-usage): read zones.json from the earlier directory until …
melodic-automation-lanes commentedon Nov 14, 2026
Not admitted to the issue lane: merged pull request #15633 names it with
Refs:after its newest decision or refinement comment, so its work may already be done: close the issue if it is, or post a comment whose first line is**Decision recorded.**saying what is left, which sends it back through intake. Admission takes the issue once each of those is met, when intake triages it again (.github/actions/resolve-config/admission-rules.json).kyle-sexton commentedon Nov 14, 2026
Closed by hand after the fleet check on the WSL lane (2026-11-14):
context-guard@melodic-softwareis not installed,context-usage@melodic-softwareis; nocontext-guardruntime or data folder exists; every running session was reloaded with/reload-plugins --force. The only old-id hit in user settings is thefalseentry the dotfilesuninstallPluginslist renders.