| name | reflex-add |
| description | Use this whenever the user runs /reflex:reflex-add or describes a single new reflex rule in words ("block reads of X", "remind me when editing Y", "pause before running Z"). Translates the description into a reflex.json entry and appends it after user confirmation. |
| argument-hint | <natural-language rule> |
Translate a natural-language rule into reflex.json
Steps
- Read
${CLAUDE_PLUGIN_ROOT}/reflex-format.md so the translation respects the schema.
- Research before proposing. Read
.reflex/reflex.json (if it exists) to understand existing rules and naming conventions. Then read the agent-instruction files in the project (CLAUDE.md, AGENTS.md, README.md) to understand the project's conventions, sensitive paths, and what kinds of mistakes are worth guarding against. Use this context to ground your translation — a rule about "the config file" should reference the actual config file path, not a guess.
- Infer the four fields from
$ARGUMENTS, informed by what you just read:
- Trigger verb →
on. reading / viewing / opening → read. editing / writing / modifying / creating → write. running / executing → bash.
- Severity verb →
action. block / forbid / disallow / never → reject. remind / warn / note / hint → proceed. pause / double-check / confirm first → pause.
- Subject →
pattern. Remember this is a full match: wrap with .* when the user clearly meant "any path containing X" or "any command starting with X". Use concrete paths you found in step 2 rather than generic guesses.
message. Preserve the user's phrasing; don't over-embellish. Craft it so the agent, seeing it mid-task, knows what to do next.
- If the phrasing leaves the pattern ambiguous (e.g., "dotenv files" — does that include
.env.local?) or if your research revealed multiple plausible interpretations, use AskUserQuestion to pin it down. A silent guess here causes either false triggers or silent misses.
- Show the full proposed rule as JSON, then use
AskUserQuestion to confirm before writing. On confirmation, append the rule to .reflex/reflex.json, creating the file if needed and preserving existing rules and "version": 0.
Why
Rules that look right in English can be subtly wrong as regexes. Step 3 exists specifically to catch the class of bugs where the thing everyone calls X and the literal pattern X diverge.