Memory That Says No.
Every rogue-Ai headline, from a model scamming for compute credits to one copying itself onto a cheap TV box, describes an Ai that acted with no one to tell it no. CogmemAi Guard is the part that says no. Your Ai already remembers the command that took production down last month, and the email you told it never to send. Guard is what stops it from doing either again. Rules you save in memory are enforced before an action happens, whether that action is a shell command, a message, a purchase or a change, and every piece of finished work can be reviewed against what you actually asked for. In a coding tool it runs as hooks. Everywhere else it is one call: guard_check before, review_work after.
Advice Is Not Enforcement
Every memory product, ours included, can tell your Ai what went wrong last time. Under pressure, the Ai reads the note and does it anyway. A rule that lives only in context is a suggestion. Guard turns it into a stop.
You save a rule once
After an incident, write it down the way you already do: NEVER run `pkill -u www lsphp` on the shared host. It is a normal CogmemAi rule memory, saved with save_rule or from any client.
Guard compiles it
At session start the rule is turned into a pattern and cached on your machine. No code to edit, and the check itself makes no network call, so it costs nothing per command.
The command never runs
When your Ai tries it, inside an ssh string or not, the command is denied before it executes, with your own words as the reason and a way forward: run it yourself, or remove the rule.
Three Checks, One Engine
Guard ships inside the cogmemai-mcp package you already install. It never calls a language model, never edits your code, and fails open: if anything inside it breaks, your command runs untouched.
Before a command runs
Six built-in rules cover the operations with no good unattended use: rewriting a whole crontab from a pipeline, destructive SQL sent to a live database, recursive deletes outside temp and build paths, force-pushing a shared branch, piping a download into a shell, and killing shared server workers by name. Then your remembered rules run.
Inside the wrapper
The payload of ssh host "...", bash -c "...", and a heredoc fed to a shell runs on the far side exactly as written, so it is judged exactly as if typed directly. Quoted data and heredoc bodies are stripped first, so writing a dangerous command into a notes file is not the same as running it.
After every turn
A review of what actually changed in the working tree: credentials pasted into tracked source, version strings that disagree across release files, deleted files, large net deletions, a function newly defined in two places, and remembered gotchas about the files that were touched. Silence is the correct output for a clean turn.
For Every Other Ai
Hooks are how a coding tool asks. Everything else asks with one call.
Before it acts: guard_check
A support assistant about to send a message, an agent about to spend money, a robot about to move, a companion about to make a promise. Any proposed action is judged against the rules you saved and the NEVER and MUST lines of your intent, and answered allow, ask or deny with the rule that applies. A literal match runs on every plan; a judged check on the paid tiers. It fails open, never stalls.
After it finishes: review_work
Pass what was done, a description, an output, a message or a whole transcript, and it is reviewed against your intent: a plain summary, what the intent covers, what it does not, and any violation named in your own words. The same review that reads a code diff reads a customer conversation.
One memory, every door
The rules and the intent live in CogmemAi, not in one tool's config, so the same guard answers through MCP tools, POST /cogmemai/guard-check and /intent-check on REST, and guardCheck / reviewWork in the JavaScript and Python SDKs. Change a rule once and every Ai you run obeys it.
Ai Agents Under Your Security Policy
Whoever you hire for platform or security will be running Ai agents on your infrastructure. The DevSecOps rule pack is the policy those agents cannot ignore: forty rules, plain English, one command.
Install it
npx cogmemai-mcp rules install devsecops --intent installs the pack for the project you are in (add --global for every project) and the matching intent document: purpose, nine invariants, out of scope, definition of done. Read it first with rules show devsecops. Reinstalling skips what you already have, and every rule stays editable like any memory.
What it stops
Committing a secret or a .env file. A key pasted into export. terraform destroy and auto-approved applies. Console changes outside infrastructure as code. Administrator and wildcard policies, long-lived keys. Public buckets and snapshots, security groups open to the world. curl | bash. Privileged containers, cluster-admin bindings, destructive kubectl against production. Production data copied to a laptop. Audit logging switched off. Force pushes and admin merges. All before the command runs, with no model call.
What it judges
Not every risky action is a shell command. "Copy last night's production dump to my laptop" and "attach AdministratorAccess so the pipeline stops failing" are denied by guard_check reading the rules in plain English, with the rule named and the reason given. At the end of the turn, review_work grades the work against the intent: covered, uncovered, violations, a coverage score. Agents open pull requests; the policy says humans merge them.
Secrets, infrastructure as code, least privilege, network exposure, CI/CD gates, change control, supply chain, containers and Kubernetes, data handling, logging, incident response, and the rules for the agents themselves. Included in CogmemAi for Teams. All forty rules, the intent document and the install steps, or cogmemai-mcp 3.30 on npm.
Every Tool That Opens a Shell
Claude Code gets Guard as hooks, installed by the setup wizard. Everything else gets it at the shell.
Claude Code
A PreToolUse hook on Bash and a Stop hook, wired by npx cogmemai-mcp setup. Already set up? Run cogmemai-mcp guard install.
Cursor, Codex, Gemini CLI, Cline, scripts
They all end up running bash -c "<command>". One command, cogmemai-mcp guard shell-install, makes every such shell hand its command to Guard before it runs. Same rules, same log. zsh too.
The log
Every verdict, including the silent allows, is written locally with secrets redacted. cogmemai-mcp guard status shows what fired and how often, so precision is something you can measure rather than something we claim.
Turn It On
If you use CogmemAi with Claude Code, you may already have it. Check with the first command.
See what is active
cogmemai-mcp guard status
Lists the remembered rules cached for this project and the verdict counts so far. Not installed? npm install -g cogmemai-mcp@latest then cogmemai-mcp guard install.
Save a rule
save_rule: "NEVER run `wp cron event run` from the system crontab, it runs under the wrong PHP."
A backticked command that follows NEVER, DO NOT, or MUST NOT becomes a rule. Want an exact pattern? Add a line reading GUARD: <regex>. Want a rule to stay advisory? GUARD: off.
Cover every other tool
cogmemai-mcp guard shell-install
Optional. Guards every bash -c and zsh -c on the machine, whichever tool opened it. guard shell-remove undoes it.
What Guard Is Not
We would rather you trust it for the right reasons.
Not a sandbox
Guard judges commands; it does not contain them. Git, backups, and review are still the real undo. Guard makes the mistake you already made once much harder to make twice.
Not a mind reader
A remembered rule only becomes enforcement when it names a command. Prose about being careful stays advice. That is deliberate: a guard that guesses gets switched off within a week.
Not automatic outside a coding tool
In a coding tool the hooks ask for you. Anywhere else your Ai has to make the call, guard_check before and review_work after, so build it into the agent, not into hope. The shell adapter judges the -c string, not the body of a script file, and interactive terminals are untouched.
Stop Paying for the Same Mistake Twice
Guard is included with every CogmemAi plan, Free included. Install the memory layer and the enforcement comes with it.
Want to see it live? Book a 20-minute demo call with an engineer. Bring your questions; there is no sales deck.
Schedule a Demo