Claude Code has a mode called ultracode. You put the word in a prompt and the prompt stops being a conversation and becomes a workflow: the task gets split into pieces, a fleet of agents works the pieces in parallel, skeptics try to refute what came back, and one final pass folds it all into an answer. It is the most useful thing that CLI does at scale. It is also one vendor's.
moshcode's herd has been the same idea with the vendor removed for a while now. Sessions outlive your terminal. herd prompt --wait hands an agent work and blocks until it lands. The task ledger keeps what every session did. And moshscript could already wire a fan-out by hand: start three sessions, prompt three sessions, wait on all three. Nobody did, because it was a script to write every time, and the two parts that make a swarm worth running were the parts the script did not give you: splitting the task so the agents do not collide, and folding what they did back into one answer.
moshcode 0.98.0 ships the verb.
moshcode swarm
moshcode swarm "port the auth routes and the dashboard to the new API"
Four phases, and you see each one. One headless call to your engine splits the task into at most --agents pieces that do not touch the same files. Each piece gets its own herd session, four at a time by default, which is the same cap the claude engine's settings defaults put on Claude's own workflows, so a swarm cannot eat the box the rest of the herd is running on. Each session is prompted and waited on exactly the way herd prompt --wait is, so every piece is a task in the ledger and moshcode herd task <id> shows you afterwards what that agent did. Then one more call folds the outputs into the answer you read.
--verify adds a skeptic per piece, prompted to refute it and to default to refuted when unsure. Its verdict goes to the synthesis and never drops a piece on its own. --plan-only shows the split and starts nothing. --keep leaves the sessions in moshcode ps for you to attach to. --json gives you the whole run as data. It works from the CLI, from the pit as /swarm, and from moshscript as swarm(...).
It degrades rather than fails. A plan that does not parse runs the task as one piece. A piece whose session never became ready is reported as failed and the synthesis says so. A synthesis that fails still leaves every piece in the ledger.
Any engine moshcode can start can be the swarm. Whatever ai() can run headlessly can plan and synthesise. Whatever herd start can run can be a member.
What the herd learned about Claude Code 2.1
Getting a swarm to run end to end against Claude Code 2.1.270 turned up four things no unit test could see, because they are all about what the real engine paints on a terminal. All four are fixed in this release, and if your roster has ever shown a Claude session as gone or unknown while it was plainly sitting there, one of them is why.
Claude sets its own terminal title the moment it is up. The herd used the pane title as a member's handle, so the member fell out of the index and read as gone. The title is now pinned at start on tmux 3.5 or newer; an older tmux keeps the old behaviour rather than failing to start.
A detached tmux session is 80 columns wide unless told otherwise, and Claude's status line truncates at 80. The idle rule was reading "? for shortc" and finding nothing. Sessions now start at 200 by 50; a client that attaches resizes as before.
Claude 2.1 with permissions bypassed does not print "? for shortcuts" at all any more. Its footer says "bypass permissions on (shift+tab to cycle)" and an empty composer shows a placeholder. Both are idle now. The workspace trust dialog is blocked, and the claude engine carries a boot spec that answers it with Down then Enter, because its default answer is "No, exit" and a reflexive Enter ends the engine.
A long prompt typed into a session by tmux arrives as a paste, and the Enter on its heels lands inside the paste as one more line. The screen shows "[Pasted text #1 +1 lines]" and nothing is ever submitted. herd prompt now settles for a quarter of a second before pressing Enter.
Getting it
moshcode upgrade
moshcode swarm "audit src/ for unhandled promise rejections" --agents 8 --verify
Release notes: https://github.com/moshcoder/moshcode/releases/tag/v0.98.0
Top comments (0)