Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
882 changes: 180 additions & 702 deletions BOOK_PLAN.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ For commands, side effects, persistence, transport, updates, and cleanup, answer
Quote only the minimum source required to explain the design. Do not copy upstream
documentation or substantial source files into the book. Preserve attribution and
immutable links. Never include credentials, local paths containing personal data,
private downstream implementation details, or unpublished repository content.
private Easy Code implementation details, or unpublished repository content.

## Diagrams and interactive labs

Expand Down
4 changes: 2 additions & 2 deletions NOTICE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ architecture. The upstream project is available at:

https://github.com/pingdotgg/t3code

The source snapshot used by this edition is commit
`fa219001dc2f14cfd9c7774c2c03c153359144be`. T3 Code is licensed under the MIT
The referenced T3 Code source is commit
`859304b7808ab9a4be87b1bddcd07c6485bf9c4f`. T3 Code is licensed under the MIT
License. The following upstream notice and permission terms remain applicable to
every included excerpt:

Expand Down
63 changes: 34 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# T3 Code Decoded

**A source-grounded, interactive guide to the architecture and implementation of T3 Code.**
**A complete product guide and source-grounded interactive guide to T3 Code's architecture and implementation.**

[Read the book](#read-the-book) · [Explore the plan](./BOOK_PLAN.md) ·
[Contribute](./CONTRIBUTING.md) · [Source policy](#source-grounding)
Expand All @@ -18,25 +18,31 @@ Created and maintained by [Ahmed Alaa (`@BenAlaa`)](https://github.com/BenAlaa).

> [!NOTE]
> The public Pages site is deployed from protected `main`. It reflects the latest
> merged revision; topic branches remain local or unmerged until their reviewed
> pull requests are ready.
> merged milestone; stacked local authoring branches can be ahead while later parts
> wait for their own reviewed pull requests.
> No authored work is pushed directly to `main`.

## Read the book

[Read the published book](https://benalaa.github.io/t3code-decoded/). When reviewing
an unmerged change, run that branch locally with the instructions below—the
published site intentionally tracks protected `main`, not unpublished work.
an unmerged milestone, run that branch locally with the instructions below—the
published site intentionally tracks protected `main`, not local stacked work.

The current edition is pinned to
[`pingdotgg/t3code@fa219001d`](https://github.com/pingdotgg/t3code/tree/fa219001dc2f14cfd9c7774c2c03c153359144be).
The book is synchronized with
[`pingdotgg/t3code@859304b78`](https://github.com/pingdotgg/t3code/tree/859304b7808ab9a4be87b1bddcd07c6485bf9c4f),
captured on 11 September 2026.
Every exact excerpt in the book is generated from that revision, checksum-verified,
and linked back to immutable GitHub source lines.

## What this book explains

T3 Code is not the reasoning engine inside Codex, Claude, Cursor, Grok, or
OpenCode. It is the server-authoritative control plane around them: it normalizes
The product guide explains installation, onboarding, environments, projects,
threads, worktrees, composing with rich context, providers, permissions, files,
terminals, previews, SnapShots, source control, remote access, mobile, device
testing, usage, updates, privacy, complete workflows, and troubleshooting.

The technical guide explains that T3 Code is not the reasoning engine inside Codex,
Claude, Cursor, Grok, OpenCode, or Antigravity. It is the server-authoritative control plane around them: it normalizes
intent, durably records product state, starts and supervises provider runtimes,
projects ordered state to several clients, and surrounds the conversation with
worktrees, Git checkpoints, terminals, files, previews, remote access, usage, and
Expand All @@ -48,30 +54,29 @@ Web · Desktop · Mobile
T3 server: command → event → projection → reactor
│ │
│ └─ files · Git · terminal · tunnel
│ └─ files · Git · terminal · devices · tunnel
ProviderAdapter
│ native protocol
Codex · Claude · Cursor · Grok · OpenCode
Codex · Claude · Cursor · Grok · OpenCode · Antigravity
```

The book follows that causal path instead of mirroring repository folders. Its
eight parts cover:

1. ownership boundaries, vocabulary, repository topology, and runtime shapes;
2. CLI/server boot, Effect RPC, pairing, authorization, subscriptions, and resume;
3. commands, events, receipts, projections, reactors, SQLite, and recovery;
4. the provider adapter contract, all five harness integrations, and both usage
systems;
5. projects, worktrees, turns, permissions, plans, tasks, context, memory,
checkpoints, terminals, files, VCS, MCP, preview, and pull requests;
6. the shared client runtime plus web, Electron, and React Native clients;
7. direct/relay/Tailscale/SSH access, reconnection, packaging, releases, updates, and telemetry;
8. complete end-to-end traces, architectural trade-offs, limitations, and
evidence-bounded roadmap analysis.

See [BOOK_PLAN.md](./BOOK_PLAN.md) for the complete 40-chapter specification,
The book starts with product tasks, then follows that causal path instead of
mirroring repository folders. Its eight parts cover:

1. the complete product guide and task recipes;
2. architecture orientation, ownership boundaries, vocabulary, repository topology, and runtime shapes;
3. CLI/server boot, Effect RPC, pairing, authorization, subscriptions, and resume;
4. commands, events, receipts, projections, reactors, SQLite, and recovery;
5. the provider adapter contract, all six provider integrations, historical usage,
live context, and subscription limits;
6. projects, worktrees, turns, permissions, plans, tasks, context, memory,
checkpoints, terminals, files, VCS, MCP, previews, pull requests, and devices;
7. the shared client runtime plus web, Electron, and React Native clients;
8. direct/relay/Tailscale/SSH access, reconnection, packaging, releases, updates, and telemetry.

See [BOOK_PLAN.md](./BOOK_PLAN.md) for the complete 53-chapter specification,
figure/lab inventory, review gates, and definition of done.

## Why another set of docs?
Expand All @@ -82,7 +87,7 @@ answers a different class of questions:
- Where is the transaction boundary?
- What does a command receipt actually prove?
- Which state survives a server restart?
- How do five provider protocols become one product vocabulary?
- How do six provider integrations become one product vocabulary?
- Why does reconnect logic live above a one-attempt RPC session?
- What is shared across clients, and what deliberately differs?
- Which remote component allocates credentials, and where does application traffic
Expand Down Expand Up @@ -192,7 +197,7 @@ checkout:

```sh
git clone https://github.com/pingdotgg/t3code.git ../t3code
git -C ../t3code checkout fa219001dc2f14cfd9c7774c2c03c153359144be
git -C ../t3code checkout 859304b7808ab9a4be87b1bddcd07c6485bf9c4f
npm run source:check
```

Expand Down
23 changes: 12 additions & 11 deletions sources/excerpts.manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

[
{
"id": "architecture-boundary",
Expand Down Expand Up @@ -26,24 +27,24 @@
{
"id": "provider-adapter-core",
"path": "apps/server/src/provider/Services/ProviderAdapter.ts",
"start": 47,
"end": 71,
"start": 67,
"end": 94,
"language": "typescript",
"label": "Provider adapter lifecycle contract"
},
{
"id": "provider-adapter-interactions",
"path": "apps/server/src/provider/Services/ProviderAdapter.ts",
"start": 73,
"end": 94,
"start": 97,
"end": 117,
"language": "typescript",
"label": "Provider approval and input contract"
},
{
"id": "provider-adapter-stream",
"path": "apps/server/src/provider/Services/ProviderAdapter.ts",
"start": 126,
"end": 134,
"start": 149,
"end": 157,
"language": "typescript",
"label": "Canonical provider event stream"
},
Expand Down Expand Up @@ -395,7 +396,7 @@
"id": "usage-web-context-meter",
"path": "apps/web/src/lib/contextWindow.ts",
"start": 50,
"end": 96,
"end": 90,
"language": "typescript",
"label": "Latest valid context-window snapshot derivation"
},
Expand Down Expand Up @@ -1258,8 +1259,8 @@
{
"id": "resource-telemetry-demand-history",
"path": "docs/internals/resource-telemetry.md",
"start": 129,
"end": 170,
"start": 9,
"end": 50,
"language": "markdown",
"label": "Bounded native history and diagnostics-driven telemetry streaming"
},
Expand Down Expand Up @@ -1290,8 +1291,8 @@
{
"id": "connect-environment-link-handshake",
"path": "apps/web/src/cloud/linkEnvironment.ts",
"start": 402,
"end": 493,
"start": 256,
"end": 347,
"language": "typescript",
"label": "Client-side relay challenge, environment proof, link, and runtime setup"
},
Expand Down
49 changes: 22 additions & 27 deletions sources/references.manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

[
{
"id": "rpc-group",
Expand Down Expand Up @@ -662,10 +663,8 @@
{
"id": "stale-startup-overview",
"path": "docs/internals/overview.md",
"start": 124,
"end": 130,
"kind": "file",
"label": "stale documented startup sequence"
"label": "current server boundaries and startup constraints"
},
{
"id": "orchestration-snapshot-contracts",
Expand Down Expand Up @@ -1022,10 +1021,8 @@
{
"id": "auth-doc-ticket-overclaim",
"path": "docs/internals/environment-auth.md",
"start": 95,
"end": 111,
"kind": "file",
"label": "documentation claim that WebSocket tickets carry scopes"
"label": "current environment authentication contract"
},
{
"id": "decider-effect-dependencies",
Expand Down Expand Up @@ -1634,8 +1631,8 @@
{
"id": "provider-adapter-registry-live",
"path": "apps/server/src/provider/Layers/ProviderAdapterRegistry.ts",
"start": 36,
"end": 100,
"start": 30,
"end": 85,
"kind": "file",
"label": "live adapter facade excludes unavailable instances"
},
Expand Down Expand Up @@ -1778,8 +1775,8 @@
{
"id": "codex-app-server-child-process",
"path": "packages/effect-codex-app-server/src/client.ts",
"start": 212,
"end": 268,
"start": 213,
"end": 264,
"kind": "file",
"label": "Codex app-server child process and stdio client construction"
},
Expand Down Expand Up @@ -2166,8 +2163,8 @@
{
"id": "claude-provider-skills-commands",
"path": "apps/server/src/provider/Layers/ClaudeProvider.ts",
"start": 920,
"end": 962,
"start": 526,
"end": 588,
"kind": "file",
"label": "Claude snapshot combines discovered skills and initialization commands"
},
Expand Down Expand Up @@ -2334,16 +2331,16 @@
{
"id": "turn-lifecycle-settlement-guards",
"path": "packages/client-runtime/src/state/threadSettled.ts",
"start": 286,
"end": 312,
"start": 14,
"end": 45,
"kind": "file",
"label": "Thread settlement eligibility guards"
"label": "queued turn-start guard used by thread lifecycle decisions"
},
{
"id": "turn-lifecycle-waiting-ui-test",
"path": "apps/web/src/components/chat/ComposerPrimaryActions.test.tsx",
"start": 214,
"end": 219,
"start": 95,
"end": 109,
"kind": "file",
"label": "Stop action retained while provider waits for input"
},
Expand Down Expand Up @@ -2957,7 +2954,7 @@
},
{
"id": "workbench-terminal-mobile",
"path": "apps/mobile/src/features/terminal/ThreadTerminalPanel.tsx",
"path": "apps/mobile/src/features/terminal/ThreadTerminalRouteScreen.tsx",
"start": 31,
"end": 210,
"kind": "file",
Expand Down Expand Up @@ -3463,7 +3460,7 @@
"id": "client-connection-resolver",
"path": "packages/client-runtime/src/connection/resolver.ts",
"start": 51,
"end": 280,
"end": 252,
"kind": "file",
"label": "Target-specific preparation into a prepared connection"
},
Expand Down Expand Up @@ -3951,7 +3948,7 @@
"id": "release-server-update-architecture",
"path": "docs/internals/server-updates.md",
"start": 1,
"end": 99,
"end": 58,
"kind": "file",
"label": "Stable launcher, reversible trial, database snapshot, and client correlation"
},
Expand Down Expand Up @@ -3991,7 +3988,7 @@
"id": "telemetry-browser-client-tracing",
"path": "apps/web/src/observability/clientTracing.ts",
"start": 16,
"end": 133,
"end": 125,
"kind": "file",
"label": "Web tracer delegates OTLP batches through the selected primary environment"
},
Expand All @@ -4007,7 +4004,7 @@
"id": "telemetry-resource-architecture",
"path": "docs/internals/resource-telemetry.md",
"start": 1,
"end": 352,
"end": 51,
"kind": "file",
"label": "Native resource telemetry topology, demand, retention, and packaging"
},
Expand Down Expand Up @@ -4043,7 +4040,7 @@
"id": "access-connection-resolver",
"path": "packages/client-runtime/src/connection/resolver.ts",
"start": 51,
"end": 277,
"end": 252,
"kind": "file",
"label": "Route-specific target resolution into a common prepared connection"
},
Expand Down Expand Up @@ -4146,10 +4143,8 @@
{
"id": "remote-explicit-future-work",
"path": "docs/internals/remote.md",
"start": 223,
"end": 229,
"kind": "file",
"label": "Explicitly unbuilt remote endpoint-provider, callback-broker, and multi-environment work"
"label": "Current remote endpoint, SSH, Tailscale, and T3 Connect architecture"
},
{
"id": "plan-ui-transition",
Expand All @@ -4163,7 +4158,7 @@
"id": "plan-ui-capability-filter",
"path": "apps/web/src/providerModels.ts",
"start": 80,
"end": 112,
"end": 108,
"kind": "file",
"label": "Legacy plan-mode capability filtering before model dispatch"
},
Expand Down
17 changes: 9 additions & 8 deletions sources/t3code.lock.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@

{
"repository": "https://github.com/pingdotgg/t3code",
"commit": "fa219001dc2f14cfd9c7774c2c03c153359144be",
"shortCommit": "fa219001d",
"commit": "859304b7808ab9a4be87b1bddcd07c6485bf9c4f",
"shortCommit": "859304b78",
"branch": "main",
"capturedAt": "2026-08-24T00:00:00+03:00",
"capturedAt": "2026-09-11T00:00:00+03:00",
"sourceDirHint": "../t3code",
"inventoryRulesVersion": 1,
"productionFiles": 1844,
"productionLines": 533213,
"testFiles": 881,
"testLines": 247766,
"notes": "Recomputed from pinned Git objects by scripts/inventory-source.mjs. Counts include tracked implementation/build source extensions, exclude assets and .repos, and classify test/spec/fixture paths separately; generated protocol source remains included."
"productionFiles": 2288,
"productionLines": 669059,
"testFiles": 1170,
"testLines": 404139,
"notes": "Recomputed from pinned Git objects by scripts/inventory-source.mjs. Counts include tracked implementation and build-source extensions, exclude assets and .repos, and classify tests, specs, and fixtures separately."
}
Loading