save_rule
Save or update a rule to constrain agent behavior, using severity levels (hard=must obey, soft=prefer to obey) to enforce compliance.
Instructions
Save (or update) a rule memory · the 'memory as constraint' wedge. Rules constrain agent behavior, not just store facts. Severity 'hard' = must obey; 'soft' = prefer to obey. Rules auto-project out to AGENTS.md (read by Claude Code, Codex CLI, Cursor, Aider, Devin, Copilot, Gemini CLI, Windsurf, and Amazon Q natively) when AGENT_MEMORY_AUTO_EMIT_DIR is set, or via the emit_companions tool on demand.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Short kebab-case slug, 1-80 chars (e.g. 'no-emojis-ever', 'tests-before-commit') | |
| scope | No | Where this rule applies. Examples: ['global'], ['project:prefixcheck'], ['tool:git']. | |
| content | Yes | Markdown body. Lead with the rule itself, then **Why:** and **How to apply:** lines. | |
| matches | No | Regex patterns that deterministically signal a violation. Used by Tier-1 check_action on every client. | |
| severity | No | hard = must obey (rule violations are blocked when enforced); soft = prefer to obey (warned but allowed). Defaults to soft. | |
| enforce_on | No | Action categories this rule constrains. Examples: 'file_writes', 'commits', 'pushes', 'chat_responses'. | |
| description | Yes | One-line summary of what the rule constrains | |
| applies_when | No | Natural-language conditions for when the rule triggers. Used by Sampling-enriched check_action on supporting clients. | |
| last_verified | No | ISO date (YYYY-MM-DD) of last verification. Defaults to today. |