gc

gc is a command for Claude Code from Redtropig/harness-anchor. It costs 72 tokens per session (780 once invoked), scanned A, original, MIT.

A read-only command that scans recently changed or active code for drift from project rules and conventions. Drift includes dead code, duplicated helpers, inconsistent error handling, outdated documentation, and other code that still works but no longer fits the project.

In plain words
What is it for?
Use /gc to review a recent change or feature, compare it with golden-rules.md and general code-quality checks, and receive an evidence-based report of recommended fixes.
Why use it?
It finds maintenance problems that ordinary compilation and tests may miss. A fresh analysis context reduces the chance that the same agent that wrote the code overlooks its inconsistencies, while the report leaves changes under human control.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: mentions subagents.

Part of the harness-anchor plugin — 14 skills, 9 commands, 5 agents, 5 hooks shipped together

Good fit Use /gc to review a recent change or feature, compare it with golden-rules.md and general code-quality checks, and receive an evidence-based report of recommended fixes.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/redtropig/harness-anchor/gc
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/Redtropig/harness-anchor

Made for: Claude Code.

Or install harness-anchor, the plugin that ships this one along with the rest of its 14 skills, 9 commands, 5 agents, 5 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for gc

README.md
[![agentmods](https://agentmods.dev/badge/commands/redtropig/harness-anchor/gc.svg)](https://agentmods.dev/commands/redtropig/harness-anchor/gc)
Your own site
<a href="https://agentmods.dev/commands/redtropig/harness-anchor/gc"><img src="https://agentmods.dev/badge/commands/redtropig/harness-anchor/gc.svg" alt="Measured on agentmods" height="20"></a>
Per session 72 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 780 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00072 $0.00780
Opus 5 $0.00036 $0.00390
Sonnet 5 $0.00014 $0.00156
Haiku 4.5 $0.00007 $0.00078

Measured 8d ago against content hash 8de5a5baa65c, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

gc scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/gc.md · 63 lines

How it starts

The opening of the file, as written. The whole thing — 63 lines — stays where its author put it; the contents beside it link to each section on GitHub.

/gc

Scan recent work for drift / entropy / AI slop — code that compiles and passes tests but has rotted away from the project's conventions: duplicated helpers, dead code, inconsistent error handling, stale docs, golden-rule violations. This is the garbage-collection sensor (Concept ⑥) — not git gc.

Like /verify and /test-plan, it uses a fresh-context subagent so the scan isn't biased by the agent that wrote the code. It is report-only — it never refactors in bulk.

Steps

  1. Dispatch drift-analyst via the Task tool:

    Task tool with:
      subagent_type: drift-analyst
      prompt: Scan the changed/active code for drift against golden-rules.md plus the generic drift
              heuristics. Bound the scope to changed files (git diff vs HEAD) or the active feature —
              plus the one deliberate doc-drift exception: an unchanged *.md file still enters scope
              when it mentions a symbol this change touched. Follow the fixed report format.
              Read-only — recommend, do not refactor.
    

    If the user passed a path or feature id as an argument, name it in the prompt.

  2. Surface the report verbatim### Golden-rule violations, ### Generic drift findings, ### Recommended actions, ### Verdict, ### Uncertainties. The point of fresh-context analysis is that the user sees the analyst's actual words.

  3. If verdict is DRIFT FOUND, offer (do not auto-apply):

    • Fix specific findings within the current feature's scope — transparently (show each change), highest-severity first. Do NOT bulk-refactor or wander outside the active feature (that's a scope-jump — confirm first).
    • Capture a recurring finding as a golden rule via the capturing-golden-rules skill, so /gc catches it automatically next time.
    • Leave as-is and note it in session-handoff.md (e.g. deliberate debt to pay later).
  4. If verdict is CLEAN, report it with the .harness-anchor/drift-<ts>.md evidence path. Note that a clean scan is a floor, not a guarantee (the heuristics are partial).

Read the full file on GitHub · 63 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 63 lines · 72 tokens per session scan A 8de5a5baa65c

Subscribe to this mod's changes

gc is a command published in the GitHub repository Redtropig/harness-anchor (13 stars, last pushed 1mo ago), licensed MIT. It adds 72 tokens to every session and 780 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.