Skip to Content
turbo-12f
Architecture

Planning and build roles

Deep dive into Strategist DAG lane planning and routing, Analyzer repro creation and split plans, and Engineer caged edits, turn limits, and verify gates.

Explanation

After Context creator confirms an OpenSpec change on staging, three roles turn requirements into verified lane commits (strategist, analyzer, and engineer). In the default team flow they are the Tech Lead's split, the Tech Lead's plan step and the Developer's build; the classic flow names them Strategist, Analyzer and Engineer. Orchestrator schedules lanes across slot pools while deterministic Go checks enforce every boundary.

Planner

Strategist

Split confirmed specs into parallel DAG lanes (the Tech Lead's split in the team flow) and, in classic only, route failed steps.

Step 1

Analyzer

Investigate staging, write failing repro tests, and scope files within diff caps. The Tech Lead's plan step in the team flow.

Step 2

Engineer

Write tests first and implement fixes inside a persistent offline Docker cage. The Developer in the team flow.

Strategist (internal/roles/strategist)

internal/roles/strategist handles pre-lane DAG planning and post-failure routing, pairing deterministic rule tables with 3m read-only sessions. Planning (Route) runs in both flows, as the Tech Lead's split of the conversation into parts. The routing agent (Decide) runs only in the classic flow: the team flow routes every failure by rules.json alone.

  • Read-only boundary: Plan (plan.go) runs readonlysession.Run (NoCommands: true, 3m) on a detached staging checkout at <home>/worktrees/<req>@strategist. Decide (agent.go) runs a 3m read-only session in the lane's own cage, in the classic flow only.
  • DAG planning (Route & Tasks): When ShouldPlan sees at least 2 non-quality capabilities or 3 non-quality requirements, Plan emits parallel lanes; invalid outputs fall back to deterministic strategist.Tasks. The planner is told to size each lane at about half of budgets.diff_cap_lines, because estimates run low and a lane that lands over the cap is thrown away after an expensive build. Both assign dependency-ordered Sprint waves, and t12 run --sprint N runs only tasks up to wave N.
  • Static routing & proposals: Failures match rules.json plus .t12/preferences.json strategist.rules first (qc/qa/merge/deploy-dry-run → engineer at 0 tokens; engineer/code-review/deslop/red-team/ui-check → analyzer at 1 token; should-fix → chore; note → report only). In the classic flow, unmatched or repeat failures call Decide, which can write a proposal document named strategist-rule-*.json; the team flow never calls it.

Open gap in Strategist

Both Tasks and Plan currently log NotDone: "Entry steps for security, devops and incident tasks (D15)".

Analyzer (internal/roles/analyzer)

internal/roles/analyzer is step 1 of every lane in both flows (the Tech Lead's plan step in the team flow). It inspects staging, proves bug repros fail on base, and produces the schema-validated plan Engineer executes via analyzer_plan or escalate {question}. An escalated question goes to a person, or the orchestrator answers it itself when the project's autonomy level says so.

Analyzer runs a 15m (DefaultSessionTimeout) caged session of at most 40 turns inside in.Cage with approvals.GuardFor (DefaultCommandTimeout = 5m) using analyzer-v2.md. Its policy confines writes strictly to in.TestGlobs (confine: true, read_only: in.ProtectedPaths).

Plan field / checkGo validation in plan.go
Root cause & reproevidence, root_cause (required on bugs/send-backs), repro {test, name} (reproFailsOnBase), cause_class
Files & criteriaapproach, files (add/edit/delete), criteria mapping IDs to unit or e2e .feature files, screens for "ui" tags
Source line estimateestimated_lines counts added production source lines only (excludes tests, E2E, lockfiles, deletions, binaries)
Diff cap & splitsEnforces FinalSchema(), protected paths, and the EstimatedLines limit: an estimate above two thirds of budgets.diff_cap_lines (SplitAbove) requires an acyclic seam split, or a size_waiver for a single-requirement task that cannot split by criteria. A split part with one requirement may use the whole cap, and cannot split again

Engineer (internal/roles/engineer)

internal/roles/engineer is step 2 of every lane in both flows (the Developer in the team flow). It writes tests first and production code second inside a persistent Docker cage (sandbox.StartLane, DefaultSessionTimeout = 20m, DefaultCommandTimeout = 10m, DefaultMaxTurns = 60, DefaultFixAttempts = 3). The session's real time limit adds 15m (CheckAllowance) for each of the FixAttempts + 1 candidates it may hand over, because the session waits while the factory builds and tests what it handed over.

On merge send-backs, orchestrator/sendback.go runs gitio.SyncOntoStaging on the host and internal/cli/factory.go refreshes .feature files and e2e/t12/capture.ts. Engineer never runs git add or git commit, never edits e2e/features/*.feature, and exits via engineer_done or escalate. Its prompt ends with the worktree's file list (up to 400 paths, then a count per folder), so it opens files by path instead of listing folders.

Escalated questions and need-decision issues

Both Analyzer and Engineer may escalate a question, and the orchestrator records it as a question event. At autonomy.level auto the factory answers a lane's question itself once (turbo: up to 3 times) with the smallest change that satisfies the spec, and records an answered-for-you decision. Otherwise the lane waits for a person; in the cloud build the worker opens a GitHub issue labelled need-decision with the options and resumes the lane when someone replies. See Cloud hosting.

Checks inside the session (verify.go)

engineer_done does not end the session. The factory commits what the session handed over, runs the seven gates in verify.go, and, when they pass, runs QC, the screen check and Red team's origin check on that candidate. A refusal comes back as the answer to engineer_done, so the same warm session fixes it with everything it has read still in context; a new session starts only when one ends with its candidate still refused, for example out of turns. A check that could not run at all (Blocked) is not the Developer's to fix: the candidate goes through and the lane's own step reports it. When every check passes, the lane's qc and ui-check steps (or the first two parts of qa) reuse those results while the worktree still holds that candidate. Checks running at once across lanes are bounded by the run's check slots. Go enforces CheckTurnCap (turn-cap) when a session ends without finishing.

GateScript checkFailure behavior
new-testRequires at least one added or updated test file matching TestGlobsRefuses engineer_done inside session
fails-on-baseRuns each added or updated test file (and new .feature E2E scenarios) on Base; must exit non-zero (skipped for guard-only lanes)Refuses engineer_done (proves nothing)
passes-on-candidateRuns UnitFiles (ExpandFiles) on the added or updated test files in a checkout of the candidateRefuses engineer_done
no-commentsRejects added comments in JS/TS, Go, Python (.py, .pyi), Rust (.rs), CSS, and SCSS or Less outside allowlisted directivesRefuses engineer_done with line numbers
diff-capSums added source lines (gitio.Tree.AddedLineCount) against budgets.diff_cap_lines (800); every refusal states the lines used and warns at 80%Refused once so the session can trim; finishing again unchanged sets res.DiffCap = true and hands the task to the Analyzer's split. The candidate is kept on t12/<req>/<lane>--oversize first, and each part's Engineer starts from that attempt's version of the files its plan lists
buildRuns commands.build in a checkout of the candidateRefuses engineer_done
protected-pathBlocks edits to .github/workflows/**, .t12/**, .agents/**, and unsafe symlinksRefuses engineer_done

Key takeaway

Planning and build roles keep every change small and testable: the split partitions work, Analyzer proves failures first, and Engineer cannot commit past seven deterministic gates. Both flows run all three; only classic adds the Strategist's failure routing.

Next steps

On this page