/harness-anchor:capturing-golden-rulesfrom harness-anchor
Captures recurring mistakes and code-review conventions as durable, checkable rules in golden-rules.md. Use when the same bad pattern appears twice or AI-generated drift/slop needs a permanent guardrail.
Ships in harness-anchor. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
A one-off fix repairs today's symptom. A golden rule repairs the whole class — it makes the
harness learn so the same mistake can't recur. This skill is the ratchet: turn a recurring
failure into a durable, checkable rule in golden-rules.md.
Hashimoto's principle: "Anytime an agent makes a mistake, engineer a solution so it never makes that mistake again." The fix is a guardrail, not a scolding — blame the process, not the agent. You're improving the environment, not the model.
Capture when the signal is recurring, not a one-off:
/gc (the drift-analyst) flags drift that should have been a rule.One-off edge cases and personal style stay personal — capture what recurs, or what any contributor would hit. (The archive's lesson: 3 rules, not 30.)
Capture happens in the turn you recognize the signal — append the rule, then continue the task. Context is a volatile medium: compaction and attention dilution mean a deferred write gets reconstructed from decayed memory (bias) or never happens at all (the intent itself is displaced).
A rough stub written now beats a polished rule written later:
### GR-<n> — <one-line rule>
- **Why / origin:** <paste the evidence at hand: exact error text, file:line, commit sha>
- **Check:** manual review — <what to look at>
manual review Check lands in /gc's [MANUAL] tier — mechanically harmless until graduated./gc adjudication and
/session-end's flywheel do it later; a lost lesson cannot be recovered.golden-rules.md is specifically the home for failure → guardrail / anti-pattern signals. Other
learning belongs elsewhere — routing keeps each artifact focused:
| Signal | Example | Goes to |
|---|---|---|
| Failure | "it keeps reintroducing this bug class" | golden-rules.md (this skill) |
| Context | a fact / version / convention the AI keeps missing | AGENTS.md (Conventions / Project Context) |
| Instruction | a prompt phrasing that reliably works | a skill, or AGENTS.md |
| Workflow | a task sequence that reliably produces good work | AGENTS.md / session-handoff.md |
If it isn't a failure-class signal, route it and stop.
Append a rule to golden-rules.md:
### GR-<n> — <one-line rule>
- **Why / origin:** <the concrete failure that motivated it>
- **Check:** <manual review | grep one-liner | lint rule>
origin line is what makes the rule stick — and lets a future
reader judge whether it still applies./gc): one backtick-quoted command in
the Check line → golden-rules-check.sh executes it (5s cap); its output is candidate-violation
evidence, empty output = clean. Keep "manual review" in the line to stay human-judged — that takes
precedence even when the line contains backticked prose.GR-1, GR-2, …) so /gc and /status can reference and count them.[user] protects a rule. Put [user] in the Why / origin line of a rule the human
authored or explicitly endorsed — /session-end's consolidation offer must never merge,
reword, or prune it.review comment / recurring failure / drift
│ capture (this skill)
▼
golden-rules.md ──► /gc (drift-analyst) scans every change ──► surfaced before it ships
▲ │
└──────────── prune / refine when a rule misfires ◄─────────┘
golden-rules.md is startup-loaded (AGENTS.md points to it) — a feed-forward Guide — and the
checklist /gc enforces as a Sensor. Closing that loop is the point: human taste, captured once,
applied to every future change.
Rules rot. Delete dead rules; resolve rules that contradict each other. A golden-rules.md nobody
trusts is worse than none. Review it when it stops matching how the project actually works.
/gc + drift-analyst — scans changed code against these rules (the Sensor half).anti-hallucination-gates — a recurring "claimed done without evidence" is itself a capturable rule.self-correction-loop — a recurring fix pattern is a candidate rule.docs-lookup — when unsure how to phrase a Check command for an unfamiliar tool./session-end — its flywheel reflection is the safety net for anything missed; the preferred capture moment is the turn the signal appears (see "When to write").What SKILL.md sets; muted values are Claude Code's defaults
14 skills in this plugin
/anti-hallucination-gatesUse before claiming done/fixed/passing — or before asserting something is absent: not installed, not available, no such function, couldn't find it. Default-FAIL runs both ways — every claim needs an evidence path. A negative claim must carry its search scope and observation date; state calibrated uncertainty when evidence is missing./context-budget-disciplineUse when sessions run long, adding subagents, fetching large files, or planning context-heavy work. SELECT/WRITE/COMPRESS/ISOLATE discipline./cpp-build-systemsUse in C/C++ projects for build configure/errors, compile_commands.json generation, or selecting CMake/Meson/Make/Bazel commands.npx claudepluginhub redtropig/harness-anchor --plugin harness-anchorOther plugins' skills for the same job