godmode:crs-hook-testing
Skill1 starsChanged 56 days agoMITView on GitHub
Coursers rule lifecycle pipeline. Walk a course-correct rule (or candidate rule) through the full lifecycle: author → validate → probe → fire (pre/post) → observe → refine/retire. Use when adding a new crs/coursers rule, auditing an existing one, or diagnosing a rule that is misfiring or dead.
- Installs packages
In this repository76 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- godmode:agent-governanceSkill
- godmode:agent-improvement-loopSkill
- agents-skill-saveSkill
- baml-add-typesSkill
- godmode:brainstormSkill
- godmode:capSkill
- godmode:changelogSkill
- godmode:ci-fixSkill
- godmode:code-reviewSkill
- godmode:context-mapSkill
- godmode:cross-issueSkill
- godmode:crs-discoverSkill
- godmode:crs-installSkill
- godmode:crs-propose-rulesSkill
- godmode:crs-validateSkill
- godmode:dead-codeSkill
- godmode:decomposeSkill
- godmode:dep-auditSkill
- godmode:dep-bumpSkill
- godmode:designSkill
- devloop-session-primerSkill
- godmode:dialecticSkill
- godmode:doc-maintainerSkill
- godmode:doc-reviewSkill
- godmode:doc-syncSkill
- godmode:doc-writerSkill
- doob-db-inspectorSkill
- doob-release-managerSkill
- godmode:doublecheckSkill
- dual-forge-pr-mergeSkill
- gh-bulk-issuesSkill
- godmode:health-scoreSkill
- godmode:ingestSkill
- godmode:introspectionSkill
- godmode:issue-triageSkill
- godmode:memory-bankingSkill
- godmode:mergeSkill
- godmode:mini-context-graphSkill
- godmode:mistake-trackerSkill
- godmode:moaSkill
- notfiles-release-workflowSkill
- godmode:observability-as-infrastructureSkill
- godmode:parallel-agentsSkill
- godmode:pattern-learnerSkill
- planning-with-cruxSkill
- godmode:pr-authorSkill
- godmode:receiving-reviewSkill
- godmode:refactoringSkill
- godmode:release-notesSkill
- release-readiness-checkSkill
- remote-upstream-triageSkill
- repo-gap-backlogSkill
- godmode:rust-conventionsSkill
- rustqualSkill
- rustqual-workspaceSkill
- rust-release-workflow-authorSkill
- godmode:self-reflectSkill
- session-wrap-commit-pushSkill
- godmode:systematic-debuggingSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 3 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 77
Check that all rules are well-formed, patterns compile, and alternative tools are on PATH:
- Distinctive: line 140
After the rule has been live for a session or more, check its activity:
- Very specific: line 174
Add more entries to exceptions
- Very specific: line 180
Verify the pattern actually matches the commands you care about via crs probe
- Distinctive: line 181
Check if an exception is over-broad and eating all matches
- Very specific: line 185
Remove the rule from the JSON file.
- Very specific: line 220
After editing crates/core or crates/coursers, the live crs/coursers binaries are NOT updated automatically.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CRS Hook Testing — Coursers Rule Lifecycle
A structured pipeline for managing the lifecycle of a course-correct rule in
~/.config/coursers/course-correct-rules.json.
Each stage maps to one or more crs / coursers subcommands. Walk through stages in
order for a new rule. Jump to the relevant stage when debugging or refining an existing
rule.
Stage 0: Discover (optional — new rules only)
Surface Bash commands that coursers is not yet handling:
crs discoverOutput: commands seen in Claude Code session logs that have no matching rule. Pick candidates for a new rule from this list.
Also useful:
crs suggestOutput: heuristically proposed new rules based on unhandled command frequency.
Stage 1: Author
Edit ~/.config/coursers/course-correct-rules.json (or the path in $COURSERS_RULES).
Each rule has:
{
"id": "no-raw-grep",
"description": "Use ripgrep (rg) instead of grep",
"pattern": "\\bgrep\\b",
"message": "Use `rg` instead of `grep` — faster and respects .gitignore",
"exceptions": [
"git (commit|log|tag|stash)",
"git -C .* (commit|log|tag|stash)"
],
"alternative": "rg",
"failure_threshold": null
}Key fields:
pattern— regex matched against the full Bash command string (not per-segment)exceptions— list of regexes; if any match, the rule does not firealternative— tool name used in the block message and checked byvalidatefailure_threshold— optional: block a command after this many consecutive failures
Stage 2: Validate
Check that all rules are well-formed, patterns compile, and alternative tools are on PATH:
crs validateFix any errors before continuing. Common failures:
- Invalid regex in
patternorexceptions - Alternative tool not on PATH (install it or remove the alternative field)
Stage 3: Probe
Interactively test a rule against a specific command string before wiring into the live hook:
# Pass a raw command string:
echo "grep -r foo ." | crs probe
# Pass a PreToolUse JSON payload (matches real hook input):
echo '{"tool":"Bash","input":{"command":"grep -r foo ."}}' | crs probecrs probe prints per-rule verdicts — which rules matched, which exceptions fired, and the
final block/allow decision.
Note: probe matches the whole command string. The live crs pre hook additionally
splits pipeline commands on ; / && / || before matching. If a rule behaves
differently in production than in probe, test via crs pre with the full JSON payload.
echo '{"tool":"Bash","input":{"command":"grep -r foo . && echo done"}}' | crs preStage 4: Fire (pre/post)
Exercise the rule through the real hook chain:
Pre-tool (blocking):
echo '{"tool":"Bash","input":{"command":"<command-to-test>"}}' | coursers preExit 0 = allowed. Exit 2 = blocked (rule fired). The response JSON is printed.
Post-tool (failure learning):
echo '{"tool":"Bash","input":{"command":"<cmd>"},"output":{"exit_code":1}}' | coursers postRecords the failure to the rolling state log. After failure_threshold hits, crs pre
will block the command even without a pattern match.
Stage 5: Observe
After the rule has been live for a session or more, check its activity:
# Count by rule (all time):
crs stats
# Heatmap — visual frequency chart:
crs heat
# Recent blocked commands:
crs history
# Full hook execution log (last N entries):
crs log --limit 50
# Filter to a specific rule:
crs log --limit 200 | rg "<rule-id>"Also export a full snapshot for offline analysis:
crs export > /tmp/crs-snapshot-$(date +%Y%m%d).jsonStage 6: Refine or Retire
Based on Stage 5 observations:
Rule fires too broadly (false positives)
- Narrow
patternregex, or - Add more entries to
exceptions
Then re-run Stage 2 (validate) and Stage 3 (probe) before deploying.
Rule never fires
- Verify the pattern actually matches the commands you care about via
crs probe - Check if an exception is over-broad and eating all matches
Rule is obsolete
Remove the rule from the JSON file. Run crs validate to confirm the file is still clean.
Tracking rule health across sessions
crs insights # session facets with git context
crs replay # replay past session Bash commands through the current rulesetreplay is especially useful after narrowing a pattern — it shows how the change would
have affected past sessions.
Quick Reference
| Stage | Command(s) |
| Discover | crs discover, crs suggest |
| Author | Edit ~/.config/coursers/course-correct-rules.json |
| Validate | crs validate |
| Probe | echo '<cmd>' | crs probe |
| Fire (pre) | echo '<json>' | coursers pre |
| Fire (post) | echo '<json>' | coursers post |
| Observe | crs stats, crs heat, crs history, crs log |
| Export | crs export |
| Refine | Edit rules → validate → probe → observe |
| Replay | crs replay, crs insights |
Common Pitfalls
probevspredivergence:probematches the whole command string;presplits on shell operators first. Always test withcrs prebefore trustingcrs probealone.- After editing
crates/coreorcrates/coursers, the livecrs/coursersbinaries are NOT updated automatically. Runcargo install --path crates/coursersto deploy. - The
no-find-use-globrule matchesfind .ctxin commit messages. Exceptions forgit (commit|log|tag|stash)(includinggit -Cform) suppress this. - State files: global at
~/.config/coursers/course-correct-state.json; project-local at.ctx/course-correct-state.json(wins over global).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

