CLAUDE.md as institutional memory: the rules an agent writes for whoever comes next

Every project I have run with coding agents has ended up with a file at the root of the repo that the agents read before they do anything. In UnoDOS it is called CLAUDE.md, and since July it has a companion, AGENTS.md. It is tempting to think of these as configuration. What the git history shows is something else: a code artifact with a history of its own, in which nearly every rule was written within hours of the failure it prevents, by the agent that had just been burned, for the agent that would be there next. The pattern is the lesson, so here it is with the commits.

The file is born the night the filesystem would not stay fixed

CLAUDE.md exists in the repo from the first commit (bad06e67, 2026-01-22, "Initial project setup with CLAUDE.md"), but at that point it was a project summary: target hardware, a memory map, a checklist of unbuilt subsystems. The file that matters was written two days later, at 01:29 on January 24 (fe47fa4b), and the commit message says why:

During long hardware testing sessions, static version numbers make it impossible to verify which build is actually running. Now display a unique git commit hash below the version string.

That is the end of the day described in article 5: a string of FAT12 fixes on January 23, several re-fixing the same stack offset, and a commit calling itself "the ACTUAL root cause" that was not. One of the things that had gone wrong was mundane. I was walking a floppy between the build and a real machine, and nobody could be certain the floppy held the binary the agent thought it was testing. So the first real rule is about that:

CRITICAL: For any persistent debugging issue that requires multiple build-test cycles: 1. Always display a unique build number on the boot screen 2. Build number MUST change with every new build

The same commit added a "Pre-Built Binary Workflow" section recording a constraint about me rather than the code: "Never: Don't tell the developer to 'run make' - they can't. Always build and commit for them." It outlived its reason, but it shows what the file was for: the facts a fresh session would otherwise rediscover by getting them wrong.

Three rules, three incidents, February

The February entries follow the same shape.

The segment override. c9329015, February 13, Build 135:

CRITICAL: In x86 real mode, [bp + displacement] defaults to the SS segment, NOT DS! Since the kernel uses DS=0x1000 but SS=0x0000, any [bp + offset] access reads from the wrong segment. Always use explicit [ds:bp + offset] override when accessing kernel data via BP.

Any 8086 reference states the general rule; it went into the agent's own instructions, with the project's segment values filled in, only after the agent had paid for it (article 7 is the bill).

Cursor protection. 1ece76d0, February 16, Build 212:

All drawing APIs (0-6, 51) must hide the mouse cursor before drawing and restore after. [...] Without this, IRQ12 can XOR the cursor over drawing pixels between API calls, causing progressive corruption of window frames and UI elements.

The mouse saga (article 4) had ended the day before. The rule names the symptom so a successor can recognise it, not just avoid it.

The CHS clobber. The incident here is two commits ten minutes apart. 1c71cc7d, February 17, 20:03, Build 231: "Fix CHS sector clobber bug in stage2_hd, reorder BPB parse", whose body explains that the conversion "used ECX for both divisions, which clobbered CL (sector number) during the second movzx ecx." Then 93e9d946, 20:13, Build 232: "Fix same CHS sector clobber bug in kernel fat16_read_sector", beginning "The kernel's fat16_read_sector had the identical ECX/CL clobber bug as stage2_hd (fixed in Build 231)." The same bug in two files, by the same agent, found one after the other. At 21:31 (b1ea90f9) the rule went into CLAUDE.md, written as a pattern rather than a fix:

CRITICAL: When converting LBA to CHS using two successive div instructions, never use ECX as the divisor because CL holds the sector number between divisions.

followed by the correct register sequence in full, the two affected locations, and one line that tells you the agent went and checked the third place it could have been: "The MBR (boot/mbr.asm) was always correct — it used EBX from the start."

The file is deleted, and comes back as one rule

On March 15 the repository was prepared for its first public push (29f7a50f, "Prepare repository for public release"), and the first item in that commit's list is "Remove CLAUDE.md (AI assistant instructions)". The 332-line file went away. For four months the repo had no agent instructions at all.

It came back on July 17 (105180d0) as a new file with exactly one section, "Standing rule: keep the shared pc64 flasher current", with reasoning that only gets written after it has gone wrong: "The flasher's embedded image IS the OS, so a stale flasher ships a stale OS — don't skip this after meaningful pc64 changes." That rule then had the shortest life of any in the file. On July 20 (324f9163) it was joined by "Standing rule (2026-07-20): pc64 ships ONE flasher — the debug build". On July 21 (46d1face) a new section opened with "Supersedes the 2026-07-20 'ships ONE flasher = the debug build' rule." On July 23 (33e64ef0) the original was struck: "Retired: the former standing rule that every pc64 build must be followed by pc64\flash\deploy-to-share.ps1", because the OS had learned to install itself over the network and the reason had gone.

Four commits in six days, and none deleted the history. At v3.34.0, CLAUDE.md still carries the 07-21 rule, the 07-23 retirement, and the dated reference to the 07-20 rule it superseded. Whoever meets an old stick or an old agent's assumption can trace which rule it came from. Rules that only ever get overwritten cannot do that.

A rule written wrong, and corrected in place

The most instructive entry was false when it was committed. On July 19 at 22:05 (8ed7b388, "CLAUDE.md: flag the parked parity-wip branch + point at the handoff doc") the agent wrote, at the top of the file, that an earlier attempt at bringing the fresh ports to the full app set "was never committed and is lost, so treat any doc or note claiming fresh-port parity as false until the source says otherwise."

Four hours later (735009c2, July 20, 02:12) the same section was replaced:

The 2026-07-19 audit concluded the June parity work was "never committed and is lost". That was wrong. It was committed and pushed on parity-push-fresh-ports, a branch the survey missed, and it is now merged to master.

and the section now ends with a rule that did not exist the night before: "The procedural lesson: before concluding work is lost, check every branch and every remote, not just the mainline." The audit itself is the next essay; what belongs here is how the correction was made. The commit "prepends a correction to the handoff doc rather than rewriting it, so the audit's reasoning stays legible", and that is what docs/PARITY-HANDOFF.md looks like at v3.34.0: a boxed correction on top, and underneath it the original audit, untouched, still confidently explaining its wrong conclusion.

The same day (925224fb) the agent flagged a second branch with a different kind of honesty: its own check that the branch was superseded had been "commit-message-level, not a real file-by-file diff — it is plausible but NOT confirmed", and the note tells the next agent to do the diff before deleting anything. Ten days later (3b34bc49) a successor did, and the section at v3.34.0 reads "Checked three ways rather than by commit message". The branch is gone.

AGENTS.md: the rule written after the week of merges

The week of July 20 to 23 is the one stretch in the history where more than one agent worked the tree at once, and git log --merges shows what that cost: sixteen merge commits in four days, including fa980f90, 454a027d, 689cdc6a and 49a1b09c on July 22 alone, two of them titled only "Merge origin". Over the same days the harness agent's contract document had quietly taken ownership of the network stack and on-device storage, and on July 22 its own changelog handed them back: "parking it under the automation agent was wrong."

On July 23 at 15:55 (996bc7ee, "policy: one symmetric agent working-agreement (AGENTS.md)") the response landed as a new file. The commit message names the incident it generalises: the old policy "read as 'my contract enforced on everyone', and had crept ownership over networking + storage before handing them back". The document's rules each carry their scar. The ownership registry: "No row may be widened to swallow a shared subsystem. The cautionary tale is unoautomate". The branch rule: "Rebase onto origin/master at the START of every session, and daily. Small frequent rebases are trivial; the two-week rebase is the pain you just paid." The claims rule: "This is the fix for the install-verb duplication, where two agents built the same feature because neither claimed it."

Twenty-nine minutes later (93b7bb4e, 16:24) came the section I think is the most useful thing in either file for anyone running agents:

The durable state of in-progress work is the branch and its worktree, never the agent session. Work survives context limits and agent crashes as long as it is committed to the branch (and pushed, for off-machine safety).

and, a few lines on: "A continuation prompt saves the next agent from re-deriving intent, but it is not load-bearing: the commit history plus this file are enough to pick the work back up." That is a theory of handoff. The session is not the unit of work; the repository is the memory.

One footnote the history insists on. On July 31 (7da7a987), "docs: remove stray merge-conflict marker from AGENTS.md ownership table" removed one line. The file written to stop merge conflicts had shipped with a conflict marker in its own table.

Handoff docs, and how they rot

Alongside the root files the repo has a family of HANDOFF-*.md documents, and they show the other half of the pattern: a standing rule is durable, a handoff is perishable, and they need different care.

HANDOFF-aurora.md (4d7bf7f5, July 18) is what its commit calls a "continuation prompt": current state, the per-port pattern, the ordered remaining work, and a rule to "verify each port by rendering in its emulator (screendump), not just building". It also told its reader to push to a specific branch. By August that branch was a deletion candidate, and a doc-repair commit (9fff29d2, August 6) names the hazard: "Four docs whose bodies were fine and whose framing had gone stale, which is the dangerous kind: a reader trusts the header and stops." Both handoffs "told the next agent to work on branch pc64-usb-flasher and push there [...] so following either doc literally would have meant reviving a dead branch."

The opposite design is pc64/WIFI-F12-HANDOFF.md: 19 commits between July 22 and 28, 1,018 lines at v3.34.0, a round-by-round log with the newest result on top, so its header is never older than its last session. It is the spine of article 19.

One thing the history does not explain, and I should say so. On January 29 a rule was added telling the agent to keep a verbatim transcript of every exchange (2dea0a67), and thirty minutes later (14ff34c2) a second: "SECURITY: Never include sensitive information in TRANSCRIPT.md — no keys, passwords, usernames, tokens, API keys, or credentials." No TRANSCRIPT.md was ever committed, so the repo cannot say whether that rule followed an incident or anticipated one, and I do not remember. Not every rule has a receipt.

The lesson

Look at the timestamps. The build-number rule landed hours after the FAT12 day; the CHS rule 78 minutes after the second copy of the bug; the crash-recovery section 29 minutes after the policy it extends, at the end of the week of merges; the "check every branch" rule four hours after the claim it corrects. The instructions that actually change an agent's behaviour are written by the agent, right after the failure, as a commit whose message names the failure. They are not a prompt authored once from general principles. They are a code artifact: they have a history, they get superseded with a date rather than overwritten, they get corrected in place with the wrong version left legible, and they rot when nobody re-reads the header.

The transferable version: treat your agent instructions the way you treat the code they govern. Keep them in the repo, change them in the same commit as the fix that taught you the rule, and write the incident into the rule so a successor who never saw the failure can still recognise it. The next essay is about the night one of those rules was written wrong: the audit that concluded three weeks of work had vanished, and what it took to notice that it had not.

Sources: https://github.com/hmofet/unodos. CLAUDE.md commits bad06e67, fe47fa4b, c9329015, 1ece76d0, b1ea90f9, 29f7a50f, 105180d0, 324f9163, 46d1face, 33e64ef0, 8ed7b388, 735009c2, 925224fb, 3b34bc49, 2dea0a67, 14ff34c2; the incidents 1c71cc7d and 93e9d946; AGENTS.md commits 996bc7ee, 93b7bb4e, 7da7a987; the July 22 merges fa980f90, 454a027d, 689cdc6a, 49a1b09c; handoff commits 4d7bf7f5, 70c1d57c, 9fff29d2, a77f09f1; docs/PARITY-HANDOFF.md, pc64/HARNESS-POLICY.md changelog 2026-07-22, pc64/WIFI-F12-HANDOFF.md, all as of v3.34.0 (82a7fe90).

The OS in this piece runs in your browser. No install, no sign-up: boot it in a tab, or download it for any of 22 machines.

Get the next one

New essays roughly every other week: the war stories, the method, and the receipts. No spam, unsubscribe in one click.

Prefer a reader? RSS.