Mandatory Rules: Teach Your Ai Assistant What It Must Never Forget
The Problem: Your Ai Assistant Has Amnesia
You’ve been there. You tell your Ai coding assistant: “Never use the -latest model aliases. Always use the specific version string.” It follows the instruction perfectly — for that session. Tomorrow? It’s right back to claude-sonnet-latest like you never said a word.
Or maybe it’s something more serious. A security policy. A naming convention your entire team depends on. A deployment rule that, if broken, takes down production. You tell your assistant once, twice, ten times — and it still forgets when it matters most.
The core issue is simple: most Ai memory systems treat everything the same. Your critical “NEVER do X” instruction gets ranked alongside hundreds of other memories, subject to relevance scoring, decay over time, and context filtering. Sometimes it surfaces. Sometimes it doesn’t. And “sometimes” isn’t good enough for rules that must be followed every single time.
Introducing Rules: Memories That Cannot Be Forgotten
CogmemAi v3.8 introduces Rules — a dedicated class of memory designed for hard constraints that must be present in every session, no exceptions.
Unlike regular memories, Rules are mandatory. They always appear at the top of your assistant’s context, before anything else. They don’t decay. They don’t get filtered out because something else seemed “more relevant.” They’re always there, always enforced.
Think of it this way:
- Regular memories are things your assistant should probably remember — project context, past decisions, useful facts. They’re surfaced when relevant.
- Auto-Skills are behavioral patterns your assistant learned from watching you work — coding style, preferred approaches, workflow habits. They’re matched to the current task.
- Rules are non-negotiable constraints your assistant must always follow — security policies, naming conventions, things that should never be violated regardless of context.
Rules fill a gap that regular memory was never designed to handle: guaranteed recall of critical instructions, every time.
What Should Be a Rule?
Rules are best for constraints that apply broadly and must never be missed. Here are some real-world examples:
Security Policies
"NEVER commit .env files or expose API keys in public-facing code.
Always use environment variables for secrets."
Naming Conventions
"Brand name is 'Acme' (capital A only). Use 'Ai' not 'AI'
in all user-facing text. No exceptions."
Coding Standards
"Always use specific model version strings, never -latest aliases.
Example: claude-sonnet-4-5-20250929, not claude-sonnet-latest."
Deployment & Architecture Rules
"After every npm publish, immediately commit and push to GitHub.
Never leave the registry and repo out of sync."
Parity Requirements
"Every change to the chat module MUST be applied to BOTH
the companion module AND the service module. Never update
one without the other."
If you’ve ever caught your assistant violating a rule you know you told it about, that rule belongs in the Rules system.
Three Simple Tools
Managing rules is straightforward with three dedicated tools:
save_rule— Create a new mandatory rule for your project. Give it a clear, imperative description.list_rules— See all active rules for the current project at a glance.delete_rule— Remove a rule that’s no longer needed.
That’s it. No configuration, no scoring thresholds to tune, no complicated setup. Save a rule, and it’s enforced from that moment forward in every session.
Rules as Part of a Larger Intelligence System
Rules don’t exist in isolation. They’re one layer of CogmemAi’s broader intelligence system — now with 33 tools — that includes auto-learned behavioral skills, intelligent recall with cross-encoder reranking, knowledge graphs, and self-improving memory.
Together, these layers mean your Ai assistant gets smarter over time while never forgetting the things you told it were non-negotiable. It’s the difference between an assistant that learns and an assistant that learns and follows the rules.
Get Started
CogmemAi works with Claude Code, Cursor, Windsurf, Cline, and Continue. If you’re already using CogmemAi, the Rules tools are available now — just update to the latest version and start saving rules with save_rule.
npx cogmemai-mcp setup
New to CogmemAi? Get your free API key at hifriendbot.com/developer and set up in 60 seconds.
Stop re-telling your Ai assistant the same critical instructions every session. Tell it once. Make it a rule. Move on.
