Why I built it
I built a multi-agent program with Claude Code that plans, logs, and reviews swim training. It began as ordinary chats about how to structure a session, but each one worked only once: the next chat had lost the times, the limiters, and everything done the week before.
So the coaching moved somewhere permanent. The whole training history lives in plain-text files, and a group of specialised agents reads and reasons over them, each handling one part of the job. The entire thing runs from the terminal.
How it works
The system runs from four commands. The two that carry a session, /plan and /log, are below; each spins up a fresh set of agents that reason over the plain-text memory.
Before the swim
When /plan runs, the pipeline kicks off. Each agent does one job and hands its result to the next, looping between the Coach and the Critic until the set passes. Click any stage to read it.
Sets the factual ground truth and nothing more: recent load, which set shapes are due to change, how long since the flip turn was last drilled, and any real gaps in the data. It never gives an opinion, so none leaks into the agents downstream.
Reads recent load and how well it has been recovered, then sets the day's target: the energy system to train, the zone, the work-to-rest structure, and a ceiling on volume. It steers load and recovery rather than policing a fixed easy-to-hard ratio, and leaves the shape of the set to the Coach.
Writes the actual set within those constraints, in the shorthand read off the wall, shaped to differ from recent sessions. When the data contradicts the request, it overrides and says so in plain words.
Independently reviews the set against the brief and the log, hunting specific faults: intervals too soft to train anything, skill work after a hard effort, totals that fail to add up, a pool rule broken. It approves, or sends back the exact fix.
The Critic reviews the set once. If it catches a real problem, the set returns to the Coach with that single fix and is checked again before it ships.
After the swim
Afterwards, /log takes whatever was remembered of the session, usually a lot of detail. The Logger is the only agent that writes: it saves the raw record first, then refreshes every view built from it.
Reads the messy dump, writes the new session line to the raw log untouched, then rebuilds every view from it: capacity now, the profile, records, phase, and the human glance table. It is the only agent allowed to write, so the memory only ever changes in one place.
The commands
Four commands run the whole loop, from the first /setup through every weekly /review.
/setup interviews a new swimmer in groups: their pool and units, strokes, schedule, goals, the one skill they most want to improve, and any benchmarks. It parses old logs into the schema and writes every memory file. The system is a template, so anyone can run it and get a coach built around their own numbers.
> /setup 25m pool, sprint background, want to fix my flip turns ... # pool, strokes, schedule, goals, the one skill # prior logs parsed into the schema memory/ written: profile, current_state, prs, phase, logs
Given the time, the pool, and a rough ask, /plan turns that into a set through the four agents. It overrides the request when the data disagrees, and returns a readable set plus the deck cheatsheet.
> /plan 60 min, 25m. solid kick + pull, integrate flip turns ... SESSION · dd/mm/yyyy · 1,150 m · ~60 min Today's focus: groove the flip fresh, then steady aerobic. # lighter on purpose, load's high and recovery's short ...
/log takes a messy, detailed dump of the session. The Logger writes the raw line first, refreshes the views, moves any record that fell, and separates what the clock proved from what it only suggests.
> /log 3x50 pull 52/55/57, 3rd held; flip sloppy tired ... Logged: session 5, all five files. pull 3x50 <:57 met, standard advances to 4x50. flip drill ~45%, climbing toward the >50% gate.
/review sends the Historian and Physiologist over the whole block: total volume, the easy-to-hard balance, how the skill is trending, and whether the training phase should change. It states conclusions as conclusions and reads as reads.
> /review last 6 sessions, ready to move to a build phase? ... 6 sessions · 6,275 m · ~1,046 m avg. flip turn 17% → 90% clean fresh, a real trend. load steady, well recovered between hard days; spacing fine. hold base-build one more session to confirm the flip.
Results
Run across seven sessions of real training, the data tells the system's clearest story through its one skill project: the freestyle flip turn. Fresh, the clean rate has climbed from about one turn in six to nearly every turn, the timing clicking into place around the fifth session; tired, it still has ground to make up.
Fresh, the turn is reliable now. Tired, it drops to around half, and closing that gap is the next thing the system is chasing.
Across the block I have learned to nail the timing, and fresh I am consistent at it now.
Tired clean rate was tracked closely from session 5, once the turn was reliable fresh; the earlier tired points are estimated from the logs.
The build
Every piece is plain text: the five agents, the four commands, the memory, and the spec that ties the rules together. Running /setup interviews a new swimmer, ingests any old logs, and builds the same coach around their own history.
borjadelamora / ai-swim-coach Public A multi-agent swim-coaching system built on Claude Code: five agents, four commands, a plain-text memory. Markdown JSON View repository →