# Our agent reviews its own mistakes every day. Here is the loop, and the tests it produced

> Source: <https://dev.to/space_app_fc7f6872808dc84/our-agent-reviews-its-own-mistakes-every-day-here-is-the-loop-and-the-tests-it-produced-4n7k>
> Published: 2026-11-18 14:31:30+00:00

**Recommendation:** Schedule agent self-review as a first-class turn driven by counted metrics, not the agent's own account, and rewrite bare failure messages to state the next step so the model does not retry blindly.
More in the playbook "Designing agent systems": <https://wpnews.pro/playbooks/agent-architecture>

I build SpaceApp, a self-hosted workspace where AI coding CLIs run side by side in persistent rooms. Nous is the part of it that sees every room and pane, does the routine work itself and brings me only the decisions that need me.

An agent that does routine work makes routine mistakes, and the same ones come back. This post is about the loop that catches the repeats: a daily self-review that turns them into code changes, each with a test. Every part of it is in the public repository, so you can read the code instead of taking my word for it.

The first version was a scheduled task typed into a pane once a day. It kept getting lost: the pane it was bound to closed, and the review was skipped on 21 and 23 October. Since 24 October, Space itself starts the review as a turn of its own, once per local day at or after the hour you choose, and skips it when a review already ran that day.

Source: [`daily-review.ts`](https://github.com/oll4com/spaceapp/blob/main/apps/api/src/nous/daily-review.ts) and [`standing-orders.ts`](https://github.com/oll4com/spaceapp/blob/main/apps/api/src/nous/standing-orders.ts).

The review prompt is built from figures Space counts, not from the agent's own account of its day:

The split between mistakes and gate refusals matters. Without it, a safety rule doing its job would show up in the review as a bug to fix.

Five orders, in this order:

`OPEN <day> REVIEW: <cause>; evidence: <tools and counts>; fix: <the code change you want>`
Nothing when no cause repeats.
A lesson in a note helps only while the agent reads it. A line in the queue asks for a change in the code, so the next turn, or the next model, does not have to remember.

The queue is worked in separate upgrade rounds. The fixes that came out of it carry a test named after the review or queue item that found it, in [`nous-self-upgrade.test.ts`](https://github.com/oll4com/spaceapp/blob/main/apps/api/tests/nous-self-upgrade.test.ts). A few of them:

One group of tests is titled "errors that say the next step" (daily review of 21 October): a shell terminal with no AI CLI is refused before anything is sent, with "do not send again"; a copilot pane points to the copilot's own tools; an answer that left the screen unchanged says "read the pane before you answer again; never repeat the same answer".

Reading the file back, most of these fixes are not clever. They are error messages rewritten so the next step is inside the message. A bare "failed" gives a model nothing to do except try the same thing again.

You need Linux, macOS or Windows 11, Node.js 20.11 or newer, and at least 4 CPUs, 8 GB RAM and 15 GiB of free disk:

```
npx --yes run-spaceapp@latest install
```

SpaceApp is MIT-licensed. Code and docs: [https://github.com/oll4com/spaceapp](https://github.com/oll4com/spaceapp) · site: [https://spaceapp.dev](https://spaceapp.dev)

If you run agents for long stretches: what do you count as a mistake, and what do you count as a guard doing its job?
