Architecture
The system
GAOS is a graph-native agent operating system. Six layers, five control loops, and one thesis that decides every other design question: the graph is the primitive, not the prompt.
Two invariants everything else follows from
State lives in the graph. The orchestrator holds no authoritative state. Kill it mid-run and it rebuilds from vertices, edges and events. Anything an orchestrator keeps in process memory is state that a restart silently invents a new version of.
Every change emits an event. An event that was never written is a state change that never happened. This is not a logging convention — it is what makes replay possible at all, and it is why the event catalog is closed rather than open.
Why the graph and not a prompt chain
A prompt chain has no addressable intermediate state. You cannot ask it what a task depended on, which requirement justified a decision, or what exactly was sent to the model on attempt two — because none of that was ever a thing, only a substring. In a graph each of those is a vertex with edges, and the question is a traversal.
Six layers, and what each may never do
The “must never” column is the load-bearing one. Each entry is a specific way the layering has been broken before, in this kind of system.
| Layer | Owns | Must never |
|---|---|---|
| UI · Mission Control | A projection of graph state; operator actions | Invent state the graph does not have |
| API gateway | Auth, tenant scoping, request validation, event fan-out | Let a tenant boundary be enforced further down only |
| Orchestration | Planner, scheduler, review engine, retry policy | Hold long-lived state in process memory |
| Execution | Turn supervision: one live turn per product workspace, a request id per attempt, polling, recovery by deadline. Before v0.29.0: detached processes, workspace leases, heartbeats | Lose a turn it submitted, or start a second writer in a workspace |
| Model gateway | One adapter, an HTTP client of ai-manager; cost and token accounting from its reply. Before v0.29.0: the CLI adapter | Leak provider-specific shapes upward, or spawn a tool |
| ArcadeDB | Graph, documents, events, full-text, time series | Be bypassed by a side channel |
Three layers outside the six
Since D-055 the model is not run by any of the six layers above. GAOS hands one turn at a time to ai-manager, which runs it through ai-claude-cli in the product's workspace. ai-claude-cli works the task with context; ai-manager shapes it with a workspace; GAOS shapes it with the product, the task details and the product's Blueprint. The contract between them is The gateway; what GAOS writes into the workspace is the Blueprint.
What happens when the orchestrator restarts
Because a turn runs in ai-manager and not in the orchestrator, a restart finds tasks that claim
to be running. The recovery is a reconciliation, not a reset, and it rests on one ordering rule:
every turn is recorded with its request id before it is sent. Reconcile in
dashboard/runner.go and recoverTurns in dashboard/turns.go
do the rest:
for run in runs where status in (STARTED, RUNNING) and run.requestId != "":
reply = gateway.poll(run.requestId)
if reply in (completed, failed):
adopt(run) # TaskResumed(rule=adopted); finished like a supervised run
else: # ai-manager no longer knows the request
emit TaskOrphaned(rule=request-lost)
hold(run.product) until run.startedAt + turn_deadline
requeue(run.task) # TaskResumed(rule=requeued), on a new session
for task in tasks where status in (DISPATCHED, RUNNING) and no turn was recorded:
requeue(task) # READY; TaskResumed(rule=requeued)
A turn that cannot be proved finished is not assumed finished, and a lost one is not assumed
dead. ai-manager keeps request records in memory, so a request it no longer knows may still be
running in the workspace; the product stays held — the per-product graph lease of
BR-38 allows one live turn per product — until the turn deadline has passed,
and only then is the task requeued (D-060). The
turn is made dead by waiting, because nothing can signal it. A task that claims to be running
with no turn behind it never reached the gateway, so nothing anywhere can still be doing its work,
and it goes straight back to READY. The gateway §recovery
has the request-level detail.
Before v0.29.0 this was a lease-and-heartbeat reconciler
Work ran as detached processes under a workspace lease, and recovery compared the lease with the last heartbeat: adopt a live run, kill-then-requeue one whose supervisor had died, and orphan one whose lease had expired. The kill came first because a stale beat says the supervisor died, not the child, and requeuing without it could start a second writer in the same workspace (D-054). M14.7 deleted the detached runner, the lease and the heartbeat; the principle — never hand a workspace on while something may still be writing in it — survives as the hold above.
From an empty record to autonomous work
Seven stages, since the Blueprint became one. The interesting boundary is stage four, where the last human instruction runs out.
| Stage | Human | System | Writes to the graph |
|---|---|---|---|
| Product setup | Fills the record | — | Product, Requirement, Issue, AcceptanceCriterion, Artifact |
| Blueprint | Writes policies, names knowledge sources, publishes | Provisions the workspace, syncs the files | Policy, KnowledgeSource, BlueprintVersion, Workspace |
| Readiness check | — | Scores the rubric | Product.readinessScore, ReadinessEvaluated |
| Workflow creation | States an objective | Planner expands it | Workflow, Task, DEPENDS_ON, IMPLEMENTS |
| Execution | Moves cards on the board, or nothing | Scheduler, one turn per workspace, reviewer | TaskRun -PINNED_TO-> BlueprintVersion, ContextSlice, Review, Event |
| Gate | Approves, or does not | Holds | Approval, Event |
| Close | — | Extracts the lesson | Knowledge, Decision, Event |
Autonomy begins when the scheduler can find a READY task without a human naming
it. That requires four things at once: an acyclic dependency graph, a capable agent for
the role, a product with no live turn (the graph lease of BR-38), and a readiness gate that passed. Miss any one and the
work queues instead of starting — which is the correct failure, and the one the product's board
and its blocking reasons are there to make visible.
Splitting work, and choosing who does it
A task is atomic when it has one concern, one workspace, and at least one acceptance criterion. A task with two concerns cannot be scored, because a single number now describes two independent outcomes.
| The work | Role | Model tier | Review |
|---|---|---|---|
| Schema migration, money, auth | Backend + Security | top | always an extra reviewer |
| Public API contract | Architect | top | normal |
| New feature inside an existing boundary | Backend / Frontend | mid | normal |
| Tests, docs, refactor | QA | low | normal |
| A retry | same role | one tier above the last attempt | normal |
Scoring, and when to stop trying
Every completed run is scored on five dimensions and reduced to one number:
final = 0.45·correctness
+ 0.20·completeness
+ 0.15·safety
+ 0.10·quality
+ 0.10·efficiency
| Score | Verdict |
|---|---|
| 85–100 | accept |
| 70–84 | accept, and plan a cleanup task |
| 50–69 | iterate with a widened context slice |
| 30–49 | escalate one model tier |
| 0–29 | stop, and call a design review |
| safety < 60 | immediate stop, regardless of the total |
The guardrails are what stop a loop, not the scoring
max_retry_count 3 per task · max_escalation_count 2 per task ·
same_failure_signature_limit 2 · exponential cooldown with a cap · a budget cap
per workflow and per tenant · human intervention at two escalations or any safety veto.
A scoring function alone will happily retry forever at 68.
The failure signature — a hash of the normalised error — is what decides retry versus design review. Two attempts failing the same way is not bad luck; it is a problem the model cannot see, and a third attempt at a higher tier will fail identically.
Knowledge maturity, scored out of 100
The planner refuses work it cannot plan. The rubric is machine-checkable on purpose — a human judgement of “is this spec good enough” is not repeatable, and the whole point is to stop a vague record producing a vague plan.
| Item | Points | Item | Points |
|---|---|---|---|
| Problem statement | 8 | Criteria coverage | 12 |
| Goals | 8 | Behaviour diagram | 10 |
| Domain rules | 12 | Data model | 8 |
| Out of scope | 6 | Repository linked | 8 |
| Stories exist | 10 | Decisions | 8 |
| Success metrics | 5 | Verification strategy | 5 |
| Band | Score | What the planner will do |
|---|---|---|
| INSUFFICIENT | 0–44 | Refuses to plan |
| MINIMUM | 45–69 | Everything gated, mid-tier cap, no auto-merge |
| WORKING | 70–89 | Normal autonomy |
| COMPLETE | 90–100 | Low-risk changes may auto-merge |
A record also decays. The effective score is the raw score minus a drift penalty:
drift_penalty = min(25,
4 × months_since_last_review
+ 6 × (boundary_files_changed > 0)
+ 8 × (open_contradictions > 0))
Crossing a band downward emits ReadinessDropped. A document that was accurate a
year ago and has not been read since is not a specification; it is a historical artifact, and
the planner should treat it as one.
Replay
state(t) = fold(reduce, events.filter(e => e.ts <= t), snapshot_before(t) ?? empty)
reduce must be pure, total, and order-stable by
(ts, seq). Pure so it can be re-run; total so an unknown event type cannot
crash a replay of last month; order-stable so two events in the same second cannot produce two
different pasts.
Replay scopes are Workflow, Task, Meeting, and Comparison. Route replay through a read-only store handle, not a flag — a flag is one forgotten branch away from a replay that writes.
Build order
Ten deliverables, sequenced. Mission Control is number nine, and that is deliberate.
- Graph schema and event store
- Task state machine
- Product master and readiness scoring
- Planner producing a static task graph
- Runner with one supervised turn (a detached process until v0.29.0)
- Review, scoring and retry policy
- Context assembly
- Approval gates
- Mission Control and replay
- Meetings, knowledge extraction, multi-repo
Resist starting with the visual layer
It is the most rewarding to build and the least load-bearing. This repository has done exactly that anyway — see the changelog — but for a stated reason: the first thing worth proving was the deployment path, and a dashboard is the only component that exercises all of it. The engineering floor that first shipped was moved by a simulation; v0.29.0 deleted both, and since then the board moves only when real work, through ai-manager, moves a task.
Where this lives in the repository
| Path | What it is |
|---|---|
artifacts/v1/gaos-architecture.html | The full design document this page summarises |
artifacts/v1/gaos-arcadedb-model.html | The complete schema — see The graph |
artifacts/v1/gaos-mission-control.html | The UI prototype the dashboard was ported from |
dashboard/ | Mission Control — Go, stdlib only, HTMX |
dashboard/events.go | The closed event catalog, as typed constants |
dashboard/store.go | The seam both stores implement — unchanged since it was written |
dashboard/store_arcade.go | The ArcadeDB store: reads and writes the graph |
dashboard/arcade.go | The ArcadeDB client — ready probe, query, command, transaction |
dashboard/adapter.go | The model-gateway seam; reshaped to Submit/Poll by M14.2 |
| The gateway, Blueprint | The contract with ai-manager and ai-claude-cli, and what GAOS writes into a product's workspace |