---
name: t3-code-engineering-rules
description: "Evidence-backed engineering rules for T3 Code, generated by Everdoc from static analysis and git history: boundaries, contracts, co-change, hotspots, docs hygiene. Use when editing, reviewing, or planning changes in this repository."
---

# T3 Code engineering rules

Generated by Everdoc from T3 Code @ [`c0eed7328db2`](https://github.com/pingdotgg/t3code/tree/c0eed7328db2609e5a535be704e90638aef1c111) (v0.1.14) by static analysis and the last 2,000 commits; no LLM. Every rule cites the counts it rests on. Regenerate instead of editing by hand.

Follow these rules when changing this repository. Each states the constraint, then the observed ratio it rests on, then evidence.

## Boundaries

- **Point dependencies down the layer stack.** Apps and CLIs may depend on adapters, libraries, and contracts, never the reverse: 22 of 27 layered workspace edges (81.5%) comply; fix the 5 upward edges listed below. _(error, confidence 81.5%, 27 observations)_
  - @t3tools/client-runtime (library) → provider-* (adapter)
  - @t3tools/client-runtime (library) → secret-provider-* (adapter)
  - @t3tools/client-runtime (library) → source-control-* (adapter)
  - …and 2 more
- **Keep `@t3tools/contracts` a leaf contract package.** `@t3tools/contracts` must not import apps, adapters, or libraries: 36 workspaces depend on it, and it imports no other workspace. _(warning, confidence 100%, 36 observations)_
  - Imported by @t3tools/client-runtime ([`packages/client-runtime/package.json`](https://github.com/pingdotgg/t3code/blob/c0eed7328db2609e5a535be704e90638aef1c111/packages/client-runtime/package.json))
  - Imported by @t3tools/desktop ([`apps/desktop/package.json`](https://github.com/pingdotgg/t3code/blob/c0eed7328db2609e5a535be704e90638aef1c111/apps/desktop/package.json))
  - Imported by @t3tools/evals ([`evals/package.json`](https://github.com/pingdotgg/t3code/blob/c0eed7328db2609e5a535be704e90638aef1c111/evals/package.json))
  - …and 7 more

## Contracts

- **Pair every new RPC with a handler.** 97.3% of RPCs (291/299) are paired with handlers — do not leave new RPCs unhandled; 8 current orphans listed below. _(warning, confidence 97.3%, 299 observations)_
  - authenticate has no handler (1 caller) ([`packages/effect-acp/src/rpc.ts:153`](https://github.com/pingdotgg/t3code/blob/c0eed7328db2609e5a535be704e90638aef1c111/packages/effect-acp/src/rpc.ts#L153))
  - feedback::Command.close has no handler (0 callers) ([`native/hyprland-snap-shot/src/feedback.rs:71`](https://github.com/pingdotgg/t3code/blob/c0eed7328db2609e5a535be704e90638aef1c111/native/hyprland-snap-shot/src/feedback.rs#L71))
  - logout has no handler (1 caller) ([`packages/effect-acp/src/rpc.ts:159`](https://github.com/pingdotgg/t3code/blob/c0eed7328db2609e5a535be704e90638aef1c111/packages/effect-acp/src/rpc.ts#L159))
  - …and 5 more
- **Pair every new IPC channel with a handler.** 96.2% of IPC channels (127/132) are paired with handlers — do not leave new IPC channels unhandled; 5 current orphans listed below. _(warning, confidence 96.2%, 132 observations)_
  - preview:annotation-voice-event has no handler (1 caller) ([`apps/desktop/src/preview/PickPreload.ts:797`](https://github.com/pingdotgg/t3code/blob/c0eed7328db2609e5a535be704e90638aef1c111/apps/desktop/src/preview/PickPreload.ts#L797))
  - preview:element-picked has no handler (2 callers) ([`apps/desktop/src/preview/PickPreload.ts:1815`](https://github.com/pingdotgg/t3code/blob/c0eed7328db2609e5a535be704e90638aef1c111/apps/desktop/src/preview/PickPreload.ts#L1815))
  - preview:human-input has no handler (3 callers) ([`apps/desktop/src/preview/PickPreload.ts:205`](https://github.com/pingdotgg/t3code/blob/c0eed7328db2609e5a535be704e90638aef1c111/apps/desktop/src/preview/PickPreload.ts#L205))
  - …and 2 more
- **Remove or wire RPCs nothing calls.** 93.1% of handled RPCs (271/291) have a caller in the repository; 20 RPCs have a handler but no caller — confirm an external client uses them or delete them. _(info, confidence 93.1%, 291 observations)_
  - _session/elicitation has 2 handlers and no caller ([`packages/effect-acp/src/rpc.ts:404`](https://github.com/pingdotgg/t3code/blob/c0eed7328db2609e5a535be704e90638aef1c111/packages/effect-acp/src/rpc.ts#L404))
  - feedback::Command.animate has 1 handler and no caller ([`native/hyprland-snap-shot/src/feedback.rs:72`](https://github.com/pingdotgg/t3code/blob/c0eed7328db2609e5a535be704e90638aef1c111/native/hyprland-snap-shot/src/feedback.rs#L72))
  - fs/read_text_file has 2 handlers and no caller ([`packages/effect-acp/src/rpc.ts:358`](https://github.com/pingdotgg/t3code/blob/c0eed7328db2609e5a535be704e90638aef1c111/packages/effect-acp/src/rpc.ts#L358))
  - …and 7 more
- **Define new RPCs in `@t3tools/contracts`.** Define new RPCs in `@t3tools/contracts` (packages/contracts): 91.6% of RPCs (274/299) live there. _(info, confidence 91.6%, 299 observations)_
  - effect-acp defines 14 RPCs ([`packages/effect-acp/src/rpc.ts`](https://github.com/pingdotgg/t3code/blob/c0eed7328db2609e5a535be704e90638aef1c111/packages/effect-acp/src/rpc.ts))
  - t3-resource-monitor defines 9 RPCs ([`native/resource-monitor/src/main.rs`](https://github.com/pingdotgg/t3code/blob/c0eed7328db2609e5a535be704e90638aef1c111/native/resource-monitor/src/main.rs))
  - t3-hyprland-snap-shot defines 2 RPCs ([`native/hyprland-snap-shot/src/feedback.rs`](https://github.com/pingdotgg/t3code/blob/c0eed7328db2609e5a535be704e90638aef1c111/native/hyprland-snap-shot/src/feedback.rs))
- **Pair every new HTTP route with a handler.** 97.4% of HTTP routes (114/117) are paired with handlers — do not leave new HTTP routes unhandled. _(info, confidence 97.4%, 117 observations)_

## Co-change

- **Change `apps/mobile/src/features/home/HomeScreen.tsx` together with `apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx`.** When modifying `apps/mobile/src/features/home/HomeScreen.tsx`, also inspect/update `apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx` — co-changed in 10/10 commits (100%). _(warning, confidence 100%, 10 observations)_
  - feat(search): stop subagents and remote delegates from flooding multi-environment search (#47191) ([#47191](https://github.com/pingdotgg/t3code/pull/47191), 2026-12-04)
  - feat(mobile): thread list shares the web sidebar's model, shelves and row details (#48707) ([#48707](https://github.com/pingdotgg/t3code/pull/48707), 2026-12-04)
  - fix(web): sidebar threads in a checkout without an icon show their project's icon (#48931) ([#48931](https://github.com/pingdotgg/t3code/pull/48931), 2026-12-04)
  - …and 2 more
- **Change `apps/mobile/src/state/queries.ts` together with `apps/web/src/state/queries.ts`.** When modifying `apps/mobile/src/state/queries.ts`, also inspect/update `apps/web/src/state/queries.ts` — co-changed in 5/7 commits (71.4%). _(warning, confidence 71.4%, 5 observations)_
  - feat(search): stop subagents and remote delegates from flooding multi-environment search (#47191) ([#47191](https://github.com/pingdotgg/t3code/pull/47191), 2026-12-04)
  - fix(git): preserve Unicode whitespace in branch names and queries (#46205) ([#46205](https://github.com/pingdotgg/t3code/pull/46205), 2026-11-30)
  - fix(web): @ file search keeps its results while a longer query loads (#45614) ([#45614](https://github.com/pingdotgg/t3code/pull/45614), 2026-11-30)
  - …and 2 more
- **Change `packages/contracts/src/rpc.ts` together with `apps/server/src/ws.ts`.** When modifying `packages/contracts/src/rpc.ts`, also inspect/update `apps/server/src/ws.ts` — co-changed in 5/7 commits (71.4%). _(warning, confidence 71.4%, 5 observations)_
  - perf(server): clients get a smaller server config and fewer provider pushes (#46798) ([#46798](https://github.com/pingdotgg/t3code/pull/46798), 2026-12-05)
  - feat: move threads between projects and recover missing workspace folders (#47234) ([#47234](https://github.com/pingdotgg/t3code/pull/47234), 2026-12-01)
  - perf(client-runtime,server,mobile): pipeline shell sync on opening session and avoid redundant reconnect work (#46295) ([#46295](https://github.com/pingdotgg/t3code/pull/46295), 2026-11-30)
  - …and 2 more
- **Change `apps/mobile/src/features/threads/use-worktree-setup.ts` together with `apps/web/src/components/chat/useWorktreeSetup.ts`.** When modifying `apps/mobile/src/features/threads/use-worktree-setup.ts`, also inspect/update `apps/web/src/components/chat/useWorktreeSetup.ts` — co-changed in 4/4 commits (100%). _(warning, confidence 100%, 4 observations)_
  - fix(web): worktree setup progress clears after reconnecting once setup has ended (#47540) ([#47540](https://github.com/pingdotgg/t3code/pull/47540), 2026-12-02)
  - fix(client-runtime): show setup script failures that finish after a follow-up (#47563) ([#47563](https://github.com/pingdotgg/t3code/pull/47563), 2026-12-02)
  - fix(web): opening a thread after checkout fails shows the worktree setup details (#47530) ([#47530](https://github.com/pingdotgg/t3code/pull/47530), 2026-12-02)
  - …and 1 more
- **Change `apps/mobile/src/features/home/HostPressurePill.tsx` together with `apps/web/src/components/sidebar/SidebarHostPressureWarning.tsx`.** When modifying `apps/mobile/src/features/home/HostPressurePill.tsx`, also inspect/update `apps/web/src/components/sidebar/SidebarHostPressureWarning.tsx` — co-changed in 4/5 commits (80%). _(warning, confidence 80%, 4 observations)_
  - fix(web,mobile): memory warning names the machine first (#49406) ([#49406](https://github.com/pingdotgg/t3code/pull/49406), 2026-12-05)
  - feat(web): dismiss the overload notice from the sidebar pill (#45775) ([#45775](https://github.com/pingdotgg/t3code/pull/45775), 2026-11-29)
  - fix: a machine overloaded on both CPU and I/O no longer reads "Machine overloaded · Machine overloaded" (#45531) ([#45531](https://github.com/pingdotgg/t3code/pull/45531), 2026-11-29)
  - …and 1 more
- **Change `apps/server/src/vcs/GitVcsDriver.ts` together with `apps/server/src/vcs/GitVcsDriverCore.ts`.** When modifying `apps/server/src/vcs/GitVcsDriver.ts`, also inspect/update `apps/server/src/vcs/GitVcsDriverCore.ts` — co-changed in 12/17 commits (70.6%). _(info, confidence 70.6%, 12 observations)_
  - fix(server): isolate passive Git status reads (#49270) ([#49270](https://github.com/pingdotgg/t3code/pull/49270), 2026-12-04)
  - fix: TanStack Source private PRs load, link and open on Source (#49105) ([#49105](https://github.com/pingdotgg/t3code/pull/49105), 2026-12-04)
  - fix(server): finish worktree recovery that a stopped turn interrupted (#47694) ([#47694](https://github.com/pingdotgg/t3code/pull/47694), 2026-12-02)
  - …and 2 more
- **Change `apps/desktop/src/preview/DesktopBrowserHost.ts` together with `apps/desktop/src/preview/Manager.ts`.** When modifying `apps/desktop/src/preview/DesktopBrowserHost.ts`, also inspect/update `apps/desktop/src/preview/Manager.ts` — co-changed in 4/5 commits (80%). _(info, confidence 80%, 4 observations)_
  - fix(desktop): mute hidden browser previews (#49425) ([#49425](https://github.com/pingdotgg/t3code/pull/49425), 2026-12-05)
  - fix(desktop): preview screenshots no longer come out transparent (#48711) ([#48711](https://github.com/pingdotgg/t3code/pull/48711), 2026-12-05)
  - fix(desktop): browser downloads no longer go missing from Downloads (#47366) ([#47366](https://github.com/pingdotgg/t3code/pull/47366), 2026-12-02)
  - …and 1 more
- **Change `apps/mobile/src/features/threads/ThreadDetailScreen.tsx` together with `apps/mobile/src/features/threads/ThreadFeed.tsx`.** When modifying `apps/mobile/src/features/threads/ThreadDetailScreen.tsx`, also inspect/update `apps/mobile/src/features/threads/ThreadFeed.tsx` — co-changed in 4/5 commits (80%). _(info, confidence 80%, 4 observations)_
  - feat(chat): add previewed files to the draft (#47797) ([#47797](https://github.com/pingdotgg/t3code/pull/47797), 2026-12-05)
  - feat: move threads between projects and recover missing workspace folders (#47234) ([#47234](https://github.com/pingdotgg/t3code/pull/47234), 2026-12-01)
  - feat(chat): cite text from proposed plans (#44977) ([#44977](https://github.com/pingdotgg/t3code/pull/44977), 2026-12-01)
  - …and 1 more
- **Change `@t3tools/provider-core` together with `t3`.** When modifying `@t3tools/provider-core`, also inspect/update `t3` — co-changed in 16/24 commits (66.7%). _(info, confidence 66.7%, 16 observations)_
  - fix(server): tighten server process environment, token routing, redirects and stop scope (#46617) ([#46617](https://github.com/pingdotgg/t3code/pull/46617), 2026-12-05)
  - feat: Labs MCP gateway serves T3-signed-in MCP servers to every agent (#47943) ([#47943](https://github.com/pingdotgg/t3code/pull/47943), 2026-12-04)
  - fix(server): portable handoffs keep conversation turns ahead of command output (#48951) ([#48951](https://github.com/pingdotgg/t3code/pull/48951), 2026-12-04)
  - …and 2 more
- **Change `app-t3uikit` together with `@t3tools/mobile-nitro`.** When modifying `app-t3uikit`, also inspect/update `@t3tools/mobile-nitro` — co-changed in 4/4 commits (100%). _(info, confidence 100%, 4 observations)_
  - feat(mobile-nitro): model picker folds older models behind "Show more" (#49312) ([#49312](https://github.com/pingdotgg/t3code/pull/49312), 2026-12-05)
  - fix(mobile-nitro): model picker lists scroll on their own with the options pinned (#49296) ([#49296](https://github.com/pingdotgg/t3code/pull/49296), 2026-12-05)
  - fix(mobile-nitro): new-thread draft screens match the React Native app (#49239) ([#49239](https://github.com/pingdotgg/t3code/pull/49239), 2026-12-05)
  - …and 1 more

## Hotspots

- **Test `apps/server/src/vcs/GitVcsDriverCore.ts` before editing.** `apps/server/src/vcs/GitVcsDriverCore.ts` absorbed 33 bug fixes recently — verify edge cases and run targeted tests before editing. _(warning, confidence 94.3%, 35 observations)_
  - fix(web): find comparison branches when a Greek search prefix ends in sigma (#49260) ([#49260](https://github.com/pingdotgg/t3code/pull/49260), 2026-12-04)
  - fix(server): use consistent SSH settings for automatic Git refreshes (#49273) ([#49273](https://github.com/pingdotgg/t3code/pull/49273), 2026-12-04)
  - fix(server): isolate passive Git status reads (#49270) ([#49270](https://github.com/pingdotgg/t3code/pull/49270), 2026-12-04)
  - …and 2 more
- **Test `packages/shared/src/markdownChunks.ts` before editing.** `packages/shared/src/markdownChunks.ts` absorbed 32 bug fixes recently — verify edge cases and run targeted tests before editing. _(warning, confidence 100%, 32 observations)_
  - fix(shared): keep footnotes in Markdown price ranges (#49115) ([#49115](https://github.com/pingdotgg/t3code/pull/49115), 2026-12-05)
  - fix(shared): keep footnotes with nonbreaking spaces linked in long Markdown files (#49077) ([#49077](https://github.com/pingdotgg/t3code/pull/49077), 2026-12-04)
  - fix(shared): long Markdown previews link footnotes indented with a tab in list items (#49046) ([#49046](https://github.com/pingdotgg/t3code/pull/49046), 2026-12-04)
  - …and 2 more
- **Test `apps/server/src/orchestration-v2/Orchestrator.ts` before editing.** `apps/server/src/orchestration-v2/Orchestrator.ts` absorbed 30 bug fixes recently — verify edge cases and run targeted tests before editing. _(warning, confidence 73.2%, 41 observations)_
  - fix(server): an unsettle in the same turn cancels a pending self-settle (#49379) ([#49379](https://github.com/pingdotgg/t3code/pull/49379), 2026-12-05)
  - fix(server): a prompt stopped before provider start can be edited and resent (#49276) ([#49276](https://github.com/pingdotgg/t3code/pull/49276), 2026-12-05)
  - fix(server): t3_thread_list lists delegated tasks by the id task_status takes (#49240) ([#49240](https://github.com/pingdotgg/t3code/pull/49240), 2026-12-04)
  - …and 2 more
- **Test `apps/web/src/components/files/extendedDocumentPreview.ts` before editing.** `apps/web/src/components/files/extendedDocumentPreview.ts` absorbed 30 bug fixes recently — verify edge cases and run targeted tests before editing. _(warning, confidence 100%, 30 observations)_
  - fix(web): keep ODT footnote citation inline on styled paragraphs (#49213) ([#49213](https://github.com/pingdotgg/t3code/pull/49213), 2026-12-04)
  - fix(web): notebook previews show JPEG outputs with large metadata headers (#49062) ([#49062](https://github.com/pingdotgg/t3code/pull/49062), 2026-12-04)
  - fix(web): an empty RTF page-break group no longer starts a new page (#48872) ([#48872](https://github.com/pingdotgg/t3code/pull/48872), 2026-12-04)
  - …and 2 more
- **Test `apps/server/src/provider/documentTextWorker.ts` before editing.** `apps/server/src/provider/documentTextWorker.ts` absorbed 27 bug fixes recently — verify edge cases and run targeted tests before editing. _(warning, confidence 100%, 27 observations)_
  - fix(server): extract text from Mac Cyrillic RTF attachments (#48783) ([#48783](https://github.com/pingdotgg/t3code/pull/48783), 2026-12-04)
  - fix(server): EPUB text skips hidden map groups that also set a transform (#48478) ([#48478](https://github.com/pingdotgg/t3code/pull/48478), 2026-12-03)
  - fix(server): a large footnote no longer erases a DOCX attachment's body text (#48479) ([#48479](https://github.com/pingdotgg/t3code/pull/48479), 2026-12-03)
  - …and 2 more

## Docs hygiene

- **Fix broken documentation links.** Fix 1 broken link in 1 guide and check links when moving files: 99.8% of 509 doc links resolve. _(warning, confidence 99.8%, 509 observations)_
  - docs/operations/04_observability.md: `../user/telemetry.md#export-diagnostics-to-your-own-receiver` does not resolve ([`docs/operations/04_observability.md:44`](https://github.com/pingdotgg/t3code/blob/c0eed7328db2609e5a535be704e90638aef1c111/docs/operations/04_observability.md#L44))
- **Update guides that mention changed code.** When changing an entity a guide mentions, update the guide in the same change: 40 guides mention code modified after the guide's last edit (46/87 are fresh). _(info, confidence 52.9%, 87 observations)_
  - docs/internals/02_effect-services.md: `make` is defined in scripts/build-desktop-artifact.ts, changed 2026-12-05 after this page (2026-11-23) ([`docs/internals/02_effect-services.md:41`](https://github.com/pingdotgg/t3code/blob/c0eed7328db2609e5a535be704e90638aef1c111/docs/internals/02_effect-services.md#L41))
  - docs/internals/04_environment-auth.md: `pull_request_create` is defined in apps/server/src/mcp/toolkits/pullRequests/tools.ts, changed 2026-12-04 after this page (2026-11-27) ([`docs/internals/04_environment-auth.md:76`](https://github.com/pingdotgg/t3code/blob/c0eed7328db2609e5a535be704e90638aef1c111/docs/internals/04_environment-auth.md#L76))
  - docs/internals/04_environment-auth.md: `T3CODE_DEV_AUTH_TOKEN` is defined in apps/server/src/cli/config.ts, changed 2026-12-04 after this page (2026-11-27) ([`docs/internals/04_environment-auth.md:137`](https://github.com/pingdotgg/t3code/blob/c0eed7328db2609e5a535be704e90638aef1c111/docs/internals/04_environment-auth.md#L137))
  - …and 7 more
