Sign In

Let your AI agent learn from every session: a simple curation loop

1

Let your AI agent learn from every session: a simple curation loop

Every generation session teaches you something about a model, and most of it is gone by the next session. A small curation loop (notes in, counted lessons out, rule changes only with your approval) turns those sessions into instructions your AI agent actually follows.

I run my image work through an LLM agent. This is the loop I built for it, written so you can set it up with any agent that can read and write files (Claude Code, Cursor, Codex, a custom script). A one-page version for your own LLM is attached at the end.

The loop

  1. A working session ends and writes a wrap-up note.

  2. The note lands in an inbox folder.

  3. A separate curator agent merges the inbox into a lessons file, with counts.

  4. When a lesson is proven, the curator writes a proposal: an exact edit to an instruction file.

  5. You approve or reject it. Only then does the instruction change.

The working agent never edits its own rules, and the curator never edits them either. It only proposes.

Step 1: set up the folders

Create these in your project:

  • learnings/inbox/: new notes, one file each

  • learnings/distilled/lessons.md: the curated lessons

  • learnings/proposals/: one JSON file per suggested edit

  • learnings/archive/: processed notes, moved there unchanged

  • learnings/rejected.jsonl: one line per rejected proposal

Step 2: capture at the end of every session

Tell your working agent to write a wrap-up note when you end a session. It lists:

  • what ran, with run or job ids,

  • your ratings,

  • what failed and what was retried,

  • every correction you made, in your own words,

  • suggested lessons: one sentence each, with a scope (model, task, character), the run ids as evidence, and a confidence.

Your corrections are the strongest signal. "No, her hair is straight" is worth more than any score.

Step 3: curate with counts

The curator runs in its own session and keeps its memory in files, so it can be restarted at any time. For each inbox file it:

  1. pulls out observations, one per run, not one per sentence;

  2. matches them to existing lessons by meaning and scope, not wording;

  3. adds +1 support or +1 contra, and keeps the three newest evidence refs;

  4. creates a new candidate when nothing matches. When it is unsure, it keeps a separate candidate marked "possible duplicate", because a wrong merge inflates the counts while a missed one only waits.

A lesson looks like this:

L072 [candidate, low] Side-on duels give strict profiles that lose the face; ask for three-quarter view. scope: model:seedream-5.5 | support 1 | contra 0

Step 4: promote and retire by rule, not by feel

Fixed thresholds keep one lucky render from becoming a rule:

  • Promote a candidate at 3 supporting observations from at least 2 runs, or when you confirm it.

  • Retire it when you contradict it, or when contra is at least 2 and at least equal to support.

  • Confidence: low at support 1 to 2, medium at 3 to 4 (or confirmed by you), high at 5 or more with no contra.

  • Dormant: a weak candidate with no new evidence for 2 days shrinks to one line, so the file stays short.

Only promoted lessons are applied by the working agents.

Step 5: change instructions only through proposals

A proposal is one JSON file per change: the target file, the exact text to find and its replacement, the evidence, and the size change in bytes. Two rules make this work:

  • Instruction files must not grow unless the proposal explains why. Prefer merging or deleting lines.

  • Rejected stays rejected. The curator checks the rejected log and never proposes the same idea for the same file again.

Once you accept a proposal and it is applied, the lesson moves to an "Applied" list with a pointer to where it now lives.

Takeaways

  • Capture corrections in your own words at the end of every session.

  • Count evidence per run, and merge by meaning and scope.

  • Promote and retire on fixed thresholds.

  • Let a curator propose edits, and approve them yourself.

  • Keep instruction files from growing.

The attached curation-best-practices.md holds the formats and rules on one page. Drop it into your project and ask your agent to set up the loop.

1

Comments