rules sonnet
Project scope only
.claude/rules/ only — never ~/.claude/rules/. Quick reference
| Field | Value |
|---|---|
| Command | /brewcode:rules |
| Input | [list] | [<path>] | [<path> <prompt>] |
| Specialist | bc-rules-organizer (Task) |
| List source | rules.sh list (Bash) |
| Target dir | .claude/rules/ (project only) |
When to use
- After fixing a bug: capture what went wrong and the correct pattern
- After a code review: lock in the standards that were enforced
- After a session with many learnings: extract the 5 most impactful findings
- To inspect which rules already exist in the project
- To import structured knowledge from a
KNOWLEDGE.jsonlfile
Examples
/brewcode:rules
/brewcode:rules what is the current state of our rules
/brewcode:rules capture what we learned fixing the auth bug
/brewcode:rules path/to/KNOWLEDGE.jsonl add new entries
/brewcode:rules list
How it works
- Input gate
Reads
$ARGUMENTS. If the first token islist, routes immediately torules.sh listand exits. Otherwise continues to mode detection. - Auto-mode select
Announces
Mode: <mode> (rules) — chosen because <evidence>. Defaults tostatuswhen arguments are empty or conversational; detectscreate,improve, orreviewfrom explicit cues. A.jsonlpath or inline prompt is treated as a knowledge source passed to the organizer, not a separate mode. - No-prompt menu
When no arguments are given and mode cannot be inferred, sends a single AskUserQuestion with options in this order: Status (rules) (recommended), Status (all: agents+rules+skills), Create, Improve, Review, List (plain), Cancel.
- Dispatch
Routes to bc-rules-organizer via the Task tool, passing the prepared knowledge block and mode. For
listmode, runsrules.sh listdirectly via Bash instead. - Real status
Reports which files were created or updated (
avoid.md,best-practice.md, or prefix variants). If bc-rules-organizer is unavailable, outputs:bc-rules-organizer not available — install brewcode plugin. - Final output
Prints a summary of rules added, merged, or skipped, grouped by target file. Skipped entries include the dedup reason (similarity %, cross-file antonym, or CLAUDE.md duplicate).
Modes
| Mode | Trigger | Execution |
|---|---|---|
status (default) | Empty input or conversational status query | Reports current rule files and coverage; delegates to bc-rules-organizer |
list | Explicit list argument only | Runs rules.sh list directly — no agent spawned |
create | Conversational cue or menu selection | Creates missing rule files from plugin templates; accepts KNOWLEDGE.jsonl or inline prompt as knowledge source |
improve | Conversational cue or menu selection | Rewrites weak or redundant entries for clarity; accepts KNOWLEDGE.jsonl or inline prompt as knowledge source |
review | Conversational cue or menu selection | Reads all rule files and reports coverage gaps |
batch | Auto fan-out flag | Processes multiple knowledge entries in one pass alongside the selected mode |
Knowledge sources & dedup
Sources accepted:
KNOWLEDGE.jsonlpath — parses each line;t:"❌"maps to avoid,t:"✅"maps to best-practice- File path + inline prompt — organizer reads the file and uses the prompt as instruction
- Session learnings — the skill selects the 5 most impactful findings from the current conversation and formats them as ❌/✅ pairs
Output files: avoid.md, best-practice.md, {prefix}-avoid.md, {prefix}-best-practice.md — all inside .claude/rules/
3-Check dedup protocol:
- Within-file similarity: >70% match → skip; 40–70% match → merge into existing entry
- Cross-file antonym check: if the same pattern appears in both avoid and best-practice → keep the avoid entry only
- CLAUDE.md duplicate: if the content already appears in
CLAUDE.md, skip entirely. The string"CLAUDE.md"is forbidden as a Source value in rule entries
Specialist: bc-rules-organizer — acts as organizer only (no separate creator agent). Spawned via the Task tool; the agent resolves paths via native ${CLAUDE_PLUGIN_ROOT} (substituted in its .md at Task spawn).
agents
skills
brewcode
GitHub source
Updating plugins
/brewtools:plugin-update to check and update the brewcode plugin suite in one command.
See the FAQ for details.