Karpathy’s AI ran itself for two days and got better on its own. The secret was four guardrails, not more freedom. Here is the copy-paste template to add them to any agent.
Andrej Karpathy, a founding member of OpenAI, let an AI agent run on its own for two days. It ran about 700 experiments on his model training code and found 20 changes that made training faster. When he applied those changes to a bigger model, training time dropped 11%.
Everyone focused on the freedom. The real story is the guardrails in his autoresearch setup that made walking away safe. I turned them into a template you can paste into any agent or skill you build in Claude or Claude Code.
01
It can score its own work
Every run was measured on one number against the current best. Better stayed, worse got thrown out. If your AI can’t tell a good result from a bad one, it can’t run alone.
02
Every change is reversible
Each try was saved as a git commit. If it didn’t beat the best score, the agent reset back to where it started. A bad idea never broke anything. Give your agent a way back.
03
It moves in small, timed steps
One change, one 5-minute test run, then a decision. Any run that went past 10 minutes got killed and counted as a failure. Small steps beat one giant prompt trying to fix everything at once.
04
It stays inside strict boundaries
The agent could edit exactly one file. Everything else was off-limits. A small blast radius is what makes autonomy safe.
Paste this at the top of any agent or skill instructions, then fill in the brackets. It turns all four guardrails into a loop your AI follows, so you can step away and trust what you come back to.
Where to put it. In Claude Code, paste it into the top of a subagent file (.claude/agents/<name>.md) or a skill’s SKILL.md. In the Claude app, paste it into a Project’s instructions.
The hardest bracket is the success metric. This prompt interviews you until every bracket is filled and the metric is something a machine can check.
The Real Win
The future is giving AI better guardrails, not more freedom. Tighter rails, longer leash.
Want the build side? Here is how I build AI agents, and the commands that let Claude finish a whole job on its own in Stop Babysitting Claude.