Skip to content

Legion

Legion is a team of coding agents that works the issues you hand it. You write an issue in Dispatch, label it legion and set it to todo. When a slot is free, the Legion daemon admits it and starts an architect, an agent that owns the issue from start to finish. The architect turns your issue into a spec and asks you the questions only you can answer. Once you approve the spec, the daemon runs phase workers one after another: a planner, an implementer that writes the change and opens a pull request, a tester, a reviewer and a merger. Each agent is an Oh My Pi session in a Kubernetes pod of its own.

When the change is tested, reviewed and approved, the merger posts READY on the Dispatch issue and submits the pull request for merge under the repository’s own branch protection. The implementer then drives the merged change in production and records what it saw, and only then does the architect close the issue. Every step leaves a record you can read: the spec and the questions in Dispatch, the code and the reviews on GitHub, and each phase’s handoff on the issue’s branch.

flowchart LR
  issue["Dispatch issue<br/>labelled legion, in todo"] --> admission["Admission<br/>a free slot"]
  admission --> architect["Architect<br/>writes the spec"]
  architect --> gate{"You approve<br/>the spec"}
  gate --> planner
  subgraph pods["Phase workers, one Kubernetes pod each"]
    planner --> implementer
    implementer --> tester
    tester --> reviewer
    reviewer --> retro["retro<br/>(the implementer)"]
    retro --> merger
    tester -. fails .-> implementer
    reviewer -. changes requested .-> implementer
  end
  merger --> ready["READY on<br/>the issue"]
  ready --> merge["The daemon submits the merge;<br/>the repository's rules land it"]
  merge --> production["Production check<br/>(the implementer)"]
  production --> done["The architect<br/>closes the issue"]
  • Concepts: the controller, the architect, the phase workers, admission, the design gate, handoffs, review and the production check, and how they fit together.
  • Using Legion: hand an issue to Legion, approve its spec, review and merge its pull request, and read what each Dispatch status means.
  • Running Legion: what an operator needs to run the Legion daemon on Kubernetes, how to configure, start, upgrade and watch it.
  • Troubleshooting: the failures Legion reports, and the command that shows each one.
  • Walkthrough: an issue going through Legion, end to end.
  • Reference: the CLI, the configuration examples and the skills Legion’s agents load, all generated from the code when the site is built.

Legion’s agents ask for credentials through the Secrets Broker when a deployment enrolls them, and everything a person sees of Legion happens in Dispatch. How it fits together shows Legion, Dispatch and the Secrets Broker side by side.