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.
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 tot12. - Cloud worker (
t12-cloud-worker): Runs a request in GitHub Actions against the same database. - AI harnesses:
agyandomprun 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 Postgres | Kept on local disk (<home>, T12_HOME) |
|---|---|
| Accounts, teams, sessions, projects, conversations, runs | Git worktrees and project checkouts |
Hash-chained events streams and evidence blobs | Build and dependency caches, merge scratch |
Small mutable state as documents, append logs as log_entries | Cage and agent scratch homes, per-run credential homes |
leases instead of lock files, approvals, outbox, metrics | The 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.
| Topic | What the code does |
|---|---|
| Access | Neon's HTTPS SQL API with the standard library only; a Batch is one transaction; no Postgres driver |
| Retries | Query and statements marked idempotent retry on transient errors; Exec never retries; one HTTP attempt times out at 30 s |
| Migrations | Embedded in internal/db/schema/migrations (0001_infra to 0018_hosting), applied once under an advisory lock; t12 db migrate, status, compact, import |
| Test database | T12_TEST_DATABASE_URL with dbtest.New(t); scripts/test-db.sh starts a local Postgres behind cmd/t12-neon-local, reached through T12_DB_ENDPOINT |
| No-network cage | t12-container runs a db.Broker on a Unix socket (T12_DB_BROKER); DATABASE_URL never enters the container |
| Transfer metering | Each process counts the response bytes and HTTPS calls it reads and adds them to its db_usage row of the day about once a minute; the Usage page compares them with the Neon plan's monthly transfer |
Six-layer package stack
The target v2 design in design.md stacks Go packages from storage up to CLI and HTTP entry points.
| Layer | Packages | Responsibility |
|---|---|---|
| Foundation | internal/db, internal/store, internal/schema, internal/gitio, internal/dag, internal/envfile, internal/project | Postgres client and migrations, canonical JSON and SHA-256 helpers, tool schemas, git helpers, DAG ordering, configs |
| Record & specs | internal/record, internal/access, internal/connections, internal/projectenv, internal/metrics, internal/spec, internal/rollup, internal/approvals, v1 internal/model | Hash-chained streams, accounts and per-user connections, sealed project variables, OpenSpec views, rollups, approvals |
| Containment | internal/sandbox, internal/cage, internal/container, internal/readonlysession, *rpc, internal/workersession, internal/docs, internal/served, internal/skillmap, internal/runner, internal/eval | Landlock/Docker cages, revert guards, harness RPCs, Context7 socket, skill checks, role evals |
| Roles & merge | internal/roles/*, internal/mergequeue, internal/mergepolicy, internal/adapters/*, internal/hosting, internal/trysite | Thirteen role packages, staging rebase queue, policy rules, external adapters, production deploys to a person's Cloudflare or Vercel account, free test sites |
| Orchestration | internal/orchestrator, internal/observer, internal/setup, internal/docschat | Lane DAG scheduling, slot pools, in-process file locks, failure routing, Observer loop, onboarding setup, docs chat |
| Entry points | internal/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
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 PlayDownward 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.
While the v1-to-v2 transition finishes, go list shows five places where packages still cross layer boundaries:
| Package | Temporary imports | Why it exists today |
|---|---|---|
internal/roles/context | orchestrator, schema, omprpc, workersession, project, spec, record, skillmap, gitio, store, imginput, catalogue, adapters/ghissue | Drives conversation turns, readiness checks, and harness runners |
internal/roles/release | orchestrator, rollup, roles/deslop, roles/devops, project, record, served, gitio, store, adapters/ghrepo, cloud/issuelink | Coordinates release checks, bisection, and fix-lane additions |
internal/ui | roles/context, roles/release, roles/devops, observer, access, approvals, connections, projectenv, uistate, board, omprpc, readonlysession, record, rollup, project, spec, gitio, store, metrics, mergepolicy, orchestrator, sandbox, setup, imginput, adapters/ghcli, adapters/ghissue, adapters/ghrepo, cloud/ghapi, cloud/kanban, net/http | Serves dashboard views, accounts, connections, board, and embedded Observer controls |
internal/observer | roles/context, roles/release, orchestrator, approvals, access, record, rollup, readonlysession, schema, store | Scans waiting work and runs session.go via Actor and Hands without importing internal/ui |
| Sibling roles & rollup | qc ← uicheck/deslop; engineer ← qc; strategist ← orchestrator; orchestrator/analyzer/deslop ← rollup | Shares helper functions and Plan schemas across adjacent stages |
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 group | Binaries | Network and model policy |
|---|---|---|
| Core & cages | cmd/t12, cmd/t12-cage, cmd/t12-container | Import 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 server | cmd/t12-ui | Serves SPA, auth, approvals, and Observer; forks sibling t12 for mutations |
| Cloud worker | cmd/t12-cloud-worker | Runs in GitHub Actions against the shared database; resolves the requesting person's credentials from a per-run reference |
| Network adapters | cmd/t12-adapter, plus v1 t12-runner, t12-cc, t12-job, t12-queue | Links net/http directly or transitively (internal/adapters/common, internal/skills); handles the Context7 Unix-socket proxy, intake, delivery, and SRE HTTP probes |
| Helper tools | cmd/t12-mutate, cmd/t12-wizard, cmd/t12-neon-local | Mutation 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
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 PlayKey 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
Autonomy, people, and Observer
Understand the Operator and team roles, who accepts a request, the four factory autonomy modes, two-operator safety rules, and the optional Observer assistant.
Request lifecycle and orchestration
End-to-end execution from ask and confirm through the team flow's dependency-ordered lanes, capacity scheduling, autonomy modes, and failure recovery ladders.