DocsWhat may it doRecover and decide ahead

Recover and decide ahead

Four commands that change how people actually behave, for the same reason: each moves the question to a moment when answering it costs nothing. rewind after, replay and trace when the agent's own account of what happened is not enough, and check before.

Rewind

An agent runs unsupervised for three hours. It writes a broken migration, reformats forty files nobody asked about, and deletes a directory it misread as generated. None of it is committed, so git checkout . throws the good away with the bad, and there is no commit to go back to.

bash
memnox rewind
Working tree back to mst_mtnxybca94e3, taken 2026-09-05T05:27:28.234Z.
 
  What it replaced is kept as mst_mtnxybg19f65.
  memnox rewind --to mst_mtnxybg19f65   undoes this
Only files moved. No commit, no branch and no stash was touched.

Command

memnox rewind

Back to the last milestone

memnox rewind --list

What there is, with how long ago, how many files, and the agent, session and reason each was kept for

memnox rewind --session <id>

Back to before that session first changed anything

memnox rewind --last

The same, for the most recent session

memnox rewind --to <id>

A particular one

memnox rewind --take

Keep the tree as it is now, restoring nothing

memnox rewind --forget [keep]

Drop all but the newest few. The newest is never dropped

What it touches, and what it refuses to

A milestone is a tree object written under refs/memnox/, where nothing else looks. Never a commit, never a branch, never the stash, because this has to be invisible to everything you do with git afterwards or the cure is worse than the mess.

Behaviour

Tracked files

Restored, including the uncommitted work in them

Untracked files

Restored. They are the ones with no other copy anywhere

Files the agent added

Removed, along with any directory that leaves empty

Ignored files

Untouched. Restoring somebody's node_modules from a tree object would take a minute and help nobody

Commits, branches, the stash, the index

Untouched

Where milestones come from

memnox run takes one before the agent's first command, so the way back is already there when you realise you need it. --no-milestone opts out, and memnox rewind --take makes one by hand.

An agent started without memnox run is covered too. The hook setup installed keeps a milestone before a session's first write in a repository, and the shell seams keep one before a command that destroys work: rm, rm -r, git reset --hard, git clean, git checkout -- ., git restore . and a mv of three or more paths. The first write is kept once per session and repository, and a destructive command at most once every twenty seconds per session. Only the newest twenty are kept in a repository. A milestone that cannot be kept is logged and never stops the agent.

The point is not the rollback. It is the willingness to let an agent run at all.

Rewind from the session

Mostly you will not type it. The agent's memnox-session server has a rewind tool, so the person can say put my files back to before this session in the conversation they are already having, and the agent asks Memnox. With nothing named it goes back to before the newest session first changed anything; the agent can also name a session or a milestone id from memnox rewind --list.

The agent can ask, and only the person can say yes:

Behaviour

The host asks first

The tool is marked destructive, so the agent's own permission prompt asks its person before it runs.

Memnox asks again

Where the agent offers a way for a server to ask its person directly, the rewind asks through it too, naming the directory and the milestone, and a no there is a no.

Nobody there, no rewind

Under CI, or with no terminal and no way to ask, it refuses and says to run memnox rewind yourself.

Recorded either way

Every request is a memnox.rewind row, whether it was done or refused.

Undoable

The same restore as the command: the current files are kept first, and the answer carries the memnox rewind --to that undoes it.

The terminal command is still the way to list milestones, take one by hand or forget old ones, and the way back when the agent itself is what went wrong. See Memnox in your session for the other tools.

Replay

The timeline says what happened across every session. When one session went wrong, the question is narrower: what did it do, in order, and what came right before it failed.

From inside the session, the agent's replay tool gives a compact version of the same thing for the session it is in. At the terminal:

bash
memnox replay            # the most recent session, which is also what --last means
memnox replay <session>  # one in particular
memnox replay --json     # the replay itself, for a script

Every action is listed with its surface, operation, target and verdict, and, while the machine was observing, what enforce would have said. Exit codes, circuit breaker trips and who resumed them, holds still waiting, and the milestones kept for the session are in the same column. The five actions right before a failure or a breaker trip are marked with > and carry their reasons and the id memnox trace opens.

It is read from the ledger, the pause records and the repositories the session kept milestones in, so it works long after every process involved has gone. A hold that was answered shows only where its row names who allowed it, because an answered hold is cleared from disk.

Resume

Some stops are on the session rather than the command: the circuit breaker pausing an agent that keeps failing the same way, or a session put under suspicion after a tool result read like instructions (see What changed under you).

bash
memnox paused                      # what is held, and why
memnox resume <session> --by <you>

Resuming lifts either, and who lifted it stays in the record.

Check

The decision to let an agent run is made once, at the start, with nothing to go on. Half an hour later it reaches the one thing it should not have touched, and the choice is to abandon the run or approve under pressure. Under pressure the answer is yes.

bash
memnox check "deploy the payments service"
read as: deploy · payments
 
  deny   railway.up            payments is frozen
  ask    gh.pr-merge           a merge is somebody's review
  allow  npm.test
 
  2 of 3 would stop, and nothing was run to find out.
  memnox freeze --lift   when the incident is over

Same engine, same rules, same state as the gate itself, run ahead of time with nothing executed. It exits non-zero when anything would stop, so it works in a script that runs before an agent does.

What you can hand it

A command line

memnox check 'gh pr merge 12 && vercel deploy --prod' resolves exactly, because that is exactly what would run

A phrase

memnox check 'deploy payments' resolves to every action it could mean, and prints what it read the phrase as

A phrase means more than one command until somebody says which. Answering about only the first would be a guess dressed as an answer, so it answers about all of them and shows its reading, which is how a wrong reading becomes visible rather than mysterious.

Trace

Afterwards, the timeline says the deploy ran and exited zero. It does not say what it printed, and the agent's own account of it is a summary written by something with an interest in the summary being good.

bash
memnox trace evt_011179
  action    railway.delete
  agent     claude-code
  session   ses_9f21
  decision  deny
  reason    no volume deletes while payments is frozen
  rule      no-volume-deletes-while-frozen
  exit      1
  took      412 ms
  args      6197595503f01ee2

An id prefix is enough. args is a digest and never the arguments, because an argument list is exactly where a secret would be. When the session was started with memnox run --transcript, the tail of what it printed appears underneath, capped and bound by the same retention as everything else.