PT EN
Install

Reference

Architecture.

Três planos e uma invariante. O control plane decide, o worker executa onde o código está, o cockpit observa — e nenhum CLI de agente toca o checkout principal, nunca. Esta página é o resumo; a referência completa é docs/ARCHITECTURE.md.

Archify diagram: operator → cockpit/API → FactoryService → Postgres leases → remote worker. Open the interactive version (views, theme, trace).

The three planes

Control plane

Keeps tasks, runs, events, artifacts and leases in Postgres, and exposes REST and SSE. It is what knows the state machine and what issues the leases workers claim. No agent runs here: this process decides, it doesn't build.

Worker

Runs on the host where your code lives. It claims a lease, creates the task's worktree, invokes the agent CLI and returns the result. The credential lives in FACTORY_WORKER_CREDENTIAL, an environment variable, never t25.yaml. An expired lease is reclaimed on the next cycle, and a completion that arrives after the lease expired is rejected instead of quietly accepted.

Mission Control

The cockpit at localhost:4173: board, per-run log, approvals, retries, cost, per-project policies and agent profiles, with progress events arriving over SSE while the task moves.

The state machine

RECEIVED → SPEC → PLAN → AWAITING_APPROVAL → IMPLEMENTING
         → QA → REVIEW → PR_OPEN → DOCS → DONE

fuga: NEEDS_INPUT · FAILED · CANCELLED
loop: QA and REVIEW can send it back to IMPLEMENTING

Legal transitions are declared in one place and checked before any state change; no part of the pipeline writes the state directly. Every change emits an event, and that is what the cockpit sees arriving.

StateMission nameWhat happens
SPECBriefingAn agent reads the repository and writes the spec. It stops until you approve.
PLANFlight planThe plan fixes the acceptance criteria. It only narrows the research scope, never widens it.
AWAITING_APPROVALGo/no-goA human stop, when policy or risk requires one.
IMPLEMENTING—Backend and frontend agents work inside the task's worktree.
QAChecklistChecks; if it fails, the task goes back to implementation.
REVIEW—Code and security review, with a structured verdict.
PR_OPENRelease runwayThe pull request is really opened and checked before anything moves on.
DOCS—The documentation for the change ships with it.

Mission names exist only where there is a real operational counterpart; the cockpit still shows the technical state, not the nickname.

Isolation by worktree

This is the deliberately paranoid part of the system, and the one you don't touch without reading the module's security comments:

Agent adapters

An adapter is the smallest possible thing: the binary name and how to assemble the arguments. All the process machinery (finding out whether the CLI exists, reading its version, streaming output, killing it on timeout) is shared. Adding a new CLI means declaring an adapter, not reimplementing process handling.

Two choices are worth recording: execution uses an argument list, with no shell in between; and a very large prompt goes to a temporary file instead of an argument, because the command line has a size limit in the operating system.

Role routing is a preference chain, not a fixed CLI: T25 uses the first available item in the list. See configuration.

Durable execution

Execution isn't a function call that has to survive the process: it is a queue of leases. The task is enqueued, a worker claims it with a deadline, and on finishing either confirms or hands it back. If the worker dies halfway through, the lease expires and the work returns to the queue. That is the crash recovery, and it doesn't depend on anyone remembering to clean up state.

Where the code is

WhatWhere
Shared contracts (roles, adapters, states, API)src/core/types.ts
Legal transitionssrc/core/state-machine.ts
The pipeline loopsrc/factory/service.ts
Isolation by worktreesrc/workspace/manager.ts
Queue, worker and runtimesrc/runtime/
CLI adapterssrc/adapters/
Agent prompts and rolessrc/agents/roles.ts
HTTP API e SSEsrc/server/
Cockpitweb/

Read before changing. ARCHITECTURE.md opens the layers with a guided tour and complexity hotspots; ARCHITECTURE-WORKERS.md details the plan of execution; and the ADRs record why the design is this.

Next Configuration: the t25.yaml sections →