Use case · August 2026

An AI Assistant That Learns From Its Mistakes

Without memory, an AI coding assistant repeats the same mistakes forever -- each session is a new hire with no onboarding. Here's a real production incident that happened exactly once.

The problem: every session makes the same mistake fresh

An AI coding assistant that repeats mistakes isn't being careless -- it's being stateless. When a session ends, everything it learned the hard way ends with it. The subtle gotcha it hit today, the footgun it discovered in your deploy tooling, the "never do X on this repo" rule you had to spell out -- none of it exists tomorrow.

So you get the same failure mode over and over: the assistant walks confidently into a trap that a previous version of itself already fell into, documented, and climbed out of. You paid the tuition. Then you paid it again.

The real story: the deploy that succeeded and was still wrong

This one is ours. During a real project, the assistant ran a production deploy from the wrong directory. Here's the nasty part: the deploy succeeded. Exit code 0. Health checks green. Everything about it looked fine.

But the deploy tool builds from the current working tree -- and the working tree it was standing in held month-old code. Production had been silently rolled back to a state from weeks earlier, and nothing in the tooling said a word. We caught it minutes later, by luck and by paranoia, not because anything failed.

The fix took minutes. The lesson was the valuable part, and it was written to memory once, roughly as:

memoir_note("deploys", "This deploy tool builds from the
  CURRENT WORKING TREE, not from git. Exit 0 + healthy
  checks proves nothing about WHICH code shipped.
  Before deploying: verify the tree you're standing in.
  After deploying: verify the artifact -- grep the
  running machine for a string from your change.")
Saved to deploys

That's the whole intervention. One note, written at the moment the pain was fresh.

Every deploy since -- across many later sessions, none of which were present for the incident -- has followed that rule unprompted. Check the tree, deploy, grep the deployed artifact for a string from the change. The incident never recurred. Not because the model got smarter, but because the lesson stopped evaporating.

How it works

memoir connects to your AI tool over MCP. When something goes wrong and you extract a rule from it, the assistant records the rule:

# The moment you learn something the hard way

memoir_note("deploys", "the lesson, with the failure
  mode spelled out and the check that prevents it")
Saved

Hard-won operational rules load as context at session start, so a fresh session already knows them before it touches anything. For deeper history, the assistant searches on demand:

# A later session, about to deploy

memoir_recall("deploy gotchas")
Found 1 memory matching "deploy"

# It verifies the tree, deploys, then greps prod
# for a string from the change -- without being asked

Mistakes are tuition. You pay either way -- the only question is whether you pay once or every session. Memory is the difference.

Honest limits: memoir stores what you or the AI record. It won't auto-detect that a mistake happened or extract the lesson for you -- someone has to write the note. After that, it persists everywhere.

Pay the tuition once

One install. Every lesson your AI learns stays learned.

npx memoir-cli

More use cases