An AI agent writes its own rules. Each one has to prove itself first.
Opinions expressed by Digital Journal contributors are their own.
People who work closely with AI agents usually keep a file of standing instructions for them: a rulebook the AI reads before it starts work. Users of Anthropic’s Claude Code call theirs CLAUDE.md; other tools use a similar file called AGENTS.md. When the AI repeats a mistake, the standard advice, including Anthropic’s own, is to add a line to the file.
So the rulebooks grow. A line goes in after each mistake, and few are ever checked to see whether they helped.
Research published this year suggests the habit does little good. Anthropic’s documentation advises keeping each file under 200 lines, warning that longer files are followed less reliably. A study from ETH Zurich, whose final version was posted on September 29, found that these files did not generally make AI coding assistants more successful at their tasks and made them more than 20% more expensive to run, even though the assistants did follow the instructions. In June, researchers at Microsoft Research wrote that a revision to an AI’s instructions that looks perfectly reasonable can quietly make it perform worse.
Ji “Franco” Lu runs the same kind of rulebook under a stricter rule: nothing gets written as a rule until it has proved itself.
Lu is a software engineer at Amazon Web Services who builds the connections that let AI agents work with other software. Lu independently developed an AI agent that trades on open stock exchanges. The agent is a piece of software that uses an AI model to decide, during market hours, what to buy, what to sell, and when to get out.
The trading agent’s rulebook is a file Lu calls the agent’s “diary,” which the agent reads before every session. What makes the diary unusual is who writes it: the agent proposes its own rules, based on its own trading record, and each proposal has to pass a performance test before Lu adds it to the file.
“The agent can suggest any rule it wants, but a rule only gets added if the numbers show it helps,” Lu says.
Telling a mistake from bad luck
The system’s first safeguard is a nightly review that starts with the agent’s behavior rather than its profits. Every trade gets checked against a short list of lapses. Did it stick to the plan it set for when to sell? Did it trade too often? Did it hold a stock through a scheduled event, such as an earnings report, that it should have avoided? Only after those checks does the review look at whether the trade made or lost money. A trade that lost money but followed every rule is written down as bad luck, and it produces no new rule.
Checking behavior before profit matters because a trade can follow every rule and still lose money. Rewriting the rules after each loss teaches the agent to react to bad luck, while a real mistake left alone will corrode the portfolio over time.
When the review does spot a real pattern, the agent drafts a rule, and the rule goes on trial. A copy of the agent runs the new rule with pretend money, replaying 20 past trading days the agent has never seen, so it can’t simply have memorized them. To pass, the rule has to improve one chosen measure, such as how often the agent’s trades turn out right, without making the others worse: how deep its worst run of losses gets, and how much money it leaks by buying or selling at bad moments.
Several of the rules now in the diary started as the agent’s own proposals. The clearest example is a rule against trading in the first fifteen minutes after the market opens. Over three weeks in July, the agent lost money on six early-morning trades, and the nightly review traced every one to the same cause: prices swing hardest right after the open, and the agent kept buying into moves that reversed within minutes. It proposed waiting 45 minutes before placing any trade. On the 20 replayed days, the rule cost the agent two profitable early trades but removed eleven losing ones, and its worst run of losses shrank by about a third.
Keeping the failures, too
One rejected proposal shows what the trial catches. After a run of trades that were sold at a small loss and then recovered, the agent proposed giving positions more room before selling, so brief dips wouldn’t push it out. On the 20 replayed days, the rule worked as intended: fewer trades ended in small losses, and the agent was right more often. But when a stock kept falling instead of recovering, the agent now held on longer and lost more before it sold, and its worst losing streak roughly doubled.
The idea now sits in a second notebook of failed proposals, next to the reason it failed, and the agent reads that notebook before every session too. If a later review reaches for the same idea, it can see that it has already been tried.
Accepted rules aren’t permanent either. Every entry in the diary records a situation, an action, how much evidence supports it, when it was last checked, and whether it’s live, on probation, or retired. Rules are retested every 5 sessions and can lose their place. The diary has shrunk as a result, from roughly 30 rules to ~20 over 2 months, which Lu regards as the clearest sign the process is working.
Researchers in the AI space have been converging on the same instincts. Microsoft’s SkillOpt method, described in June, also limits how much can change at once, accepts an edit only if it scores better on examples set aside for testing, and keeps rejected edits so the system learns from them.
Lu is open about the method’s drawbacks. A trial with pretend money only shows how a rule would have behaved on past days, he says, and live trading can differ. The replayed days also lose their value with reuse: the more proposals are tested against the same 20 days, the likelier one passes by luck. His answer to both is to keep testing after a rule is accepted, and to swap in new trading days as they accumulate, so no rule is ever judged on the same days twice.
Who approves the next change
Passing a trial doesn’t let the agent rewrite its own diary. Lu reviews each proposed rule himself, the way an editor reviews tracked changes in a document, and allows no more than 2 new rules a week so he can see what each one does on its own.
The same test-and-measure approach decides how much money the agent is allowed to trade. The agent’s trading limit is tied to what Lu calls a failure allowance: a failure is any trade that breaks one of the diary’s rules, and the agent is allowed no more than three in any 20-session stretch. When the agent stays within the allowance, Lu raises the amount it is allowed to trade. When it exceeds the allowance, he lowers it. In August, after a week with four rule breaks, the limit was cut in half; the agent earned it back a month later.
Lu says the point was never to make the agent a better predictor of markets. “The agent simply got more accountable. I can now trace every rule back to the trades that justified it.”
An AI agent writes its own rules. Each one has to prove itself first.
#agent #writes #rules #prove