Both the kid and the teacher: a few tricks for letting an AI agent grow up on its own
AI starts from zero in every new conversation, so the same pitfall can be hit a second and third time. My approach is to have it play two roles in each round: the kid who makes mistakes and learns something in that round, and the teacher who writes the teaching material for the next round. The point is not to remember more, but to write things where they will be read at the moment the problem comes up again.
After using agent-style AI for a while, you are bound to run into this: last week it spent half an hour working out an environment problem, and this week, in a new conversation, it spends another half hour from scratch. It is not that it is dumb; it loses its memory every time a new conversation starts. What it learned in the last round lives only inside that round’s conversation.
So I had it play two roles in every round:
- The kid: in this round it makes mistakes, takes detours, and comes up with workarounds on the spot. Mistakes are fine, but they must be written down.
- The teacher: it turns what this round learned into teaching material that the next round’s version of itself will read.
This post covers what each of these two roles should do. The core comes down to one sentence: where a lesson is written matters more than what is written.
The kid: at the end of each round, record three kinds of things
Every time I wrap up (the wrap-up procedure is described in “Does your AI agent really finish the job?”), I require it to write three fixed kinds of things into the handoff record:
- Problems encountered, and how they were solved. One line each: “problem → fix.” For example, “Printing Chinese in Python errors out on Chinese Windows → specify UTF-8 when running.”
- Improvised approaches. Any small script, string of search commands, or manual inventory written on the spot in this round gets a verdict: keep as is (one-off), speed up (write down exactly how to speed it up), or upgrade to a shared tool.
- Flaws in the tools themselves. Where a tool, rule, or skill used did not work well or broke, write it down, even if this round worked around it.
One small rule matters a lot too: if nothing came up, still write “none.” That way, a missing entry always means something was missed, not “maybe nothing happened.”
“The problem is already solved, no need to record it” is the excuse heard most often. Solving it in this round does not mean the next round knows about it.
The teacher: a lesson has only one home
Writing it down is only the first step. The hard part is this: where should it be written so the next round actually reads it at the moment it is needed?
The pitfall I fell into: I put the rules into the master instruction file that the AI reads at the start of every session, thinking that was the safest. The result: the same mistake recurred for a whole month. The reason: when it is read at the start, the rule is abstract; by the time the actual work happens, the rule has long since left its attention.
So now I decide where a lesson goes based on when the mistake happens:
| When the mistake happens… | Where the lesson goes… | Why |
|---|---|---|
| Can happen every time a certain command runs | An automatic check that blocks it right before the command runs | Does not depend on remembering; the system blocks it |
| Only when touching a certain kind of file | A rule that follows that kind of file and loads when it is touched | The rule appears at the moment the mistake would happen |
| When a certain kind of task needs a judgment | One conditional sentence in the master instruction file: “When doing X, read Y first” | It is only recalled when that kind of task comes up |
| A one-off bit of environment know-how | The lesson log entry itself, searched when needed | Rarely used, not worth taking up space at the start |
Two more rules:
- The same lesson is not written in two places. If it is written twice and one copy is changed, the other becomes an outdated, wrong instruction. The second place holds only a pointer: “see where it is kept for details.”
- The lesson log needs an index. One line per lesson, with a number, like a database key. When a problem comes up, first check the index to see whether someone has already hit it, then decide whether to add a new entry.
Verification: did the teaching work?
Writing a lesson down does not mean it has been taught. My verification method is to record recurrences: when the same pitfall shows up again, write an entry and mark whether the lesson held this time.
- Held: the lesson was read before the mistake happened, and the AI followed it. The teaching worked.
- Did not hold: the lesson existed, but this round did not read it, or read it and did not follow it. This is not the AI being disobedient; it means the lesson was put in the wrong place, and it should move to a spot whose trigger timing is closer to the moment the mistake happens (move one row up in the table above).
That way, “writing the lesson did no good” stops being a feeling and becomes something you can count.
Handoff record: ten lines for the next shift
At the end of each round, write a handoff record with fixed fields, ten lines or fewer: what was done, what decisions I made, problems encountered, improvised approaches, and the next step.
- The “next step” in the latest entry is the project’s current next step. There is no separate to-do list to maintain, so two to-do lists will never fight each other.
- When opening a new conversation, read the handoff record first, instead of rereading the whole previous conversation. Ten lines are enough to pick up the thread, which is far cheaper than letting it grope its way again.
- The handoff record is an append-only log: entries are added, never edited or deleted, so how things reached today can always be traced back.
Periodic review: turn what recurs into skills
A practice marked “keep as is” three times in handoff records is probably not one-off. Every so often I look back over them:
- Procedures that keep recurring get organized into a skill, and the master instruction file holds only a one-line index pointing to it.
- Lessons that keep recurring get checked for whether they should move (see Verification above).
- Lessons already caught by an automatic check are marked “absorbed,” so they no longer take up attention at the start.
The kid remembers, the teacher writes, and the review sorts things out: when these three turn together, the agent takes fewer detours with every round.
Example: how a pitfall goes from “hit it again” to “won’t hit it again”
Let’s walk through a very common case: on Chinese Windows, a small Python tool the AI wrote errors out as soon as it prints Chinese.
- Round one (the kid): it spent a while before realizing it was an encoding problem, and fixed it. The handoff record gets one line: “Printing Chinese errors out → specify UTF-8 when running.”
- Round one (the teacher): written up as a lesson and put into the lesson log.
- Round three: it wrote another new tool, and it errored again. Record an entry: “recurred, did not hold.” The lesson existed, but nobody checked it when the new tool was written.
- Move: this mistake happens when “writing a certain kind of file,” so it becomes a rule that follows the Python tool files: when writing this kind of file, the tests must include a non-UTF-8 environment.
- Afterwards: every time it writes this kind of tool, it reads that rule. If the mistake shows up again, record “recurred, held,” and then the lesson counts as taught.
Design lesson: start from the smallest version
- Add only the handoff record first. Each round ends with five fields: what was done, decisions, problems and fixes, improvised approaches, and the next step. First get it used to writing “none” when there is nothing to report.
- Open a lesson log. One entry per number, one line of title each, kept in a fixed folder. The master instruction file gets one sentence: “When you hit an error, search the lesson log first.”
- Start recording recurrences. When the same pitfall shows up a second time, note whether the lesson held.
- Move only the lessons that fail. Do not set up automatic checks for every lesson from the start. Wait until it proves that keeping the lesson in the log does no good, and only then move it closer to the trigger moment.
- Review every so often. Turn recurring practices into skills, and mark lessons already absorbed by automatic checks as “absorbed.”
Prompt: have your AI help you design this feedback loop
Paste the text below to your agent, and replace the words in angle brackets < > with your own situation.
I want you to leave behind, in every round of work, something the next round can use: in this round you are the kid who makes mistakes, and also the teacher who writes the teaching material for the next round.
The tools I use are: <Claude Code / Codex / other>; the instruction file is at: <where CLAUDE.md / AGENTS.md is>.
Please help me design a minimal workable feedback loop, in this order:
1. Handoff record format: written at the end of each round, 10 lines or fewer, with fixed fields: what was done, decisions (state whether I made the decision or you did), problems encountered → fixes, improvised approaches (each with a verdict: keep as is / speed up / upgrade to a shared tool), next step. A field with no content is written as “none”; fields may not be left out.
2. Lesson log: one entry per file or per row, with a number, a one-line title, the situation in which it occurred, the fix, and where it takes effect; plus an index with one line per entry.
3. Placement rules: decide where a lesson goes based on “when the mistake happens” (each time a certain command runs / when touching a certain kind of file / when doing a certain kind of task / a one-off bit of small know-how), and explain how each of these is actually done with my tools.
4. Recurrence record: when the same lesson shows up again, record an entry marked “held” or “did not hold”; for those marked “did not hold,” propose where to move them.
5. Review checklist: how often to do it, what to look at, and under what conditions to upgrade a practice into a skill.
Rules: each lesson is written in only one place; everywhere else holds only a one-sentence pointer to it.
First give me a draft and the list of files to add; do not change my instruction file directly.Related:Does your AI agent really finish the job?, Getting AI to find things again: Markdown files and folders as the core of memory, Routing layer: what AI reads at the start, and what it reads only when it hits something, From a seed: my AI assistant Qizhe, and a starter seed kit for newcomers to agents
← Previous:Does your AI agent really finish the job?
Next:Our own numbers, not the audience's numbers →
Email subscriptions will open later. For now, you can follow new articles and work with RSS.