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). Orchestrator schedules lanes across slot pools while deterministic Go checks enforce every boundary.

Planner

Strategist

Split confirmed specs into parallel DAG lanes and route failed steps.

Step 1

Analyzer

Investigate staging, write failing repro tests, and scope files within diff caps.

Step 2

Engineer

Write tests first and implement fixes inside a persistent offline Docker cage.

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.

  • Read-only boundary: Plan (plan.go) and Decide (agent.go) run readonlysession.Run (NoCommands: true, 3m) on <home>/worktrees/<req>@strategist.
  • 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.
  • Static routing & proposals: Failures match rules.json plus .t12/preferences.json strategist.rules first (qc/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). Unmatched or repeat failures call Decide and emit proposals/strategist-rule-*.json.

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. It inspects staging, proves bug repros fail on base, and produces the schema-validated plan Engineer executes via analyzer_plan or escalate {question}.

Analyzer runs a 15m (DefaultSessionTimeout) caged session 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 EstimatedLines cap; oversized tasks require acyclic seam split or child size_waiver

Engineer (internal/roles/engineer)

internal/roles/engineer is step 2 of every lane. It writes tests first and production code second inside a persistent Docker cage (sandbox.StartLane, DefaultSessionTimeout = 20m, DefaultCommandTimeout = 10m, DefaultMaxTurns = 60, DefaultFixAttempts = 3).

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.

Deterministic verification gates (verify.go)

Go enforces CheckTurnCap (turn-cap) inside loop(), then commits and runs seven gates in verify.go:

GateScript checkFailure behavior
new-testRequires at least one newly added test file matching TestGlobsRefuses engineer_done inside session
fails-on-baseRuns new test files (and new .feature E2E scenarios) on Base; must exit non-zeroRefuses engineer_done (proves nothing)
passes-on-candidateRuns UnitFiles (ExpandFiles) on the candidate worktreeRefuses engineer_done
no-commentsRejects added comments in JS/TS, Go, Python (.py, .pyi), Rust (.rs), CSS, and SCSS outside allowlisted directivesRefuses engineer_done with line numbers
diff-capSums added source lines (gitio.Tree.AddedLineCount) against budgets.diff_cap_lines (800)Sets res.DiffCap = true, resets to base, splits at Analyzer
buildRuns commands.build inside verification cageRefuses or consumes fix attempt
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: Strategist partitions work, Analyzer proves failures first, and Engineer cannot commit past seven deterministic gates.

Next steps

On this page