clodfarm
AGENTS.md216 starsChanged 2 months agoMITView on GitHub
Every Claude on the farm reads the farm guide (text in clodfarm/prompts.py): it is written into each Claude's user-level CLAUDE.md (between clodfarm:guide markers), so the conversations you open through Remote Control know the farm, and every sub-agent gets it appended to its system prompt plus a line naming its id, depth and worktree. The guide teaches them to: - Know their budget: clodfarm agents shows how much of every Claude's 5-hour and 7-day usage is used and how many more…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 33,398 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repositoryOne other file it gives its agents.
- site/llms.txtllms.txt
The file
We split this agents.md into the rules it gives an agent
7 rules. About 1 is common, 2 are distinctive, and 4 are very specific to this project.
≈1
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 3
Every Claude on the farm reads the farm guide (text in clodfarm/prompts.py): it is written into each Claude's user-level CLAUDE.md (between …
- Distinctive: line 18
Use Claude Code's Agent tool: only for quick look-ups (it isn't visible on the farm or paced).
- Common: line 28
Stay safe: never touch credentials; no messages outside the farm, payments, account creation or public posts unless the person they work …
- Very specific: line 42
After its next batch of tool calls: every Claude's doorbell in the store is checked every FARM_MAIL_POLL seconds.
- Very specific: line 52
--wake: if nobody has read it after FARM_MAIL_WAKE_AFTER seconds, the farm starts a "mail" sub-agent on that Claude's account (one at a … - Distinctive: line 57
Every message has an id and a reply address (a sub-agent's is its task id), and shows up in the event log.
- Very specific: line 64
Every session a Claude starts on the farm (Remote Control, its conversations, its sub-agents) also loads the farm's mod: a Claude Code …
≈ “Common” is an estimate: at least 1 in 5 of the 43,423 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
What the Claudes know (and how to steer them)
Every Claude on the farm reads the farm guide (text in clodfarm/prompts.py): it is written into each Claude's
user-level CLAUDE.md (between clodfarm:guide markers), so the conversations you open through Remote Control know
the farm, and every sub-agent gets it appended to its system prompt plus a line naming its id, depth and worktree.
The guide teaches them to:
- Know their budget:
clodfarm agentsshows how much of every Claude's 5-hour and 7-day usage is used and how many more sub-agents it can start. The governor paces each account; they don't try to get around limits. - Save budget: a sub-agent without
--onruns on whichever Claude has room, so a Claude that is running low hands big jobs to sub-agents instead of doing them in its conversation. - Start sub-agents you can see:
clodfarm spawn "<title>" --prompt "<self-contained instructions>" [--on NAME], thenclodfarm subagents/clodfarm result <id> [--wait]. In a conversation (the Claude app), a Claude waits for them in the background (clodfarm result <id> --waitwith Bash's run_in_background) and ends its turn, so you can keep talking to it while they work; Claude Code wakes it with the result. Ask it to change or stop a running sub-agent and it relays that at once (clodfarm msg <id>,--urgentto interrupt), as your instruction. Inside a sub-agent, new sub-agents become its children; it ends its run and is resumed in the same session with their results. It never sleeps or polls. - Use Claude Code's Agent tool only for quick look-ups (it isn't visible on the farm or paced).
- Work with the other Claudes: hand off a mission, ask for a review or avoid collisions with a message (see Messages below).
- Schedule work:
clodfarm schedule add "<title>" --prompt "..." --cron "0 9 * * 1-5" --tz <zone>(or--every 2h,--at "in 3h");clodfarm schedule list/remove <id>. - Commit on their branch (sub-agents) and not push or merge. The farm does that.
- End with a plain summary. That is the sub-agent's result.
- Build apps on AWS (only when the optional apps role is on):
aws --profile apps ..., one CloudFormation stack per app, roles named<prefix>-*with the permissions boundary, within the monthly budget (deploy-aws.md). - Stay safe: never touch credentials; no messages outside the farm, payments, account creation or public posts unless the person they work for asks.
Messages
Two ways, and the guide tells the Claudes when to use which:
| Reaches | Delivered | |
Claude Code's SendMessage (find the session with ListAgents) | the live sessions on this box: every Claude's conversations and every sub-agent ([clodfarm] <claude> · <title> · <id>) | at its next tool call; an idle session starts a turn for it |
clodfarm msg <name or sub-agent id> "..." | anyone, on any box, running or not (it waits in the store) | see below |
A clodfarm msg is handed over exactly once, by the first of:
- With the prompt: a sub-agent that isn't running gets it when it next starts.
- After its next batch of tool calls: every Claude's doorbell in the store is checked every
FARM_MAIL_POLLseconds; new mail for its conversations or its running sub-agents sets a flag file, and aPostToolBatchhook hands the mail over (without a flag the hook doesn't even start Python). - Before a turn ends: the
Stophook keeps the turn going with the mail (at most three times in a row). - Waking an idle conversation: a conversation whose last turn ended in the last 10 minutes is woken when mail
arrives: the farm's mod (below) starts a turn with it. Where the mod isn't loaded, an async hook waits after each
turn of a Remote Control conversation (the Claude app, claude.ai/code) and wakes it (Claude Code's
asyncRewake). - At the next prompt, as before.
--urgent(a running sub-agent): sub-agents read stream-json on an open stdin (FARM_LIVE_STDIN), so the farm interrupts it (a running tool is cancelled) and hands the message over as its next turn.--wake: if nobody has read it afterFARM_MAIL_WAKE_AFTERseconds, the farm starts a "mail" sub-agent on that Claude's account (one at a time), or resumes the finished sub-agent it was for, in its own session. A run started by a message counts a hop: afterFARM_MAIL_MAX_HOPShops, orFARM_MAIL_WAKES_PER_HOURwakes per recipient, messages no longer wake anyone, so two Claudes can't keep each other busy.
Every message has an id and a reply address (a sub-agent's is its task id), and shows up in the event log.
SendMessage needs the sessions to see each other: every Claude added in the farm UI lists its sessions in the farm's
own Claude's list (FARM_SHARE_SESSIONS), and each Claude takes messages from them without holding them for approval
(crossSessionInbound: accept, unless you set it). Messages from another Claude are never the person's approval.
The farm's mod
Every session a Claude starts on the farm (Remote Control, its conversations, its sub-agents) also loads the farm's
mod: a Claude Code plugin of function hooks (clodfarm/mod), which the farm puts in each Claude's config dir
(farm-mod) and names in CLAUDE_CODE_PLUGIN_DIRS. It does from inside the session what a shell hook can't do well:
- wakes an idle conversation for its mail (above), with a turn of its own, instead of a process left polling for 10 minutes after every turn, which Claude Code also waited up to 30 s for when the session ended; and it does so for any conversation, not only Remote Control ones;
- gates and logs
SendMessagewhere Claude Code sends it (session.send): every message from the main loop, its own agents and other plugins, not just the tool calls aPreToolUsehook sees. One to a Claude whose person approves everything is turned away (send it withclodfarm msg, which asks them), and only a delivered one goes in the event log; - gives the model a
msgtool (mcp__clodfarm__msg):clodfarm msgwithto,text,urgentandwake, which works even where its person turned Bash off.
A session that loaded it carries FARM_MOD_LIVE=1, and the settings hooks' shell versions of those steps stand down
there; a session without it (an older Claude Code, or FARM_MOD=0) gets them from the shell hooks as before. A
long-lived session reloads the mod when an upgrade brings a new one.
Limits that keep a swarm sane
| Setting | Default | Why |
FARM_MAX_DEPTH | 3 | sub-agent nesting |
FARM_MAX_QUEUE | 25 | sub-agents can't start more once this many are waiting (you and your Claude can) |
FARM_MAX_ATTEMPTS | 3 | per sub-agent, rate-limit retries excluded |
FARM_MAX_RESUMES | 5 | a parent re-runs at most this often for late children |
FARM_TASK_TIMEOUT | 5400 s | one agent run |
FARM_MAIL_MAX_HOPS | 3 | message-triggered runs in a row before messages stop waking anyone |
FARM_MAIL_WAKES_PER_HOUR | 6 | wakes per recipient and hour |
Customising
- Model:
FARM_MODELapplies to every agent, and is each Claude's default model for the sessions you open from the Claude app. An alias (opus) follows the newest model of that family. - Claude Code version: the image ships the newest release (the
latestchannel) and the farm updates it every hour (FARM_CLAUDE_UPDATE, 0 = never). Sub-agents run on a new version at once; each Claude's Remote Control restarts on it once no one has talked to that Claude for 15 minutes. - Tools and MCP servers: anything in the container's Claude Code config (
/home/farm/.claude/settings.json,claude mcp add ...viadocker exec) applies to all agents. - Project rules: a
CLAUDE.mdin your work repo is read by every agent, like in any Claude Code project.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

