Skip to content

refactor: rename rate-limit-guard to rate-limits #15556

Closed

Description

@kyle-sexton

Problem

Rename the rate-limit-guard plugin to rate-limits, completely. The new name says what the plugin reports: the account's rate-limit windows. "Guard" names one behavior.

When this is done:

  • no current-state reference to the old name remains in this repository or its companion repositories;
  • every lane runs rate-limits@melodic-software;
  • the runtime directory ~/.claude/rate-limit-guard/ and the MCP tool mcp__rate-limit-guard__status are gone, replaced by ~/.claude/rate-limits/ and mcp__rate-limits__status;
  • no saved setting or recorded data is left under the old name.

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."

The 2026-11-12 decision has three consequences here:

  • Every item a previous rename treated as optional is required. That includes the account-rotation RateLimitGuard* identifiers.
  • The runtime directory and the MCP tool rename too.
  • Saved values 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/rate-limit-guard plugins/rate-limits.
  • .claude-plugin/marketplace.json: name and source.
  • plugin.json: name, plus the keys below.
  • Commands: /rate-limit-guard:setup, /rate-limit-guard:band and the other skill commands become /rate-limits:….
  • Install id: rate-limits@melodic-software.

Option keys and environment variables

Old key New key
rate_limit_guard_enabled rate_limits_enabled
rate_limit_guard_band rate_limits_band
rate_limit_guard_toast rate_limits_toast

These keys keep their names, because they carry no plugin name: rate_limit_report_mode, rate_limit_line_threshold, rate_limit_approach_pct, rate_limit_line_data. This matches #15372, which renamed only the key that carried the renamed name.

The environment variables follow their keys:

  • CLAUDE_PLUGIN_OPTION_RATE_LIMIT_GUARD_* becomes CLAUDE_PLUGIN_OPTION_RATE_LIMITS_*.
  • hook::check_enabled "RATE_LIMIT_GUARD" changes the same way.
  • lib/hook-utils.test.sh (around lines 3724-3777) uses RATE_LIMIT_GUARD as its example check_enabled name. Change it to the new name.

Runtime contracts

Directory. ~/.claude/rate-limit-guard/ becomes ~/.claude/rate-limits/.

  • It holds rate-limits.json, the snapshot, which keeps its file name because the name describes the content.
  • It also holds stop-events.jsonl, the StopFailure record.
  • The directory name comes from the CONTRACT_DIR literal in hooks/register.tsx.
  • reference/reader-contract.md owns the paths.

MCP tool. mcp__rate-limit-guard__status becomes mcp__rate-limits__status with no code change: the tool registers as name: 'status', and the server name comes from the plugin name. Update every caller and mention:

  • the plugin's README.md, reference/reader-contract.md, scripts/check-mod-load.sh and its test, skills/setup/SKILL.md, and hooks/rate-limit-guard.test.ts;
  • plugins/session-flow/skills/keep-going/SKILL.md (two places);
  • plugins/session-flow/skills/orchestrate/context/sources.md;
  • plugins/source-control/skills/babysit-loop/SKILL.md;
  • plugins/work-items/skills/work-loop/SKILL.md.

No allowed-tools: or settings allow rule names the tool anywhere in the org. Grep again before closing.

Mod literals in hooks/register.tsx that the directory move does not change:

  • CONTRACT_DIR;
  • the transcript prefix;
  • the /rate-limit-guard slash command, which becomes /rate-limits. It appears in its registration and in the command.run matcher;
  • the README URL.

Readers outside the plugin. All of them move to the new path:

  • The inline floor. The loop-lane prompts and skills copy the fixed snapshot path verbatim. These copies must stay identical to reference/reader-contract.md under scripts/check-loop-lane-floor-drift.sh, so all of them change in this one PR:
    • plugins/work-items/skills/work-loop/SKILL.md, plugins/work-items/skills/work-loop/reference/paused-wait.md and plugins/work-items/skills/work-loop/reference/guard-reader-rules.md;
    • plugins/work-items/skills/attend-queue/SKILL.md;
    • plugins/source-control/skills/babysit-loop/SKILL.md and plugins/source-control/skills/babysit-loop/reference/paused-wait.md;
    • plugins/source-control/skills/pull-request/reference/watch-handoff.md;
    • plugins/docs-hygiene/skills/extract-ssot/context/orchestrated-mode.md;
    • prompts/loops/loop-lane-profile-claude-code-plugins.md and prompts/loops/loop-lane-prompts.md.
  • The audit-install-state path matcher. plugins/harness-ops/skills/audit-install-state/scripts/install_state.py matches r"rate-limit-guard/.*\.tmp\.\d+", and its test test_install_state.py checks that matcher.
  • The account-rotation dashboard (see Companion changes).

Files whose names carry the old name

  • hooks/rate-limit-guard.test.ts becomes hooks/rate-limits.test.ts.
  • .claude/skills/control-claude-code-plugins/features/rate-limit-guard/ becomes features/rate-limits/.
  • git ls-files | grep -i -e rate-limit-guard -e rate_limit_guard must print nothing.

References inside the moved directory (about 17 files)

  • plugin.json and README.md (24 lines).
  • hooks/register.tsx (16 lines) and hooks/rate-limit-guard.test.ts (68 lines).
  • hooks/record-rate-limit-stop.sh and its test. Their file names describe the content, so they keep them.
  • reference/reader-contract.md, scripts/check-mod-load.sh and its test, and skills/setup/SKILL.md (12 lines).
  • Five eval prompts.
  • lib/write-snapshot.mjs, a vendored copy.
  • In CHANGELOG.md, the title line and the released sections are renamed; see "Owner ruling on released history" below.

References outside the moved directory (about 58 files)

Other plugins' code:

  • plugins/context-usage/hooks/post-compact-mark.sh;
  • plugins/context-usage/lib/write-snapshot.mjs (vendored);
  • plugins/harness-ops/skills/audit-install-state/scripts/install_state.py;
  • plugins/harness-ops/skills/lanes/scripts/lane-launcher.sh, a comment.

These paths assume the context-usage rename has merged.

Other plugins' prose, beyond the floor copies:

  • plugins/docs-hygiene/skills/extract-ssot/actions/batch.md;
  • plugins/docs-hygiene/skills/audit-encapsulation/SKILL.md;
  • plugins/session-flow/skills/orchestrate/context/sources.md;
  • plugins/harness-ops/skills/lanes/SKILL.md (two places);
  • plugins/harness-ops/skills/audit-install-state/SKILL.md and reference/name-schemes.md;
  • plugins/autonomy/reference/prerequisite-resolution.md;
  • plugins/context-usage/skills/setup/SKILL.md and plugins/context-usage/README.md.

docs/:

  • ADRs 0018, 0028 and 0052.
  • ADR 0093: rename the dated review headings too and change the current-state carve-out paths.
  • ADR 0048 holds release counts, which are history. Rename that line too, per the owner ruling below.
  • docs/contracts/config-cascade/README.md.
  • docs/contracts/hook-budget/README.md and docs/contracts/hook-observability/README.md.
  • docs/contracts/loop-lane/README.md. Its heading anchor #6-rate-limit-guard-binding is linked from docs/conventions/loop-lane/README.md and prompts/loops/loop-lane-prompts.md. Rename the heading and every link together.
  • docs/contracts/retired-conventions/README.md.
  • docs/cursor-compatibility.md.
  • docs/upstream/claudedevs-cost-performance.md.

.github/: none today. Grep it anyway.

Tests:

  • lib/write-snapshot.test.mjs;
  • lib/hook-utils.test.sh;
  • plugins/context-usage/hooks/context-usage.test.ts, one line;
  • plugins/harness-ops/skills/audit-install-state/scripts/test_install_state.py;
  • plugins/session-flow/skills/keep-going/evals/evals.json;
  • plugins/source-control/skills/babysit-loop/evals/evals.json;
  • plugins/work-items/evals/wl-adaptive-cap-clamp-and-guard-pause/prompt.md;
  • scripts/check-loop-lane-floor-drift.test.sh.

Code comments that name a past run: plugins/evals/skills/plugin-eval/scripts/convert-evals-json.py and plugins/evals/skills/validate/scripts/validate-cases.py name "#8635 rate-limit-guard run". Reword both to cite the run by number only.

Recorded data: plugins/source-control/skills/babysit-prs/scripts/verify-legacy-fails.json holds head_ref: fix/lane-rate-limit-guard, a real branch name copied from a past PR. It is a record. Rename it too, per the owner ruling below.

Root and scripts:

  • lib/write-snapshot.mjs;
  • scripts/check-loop-lane-floor-drift.sh (header and SOURCE=);
  • scripts/cross-plugin-source-registry.txt (two lines);
  • the control skill's SKILL.md row;
  • the sorted lists scripts/em-dash-purged-paths.txt, scripts/fragment-plugins.txt, scripts/shared-copies.txt (several lines) and scripts/suite-seconds.txt. The entry moves, so re-sort 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.
  • The vendored copies, including lib/write-snapshot.mjs: scripts/sync-shared-copies.sh.

Traps: do not run a blind sed

  • Keys that keep their names. rate_limit_report_mode and the other rate_limit_* keys, plus rate-limits.json and record-rate-limit-stop.sh, do not contain the old name. A loose pattern such as rate.limit would catch them. Grep with the exact old forms only.
  • The floor drift gate. scripts/check-loop-lane-floor-drift.sh exits 2 when its source is unreadable, and fails when any floor copy differs from the source. Change the source and every copy in the same commit.
  • Directory-only hits. register.tsx holds the path literal, and so do the vendored write-snapshot.mjs comments.
  • After the git mv, run /docs-hygiene:rename-references rate-limit-guard rate-limits.

Changelog

  • Run scripts/new-changelog-fragment.sh rate-limits major, which writes .changes/rate-limits/<slug>.md with bump: major. Add any fragment the checks require for the other plugins whose skills change (work-items, source-control, docs-hygiene, session-flow, harness-ops).
  • The fragment names the new id, commands, keys, directory and MCP tool. The old-to-new mapping goes in the PR body.
  • Rename the old name in the released CHANGELOG.md sections too. Released-entry body edits follow the in-place correction rule in the header of scripts/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-preserved watches version headings only; keep every heading and do not change the gate.
  • After merge, confirm the release PR releases rate-limits and records nothing under rate-limit-guard.

Companion changes in other repositories (each its own paired PR)

Repo Change
melodic-software/dotfiles See below. Required.
melodic-software/claude-code-account-rotation Required. src/ClaudeCodeAccountRotation.App/Configuration/ConfigurationDefaults.cs: TeeDirectoryName = "rate-limit-guard" becomes "rate-limits". TeeFileName = "rate-limits.json" stays. Rename every RateLimitGuard* identifier and file, for example RateLimitGuardTeeFileReader.cs, along with doc comments and tests. About 14 files name it: ConfigurationDefaults.cs, RateLimitGuardTeeFileReader.cs, DashboardAssembler.cs, ImportEndpoints.cs, SwitchEndpoints.cs, AppComposition.cs, WslSwitch.cs, IPeerRotationInstance.cs, src/ClaudeCodeAccountRotation.Core/Quota/StatuslineSnapshot.cs, and their tests. The local clone used for this list predates that repository's latest main, so re-grep it. Cut a release. If dotfiles pins the account-rotation version, bump the pin in the dotfiles PR.

Not edited, and why:

dotfiles PR:

  • .chezmoidata/claude.json:
    • claudeSettings.force.enabledPlugins: replace "rate-limit-guard@melodic-software": true with "rate-limits@melodic-software": true, in sorted position. The plugin is defaultEnabled: false, so the new id installs only when declared here.
    • force.pluginConfigs: no rate-limit-guard entry exists today. If one exists at build time, move it under the new id, with new key names and values unchanged.
    • Add "rate-limit-guard@melodic-software" to claudeSettings.uninstallPlugins.
  • Saved-settings rename map: add rate-limit-guard → rate-limits, with the three key pairs. The spelling issue builds this map.
  • .chezmoiignore: the .claude/rate-limit-guard line becomes .claude/rate-limits.
  • dot_claude/statusline/tests/entrypoint.test.sh (around lines 49-54): the test checks that a leftover rate-limit-guard@melodic-software install record is ignored. Rewrite it with a generic made-up plugin id. The behavior under test stays; the old name goes.
  • Dated records: docs/adr/0002… and dot_claude/statusline/perf/RESULTS.md are renamed too, per the owner ruling below.
  • Golden files: regenerate the affected tools/chezmoi-template-lint/golden/*.sha256 with Get-RenderHash.ps1 -Fixture <fixture>, and log the regeneration in golden/README.md.
  • Self-Modification soft-deny: cite Q107/Q133 and the 2026-11-12 quote.
  • Merge timing: tools/check-plugin-manifest/check.sh passes only after the ccp PR merges. Merge right after it.

Migration: nothing left behind

  1. Installed old id. The next fleet-converge uninstalls it on every lane through uninstallPlugins. It runs without --keep-data, so ~/.claude/plugins/data/rate-limit-guard-melodic-software/ goes too.

  2. Saved option values: migrate, do not reset. dot_claude/modify_settings.json uses the rename map:

    • each old-id pluginConfigs value is copied to its new key unless that key is already set;
    • keys that keep their names are copied as they are;
    • the old entry is then deleted.
  3. On-disk data under ~/.claude/rate-limit-guard/: move it, regenerate the rest, then remove the old directory.

    • stop-events.jsonl: a record of past stops. Append it to ~/.claude/rate-limits/stop-events.jsonl, keeping line order.
    • rate-limits.json: the snapshot. The new mod rewrites it from the next API response, so do not carry it over.
    • Leftover *.tmp.* files: drop them.
    • Then remove ~/.claude/rate-limit-guard/.

    Where it runs: in the dotfiles plugin-installer step that already handles uninstallPlugins (run_after_install-claude-plugins.sh.tmpl, run_install-claude-plugins.ps1.tmpl), unattended on every lane. On a machine without dotfiles, /rate-limits:setup check reports a leftover old directory as drift with the fix, and /rate-limits:setup apply performs the move. List these as migration lines with their removal condition.

The lane window

Loop lanes read the snapshot path. If a lane's work-items or source-control skills read the new path while the old mod still writes the old one, or the reverse, the lane reads no snapshot. It then goes reactive-only and gets no early pause at 95% (reference/reader-contract.md: an absent snapshot classifies as unknown). It fails soft, but keep the window short:

  • merge the ccp and dotfiles PRs together;
  • run fleet-converge on each lane promptly.

The account-rotation dashboard also shows no quota until both its release and the new mod are on a host. Its reader treats an absent snapshot as no data, not an error.

Acceptance criteria

  • On merged ccp main, git grep -n -i -e 'rate-limit-guard' -e 'rate_limit_guard' -e 'ratelimitguard' -e 'rate limit 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 and claude-code-account-rotation main returns only:

    • the dotfiles uninstallPlugins entry, rename-map entry and migration step;
    • the migration lines each PR lists.

    No RateLimitGuard identifier remains in account-rotation.

  • git ls-files | grep -i -e rate-limit-guard -e rate_limit_guard -e ratelimitguard prints nothing in ccp, dotfiles or account-rotation.

  • These ccp tests pass:

    • plugins/rate-limits/hooks/rate-limits.test.ts;
    • plugins/rate-limits/scripts/check-mod-load.test.sh;
    • the record-rate-limit-stop test;
    • lib/write-snapshot.test.mjs;
    • lib/hook-utils.test.sh;
    • scripts/check-loop-lane-floor-drift.sh, which exits 0;
    • scripts/check-loop-lane-floor-drift.test.sh;
    • the harness-ops test_install_state.py.
  • ci-status is green, including the changelog fragment and parity checks and the shared-copies drift check.

  • Account-rotation CI passes.

  • On the dotfiles PR, after the ccp merge, dotfiles tools/check-plugin-manifest/check.sh, the golden render check and the statusline tests pass.

  • After all PRs merge and one fleet-converge on a lane:

    • claude plugin list shows rate-limits@melodic-software and not rate-limit-guard@melodic-software;
    • ~/.claude/rate-limit-guard/ does not exist;
    • ~/.claude/rate-limits/rate-limits.json is written after the next API response;
    • the lane's previous stop-events.jsonl lines are present under the new directory;
    • a new session lists mcp__rate-limits__status and not the old tool;
    • ~/.claude/settings.json has no rate-limit-guard@melodic-software pluginConfigs entry, and every saved value sits under its new key unchanged;
    • the account-rotation dashboard shows quota again.

Order and dependencies

  • Prerequisite: start after the context-usage rename merges. Each plugin's directory and tests name the other, and both touch lane-launcher.sh, harness-ops/skills/lanes/SKILL.md and ADRs 0018, 0052 and 0093.
  • Why this one goes last: its dotfiles and account-rotation follow-ups can then land together.
  • Merge order:
    1. The ccp PR.
    2. The dotfiles PR, within the same hour.
    3. The account-rotation release, with the dotfiles pin bump if one is needed, as soon as possible after that.

Open PRs to rebase around

Re-run gh pr list -R melodic-software/claude-code-plugins --state open before starting. At filing time, these were open:

  • #15504 adds .changes/ fragments for all five plugins.
  • #15507 adds .changes/rate-limit-guard/… and edits plugins/rate-limit-guard/README.md, hooks/record-rate-limit-stop.sh and plugins/autonomy/reference/prerequisite-resolution.md.
  • #15536 edits docs/contracts/loop-lane/README.md and harness-ops/skills/lanes/SKILL.md.

A fragment under .changes/rate-limit-guard/ that merges after this rename leaves a fragment for a plugin that no longer exists, and git reports no conflict. Before merging, git mv any such fragment into .changes/rate-limits/.

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.

Blocked by #15555

Activity

  1. self-assigned this
    on Nov 12, 2026
  2. added
    agent-ready
    on Nov 12, 2026
  3. added
    needs-triage
    on Nov 12, 2026
  4. github-actions commented on Nov 12, 2026

    @github-actions
    Contributor

    Size: Large
    Complexity: Medium
    Uncertainty: Known
    Flags: none
    Blocked by: #15555

    Thanks. I read this as a complete rename of the rate-limit-guard plugin to rate-limits. It covers the plugin identity, option keys, the runtime directory, the MCP tool name, references in other plugins and docs, and the paired dotfiles and account-rotation PRs. It also includes a one-time migration of saved settings and on-disk data.

    The scope and acceptance criteria are already exact. The work spans three repositories and many files, so it likely needs splitting.

    The issue says it must start after the context-usage rename, which is #15555 and still open. I listed that as the blocker.

    I found no duplicate among the open issues. No merged pull request already covers this rename.

    Automated triage. A maintainer reviews it.

  5. removed
    needs-triage
    on Nov 12, 2026
  6. removed
    agent-ready
    on Nov 12, 2026
  7. github-actions commented on Nov 12, 2026

    @github-actions
    Contributor

    The triage sweep dispatched intake triage for this issue (dispatch 1; 2 runs that reach intake, or 6 dispatches, hand it to a maintainer).

  8. melodic-automation-lanes commented on Nov 12, 2026

    @melodic-automation-lanes
    Contributor

    Not admitted to the issue lane: its body or a criterion names .claude/skills/control-claude-code-plugins/features/rate-limit-guard/, .claude/rate-limit-guard, .claude/rate-limits, which the issue lane cannot push (patch-protected-path); a builder session takes it. Admission takes the issue once each of those is met, when intake triages it again (.github/actions/resolve-config/admission-rules.json).

  9. kyle-sexton commented on Nov 14, 2026

    @kyle-sexton
    MemberAuthor

    Closed by hand after the fleet check on the WSL lane (2026-11-14): rate-limit-guard@melodic-software is not installed, rate-limits@melodic-software is; a reloaded session lists mcp__rate-limits__status and not the old tool; ~/.claude/rate-limits/rate-limits.json is written after API responses. Sessions on the old code had kept writing ~/.claude/rate-limit-guard/: after every running session was reloaded with /reload-plugins --force it stayed unwritten for ten minutes, its three stranded stop-events.jsonl lines were appended to the new file, and the folder was removed. The only old-id hit in user settings is the false entry the dotfiles uninstallPlugins list renders.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Fields

Work status

confirmed

Priority

medium

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions