Skip to Content
turbo-12f
Development

Architecture decisions and status

Why turbo-12f keeps host tools, replaces the v1 QC stage, gates features on stored run metrics, budgets per-test CPU, keeps all state in Neon Postgres, runs as a small team by default, and what remains open.

Explanation

Architecture Decision Records under docs/adr/ capture empirical measurements and structural boundaries for turbo-12f. The 22 Nov 2026 target redesign kept three of the first four decisions, amended two of them, and superseded the v1 QC structure. ADR 0005 later moved all state into Neon Postgres, and ADR 0006 made the small-team flow the default.

Decisions at a glance

ADRDecisionCurrent status
ADR 0001Keep Go host tools instead of BAML parsingActive
ADR 0002Order QC by trust pyramid; drop t12-tia and integration tierSuperseded by v2 11-role split (pyramid and no-integration rule kept)
ADR 0003Require factory features to beat the baseline factoryActive, amended for v2 cutover parity ($60 spend cap) and, on 2026-12-01, to compare by stored run metrics
ADR 0004Replace 10 s wall-clock tier kill with ~100 ms per-test CPU budgets + mutationActive, amended to run baseline timing in DevOps Project Gate
ADR 0005Neon Postgres is the only source of truth; local disk is scratchAccepted; implemented
ADR 0006A small-team flow (Tech Lead, Developer, QA, DevOps) next to the classic one, measured before it replaces itAccepted; team is the default flow since 2026-12-01

Accepted and superseded decisions

ADR 0001 keeps host tools over BAML

READY

Active decision (issue #97)

Production code stays free of baml-py; structured JSON calls run through Go internal/tools and tools.Parse.

  • Context: Tested replacing host tools with BAML (baml-py 0.226.3), where the model writes the final call as text and BAML parses it.
  • Evidence: Across 5 runs per cell on analyzer, red (sonnet and haiku) and reviewer (opus, high thinking), host tools hit 5/5 accepted calls with 0 refusals. BAML added ~45% output tokens and 20%–25% cost on analyzer. Its 4 reviewer refusals were mostly the test harness, not BAML.
  • Consequence: The experiment code is off main and lives on the experiments/baml branch. Nothing depends on baml-py.
  • Reopen rule: Reopens only if a weaker model raises the recorded refused-call count per session.

ADR 0002 replaced v1 gates before v2 superseded it

CHECKPOINT

Superseded by v2 11-role redesign

Trust-pyramid ordering and dropping tests/integration carry forward; separate v1 review and verifier sessions were replaced.

  • Context: ADR 0002 ordered v1 QC into static, verification (verify skills), and parallel reviewer-bugs/reviewer-quality Claude Opus 5.5 reviews while deleting t12-tia and tests/integration.
  • Outcome: In v2, QC runs deterministic static, E2E, and ui-check scripts only, while Red team, Deslop, and Code review run as dedicated lane roles (plus optional release qc.explorer).

ADR 0003 requires features to beat the baseline

READY

Active, amended for v2 cutover

Every kept or new v2 component must match or beat a single deep Claude Code + pstack baseline on stored run metrics of the same request and model (docs/evidence/; $60 cap under H8/Q10). FactoryBench, the earlier home of this comparison, was retired on 2026-12-01.

  • Context: Enforced after turbo-12f reached 29k Go lines across 10 programs without comparative benchmarks. Hash-chained logs and locked tests remain exempt as integrity invariants.
  • v2 amendment: Features replaced by the 11-role catalogue (TDD mode, frozen lanes, the two v1 reviewers and verifier, prepare, touches, intake, the wizard) are cut by design without benchmark runs, in one cutover change. Until then they stay in the tree.

ADR 0004 replaces the 10 s kill with per-test CPU budgets

READY

Active, amended for DevOps Project Gate

Local ~100 ms per-added-test CPU budgets, 3-run median checks, ~3x runaway kills, and t12-mutate replace the brittle 10 s wall-clock tier kill.

  • Context: Killing an entire unit suite at 10 s wall time penalized correct changes for host load and suite growth. Hardware-dependent wall limits (100 ms / 10 s / 60 s) report locally rather than gating CI.
  • v2 amendment: Baseline timing moves from prepare to the DevOps Project Gate, and tier budgets are recorded at bootstrap; going over one is a should-fix.
  • Implementation: t12-mutate new-tests enforces the mutation-kill rule. QC's own list of work not done names per-test CPU: the whole unit tier runs every time, and the unit limit stays 10 s unless T12_UNIT_LIMIT_S (1..300) sets it.

ADR 0005 makes Neon the only source of truth

READY

Accepted; applies to every store

A process without DATABASE_URL stops at startup with db.ErrNoDatabaseURL. There is no local file mode.

  • Context: State used to live in a directory guarded by flock files, mirrored to a GitHub repository in the cloud build. That tied a conversation to one machine and let the cloud worker and the Vercel function disagree about what exists.
  • Decision: Accounts, teams, projects, conversations, run records, hash-chained event logs, evidence blobs, approvals, observer state, project variables (still encrypted), cloud jobs, board issues and metrics live in Neon Postgres. Local disk holds worktrees, caches and cages, all rebuildable from GitHub plus the database.
  • Access: internal/db calls Neon's HTTPS SQL API with the standard library only (POST https://<host>/sql). DATABASE_URL is the pooled endpoint for every process.
  • Locks: File locks became leases (leases table), optimistic rev checks and unique constraints. A lease expires by itself when its holder dies.
  • Schema: Numbered migrations in internal/db/schema/migrations (currently 0001 to 0018) are embedded and applied under an advisory lock. A merged migration is never edited.
  • Import: t12 db import --home DIR [--dry-run] [--only a,b] loads an old home once. Event logs are verified and copied byte-exact, so every hash still checks.
  • Tests: T12_TEST_DATABASE_URL selects the test database; scripts/test-db.sh provides a local PostgreSQL behind cmd/t12-neon-local, reached with T12_DB_ENDPOINT.

ADR 0006 makes the small team the default flow

READY

Accepted; team is the default since 2026-12-01

A project chooses its flow with the flow preference: team (the default) or classic. A conversation records its flow in a flow-chosen event before its first part starts and keeps it.

  • Context: The classic flow runs eleven steps per part, each check in its own session, and asks a Strategist session where a failed check goes. Nothing showed that all of it pays for itself (ADR 0003), and the role names were hard to explain to a client or a new maintainer.
  • Decision: The team flow keeps what a small development team does. The Product Owner (Context creator) writes the spec; the Tech Lead splits the work and plans each part (analyze); the Developer builds it (engineer); QA runs the tests, the screens, and one review (qa), stopping at the first that fails; DevOps runs the merge policy, merge, and deploy dry run. A part costs three agent sessions instead of five, and a QA finding goes straight back to the Developer as a fix attempt.
  • Shared: The record, the cage, the merge queue, the release checks, the release gate, and sign-off are the same in both flows. Deslop, Red team, and SRE do not run per part in team.
  • Evidence: The same request, model, and answers ran once in each flow on the production cloud (docs/evidence/flow-comparison-2026-12-01/):
ClassicTeam
Parts merged, release checks7 of 7, pass6 of 6, pass
Model fees$16.64$8.21
Tokens31.0 M15.5 M
Session time2 h 57 min2 h 15 min
Extra tries81
Agent sessions10350
Problems the checks caught151
  • Reopen rule: A classic step comes back only when a stored comparison like this one, on the same request and model, shows it wins. The rule "No role can be switched off" now reads "No step of the conversation's flow can be switched off".
  • Learned from the team run: 150 of its 809 tool calls failed (129 reads of files that do not exist, 19 commands the sandbox policy refused), so every session now starts with the worktree's file list, the Developer's prompt names the three mistakes half the first in-session checks failed on, and the release red team starts on a whole-app budget.
  • Changing a flow: A step is a constant in internal/orchestrator, a StepFunc, an entry in the flow's Steps (and Owners), a found_by rule and a web label; the recipe is in Extend the factory.

Current build status and open gaps

Through late Nov 2026, walking skeleton items S1–S14, v2 core roles, factory controls, and the Neon cutover are merged:

  • Core lane execution & planning: H1, H2, spec gate D7 (#227, #229), catalogues D8, Deslop D13–D14, Red team D15–D16, UI baselines D17–D18, Context7 proxy D30, skill map D29, and Strategist DAG + gitio.SyncOntoStaging (#224).
  • Operations & delivery: D28 config proposals, CLI reporting (D23, D24, D31), release gates (D19, D26), SRE watch/triage (D21, D22), and web-react starter (A27–A29).
  • UI pages: t12 ui (D33–D37, E8) adds /c/:id, /onboarding, /connections, /observer, and /settings.
  • UI controls: Conversation permission, command approvals, scoped Observer (#216, #225, #451, #465), and live SSE canvas (#226, #466).
  • Evaluation & benchmarks: Evaluation profile E5, and t12 eval (run/seams/capture).
  • Cloud and teams: Neon as the only store (ADR 0005), open sign-up, per-user connections, team roles, the project board, and metrics (see ## Unreleased in CHANGELOG.md).
AreaCurrent stateBlocked on
Cloud deploys (H10, D42)Production deploys to the requesting person's own Cloudflare or Vercel account when one is connected under Your connections; with none, devops.Promote falls back to DryRunOnly and refuses productionA hosting account connected by the person who releases
Baseline parity (D38–D41, E9–E10, F1–F3)Pending comparative runsStored run metrics under docs/evidence/, multi-family model keys beyond Gemini, CI runner keys, and human trials
Legacy v1 cutover (G1)v1 flows coexist (TestTheCoreAndTheCageProgramsLinkNoNetworkCodeButTheDatabaseClient already passes)Baseline parity completion

Key takeaway

Every architectural boundary in turbo-12f is empirical: host tools beat BAML on cost and reliability, mutation kills replace brittle wall timers, the small-team flow halved the cost of the same request, baseline parity on stored run metrics gates the final v1 cutover, and one database, not a folder, is the record.

Next steps

On this page