RepoOps
Open the app
07 / Memory and the brain

Turn a repeated mistake into a check

A lesson is one recurring problem written down as a trigger, what went wrong, and the fix. Active lessons re-render a managed block in each tracked repository's CLAUDE.md and AGENTS.md, so the next agent reads them. A lesson can also carry a guard, and the guard is the only part that catches anything.

Last updated

Watch it

30.1 s, captions on. Narration: Microsoft Zira Desktop (provisional voice; an approved narration source is pending).Transcript
Read the narration
  1. 0:00 The same mistake comes back.
  2. 0:02 Someone already wrote that lesson down last time.
  3. 0:06 A note in a file stops nothing.
  4. 0:08 RepoOps gives a lesson a checkable guard.
  5. 0:13 Every guard starts advisory.
  6. 0:15 Three clean catches, no false positives, a clean replay.
  7. 0:19 Then a person may let one block a build.
  8. 0:23 Recurrence is read from later captured sessions, never assumed.
  9. 0:27 The rate can fall.

Synthetic example. Read the guide

1

How to

A tracked repository on the desktop app. The managed block needs a CLAUDE.md at the repository root; without one the re-render is skipped and the store is unaffected.

  1. Open Memory, then the Lessons tab.

    Lessons on this machine lists the active lessons twenty at a time behind Load more. Contested, Queued for review, Deactivated and Retracted are the other four lists, one button each above it.

  2. Write a lesson, or accept one.

    Press Add lesson and fill in Trigger, What went wrong and Fix, then Create; all three are required. Other producers write the same fields: accepting a rule on Recurrence rules mints an inactive lesson, and a case's Review the lesson on Memory admits one from a confirmed cause. A bad outcome promptcompute reports on a code action also drafts a lesson card on Memory's Corrections tab, joined to the cases that name the change. Approving it writes one lesson, or adds to the lesson that already holds the claim. Two active lessons about the same files or guard, whose fixes say never and always about one action, are marked Contested, and both stay out of the managed block. Keep this one puts the lesson you pick back and deactivates the other with a reason that names it. Both stand returns both and stops flagging the pair.

  3. Triage the queue.

    A lesson the machine wrote is inactive and reaches nothing: no briefing, no managed block, no session. The queued for review pane ranks it by how often the problem was observed. Press Activate for what every session should read, or Deactivate to record that you said no.

  4. Let the managed block re-render, or force it.

    Every write to lessons.jsonl re-renders the block between the repoops:lessons markers in that repository's CLAUDE.md and AGENTS.md. Content outside the markers is never touched. Sync agent files runs the re-render across every tracked repository. On a team connected to promptcompute Approvals, the rewrite waits for a memory.agentmd.publish approval and writes only the text the approval names.

  5. Give the lesson a guard and leave it at warn.

    A guard is a deterministic match: error-signature, diff-pattern, content-pattern or regression-test. A new guard is warn, which reports and blocks nobody.

  6. Replay, then promote only when the bar is met.

    Replay runs the guard's matcher over the tree and the recorded incidents and records how broadly it matches. Make blocking needs three distinct catches, no recorded false positive, your name, and REPOOPS_LESSON_PROMOTION armed. A replay older than 90 days reads stale.

2

Use cases

A lesson the machine wrote, waiting on a person

Situation
The nightly reflector distilled a lesson from the week's sessions. It was minted inactive, so it is in the queue, not in anyone's context.
You do
Open the Lessons tab on Memory, read the Queued for review list, and press Activate on the lesson that belongs in front of every session.
You see
The managed block re-renders in every tracked repository at once. Whether the lesson then prevents anything is a separate question, answered by a guard and by later sessions.

Making a guard blocking

Situation
A lesson carries a diff-pattern guard at warn. It has fired on real diffs and nobody has marked a firing wrong.
You do
Press Replay on the card, read the result, then press Make blocking and enter your name.
You see
The guard fails the check instead of reporting. When the bar is not met the button is disabled and names the shortfall, for example 2 of the 3 distinct catches required. Three distinct false positives demote it back to warn on their own.
3

Expected outcome

WorkedEach card shows the trigger, What went wrong, the fix and its created date, with a guard block when it has one.
WorkedThe repository's CLAUDE.md holds the block between the locked markers, with a Showing the top N of M line when the store holds more than fits.
WorkedWeekly prevention rate shows a percentage only for weeks with at least three combined observations.
Did not workAn active lesson is missing from CLAUDE.md.

Next step: The block holds at most 12 lessons and 1,500 bytes. Read the Showing the top N of M line, then deactivate what no longer earns a slot or shorten the fix. A lesson marked Contested stays out until you press Keep this one or Both stand. A lesson whose cited file, symbol or check is gone at HEAD stays out until that code is back or you fix the lesson.

Did not workA lesson's card says Files changed and the lesson is gone from CLAUDE.md.

Next step: A file the lesson names was deleted, renamed or had more than half its lines rewritten since the lesson recorded it. Read the files listed under Files changed since, then press Confirm if the lesson still holds (it records the files as they are now and goes back in the block), or Retire if it does not.

Did not workThe block does not re-render at all.

Next step: Add a CLAUDE.md at the repository root or unset REPOOPS_LESSON_BLOCK_SYNC_OFF, then press Sync agent files.

Did not workMake blocking is disabled.

Next step: Read the reason on the button. Run Replay, wait for real catches, and arm REPOOPS_LESSON_PROMOTION once a guard has earned it.

Did not workA guard keeps firing on the wrong thing.

Next step: Press Mark a firing wrong. To stop one guard for good, press Retire this guard, which leaves the lesson readable.

Did not workThe hosted Lessons page is empty.

Next step: Turn on brain publishing in the desktop app and wait for the next snapshot.

4

What else to consider

Retire, deactivate, retract, delete

Retire this guard removes the machine-checkable half and leaves the lesson readable. A guard that has caught nothing in the last 90 days, and was armed before them, gets a retirement card from the nightly pass, filed with the other proposals under .claude/brain/proposed; nothing is retired until you press Retire this guard, and acknowledging the card keeps the guard. Deactivate takes the lesson out of the managed block and is reversible. Retract records, with a required reason, the date the lesson stopped being true; the row is kept, leaves every surface that answers what is true now, and cannot be un-retracted. Delete removes the row from the file. On a team connected to promptcompute Approvals, Deactivate, Retract and Delete on an active lesson, and a not useful verdict, first ask for a memory.lesson.retire approval: the tab says Nothing changed yet, and you press the same button again once the approval arrives. REPOOPS_LESSON_GUARDS=off stops every guard firing, including the advisory ones.

Recurrence rules: anything you did twice

Recurrence rules, on the Memory page's Lessons tab under Plays and patterns, lists every action for the repository picked there that recurred across two or more distinct sessions, with its evidence rows and a proposed rule. Each rule names where its fix should live (a lesson, a gate, a decision, a glossary or a playbook entry) and you can pick another. Accept files it there (as a lesson it is minted inactive, so you still activate it here), reject stops it being proposed again, and snooze brings it back after 14 days. An accepted rule that recurs is reopened as actionable. Nothing is enforced until you accept. On repoops.ai the Recurrence rules and Validated improvements cards show what each bound desktop published, read only; accepting, rejecting or snoozing a rule stays on the desktop app.

Admission and recurrence on a case

A case admits a lesson only with a confirmed cause, a verified remedy, a repository and the person admitting; a refusal names the missing fact. Delivery, retrieval, acknowledgment, use and a guard's run are five separate receipts, and a guard run carries one of six outcomes: ran-caught, ran-missed, did-not-run, not-applicable, unavailable, execution-error. A new sighting is decided against the case's versioned signature and scope: a different repository is no match, a different signature in the same scope links a new case, and the same signature reopens the case and marks the lesson for revision. When a reviewer marks a recurrence stale, they may record why the line outlived its truth: no owner, no expiry, supersession missed, source rank ignored, or unknown.

From a lesson to a prevention package

A lesson the team keeps becomes a prevention package on the hosted case: one id, immutable versions and a content hash. Promotion criteria are written while the package is a draft and fixed once a candidate is evaluated. Validation runs six legs (reproduce, verify, detect, legitimate controls, held-out variants, a later session), and a timeout, a crash or a flaky answer is never a pass. A second person who is neither the owner nor the version's author approves the exact hash. A pilot is warn-only, a published package can be suspended and resumed, and revocation is final. Bound devices pull the delta, stage each version and acknowledge it by version and hash; a session with no manifest is told its protection is unverified.

Transcript

The walkthrough is silent. These are its captions, in order. Every value it shows is illustrative.

  1. 0:00Version 1, written from a verified case
  2. 0:06Criteria fixed before the results
  3. 0:12Six legs, each bound to the hash
  4. 0:18A second person approves that hash
  5. 0:24Pilot warn-only, then publish. Read the outcome in its denominators.

Install a hook that already worked

The Hook library section of the Lessons tab lists the active lessons whose guard has caught the mistake at least once, most caught first, with the hook each becomes: a prevention package named hook- and the lesson id, and what its guard checks. A lesson with a prevented count of zero is not listed, and the section says how many were left out and why. Type your name, then Approve or Reject an entry; the review is tied to the lesson as it reads now, so editing its trigger, fix or guard puts it back to Changed since review. Install stays disabled until an entry is approved. It stages the package in the tracked repository you pick through the same prevention package path a pulled package takes, and that repository's next session reads it from the prevention block in CLAUDE.md and AGENTS.md. The package also carries the guard itself, named by its hash. In the repository you installed it in, a diff-pattern guard checks that repository's diffs and a content-pattern guard checks each pending tool call, the same way the repository's own lesson guards run; a guard changed on disk after the install does not match its hash and does not run. An error-signature or regression-test guard names the source repository's own errors or test files, so it stays context in the prevention block, and the entry says which kind you have. A hook catch is not counted as a prevented repeat in the target, because the lesson it came from lives in the other repository.

Share a hook with the whole team

On an approved entry, Offer to team sends it to your team's hook library on repoops.ai: the lesson's trigger and fix, its count, the guard and the guard's hash, and who approved it. The machine must be connected to the team, and nothing is sent for an entry that is not approved on its current version. repoops.ai checks the entry again and refuses a count of zero, a guard that does not match its hash, or a review that is not a person's. The offered hooks appear in the Hook library card on the Lessons tab of the hosted Memory page, for the repositories you may open. The owner or an admin chooses Publish to team, and RepoOps writes the prevention package itself from the entry; every machine connected to the team stages it on its next prevention sync and runs its guard as above, and the card counts the machines it was delivered to and installed on. Withdraw revokes the published version, and the next sync removes it from every machine. Offering a newer version of the same lesson and publishing it replaces the old one. A member whose repository access does not include the repository the lesson came from never receives that hook.

Transcript

The walkthrough is silent. These are its captions, in order. Every value it shows is illustrative.

  1. 0:00The Hook library lists a lesson only when its guard has caught the mistake at least once
  2. 0:05A person approves the entry as it reads now, and only then can it be installed or offered
  3. 0:10Offer to team sends it to the Hook library card on repoops.ai
  4. 0:14The owner or an admin publishes it, and every bound machine stages it and runs its guard

Publishing, cost and data

The store is lessons/lessons.jsonl in the repository brain, local by default. With brain publishing on and a bound device, it is published through the redaction pass, and the team brain reader on repoops.ai opens it as lessons, scoped to the repositories you can see. No route withdraws a lesson from a snapshot already published; the next publish replaces the file. The tab makes no model call, and the local store has no plan gate. When the desktop is signed in to a team, a lesson that becomes active gets a signed lesson.record receipt from repoops.ai. A lesson that is deactivated, retracted, deleted while active, folded into a duplicate or loses a contest gets a lesson.retire receipt. Both are checkable against https://repoops.ai/.well-known/receipt-keys.json. Each card shows Signed receipt with its Record and Retire links, or why it has none. Only ids, hashes and fixed codes leave the machine, never the rule text.