Lesson 5 of 7 · Individual agent
The Coder agent
The Coder can be called directly as part of the individual-agent stream, or by the Orchestrator as part of the implementation stage. The Coder takes input from an implementation plan, design specifications from the Designer, or direct user requests. The Coder is the right choice whenever the "what" is already decided and you need the "done".
When to use the Coder
- Direct, well-scoped implementation tasks: adding a function, fixing a bug, applying a known pattern.
- Refactors where the target behaviour and signature are already clear — e.g. swapping an algorithm without changing its contract.
- Following project standards automatically (the Coder discovers them), so output matches the surrounding codebase.
- Working from a structured plan handed down by the Orchestrator, executing phases that touch different files in parallel and phases sharing files in sequence.
- Self-correcting: when a build fails, the Coder gets up to two retries before escalating to a human.
How to use the Coder
- State the desired behaviour change precisely.
- Name the affected files or functions explicitly.
- Point out existing patterns to follow, and anything backward-compatible that must not break.
- List acceptance criteria and any files the Coder should not touch.
- Expect back: a summary of what changed, files touched, build status, any deviations from plan, and handoff notes for the Unit Tester.
"In src/utils/sortOrder.ts, replace the bubble sort implementation in the sortOrder function with an insertion sort. Keep the same function signature and return type. The existing tests in tests/sortOrder.test.ts should still pass."
Where the Coder fits in the Orchestrator: the Coder runs as Stage 3. The Coder receives the Planner's steps and file assignments, plus the Designer's spec if UI work is involved. If the build fails, the Coder gets up to two retries before the Orchestrator escalates to you.
Things to avoid
- Using the Coder when the task is too vague or broad — run the Planner first if you're unsure how something should be done.
- Asking the Coder for design specifications or architectural decisions; the Coder implements, the Coder does not plan.
- Diving in on UI work with no design in mind — run the Designer first to produce a spec.
Test your knowledge
"Replace bubble sort with insertion sort in sortOrder(), same signature, keep tests passing." Which agent handles this directly?
Source: documentation.md, "Coder Agent".