Skip to Content

Memory and undo

How zerd picks up your preferences from corrections, and how to undo what it changed.

zerd learns your preferences from your corrections without any setup, and /undo puts every file back the way it was before the run.

Memory

In an interactive session, zerd learns from what you say and from runs that verified. You don't have to run a command or write a rule.

After each message you send, zerd asks a model in the background, so your reply isn't held up. The model reads your new message alongside the request and answer it follows. It writes one rule if you:

  • redirected it ("no, not that", "I meant the header")
  • confirmed an approach ("yes, exactly like that")
  • stated a preference ("always use pnpm")

A new unrelated task, a question or a thank-you gets no rule.

When it learns something, you see:

Learned: use pnpm, never npm, in this repo (saved to AGENTS.md; /forget removes it)

Where lessons live

The rule is saved in your own AGENTS.md under ## Learned by zerd. You can read it, edit it and commit it, so your team gets it too. The next session loads it as an ordinary instruction, newest first, capped at 30 per repo.

Managing lessons

  • /learn <rule> adds one by hand.
  • /forget N removes one, from AGENTS.md too.
  • Duplicates and notes under four words are dropped.
  • Rejecting an action with a reason ("not like that, use the helper in utils/") becomes a lesson immediately.

Scripted runs (zerd "...", --json and --rpc) never write lessons, so CI and benchmarks can't change your repo.

Edit history

A run that ends verified records the words of your request and the files it changed. Later, search ranks files that fixed similar requests higher. A failed run adds nothing.

Importing old sessions

zerd learn-import --repo .

This mines your old Claude Code sessions for rules. Each one is checked against what AGENTS.md already says, so only new ones are added.

Undo

Before each request, zerd saves a snapshot of the working tree as a commit object under refs/zerd/backup. It uses no stash and changes no index.

  • /undo restores what the last request changed and removes the files it created. Files that were untracked before are never deleted.
  • /rewind goes back up to 20 requests.

On this page