Skip to Content
turbo-12f
Architecture

System overview

How turbo-12f stacks its Go packages on Postgres (the only store), enforces zero external Go dependencies, and separates cage binaries that reach the network only through the database client from HTTP companion and cloud processes.

Explanation

turbo-12f keeps its Go runtime small and deterministic, and keeps every durable record in one Postgres database. Cage binaries (t12-cage, t12-container) link no HTTP code except the database client, while companion processes handle UI HTTP, cloud runs, AI harnesses, Cloudflare, and GitHub.

Core & cages (db client only)

  • Zero Go dependencies: Builds with the Go standard library only.
  • One store: Postgres through internal/db; the state home on disk is scratch.
  • Deterministic gates: Scripts verify every test, diff, and hash chain.

Companion processes & UI

  • Web workbench (t12-ui): Serves the React app, manages accounts and Observer, and shells out to t12.
  • Cloud worker (t12-cloud-worker): Runs a request in GitHub Actions against the same database.
  • AI harnesses: agy and omp run behind RPC wrappers and guard hooks, on the requesting person's own credentials.

New to turbo-12f?

Read The factory pipeline first for a plain-language overview before diving into Go packages.

Postgres is the only store

ADR 0005 makes Neon Postgres the single source of truth. Every process needs DATABASE_URL and stops at start-up without it (db.ErrNoDatabaseURL); there is no local file mode.

Kept in PostgresKept on local disk (<home>, T12_HOME)
Accounts, teams, sessions, projects, conversations, runsGit worktrees and project checkouts
Hash-chained events streams and evidence blobsBuild and dependency caches, merge scratch
Small mutable state as documents, append logs as log_entriesCage and agent scratch homes, per-run credential homes
leases instead of lock files, approvals, outbox, metricsThe approval spool a sandboxed guard hook writes to

Everything on disk can be rebuilt from GitHub plus the database. An old state home enters only once, through t12 db import --home DIR.

Six-layer package stack

The target v2 design in design.md stacks Go packages from storage up to CLI and HTTP entry points.

LayerPackagesResponsibility
Foundationinternal/db, internal/store, internal/schema, internal/gitio, internal/dag, internal/envfile, internal/projectPostgres client and migrations, canonical JSON and SHA-256 helpers, tool schemas, git helpers, DAG ordering, configs
Record & specsinternal/record, internal/access, internal/connections, internal/projectenv, internal/metrics, internal/spec, internal/rollup, internal/approvals, v1 internal/modelHash-chained streams, accounts and per-user connections, sealed project variables, OpenSpec views, rollups, approvals
Containmentinternal/sandbox, internal/cage, internal/container, internal/readonlysession, *rpc, internal/workersession, internal/docs, internal/served, internal/skillmap, internal/runner, internal/evalLandlock/Docker cages, revert guards, harness RPCs, Context7 socket, skill checks, role evals
Roles & mergeinternal/roles/*, internal/mergequeue, internal/mergepolicy, internal/adapters/*, internal/hosting, internal/trysiteThirteen role packages, staging rebase queue, policy rules, external adapters, production deploys to a person's Cloudflare or Vercel account, free test sites
Orchestrationinternal/orchestrator, internal/observer, internal/setup, internal/docschatLane DAG scheduling, slot pools, in-process file locks, failure routing, Observer loop, onboarding setup, docs chat
Entry pointsinternal/cli, internal/ui, internal/cloud/*, cmd/*CLI dispatch, embedded React dashboard with SSE, the cloud backend, and 12 helper binaries beside t12

Factory architecture across six layers

Flow
100%
binds netappendsderivesJSON + SSEEntry pointsLayer 6internal/cli · internal/ui · cmd/*Orchestration and automationLayer 5orchestrator · observer · setup · docschatRoles and mergeLayer 4internal/roles/* · mergequeue · mergepolicy · adaptersContainment and driversLayer 3sandbox · cage · *rpc · readonlysession · evalRecord, access, and approvalsLayer 2record · access · rollup · approvals · spec · v1 modelFoundationLayer 1db · store · schema · gitio · dag · envfile · projectProcess splitnet/http on boundsView readerUI reads rollupPostgresADR 0005 · Neon

Six Go package layers align with downward dependencies from CLI and UI entry points down to the Foundation, where internal/db reaches Postgres, the only durable store.

Click any node or press Play

Downward import rule

In the target architecture, dependencies flow strictly downward. Roles never import each other or the orchestrator, and only the orchestrator writes lane progression events to the log.

Zero-dependency Go stdlib rule

go.mod targets Go 1.27, excludes docs-site via ignore ./docs-site, and has zero require lines. Every binary in cmd/ builds strictly with the Go standard library, including the Postgres client.

External Node tooling is isolated to internal/ui/web (bun and vite-plus for embedded UI assets), docs-site, and site (the Astro marketing site). None of these directories adds third-party Go modules.

Core and network boundary

turbo-12f splits binaries so containment code cannot link HTTP clients or servers of its own. The one exception is internal/db, the Postgres client, which a cage reaches over a Unix-socket broker instead of the network.

Program groupBinariesNetwork and model policy
Core & cagescmd/t12, cmd/t12-cage, cmd/t12-containerImport net/http only through internal/db; cages run offline; t12 invokes local harnesses and subprocess adapters (ghcli, ghissue, ghrepo, t12-adapter context7 call)
Web UI servercmd/t12-uiServes SPA, auth, approvals, and Observer; forks sibling t12 for mutations
Cloud workercmd/t12-cloud-workerRuns in GitHub Actions against the shared database; resolves the requesting person's credentials from a per-run reference
Network adapterscmd/t12-adapter, plus v1 t12-runner, t12-cc, t12-job, t12-queueLinks net/http directly or transitively (internal/adapters/common, internal/skills); handles the Context7 Unix-socket proxy, intake, delivery, and SRE HTTP probes
Helper toolscmd/t12-mutate, cmd/t12-wizard, cmd/t12-neon-localMutation testing and host setup link HTTP only through internal/db; t12-neon-local is the test-only Neon SQL shim

When a core or cage binary needs direct HTTP calls or UI actions, it calls a sibling binary across an OS process or Unix-socket boundary (sibling("t12") in cmd/t12-ui, t12-adapter sre probe --url in SRE, t12-adapter context7 serve and call for docs lookups, t12-adapter hosting call for Cloudflare and Vercel deploys, health checks and test-site deletes, db.Broker for the database).

Boundary check

TestTheCoreAndTheCageProgramsLinkNoNetworkCodeButTheDatabaseClient in naming_test.go runs go list -buildvcs=false -deps on t12, t12-cage, and t12-container and allows net/http only in internal/db. Helpers the core needs live in network-free packages (internal/credhome, internal/contextcreator/ccstate, internal/hosting) beside the packages that make HTTP calls (internal/connections, internal/adapters/hosting). internal/hosting sends each provider call to t12-adapter hosting call as JSON on stdin, so no token is on a command line.

Process and network boundary

Flow
100%
Core & cages · db client onlynet/http · UI, cloud, adapters, v1sibling t12isolatesruns t12execUnix sockprobe JSONt12 core binaryCoreask · confirm · run · release · previewt12-cage & t12-containerSandboxLandlock & container wrapperst12-wizard · t12-mutatesetup & mutationt12-uiSPA · SSE · ObserverLegacy v1 driversrunner · job · queuet12-cloud-workerActions job · cloud runst12-adapterdocs · SRE · intakeProcess & socket boundarysibling t12 · sre probe · Context7 sock · DB broker

Cage binaries link net/http only through the Postgres client, with a host-side broker for the container; companion processes handle UI HTTP, cloud runs, SRE probes, and Context7 lookups.

Click any node or press Play

Key takeaway

Keeping the Go core stdlib-only and the cages offline lets turbo-12f verify every build in isolation, while Postgres holds the one record and thin sibling adapters confine credentials and network calls.

Next steps

On this page