---
title: "Sleep Consolidation: Teaching an AI Agent Once"
author: "Oscar Serra · Independent Research"
date: "12 October 2026"
version: "v7.0"
---

## Abstract

Tell a good new colleague something once and it sticks. If it slips, you say it again, and they stick a note on their screen. By the third time it is no longer something they have to remember. It is how they work, the way a cyclist stops thinking about balance. In your own brain the cerebellum is where a practised movement turns automatic, and a night's sleep is when much of that settling happens.

AI assistants get corrected every day, and their owners keep repeating themselves. The model's weights cannot change, so each lesson is written down as text: a note in a memory store, or a line in a file the assistant loads on every turn. But text is advice. The model weighs it against everything else in front of it, a long list of advice is followed less well than a short one, and the clean-ups that keep the list short push old lessons out of sight. So the owner teaches the same rule again.

We propose a design in which each correction becomes a rule with its own row in a ledger, and the rule climbs a ladder each time it recurs: a note found on demand, then text that loads with the task, then text that loads on every turn, then a check in the path of action that blocks, rewrites or asks before the mistake is made. Learning runs at two speeds. A short turn right after the task records the correction the same day, and a nightly audit counts recurrences, moves rules up or down and drafts the checks.

For the owner, a second correction is what makes a rule harder to miss, and a third turns it into a check. The file read on every turn stays short, because a rule leaves it only when a check carries it, never for being old. Every change to what each turn loads waits for the owner's approval in one morning report: the loop may tighten on its own, and only the owner loosens. Every learning loop keeps its own accounts and goes dormant when it stops paying. This is a design for the next build, and the last section names the tests that would prove it.

If it holds, you teach your assistant a thing once or twice, and never a third time.

## 1. Introduction

On a Monday the owner writes to his assistant in Finnish and gets an answer in English. He says so: reply in the language I write in. The assistant apologises and saves a note. Ten days later it happens again. The note sat in a memory store, and nothing brought it into that turn. This time the rule goes into the file the assistant reads on every turn. A month later it happens a third time. The file had grown long, and an older line in it, written for a different situation, said to answer in English. The owner gave one instruction three times, and the assistant wrote it down three times.

Writing things down was never the problem. Each time, the lesson was saved. What the assistant lacked was a way to make a lesson that had already failed once bind harder the next time, and a way to notice that it had failed.

This paper is about that missing step: how an agent whose model cannot change turns experience into behaviour that stays changed.

### 1.1 What the brain suggests

The brain learns at two speeds. In the complementary learning systems account (McClelland et al., 1995), a fast learner, the hippocampus, records an episode at once, and a slow learner, the neocortex, folds many episodes into durable knowledge, much of it during sleep, when recent experience is replayed. The cerebellum adds the step that matters most here. A movement you once had to think through becomes one you no longer think about at all. Sleep helps with that too: people who practise a finger sequence in the evening play it faster the next morning without any further practice (Walker et al., 2002).

Learning to ride a bicycle passes through three forms of the same lesson. First it is an instruction you have to recall ("look ahead, not at the wheel"). Then it is a reminder you hold in mind while you ride, which costs attention. Finally it is balance, which fires before you could think of it. An agent can hold a lesson in the same three forms: a note it finds when it searches, text it keeps in front of it, and a check that runs at the moment of action whether the model remembers or not. That last step gives this stage its name in the series, CEREBELLUM. Like every brain name in the series it is an aid to reasoning, not an anchor: we take the functions worth copying and leave the rest.

### 1.2 Why the obvious fixes fail

**Text binds weakly.** A model reads its instructions as context and weighs them against everything else in the turn. Claude Code's documentation says it in as many words: its memory files are treated "as context, not enforced configuration", and to block an action for certain you use a hook (Anthropic, 2026a). Safety engineering reached the same conclusion long ago. The hierarchy of controls ranks rules people must remember below controls built into the equipment, because the former "require significant and ongoing effort" (NIOSH).

**Text competes for attention.** Every line in a file the model reads on each turn makes every other line a little weaker. On IFScale, accuracy falls as the number of instructions in a prompt grows, and earlier instructions are followed more than later ones (Jaroslawicz et al., 2025). A file that grows by one lesson a day gets worse at all of them.

**Learning only at night is late.** If the lesson waits for the night, a correction given in the morning can be needed again that afternoon, and the owner gives the same instruction twice in one day. A lesson has to take hold in the session where it was taught.

**Pruning by age or size throws away rules that still matter.** Keeping the always-loaded file short is right. Choosing what leaves it by date or by bytes moves a rule out of sight, and a rule the agent can no longer see gives it no reason to look it up. Compression that can be undone does not help, since nothing asks for the original.

**The learner learns from the wrong signal.** A network outage is not fixed by a paragraph of advice. Text a harness wraps around the owner's words (a time stamp, an appended instruction, another agent's message) is not the owner speaking. An outcome column that never changes teaches nothing while looking like data.

**Silence hides failure.** A night that found nothing to learn and a night that never ran leave the same empty trace, so a learning loop can be dead for weeks before anyone asks.

### 1.3 What this paper proposes

We propose a design built around one idea: **a rule that recurs moves one rung up, from a note, to text loaded with the task, to text loaded on every turn, to a check in the path of action, and it leaves a lower rung only when a higher one carries it.** Around that idea:

1. The owner's correction is the main signal, read from his own words with the wrapper removed and sorted by cause, so only real rule gaps become rules (§3).
2. A rule ledger keeps one row per rule, with its purpose, its home and every time it recurred (§4).
3. A four-rung binding ladder, climbed one rung per recurrence, with a cost argument for why a rule should not jump straight to code (§5).
4. Two speeds: a reflection turn right after the task, and a nightly auditor (§6).
5. Pruning by binding, an attention budget for the always-loaded file, an approval gate on it, and one morning report through which every memory stage reaches the owner (§7).
6. The same machinery for procedures and for the texts that machines run on (§8).
7. Accounts for every learning loop, and a rule for retiring the ones that stop paying (§9).

Figure 1 shows the whole loop. §10 follows the reply-language rule from the opening through it, and §12 names the tests. Everything here is a design for the next build.

![The life of one correction. The owner corrects the agent; a short turn right after the task records the rule the same day and writes the cheap rungs at once. Every rule has a row in the ledger. Each night an auditor counts recurrences and drafts proposals, and the owner approves anything that changes what every turn loads. A rule that recurs moves one rung up its ladder, and a check at the top writes a receipt to the ledger each time it fires.](images/fig1-life.png){width=100%}

## 2. Related work

This is one of four designs for an agent's memory: keeping (J1, what survives the context window, with the full session record as ground truth), writing (J14, what enters the long-term memory store and in what shape), finding (J2, getting the right thing back fast), and learning (J5, this paper: turning experience into behaviour). Where this paper relies on one of the others, it says so in a line.

**Lessons kept as text.** Reflexion (Shinn et al., 2023) has an agent write a short reflection after a failed attempt and read it on the next try. ACE (Zhang et al., 2025) turns the idea into a maintained playbook: a generator does the work, a reflector draws lessons from the result, and a curator merges them as small itemised edits. We keep the itemised edit, since a row in our rule ledger is one such item; why whole rewrites lose detail is J1's subject. We change what happens to an item that keeps failing: in ACE every lesson stays text in the playbook, and here a lesson that recurs climbs out of text (§5).

**Learning while idle.** Sleep-time compute (Lin et al., 2025) lets an agent think about its context before a question arrives and store what it worked out, and Letta runs this as background agents that tidy memory between conversations. We share the idea of an offline pass. Our night pass has a different job: it audits rules, counts recurrences and drafts checks (§6.2).

**Products that rewrite the prompt.** LangMem's prompt optimiser rewrites an agent's system prompt from conversations and feedback (LangChain, 2025). Claude Code loads its instruction files and its own auto-memory notes into every session (Anthropic, 2026a), and the Claude memory tool gives a model a directory it reads and writes across conversations (Anthropic, 2025). Together these supply the bottom three rungs of our ladder. As far as their documentation shows, none counts how often a written lesson failed, and none moves a lesson from one rung to the next.

**Checks made from corrections.** Claude Code hooks run code before a tool call and can block it (Anthropic, 2026b). The hookify plugin goes a step further: run with no arguments, it reads the recent conversation for behaviour the user corrected and writes rules that warn or block on the next tool call (Anthropic, 2026c). It is the closest shipping relative of our top rung, and it makes a check when asked; it keeps no ledger and has no criterion for when a correction deserves one. HASP (Liu et al., 2026) makes the research case that textual skills stay advisory, turns them into program functions that fire on failure-prone states, and proposes new ones from failure and repair patterns that recur. Self-Harness (Zhang et al., 2026) mines an agent's own traces for recurring failures and edits its harness, accepting a change only after regression tests. We take from these the move from text to an executable check and the test before acceptance. What we add is the path in between: the middle rungs, the count that decides when to climb, the owner's correction as the label, and pruning that removes text only when a check carries it. We did not find a design that keeps such a per-rule count across text, always-loaded text and checks and uses it to decide both promotion and pruning; the parts exist, and the ladder that joins them is the contribution.

**Optimising texts against a score.** OPRO, DSPy and GEPA improve prompts by proposing rewrites and keeping those that score better (Yang et al., 2023; Khattab et al., 2023; Agrawal et al., 2025). GEPA reflects on traces in plain language and keeps a set of complementary candidates. Our loop for the texts that machines run on (§8.4) is this family applied to our own labels, with a chronological split and a set of cases that must never regress. PROCTOR (Wahi, 2026) argues that such loops need deterministic acceptance checks that a model judge cannot override. We adopt that for every proposal (§7.4).

**Skills that compound.** Voyager (Wang et al., 2023) stores working procedures as named skills and builds new ones out of old ones. Our procedural home is the skill or recipe file (§8.1), and its lessons come from the owner's corrections and from real run outcomes.

## 3. What the agent learns from

### 3.1 The owner's correction is the label

An agent has many possible teachers: its own critique, a benchmark, the result of a tool call. For a personal assistant the best one is the person it works for, because a correction is rare, it costs the owner something, and it states the exact standard he holds. We rank the signals, strongest first:

1. An explicit mark: "remember this", "that was wrong", a button that records the same.
2. A correction in his next turns: "I asked you to", "again", "still", a terse "no".
3. A reversal: he undoes the agent's change, rewrites its draft, or reverts its commit.
4. Praise for something the agent did of its own accord. A good habit is a rule as well, and the owner may ask the agent to keep doing it.
5. The outcome of scheduled work: a job's status and error, a report nobody opened.

The agent's critique of itself ranks last. It is cheap, and it shares the assumptions that produced the slip.

Every reader in this stage sees only the owner's own words, taken from the author field of the session record (J1 §4.1), never the wrapper a harness puts around them. Signals 1 and 2 are found by one classifier shared with J1: the cheap judge of J1 §5.2 tags each of the owner's sentences once, when the turn is appended, as an instruction, a correction, praise or none of these. Compaction keeps the tagged sentences word for word, and learning reads the same tags. We call it the correction detector. One classifier means one labelled sample and one precision to measure (§12, test 6).

### 3.2 Sort by cause before writing a rule

Not every failure is a missing rule. Each correction is first put in one of five classes:

| Cause | Example | What it becomes |
|---|---|---|
| Rule gap | The agent could have done right and had no rule, or ignored one | A rule in the ledger |
| Missing capability | No tool or skill exists for the job | A task to build one |
| Environment | An outage, a rate limit, a restart | A repair, never a rule |
| Model limit | The task was beyond the model that ran it | A routing record: next time, a stronger model |
| Wrong or stale fact | "The call is on Thursday", when the store says Wednesday | A supersede through J14's gate (J14 §6.5, §7.5), never a rule |

A rule written for an outage teaches the agent to fear something that will not happen again, and makes the always-loaded file longer for nothing. A factual correction is the same kind of error in reverse: written as a rule, it leaves the wrong fact standing in the memory store and adds a line that contradicts it. One correction can belong to two classes. If the agent should have checked the calendar before naming the day, the fact is superseded and a rule gap is recorded as well. Scheduled jobs fail mostly for environmental reasons, which is why this sort comes before any rewrite of the texts they run on (§8.4).

### 3.3 A correction carries its reason

A correction records three things: what happened, what should have happened, and why the owner cares. The reason matters more than it looks. A rule obeyed without its reason cannot be stretched to a new case or retired when its case is gone. A rule that carries its purpose extends to cases its wording missed, and it tells the auditor when it no longer applies. Each rule also states when it must not apply. A safety rule with no such limit tends to grow until it blocks useful work, and stating the exception up front is cheaper than discovering it later.

## 4. The rule ledger

A fact says what is true; a rule says what to do. Facts belong to the memory store designed in J14. Rules have a ledger of their own, because what we need to know about a rule is different: where it lives, whether it binds, and how often it failed.

| Field | What it holds | Why it is there |
|---|---|---|
| Statement | The rule in one sentence | What the agent should do |
| Purpose | Why the owner wants it | Extends the rule to new cases; tells when it is obsolete |
| Applies when / not when | Trigger and exception | Keeps the rule from growing too broad |
| Evidence | Each correction, with its date and a pointer into the session record | The positive tests for any check built later |
| Home | Current rung, and the file or check that carries it | Where to look when it fails |
| Recurrences | Each slip after the rule existed, and the rung it was on at the time | Drives promotion (§5) |
| Receipts | Each time its check fired, and what happened | Tells a working check from a silent one |
| Cost | Tokens per turn on rung 2; false alarms on rung 3 | Spends the attention budget (§7.1) |
| Status | Active, provisional, pinned, dormant or retired, with approvals | The audit trail |

The ledger only grows. Retired rows stay, so the history of every rule can be read back. The rule ledger is a file, and the file is the ground truth: any table or index built over it is a cache that can be rebuilt. It is not J2's read ledger, which tracks what the context window already holds.

**Matching is the hard part.** When a correction arrives, the first question is whether it is a new rule or an old one failing again. A recurrence counted as a new rule hides the climb: the ledger fills with near-copies, each on the bottom rung. Two different rules merged into one produce a rule too broad to follow. Matching goes by meaning, and it reuses the judge J14 already runs (J14 §5.3) with a different comparison set: the candidate rows that a search over statements and purposes returns. The judge's relations map onto the ledger. *Same* is a recurrence of that rule. *Adds detail* sharpens the row's statement or exception. *Replaces* means the owner changed the rule: the old statement stays in the row, struck and dated, and on rungs 2 and 3 the change waits for him (§7.4). *Conflicts* becomes a question in the morning report (§7.5), and *new* opens a row. One judge means one set of thresholds, tuned on one labelled sample, and the auditor reviews every unsure match that night. When the rule's text is later written into a file, the same judge runs again through J14's gate, this time against that file's topic and the always-loaded rules. The two calls compare the rule with different things, so neither can stand in for the other.

## 5. The binding ladder

![The binding ladder. Each rung binds harder and costs more. A rule moves up one rung when it recurs while living on its current rung, and down one rung only when its check misfires or it has gone unused for months without ever recurring.](images/fig2-ladder.png){width=100%}

### 5.1 The four rungs

**Rung 0: a note in the memory store.** It costs nothing per turn and binds only when something searches for it, either the agent on purpose (a pull) or the retrieval step that runs on every turn (J2's push).

**Rung 1: task text.** A line in the skill or recipe file that loads when that kind of task runs. Owners ask for this rung by name ("save it in the recipe"), and for most procedural lessons it is the right first home: the rule shows up exactly when it is needed and costs nothing otherwise.

**Rung 2: always-loaded text.** A line in the file the agent reads on every turn. It binds better than the lower rungs because it is always in view, and it costs attention on every turn whether the rule matters there or not.

**Rung 3: a check in the path of action.** Code, or a small model call, that runs before an action takes effect and blocks it, rewrites it or asks the owner, and writes a receipt each time it fires. The best version removes the possibility of the mistake altogether: a renderer that cannot show a draft the wrong way needs no rule about drafts. Safety engineering calls that elimination and ranks it above every other control (NIOSH).

### 5.2 Where a rule enters, and why it climbs one rung at a time

A new rule enters the lowest rung whose loading covers the place where the slip happened. A rule about one kind of task goes into that task's file. A rule about every reply belongs on rung 2, which needs approval (§7.4); until then it is held as a provisional line, described there.

It would be simpler to send every rule straight to a check. Here is why we do not. For a rule on rung $k$, let $p_k$ be the chance it slips again within a month, $H$ the cost of a slip and the re-teaching that follows (the owner's time, and his trust), and $c_k$ the monthly cost of carrying the rule on that rung. The expected monthly cost is

$$C_k = p_k H + c_k .$$

Each rung up lowers $p_k$ and raises $c_k$. On rung 2 the cost is attention. On rung 3 it is building and maintaining the check, testing it, and the false alarms that block legitimate work. Most rules are taught once and never slip again: for them $p_0$ or $p_1$ is already small, and a higher rung only adds cost. We do not know a rule's $p_k$ in advance, but a recurrence is direct evidence that it is high where the rule lives now. Climbing one rung per recurrence pays the higher price only for rules that have shown they need it.

Money is not what limits rung 2. We use the series' notation and price table (J2 §7.1): a cached token is read at $r$ times the base input price, with $r = 0.1$ at Anthropic's standard rate and 0.05 on some current models. A 40-token line read on 300 turns a day for 30 days is 360,000 cached tokens a month, which is $360{,}000\,r$ base tokens. At the large-model input price J14 §9 uses, \$4 per million tokens, that comes to between 7 and 15 cents a month (Anthropic, 2026d). The scarce resource is the model's attention (§1.2), so the budget in §7.1 is counted in lines and tokens, not dollars.

Two kinds of rule skip the climb. Harm that cannot be undone, such as deleting the owner's files or sending a message in his name, gets a check from the first correction. And the owner can place any rule on any rung by asking.

### 5.3 What a check looks like

A check is deterministic wherever the slip is visible in the action itself: a command, a file path, a recipient, the format of a draft. Where the slip needs judgement (the language of a reply, a plan that does not match what was asked, an explanation pitched too high), the check is a call to a small model that answers with a typed choice before the action goes out. Either way it writes a receipt every time it fires: what it saw, what it did, and whether the owner overrode it.

A check is built from the ledger's evidence. The recorded slips are its positive tests, and recent similar actions that went well are its negative tests. It must catch every recorded slip and stay silent on the negatives before it is proposed. A check that blocks is the last resort. Rewriting the action, or asking one short question, often serves the owner better, because a needless question costs him time too.

### 5.4 When a rule recurs, ask why before climbing

A recurrence does not climb automatically. The auditor first asks why the current home failed to bind, and the answer decides the fix:

| Why the rule failed | Fix |
|---|---|
| It was not loaded where the slip happened | Move it to a home that loads there |
| Another line contradicted it | Fix or remove the other line (J14's contradiction check), with the owner's approval (§7.3) |
| It was too vague to act on | Rewrite it with its trigger and an example |
| It was buried in a long file | Shorten the file; reorder by harm (§7.1) |
| It was loaded, clear and uncontradicted, and still ignored | Climb one rung |

Only the last case is evidence that the rung itself is too weak. In the opening story, the second slip came from a missing load and the third from a contradiction: the fixes were a move and a deletion, and only a later slip, with nothing else left to blame, would justify a check.

A rule can also come down. A check whose receipts show it firing wrongly, or being overridden by the owner, is fixed or moved down a rung. A rule that has gone months with no trigger and no recurrence may move down to free attention for others. Nothing comes down for being old or long.

## 6. Two speeds

![Two speeds of learning. In the daytime the task turn answers first; a separate reflection turn then records the correction, applies low-risk writes at once and files proposals. At night an auditor gathers the day's evidence, counts recurrences, decides promotions and checks, prunes only what a check carries, and sends a morning report. In the morning the owner approves, and the next session loads the change.](images/fig3-speeds.png){width=80%}

### 6.1 The fast path: a turn right after the task

The owner gets his answer first. Then a separate, short reflection turn runs. It is kept out of the task turn for two reasons. A reflection mixed into the task delays the answer and degrades both, and a turn of its own can act, with its own budget, after the owner's work is done.

The reflection turn reads the exchange that just ended, the owner's words only (§3.1), looks for a correction, sorts it by cause (§3.2) and matches it to the ledger (§4). A new rule is recorded, and a recurrence is added to its row. Writes to rungs 0 and 1 happen at once: they are scoped, cheap and easy to undo. Anything that touches rung 2 or 3 becomes a proposal, except for the provisional line of §7.4. The turn then reports only the writes it can show, by reading each one back, so a reflection can never claim a fix it did not make.

A second sighting of a rule is urgent. The reflection turn flags the proposal so the morning report puts it first. If the owner is still working, it can ask him then.

### 6.2 The slow path: the nightly auditor

The auditor runs in a fixed order, because each step needs the one before it:

1. **Gather.** The rule ledger; the day's session records, read for corrections the fast path missed, from the owner's own words only; the receipts of every check; the outcomes of scheduled jobs.
2. **Count.** Merge duplicate rows, confirm uncertain matches, and add each recurrence to its rule.
3. **Decide.** For each rule that recurred, answer the question in §5.4 and pick the fix. Draft checks, with their tests taken from the recorded slips. Demote checks whose receipts show false alarms.
4. **Prune and report.** Propose removing from rung 2 only what a higher rung now carries (§7.2), and assemble the morning report (§7.5).

Pruning comes last because it needs the night's decisions. If it ran first it could remove a rule the same night was about to pin.

The other night jobs of the memory system are not the auditor's. J2 refreshes its indexes and use keys on its own offline loop, and J14's nightly pass consolidates facts, sweeps the lines its gate marked "unchecked" (J14 §4.3) and raises its conflict questions. Each runs on its own schedule, owned by its own paper, and keeps its own receipts (§9.1). The auditor's only tie to them is the report: it is assembled after they finish, so their holds and questions reach the owner the same morning, and a job whose receipt is missing at that point appears in the report as "did not report", never as "nothing to say".

The auditor's input grows with the number of corrections, not with the day's traffic. It reads the ledger and the turns around each correction, not every transcript in full. This matters because an agent loop sends its context again on every step, so a night pass that reads whole days pays for them many times over.

### 6.3 Which path does what

The fast path is a recorder with small powers: it never waits, it never edits what every turn loads, and it may be wrong about a match. The auditor is the judge with the full picture: it sees every correction of the day together, it can compare a rule's whole history, and it proposes the costly changes. Both write the same ledger. A lesson therefore exists the moment it is taught and binds harder the morning after it fails.

## 7. Keeping the always-loaded file honest

### 7.1 A budget measured in attention

The always-loaded file has a fixed budget, in lines and tokens. Since a long list of instructions is followed less well than a short one, and earlier lines more than later ones (Jaroslawicz et al., 2025), the budget is a ceiling, and the order is part of the design: rules whose slip does the most harm come first. When a new rule needs room, the one with the lowest expected cost of moving down ($p H$ at its next rung down, §5.2) gives way. The budget, and what leaves the file when it is full, belong to this stage; J14's gate checks each line that enters it.

### 7.2 Prune by binding

A rule leaves rung 2 in one of two cases:

- **A higher rung carries it.** Its check exists and the receipts show it firing on the right cases.
- **It earned no place.** It has seen no trigger and no recurrence for a long window, on the order of two months, and it has never recurred.

A rule that has ever recurred is pinned on rung 2 until a check carries it. When a rule moves down, it goes to rung 1 or 0 and is found the way J2 finds any owned asset. Its entry in J2's asset index gets use keys cut from its trigger and from the slips in its evidence (J2 §5), and while its area is still active the entry stays in the index file, the always-loaded head of the store (J2 §4.3). The use keys are what find it again. J2's guaranteed slot for a named item cannot, because it fires only when the owner's words name the item, and nobody names a rule he believes the agent already follows.

Pruning by date or size looks safe because the archived rule can still be retrieved. But retrieval needs a cue, and a rule the agent no longer sees gives it none. This is the case where a lesson is kept and still forgotten, and it is the failure that pruning by binding exists to prevent.

### 7.3 One voice

The rules every turn reads must not contradict each other. Every promotion to rung 2 runs J14's contradiction check against the whole always-loaded set, and a clash is resolved as J14 §5.2 prescribes: held for the owner, via the morning report (§7.5). Neither line wins by being newer. In the opening story, one stale line undid a rule that was otherwise correct and in place, and the right fix was to narrow the old line, not to delete it (§10).

### 7.4 Approval, and who may loosen

Not every change needs the owner, and asking him about every one would make him the bottleneck. The split follows risk. Anything cheap, scoped and easy to undo happens at once. Anything that every turn reads, or that can block his work, waits for him. Loosening is his alone.

| Change | Who decides |
|---|---|
| Writes to rungs 0 and 1 | The fast path or the auditor, at once; undone in one step |
| A provisional line on rung 2, from the owner's own instruction in the turn | The fast path, without waiting; it expires in a few days unless approved |
| Any other change to what every turn loads | The owner, in the morning report |
| A new check, or a change to one | The owner, after its tests pass |
| Loosening: removing or weakening a safety rule or check, widening a permission | Only the owner, always |

The provisional line exists because a universal rule taught in the morning should not wait for the next day. It needs no further approval because the owner just gave the instruction himself, and it is capped at a few lines so that it cannot grow into a second always-loaded file. It does not enter the always-loaded file during the session. A line written there moves the cached prefix, and every later turn would pay to write the rest of the prefix again (J2 §7.4). For the rest of the session the line rides in the per-turn tail, next to the owner's message, where it costs only its own tokens. It loads from the always-loaded file from the next session on, when the prefix is written anyway. Approved changes take effect the same way, at the next session.

Before the owner sees a proposal, it passes two filters. The first is deterministic and no model can override it (Wahi, 2026): the check's tests pass, the budget holds, and the contradiction check finds nothing. The second is a doubt pass: a reviewer in a fresh context, from a different model family, sees only the proposal, its evidence and the current always-loaded file, and argues against it. The model that wrote a change shares the assumptions that produced it, and a reviewer that never saw its reasoning can question them.

The model that writes to rungs 2 and 3 is the strongest one available, never a cheap default. Its quality is measured by how often its changes are later reverted or corrected again (§12).

The loop may tighten on its own within these gates. Only the owner loosens.

### 7.5 The morning report: one channel to the owner

Every memory stage sometimes needs the owner. This stage needs approvals. J14 holds a write that clashes with an always-loaded rule (J14 §5.2), raises a question when two facts conflict and neither clearly wins, and holds any closure of an always-loaded line (J14 §6.2). If each stage asked in its own way, the owner would field questions from several places at several times. So there is one channel, the morning report, and every stage that holds something for the owner writes it there.

Each item is one line: what is waiting, the evidence quoted, and the answers it accepts. The evidence is the slips behind a proposal, or the two clashing lines with their sources and dates. A proposal takes approve or reject. A conflict takes keep the old, keep the new, or keep both with a scope. A held write takes write it or drop it. The answer goes back to the stage that raised the item, which applies it through its own path: J14's gate writes or supersedes, and this stage updates the rule ledger. The report itself never changes a file.

Items are ordered by what waiting costs. Alarms come first: a loop whose receipt is missing (§9.1), or a burst of closures that paused J14's automatic closing (J14 §6.6). Then second sightings of a rule (§6.1), holds on always-loaded lines, conflict questions, and the remaining proposals. The report is capped, at about ten items, because it is paid for in the owner's minutes (§11). What does not fit waits for the next morning with its age shown, and an unanswered item never turns into a yes by expiring. An urgent item may also be asked in the session if the owner is working, and his answer there closes it in the report. A night with no report is an alarm, and so is a report with a stage missing: a stage with nothing to ask says so in one line.

## 8. Procedures, and the texts machines run on

### 8.1 Recipes and skills are where procedural lessons live

Most lessons about how to do a task belong in the file that describes the task. A correction that points at a step of a recipe edits that step, not a general note. Steps that fail noticeably more often than the rest of their own recipe are flagged for sharpening, and the step's failure rate is compared before and after on later runs. That gives a before-and-after on the step itself, independent of the agent's own report of success.

### 8.2 Learn from what records the work

A learner is only as good as its input. Procedure learning reads the session record (J1) and the run log of each recipe and scheduled job: status, error, duration, model, and the owner's reaction. Before any procedure-learning lane is switched on, it checks that its input saw the work: the owner's turns present in its input, divided by the owner's turns in the session record, must be close to one (we propose 0.9). A learner fed empty episodes learns nothing and reports success anyway.

### 8.3 Switch strategies; do not stack patches

The ladder applies to procedures too. A strategy that fails several times within a short window (we propose three times in a day) switches to its fallback instead of receiving another patch. The switch records how long recovery took, so a switch that did not help is visible. The fallback for each strategy is written by hand at first, until enough outcomes exist to rank alternatives.

### 8.4 Texts that machines run on

Some texts are read by models on every run: the instructions of scheduled jobs, and the short question texts a small classifier answers before an action. They can learn from outcomes too:

1. Score each text against its labels (§3.1), with environmental failures removed (§3.2).
2. For the worst text, a model drafts two or three rewrites.
3. Replay old and new on the labelled history, split by date so the newest cases are held out.
4. Promote the new text only if it wins on the held-out cases and loses nothing on a fixed set of cases it must always get right.
5. Keep every version, and record the numbers with each promotion.

A new incident joins the test set at once instead of waiting for the night, and costly or surprising cases are replayed more often (Schaul et al., 2016). This is the GEPA and DSPy family of optimisers (§2), pointed at labels that come from one owner's real corrections.

### 8.5 Skills that compound

When the agent solves a recurring kind of task well, the procedure is kept as a skill file, ranked by its real outcomes and found the way J2 finds any owned asset. Skills are retired when their outcomes decay, and deprecated skills stay readable. The ledger treats a skill like any other home on rung 1.

## 9. Every loop keeps its books

### 9.1 A receipt for every run, and a zero means zero

Every learning loop (the fast path, the auditor, each procedural lane, the text optimiser) writes one receipt per run, idle runs included: when it ran, what it read, what it changed. The process that runs the loop writes the receipt itself, so a receipt never depends on a server that the loop did not start. A missing receipt is an alarm.

This is one case of a rule the whole series follows, stated here once; J1, J2 and J14 cite it. **A zero means zero.** A count of none, an empty table or a quiet log must mean that its producer ran and found nothing. A missing producer, a dropped event, a probe on a path the work never takes, or a tool that was never offered must read as "did not run" or "not reported", never as zero. So every count has a named producer on the path that does the work, "did not run" and "ran and found nothing" are different values, and a count that should move but stays at zero while work goes by raises an alarm. The rule lives in this paper because a false zero costs most in a loop that learns from what it observes: fed by a silent producer, it learns that nothing goes wrong.

### 9.2 Inputs that move

A learner checks that its outcome field varies. If every row says "done", or every value is the default, the learner is learning from a constant, and it flags itself as broken instead of reporting a confident estimate.

### 9.3 Retiring a loop that stops paying

Self-improvement has diminishing returns: past some point a loop finds no more useful signal, and it should be switched off. Each loop therefore keeps an account. On the gain side: re-teaches avoided, meaning rules it promoted that then stopped recurring, and approved proposals. On the cost side: tokens, the owner's minutes spent on approvals, and false alarms from the checks it built. When the gain stays below the cost for several periods in a row (we propose three weeks), the loop goes dormant and says so in the morning report. A dormant loop has wake conditions: a new kind of correction appears, the owner's correction rate rises, or the owner asks.

![A learning loop's account, with illustrative numbers. Its weekly gain falls as the rules it can fix get fixed, while its cost stays flat. After three weeks below cost it goes dormant and stops running; a new kind of correction wakes it. The shape, not the values, is the point.](images/fig4-retire.png){width=80%}

Rules and checks retire the same way. A check that guards a tool which no longer exists retires, and a rule whose purpose has gone (§3.3) is marked obsolete with its reason.

### 9.4 Two numbers judge the whole design

Everything above serves two measures, both read from the owner's own words: **his correction rate**, the share of his messages that correct the agent, which should fall; and **the number of rules he has had to give more than once that still live only as text**, which should fall by one rung per recurrence.

## 10. One rule, start to finish

Back to the Monday in §1, under this design.

The owner writes in Finnish and gets English. He corrects it. The reflection turn after the reply finds the correction and sorts it as a rule gap, since the agent could have replied in Finnish. It finds no match in the ledger and opens a row with the statement (reply in the language of the owner's message), its purpose (he reads fastest in the language he chose), and its exception (a draft for someone else follows that person's language). Because the rule is about every reply and the owner gave it himself, it goes in as a provisional line on rung 2: in the per-turn tail for the rest of that session, in the always-loaded file from the next. The morning report asks for approval, and he approves.

Ten days later the agent answers in English again. The reflection turn matches the slip to the row and flags it as urgent. That night the auditor asks why the rule failed. The line was loaded and clear, but the contradiction check finds an older line, written for a scheduled job, telling the agent to answer in English. The fix is to scope the old line to that job. That changes an always-loaded line, so the clash is held and the morning report puts both lines in front of the owner; he picks the scoped version. The rule does not climb, because the rung was never really tested.

A month later it slips a third time. The rule was loaded, clear and unopposed, so the rung itself is too weak. The auditor drafts a check: before a reply goes out, a small model compares the language of the reply with the language of the owner's last message, and rewrites on a mismatch. Its positive tests are the three recorded slips, and its negative tests are the last two hundred replies, all in the right language, plus drafts for third parties that are meant to differ. The check passes, the doubt pass finds nothing to object to, and the owner approves it in the morning report.

Over the next weeks the check fires twice and rewrites twice, with no override. The receipts show it binding, so the auditor proposes freeing the rung-2 line, the owner approves, and one line in the index file keeps pointing at the check. The owner never gives the instruction a fourth time.

## 11. Conclusions

An agent whose model cannot change learns through the texts and checks around the model, and text alone binds weakly. This design takes the owner's corrections as the labels and gives each rule a row in a ledger. A rule is recorded the same day and audited each night, and each time it recurs it moves one rung up, from a note to text loaded with the task, to text loaded on every turn, to a check in the path of action. It leaves the always-loaded file only when something stronger carries it. Changes to what every turn reads wait for the owner, who alone may loosen. Every loop keeps receipts and accounts, and sleeps when it stops paying. The point of it all is the cyclist's balance: a lesson taught once or twice that then runs on its own.

The design has limits.

- **It is only as good as its correction detector.** A missed correction is a rule that never gets written, and a false one adds noise. Both are measurable from the session record, and §12 measures them.
- **Checks can be wrong.** A check that blocks useful work trades one kind of correction for another. The receipts, the owner's overrides and demotion bound the damage without removing it.
- **Approvals cost the owner time.** The design asks for his attention every morning. If the proposals outgrow it, the approval gate becomes the bottleneck it was built to protect.
- **The cost model is unmeasured.** The $p_k$ of §5.2 are what the ledger will estimate. Until then, one rung per recurrence is a reasoned default, not a fitted policy.
- **Some rules resist checking.** "Explain it more simply" can be checked by a model, but only roughly, and such rules may stay on rung 2 for good.
- **Rules can be planted.** A crafted input could try to teach the agent a harmful rule. Approval on rungs 2 and 3, and the owner's sole right to loosen, limit what a planted rule can do, but a rule on rung 0 or 1 can still mislead within its task.
- **Models change.** A rule tuned to one model may be unnecessary, or wrong, for the next. Every model upgrade should replay the checks' tests and re-examine the rung-2 rules.
- **One owner.** The design was shaped by one person's corrections. The mechanisms should carry over to other owners; the particular rules will not.

## 12. Next steps

TinkerClaw will build this design and test it, and an updated version of this paper will report what the tests found. These are the tests that would settle what is not yet known:

1. **The ladder against text.** Take six rules the owner has already given more than once. Give three a check and leave three as always-loaded text. Count repeats for four weeks. The design predicts fewer repeats for the checked rules.
2. **Pruning by binding against pruning by age.** Over sixty days, compare the recurrence rate of rules moved down by each policy.
3. **Fast against slow.** For every correction over eight weeks, record the time from the correction to the edit that encodes it, and whether the rule recurs within fourteen days, split by "recorded the same turn" and "recorded only at night".
4. **Why rules fail.** For every recurrence, record the answer to §5.4. If "loaded, clear and still ignored" is rare, most of the gain comes from moving and pruning lines, not from checks.
5. **Check precision.** From the receipts: fires, true catches, owner overrides. A check whose false-alarm share stays above a set bar is demoted.
6. **Correction detection.** Hand-label a random sample of the owner's messages and measure the precision and recall of the shared classifier (§3.1), with and without removing the wrapper.
7. **Input coverage.** Before any procedure lane runs, the ratio of §8.2, measured daily.
8. **The text optimiser.** Held-out win rate of promoted texts, and zero losses on the must-pass set.
9. **Who should write rung 2.** The rate at which night edits are reverted or corrected again, broken down by the model that made them.
10. **The two numbers of §9.4,** tracked weekly for the life of the system.

Two things are worth trying beyond these tests. First, ranking strategy fallbacks by measured outcomes instead of by hand once enough runs exist. Second, feeding the ledger's pairs of slip and correct behaviour to a small model trained to spot the next slip, which would make a rung-3 check out of the owner's own history.

## References

Agrawal, L. A., et al. (2025). GEPA: Reflective Prompt Evolution Can Outperform Reinforcement Learning. arXiv:2507.19457. <https://arxiv.org/abs/2507.19457>

Anthropic (2025). Managing context on the Claude Developer Platform (context editing and the memory tool). <https://www.anthropic.com/news/context-management>

Anthropic (2026a). How Claude remembers your project. Claude Code documentation. <https://code.claude.com/docs/en/memory>

Anthropic (2026b). Hooks reference. Claude Code documentation. <https://code.claude.com/docs/en/hooks>

Anthropic (2026c). hookify plugin. anthropics/claude-code repository. <https://github.com/anthropics/claude-code/tree/main/plugins/hookify>

Anthropic (2026d). Pricing. Claude Platform documentation. <https://platform.claude.com/docs/en/about-claude/pricing>

Jaroslawicz, D., Whiting, B., Shah, P., & Maamari, K. (2025). How Many Instructions Can LLMs Follow at Once? arXiv:2507.11538. <https://arxiv.org/abs/2507.11538>

Khattab, O., et al. (2023). DSPy: Compiling Declarative Language Model Calls into Self-Improving Pipelines. arXiv:2310.03714. <https://arxiv.org/abs/2310.03714>

LangChain (2025). LangMem SDK for agent long-term memory. <https://blog.langchain.com/langmem-sdk-launch/>

Lin, K., Snell, C., Wang, Y., Packer, C., Wooders, S., Stoica, I., & Gonzalez, J. E. (2025). Sleep-time Compute: Beyond Inference Scaling at Test-time. arXiv:2504.13171. <https://arxiv.org/abs/2504.13171>

Liu, H., Ming, Y., Joty, S., & Zhao, C. (2026). Harnessing LLM Agents with Skill Programs. arXiv:2605.17734. <https://arxiv.org/abs/2605.17734>

McClelland, J. L., McNaughton, B. L., & O'Reilly, R. C. (1995). Why there are complementary learning systems in the hippocampus and neocortex. *Psychological Review*, 102(3), 419–457. <https://doi.org/10.1037/0033-295X.102.3.419>

NIOSH. About Hierarchy of Controls. U.S. Centers for Disease Control and Prevention. <https://www.cdc.gov/niosh/hierarchy-of-controls/about/index.html>

Schaul, T., Quan, J., Antonoglou, I., & Silver, D. (2016). Prioritized Experience Replay. ICLR 2016. arXiv:1511.05952. <https://arxiv.org/abs/1511.05952>

Shinn, N., et al. (2023). Reflexion: Language Agents with Verbal Reinforcement Learning. NeurIPS 2023. arXiv:2303.11366. <https://arxiv.org/abs/2303.11366>

Wahi, V. (2026). LLM-as-a-Judge Is Not an Oracle: Why Self-Improving Agents Need Deterministic Guardrails. arXiv:2609.02246. <https://arxiv.org/abs/2609.02246>

Walker, M. P., Brakefield, T., Morgan, A., Hobson, J. A., & Stickgold, R. (2002). Practice with sleep makes perfect: sleep-dependent motor skill learning. *Neuron*, 35(1), 205–211. <https://doi.org/10.1016/S0896-6273(02)00746-8>

Wang, G., et al. (2023). Voyager: An Open-Ended Embodied Agent with Large Language Models. arXiv:2305.16291. <https://arxiv.org/abs/2305.16291>

Yang, C., et al. (2023). Large Language Models as Optimizers. arXiv:2309.03409. <https://arxiv.org/abs/2309.03409>

Zhang, H., et al. (2026). Self-Harness: Harnesses That Improve Themselves. arXiv:2606.09498. <https://arxiv.org/abs/2606.09498>

Zhang, Q., et al. (2025). Agentic Context Engineering: Evolving Contexts for Self-Improving Language Models. ICLR 2026. arXiv:2510.04618. <https://arxiv.org/abs/2510.04618>

---

_J-series paper J5 | Version 7.0 | 2026-10-12_
