saaiov0.3.1

Reference

The JSON contract

#Introduction

Agents read saaio's TOON, but a program wants something it can parse and rely on. For a status bar, a dashboard or a script of your own, saaio status --json prints the whole board as JSON: every flow, nothing truncated, with camelCase keys and version first.

saaio status --json          # this project's flows
saaio status --all --json    # every project's flows
saaio status shop-217 --json # a board with just that flow

Important

The command line and this JSON are saaio's only public interface. The log files are private and may change, so read the JSON, never the logs.

#The board

saaio status --json prints one board, with its flows:

{
  "version": 4,
  "now": 1792214602016,
  "count": 2,
  "needsYou": 1,
  "flows": [
    {
      "id": "e514f1de-604d-4dbc-9b88-2cd76333d0a4",
      "name": "shop-217",
      "request": "SHOP-217 add CSV export",
      "mode": "guided",
      "kind": "feature",
      "merges": true,
      "phase": "implement",
      "state": "blocked",
      "blocker": "Task 5: the migration needs a default value",
      "delegate": null,
      "tasks": { "done": 4, "total": 9 },
      "review": null,
      "mergeRequest": null,
      "merged": false,
      "decisions": ["approach B: one exporter per format"],
      "steps": [
        { "phase": "plan", "status": "done", "durationMs": 5052 },
        { "phase": "implement", "status": "current", "durationMs": 22132 },
        { "phase": "review", "status": "open", "durationMs": null },
        { "phase": "merge-request", "status": "open", "durationMs": null }
      ],
      "timeline": [
        { "at": 1792214574703, "text": "started", "tone": "neutral" },
        { "at": 1792214574832, "text": "phase: plan", "tone": "progress" },
        { "at": 1792214577856, "text": "decided: approach B: one exporter per format", "tone": "neutral" },
        { "at": 1792214579884, "text": "phase: implement", "tone": "progress" },
        { "at": 1792214583915, "text": "blocked: Task 5: the migration needs a default value", "tone": "problem" }
      ],
      "startedAt": 1792214574703,
      "changedAt": 1792214583915,
      "workspace": {
        "path": "/Users/jan/projects/shop/.saaio/worktrees/shop-217",
        "branch": "flow/shop-217",
        "slot": 1,
        "window": null,
        "agent": "claude",
        "base": null
      },
      "answer": null,
      "session": null,
      "questions": [],
      "permission": false,
      "services": null,
      "turn": null,
      "setup": null
    },
    {
      "id": "5418e55e-581e-4117-a46c-0824b8e475d9",
      "name": "scratch",
      "request": "",
      "mode": "plain",
      "kind": null,
      "merges": true,
      "phase": null,
      "state": "idle",
      "blocker": null,
      "delegate": null,
      "tasks": null,
      "review": null,
      "mergeRequest": null,
      "merged": false,
      "decisions": [],
      "steps": [],
      "timeline": [{ "at": 1792214574828, "text": "started", "tone": "neutral" }],
      "startedAt": 1792214574828,
      "changedAt": 1792214574828,
      "workspace": {
        "path": "/Users/jan/projects/scratch",
        "branch": null,
        "slot": null,
        "window": null,
        "agent": "claude",
        "base": null
      },
      "answer": null,
      "session": null,
      "questions": [],
      "permission": false,
      "services": null,
      "turn": null,
      "setup": null
    }
  ]
}

The board's own keys:

KeyTypeHolds
versionnumberthe contract's version, 4 today
nownumberwhen the board was made, in Unix milliseconds
countnumberhow many flows there are
needsYounumberhow many are waiting, blocked or not-responding
flowsarraythe flows, sorted: needs you, ready (idle), running, finished. The most recent change first within each group

All times are Unix milliseconds.

#A flow

Each entry of flows holds everything saaio knows about one flow:

KeyTypeHolds
idstringthe flow's id, a UUID
namestringthe flow's name
requeststringwhat was asked for. Empty for a plain session
modestringguided, auto or plain
kindstring or nullthe flow's kind: feature, fix, research or one of the config's. Null for a plain session and a flow from before kinds
mergesbooleanfalse for a kind without a branch, such as research: nothing to merge, done once it answered
phasestring or nullthe phase it is in. Null before its first phase and for a plain session
statestringsee States
blockerstring or nullthe question of a waiting flow, or the reason of a blocked one
delegatestring or nullwhat a subagent works on while the flow is delegated
tasksobject or null{ "done", "total" }, the plan's tasks
reviewobject or null{ "fixed", "open" }, the review's findings
mergeRequeststring or nullthe merge request's URL
mergedbooleanthe merge request was merged
decisionsarray of stringsdecisions made on your behalf, oldest first
stepsarrayone per phase of the flow's workflow. Empty for a plain session. See Steps.
timelinearraywhat happened, oldest first. See Timeline.
startedAtnumberwhen the flow started
changedAtnumberwhen its state, phase, blocker or idle note last changed, or its merge request closed
workspaceobject or nullwhere its worker runs. Null for a flow made with saaio new. See Workspace.
answerstring or nullthe worker's last turn's closing message, as its harness reported it, up to 4000 characters
sessionobject or null{ "id", "transcript" }: the session id the harness picked and the path of its transcript (transcript may be null). Set for Codex, which picks its own id. Null for Claude Code, which uses the flow's.
questionsarraythe questions of the dialog a waiting flow shows. Empty when it waits on none. See Questions.
permissionbooleanthe flow is waiting on a permission prompt in its pane; blocker names the tool call. A Codex request counts once it is waiting, three seconds in.
servicesobject or nullwhere the flow's services stand. Null until saaio first pauses them. See Services.
turnobject or nulla heavy command of the flow that waits for another worker's run. Null when none waits. See Turn.
setupobject or nullthe last run of the repo's .saaio/setup for the flow. Null when the repository has none. See Setup.

#States

state is one of:

StateMeans
workingthe worker is at work
delegateda subagent works on the flow
waitingthe worker asks you something (blocker holds the question)
idlethe worker's turn ended without a question
blockedthe flow cannot go on (blocker holds the reason)
not-respondingthe worker sent heartbeats and stopped for 90 seconds
donethe merge request is open or merged, or a flow that merges nothing answered
endedthe worker's session ended for good

waiting, blocked and not-responding count as needing you.

#Steps

Each entry of steps is one phase of the flow's workflow, in order:

KeyTypeHolds
phasestringthe phase's name, as the flow's workflow names it
statusstringdone, current, open or stale: done before, but the flow went back to an earlier phase since (Going back to implement)
durationMsnumber or nullthe time spent in the phase. The current phase counts up to now, or up to when the merge request opened or the flow ended; a phase skill after that runs its clock again. Null for a phase not reached

Once a merge request merged, or opened while the flow stands at its last phase, every step is done, and a phase skipped on the way has durationMs null. A flow keeps the phases it started with, so two flows can have different steps.

#Timeline

Each entry of timeline is one thing that happened, oldest first:

KeyTypeHolds
atnumberwhen it happened
textstringwhat happened: started, phase: plan, phase: implement (back), waiting: ..., answered, idle: ..., blocked: ..., decided: ..., review: 3 fixed, 1 open, MR opened, PR #42 merged (MR !88 merged on GitLab), PR #42 closed, master: ... (a message from the master), master typed: ... (a line typed into its pane), pause failed: ..., resume failed: ..., setup failed: ... (while its worker was working), setup passed, ended
tonestringneutral, progress, attention, problem or success

#Questions

When a Claude Code worker asks with a question dialog (AskUserQuestion), questions holds one entry per question, and blocker holds the first question:

KeyTypeHolds
headerstringthe question's short label
questionstringthe question
optionsarray{ "label", "description" } per option, in the dialog's order
multiSelectbooleanseveral options may be picked

#Services

services tells you where the repo's .saaio/pause and .saaio/resume left the flow's services (Pause and resume):

KeyTypeHolds
statusstringpausing, paused, resuming, running, pause-failed or resume-failed
sincenumberwhen it got there
reasonstring or nullthe last line the script printed, for pause-failed and resume-failed; its whole output is in the store's hooks/<id>/pause.log or resume.log (Files)

#Turn

turn describes a shell call that runs a command the repository lists under [exclusive] (Heavy commands) and waits while another worker runs one:

KeyTypeHolds
commandstringthe listed command it runs
holderstringthe name of the flow whose run has the turn
sincenumberwhen it began to wait

#Setup

setup holds the last run of the repo's .saaio/setup, at saaio start or by saaio setup (When setup or teardown fails). A failure stays until a run passes, whatever the flow's state:

KeyTypeHolds
failedstring or nullthe last line the script printed when it failed. Null when it passed
logstringthe file with the run's whole output
atnumberwhen it ran

#Workspace

workspace says where the worker runs:

KeyTypeHolds
pathstringthe worktree, or a plain session's folder
branchstring or nullthe flow's branch. Null for a plain session
slotnumber or nullthe flow's slot, 1 to 20. Null for a plain session
windowstring or nullsaaio-ui once the UI opened the worker. Null before
agentstringthe agent it runs, a name from the config
basestring or nullthe branch a stacked flow stands on and its merge request targets: its saaio start --base, then where that base merged. Null for a flow that started from what the repository had checked out

#Every project

saaio status --all --json wraps one board per registered store that has flows:

{
  "version": 4,
  "now": 1792214602016,
  "projects": [
    { "name": "shop", "root": "/Users/jan/.local/state/saaio/projects/shop", "board": { "version": 4, "...": "..." } }
  ]
}

Each project holds:

KeyTypeHolds
namestringthe project's name: its store's folder name, or default for the default store. (2), (3) and so on after a name already taken
rootstringthe store's folder
boardobjectthe board, as saaio status --json prints it

#Versions

version increases when a change could break a reader. New keys can appear without a new version, so your reader should ignore keys it does not know.

So far, the contract has had four versions:

VersionChanged
1the first contract
2plain sessions: workspace.branch and workspace.slot can be null, and mode can be plain
3phase and steps[].phase are the names of the flow's own workflow, not always the built-in four
4steps[].status can be stale