Workflows

A workflow is one self-contained file, .laight/workflows/<id>.yaml. It declares the agents (seats) and the steps, and laight only executes it: if behaviour can't be read from the workflow file, it's a bug in laight. A JSON Schema gives your editor completion and validation.

A complete example

version: 1
id: issue-cycle
summary: One issue, implemented and independently reviewed, merged into {{ .base }}.
base: dev
inputs:
  issue:
    {
      required: false,
      description: Issue number; empty = the next one in the backlog,
    }

seats:
  impl:
    runtime: claude-code # claude-code | codex | shell
    cwd: worktree # worktree (default) | repo | <path>
    session: resume # resume | fresh
    permissions: auto # default | auto | yolo
    guidance: guidance/implementer.md
  reviewer:
    uses: seats/reviewer.yaml # a shared seat definition
    session: fresh

steps:
  - id: implement
    seat: impl
    objective: |
      Implement issue {{ .inputs.issue }}, open a PR into {{ .base }}.
      Finish with: laight done handoff pr=<PR URL> issue=<N>
    next_hop: { on: { handoff: review } }
  - id: review
    seat: reviewer
    objective: Review {{ .steps.implement.out.pr }}.
    next_hop: { on: { handoff: fix } }
  - id: fix
    seat: impl
    objective: Address every review finding; push.
    next_hop: { on: { handoff: verify } }
  - id: verify
    seat: reviewer
    objective: All resolved → laight done pass. Otherwise → laight done fail.
    allowed_exits: [pass, fail]
    next_hop: { on: { pass: approve, fail: fix } }
  - id: approve
    type: gate
    ask: Merge {{ .steps.implement.out.pr }} into {{ .base }}?
    allowed_exits: [yes, no]
    next_hop: { on: { yes: merge, no: end } }
  - id: merge
    type: shell
    run: gh pr merge {{ .steps.implement.out.pr }} --squash

loop_guards: { max_hops: 11 }
timeouts: { step: 90m }
on_finish: { success: destroy, failure: keep }

Seats

A seat is one agent CLI session in one tmux window: its runtime, its working folder (cwd), its guidance file, its permissions mode and optionally a model and env. session: fresh restarts the agent before each step; resume keeps the conversation.

Steps

  • Agent steps (the default when seat is set) paste the objective into the seat. The agent finishes with laight done <exit> key=value…; the values become .steps.<id>.out.<key>.
  • Shell steps (type: shell) run a command with no agent: exit 0 is ok, anything else is failed.
  • Gates (type: gate) ask a human through the inbox and route on the answer.

allowed_exits defaults to [handoff]; failed is always possible and can be routed. next_hop.on maps each exit to the next step, which gives you series, branches and loops. loop_guards.max_hops stops a loop that never converges.

Series and parallel

steps:
  - id: plan
    seat: lead
    objective: Split the epic into independent tasks. laight done ok tasks='["a","b","c"]'
  - id: build
    needs: [plan]
    matrix: { task: "{{ .steps.plan.out.tasks }}" } # one copy per task, each with its own agent
    seat: dev
    objective: Implement {{ .matrix.task }} and open a PR.
  - id: integrate
    needs: [build] # waits for every copy of build
    seat: lead
    objective: Merge the PRs in order and run the full test suite.

A step with needs starts when every needed step has finished. A matrix runs one copy per value, each with its own seat instance, worktree and window, up to max_parallel (default 4) at a time.

Next: The inbox.