Sandbox and harnesses
How Landlock, Docker cages, Request Review command approvals, read-only guards, prompt budgets, and Context7 socket forwarding isolate execution.
turbo-12f runs builds, tests, and model sessions inside stacked OS containment boundaries with secrets stripped from child environments.
Inside the cage
- Network disabled: Docker uses
--network none; Landlock filters TCP/Unix sockets. - Secrets scrubbed:
IsForbiddenEnvKeystrips API keys, tokens, and git/linker overrides. - Scoped writes: Read-only roles revert changes; Engineer writes only its lane worktree.
Host-side drivers & proxies
- Harnesses (
agy,omp,claude): Run outside cages behind RPC wrappers and guard hooks. - Context7 socket (
t12-adapter): Proxies docs lookups over a Unix socket withCONTEXT7_API_KEY. - Per-command gate: In
reviewmode, guard hooks pause commands on<home>/approvals/.
Linux Landlock and process limits
landlock_linux.go enforces filesystem and socket sandboxing on Linux with zero external libraries. Re-executing with argv[0] set to "t12-landlock-exec" applies the kernel ruleset before launching the child:
| Kernel feature | Enforcement |
|---|---|
ABI 4 (netTCP) | TCP bind and connect filters on supported kernels |
ABI 5 (MinCageABI) | Required by t12-cage for directory-scoped containment |
| ABI 6 & ABI 9 | Abstract Unix socket/signal scoping (ABI 6) and fsResolveUnix (ABI 9) |
| Process hardening | Sets PR_SET_NO_NEW_PRIVS and caps RLIMIT_NPROC at userTasks() + 8192 |
Docker verification containers and persistent lane cages
On Linux and macOS (MinMacOSMajor = 26), sandbox.go runs checks inside Docker containers with --network none, --cap-drop ALL, --security-opt no-new-privileges, and --pids-limit 8192.
- User & engine resolution (docker_host.go):
ContainerUser()passesuid:gidon Linux and0:0on Darwin (T12_CONTAINER_USERoverrides).ResolveDockerHostandDockerClientEnvselect Docker or Colima sockets underT12_CONTAINER_ENGINE(auto,docker,colima), strippingDOCKER_CONTEXT. - State-home checkouts &
deps-cache: Checkouts mount from<home>/checkouts/with a startup mount probe (24hsweep);node_modulescache under<home>/deps-cache/(8-entry LRU,14dTTL). - Persistent lane cages (
sandbox.StartLane): Starts one background container per lane (t12-lane-<hex>,--label t12.lane=<req>) with.gitmounted read-only to avoid per-turn container startup cost. - Offline after install:
devops.InstallsetsNetwork: trueonly whenadapter == "docker"during Project Gate dependency installs;qc,uicheck, andredteamstay offline. - Environment scrubbing (
IsForbiddenEnvKey): Strips API keys, tokens,PROD/PRODUCTIONvars, git overrides,PYTHONPATH,LD_PRELOAD,DYLD_INSERT_LIBRARIES,AGY_ADC_AUTH,GOOGLE_*, andDOCKER_HOST.
Namespace containment and container self-wrap
t12-cage(internal/cage): Creates Linux user and PID namespaces (CLONE_NEWUSER | CLONE_NEWPID), bindsPdeathsig: SIGKILL, and runs"t12-cage-init". Outside-cageCommitopens.gitwithO_NOFOLLOWand rejects nested.gitdirectories.t12-container(internal/container): Wrapsbin/t12inside a read-only--network nonecontainer for full CLI containment.
Concentric containment rings
Each boundary strips privileges inward from host credentials, through tool guards, into lane containers and fresh verify sandboxes.
Click any node or press PlayWorker harness matrix and read-only guards
turbo-12f drives three agent CLIs (agy, omp, claude) through RPC wrappers (internal/agyrpc, internal/omprpc, internal/ccrpc). For image attachments (internal/imginput), omprpc and ccrpc pass image blocks (checking vision capability), while agyrpc fails explicitly rather than silently dropping images.
| Harness | Go RPC driver | Guard hook script | Guard mechanism |
|---|---|---|---|
agy | internal/agyrpc | adapters/agy/guard-hook.ts | Sets toolPermission: "request-review"; hook rewrites run_command via overwrite + BypassSandbox: true; CheckWorkspace refuses .agents/ |
omp | internal/omprpc | adapters/omp/guard.ts | Intercepts tool_call events inside the extension runtime to reject forbidden writes and commands |
claude | internal/ccrpc | adapters/claude/guard-hook.ts | Runs bun --no-env-file ./guard-hook.ts and emits JSON permissionDecision plus updatedInput |
- Model, effort & token caps:
project.SplitAgyRoleModelsplits legacy slugs, andagyrpc.Argvemits--modeland--effort.agyrpc.RunWorkerrecordsSession.ToolCallsfromstep_updateand enforcesMaxTokens(StatusCostCap). - Scratch home credentials (
PrepareSession): Copiesantigravity-oauth-token,credential-user-scope, and conditionalapplication_default_credentials.json(0600) into scratch homes. - Conditional keys: Forwards
GEMINI_API_KEYandGOOGLE_GEMINI_BASE_URLonly whensettings.jsonsets"modelProvider": "gemini", and forwardsAGY_ADC_AUTH/GOOGLE_*only whenAGY_ADC_AUTHistrueor1.
Read-only and scoped role containment
- Read-only sessions (
readonlysession.Run): RunsNoCommands: trueorguardTree(confine: true), writes numbered transcripts (transcript-<id>[-N].jsonl), appliesroles.*overrides, and reverts edits on exit. - Scoped/toolless sessions:
analyzerruns a15mcaged session (TestGlobswritable);contextruns without shell tools (Settings(nil, nil)).
Per-command approvals (Request Review mode)
When an Operator sets factory mode to review (Request Review) in t12 ui, every agent shell command waits on a live file gate in internal/approvals (approvals.go):
- Fail-closed mode checks:
guard-hook.ts(agy,claude) andguard.ts(omp) read<home>/access/mode.jsonbefore every command, blocking commands if unreadable or corrupt. - Write-once decisions: Asks write
<unix-nanos>-<6hex>.json(0600) under<home>/approvals/<YYYY-MM-DDTHH>/; approvals write<id>.decision.jsonvia hard link (EEXISTsafe).Pendingscans30m,Recentcaps at500, andRetentionprunes after7d. - Guard vs. role timeouts:
WaitTimeout(30m) sits insideHookTimeout(31m/1860s), whileapprovals.EndSessioncloses undecided asks (409on late UI posts) whenever a shorter role timer finishes first:
| Caller | Session timeout | Caller | Session timeout |
|---|---|---|---|
analyzer, explorer | 15m | deslop, observer | 5m |
codereview, redteam, sre | 10m | strategist | 3m |
Prompt assembly and Context7 socket forwarding
- Embedded prompts & skills (
factory.Files): skills/map.json pins each skill to a SHA-256 digest andSOURCEline withinbudget_words: 9000(skillmap.Check()runs at confirm; wording_test.go checks neutral phrasing). - Context7 socket proxy (
internal/docs,internal/adapters/docs): Launchest12-adapter context7 serveon/tmp/t12d-.../c7.sock. ItsForwarderforwards onlyPOST /mcpcalls forresolve-library-idandquery-docswithCONTEXT7_API_KEYinjected outside the cage, logging lookups toRoleReport.Docs.
Key takeaway
Even when AI harnesses execute on the host, every shell command is rewritten through a fail-closed guard hook into an offline, secret-free cage.
Next steps
Record and evidence
How turbo-12f maintains tamper-evident hash-chained event logs, typed evidence reports, read-side rollups, and legacy v1 state models.
Release and SRE
How lanes enter staging through the serialized merge queue, clear merge policies and proof bisection, and stay monitored after promotion.