Skip to Content
turbo-12f
Architecture

Record and evidence

How turbo-12f maintains tamper-evident hash-chained event logs, typed evidence reports, read-side rollups, and legacy v1 state models.

Explanation

Every state transition, test verdict, decision, and token count under a request home appends to an immutable trail in requests/<id>/. Read models in internal/rollup fold that log into UI pages and CLI summaries with no separate mutable state files.

Write

Append-only event log

Canonical JSON entries chained by SHA-256 under exclusive file locks.

Store

Typed immutable blobs

Sequenced RoleReport, Decision, and Session records verified by digest.

Project

Read-only rollups

Single-pass projections for lane states, flow graphs, quality, and scorecards.

Hash-chained event logs

internal/record (record.go) chains events under requests/<id>/events.jsonl using canonical JSON from internal/store:

  • Genesis & chaining: Sequence 0 anchors on SHA256("t12-request-genesis:" + req). Each event strips hash, encodes via store.Canonical, writes its SHA-256 into hash, and links the prior digest in prev.
  • Crash-safe appending: appendLocked holds an exclusive flock on events.lock and truncates any torn trailing line without a newline before writing.
  • Sequenced blobs & fast statting: freshName prefixes evidence and reports with a 4-digit sequence (0001-...); EventsStat checks (size, modNano) for SSE ticks; StatusTracker reads state in one pass.
  • Full verification (Home.Verify): Replays Seq, Request, Prev, and Hash, verifies every blob digest via VerifyRef, and rejects symlinks or path traversal.

Design target vs. current writers

design.md restricts event appends to the orchestrator alone. Today, approve, bugbash, confirm, release, and internal/roles/context also call Home.Append directly.

Typed evidence records

Record typeWhat it captures
RoleReportStep execution (Did, Done, NotDone, Next), Verdict, Findings, Checks (CheckCoverage: ran/skipped/noop-true), Cost, Context, Cage, Preferences, and Context7 Docs
DecisionStrategist rules, "answered-for-you", Observer actions (observer-<kind>, By: "observer"), and rule proposals (plus observer/log.jsonl & inflight.json)
Session (EvSession)Harness runs, SessionTool calls, SessionUsage tokens, numbered TranscriptRef links (transcript-<id>[-N].jsonl), plus approval-asked / approval-decided outcomes from approvals.EndSession
FactoryBench (internal/benchreport)Maps events.jsonl to attempt.started (+autonomy:<level>), usage, activity, gate, send_back, check_coverage, noop_checks, and human.waiting/resumed

Read-side projections in internal/rollup

internal/rollup derives all status views, flow graphs, and scorecards directly by folding events, reports, and decisions:

  • Twelve lane states: StateWaiting, StateBuilding, StateChecking, StateFixing, StateYourOK, StateOnTest, StateHeldBack, StateStuck, StateLive, StateUndone, StateLiveFixes, and StateSplit power UI and CLI summaries via single-pass helpers (TasksFromEvents, Summarize, NowFromEvents, PlanFromEvents, QualityFromEvents).
  • Flow graph (GraphOf & ApplyLiveJob in graph.go): Folds events into FlowGraph; only EvStepDone with Detail["by"] == "orchestrator" advances lane steps, and EvSendBack emits ReworkEdge only when from exists in stepIndex.
  • Acceptance & quality: Acceptance maps scenarios to tests and files; QualityOf computes catch rate from pre-merge versus escaped bugs.
  • Scorecards & outcomes: Score/Outcomes run RecordOutcomesFor on t12 run and t12 release merge, aggregate CheckCoverage, and propose guardrail-*.json after EscapedGuardrailMin = 2 escaped bugs.

Legacy v1 model contrast

Before internal/record introduced request-scoped streams, turbo-12f v1 stored per-task state in internal/model (Version = 8).

Aspectv2 (internal/record and internal/rollup)Legacy v1 (internal/model)
Primary log layoutrequests/<id>/events.jsonl + immutable blobsruns/<task-id>.json + runs/<task-id>.events.jsonl
Integrity hashprev and hash chain over store.Canonical JSONstate_sha chained across snapshots and event rows
Concurrency safetyExclusive events.lock and request worktreesFixed lock order lane -> integration -> run
State updatesAppend events and fold projections in rollupThree-way JSON merge (ApplyChanges) with runMoved guards
Crash recoveryAutomatic torn-tail truncation in appendLockedExplicit t12 repair CLI pass

One hash-chained log, every view derived from it

Flow
100%
eventchainblob hashderiveviewsre-hashSHA-256Producerst12 · roles · ObserverAppend engineunder events.lockevents.jsonlChainseq · prev · SHA-256Rollup viewsstatus · graph · scoreContent blobsreports · evidencet12 ui serverJSON · SSE · ObserverChain verifyre-hash + zero linksState foldersaccess · approvals · obsHost secrets~/.config/t12/env 0600Local trust modelno external anchor

Every t12 command and Observer decision appends through one locked log; rollup derives snapshots for t12-ui while host control stores and secrets stay separate.

Click any node or press Play

Key takeaway

Because every view in t12 and t12 ui is folded from one hash-chained log, there is no split-brain status database to repair. If t12 conversation verify passes, the history is intact.

Next steps

On this page