Obey remember
Save a rule that Claude must follow. Use when the user says "/remember", "remember this", "save this rule", or wants to save a persistent instruction that should be enforced across sessions.
git clone https://github.com/Lexxes-Projects/obey
T=$(mktemp -d) && git clone --depth=1 https://github.com/Lexxes-Projects/obey "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/remember" ~/.claude/skills/lexxes-projects-obey-remember && rm -rf "$T"
skills/remember/SKILL.md/remember — Save a Persistent Rule
The user wants to save a rule: $ARGUMENTS
Step 1: Parse the Rule
Extract the rule text. Strip any flags (--global, --local, --rust, --node, --python, --go) if present.
Step 2: Determine Scope
Check for explicit flags first:
→ scope: global (all projects, always)--global
or--local
→ scope: project (only this project)--project
,--rust
,--node
,--python
,--go
→ scope: stack--java
If NO flag given, analyze the rule:
- General dev practices (git, testing, formatting, security) → global
- Language-specific (unwrap, console.log, pip, cargo, npm, types) → stack (detect with
)bash ${CLAUDE_PLUGIN_ROOT}/scripts/detect-stack.sh - References specific files, paths, or "this project"/"here" → project
- If truly ambiguous → ask the user: "Should this apply globally, to all [detected stack] projects, or just this project?"
Step 3: Determine Enforcement
Can this be blocked by matching a pattern in tool input?
Code-enforceable (mechanism: hook or both):
- "never push to main" → tool: Bash, field: command, pattern:
git\s+push.*(main|master) - "never use sudo" → tool: Bash, field: command, pattern:
\bsudo\s+ - "never delete with rm -rf" → tool: Bash, field: command, pattern:
rm\s+-rf - "never force push" → tool: Bash, field: command, pattern:
push\s+--force|push\s+-f - "never edit .env files" → tool: Write|Edit|MultiEdit, field: file_path, pattern:
\.env$|\.env\. - "never use console.log" → tool: Write|Edit|MultiEdit, field: content, pattern:
console\.log\( - "never use .unwrap()" → tool: Write|Edit|MultiEdit, field: content, pattern:
\.unwrap\(\) - "never use eval()" → tool: Write|Edit|MultiEdit, field: content, pattern:
\beval\( - "never make repos public" → tool: Bash, field: command, pattern:
--visibility\s+public - "never publish without asking" → tool: Bash, field: command, pattern:
cargo\s+publish|npm\s+publish
Instruction-only (mechanism: instruction):
- Style preferences ("prefer X over Y")
- Process rules ("always explain before coding")
- Quality standards ("keep functions under 50 lines")
- Architecture guidance ("use repository pattern")
IMPORTANT: Set
tool_matcher to control WHEN the rule triggers:
- Rules about writing/coding style → tool_matcher:
Write|Edit|MultiEdit - Rules about commands/processes → tool_matcher:
Bash - Rules about completion/finishing → tool_matcher:
(fires when Claude tries to finish)stop - Rules about checking output → tool_matcher:
orpost:Bash
(fires after tool runs)post:Write - General rules → tool_matcher:
(session start only)none
Completion checklist rules (tool_matcher:
stop):
- "always run tests before finishing" → instruction, tool_matcher:
stop - "always update the README before finishing" → instruction, tool_matcher:
stop - "always commit your changes before stopping" → instruction, tool_matcher:
stop - "summarize what you did before finishing" → instruction, tool_matcher:
stop
Post-tool rules (tool_matcher:
post:<tool>, check output after execution):
- "warn if test output contains failures" → instruction, tool_matcher:
, field: content, pattern:post:BashFAIL|ERROR|panic - "warn if TODO comments in written code" → instruction, tool_matcher:
, field: content, pattern:post:WriteTODO|FIXME|HACK
Pre-tool reminders (instruction rules reminded before tool use):
- "always explain reasoning before writing code" → instruction, tool_matcher:
Write|Edit|MultiEdit - "always run tests before committing" → instruction, tool_matcher:
Bash - "prefer functional style" → instruction, tool_matcher:
Write|Edit|MultiEdit - "keep functions under 50 lines" → instruction, tool_matcher:
Write|Edit|MultiEdit - "always ask before deleting" → instruction, tool_matcher:
Bash
If a rule is code-enforceable, use mechanism "both" (hook blocks + instruction reminds).
Step 4: Save
Run this command (fill in the values you determined):
bash ${CLAUDE_PLUGIN_ROOT}/scripts/rules-add.sh \ --scope "SCOPE" \ --stack "STACK_OR_NONE" \ --mechanism "MECHANISM" \ --tool-matcher "TOOL_OR_NONE" \ --field "FIELD_OR_NONE" \ --pattern "PATTERN_OR_NONE" \ --text "THE FULL RULE TEXT"
Step 5: Confirm
Tell the user clearly:
- What rule was saved
- Scope: where it applies (global/stack/project)
- Enforcement: how it will be enforced
- hook: "This will be actively blocked if violated"
- instruction: "This will be injected as a reminder at the start of every session"
- both: "This will be both reminded and actively blocked"
- If it's a hook rule: note it takes full effect next session (hooks load at session start)
Do NOT ask unnecessary questions. If the intent is clear, just save it.