State home layout
Directory trees and lock files inside the v2 request state home, host paths outside --home, the one-time layout migration, and legacy v1 state layout.
--home defaults to $T12_HOME or ~/t12/home, and must resolve outside any project repository (record.Open). Project checkouts default to sibling directories under ~/t12/<project>, while every request, artifact, cache, access store, and lock lives inside --home.
Logs & drafts
requests/<id>/ holds hash-chained events, drafts, transcripts, and evidence.
Access & Observer
access/, approvals/, observer/, and proposals/ govern people and modes.
Worktrees & release
worktrees/, merge-scratch/, artifacts/, and release/ track builds and merges.
Caches & locks
qc-cache/, ui-baselines/, projects.json, and *.lock files coordinate state.
v2 state home tree
Directory reference
| Path | Owner | Purpose |
|---|---|---|
requests/<request-id>/events.jsonl | internal/record | Append-only SHA-256 hash-chained event log (0600). |
requests/<request-id>/events.lock | internal/record | Per-request flock held on event appends and blob sequencing (10s deadline). |
requests/<request-id>/context/ | internal/roles/context | Stores state.json, draft/{plain,srs,uat}.md, and sessions/. |
requests/<request-id>/lanes/<lane>/ | internal/readonlysession | Numbered per-role session transcripts (<role>/transcript-<id>[-N].jsonl). |
requests/<request-id>/reports/ | internal/record | Sequenced RoleReport JSON blobs referenced by role-report events. |
requests/<request-id>/decisions/ | internal/record | Sequenced Decision JSON blobs referenced by decision events. |
requests/<request-id>/evidence/ | internal/record | Sequenced evidence (plans, diffs, PNGs, PR bodies, transcripts, github-issue*.json, turn images). |
Layout migration
Older homes name the domain product: products.json, products/, product* JSON keys. On first open, every entry point runs one migration that renames them to project. The entry points are t12, t12-ui, t12-runner, t12-cc, t12-queue, the cloud worker, and the serverless handler.
The migration is idempotent. It runs under the home lock migrate.lock and writes state-layout.json when it finishes, so later opens skip it and a crash halfway is safely rerun.
| Step | What changes |
|---|---|
| Registry | products.json becomes projects.json, and products/ becomes projects/ (config.json replaces product.json inside). |
| Mutable records | product* keys become project* in access.json workspaces, observer.json, requests/<id>/context/state.json, cloud job records, projectenv files, and queue tasks. |
v1 run records | Each runs/<task-id>.json is rewritten and model.Version goes from 7 to 8, with one appended migrated event per run. |
| Hash-chained logs | Never rewritten. requests/<id>/events.jsonl and runs/<id>.events.jsonl keep their legacy bytes. |
Readers stay tolerant of the old names, so a repo or log written before the migration still loads:
- the legacy
product-boundevent type andproductdetail key in hash-chained logs .t12/product.json, read when.t12/config.jsonis absent- the
productskey of the profile (.t12/project.json) and theproductkey of a task file - the
product:<name>Asana tag prefix, next toproject:<name>
Re-copy the cloud worker workflow
The cloud worker workflow input product is now project, and the action init-product is now init-project. Copy .github/workflows/t12-worker.yml from this repository into the worker repository again, so its inputs match what the updated handler dispatches.
Legacy v1 state home layout
Legacy v1 isolation
t12 init and legacy v1 commands store per-task run records (model.Version = 8) at the top level of --home, separate from v2 requests/.
| Path | Owner | Purpose |
|---|---|---|
config.json | t12 init | Binds --home to a single project repository path, trunk branch, and model.Version. Not the repo's .t12/config.json. |
limits.json | t12 calibrate | Calibrated budget defaults (time_limit_s, op_limit, repair_cap, max_lanes). |
runs/ | internal/model, t12-runner | Per-task <task-id>.json, .events.jsonl, .lock, lane locks, integration.lock, runner.log. |
evidence/ | internal/evidence | Per-task evidence blobs (evidence/<task-id>/, including manifest.txt). |
go-cache/ | internal/sandbox | Per-project Go build cache (0700), writable only during untimed go compile steps. |
deliveries/ | t12-runner | Delivery adapter JSON reports (deliveries/<task-id>.json). |
jobs/ | t12-job, t12-adapter | Trunk analysis state (jobs/<name>/cubic-last.json). |
context/ | t12-cc | Standalone Context creator folders (state.json, transcript.jsonl, draft/, sessions/). |
queue/ and queue.lock | t12-queue, t12-wizard | Pending intake task JSON files and the queue lock. |
adapters/ | t12-job | Optional per-home executable adapters (adapters/<name>). |
worktrees/ and verify/ | internal/model | Legacy run worktrees and detached verification checkouts. |