Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

t3-codemode

t3cm is a Code Mode MCP service for T3 Code, in the style of Cloudflare’s Code Mode. It puts T3’s MCP tools, and the tools of any other MCP servers you configure (upstreams), behind two tools, search and execute. Instead of 74 tool schemas (about 166k chars of JSON) in every session, a client sees two tools (about 3.3k chars for the whole tools/list). The model finds what it needs with code over a catalog, then runs code against that catalog in a sandbox.

Beyond T3’s tools, the sandbox carries:

  • any other MCP server as an upstream, under its own namespace,
  • a persistent memory store (mem, vars),
  • a thread-workflow layer (wf): parent and child links between threads, gates, wakes and a watcher that nudges stalled threads,
  • a local web board that acts as the root overseer for ticket threads.

Status: prototype. It builds and passes its tests on Linux, macOS and Windows, and installs as a per-user service on each: a systemd user unit, a launchd agent, or a logon task.

Where to go next

  • Getting started: requirements, install on each OS, and the t3cm commands.
  • Configuration: the config file, its defaults, and where state lives.
  • The two tools: search and execute, with examples.
  • Execute globals: t3, upstream namespaces, tools, mem, vars, wf and console.
  • The board: decision cards, the feed, the ask box and the HTTP routes.
  • Upstreams: wrap any MCP server over stdio or HTTP.
  • Security model: what the service trusts and what it shuts out.
  • Troubleshooting: the usual failures and how to read them.
  • API reference: the TypeScript declarations the site build generates from t3cm types.
  • Contributing: the contribution guide, the security policy and the development checks.

CI builds this site from the docs/ directory of the repository and redeploys it on every push to main.

Getting started

Requirements

  • Linux with systemd user services, macOS, or Windows (x86_64; Arm64 runs it under emulation). Windows release binaries are paused until we have a code-signing certificate, so v0.6.0 is the last release with a Windows archive.
  • A running T3 Code server and its t3 CLI.
  • curl and tar for deploy/install.sh; Windows PowerShell 5.1 or newer for deploy/install.ps1.
  • Claude Code or T3 Code Antigravity profiles, if you want the installer to register the MCP server for you.
  • gh, signed in, if you want the installer to check build provenance.
  • Rust 1.95 or newer, only to build from source. oxc is pinned to =0.146.0 because later releases need a newer compiler.

Install

The installers fetch the latest release from Releases, check the archive against the release’s SHA256SUMS, and, when gh is signed in, check its build provenance with gh attestation verify. Then they install the binary and a per-user service, start it, and register the MCP server with Claude Code and any T3 Antigravity profiles. Last, they ask Use the T3 workflow? [Y/n], and on yes run t3cm skills install, described below. Nothing needs administrator rights. Release builds came in with #2.

Linux and macOS

curl -fsSLO https://raw.githubusercontent.com/OttoOps/t3-codemode/main/deploy/install.sh
bash install.sh                     # latest release
bash install.sh --version v0.4.0    # a given release

On Linux the installer picks the static musl build, which runs on any distro. --target x86_64-unknown-linux-gnu (or aarch64-unknown-linux-gnu) picks the glibc build, which needs glibc 2.39 or newer. On a Mac it picks the Mac’s own architecture, under Rosetta too.

Releases sign the macOS binaries with a Developer ID and notarize them with Apple, so Gatekeeper lets them run when a browser download quarantines the archive. A bare binary can’t carry a stapled ticket, so Gatekeeper fetches the notarization ticket online the first time it checks one. To check a binary yourself:

codesign --verify --strict --verbose=2 ~/.local/bin/t3cm
spctl --assess --type open --context context:primary-signature --verbose=2 ~/.local/bin/t3cm

The second command should print source=Notarized Developer ID.

On macOS, install from a GUI login: launchd loads the agent into your login session. Over SSH alone, use --files-only and run the launchctl bootstrap command it prints once you log in.

When no v* release is published yet, the default install stops and says so. Build from a clone instead:

git clone https://github.com/OttoOps/t3-codemode && cd t3-codemode
deploy/install.sh --from-source

Windows

Windows release binaries are paused until we have a code-signing certificate, and CI no longer builds or tests on Windows (#123). v0.6.0 is the last release with a Windows archive, so install that version by name. Once a newer release is out, a plain install.ps1 or t3cm update finds no Windows archive to fetch.

In PowerShell:

Invoke-WebRequest https://raw.githubusercontent.com/OttoOps/t3-codemode/main/deploy/install.ps1 -OutFile install.ps1 -UseBasicParsing
powershell -ExecutionPolicy Bypass -File install.ps1 -Version v0.6.0   # the last Windows release

The Windows installer does not add t3cm to PATH, so run it by its full path: & "$env:LOCALAPPDATA\Programs\t3-codemode\t3cm.exe" status. Windows has no source install; it needs a published release.

Other ways in

  • install.sh --archive t3cm-<version>-<target>.tar.gz --sums SHA256SUMS (install.ps1 -Archive t3cm-<version>-x86_64-pc-windows-msvc.zip -Sums SHA256SUMS) installs an archive you already downloaded. It checks the checksum, not the provenance; run gh attestation verify <archive> -R OttoOps/t3-codemode for that.
  • deploy/install.sh --from-source, from a clone, builds with cargo build --profile dist --locked --bin t3cm instead (Linux and macOS).
  • --files-only (-FilesOnly) installs or removes the files without touching systemd, launchd or Task Scheduler, and prints the command that starts the service.
  • --workflow and --no-workflow (-Workflow, -NoWorkflow) answer the workflow question for an unattended run. With no terminal to ask on, the answer is yes. When t3cm installed the skills before, the installer brings them to the new release without asking. When npx skills or a copy by hand installed them, it asks whether to replace them, yes by default, and on yes runs t3cm skills install --take-over.

What it installs

OSBinaryServiceLogs
Linux~/.local/bin/t3cmsystemd user unit t3-codemode (deploy/t3-codemode.service)journalctl --user -u t3-codemode
macOS~/.local/bin/t3cmlaunchd agent com.ottoops.t3-codemode in ~/Library/LaunchAgents/~/Library/Logs/t3-codemode/t3cm.log
Windows%LOCALAPPDATA%\Programs\t3-codemode\t3cm.exescheduled task t3-codemode, at logon%LOCALAPPDATA%\t3-codemode\logs\t3cm.log

Each runs t3cm serve on 127.0.0.1:47731 and restarts it when it fails. The systemd unit also sets LimitNOFILE=1048576, MemoryHigh=1G and MemoryMax=1536M. The Windows task runs as you, not elevated, starts at logon and then every five minutes, and does nothing while t3cm is still running, so a dead server comes back within five minutes. To stop it for good, run Disable-ScheduledTask t3-codemode and then Stop-ScheduledTask t3-codemode. When ~/.local/bin is not on your PATH, the Linux and macOS installer says so.

To update, run the installer again, or run t3cm update. Either one also brings the skills t3cm installed to the new release. To uninstall, run bash install.sh --uninstall or install.ps1 -Uninstall. It stops and removes the service and the binary, and keeps the store and the skills.

Uninstalling also removes Claude Code’s user-scope t3cm MCP entry, even one you added yourself before installing, and removes the t3cm entry from each T3 Antigravity profile’s mcp_config.json while keeping other servers intact.

Register the MCP server

Claude Code

The installers run this for you. When claude is not on PATH, they print it for you to run. When Claude Code already has a server named t3cm, they leave that entry alone.

claude mcp add --transport http --scope user t3cm http://127.0.0.1:47731/mcp \
  --header 'X-T3-Thread: ${T3CODE_THREAD_ID}' --header 'X-T3-Config-Dir: ${CLAUDE_CONFIG_DIR:-}'

In PowerShell, run it on one line:

claude mcp add --transport http --scope user t3cm http://127.0.0.1:47731/mcp --header 'X-T3-Thread: ${T3CODE_THREAD_ID}' --header 'X-T3-Config-Dir: ${CLAUDE_CONFIG_DIR:-}'

Keep the headers in single quotes in either shell. Claude Code expands them when it connects, so each T3 thread reaches the service as itself. The thread header is how mem, vars and wf know which thread is calling. The config folder header tells the service which Claude config folder the session runs from (empty means ~/.claude), so slots resolve to the skills that session has installed and enabled. t3cm skills update re-registers an existing entry that lacks it (setup step mcp:config-dir-header); new sessions send it.

Antigravity

The installers also register t3cm for every Antigravity profile T3 Code creates under ~/.t3/userdata/providers/antigravity/<hash>/config/mcp_config.json, or under $T3CODE_HOME when that variable is set. Existing installs receive the same entry from t3cm update or t3cm skills update through setup step mcp:antigravity. The edit merges into existing JSON, keeps other servers and top-level keys, merges the eager tool flags into an existing t3cm stdio entry while keeping its custom path and settings, and leaves any incompatible t3cm entry alone.

{
  "mcpServers": {
    "t3cm": {
      "command": "/path/to/t3cm",
      "args": ["stdio"],
      "tools": {
        "search": { "eager": true },
        "execute": { "eager": true }
      }
    }
  }
}

Antigravity registers t3cm stdio because Antigravity sends environment variable expressions verbatim inside HTTP headers and stdio env blocks. T3 Code launches one antigravity acp process per thread with its own T3CODE_THREAD_ID, and t3cm stdio inherits that variable directly while sharing store.db in SQLite WAL mode with t3cm serve. Setting eager to true on search and execute loads both tools on turn one without an extra schema read.

Edit <profile>/config/mcp_config.json directly as JSON. T3 Code starts Antigravity with --gemini-dir <profile> and GEMINI_HOME=<profile>, so Antigravity threads ignore ~/.gemini/config/mcp_config.json, and antigravity mcp add ignores GEMINI_HOME and always writes to ~/.gemini/config/mcp_config.json.

T3 system text-generation caveat. When <profile>/config/mcp_config.json has a non-empty mcpServers object, T3 Code stops using that Antigravity profile as its system text-generation model for helper tasks such as title generation. Antigravity agent threads continue to run as normal. Pick another provider as T3’s system model if you used Antigravity there, or remove t3cm from mcpServers when no other servers remain in that object to restore Antigravity text generation.

Each Antigravity thread spawns its own t3cm stdio child against the shared store.db. Writes commit immediately and appear on the board on its next refresh or watcher pass, and any stdio upstreams configured in t3cm start once per Antigravity thread. See the Antigravity research notes for the full multi-process details.

Check it

t3cm status

t3cm status prints the running service’s /healthz. t3.connected is true once the service holds a T3 session, and tools counts the T3 tools in the catalog. Claude Code and Antigravity load MCP servers at session start, so threads that were already open keep their old tool list until a new session starts.

Update

t3cm update          # install the latest release and restart the service on it
t3cm update --check  # only say whether a newer release is out

t3cm update (or t3cm upgrade) finds the latest release, downloads this machine’s archive, and checks it against the release’s SHA256SUMS and, with gh signed in, its build provenance, as the installers do. It replaces the binary in place and keeps the old one next to it as t3cm.old.

When the service is running, t3cm update restarts it: on Linux with systemctl --user restart, on macOS with launchctl kickstart -k, and on Windows with the scheduled task’s /End and /Run. Under systemd, runs in flight finish first, up to systemd’s stop timeout. On macOS and Windows the restart ends runs in flight. The board reconnects by itself. The update then waits for /healthz to report the new version. If the service stops or does not report it within 45 seconds, t3cm update puts the old binary back, restarts the service on it, and exits non-zero. Once the new version serves, it deletes t3cm.old.

When t3cm installed the workflow skills, t3cm update then runs the new binary’s t3cm skills update, so the skills and their setup steps move to the new release with the binary. An update that finds t3cm already current still runs it when the skills or a setup step have drifted. When that sync fails, the new binary stays, t3cm update exits non-zero, and it names the command to run once you fix the cause. It leaves skills that npx skills installed alone and prints the t3cm skills install --take-over command that replaces them.

t3cm update never edits the systemd unit. When a release ships a changed unit, it saves the new one as t3-codemode.service in the state directory and prints the command that installs it. Keep local settings in a drop-in (systemctl --user edit t3-codemode) so that you can copy a new unit over without losing them.

When the service is stopped, or with --no-restart, t3cm update replaces the binary and leaves the service alone. On macOS and Windows it prints the command that restarts the service on the new binary and the one that goes back to t3cm.old. Under systemd it prints the restart command when the service is running, and a stopped service starts on the new binary. Rerun the installer to pick up a changed launchd agent or task. While Windows release binaries are paused, t3cm update on Windows fails once a release newer than v0.6.0 is out, because that release has no Windows archive.

Only one t3cm update runs at a time, and it installs nothing while a service answers with a version other than the binary on disk, for example after an update with --no-restart that the service has not restarted onto yet. When the binary is already current but the service still serves an older version, and the service starts this binary, t3cm update restarts the service and waits for it to report the current one. A service that starts another binary is left alone, and the update names that binary to run update from. With --no-restart, or with no service it can restart, it prints the restart command and exits non-zero instead of reporting t3cm up to date.

--version vX.Y.Z installs that release instead, older ones included, and --no-restart replaces the binary but leaves the running service alone, and keeps t3cm.old. Run it as the installed binary (~/.local/bin/t3cm, or %LOCALAPPDATA%\Programs\t3-codemode\t3cm.exe). A build from a checkout updates with deploy/install.sh --from-source instead.

t3cm --version, t3cm --help and a bare t3cm end with a notice when a newer release is out. The service checks every hour, the CLI at most once a day, and both share the answer in update-check.json in the state directory. The notice goes to stderr, and only when stderr is a terminal, so scripts that read t3cm --version see no change. The board shows the same news in its header; see The board. Set updateCheck to false in the config, or T3CM_NO_UPDATE_CHECK=1, to turn the checks off. They are also off when CI is set.

Commands

CommandDoes
t3cm serve [--port N] [--state-dir D] [--no-watcher] [--log-file F]MCP Streamable HTTP at /mcp, /healthz, /reload, the board at /
t3cm stdio [--state-dir D] [--watcher]MCP over stdio; the caller is $T3CODE_THREAD_ID
t3cm statusThe running service’s /healthz
t3cm exec <file|->, t3cm search <file|->Call the running service’s tools, for humans and scripts
t3cm authAcquire a fresh T3 session now; prints only its expiry
t3cm update [--check] [--version vX.Y.Z] [--no-restart]Install the latest (or a given) release in place and restart the service on it; see Update
t3cm types [--from tools.json]Print the generated TypeScript declarations and their size
t3cm skills install|update|statusInstall the workflow skills this binary carries, bring them to its release, or check them (below)
t3cm slots [--repo D] [--json] [--no-t3]The T3 workflow slots as the service resolves them for this shell’s agent and repository (Slots)
t3cm doctor [--repo D] [--json] [--no-t3] [--resolve NAME]Check the whole workflow install; exits 1 on any problem (Slots)
t3cm board expose|unexpose|pair|sessions|revokeServe the board over Tailscale Serve or stop serving it, pair browsers behind any HTTPS proxy, and end their sessions (Remote access)

--port also reads T3CM_PORT (default 47731), and --state-dir reads T3CM_STATE_DIR. --log-file appends the log to a file instead of stderr and rolls it to <file>.1 at start once it passes 10 MB; the macOS and Windows services use it. t3cm exec takes --session, --timeout-ms and --thread (default $T3CODE_THREAD_ID), and exits non-zero when the script fails. It also sends its own CLAUDE_CONFIG_DIR, CODEX_HOME and GEMINI_HOME, so wf.slot resolves for the agent whose shell runs it.

echo 'async () => (await t3.thread_list({ allProjects: true, limit: 5 })).threads.map(t => t.title)' | t3cm exec -

Slots

The workflow roles’ review, passes, credential renewal, delivery and models are slots. The service resolves them across four layers (defaults, the user config at ~/.config/t3-workflow/config.json or $T3WF_CONFIG, the repository’s AGENTS.md “Agent workflow” block, and the repository’s root .t3-workflow.json), along with the skills the calling agent has installed. It reads the calling thread’s T3 instance and project, and takes the agent’s config folder from what the call reports: the X-T3-Config-Dir header, or t3cm exec’s environment. It records each instance’s folder, so a call that reports none falls back to that record, then to the default folder, and says so in its warnings. Plugins that the folder’s settings.json (or the project’s .claude/settings.json and .claude/settings.local.json) leave out of enabledPlugins do not resolve. Resolutions are stored per project and instance and rebuilt when one of their input files changes.

  • wf.slot(name, { repo?, files? }) gives one slot for the step that needs it, each skill with how to run it or why it is skipped. For delivery, files filters paths-scoped steps against changed repo-relative paths and lists unmatched steps under skipped. See wf.
  • wf.renewal({ output }) matches a failed command’s output against the credentials patterns. The patterns use Python’s regular-expression syntax, lookaround and backreferences included; t3cm doctor names one t3cm cannot compile.
  • t3cm slots prints the same resolution for a person. t3cm doctor checks the slot config’s shape, that every configured skill resolves (for this agent and for each recorded instance), the models and pools, t3cm’s own config, the service and its T3 connection, the skills and setup steps, stale copies of the workflow skills, and leftovers of the t3wf script. t3cm doctor --resolve NAME lists every installed skill a name matches, in search order.

The workflow skills

Agent skills drive the thread-workflow layer. This repo carries five under skills/: t3-workflow, setup-t3-workflow, t3-overseer, t3-ticket and t3-worker. t3-workflow holds the link protocol and routes to the other four. The installers are the only way to get them. They put them in place when you answer yes to the workflow question, and t3cm update keeps them current. On a machine where t3cm is already installed, t3cm skills install adds them.

Install the skills with t3cm

Each t3cm binary carries the skills from the commit it was built from, so a release build and a --from-source build both have them:

t3cm skills install
t3cm skills status

install writes them to ~/.agents/skills. It stamps the release into each SKILL.md under metadata.t3-codemode-release, and records the release, every file and its SHA-256 in ~/.config/t3-workflow/installed.json (under $XDG_CONFIG_HOME when that is set). t3cm skills update brings the skills to the binary’s release. It writes the files that changed, removes files the release dropped, and keeps any file you edited since t3cm wrote it, with a warning; --force overwrites those too. status lists each skill as current, out of date, edited locally or missing, names the command that fixes it, and exits 1 unless every skill is current. --json prints either result as JSON.

Codex reads ~/.agents/skills. Claude Code reads ~/.claude/skills, or $CLAUDE_CONFIG_DIR/skills when that is set, so when that config folder exists, install and update also link each skill there to its folder in ~/.agents/skills. They never replace a folder or a link already in a skill’s place, and status mentions one that is in an info: line, and in claudeLinks with --json, without counting it against the skills being current. Antigravity reads ~/.gemini/config/skills, or $GEMINI_HOME/config/skills when that is set, and t3cm links the skills there the same way when Antigravity is installed (config, antigravity or antigravity-cli in that folder), reporting them in antigravityLinks. T3 starts each Antigravity thread with its own GEMINI_HOME, whose config/skills links back to ~/.gemini/config/skills, so the threads see these links too. Where the account cannot make links, as on Windows without Developer Mode, they print the copy commands instead.

When npx skills (or a copy by hand) installed the skills on an older machine, t3cm has no manifest for them. status reports that install, the commit in ~/.agents/.skill-lock.json, and how many files differ from this release. install and update leave those skills alone until you run t3cm skills install --take-over, which the installers offer, yes by default. That replaces their files with this release’s and removes them from the npx skills lock file, so npx skills update no longer overwrites them. t3cm never writes through a skill folder that is a link, such as one into a git clone.

install and update also apply the setup steps that need no answers, which this release lists in setup-t3-workflow/steps.json, skipping any agent that is absent:

  • rule:filed-issues writes the filed-issue rule to rules/t3-workflow-filed-issues.md in $CLAUDE_CONFIG_DIR or ~/.claude, and as a marked block in Codex’s global AGENTS.md under $CODEX_HOME or ~/.codex.
  • mcp:config-dir-header adds the X-T3-Config-Dir header to an existing Claude Code t3cm entry.
  • retire:t3wf cleans up retired t3wf timers, shims and scripts/__pycache__, leaving old registry data alone until t3cm doctor says it is safe to delete.
  • mcp:antigravity adds the t3cm stdio entry to each T3 Antigravity profile’s config/mcp_config.json. When ~/.config/t3-workflow/config.json exists, t3cm records each step it applied there under steps, with its release under writtenBy. A step that needs answers, such as a slot a later release added, prints as run setup-t3-workflow: new slot <slot>; ask your agent to run that skill. status lists the missing steps too, and exits 1 while a step t3cm can apply is missing.

The running service checks the same things. /healthz, wf.status() and the board’s /api/state (under service) carry a skills object:

FieldMeaning
releaseThe release this t3cm binary carries
installedThe release installed.json records, or null when t3cm did not install the skills
presentfalse when no skills are installed at all; the board then shows nothing
currenttrue when t3cm skills status would exit 0
fix, foreignAs in t3cm skills status --json
missingStepsThe setup steps not applied or recorded, each with its id, kind, since, slot and fix
configState, problemWhether config.json is absent, legacy (no steps), recorded, or ignored, and why
fixesThe commands to run, in order
errorSet when the check itself failed

The service reads the files at startup and on each watcher pass and keeps the result, so board updates and /healthz cost no file reads. wf.status() reads them fresh.

Set up the workflow

After installing the skills, ask your agent once to “set up the T3 workflow”. Setup also installs the rule that has every thread report the issues it files to the board. The README covers which skills need which. Without the skills, launched threads do not know the workflow, so the board and wf are the part of this project that works standalone.

Configuration

The config file

The config is optional JSON at config.json in the config directory. T3CM_CONFIG points at a different file. Whatever it holds is deep-merged over the built-in defaults, so a file only needs the keys you change:

OSConfig and state directory
Linux$XDG_CONFIG_HOME/t3-codemode/ (default ~/.config/t3-codemode/) for config, $XDG_STATE_HOME/t3-codemode/ (default ~/.local/state/t3-codemode/) for state
macOS~/Library/Application Support/t3-codemode/ for both
Windows%LOCALAPPDATA%\t3-codemode\ for both

The service reads the file at start, and again when t3cm config or the board’s Settings saves a change. It does not watch the file, so restart it after you edit the file another way or change a restart-only key:

OSRestart
Linuxsystemctl --user restart t3-codemode
macOSlaunchctl kickstart -k gui/$(id -u)/com.ottoops.t3-codemode
WindowsStop-ScheduledTask t3-codemode; Start-ScheduledTask t3-codemode
{
  "deny": ["t3_project_delete", "t3_environment_unlink", "t3_thread_interrupt"],
  "defaultTimeoutMs": 120000,
  "board": { "settleAfterHours": 48 }
}

A deep merge replaces arrays whole, so this deny replaces the default list, and it has to repeat the two default entries to keep them.

Change the config

On a local board, Settings edits every key with the same checks and reload as the commands below, apart from the few files it leaves to t3cm config edit. It uses the settings API, which takes whole values in place of paths, so it always saves a list whole.

t3cm config reads and changes the config file. Before it writes, it checks the whole result as config load does, so a rejected change prints the field that failed and leaves the file as it was. After set, unset or a saved edit, it asks the running service to reload the file and prints the keys that still need a restart.

CommandDoes
t3cm config get [<path>]Prints the value in effect as JSON, defaults included. Without a path, it prints the whole config.
t3cm config set <path> <value>Changes one key. The value is parsed as JSON, and a value that is not JSON is taken as a string.
t3cm config unset <path>Removes one key from the file so that its default applies, or removes one item from a list.
t3cm config editOpens a copy of the file in $VISUAL or $EDITOR and replaces the file once the copy is valid.
t3cm config validateChecks the file and exits 1 when it is invalid.
t3cm config get board.feed
t3cm config set board.feed 80
t3cm config set deny '["t3_project_delete", "t3_environment_unlink", "t3_thread_interrupt"]'
t3cm config set pools.opus '{"driver": "claudeAgent", "model": "claude-opus-5-5", "members": [{"instanceId": "claude-a"}]}'
t3cm config set pools.opus.members.0.weight 3
t3cm config set 'pools."gpt-6.1".effort' high
t3cm config unset board.feed

A path joins key names with dots and names a list item by its index from 0, and setting the index one past the end appends an item. A name that holds a dot goes in double quotes, with single quotes around the whole path so that the shell passes them through. To save a string that also reads as JSON, such as 5 or true, quote it twice, as in '"5"'.

Each set has to leave a valid config, so keys that depend on each other need an order or one value that holds them all. A new pool is set whole, and board.remote.origin is set before board.remote.mode. An edit inside a list that the key inherits, such as deny.2 from the defaults or a child role’s wake.0 from wake, copies that list into the file first. A copied list no longer follows the one it came from.

get needs a valid file, and set and unset write only when their one change leaves the file valid. Use edit to repair a file with several errors or broken JSON.

When a change adds or alters a pool, t3cm asks the running service whether each member of that pool is a T3 provider instance and has the pool’s driver. A change that repairs another key does not ask about a pool it leaves alone. When t3cm cannot read a pool’s earlier entry, it counts that pool as changed, so an edit that repairs broken JSON asks about every pool. validate asks about every pool. If the service or T3 does not answer, or you pass --no-t3, t3cm warns that it did not check the members and goes on, since each pick checks them again. --port names the service’s port when it is not the default.

Reload

A reload applies the whole file, so it also picks up what you edited by hand since the service last read it. The service checks the file first and keeps the config it was running when the file is invalid. A set that changes nothing still reloads.

The reload goes to the service on --port or T3CM_PORT, and that service reloads only when it reads the file you changed. If it reads another file, t3cm names that file. If no service answers, or the service is older than this t3cm, t3cm says that it did not reload and prints the restart command. t3cm saves the file in each case. When the service rejects the saved file, t3cm prints its error and exits 1.

Work already under way can finish with the value it started with. An open link keeps its link numbers, a run keeps its CPU and time limits, and an open ask keeps its poll interval. A t3cm stdio process reads the file only at start.

Restart-only keys

KeyWhy it needs a restart
maxConcurrentRunsIt sets the service’s run slots and memory bound at start.
upstreamsEvery key under it, allow and deny included, belongs to connections and a catalog built at start.
board.remoteIt sets who can reach the board from another device. To revoke a login, change it and restart.

Every other key takes effect on reload. The service keeps the starting value of these three until it restarts, and each reload names the ones whose saved value differs from that. ADR 0009 records why.

How t3cm writes the file

A write replaces the file in one step. It keeps the file’s permissions, a symlink to it, and the formatting of the values it does not change. t3cm refuses to write when the file changed after it read it, and you run the command again. t3cm config, the board, t3cm board expose and t3cm board unexpose take turns through a lock file beside the config, .config.json.t3cm-lock for the default name. Your editor does not take that lock, so its save during a write can still be lost.

When the copy from edit is invalid and t3cm runs in a terminal, it offers to open the copy again. If t3cm does not save a copy that you changed, it keeps that copy and prints its path.

Keys

Sandbox and runs

KeyDefaultDoes
deny["t3_project_delete", "t3_environment_unlink"]T3 tools scripts may not call. The host refuses them; see Security model.
cpuBudgetMs2000JavaScript CPU time per run. Time spent awaiting host calls does not count.
defaultTimeoutMs60000Wall-clock limit when a call gives no timeout_ms
maxTimeoutMs600000The largest timeout_ms a call may ask for, at least 100
maxConcurrentRuns16execute and search runs allowed at once
runQueueMs10000How long a run waits for a free slot before it fails with a retryable busy error

Each run can use up to 64 MB, so the default maxConcurrentRuns bounds sandbox memory at 1 GB, which equals the Linux unit’s MemoryHigh before the rest of the service is counted. On Linux, raise it only with MemoryHigh and MemoryMax. The launchd agent and the Windows task set no memory limit.

Workflow layer

KeyDefaultDoes
watcherIntervalSecs60How often the watcher runs a pass
maxHoldMinutes30How long a wake to a busy thread waits in the outbox
link{"down": 45, "miss": 2, "stall": 240}Default link policy: idle minutes before a nudge, unanswered nudges before an escalation, busy minutes with nothing sent before the parent hears of it
wake["event", "gate", "blocker", "handoff", "closed", "report", "escalate", "reply"]Message kinds that wake the receiver. Other kinds are stored as notes.
bodyCap, replyCap1500, 1500Characters of a wake or reply body sent inline; the rest stays behind its handle
digestLines6Note and “handled for you” lines in the digest that rides on the next wake
rolessee belowPer-role overrides for each child role
maxTicketsTotal8The most tickets that can be open on the board at once, at least 1. See the ticket cap.

The built-in roles give an overseer’s ticket children down 75, stall 480, bodyCap 600, and a wake list without event and reply, so a ticket’s routine events reach an overseer as notes. ticket has worker children with the default policy, and worker has none.

A child policy also takes relay, true by default. With it on, a child’s blocker, and each gate it opens other than merge and delivery:<id>, skip its parent when that parent’s own link goes to the board: the message becomes a board card tagged with the child, and the card’s answer goes straight back to the child when it is one of the card’s buttons or hold. Any other answer goes to the parent, and so does any answer that starts with merge. Neither step wakes the parent, which reads each one as a “handled for you” line in the digest of its next wake. A parent under an overseer thread keeps the usual path whatever relay says, so the switch matters on ticket -> worker for board tickets. Set "relay": false on a child policy to send those messages through the parent again. See ADR 0013. The same switch covers a worker’s wf.pr events: with relay on, the service checks an opened PR, records a new head and opens the merge card for a board ticket, and with it off each event wakes the ticket.

The ticket cap

maxTicketsTotal is the fail-safe on how much work runs at once. Every open board ticket counts against it, and so does a launch still waiting to join, whether the Launch form, a new-issue launch, wf.launchTicket, wf.dispatch or the flow queue started it. A launch at the cap is refused: it launches nothing, returns an error that names the cap, and leaves an error card on the board. The flow queue holds instead, and picks again when a ticket closes. Nothing raises the cap at run time; change it in the config, from the board’s Settings under Flow, or from the setup-t3-workflow flow step. flow.maxTickets must not be above it: a config that sets it higher fails validation, and Settings refuses to save it. The board header shows the count against the cap, such as “4 running · flow 6 · cap 8”.

Board

All under board:

KeyDefaultDoes
ticketModel, ticketEffortclaude-opus-5-5, highLegacy fallback for ticket launches when models.ticket is unset in repo and user workflow configs. Move these into models.ticket; t3cm doctor warns when they are set.
askInstanceIdunsetProvider instance for the ask box when askPool is unset. When unset, defaults to an enabled claudeAgent instance for the default ask model.
askModel, askEffortclaude-haiku-5-5, unsetModel and effort for the ask box’s scratch threads when askPool is unset.
askPoolunsetPool from pools for the ask box. Takes precedence over askInstanceId, askModel and askEffort, running the picked member’s model. See Pools.
instanceIdclaudeAgentLegacy fallback T3 provider instance for ticket launches when models.ticket is unset. No longer applies to the ask box; use models.ticket for tickets and board.askInstanceId for the ask box. t3cm doctor warns when it is set.
poolunsetLegacy fallback pool from pools for ticket launches when models.ticket is unset. No longer applies to the ask box; use models.ticket for tickets and board.askPool for the ask box. t3cm doctor warns when it is set. See Pools.
runtimeModefull-accessRuntime mode for launches. The service has no thread to inherit a mode from.
askPollSecs4How often an open ask is checked for its answer
askTimeoutMinutes15How long an ask may run
feed50Activity feed entries kept on the page
settleAfterHours24Hours a done ticket or closed ask stays in the main lists; 0 turns auto-settle off
reconcileActiveMinutes2Minutes between pull request checks, on GitHub and on the GitLab hosts in forges, while any tracked pull request is queued or waiting to be queued. From 1 to reconcileIdleMinutes.
reconcileIdleMinutes10Minutes between pull request checks otherwise; 0 turns the check off, page loads included. See The board.
openLinksdesktopdesktop: thread links open in the running T3 Code desktop app, or in a new tab when it is not running. The app check needs Windows, natively or through WSL, so macOS and Linux without WSL always get a tab. tab: always a new tab.
layoutdispatchThe board layout a browser opens in until it picks one with the layout button: dispatch or workspace. A browser’s own pick always wins. See The board.
remotenullOpt-in HTTPS remote board access behind a reverse proxy. null or {"mode": "off"} keeps the board loopback-only. See Remote board.

Remote board

board.remote is off by default (null). To serve the board over Tailscale Serve, run t3cm board expose --tailscale (which sets tailscale serve on HTTPS port 47732 and writes board.remote for you) and restart the service, or edit config.json directly:

{
  "board": {
    "remote": {
      "mode": "tailscale",
      "origin": "https://box.acme.ts.net:47732",
      "allowUsers": ["alice@acme.example"],
      "requirePairing": false,
      "settingsUsers": []
    }
  }
}

For Caddy, nginx, or cloudflared, use "mode": "pairing" with your public HTTPS origin:

{
  "board": {
    "remote": {
      "mode": "pairing",
      "origin": "https://board.example.com"
    }
  }
}
KeyDefaultDoes
mode"off""off": refuse all remote and proxied requests (403). "pairing": require a session cookie minted via t3cm board pair and redeemed through /pair#<token>. "tailscale": verify Tailscale-User-Login (injected by Tailscale Serve) against allowUsers or the host’s own Tailscale login.
originunsetRequired when mode is not "off". Canonical https:// origin with no path, query, fragment, or credentials, such as "https://box.acme.ts.net:47732" or "https://board.example.com".
allowUsers[]Tailscale logins allowed in "tailscale" mode (matched case-insensitively). When omitted or empty, defaults to the host’s own login from tailscale status --json. When non-empty, it replaces that default, so include your own login if you want to keep access. Ignored outside "tailscale" mode.
requirePairingfalseWhen true in "tailscale" mode, requires both an allowed Tailscale-User-Login and a valid __Host-t3cm_session pairing cookie minted with t3cm board pair. Pairing is always required in "pairing" mode.
settingsUsers[]Tailscale logins that may open Settings from a remote board in "tailscale" mode (matched case-insensitively). When omitted or empty, only the host’s own login may. When non-empty, it replaces that default. Each entry must also be in allowUsers when allowUsers is set. Ignored outside "tailscale" mode, where remote Settings stay closed.

/mcp, /healthz and /reload remain strictly loopback-only regardless of board.remote. See Remote access for Tailscale Serve, pairing commands, and reverse-proxy examples, and Security model for the proxy trust rules.

Pools

pools names groups of T3 provider instances, such as two Claude accounts, each one its own T3 provider instance. A launch from a pool picks one member, so work spreads across the accounts instead of filling one until it hits its usage limit. A pool holds instances of one driver and runs one model, unless it is mixed.

{
  "pools": {
    "opus": {
      "driver": "claudeAgent",
      "model": "claude-opus-5-5",
      "effort": "high",
      "strategy": "weighted",
      "members": [
        { "instanceId": "claude-a", "weight": 1, "reserve": 30 },
        { "instanceId": "claude-b", "weight": 3 }
      ]
    }
  },
  "board": { "pool": "opus" }
}
KeyDefaultDoes
mixedfalsetrue lets members be instances of any driver, each with its own model and effort. See Mixed pools.
driverrequiredThe driver every member must be, as orchestrator_capabilities reports it in driverKind. A mixed pool has none.
model, effortrequired, unsetModel and effort for every launch from the pool, so a thread gets the same model whichever account runs it. A mixed pool has none.
strategyweightedweighted spreads launches by weight. priority fills members in order and moves to the next only when one is out. cheapest sends launches to the lowest-cost members that can run, by weight among them. headroom needs a usage source, so config load rejects it for now.
moveOnLimitaskWhat happens when a thread the pool launched stops on a usage limit: ask puts a move card on the board, auto moves the thread to a ready member without one, and never leaves the thread where it is. See Moving a limited thread.
members[].instanceIdrequiredA T3 provider instance
members[].weight1The member’s share of weighted launches. With weights 3 and 1, three of every four launches go to the first member.
members[].reserve0A share of the account’s usage window, 0-100, held for work that names the instance directly
members[].cost1What a launch on the member costs, a number of 0 or more. Only its order against the other members counts, and only cheapest reads it.
members[].model, members[].effortrequired, unsetOnly in a mixed pool: the model and effort for launches on this member

weighted is a smooth weighted round robin. Each member’s running credit is in store.db, so a run of launches from the same state picks the same members, and a restart carries on where it stopped. When two members are level, the one with fewer running threads wins, then the one listed first.

cheapest looks at the members a pick has not skipped, takes those with the lowest cost, and spreads launches across them by the same weighted round robin. It moves to the next cost only when every cheaper member is out. Give a flat-rate subscription account cost 0 and metered accounts their relative prices. The pool then fills the subscription until limit marking takes it out, and the metered accounts take over after that, cheapest first. Cost never overrides a reserve or a limit. The pick reason names the cost, as in cheapest: cost 0, weighted: weight 1 of 2. Costs come from config only, since t3cm cannot see provider pricing; ADR 0004 records the choice.

A pick skips a member that T3 reports as disabled or constrained, a member that does not list its model or does not offer its effort, and a member marked limited until its reset time, as Limits describes. A member with a reserve is a last resort. t3cm has no usage source yet, so it cannot see how close an account is to its reserve, and the pool picks that member only when every member without a reserve is out. A launch that names the instance directly ignores the reserve. When every member is out, the pick fails, nothing launches, and a board launch leaves an error card that names the pool.

At load, a pool must have at least one member, no member twice, weights of 1 or more, reserves from 0 to 100 and costs of 0 or more, and board.pool and board.askPool must name configured pools. A pool that is not mixed must not set model or effort on a member. A bad pool fails config load with a message that names it. Only T3 knows whether each member is a real instance and, in a pool that is not mixed, whether it is an instance of the pool’s driver. Every pick checks that against T3’s live orchestrator_capabilities. A pick from a pool with an unknown instance fails, and so does a pick from a pool that is not mixed with a member of another driver. Either failure names the pool and the member. When T3 answers at start, the service also logs a bad pool then.

The pick’s reason starts with the driver, model and effort it chose, such as claudeAgent claude-opus-5-5, effort high; weighted: weight 1 of 4, and wf.pick returns them as driver, model and effort.

Sole members

A pool can depend on one account without saying so: when only one member can run the pool’s model, every launch from the pool waits on that member, and the pool launches nothing while it is limited. wf.pools() flags that member in the pool’s warnings and suggests a reserve on it:

only claude-b can run claude-opus-5-5, so the pool launches nothing while claude-b is out. Set a reserve on claude-b to keep room for the work only it can run.

With a usage source, the reserve is a floor that keeps part of the account’s usage for launches that name it directly. Until t3cm has one, a reserve only makes the member a last resort, as the pick rules above say, so in this pool, where nothing else can run the model, it changes no pick yet.

A member can run the model when T3 lists the model for it and offers the member’s effort. Limits and usage do not count, so the warning does not come and go as members are benched. A mixed pool’s members run different models by design, so there the check groups members by driver: a member that is the only one of its driver that can run its model is flagged. Once the member has a reserve, the warning drops the suggestion and stays, since the pool still has one member for that model. A pool that is not mixed gets no warning when two members can run its model, and a mixed pool gets none for a driver with two members that can run their models. A pool whose error is set gets no warning until the error is fixed.

Mixed pools

A pool with "mixed": true takes members of any driver, and each member names its own model and, when it wants one, its effort. Use one for work where it matters less which vendor runs a launch than that the launches spread out, such as a research swarm on cheap models. A capability tier is a mixed pool named for its class:

{
  "pools": {
    "frontier": {
      "mixed": true,
      "members": [
        { "instanceId": "claude-a", "model": "claude-opus-5-5", "effort": "high" },
        { "instanceId": "codex-a", "model": "gpt-6-astra", "effort": "xhigh" }
      ]
    },
    "cheap": {
      "mixed": true,
      "strategy": "priority",
      "members": [
        { "instanceId": "claude-a", "model": "claude-haiku-5-5" },
        { "instanceId": "codex-a", "model": "gpt-6-astra-mini", "effort": "low" }
      ]
    }
  }
}

A mixed pool has no pool-level driver, model or effort, and config load rejects one that sets them. Every member needs a model. t3cm does not group models into tiers on its own, so a new model joins a tier when you add it to the pool. The same instance can be a member of several pools, each with its own model. Weights and credits are per pool, and a usage limit benches the instance in every pool it belongs to. With a mixed pool active for a board launch, passing model to wf.launchTicket overrides the pool, while passing effort alone fails since each member runs its own model. ADR 0005 records why tiers work this way.

Limits

The watcher pass marks a member limited when a thread on it stops on a usage limit, and picks skip the member until the reset. T3 shows no reason for a snooze, so a snooze alone never marks a member. A thread counts as stopped on a limit when its status is failed and its latest run ends with T3’s Usage limit reached error item. The pass reads each failed run once, and it looks only at runs on pool members from the last 24 hours.

The reset time comes from T3’s limit snooze. With T3’s “snooze limited threads” setting on, T3 snoozes a thread that stops on a limit until its account resets, and t3cm takes that time when it first sees the stop. With the setting off, t3cm cannot see the reset, so it holds the member for limitHoldMinutes from when it saw the stop. Turn the setting on in T3 to get exact reset times.

KeyDefaultDoes
limitHoldMinutes60How long a member stays limited after a limit stop whose reset time T3 does not show, from 1 to 10080 (a week)

A stop with a later reset extends a member’s mark, and one with an earlier reset leaves it as it is. The pass clears a mark once its reset passes, and the member is picked again. Marks live in store.db, so they survive a restart. wf.pools() shows each mark’s reset time and the thread that set it. ADR 0001 records why t3cm reads limits this way.

Board ticket launches and wf.launchTicket resolve their pool or model from the models.ticket slot first, checking repo .t3-workflow.json and AGENTS.md before user ~/.config/t3-workflow/config.json, and fall back to legacy board.pool only when models.ticket is unset. model or effort passed to wf.launchTicket takes precedence over the slot and legacy board keys; passing effort alone over a mixed pool fails because members run different models. board.askPool covers the ask box, running the picked member’s model in place of askInstanceId, askModel and askEffort. Changes to ticket or ask model modes made from the board UI persist to their config files and take effect without a restart. Skills pick from a pool with wf.pick. The workflow skills do that for each launch when their model worker or model ticket slot names a pool, as "worker": {"pool": "opus"}; see A pool on a model slot. Pools are per T3 environment, since instance ids belong to one T3 server.

Moving a limited thread

When a thread that a pool launched stops on a usage limit, the pool’s moveOnLimit sets what the watcher pass does:

  • ask, the default, puts one card on the board: reply move to move the thread to a ready member of its pool, or wait to leave it until the reset.
  • auto moves the thread at once, with no card, and logs the move to the feed. When the move fails, for example because no other member is ready, the pass puts up the ask card instead. The card says the automatic move failed, and its full message gives the reason. When the move goes through but the fork cannot be resumed or the old thread settled, the pass puts a report card on the fork that says what to finish by hand.
  • never leaves the thread where it is. The member is still marked limited, so new picks skip it until the reset.

Config load rejects any other value. wf.pools() shows each pool’s moveOnLimit.

In a mixed pool, a move considers only the members of the thread’s own driver. A move forks the thread with its context and worktree, switches the fork to the new member, moves the thread’s workflow links to the fork, resumes the fork, and settles the old thread. The pick history and the feed record the move. The links, the pick, the feed entry and the answer are saved together, so if saving them fails, nothing moves and the card stays open. Answering move again then reuses the same fork. A failed automatic move keeps its fork the same way, and answering move on its card reuses it.

Only a thread with a recorded pick is moved or gets a card: a ticket the board launched, or a launch reported with wf.picked. A thread launched straight on an instance never is, and neither is a board question. A thread that runs again before the answer loses its card, and a move refuses a thread that is running.

Flow

The board’s dependency graph works with no flow block. GET /api/flow and wf.flow({ graph: true }) discover the GitHub repositories attached to active T3 projects from each project’s repositoryIdentity or git origin remote and read their open issues. Viewing the graph never enables auto-launching or the flow queue.

Add a flow block when you want to override which repositories are covered, or to enable the flow queue and automatic ticket launches as The flow describes. You can set every flow key from the board’s Settings under Flow, from the setup-t3-workflow interview, or with t3cm config without editing JSON by hand, and changes apply on reload with no restart. Existing flow blocks keep working unchanged, except one that sets flow.maxTickets above 8: it needs maxTicketsTotal set at least that high, or the config fails validation.

{
  "flow": {
    "repos": ["acme/widgets", "acme/tools"],
    "optIn": { "label": "flow" },
    "maxTickets": 2,
    "launch": "ask"
  }
}

To use the discovered T3 project repositories with an override, omit repos and add includeRepos or excludeRepos:

{
  "flow": {
    "includeRepos": ["acme/shared"],
    "excludeRepos": ["acme/archive"],
    "maxTickets": 2,
    "launch": "ask"
  }
}

A flow block without maxTickets customizes graph repositories only and leaves the flow queue and launching off.

KeyDefaultDoes
reposdiscovered from T3 projectsExplicit owner/name repositories to cover instead of discovering active T3 project GitHub remotes. When set, it must name at least one repository, and two entries can’t share a short name because an ownerless board ticket label such as widgets#41 cannot tell them apart.
includeRepos[]Extra owner/name repositories added to the covered list after repos or T3 project discovery.
excludeRepos[]owner/name repositories removed from the covered list, taking precedence over repos, discovery and includeRepos.
optIn.labelunsetOptional label filter for the launch queue. When set, only open issues with this label enter queue, blocked or skipped. Other open issues still appear in the dependency graph so transitive blocker chains stay intact.
optIn.milestoneunsetOptional milestone title filter for the launch queue, matched ignoring case. When both optIn.label and optIn.milestone are set, an issue must match both. When optIn is omitted, any open issue in a covered repo can enter the queue.
maxTicketsunsetEnables the launch queue and caps how many flow tickets can be open on the board at once, from 1 to maxTicketsTotal. Required when launch is ask or auto. Omit it for graph-only repository overrides.
launchask when maxTickets is set, else offHow a free slot launches the next ready issue: ask raises a launch card, auto launches it, and off launches nothing.
serializeFileConflictsfalseWhen true, serializes fileConflict pairs: holds an issue out of queue while a conflicting ticket is running, and prevents colliding ready issues from launching or being offered at the same time (keeping the higher-priority issue in queue order).

When maxTickets is set, an issue is ready when all of these hold:

  • It is open, in a covered repo, and matches optIn when optIn is set.
  • No open issue blocks it through GitHub’s blocked-by links or parsed issue-body dependencies from ## Flow Blocked by:, Depends on, Blocked by, or After, and it has no unresolved blocker reference in its body.
  • No open stacked pull request (prStack) or active sequential part: n/N predecessor holds it back.
  • When serializeFileConflicts is true, it shares no overlapping files (fileConflict) with an open running ticket.
  • It is not labelled blocked or blocked: external.
  • No board ticket is open for it.
  • It isn’t skipped. A skipped issue, or one still open after its board ticket finished, comes back once its labels or blockers change.
  • It is not a sub-issue whose parent has an open board ticket. That ticket works its sub-issues itself.

The queue runs by priority: label first, from priority: high through medium and low to issues with no priority label. Ties go to the earlier milestone due date, with issues that have no due date last, and then to the oldest issue.

A flow ticket is an open board ticket, or a launch still waiting to join, for an open issue in a covered repo. A ticket whose issue has closed no longer takes a slot. Tickets without a recorded issue reference or repository are matched by short label only when that repository name is unique among covered repos. A ticket takes one slot however many sub-issues or workers it runs. The free slots are maxTickets minus the flow tickets, and never fewer than zero. They also never exceed the room left under maxTicketsTotal, which counts every open board ticket, flow or not.

Trackers

trackers maps non-GitHub ticket references to T3 projects when wf.launchTicket runs without an explicit project argument. GitHub and GitLab references match a T3 project’s git origin remote by host and repository path first. GitLab references fall back to trackers.hosts when no remote matches, while GitHub keeps origin-remote and explicit-project matching. Jira keys check trackers.jira by project key first, then trackers.hosts for browse URLs.

{
  "trackers": {
    "jira": {
      "PROJ": "my-service"
    },
    "hosts": {
      "jira.acme.example": "my-service",
      "gitlab.acme.example": "my-service"
    }
  }
}
KeyDefaultDoes
jira{}Maps a Jira project key such as PROJ, matched ignoring case, to a T3 project id or title.
hosts{}Maps a tracker hostname without scheme, port or path, matched ignoring case, to a T3 project id or title.

Forges

forges names the git hosts, other than github.com, whose merge requests the board follows. The reconcile tracks a merge request link on a listed host and wakes its ticket when it merges or closes. github.com is built in and takes no entry. A link on a host that is not listed is not tracked, and its ticket follows the repository’s own documented steps.

{
  "forges": {
    "gitlab.acme.example": { "kind": "gitlab", "cli": "glab" }
  }
}
KeyDefaultDoes
<host>A hostname without scheme, port or path, matched ignoring case.
<host>.kindgitlab, the only kind so far.
<host>.cliglabThe command the service runs as <cli> api --hostname <host>. Its sign-in for that host decides what the board can read. t3cm holds no GitLab token.

Updates

KeyDefaultDoes
updateChecktrueCheck GitHub for a newer release: the service every hour, the CLI at most once a day. false turns off the CLI notice, the board’s update button and the service’s checks; t3cm update still works. See Update.

Upstreams

upstreams lists other MCP servers to wrap. It has its own page: Upstreams.

Environment

VariableDoes
T3CM_CONFIGPath of the config file
T3CM_STATE_DIRState directory, same as --state-dir
T3CM_PORTPort for serve, status, exec and search (default 47731)
T3CM_T3_BINThe t3 binary used to mint pairing codes; see Security model
T3CM_TAILSCALE_BINOverride path to the tailscale CLI used by board expose, board unexpose, doctor, and Tailscale identity mode (otherwise discovered on PATH, in /Applications/Tailscale.app on macOS, or under Program Files\Tailscale\tailscale.exe on Windows/WSL)
T3CM_T3_ORIGINT3’s origin, when server-runtime.json has the wrong one
T3CODE_HOMET3’s home directory (default ~/.t3)
T3CM_TZTime zone for times the board and wf show (default America/Denver; an unknown zone falls back to UTC)
T3CM_NO_UPDATE_CHECKAny value but 0 or false turns the release checks off, like updateCheck: false. CI does the same.
T3CM_RELEASES_URLWhere t3cm update and the checks look for releases (default https://github.com/OttoOps/t3-codemode/releases); https, or plain http on 127.0.0.1 or localhost only, and with no user name or password in it. The installers read it too.
RUST_LOGLog level

State

State lives in SQLite at store.db in the state directory above (--state-dir or T3CM_STATE_DIR override it). It holds the T3 session, mem and vars, the workflow links and messages, the board’s cards and feed, hashed remote pairing tokens and browser sessions, pool member credits, limits and pick history, and the cached T3 catalog for when T3 is down. Everything survives restarts. Next to it, update-check.json holds the latest release the last check found and when.

On Linux and macOS the directory is 0700 and the database 0600. On Windows t3cm sets no ACL of its own: the store relies on the per-user ACL that %LOCALAPPDATA% already carries, which grants access to you, SYSTEM and Administrators, so a --state-dir outside your profile gets whatever its parent grants.

Uninstalling (install.sh --uninstall or install.ps1 -Uninstall) keeps the store. Delete the state directory to drop memory and links.

The two tools

A client connected to t3cm sees two tools. search finds what to call, and execute calls it. The model writes a short async arrow function for each.

search {code} runs an async arrow function whose only globals are catalog and console, and returns {"result": ...} with the function’s value, plus logs when the function logged anything.

catalog is an array of {name, kind, server, description, signature, inputSchema}, in this order:

  1. One entry per T3 tool: kind: "t3", server: "t3", the bare T3 name. signature is a generated TypeScript declaration with input and result types.
  2. One per upstream tool: kind: "mcp", server is the upstream’s namespace, and name is ns.tool. The signature reads ns.tool(...), or ns["raw-name"](...) when the tool name is not an identifier.
  3. The wf, mem and vars API, with kind and server set to "wf" or "mem".

Return only what you need. The point of the tool is to keep the catalog out of the model’s context:

async () => catalog.find(t => t.name === "t3_thread_send").signature
async () => catalog.filter(t => t.server === "cbm").map(t => t.name)
async () => catalog
  .filter(t => /worktree/.test(t.name))
  .map(t => `${t.name}: ${t.description.slice(0, 80)}`)

The API reference is the same set of signatures, generated from a snapshot of T3’s tools.

execute

execute {code, session?, timeout_ms?, thread?} runs an async arrow function in a fresh sandbox and returns {"result": ...}, plus "logs": [...] when the script logged anything. The service strips TypeScript annotations and accepts loose input too: markdown fences, export default, a named function, or a bare body whose last expression becomes the result.

Execute globals lists the sandbox’s globals. In short, t3 calls T3, each upstream has its own namespace, and mem, vars and wf keep state between runs.

async () => {
  const { threads } = await t3.thread_list({ allProjects: true, statuses: ["idle"], limit: 50 });
  vars.idle = threads.map(t => t.threadId);
  return vars.idle.length;
}

Filter and count inside the script, keep the bulk in vars, and return the answer. Only the return value and the logs reach the model.

async () => {
  const { threads } = await t3.thread_list({ allProjects: true, statuses: ["failed"], limit: 200 });
  console.log(`${threads.length} failed threads`);
  return threads.slice(0, 5).map(t => t.title);
}

Arguments

ArgumentDoes
codeThe function to run
sessionNames the mem and vars namespace. It defaults to thread:<caller>, or default with no caller.
timeout_msWall-clock limit, default 60000, max 600000 (defaultTimeoutMs and maxTimeoutMs in the config)
threadThe caller’s T3 thread id, for a connection that does not send the X-T3-Thread header

The caller is the X-T3-Thread header, else the thread input, else none.

Results and errors

The service cuts results over 24,000 chars structurally. The output stays valid JSON, the largest values go first, each cut carries a --- TRUNCATED --- marker, and a truncated note says so.

Errors come back as isError with Error: <message> and any logs. The service never echoes the script back, except that a syntax error quotes up to 160 characters of the line it failed on. A failed T3 or upstream call throws inside the script, so a try/catch can handle it there.

A run that finds every slot taken waits up to runQueueMs (10 s) and then fails with a busy error that says to retry. See Troubleshooting.

From a shell

t3cm exec and t3cm search call the running service’s tools from a file or stdin, for humans and scripts:

t3cm search - <<'JS'
async () => catalog.filter(t => t.kind === "mcp").length
JS

Execute globals

These are the only globals inside execute. There is no fs, require, process, fetch, import or timers.

GlobalWhat it is
t3Every T3 tool by exact name (t3.t3_thread_list(input)), an alias without the t3_ prefix, and t3.call(name, input). A failed call throws an Error with T3’s message.
<ns>One per enabled upstream, named by its name, present even before its tool list is known: each allowed tool by exact name (cbm.search_graph(input), cbm["get-thing"](input)), a sanitized alias when it is free (cbm.get_thing), and cbm.call(name, input). A tool named call is reached with cbm.call("call", input).
toolstools.call("ns.tool", input) for any namespace, t3 included (which keeps the t3_ alias and the deny list). The name splits at the first dot, so tools.call("cbm.a.b") calls tool a.b.
memget(key), set(key, value), del(key), list(prefix?) on the session namespace; mem.ns(name) opens a shared one (for example work:widgets#41). JSON values, 1 MB each.
varsA plain object restored before the run and saved after it (also after a thrown error; a CPU or wall kill loses that run’s changes). REPL state across calls and restarts.
wfThe workflow layer, acting as the calling thread.
consolelog/info/debug/warn/error, captured to logs (50 lines / 4,000 chars).

The full signatures are on the API reference page.

t3

async () => {
  const { threads } = await t3.thread_list({ allProjects: true, limit: 20 });
  return threads.filter(t => t.status === "running").map(t => t.link);
}

t3.thread_list and t3.t3_thread_list are the same tool. A tool on the config’s deny list throws without reaching T3.

Upstream namespaces

Each enabled upstream adds one frozen global named after it. With the cbm upstream from the Upstreams example:

async () => {
  try {
    return await cbm.list_projects({});
  } catch (e) {
    return `cbm failed: ${e.message}`;
  }
}

tools.call("cbm.list_projects", {}) reaches the same tool by its qualified name. Use search to find an upstream’s tool names; catalog is not a global inside execute.

mem and vars

mem is a key-value store on the session namespace. The session defaults to thread:<caller>, so each thread gets its own, and mem.ns(name) opens a namespace any thread can share:

async () => {
  await mem.ns("work:widgets#41").set("handoff:pr1", "PR 1 merged at d4db97c");
  return await mem.ns("work:widgets#41").get("handoff:pr1");
}

vars is a plain object. Whatever a run leaves in it is there at the start of the next run in the same session, across service restarts:

async () => {
  vars.runs = (vars.runs ?? 0) + 1;
  return vars.runs;
}

wf

wf is the thread-workflow layer. Threads form a tree of links, each between a parent and a child, and the service keeps every link and message in its store.

  • wf.init({role, label?, root?, issue?, parentIssue?, part?}) starts a thread with no parent link. A role that roles.overseer.children lists, which is only ticket by default, joins the board the way wf.join({ parent: "board", label, role: "ticket" }) does, under the board launch’s label, label, or its T3 title, in that order. The result names parent: "board" and the label. root: true keeps the thread off the board as a standalone root. Every other role starts as a root. wf.init is for a ticket started on its own, but a ticket launched from the board that calls it instead of its brief’s wf.join still clears its launch from the board’s pending list. The service matches the launch by the thread T3 created for it, never by label, so a ticket started by hand under the same title leaves another launch on the pending list.

  • wf.openChild({role, label}) returns a brief block the parent pastes into the child’s launch brief; the child runs the wf.join({parent, label, role, down, miss, stall}) call it contains. When the parent launches the child with t3.t3_thread_launch in execute, the service records the new thread on its launch in the pending list, and the watcher’s never-joined report links to it.

  • wf.openChild, wf.join, wf.init and wf.launchTicket take an optional issue, parentIssue and part. issue is the GitHub issue the link works, parentIssue the epic it belongs to, each as <owner>/<repo>#<n> or the issue’s URL, and part says which of the epic’s PRs it is, as n/N with 1 <= n <= N, such as "1/4". The link stores them as <owner>/<repo>#<n> and n/N, and a malformed value fails the call. wf.openChild writes them into the wf.join call in its brief. A rejoin that leaves one out keeps the value the link already has. wf.board() and the board’s /api/state return all three on each ticket and worker, null when unset. A worker link with no issue takes one from its pull request’s closing references (Closes #N) at the next GitHub reconcile.

  • wf.openChild also takes pr: { format?, sections?, passes?, mergeOnly?, method? }, the PR description format a worker’s wf.pr opened event is checked against. It is stored on the child’s link when the child joins. method is the repo’s merge method, merge, squash or rebase, and a brief may give it with no format. With it, the service merges the PR on the board’s answer to its merge card (The board’s merge answer).

  • wf.send({kind, body, gate?, wake?, options?}), kinds note | event | gate | blocker | report | handoff | closed, to the caller’s parent. Returns {handle, delivery}: noted, sent, queued (the parent is mid-turn, or delivery failed; the watcher retries), or board when the parent is the board. When the message opened a decision card, the result also carries the card id and the card’s reply buttons as options, plus a warning when a gate’s card has no buttons. gate also opens a gate, which stops nudges until the sender clears it. handoff and closed close the link. A worker’s blocker, or any gate it opens other than merge and delivery:<id>, goes to the board past a board ticket, with delivery: "board", as relay describes.

  • options, a list of answers on a gate, blocker or report, sets the board card’s buttons in place of the ones parsed from the body. The limits and the parsing rules are in Reply buttons. A bad entry fails the send. A thread parent gets only the body.

  • wf.reply, wf.gate, wf.close, wf.inbox, wf.show, wf.board, wf.adopt and wf.sweep cover the rest of a link’s life.

  • wf.pause({ child?, paused? }) pauses a link that is parked on purpose: the caller’s own parent link, or with child one of its child links. paused: false resumes it. The board shows it as paused, not idle.

  • wf.launchTicket, wf.dispatch, wf.cards, wf.answer and wf.feed work with the board. wf.launchTicket and wf.dispatch throw, and leave an error card, when the board is at its ticket cap.

  • wf.issue({ url, title?, note?, blockedBy?, parent?, track?, priority?, sync? }) reports a GitHub issue the calling thread just filed. The board lists it under new issues with the filing thread and the time. The call needs the caller’s thread id but no parent link, so any thread can make it. It returns { added, message, issue }. When the issue is already on the list, dismissed or not, or already has a board ticket, the call adds nothing. Its result then has added: false, a reason of reported or ticket, the existing issue or ticket, and a message that says which. Passing any of blockedBy, parent, track, or priority enables GitHub wiring by default unless sync is false. Each entry in blockedBy or parent accepts #N, owner/repo#N, or a GitHub issue URL, track takes a flow track slug, and priority takes "high", "medium", or "low". The service wires GitHub’s native addBlockedBy and addSubIssue links and applies the track: <track> and priority: <priority> labels idempotently, creating missing labels when the repo lacks them. Existing links and labels succeed as alreadyLinked or alreadyApplied. GitHub and permission errors land in wiring.errors and in message. From the board’s dependency graph you can also sync body-parsed links (POST /api/flow/sync-links), edit edges and tracks directly from the inspector (POST /api/flow/edge, POST /api/flow/issue), toggle an issue’s flow opt-in label (POST /api/flow/opt-in), or run read-only Triage DAG proposals (POST /api/flow/triage) before confirming writes.

  • wf.fileIssues({ repo?, parent?, track?, priority?, labels?, queue?, report?, sync?, issues }) creates a batch of GitHub issues forming a dependency DAG in one call. See wf.fileIssues.

  • wf.pick({ pool }) picks a member of a configured pool for one launch and returns { pool, pick, instanceId, driver, model, effort, options, reason, skipped, modelSelection }. Pass modelSelection to t3_thread_launch. reason names the driver, model and effort chosen and says why that member, and skipped lists each member left out with its reason, such as limited until 14:00 MST. Under the cheapest strategy, reason names the cost, as in claudeAgent claude-opus-5-5, effort high; cheapest: cost 0, weighted: weight 1 of 2. The service records each pick, and pick is its id. When no member can run, it throws and names the pool.

  • wf.picked({ pick, thread }) records the thread a pick launched. The board offers to move a thread to another member when it stops on a usage limit, as Moving a limited thread describes, and only for a thread with a recorded pick. Board launches record theirs on their own. It throws when the pick is unknown or already launched another thread.

  • wf.pools() lists each pool, with mixed and the pool’s driver, model and effort (null in a mixed pool), and its members with their driver, model, effort, weight, reserve, cost, state (ready, limited, disabled, constrained, missing-model, missing-effort, or unknown when T3 did not answer), reason, limitedUntil, limitedUntilLocal, limitReason, usageLeft, running threads, picks and lastPick. limitReason names the thread whose limit stop set the mark and where its reset time came from. usageLeft stays null until t3cm has a usage source. The watcher sets and clears the marks, as Limits describes. Each pool also has warnings, which flags a member that is the only one that can run the pool’s model, or in a mixed pool the only one of its driver that can run its model, as Sole members describes.

  • wf.usageStats({ window }) reports how board ticket launches are routed, the view the board header shows as Launch routing. window is "all" or a count of m, h or d, such as 30m, 24h or 7d, and defaults to 24h. The result has window, since, at, mode, source, pool, strategy, error, warnings and members. since is null for all, and source names where the ticket model came from.

    • mode: "pool". Each member carries what wf.pools() reports, plus status: ready, reserve when it is held at its reserve, limited, disabled when it cannot run, or unknown when T3 did not answer. It also carries picks in the window, share and weightShare. shareBasis says what share counts: picks, the fraction of every pick in the window, former members’ picks included, or weight, the configured weight when the window has no picks. A member’s reasons counts its picks by kind, which is weighted, priority, cheapest, last-resort or moved. Its skips counts the window’s picks that passed it over, by kind: limited, reserve, disabled, constrained, missing-model, missing-effort or other. At the top level, picks and reasons cover every pick in the window, series splits the window into 24 buckets of picks per member, recent lists the latest 20 picks with their reasons, and former counts picks of instances no longer in the pool.
    • mode: "single". members holds the one instance, model and effort that launches use, with share 1 and no pick history.
    • Tokens. tokens totals the input and output tokens of the runs that ended in the window, as {input, output, runs}. It also holds byInstance, and byProvider, which groups the totals by driver. Each member carries its own tokens, and tokenSeries splits the window into the same 24 buckets as series, each with input and output per instance. These fields are null while no token source reports counts, and T3 sends none over MCP today, so they stay null against a real T3. The watcher reads each run’s counts once, within a day of the run ending, counts them on the instance that ran it, and keeps them for 400 days. ADR 0012 has the reasoning.

    running lists the active threads of every provider instance, counted the way wf.pools() and the pool picker count them, so queued and starting threads count too. It is null, with runningError, when T3 did not answer. The pick history keeps the latest 2000 picks, and a bad window throws.

  • wf.status() returns the service’s state as the board header shows it: version, t3, tokenExpiresAt, watcher, openLinks, update and skills, the check of the installed T3 workflow skills and setup steps described in Install the skills with t3cm. It needs no caller and reads the skills fresh.

  • wf.slot(name, { repo?, instance?, skills?, files? }) returns one slot, review, passes, delivery, models or credentials, resolved for the caller’s T3 instance and project: its source layer, each skill with how to run it (Skill tool, or inline: read <path> and apply it, or why it is skipped), a one-line line, and warnings. For delivery, files filters steps with paths globs against changed repo-relative paths and returns unmatched steps in skipped. For an Antigravity thread, which has no Skill tool, every skill found on disk is inline. For models, each role carries a modelSelection for t3_thread_launch, or the pool to pass to wf.pick. repo overrides the project’s workspace root, for example with a worktree.

  • wf.renewal({ output, repo? }) matches a failed command’s output against the credentials patterns and returns { match, skill, how, skipped }, or null when none matches.

  • wf.slots({ repo?, instance? }) returns every slot at once, as t3cm slots --json prints it, with the caller context and warnings.

  • wf.waiting.add, wf.waiting.resolve and wf.waiting.list keep an overseer thread’s waiting list.

  • wf.flow() returns the flow’s ready queue, the flow tickets running, and the free slots. wf.flow.next() runs one pick by hand. See wf.flow.

  • wf.pr({event, repo, pr, head, publishing?, checks?, body?}) is how a worker reports its pull request: opened, updated or ready. Under a board ticket the service checks the description, records the head, or opens the merge card itself, with no ticket turn. See wf.pr.

  • wf.merge({repo, pr, head, method?}) merges a GitHub pull request or a GitLab merge request at the approved head commit. repo takes the same forms as wf.pr, head the full 40-character SHA the user approved, and method one of merge, squash or rebase. See wf.merge.

async () => wf.send({ kind: "note", body: "tests green at d4db97c" })

The service stores a note without waking anyone, and the note reaches the parent as a digest line on its next wake. Each message the service relayed past the parent, and each answer it routed back, reaches it the same way, as a “handled for you” line. The kinds in the config’s wake list wake the receiver. wake: true on a send forces a wake for any kind, notes included, and wake: false suppresses one, except that handoff and closed always wake a thread parent. A send to the board ignores wake, since the board turns messages into cards and feed entries. A wake is one compact t3_thread_send (mode queue) of the form [t3cm <kind> from=<label> msg=<handle>], with the body capped at bodyCap. wf.show(handle) returns the rest.

Wakes to a busy thread wait in an outbox and go out as one combined message when it is idle, held at most maxHoldMinutes (30). A watcher task runs every watcherIntervalSecs (60 s): it nudges idle children, reports stalls and pending requests once, escalates after repeated misses, closes links whose thread was deleted or archived, and marks pool members limited when one of their threads stops on a usage limit.

async () => {
  const p = await wf.pick({ pool: "opus" });
  const r = await t3.thread_launch({ projectId, title, message, modelSelection: p.modelSelection });
  return wf.picked({ pick: p.pick, thread: r.threadId });
}

wf.pr

A worker calls wf.pr for each step of its pull request. repo is owner/name for GitHub, <host>/<group>[/<subgroup>...]/<project> for a GitLab merge request on a host listed under forges, or the merge request’s URL, in which case pr can be left out. pr is the pull request number or the merge request’s iid, and head the head commit SHA, 7 to 40 characters. When the worker’s ticket is on the board and the link’s relay is on, the service handles the event itself. Each step lands in the ticket’s digest as a “handled for you” line.

eventWhat the service doesstatus
opened, with publishingChecks that the Publishing line names the format and each pass, and that the description on the forge has every heading, element and Refs #<n> line the format setsopen, or rewrite with the rewrite request in message and the gaps in missing
updatedRecords the new head and drops any merge card for an older headrecorded, with the dropped card ids
readyReads the PR on its forge, resolves the delivery slot for its changed files, and opens the ticket’s merge card with the answers the slot calls forgated with the card and its options
ready, any check still running, required or not, such as CodeRabbit’sMarks the PR; PR reconcile opens the card once every check finisheswaiting
ready, a check failedNothing on the board; a failure reconcile finds later comes back as a replyfailing with the checks
ready, draft, moved head or merge conflictNothingrefused with a reason

The format comes from the ticket’s wf.openChild({..., pr}). format: "pr" requires the pr skill’s Summary, Evidence and Merge Danger sections with their elements, and sections maps more headings to the text each must hold. A PR whose merge state is BLOCKED or BEHIND with every check passed still gets its card, and the card names the block. For each reviewer whose latest review requests changes, it names the reviewer and the commit that review is on, as the current head or an earlier head.

For a GitLab merge request, the service reads the merge request, its changed files and its pipelines over REST with glab api. It judges the checks on the newest pipeline at the head whose ref is not a merge train’s. A merge request with no such pipeline goes to the ticket. A Refs #<n> line in its description names issue <n> of the merge request’s own project. Past 100 changed files, the event goes to the ticket, as it does on GitHub. It also goes to the ticket when the diff list holds fewer files than the merge request’s changes_count, or when the head moves while the service reads it. An answer to its merge card merges it through wf.merge, as on GitHub.

Where the service cannot decide, it sends the ticket the message a worker sent before wf.pr, with a line saying why, and returns status: "ticket" and why. That covers a ticket under an overseer thread, relay off, a worker’s second PR, a mergeOnly brief, checks: "none", no stored format, a delivery slot without a builtin merge stage, and a PR it cannot read or verify. ADR 0015 lists every case.

async () => wf.pr({ event: "ready", repo: "acme/widgets", pr: 7, head: "d4db97c" })

wf.merge

wf.merge reads the pull request in one GraphQL query, then does one of these. GitHub computes the merge state lazily, so while an open pull request reports UNKNOWN, the query runs again, at most three times, one second apart.

The pull requestWhat wf.merge doesReturns
Is at a head other than headNothingrefused
Is a draft or closedNothingrefused
Is already mergedNothingmerged with its merge commit
Is already in the merge queueNothingqueued with its position and approval id
Has a merge queue and is mergeableenqueuePullRequest with expectedHeadOid = headqueued with its position and approval id
Has a merge queue and is not mergeable yetRecords it as waiting to be queuedwaiting with its mergeState and approval id
Is CLEAN or HAS_HOOKS with a check on its head still runningRecords it as waitingwaiting with its mergeState and approval id
Has no merge queue and is mergeablemergePullRequest with method, else the repo’s default, and expectedHeadOid = headmerged with the commit
Has no merge queue, and is BLOCKED, UNKNOWN, or UNSTABLE with a check still runningRecords it as waiting to be mergedwaiting with its mergeState and approval id
Has no merge queue and is BEHIND, DIRTY or otherwise not mergeableNothingrefused
Has a check on its head that failedNothingrefused, naming the check

Mergeable means a mergeStateStatus of CLEAN or HAS_HOOKS with no check on the head running or failed, or UNSTABLE when every check on the head that did not pass ended CANCELLED, SKIPPED or NEUTRAL. GitHub’s own merge button accepts any UNSTABLE pull request, but UNSTABLE also covers a failed optional check, so wf.merge reads the checks. A check that ended FAILURE, ERROR, TIMED_OUT, ACTION_REQUIRED, STALE or any other outcome makes it refuse, and a check still running makes the pull request not mergeable yet, so wf.merge records it as waiting. ADR 0016 moved that case from refused to waiting on a repo with no merge queue. ADR 0003 has the reasoning. wf.merge never turns on auto-merge: on a merge-queue repo, auto-merge set on an already mergeable pull request never joins the queue. Every result carries status, repo, pr and head; refused adds a reason. When gh cannot reach GitHub at all, the call throws.

A waiting record holds the repo, the pull request, the approved head, who asked (thread and label), and the merge state it saw. A queued result keeps the record too, marked as sent, so the board follows the pull request until it merges or leaves the queue. The board’s GitHub reconcile queues a waiting pull request once GitHub shows it mergeable at the approved head, or merges it on a repo with no merge queue, and opens a new merge gate if the head moves first. It never merges over a review that requests changes: GitHub reports such a pull request BLOCKED, and the record waits until the block clears or an admin merges the pull request on GitHub. A merge, here or on GitHub, drops the record. A repeat call replaces the record, and the board acts only on the latest one.

The service runs gh api graphql with the gh login of the user it runs as, so gh must be on the service’s PATH and signed in. execute code never reaches gh or the network itself; see Security.

async () => wf.merge({ repo: "acme/widgets", pr: 81, head: "d4db97c0e1f2a3b4c5d6e7f8091a2b3c4d5e6f70" })

GitLab merge requests

repo takes <host>/<group>[/<subgroup>...]/<project> for a host listed under forges, or the merge request’s URL, in which case pr can be left out. wf.merge reads the merge request over REST with glab api, the same read wf.pr makes, plus the project’s merge_trains_enabled and, on a merge train project, the train car’s position from GraphQL. The table above holds with a merge train in place of the merge queue:

  • On a merge train project, a mergeable merge request joins the train with POST /projects/:id/merge_trains/merge_requests/:iid, with sha = head and auto_merge: true, and returns queued.
  • Elsewhere it merges with PUT /projects/:id/merge_requests/:iid/merge, with sha = head, should_remove_source_branch and auto_merge: true, and returns merged.
  • method: "squash" sends squash: true, and merge or rebase sends squash: false. GitLab takes no other method per merge, so the project’s merge method applies. With no method, the merge request’s own squash setting applies.

GitLab’s HTTP answers map onto the same results:

GitLab answersMeaningReturns
405It cannot merge the merge request yetwaiting with a reason
409sha is no longer the headrefused with “head moved”
422The merge failedrefused with the reason
401 or 403The glab login has no permission to mergerefused with the reason
400The request was refused, as on an instance that requires the sharefused with the reason

GitLab can also take the merge over. It sets its own auto-merge when its pipeline state lags the service’s read, and it answers 202 when it schedules the merge request to join the train once its pipeline passes. In both cases the service cancels that with POST .../cancel_auto_merge, or .../cancel_merge_when_pipeline_succeeds on a GitLab without it, and returns waiting, so the approval stays with the service, as it does on GitHub. When the cancel fails, the reason says GitLab will merge it on its own. A waiting approval stays waiting while GitLab keeps answering 405 to the reconcile’s merge, with the answer kept as its last error. GitLab records no reason when a car leaves a train, so the board reports a dropped car as one that left with no reason recorded.

The board’s merge answer

When the user answers a merge card that wf.pr ready opened with one of its buttons, such as merge or merge and deploy, the service runs the merge itself, with no ticket turn:

  1. It calls wf.merge for the ticket at the card’s head, with the method from the worker’s wf.openChild brief. A queued or waiting result holds the approval in the merge wait, and PR reconcile follows it.
  2. Once the forge shows the pull request merged, it deletes the head branch through the API, unless the forge already did, the branch is on a fork, or the branch’s tip is no longer the merged head. On GitLab that is the merge request’s source branch, deleted with DELETE /projects/:id/repository/branches/:branch.
  3. It resolves the ticket’s merge cards for the pull request.
  4. When no pr-scoped delivery stage remains after merge, it sends the worker Merged #<n> at <merge commit>. Hand off.
  5. It wakes the ticket only when stages remain to run: a pr-scoped stage, or on the ticket’s last PR a ticket-scoped one. The wake names the remaining stages and the ones the answer approved. Otherwise the ticket reads the merge in its digest.

A pull request merged on GitHub while its merge card is still open counts as merge alone. On a card GitHub reconcile opened after the approval, requeue and merge run wf.merge again at the card’s head, and ok accepts the queued head and keeps waiting. Any other answer goes to the ticket, and drops the service’s approval and its merge wait.

The ticket gets the answer as before when the service cannot decide: the brief gave no method, the reconcile is off, no open worker link holds the pull request, or the card predates this behavior. A refused result, or a wf.merge call that throws, also goes to the ticket, with the outcome. ADR 0016 records the rules.

wf.flow

wf.flow() reads each covered repo’s open issues through gh api graphql, then applies the ready rules when flow.maxTickets is configured. Covered repos come from flow.repos, or from active T3 projects’ GitHub remotes when flow.repos is omitted, with flow.includeRepos and flow.excludeRepos applied. It needs no caller and changes nothing. It returns:

FieldHolds
enabledfalse when flow.maxTickets is unset, whether the config has no flow block or sets repo overrides only. Without { graph: true }, every list is empty and wf.flow() reads nothing from GitHub.
launch, maxTicketsThe config’s values, or null and 0 when the launch queue is off.
maxTicketsTotalThe config’s ticket cap on open board tickets, set even when the launch queue is off.
freemaxTickets minus the flow tickets running, never below zero and never more than maxTicketsTotal minus every open board ticket.
runningThe flow tickets: label, repo, number, url, and the ticket’s thread and link. thread is null for a launch that hasn’t joined yet. A ticket whose issue has closed isn’t listed.
queueThe ready issues in launch order.
blockedThe matching issues held back by an open native or body-parsed blocker, an open prStack dependency, a fileConflict with a running ticket when flow.serializeFileConflicts is enabled, an unresolved blocker reference, a plain blocked label, or blocked: external, in the same order.
skippedReady issues kept out of the picks, in the same order: skipped on a launch card, or still open after their own ticket finished. Each comes back once its labels or blockers change.

Each issue in queue, blocked and skipped has repo, number, label, url, title, priority, milestone, createdAt, parent and unblockedBy. priority is high, medium, low or null, milestone has title and dueOn or is null, and unblockedBy lists the closed issues that used to block it. A blocked issue adds blockers, the open issues that block it, and external, which is true when it carries blocked: external. It also adds blockedLabel: true when held by a plain blocked label, unresolved for unresolved blocker references from its body, prStack for stacked PR or sequential part: n/N holds (each with repo, number, label, url, and optional branch, baseBranch, pr, basePr, part), and fileConflicts when flow.serializeFileConflicts holds it behind a running ticket touching overlapping files (each with repo, number, label, url, files). An issue with more blockers than GitHub returned in one read stays in blocked with moreBlockers: true. When gh can’t read an explicitly configured repo, or cannot read any discovered repo, the call throws and names the repo.

wf.flow({ graph: true }) also returns graph, the dependency graph the board reads from GET /api/flow, even when config.json has no flow block. It reads every open issue, its body and open pull requests across covered repos, inspects local worktree branch ancestry, modified files and static module or workspace dependencies when a local checkout is attached, keeps transitive blocker chains intact through unlabelled issues, and uses the batched tickets query for any active ticket or body-referenced issue not already in that read. Each edge carries kind as blockedBy, parent, prStack, fileConflict or codeDep and source as github, body, git or code. prStack edges include optional branch, baseBranch, pr, basePr and part fields; fileConflict edges carry files listing the overlapping repo-relative paths; advisory codeDep edges carry modules or symbols naming static Cargo, Rust, JavaScript, TypeScript or Python module and symbol dependencies without holding readiness, launches or cycle warnings. Queue-only reads skip codeDep analysis. Inferred body edges and advisory fileConflict or codeDep edges dismissed from the board’s inspector are stored in store.db (flow_dismissed_edges), omitted from graph.edges, excluded from readiness and flow.serializeFileConflicts checks, and returned in graph.dismissedEdges ({ from, to, kind, at }) so they can be restored (native source: "github" edges are never suppressed). graph.warnings and each affected node’s warnings report cycles, unresolved references, and plain blocked labels with no linked open blocker. wf.flow() leaves graph out by default because it can be large. The dependency graph describes its nodes, edges, diagnostics and smart lane rules.

async () => {
  const f = await wf.flow();
  return { free: f.free, next: f.queue.slice(0, 3).map(i => `${i.label} ${i.priority ?? "-"}`) };
}

wf.flow.next() runs one pick by hand, under the rules the board applies when a slot opens (The flow). It takes the first ready issue that has no launch card yet. With launch: "ask" it raises that issue’s launch card, with "auto" it launches the ticket, and with "off" it reads nothing and launches nothing. It returns:

FieldHolds
launch, freeThe config’s mode and the free slots the pick saw.
pickedThe issue it took, if any: label, url, title, priority and why (such as priority: high, unblocked by #9), with card for the card it raised, launched for the wf.launchTicket result, or error when the launch threw.
offeredThe launch cards still open, each { label, card }. Each holds a slot.
retiredThe launch cards this pick resolved, because their issue is no longer ready or no slot is free.
reasonWhy picked is empty: no free ticket slot (followed by the count when the board is at maxTicketsTotal), no ready issue to launch, or the flow being off.
async () => (await wf.flow.next()).picked

wf.fileIssues

wf.fileIssues creates a multi-issue dependency plan on GitHub in topological order. Each entry in issues requires title and accepts optional fields: id for a symbolic local id such as "E", "P0", or "P1", repo, body, blockedBy, parent, track, priority as "high", "medium", or "low", touches for repo-relative paths, labels, queue, and note. Top-level repo, parent, track, priority, labels, and queue act as defaults for items that omit them, except that a top-level parent matching an item’s own local id does not attach that item to itself. When queue is true and flow.optIn.label is configured, the service adds that opt-in label unless sync is false. Entries in blockedBy and parent can name another item’s local id or an external GitHub issue as #N, owner/repo#N, or a URL.

Before writing anything to GitHub, wf.fileIssues validates every item and reference, checks that every target repository is reachable, and topologically sorts the batch across both parent and blockedBy edges. Any cycle, including a self-reference or a mixed parent and blockedBy cycle, or any unknown local id throws with zero partial writes.

For each item in topological order, wf.fileIssues:

  1. Substitutes real #N references within the same repository, or owner/repo#N across repositories, for every resolved parent and blockedBy target, and writes the canonical ## Flow block with Parent:, Blocked by:, Track:, Priority:, and Touches: into the issue body. If the body already has a ## Flow section outside fenced code, the service replaces that section; otherwise it appends the block.
  2. Creates the issue on GitHub through createIssue.
  3. Unless sync is false, wires native GitHub addSubIssue and addBlockedBy relationships, creates any missing labels, and applies track: <track>, priority: <priority>, flow.optIn.label when queue is true, and any custom labels. The service records permission and wiring errors in each item’s wiring object and in top-level errors.
  4. When called from a thread with report omitted or true, records each created issue on the board’s new-issues list.

The result holds { ok, order, issues, byId, errors }. The issues array follows creation order and gives each issue’s id, inputIndex, repo, number, label, url, title, body, resolved parent and blockedBy, applied labels, reported, and wiring. The byId map indexes each symbolic local id to { repo, number, label, url }.

async () => wf.fileIssues({
  repo: "acme/widgets",
  track: "auth",
  priority: "high",
  issues: [
    { id: "E", title: "Epic: auth refresh", queue: false },
    { id: "P0", title: "Phase 0: token store", parent: "E", touches: ["src/tokens.rs"], queue: true },
    { id: "P1", title: "Phase 1: refresh flow", parent: "E", blockedBy: ["P0"], touches: ["src/auth.rs"], queue: true },
  ],
})

console

async () => {
  console.log("starting");
  console.warn("this goes to logs too");
  return "done";
}

returns {"result": "done", "logs": [...]} with both lines.

The board

The service is the root of the link tree, in place of an LLM overseer thread. A fixed virtual node, board, always exists, and ticket threads join it with wf.join({ parent: "board", label, role: "ticket" }), or with wf.init({ role: "ticket" }) when a thread starts a ticket on its own. No overseer thread runs, so no ticket’s messages land in any model’s context until someone asks.

The page is http://127.0.0.1:47731/ on the default port; use the port you gave --port or T3CM_PORT if you changed it. It is one embedded HTML file with no external requests, in light and dark, and it raises a browser notification for each new card while the tab is hidden.

What the page shows

The page is a command bar over four views. The bar holds the view tabs, Ask, Launch, and the update, skills, notification, density, theme, layout, settings and shortcut buttons. Each tab carries one count: Dispatch the cards waiting on you, New Issues the issues with no ticket, Queue & Graph the issues ready to launch, and Activity & Settled the finished tickets waiting to be settled. A filter never changes the tab counts. The tabs follow the WAI-ARIA tab pattern, so the arrow keys, Home and End move between them, and the page remembers the last view in its address and in this browser. Below 640 px the tabs read Dispatch, Issues, Graph and Activity, and below 820 px they move to their own row under the bar.

Under the bar, one telemetry line shows the connection, the ticket count (click it for Queue & Graph), the pull requests merged on open tickets, where the next ticket launch goes, as Launch routing describes, and the filter bar with search. Below 1180 px the line wraps.

The ticket count reads like “4 running · flow 6 · cap 8”: the tickets open on the board, launches still waiting to join included, then the flow’s maxTickets and the ticket cap, maxTicketsTotal. The flow part is left out when no flow queue is set. At the cap, the dot turns to a warning ring and new launches are refused.

Dispatch, New Issues and Activity & Settled fill the window as fixed panes when it is wider than 1120 px and at least 600 px tall, or at least 641 px wide and 700 px tall. The page then never scrolls, and each pane scrolls its own list under the pointer. Needs you takes at most 40% of the height, or 30% once the columns stack at 1120 px and below, where PRs in progress and Recently merged sit side by side. A smaller window scrolls the view as one page, so every list keeps enough height to read.

Dispatch is the first view, with three sections:

  • Needs you. Gates, blockers, reports and the watcher’s escalations each become a full-width card, blockers first, with an amber frame for a gate and a red one for a blocker. A card opens with the ask itself. A merge gate whose pull request belongs to a worker on the board reads as that pull request and its title, such as “Merge PR #283: feat: sync parsed links”, with the head commit on the line below. Then come the ticket, its issue title and how long the card has waited. When nothing waits, the section shrinks to one green “All clear” line, and when a filter hides every card it says so instead. Its answers are the filled buttons, as Reply buttons describes, followed by a link to the PR or issue the message names and the quieter Reply, Dismiss and full-message controls. The ticket label jumps to the ticket’s row. An answer waits 5 seconds before it goes, with an Undo button and a bar that drains as the seconds count down. The countdown changes only the bar and the seconds, so Undo keeps keyboard focus and a reply half typed in another card stays put. Answering a card sends the ticket one reply and resolves the card. A ticket that clears its gate, or sends a newer gate message, resolves its older gate cards, and its handoff resolves all of its open cards. A worker’s blocker, or any gate it opens other than merge and delivery:<id>, comes to the board past its ticket, as relay describes. Its card sits under the ticket and links to the worker’s thread. Answering it with one of its buttons or “hold” sends the worker the reply. Any other answer goes to the ticket, and so does an answer that starts with “merge”. The worker resolves its own cards when it clears its gate or hands off, and a ticket’s gate clear leaves them open. While one waits, neither the ticket nor a blocked worker is nudged. A pool thread that stops on a usage limit gets a move/wait card, unless its pool’s moveOnLimit is auto, which moves the thread with no card, or never, which leaves it. A failed automatic move falls back to the card.

  • Issues in progress. Each open ticket leads with its human title, the humanTitle in /api/state, beside its label as a code badge, and a status pill read from its workers: Needs you, Blocked, Paused, Failed, Running, Ready, Attention, In review, Waiting or Idle. Pause and Close sit beside the pill. A ticket split into pull requests shows its route as a line of stations, one per worker in step order and one for the steps not started, with “Step 4 of 10 · 3 merged” and the share landed above it:

    StationMeans
    filled green, joined by a green linemerged
    amber ringwaiting at a merge gate on the board, or a worker that needs you
    green ringready to merge or queued
    blue ringin review or CI, or a worker still building
    red square ringfailing checks, a conflict, changes requested or a failed worker
    filled greya finished worker with no pull request
    dashed ringnot started, or the steps left

    Each station is an equal share of the row, so a ten-step route still fits on a 390 px phone. Selecting a station opens that worker in the inspector. Rows group by state, with the most urgent first:

    MarkState
    filled diamondneeds you: it has an open card
    crossfailed, or blocked
    half-filled ringrunning
    dashed ringwaiting
    hollow ringidle
    two bars, violetpaused (pausing)
    checkdone

    A ticket that needs you shows a Reply "merge" link to its card. Other rows show the last message, and a gate already answered reads “Answered: …”, or “Dismissed: …” when you dismissed its card. The workers sit at the end of the row, with finished ones folded into a count that expands. A pull request shows as an outlined pill with its number, and on the ticket’s own row its state: open, queued, merged or closed. Once a GitHub reconcile has read an open pull request’s readiness, the pill says where it stands instead:

    PillMarkMeans
    ready, greenringed checknot a draft, checks passing or none, no review held, and GitHub can merge it; a queued pull request is green too
    review, CI, CI failing, draft, changes, conflict or behind, blueringed clockstill in review or CI: the word names what holds it
    failing, redtriangleapproved, but a check at the head failed

    A worker’s pill shows only the number, with the same mark and color, and its tooltip says the state.

  • PRs in progress. One row per pull request on an open ticket, and one per worker still building with no pull request yet, keyed by the pull request’s URL so two repositories never share a row. A row shows PR #283 or WIP 4/5, a title, a pill from its verdict, the parent issue and its title, the step, and its age. The title is the worker’s humanTitle or issueTitle, else the ticket’s, so it names the issue the pull request closes. Gates sort first, then failing, ready, in review and building. Active, Merged and All pick which rows show, and the heading counts the rows in the one picked. Under Active, Recently merged lists the last five merged pull requests, each on two lines so the title never cuts mid-word.

New Issues is a full-width triage list of the issues threads have filed and reported with wf.issue that have no ticket yet, newest first. Each row shows the issue’s repo#n as a code badge linked to GitHub, its title, how long ago it was filed and the thread that filed it. When a worker already covers the issue, the row says so before you launch a duplicate: Fixed by PR #284, PR #283 open, or Running in its worker, from coveredBy, and its Launch button reads Launch anyway. A badge opens the covering ticket in the inspector, or the pull request when the ticket is not on the board. Launch and Dismiss stay quiet until you hover or focus the row, and below 820 px they always show. Show dismissed, beside the heading when any are dismissed, swaps the list for the dismissed issues, each with Restore. New issues covers what each button does.

Queue & Graph holds three panels, each the full width of the page:

  • Flow queue, when the config has a flow block: the Ready, Blocked and Skipped issues side by side, Ready in the order the board launches it. The flow queue covers what each row shows.
  • Launch routing, once the watcher has read the routing, collapsed until you open it: where ticket launches go, over a time range you pick. The routing panel covers what it shows.
  • Dependency graph, which draws the open tickets and the flow’s issues in track lanes with the links between them, as The Queue & Graph view describes.

Activity & Settled holds the activity feed beside the finished tickets:

  • Activity. Notes and events from tickets, the latest board.feed (50) of them, under the ticket and worker that sent them. Runs from the same sender fold into one row that expands. The board drops kind prefixes and Publishing: tails, and shortens hashes to 7 characters and GitHub links to #65. When a launch picks from a pool in models.ticket or board.pool, each launch adds an entry that names the instance it went to and why.
  • Finished, with Done and Settled tabs and one search box over both. Done holds the tickets that finished and wait for you to settle them, with Settle all done. The search matches a finished ticket’s label, title and repository, and a settled ticket or ask’s label, question and answer. Settling covers Settled.

Launch and Ask open from the command bar, or with l and a, in a drawer that slides in from the right edge, 460 px wide or the full width of a phone. Like the inspector, it is modal: the board behind it dims, Tab and Shift+Tab stay inside it, and the close button, a click on the dimmed board, or Esc puts it away and returns focus to what opened it. Only one drawer is open at a time. Launch and Ask keep what you typed while closed. An answer that arrives while Ask is closed puts a green dot on the Ask button until you open Ask. Ctrl+Enter (Cmd+Enter on a Mac) in the Launch box launches. Launch takes GitHub, GitLab, and Jira issue references (owner/repo#41, PROJ-123, or an issue URL) and makes each one a ticket thread. When a non-GitHub reference does not resolve to a T3 project through an origin remote or trackers mapping, Launch shows a project picker for that reference so you can choose its T3 project before launching. Before you launch, the board shows which model and source (.t3-workflow.json, AGENTS.md, user config, board setting, or default) the launch will use; when an issue’s repository overrides models.ticket in its .t3-workflow.json or AGENTS.md, the board says so. The model pickers in Settings, which the Change links beside Launch and Ask open, offer two modes for both ticket launches and the ask box: a specific model (provider instance, model and effort from T3’s orchestrator_capabilities) or a pool (only pools configured in t3cm). Saving the ticket model writes the user-config layer of models.ticket (~/.config/t3-workflow/config.json); saving the ask model writes board.askInstanceId, board.askModel, board.askEffort or board.askPool in t3cm’s config.json. Both persist and take effect on the next launch or question with no restart. Ask your agent takes a question about the board or a request for work, and starts a short-lived scratch thread on the ask model. The thread gets the list of T3 projects (id, title and owner/repo). A question, such as “which tickets wait on me?”, gets a read-only answer and launches nothing. A request, such as “cut a new release for t3-codemode”, is not done in the scratch thread: it picks the one project the request is about and calls wf.dispatch, which launches a thread in that project. The launched thread joins the board and shows in Dispatch under Issues in progress, and the answer names it and its project. When no project fits, or more than one could, the answer asks which one and nothing is launched. The scratch thread writes its answer under Ask, and then gets archived.

Times show as ages (36m, 1h 32m); hover one for the local time.

The page starts dark. The theme button in the command bar, or t, switches it to Light, then System, which follows your system’s setting, then back to Dark, and this browser remembers the choice. A browser that blocks storage still switches, but goes back to Dark on reload. The density button, or d, switches the rows between comfortable and compact. Below 640 px the button hides and rows stay comfortable.

The layout button, next to the theme button, switches between two layouts of the same board, and this browser remembers the choice. A browser that never picked one opens in the layout board.layout names in the config, Dispatch unless it says workspace. Dispatch is the command bar, telemetry line and views this page describes. Workspace is a calmer layout in a neutral palette with one accent color for primary actions: a left nav (Overview, Needs you, PRs, New issues, Graph and Activity, each with a count), and a top bar with search, the connection and launch-routing line, and Launch. Its Overview opens with one banner per card waiting on you, each with its options, Reply and Dismiss, and shows nothing when none wait. Issues in progress and PRs in progress follow, side by side above 1180 px, each row with its full title, one muted line and one pill, Step n/m for a ticket with more than one pull request. Both layouts render the same state and send the same answers, with the same undo, so switching loses nothing. Needs you shows only the cards waiting on you, each with its full question and detail, and says so when none wait. PRs shows only the pull request list, with its Active, Merged and All filter. New issues, Graph and Activity show those views in the Workspace palette. Each nav view keeps its address (#needs, #prs), so a reload returns to it. A shortcut or link to a list the current view hides, such as Issues in progress from Needs you, goes back to the Overview. At 1180 px and below, Workspace drops the left nav for a row of the same six sections under the top bar, which scrolls sideways on a phone, so Launch, the layout button and every section stay reachable down to 390 px.

The top bar keeps every button on screen in both layouts. The view tabs use their short names at 1100 px and below, or at 1240 px and below while the update or skills button shows. The buttons drop their labels at 1023 px and below, or at 1080 px and below while either of those buttons shows. At 940 px and below the view tabs move to their own row.

Single-key shortcuts work while no field has focus: / focuses search, a opens Ask, l opens Launch, t switches the theme, d switches the density, g then d, t, i, q or a goes to Needs you, Issues in progress, New Issues, Queue & Graph or Activity, j and k move between cards and rows, and ? lists the rest. The list has a switch that turns them off. j and k also move through the Recently merged rows and the flow queue’s rows. Enter on a focused card or row, a flow queue row included, opens it in the inspector. While a drawer is open, the single-key shortcuts stay off, except the g jumps, which close it first.

The gear button in the header opens Settings. What it shows depends on who opened the board.

A handoff or closed message marks a ticket done.

Settings

On a board you open at a loopback address, the gear button in the header opens Settings, which edits all of t3cm’s config.json. A remote board gets the full dialog only when its own GET /api/settings answers 200, which needs all of these:

  • board.remote.mode is "tailscale".
  • The Tailscale login is in board.remote.settingsUsers or, when that list is empty, is the host’s own Tailscale login.
  • The request arrives over HTTPS with X-Forwarded-Proto: https, as Tailscale Serve sends it.

Any other remote board, including a pairing-mode session and an allowed Tailscale user who is not a settings user, gets 403 from the settings API. Its gear opens Settings with only the ticket and ask model pickers, which save as usual. See Board settings for why, and for what a remote read returns.

SectionHolds
LaunchesThe ticket and ask model pickers, and board.runtimeMode
PoolsEach pool and its members, with each member’s live state
BoardThe other board keys, such as feed, the GitHub check intervals, openLinks, layout and remote
FlowLaunch mode, maxTickets, the ticket cap maxTicketsTotal, repository discovery (repos, includeRepos, excludeRepos), queue opt-in filter (optIn.label, optIn.milestone), and serializeFileConflicts
Workflow linkslink, wake, the body and reply caps, digestLines, and a JSON editor for roles
RuntimeTimeouts, run limits, the watcher interval, the hold limits and updateCheck
Upstreams and deny listdeny, one tool per line, and a JSON editor for upstreams
All keys (JSON)An editor for the whole file, and a read-only view of every key with its default

Edit a key that has no control of its own, such as the older board.ticketModel, under All keys (JSON). Outside Pools, a field shows Default when the file does not set its key, and Reset takes the key out of the file so the default applies again. Settings leaves the keys you don’t edit as the file has them, and it writes a list whole. In Pools, choosing a member can fill in the pool’s driver, and turning Mixed on or off moves the model and effort between the pool and its members. Each field shows the value that Save will write.

The two model pickers save on their own. The ticket picker writes models.ticket in the workflow config, which is a different file. The ask picker writes config.json, so its Save is off while you have other unsaved changes. The other fields wait while it saves.

Save settings writes every section at once and pauses editing until it finishes. It then reloads the service, which also applies any hand edit that was waiting in the file. The dialog lists those waiting keys before you save. A save can end in these ways:

  • An edit that fails t3cm’s checks writes nothing. The error shows next to its field and at the top of the dialog, where a click takes you to the field. Validation reports the first error it finds, so the next save can show another. When T3 does not answer, the save goes on with pool members that t3cm could not check, and the dialog says so. That holds for a retry too. If T3 rejects a member and then stops answering, saving again without a change writes that member with the warning.
  • Settings refuses to save when the file changed on disk since it read it. It finds the change when you save or when it reads the file again, lists the keys that changed and turns Save off until you discard your edits and load the file. You can copy your edits from All keys (JSON) first. An editor that saves the file while t3cm writes it can still lose its change, as How t3cm writes the file explains.
  • A change to maxConcurrentRuns, upstreams or board.remote waits in the saved file for a restart. The dialog marks those fields Needs restart and lists every key that still waits, earlier changes included.

In Pools, add a pool by name and then choose its driver, model and members. The lists hold what T3 offers now. Type another value takes one that is missing, such as when T3 is down or leaves a model off its short list. The states beside the members describe the pool the service runs, so they change after you save. They refresh every 20 seconds while Pools is open. Member order matters to the priority strategy, so each member has Up and Down buttons.

Esc closes the dialog, and it asks before it drops unsaved changes to the file. A model picker’s unsaved choice doesn’t count: opening Settings again discards it. The arrow keys move between sections, and a narrow window shows the sections as a menu.

The dialog holds an edit it can’t save as shown:

  • Save writes nothing while a field fails the dialog’s own checks, and takes you to it. The service checks the whole file again on each save.
  • While All keys (JSON) holds text that isn’t valid JSON, the other sections take no edits.
  • While a field elsewhere fails the dialog’s own checks, All keys (JSON) is read-only. The dialog names the field to fix first.
  • A number field refuses text it would change, such as 12abc, or 1,5 in a browser that reads only . as a decimal point. Clear the field and type the number again.
  • Save waits while the pool name box holds a name you haven’t added.

The dialog cannot repair a file that is broken JSON. It shows the error, and t3cm config edit repairs the file. The dialog also refuses an integer beyond 9007199254740991 in either direction, because a browser would round it. Edit a file that holds one with t3cm config edit. A whole number written with a decimal, such as 25.0, becomes 25 when Settings saves the file, even when you did not edit it, and a number with more digits than a browser keeps is rounded, so 700000.00000000001 saves as 700000. When All keys (JSON) repeats a key, the last one wins and Settings drops the others. When link, board, board.remote, flow or flow.optIn holds a list with entries, the dialog edits nothing until t3cm config edit makes it an object. The JSON editors show any literal credential in the file, so use an ${env:NAME} or ${file:path} reference in upstreams.

Updates

When a newer t3cm release is out, the header shows Update to vX.Y.Z. It opens a panel with the t3cm update command, a button that copies it, and a link to the release notes. Hide until the next release hides the button until a later release comes out; the board remembers that per browser. After the service restarts on a new version, the page reconnects by itself. Once the service runs a newer version than the loaded page, the button reads Reload for vX.Y.Z, and a click loads the new board.

When the T3 workflow skills are behind this release, edited, installed by npx skills, or a setup step is missing, the header shows a warning button such as Skills out of date or Setup step missing. Its panel says what drifted and lists each command that fixes it, such as t3cm skills update or run setup-t3-workflow: new slot models, each with a copy button. The button goes away on the next check after the fix. A machine with no skills installed shows nothing.

When the skills are newer than the release the service runs, the service is the stale part, so the button reads Service needs a restart and its fix is this platform’s restart command, such as systemctl --user restart t3-codemode. t3cm doctor reports the same mismatch with the same command.

Launch routing

In the telemetry line, after the connection status, the board shows where ticket launches go. It follows the ticket model the board resolves: models.ticket in the user config, else legacy board.pool or the board ticket keys, else the default.

  • With a pool, it names the member with the largest share of the last 24 hours’ picks, such as claude-b 75%. When the pool made no picks in that time, the share is the member’s configured weight. A limited member also shows its reset time, as in claude-a 25% until 21:00.
  • Without a pool, it names the one instance launches run on, such as claudeAgent (no pool).

A dot before each member shows its state: filled green for ready, amber for held at its reserve, a red square for limited, grey for disabled or unable to run its model, and a grey ring when T3 did not answer. Hovering over or focusing the indicator opens a tooltip with the strategy, what the shares count, and each member’s state, reason, running threads and limit reset time. Escape or a click elsewhere closes it, and clicking or tapping the indicator opens the routing panel in Queue & Graph. The tooltip lists every member, and no panel above it clips it, on a desktop or on a phone.

The watcher refreshes the indicator on each pass and pushes it to the page over /api/events when a share, state or running count changes, so it updates without a reload. wf.usageStats and GET /api/usage-stats return the same view for any window.

The routing panel

The Launch routing panel shows the same routing over a time range you pick. It sits in Queue & Graph under the flow queue and starts collapsed. Clicking the routing indicator in the telemetry line opens it, and so does its own Show button. This browser remembers which range it shows.

  • Time range. 1h, 24h, 7d or All, with 24h as the default. All covers every pick the store keeps.
  • Totals. The picks in the range, any picks by former members, and the threads running now. With no picks in the range, the totals say the share is the configured weight.
  • Members. One row per member, largest share first. Each row has the state dot, the share and its bar, the state, picks, running threads, and usage left once a usage source reports it. A limited member shows when its limit resets and why. Below that, the row counts the reasons picks chose the member, which are weight, priority, cheapest, last resort and moved, and the reasons picks passed it over, such as limited, at reserve and disabled.
  • Picks over time. 24 bars across the range, each stacked by member, with a key.
  • Tokens over time. The input and output tokens of the runs that ended in the range and have recorded counts, with the run count, then the same totals per provider. Below them, 24 bars cover the range, each stacked by instance in the picks chart’s colors, with a key that gives each instance’s total. When no token source reports counts, which is always the case against T3 today, the section says T3 reports no token counts yet and shows no numbers. When counts are reported but none fall in the range, it says so and shows no chart.
  • Pick and skip reasons. The same counts for the whole pool.
  • Running now. Running threads per instance, from the live board state.
  • Recent picks. The last five, with the time, instance and reason.

Without a pool, the panel names the one instance with its model, effort and running threads, and shows no picks chart. Its token section still shows.

The panel reads GET /api/usage-stats?window= when it opens, when you pick another range, and when the routing in the board state changes, so a new pick, a limit, a change in running threads or a newly counted run shows without a reload. The running counts always come from the live board state, even when a read fails. A collapsed panel reads nothing, and the panel stays hidden until the watcher’s first routing pass. A failed read shows under the panel with a Retry button.

Reply buttons

A gate, blocker or report sent with options gets exactly those buttons, and the board does not read the body for them:

async () => wf.send({
  kind: "gate", gate: "merge",
  body: '**ACTION NEEDED:** reply "merge" to merge #81, or "hold" to wait, here: https://github.com/acme/widgets/pull/81',
  options: ["merge", "hold"],
})

Each option must be a single line of 1 to 60 characters once trimmed, no two may match ignoring case, and a send carries at most 8. A send that breaks any of these fails, names each bad entry by its index, and leaves no card. A note, event, handoff or closed send with options fails too. A send with an empty list gets a card with no buttons.

Without options, the board reads the buttons from the body.

When a message has an **ACTION NEEDED:** line, its buttons come from that line alone, or from each such line when it has several. A quoted phrase elsewhere in the message never becomes a button. On an action line, each quoted answer after the first reply, answer or say becomes a button. The first line below gives two buttons and the second gives three:

**ACTION NEEDED:** reply "merge and deploy" to merge #81, or "merge" alone, here: https://github.com/acme/widgets/pull/81
**ACTION NEEDED:** reply how to track it: "advisory", "issue", or "nothing", here: https://github.com/acme/widgets/pull/37

Double quotes count whether they are straight or curly. Single quotes count only when they open after a space or punctuation mark and close before one or at the end of the line. That rule keeps the apostrophe in user's from starting or ending an answer.

A message with no action line gets one button per reply "X" phrase anywhere in it.

The board trims each answer and drops one that runs past 60 characters or onto a second line. Answers that differ only in case share one button, and a card shows at most 8.

A send that opens a card returns that card’s buttons as options, so the sender sees what the user will see. A gate whose card has no buttons also returns a warning: the user can still type an answer, but the sender should send it again with options, or quote each answer after reply on its action line.

Delivery gates and chains

The board keeps no delivery wording of its own. t3-ticket reads ordered stages from wf.slot("delivery", { files }) and passes explicit options on each wf.send({ kind: "gate", gate, body, options }) call. The builtin merge stage keeps gate: "merge" so GitHub reconcile tracks the PR, holds approval to head <sha>, and clears the merge gate once the PR lands. Every later gated stage uses gate: "delivery:<id>", such as gate: "delivery:deploy" or gate: "delivery:publish".

When a gated stage is followed by a consecutive run of gate: "chain" stages, t3-ticket passes one button per composable prefix, longest first, within the board’s 8-button and 60-character limits. For a pipeline with merge (always), deploy (chain), and verify (chain), the merge gate sends:

async () => wf.send({
  kind: "gate",
  gate: "merge",
  body: '**ACTION NEEDED:** reply "merge, deploy and verify", "merge and deploy", or "merge" to merge #81 at head d4db97c, here: https://github.com/acme/widgets/pull/81',
  options: ["merge, deploy and verify", "merge and deploy", "merge"],
})

Picking a shorter prefix runs that prefix and opens the next stage’s own gate: "delivery:<id>" card when reached, such as options: ["deploy and verify", "deploy", "skip deploy"]. Stages with gate: "never" run automatically once their predecessor succeeds. Stages with scope: "post-handoff" run outside the ticket. Under the default closeAfter: "ticket", the ticket posts a note on the issue and includes the remaining checklist in a final report and its handoff body without keeping the ticket open. Under closeAfter: "all", each remaining post-handoff stage opens a delivery:<id> gate before the ticket closes. ADR 0007 records the composable delivery design.

Filtering the page

The filter bar at the end of the telemetry line narrows the page to the work you pick. Each filter applies to the decision cards, the ticket tree, the pull requests, the activity feed, the Settled section, the flow queue rows and the dependency graph at once.

  • Project, Status and Card kind are multi-select dropdowns. Type in one to narrow its list, and Enter toggles the first value left. A project shows as the ticket’s owner/repo, or as its T3 project’s title while the repo is not known. The filter keeps the T3 project id, so a pick still holds once the repo arrives, and ADR 0004 has the reasoning. Status is running, ready to launch, needs you, blocked, blocked: external, paused, ready to merge, in review or CI, alert or done. A ticket can hold several: one whose worker runs while its pull request is in CI is both running and in review or CI, and a pick matches a ticket that holds any picked status. Ready to launch matches the flow queue’s Ready rows. Blocked: external matches the tickets and flow queue rows that wait on something outside the covered repos, as the dependency graph defines it. Card kind narrows only the cards.
  • Search narrows the page while you type, with no Enter. Every word must appear somewhere in the ticket label, the issue title or number, the repo, or the card or feed text. Esc clears it, and / focuses it when single-key shortcuts are on. While the inspector is open, the first Esc closes it and the next one clears the search.

While a filter is on, each count reads visible/total. A new card the filter hides shows up as “N hidden”, and clicking it clears the filter.

Contexts

A context is a named filter: a set of projects, statuses and card kinds, plus a search if you want one. The service stores contexts, so every browser that opens the board sees the same ones, and a change made in one browser reaches the others as it happens.

The Context menu at the start of the filter bar switches between them. Picking one applies its filter. All clears every filter, and so do Clear filters and the “N hidden” button. The same menu edits contexts:

  • Save filter as a new context names the filter you have on.
  • Save filter to a context replaces its filter with the one you have on. A context whose filter you changed reads “(edited)” until you save or switch.
  • Rename and Delete act on the context you are in. Delete asks for a second click.

Each browser remembers its own context and comes back to it after a reload. If that context was deleted, the page falls back to All. A context changed in another browser applies here too. A change that arrives while this browser is saving a context applies when the save finishes, so the newer of the two edits wins. A context you just saved stays on until the board sends a state that includes the save, however long that takes.

While a context is on, a browser notification goes out only for a new card inside it. A card outside it still counts toward “N hidden”.

The inspector

Click a ticket row, a worker, a route station, a pull request row or pill, a card’s ask or ticket line, a New issues row, a Settled ticket or an issue in the dependency graph, or press Enter on a focused card, row or issue, or a flow queue row, and the inspector slides in from the right edge with that item’s details, 460 px wide, or the full width of the screen when that is narrower. It is a modal dialog: the board behind it dims, Tab and Shift+Tab cycle through its own controls, and a click on the dimmed board closes it. The lists keep their scroll and keep updating behind it. The row or card it shows gets the hover shade in place, with nothing redrawn, so you find it again when the inspector closes.

  • Header. The ticket or issue as repo#N, the PR part such as PR 2/5 when a worker’s label or part names one, the same issue, pull request and parent chips as the row (or the worker’s own when opened from a worker), the title, and a close button.
  • Pills. The live state, the pull request pill with the same readiness word as the ticket list, paused, and the repository and project when /api/state knows them.
  • Actions. Open issue on GitHub, Open PR on GitHub, Open T3 thread, and whichever of Pause or Resume, Settle and Restore apply to the ticket. A new issue offers Launch and Dismiss, or Restore once dismissed. A new issue a worker already covers lists what covers it under Already covered, and its Launch reads Launch anyway. A plain click on a row’s pull request pill opens the inspector, and a Ctrl-click or middle-click goes straight to GitHub.
  • Needs you. The ticket’s open cards, each with Go to card, which focuses the card on the board.
  • Latest message. The ticket’s last gate, blocker, handoff or note. When the board holds only the start of it, the inspector loads the whole message from GET /api/msg/{handle}.
  • Workers. Each worker’s state, a link to its thread, its pull request and Pause or Resume. Opened from a worker, the inspector shades that worker.
  • Dependencies. With a flow block, a ticket or issue in the dependency graph shows its lane and its Blocked by, Unlocks, PR stack, Stacked, File conflicts, Code deps, Code used by, Parent and Sub-issues as chips, each with its state. PR stack chips include the branch, pull request or part detail, file conflict chips list the overlapping paths, and advisory code dependency chips name the module edges or referenced symbols. A chip moves the inspector to that issue, or to its ticket when it has one, and leaves the board where it was. Esc still returns focus to the item that first opened the inspector. The pills add the issue’s priority and milestone. An issue with no ticket shows its flow standing, such as “In the ready queue”, in place of the ticket sections.

The inspector follows its item while the board updates. If the item leaves the board, the inspector says so, keeps the last details it had and disables its buttons. Opening another item replaces what it shows. Enter on a row that has left the board but still holds focus opens nothing and announces that the item is gone. Esc or the close button closes the inspector and puts focus back on the item that opened it. The next Esc clears an active search. While the inspector is open, the single-key shortcuts stay off except the g jumps, which close it before they move focus. Go to card closes it too.

Context menus

Right-click a Needs you card, a ticket row, a pull request row, a Ready queue row, or an issue, link or lane title in the dependency graph to open a menu of its actions. The ContextMenu key or Shift+F10 opens it on the focused item, and a long press opens it on a touch screen. Each menu lists only what applies to the item now, and each entry does exactly what the matching button or link on the item does:

  • Card: its answer buttons, Reply, Dismiss, Inspect, Show in Tickets, Full message, its review link and Open thread. An answer or Dismiss waits in the same undo window as the buttons, and while it waits the menu offers Undo.
  • Ticket row: Inspect, Open thread, Open PR, Go to card, Pause or Resume, Close ticket on an idle, paused or failed ticket, Settle on a finished one, and the worker list toggles.
  • Pull request row: Inspect and Open PR.
  • Ready queue row: Inspect, Open on GitHub, Launch for an open issue with no ticket, and its linked issues.

The arrow keys, Home, End and the first letter of an entry move through the menu, Enter or Space runs an entry, and Esc closes it and puts focus back on the item. The single-key shortcuts stay off while it is open. A text field, and selected text, keep the browser’s own menu.

From a thread

CallDoes
wf.launchTicket({ issue, parentIssue?, part?, project?, title?, model?, effort? })Launch a ticket thread for a GitHub issue. Its link stores issue, parentIssue and part (issue identity)
wf.dispatch({ project, request, title? })Launch a ticket thread in a T3 project to carry out a request
wf.cards({ all?, context?, projects? })The open cards, oldest first, each with its repo and project; all includes resolved ones
wf.answer(id, text)Answer a card for the user, the same as a button on the page
wf.feed({ limit?, context?, projects? })The latest notes and events, each with its ticket, ticketLabel, ticketTitle, ticketStatus, repo and project
wf.board({ parent: "board", all: true })Every ticket on the board, with live status
wf.issue({ url, title?, note? })Put an issue this thread just filed on the new issues list
async () => (await wf.cards()).map(c => `${c.id} ${c.label}: ${c.options.join(" | ")}`)

context and projects narrow wf.cards and wf.feed to the same projects the page would show. context takes a saved context’s id or its name, and uses only its projects. Its statuses, card kinds and search stay on the page. projects takes a list of T3 project ids. A repo or title value from an older context works there too. Both follow the page’s rule from ADR 0004, so a card or row matches by its project id, by the repo or title the board knows for that id, or, with no project id, by a repo the board ties to the picked id. A card or row with no project and no repo matches nothing. An empty list, or a context with no projects, keeps everything. Giving both, or a context that does not exist, throws. With a filter, wf.feed scans the latest 200 rows and returns up to limit of the ones that match.

async () => (await wf.cards({ context: "Widget work" })).map(c => `${c.id} ${c.repo}: ${c.text}`)

wf.launchTicket finds the T3 project whose workspace origin remote is the issue’s GitHub repo, unless project names one, resolves models.ticket for that project through the service’s slot resolver, and launches a thread that works the issue and reports to the board. The ticket is labeled repo#n, or owner/repo#n when a ticket for another owner’s issue of the same name and number already holds repo#n. Launching an issue that already has a ticket, or a launch that has not joined yet, fails. Precedence for the launch model is:

  1. model or effort passed to wf.launchTicket, reported as modelSource: "argument".
  2. The repository’s .t3-workflow.json or AGENTS.md, reported as ".t3-workflow.json" or "AGENTS.md".
  3. The user config’s models.ticket, reported as "user".
  4. Legacy board.instanceId, ticketModel, ticketEffort and pool in t3cm’s config, reported as "board".
  5. The built-in default, reported as "default".

The result always carries instanceId, model, effort, which is null when none applies, and modelSource. When the resolved choice is a pool in models.ticket or legacy board.pool, the launch picks a provider instance through wf.pick, adds pool and reason to the result, and logs a feed entry with instanceId and reason. Every launch checks its choice against T3’s orchestrator_capabilities. An unmapped repo, a missing or disabled instance, an unlisted model, an unsupported effort, an unknown or exhausted pool, or a failed launch throws and leaves an error card, never falling back to the built-in default. The launched thread is told to use the t3-ticket skill, which lives in this repo’s skills/ folder and is installed as an agent skill, apart from the service. The workflow skills covers installing them. Without the skills installed, launched threads do not know the workflow.

wf.dispatch launches a thread for work that has no GitHub issue. project names a T3 project by its id or title, ignoring case. The launch resolves models.ticket for that project in the order above, pools included, and applies board.runtimeMode the way wf.launchTicket does. The thread’s brief is request word for word, followed by a board link, so the thread joins the board as a ticket. Its label and T3 title are the project title and title, as in t3-codemode: release. Without a title, the label uses the first words of the request. When a ticket on the board, open or done, or a launch still waiting to join already has that label, the label gets (2), (3) and so on. When the scratch thread of a question from Ask calls wf.dispatch, the question records dispatched: { thread, link, projectId, project, label }, where project is the project title. The result has the same fields as wf.launchTicket’s. An unknown project or an empty request throws and launches nothing. A model that does not resolve or a failed launch throws and leaves an error card.

New issues

A thread that files a GitHub issue reports it with wf.issue, and the board keeps it on a list of new issues until someone acts on it. Threads know to report because setup-t3-workflow installs a short rule that Claude Code and Codex load in every session, so it reaches threads that run none of the workflow skills. Each entry records the issue’s URL, repo and number, and the title and note the thread passed. It also records the filing thread, with its T3 threadLink and threadTitle, and at, the time the thread reported it. An entry’s id looks like n3, and the list survives restarts. If T3 can’t give the thread’s link and title when the issue is reported, the entry keeps them empty. The next report of that issue fills them in.

An issue goes on the list once. Reporting it again, from any thread, changes nothing. Neither does reporting an issue that already has a board ticket, open, done or still waiting to join. The board matches tickets by their repo#n label, ignoring case. The label leaves out the owner, so an issue in another owner’s repo of the same name counts as having that ticket.

  • Launch runs wf.launchTicket for the entry’s issue, with its title as the ticket’s title. When the launch succeeds, the entry leaves the list and the ticket shows in Dispatch under Issues in progress. A launch that fails leaves the entry in place and an error card, as any failed launch does. Launching the same issue from the Launch tickets box also takes its entry off the list.
  • Dismiss takes an entry off the list without touching GitHub. Dismissed entries stay in the store, and Restore puts one back.

A worker that already took an entry’s issue does not take it off the list. Instead, the entry’s coveredBy in /api/state names each worker whose issue is that issue, best first:

kindMeans
mergedthe worker’s pull request merged
prthe worker has an open or queued pull request
workerthe worker is still open and has no pull request yet

Each entry also gives the ticket and worker labels, their threads as ticketThread and thread, the worker’s link and status, and its pr (with repository and number, or null). A finished worker with no merged pull request covers nothing. An entry no worker covers has an empty coveredBy.

A covered entry’s row carries a badge for each worker in coveredBy, with a mark, a word and a color: Fixed by PR #N in green for merged, PR #N open in blue for pr, and Running in its worker in blue for worker. Its Launch button reads Launch anyway, and says what covers the issue to a screen reader.

The page gets a reported issue within seconds, on the same event stream as everything else. While the pointer or focus is in New Issues, a new entry waits behind an “N new” button in the section’s heading, and an entry that leaves stays as a placeholder (“widgets#43 launched”) until you move away, so nothing under your pointer shifts.

While no entry waits, the view says “No new issues.” When dismissed entries exist then, the Finished search bar in Activity & Settled carries a Dismissed issues button that opens New Issues on the dismissed list, and Show new closes it again.

A new-issue row or ticket row that arrives on the event stream gets a green tint that fades on its own over about four seconds. An entry held behind “N new” gets it when you reveal it. Rows already there when the page loads, and rows a filter change brings back, don’t flash. With reduced motion set, the tint holds still for a moment and then goes, with no fade.

The flow

With a flow block in the config, which you can set from Settings under Flow, from setup-t3-workflow, or with t3cm config, the board starts the next ready issue when a ticket slot opens. A slot opens when a flow ticket sends its handoff or closed, when its link closes because its thread is gone or archived, and when its issue closes. The board also picks again on each GitHub reconcile pass, so an issue whose last blocker closed outside the board, or whose ticket’s issue closed, is picked up within one reconcile interval. With board.reconcileIdleMinutes at 0, only a ticket’s handoff or close and wf.flow.next() pick.

Each pick reads the queue from GitHub, the same queue wf.flow() returns, and fills the free slots in queue order. What it does with each issue depends on flow.launch:

  • ask, the default, raises a launch card such as “Launch widgets#60 next? (priority: medium, unblocked by #115)”, with launch and skip buttons and a link to the issue. launch starts the ticket through wf.launchTicket, with the same model choice as any board launch. The board reads the queue again first: when the flow is off, the issue is no longer ready, or no slot is free, the card closes and nothing launches. skip takes the issue out of the picks and offers the next ready issue in its place.
  • auto launches the issue through wf.launchTicket and posts “Flow launched widgets#60 (priority: medium, unblocked by #115)” to the activity feed. auto treats a priority: high issue like any other. A launch that fails leaves its error card, posts a feed event, and skips the issue, so the board doesn’t retry it on every pass.
  • off launches nothing and reads nothing from GitHub.

An open launch card holds its slot, so a pick never raises more cards than there are free slots. A pick resolves a launch card whose issue is no longer ready, for example because it closed, gained an open blocker, or got a ticket some other way. It also resolves the newest cards when tickets launched elsewhere took their slots. Switching flow.launch to off or auto resolves every open launch card on the next pick, and auto then launches into the freed slots. Dismissing a launch card leaves the issue in the queue, so the next pick offers it again.

A skipped issue stays out of the picks until its labels or blockers change: adding or removing a label, adding or removing a blocked-by link, or a blocker reopening puts it back in the queue once a pick sees the change. An issue that is still open after its own board ticket has finished is skipped the same way, so a ticket that stopped short isn’t relaunched on its own. Skipped issues show in wf.flow()’s skipped list, and the Launch tickets box still launches one by hand.

A ticket takes one slot, however many sub-issues or workers it runs. Picks, launch-card answers and every other ticket launch run one at a time, and a pick holds the board lock while it counts the open tickets and decides, so two launches can’t both fill the same slot. A launch from the Launch tickets box waits for a pick in progress to finish.

The up-next panel

With a flow block in the config, the Flow queue panel opens Queue & Graph and shows what the flow will launch next, with its Ready, Blocked and Skipped columns side by side. They wrap under each other on a narrow screen. It reads GET /api/flow, which returns what wf.flow() returns. Reading the panel never records a skip, raises a card or launches anything.

  • The heading counts the ready issues and shows the free slots and the launch mode, such as “1 of 3 slots free · launch: ask”.
  • Each ready issue is a numbered row in queue order: its repo#n linked to GitHub, its title, its priority (none without a priority label), the blockers that closed (unblocked by #115), and its milestone and due date. A blocker in another repository shows as repo#n.
  • Blocked lists the opted-in issues that still wait on something. Each row names its open blockers from GitHub links or parsed issue bodies, adds “and more” when GitHub lists more than 100, notes PR stack holds (with the base PR, branch or part), file conflicts with running tickets when flow.serializeFileConflicts is enabled, unresolved dependency references or an unlinked plain blocked label, or reads “blocked: external” for an issue with that label.
  • Skipped lists the issues the flow skipped (skip memory), each with the same details as a ready row.

Blocked and Skipped start open, and their headings fold them. Each row is one stop for j, k and the arrow keys, keeps its focus when the queue reloads, and opens its issue in the inspector on a click or Enter.

A ready row carries a ready pill, and a blocked row that waits on something outside the covered repos carries an external pill. The filter bar narrows these rows like the rest of the page, and while it is on, each heading count reads visible/total.

The panel reads the queue when the page loads, when a ticket opens or finishes, when a launch card opens or closes, and once a minute while the tab is open. Refresh reads it again now. A GitHub error shows under the panel. The panel is gone while the config has no flow block, and the page then reads nothing for it.

The dependency graph

GET /api/flow also returns graph, the issues across the covered repositories and the board’s open tickets with the links between them. With no flow block, or when flow.repos is omitted, t3cm discovers covered repositories from active T3 projects’ GitHub remotes and applies optional flow.includeRepos and flow.excludeRepos overrides. The graph reads every open issue across those repositories, so transitive blocker chains stay intact across unlabelled intermediates. Each open issue in a covered repo and each active board ticket is a node with tracked: true. An issue they link to outside that set, such as a closed blocker or an open blocker in an uncovered repository, is also a node with tracked: false and what the link carries: repo, number, label, url, title and state.

The graph reads each open issue’s body and sub-issues alongside its blockers and parent, so it makes no GitHub call per issue. The batched tickets query reads only active board tickets and body-referenced issues that were not already in that read, such as closed blockers or issues in uncovered repositories. Viewing the graph never enables auto-launching. Without flow.maxTickets, enabled stays false and the Flow queue panel stays hidden.

t3cm parses dependencies from each open issue’s body outside fenced code blocks, inline code spans and HTML comments:

  • A canonical ## Flow block with Parent:, Blocked by:, Track: and Touches:, or matching GitHub Issue Form sections: ### Parent / Epic, ### Blocked by, ### Track and ### Affected files. t3cm ignores blank _No response_ fields.
  • Standard prose directives: Depends on #N, Blocked by #N, After #N, Part of #N, Phase P<k> of #N or Phase <k> of #N, cross-repo references such as owner/repo#N or GitHub issue URLs, and tasklists - [ ] #N. Tasklists emit sub-issues by default, or blockers under a ## Dependencies, ## Blockers or ## Prerequisites heading.
  • Sibling title and phase references, such as Depends on Phase 1 or Blocked by "Setup auth", resolve against open and closed issues in the same epic or repository when unambiguous, so closing a referenced sibling unblocks its dependents cleanly. t3cm flags unresolved or ambiguous references with a diagnostic, and unresolved blocker references keep the issue out of the ready queue.

t3cm also infers git and file-overlap edges from open pull requests, local T3 worktrees, active ticket links and repository trees:

  • prStack (source: "git"). Reads each covered repo’s open pull requests (baseRefName, headRefName, closingIssuesReferences, Refs #N and <type>/<n>-... branch names) and inspects local worktree branch ancestry with git merge-base. When PR B targets PR A’s head branch or descends from A’s commits ahead of the default branch, t3cm emits a hard prStack edge between their issues. Active t3-ticket / t3-worker links carrying sequential part: n/N chains under the same parent emit prStack edges as well. A prStack edge holds the dependent issue out of queue until the base PR merges or the earlier part closes, and carries optional branch, baseBranch, pr, basePr and part details.
  • fileConflict (source: "code"). Combines modified files from open pull requests and local worktrees with repo-relative paths from Touches: and issue bodies (verified against the repository tree when a local checkout exists). Open issues in the same repository whose path sets overlap get an undirected fileConflict edge carrying files. These edges are advisory by default; set flow.serializeFileConflicts to true to hold conflicting issues while a colliding ticket is running and avoid launching conflicting issues at the same time.
  • codeDep (source: "code"). Builds a bounded static dependency graph from the local repository checkout across Cargo workspace crates, Rust use crate:: and mod edges, package.json workspaces, JavaScript and TypeScript imports, and Python imports, then maps those edges against each open issue’s resolved target files and symbol references. When issue A touches a lower-level module or defines a unique symbol referenced by issue B’s target files or body, t3cm emits an advisory codeDep edge from B to A carrying modules or symbols. codeDep edges are advisory only and never hold readiness, enter blocked, hold launches even when flow.serializeFileConflicts is enabled, or raise cycle warnings. Queue-only reads skip this pass.

edges lists each link once, from the issue that has it. Each edge carries source as github, body, git or code, and native github wins when both a native link and a body directive exist:

kindFrom, toRead the other way
blockedBythe blocked issue, its blockerthe blocker unlocks the issue
parentthe sub-issue, its parentthe parent’s sub-issue
prStackthe stacked issue, its base issuethe base PR or part unblocks the stacked issue
fileConflictan open issue, a conflicting open issue (undirected)both issues touch the paths listed in files
codeDepthe dependent issue, the lower-level module issueadvisory hint from modules or symbols

warnings lists graph-level diagnostics with kind, message, nodes and optional raw. kind is cycle for dependency, parent or mixed cycles, unresolved for unresolved or ambiguous body references, and blockedLabel for open issues with a plain blocked label and no open blocker linked.

Each node’s id is owner/name#N, and its lists use those ids:

FieldHolds
blockedBy, unlocksIts blockers, open and closed, and the issues it blocks. moreBlockers is true when GitHub lists more than 100 blockers.
parent, subIssuesIts parent’s id or null, and its sub-issues. moreSubIssues is true past 100.
stateopen or closed, or null when nothing read it.
labels, priority, milestoneAs GitHub gives them, with priority read from a priority: label.
track, trackByThe lane it belongs to, by the rules below.
flowListqueue, blocked or skipped when it is in that list, else null.
readytrue while it is in the ready queue: opted in when optIn is set, no open blocker or prStack hold, no unresolved blocker reference, no blocked or blocked: external label, no active fileConflict hold when flow.serializeFileConflicts is enabled, and no ticket.
externaltrue when it is labelled blocked: external, or when it has open blockers, GitHub listed all of them, no blocker reference is unresolved, and none is in a covered repo.
ticketIts board ticket’s thread, link and status, or null.
warningsAny cycle, unresolved or blockedLabel diagnostics affecting this node.
optInPresent only when flow.optIn is set. on is true when the issue carries the flow.optIn.label label, and inFlow is true when it matches the whole flow.optIn filter. locked says why the board cannot toggle it: its repository is not covered, it is closed or was not read, a ticket is running for it, it is external, or flow.optIn sets no label.

external here is wider than a blocked issue’s external, which reports the label alone.

A node’s track follows the first rule that applies:

  1. An explicit track label, checking track:<name> first, then *-track, then area:<name>, then Track: in the issue’s ## Flow block. For example, track: board maps to board, workflow-track maps to workflow, and area: api maps to api. Within each label form, alphabetical order wins. trackBy is label.
  2. Its parent epic. A sub-issue inherits the nearest ancestor’s explicit track label if one exists; otherwise it and its unlabelled root epic group under the root epic’s label, such as widgets#10. trackBy is epic.
  3. Its milestone’s title. trackBy is milestone.
  4. The track of its connected component, only when the component has at least two nodes. It inherits the highest-precedence track among its members, preferring label, then epic, then milestone, or else the label of the member with the lowest repo and number. trackBy is component.
  5. One shared per-repo Independent lane named <owner>/<repo>: Independent for singleton unlinked issues with no track label, parent epic or milestone. trackBy is independent.

Ticket rows on the board carry an external pill when their node is external, and the inspector shows the same pill.

The Queue & Graph view

The Dependency graph panel in Queue & Graph draws the dependency graph as an SVG swimlane view, with no library, reading the graph from GET /api/flow even when config.json has no flow block. This browser remembers the view you left the board on and opens it there after a reload; #queue in the address opens Queue & Graph, and an older #tickets-graph link still lands there.

  • Lanes. Each lane is a track, by the rules in the dependency graph: a track label, else a parent epic, else a milestone, else linked issues when a component has at least two issues, with unlinked singletons sharing one Independent lane per repository. Its heading names the track, what set it and how many issues it holds. Lanes holding a ticket come first, then label, epic, milestone, linked and independent lanes, each in name order.
  • Layout. A blocker or prStack base sits to the left of what it blocks, and a parent to the left of its sub-issues, so work flows left to right. Advisory fileConflict and codeDep edges do not constrain column order. The same graph always lays out the same way. A wide graph scrolls inside the panel, never the page. Each issue shows its repo#N, title and state: a ticket’s live state, or for an issue with no ticket ready, blocked, external, skipped, closed or open. Amber still marks only a ticket with an open card.
  • Links. A solid arrow runs from a native GitHub blocker to the issue it blocks, while a dashed purple arrow marks a blocker parsed from an issue body. A solid teal arrow marks a prStack dependency (source: "git"), a dotted amber line marks a fileConflict (source: "code"), and a dashed blue arrow marks an advisory codeDep hint (source: "code"). A dashed line runs from a parent to its sub-issue, or a dotted purple line when parsed from a body. Adjacent-column links curve within the column gap in either direction. Links that span multiple columns in either direction route through the row and lane gutters so they do not pass behind intermediate cards, and parallel links in a shared gutter take separate tracks. Hovering an edge shows a tooltip naming its source, branch/PR or part chain for prStack, overlapping file paths for fileConflict, or the module edges and symbols for codeDep.
  • Advisory links. At rest the graph draws only blockers, parents and PR stacks. An issue’s fileConflict and codeDep links appear while it is hovered, focused or pinned. The file conflict and code dep legend entries are toggles, off by default: turning one on draws every link of that kind, except links between two closed issues. Each viewer’s toggles are kept in the browser.
  • Sync parsed links. When the graph holds blockedBy or parent links with source: "body" that are not yet on GitHub, the panel heading shows Sync N parsed links to GitHub. Clicking it calls POST /api/flow/sync-links, which writes each parsed link to GitHub through addBlockedBy and addSubIssue idempotently with replaceParent: false. The panel then refreshes the graph so synced edges render with native source: "github" styling, and shows a dismissible status strip that lists any per-link permission errors or parent conflicts.
  • Edit dependencies in the inspector. Opening any issue from the dependency graph in the inspector lets you edit its DAG metadata directly and refreshes the graph at once:
    • Confirm or dismiss inferred edges. Each body edge (blockedBy or parent) and advisory fileConflict or codeDep edge carries Confirm and Dismiss buttons. Confirming a body edge writes the native GitHub addBlockedBy or addSubIssue link; confirming a codeDep edge writes a native blockedBy link; confirming a symmetric fileConflict edge previews the proposed blocker direction in the inspector (with Confirm, Flip, and Cancel) before writing the native blockedBy link and hides the advisory hint once GitHub accepts the link. Dismissing persists the edge in the flow_dismissed_edges table of store.db so it stops showing on the graph, stops blocking queue readiness or flow.serializeFileConflicts, and is skipped by POST /api/flow/sync-links. Dismissed edges incident to the selected issue appear under Dismissed edges with a Restore button. Native source: "github" edges are never suppressed by dismissals.
    • Add or remove GitHub links, tracks, and priority. Add a native blockedBy link, set or clear the native parent link (with a Replace parent prompt on a single-parent conflict), remove existing native blockedBy or parent links, and set or clear an issue’s track: <slug> or priority: <high|medium|low> label (POST /api/flow/edge and POST /api/flow/issue).
    • Put an issue in the flow or take it out. With flow.optIn.label set, the inspector shows an In flow switch for each issue in the graph. Turning it on adds the label on GitHub, creating the label when the repository lacks it, and turning it off removes it (POST /api/flow/opt-in). The Graph and the Ready queue refresh as soon as GitHub answers, so an issue with no open blocker goes straight into Ready. The switch works on open issues in covered repositories, and is disabled, with the reason beside it, for closed and external issues, issues with a running ticket, and repositories the flow does not cover. GitHub errors show under the switch. Graph nodes for open issues outside the flow carry a dashed not in flow tag, so they read differently from queued ones.
  • Triage DAG. Clicking Triage DAG starts a short-lived read-only scratch thread (POST /api/flow/triage) launched with runtimeMode: "approval-required" and interactionMode: "plan" (and blocked from calling t3cm execute operations) over the covered repositories’ open issues, existing edges, and tracked file layout using the ask model. The thread proposes missing blockedBy, parent, track, and priority changes as a reviewable diff panel above the graph (flowTriage in /api/state). Nothing is written to GitHub until you confirm individual changes or Confirm all (POST /api/flow/triage/{id}/apply), which writes through the same GitHub mutations and refreshes the graph immediately. Skip or Dismiss (POST /api/flow/triage/{id}/dismiss) discards proposals (or cancels a running triage thread) without touching GitHub.
  • Diagnostics. Dependency or parent cycles, unresolved body references, and plain blocked labels with no open blocker linked appear in a warning banner above the graph, add a badge on each affected node, and show in the inspector.
  • Tracing. Hover or focus an issue, and the chain of issues that block it (through blockedBy or prStack), however far back, turns red, and the chain it unlocks turns blue. A closed blocker no longer blocks, so the trace stops at it, and a parent link never counts as a blocker. Any incident fileConflict or codeDep edges and their peer issues stay highlighted, its parent and sub-issues keep their look, and everything else turns muted until the pointer leaves and focus moves out of the graph. The latest hover or focus picks the issue, and with the pointer off the graph, the focused issue keeps its trace. Clicking an issue pins its trace: it stays after the inspector closes and the pointer leaves, until Clear trace in the key bar removes it.
  • Filters. The filter bar, a saved context and search apply to the graph too. An issue they leave out stays in place with a dashed outline and muted text, so the layout never jumps, and the panel’s count reads visible/total. A ticket matches as its row would; an issue with no ticket matches by repo, its ready, blocked, external or closed standing, and its label, title, track and milestone.
  • Inspector. Click an issue, or press Enter or Space on it, to open it in the inspector.
  • Keyboard. The graph is one tab stop. The arrow keys move between issues lane by lane and left to right, as do j and k while single-key shortcuts are on, and Home and End jump to the first and last.
  • Live updates. The graph follows each board update. While the pointer or focus is in the graph, a change that would move issues waits until it leaves, so nothing shifts under the pointer.

While /api/flow is loading or failing, or when no GitHub repositories are discovered from T3 projects, the tab draws the open tickets with no links, one lane per repository and a Tickets lane for those the board has not placed, and says so above the graph. When a refresh fails after a good read, the tab keeps the last graph it read and says so.

GitHub reconcile

The board checks what it believes against GitHub on a timer, so a pull request merged, closed or dropped from a merge queue outside T3 still reaches the board and its ticket. It tracks:

  • each pull request of an open worker link,
  • each pull request an open card names, read once when the card opens: from its action line, or else from its whole message, and only when it names exactly one,
  • each pull request wf.merge saved as waiting to be queued, or sent to GitHub,
  • each pull request it last saw in a merge queue, until GitHub records why it left or until the first check 30 minutes after it left, so that a removal GitHub records late, or never records, still gets a report.

It reads them with gh as the user the service runs as, in one GraphQL query for every 100 pull requests it tracks, and makes no GitHub call when it tracks nothing. A check runs every board.reconcileActiveMinutes, 2 by default, while a tracked pull request is queued or waiting, and every board.reconcileIdleMinutes, 10 by default, otherwise. Loading the page runs one too, at most once every 30 seconds. docs/adr/0002-github-reconcile.md in the repository has the reasoning.

The same query reads each pull request’s readiness: whether it is a draft, its merge state, its review decision and its checks at the head. The board keeps the last read and shows it in /api/state as the pull request’s readiness, with no further GitHub call.

It also reads each pull request’s closing issue references, the issues its Closes #N lines name. An open worker link with no issue takes the first closing reference of the pull request its row shows, so a worker launched without an issue still shows the issue it closes. A link that already has an issue keeps it.

Each check compares what GitHub shows now with the board’s state now, and makes them agree:

GitHub showsThe board
MergedResolves the pull request’s cards opened before the merge, with the note “merged on GitHub at <sha>, <time>”. In the same transaction, clears the ticket’s merge gate when no other gate card stays open for it (later delivery stages use gate: "delivery:<id>", so reconcile leaves those untouched). Sends each ticket tracking the pull request one event to run its post-merge steps. When the service approved the merge itself, or the ticket’s merge card from wf.pr was still open, it runs the post-merge steps in code instead, as The board’s merge answer says
Closed without mergingResolves its cards opened before the close and sends each ticket one event. Reopening and closing it again sends another
Dropped from the merge queue for merge_conflict, failed_checks or manual removalOpens a report card per ticket that gives the reason, with requeue and hold buttons, or one card with no buttons and the steps to take by hand when no ticket tracks it. An approval older than the removal is dropped, so the board never queues the pull request again on its own
Out of the merge queue for 30 minutes with no removal recorded, no saved approval and no earlier report of that exitOpens a report card per ticket that says no reason was recorded, with requeue and hold buttons, or one card with no buttons and the steps to take by hand when no ticket tracks it. If GitHub records the removal while that card is open, a card with the reason replaces it. If a check sees the pull request back in the queue first, it resolves the card
Waiting to be queued or merged, now mergeable at the approved headSends enqueuePullRequest with the approved head as expectedHeadOid. On a repository with no merge queue, sends mergePullRequest the same way, with the approval’s method or else the repository’s default
Waiting to be queued, with a check at the approved head that failedHolds the approval and opens one report card per approval that names the failed checks, with a fix button. Queues the pull request and resolves the card once the check is re-run and passes. Resolves the card too when a check sees a new head, whatever that head’s checks show
Approved at one head, now at anotherOpens one new card per ticket: a merge gate for the new head, or a report when GitHub already has the new head in its queue. Resolves the old gate card, in one transaction with clearing the gate when the new card is a report, and drops the old approval

A gate names its head with the word head and the SHA, such as head d4db97c. The board holds a gate that names none to the head the first check sees, so a push before that check goes unnoticed.

The board records each wake and each removal report per ticket, under the merge commit, the close time or the removal time, so a later check never repeats it. It saves a wake and its delivery in one transaction, so a T3 outage delays a wake but never loses it. An event from before the board started tracking the pull request, or from before this version of the service first started, stays quiet. So does a removal dated before the last check that saw the pull request in the queue, because it belongs to an earlier stay there.

When GitHub refuses the enqueue or the merge, or cannot find the pull request, the approval stays for the next check. After 3 failures in a row the board opens a report card with GitHub’s last message and drops the approval. A pull request sent to the queue that leaves it with no removal GitHub recorded gets the same 3 checks. After that report the board keeps reading the pull request for the rest of the 30 minutes, so that a reason GitHub records later still gets a report. If no reason shows by then, it does not report that exit to the same ticket again. The board never sends an approval whose number GitHub now resolves to another pull request, such as after a repository rename. It drops that approval and opens a report card. Every card the reconcile raises for an approval carries that approval id, so wf.cards() callers can match it to the wf.merge call that recorded it. Every fix goes on the activity feed from github.

The tree shows a pull request in the merge queue as queued, next to open, merged and closed. When gh cannot reach GitHub, the check logs a warning, changes nothing, and runs again at the next interval. When one pull request cannot be fixed, for example because the waiting list is full, the check still fixes the others, and that pull request keeps its approval for the next check. A read error for one pull request, other than GitHub’s NOT_FOUND, changes nothing for it either.

GitLab merge requests

The reconcile follows a merge request on a host listed under forges the same way. It tracks a link of the form https://<host>/<group>[/<subgroup>...]/<project>/-/merge_requests/<iid> from a worker’s thread, a card or a gate, and keys it by host and full path, so acme/widgets on github.com and on a GitLab host never share a record. It reads with glab api as the user the service runs as, with prompts off and a 30-second limit per call:

  • one GraphQL query for every 10 tracked merge requests on a host, for the state, draft flag, head, detailedMergeStatus, merge time, merge commit and merge train car,
  • the merge request’s own pipelines for an open one, up to five pages of 100. The service judges readiness on the pipeline with the highest id at its head whose ref is not a merge train’s,
  • the merge request over REST for a merged one GraphQL gives no merge commit, such as a squash merge, and for a closed one, to read squash_commit_sha and closed_at.

The board shows detailedMergeStatus as GitHub’s merge state words: mergeable is CLEAN, conflict is DIRTY, need_rebase is BEHIND, draft_status is DRAFT, checking, unchecked, preparing and approvals_syncing are UNKNOWN, and every other status, pending pipelines included, is BLOCKED. A merge request in a merge train shows as queued. A merge, through a train or by hand, squash or not, wakes each ticket with one event from gitlab that says “merged on GitLab” and names the commit on the target branch. A close wakes it the same way. When glab fails, the pull requests on GitHub are still checked.

wf.pr takes a merge request, so a worker’s ready opens its merge card, naming the merge request’s URL. An answer to that card merges it through wf.merge, which joins the merge train on a project that has one. The reconcile then merges a waiting merge request, or adds it to the train, once GitLab shows it mergeable at the approved head.

Settling

The board settles finished tickets and answered asks and never deletes them. A ticket that has been done, or an ask that has been closed, for board.settleAfterHours leaves the main lists on the next watcher pass. The board also moves a settled ticket off the thread list in T3 with t3_thread_organize and settle. That step is best effort, so a T3 error goes to the log and the board state still changes.

It works the other way too. A done ticket whose thread you settle or archive in T3, or whose thread is gone, settles on the board at the next watcher pass. A ticket you restored on the board ignores a T3 settle older than the restore.

The Settled tab keeps them, with a filter and a Restore button on each one. Restoring a ticket sends unsettle and restarts its settle clock. Settle on a row and Settle all done do it by hand. An open ticket that is idle, paused or failed also shows Close, which closes its link and moves it to Done so you can settle it without visiting the thread.

Pausing

Pause on a ticket row or a worker marks its link as parked on purpose, and Resume undoes it. A thread can do the same with wf.pause(), and a parent with wf.pause({ child }). While a link is paused, the watcher sends it no nudges, does not escalate it, and reports neither a long silence nor an unanswered question. It still closes the link when the thread is archived or gone. The row shows a paused pill and sorts under Paused, and /api/state gives the ticket or worker paused: true and pausedAt. Its status reads paused where it would read idle; a paused thread that runs, waits or fails shows that status instead. Resuming starts the nudge count again from zero, so a link that has sat idle past its down minutes gets its first nudge on the next watcher pass. A link stored before pausing existed loads unpaused.

Remote access

The board is loopback-only by default. To open it from another device over HTTPS, expose it with Tailscale Serve or put your own HTTPS reverse proxy in front of 127.0.0.1:47731, configure board.remote in config.json, and restart t3cm. /mcp, /healthz and /reload stay loopback-only.

The setup-t3-workflow skill offers remote access as its last slot. It runs the commands below, restarts the service and checks the result.

Five commands manage remote access from the host:

CommandDoes
t3cm board expose --tailscaleServes the board over Tailscale Serve and writes board.remote
t3cm board unexposeRemoves the board’s Tailscale Serve routes and sets board.remote to {"mode": "off"}
t3cm board pairMints a single-use pairing link and QR code for one browser
t3cm board sessionsLists the paired browsers’ active sessions
t3cm board revoke <ID> or --allEnds one session, or every session

board.remote is a restart-only key, so the service keeps its old remote settings until it restarts. expose and unexpose print the restart command for your platform, such as systemctl --user restart t3-codemode on Linux. pair, sessions and revoke work on store.db in the state directory that --state-dir or T3CM_STATE_DIR sets, and each takes --json.

Pick the front end by who opens the board:

  • Tailscale Serve, when every device that opens it is on your tailnet. Tailscale issues the certificate and tells t3cm who each caller is, so no browser needs pairing.
  • Your own reverse proxy, such as Caddy, nginx or Cloudflare Tunnel, when a device is not on your tailnet. You write board.remote yourself, with mode "pairing", and pair each browser.

t3cm board expose drives Tailscale only. Without --tailscale it stops and points you at config.json.

Tailscale Serve

Tailscale Serve terminates HTTPS with an automatic certificate on your tailnet’s MagicDNS hostname (https://box.acme.ts.net:47732/) and injects the caller’s Tailscale-User-Login header. Serve keeps the board on your tailnet; t3cm never turns on Funnel. t3cm defaults to HTTPS port 47732 so it does not collide with T3 Code’s own :443 binding.

  1. Make sure tailscale status shows Tailscale up on the host, and that MagicDNS and HTTPS Certificates are enabled in your Tailscale admin console. t3cm board expose checks all three and stops with the fix when one is missing.

    t3cm runs tailscale serve as your own user. Tailscale on Linux, and Tailscale installed inside a WSL distro, takes Serve changes only from root or its operator, so make your user the operator once:

    sudo tailscale set --operator=$USER
    

    Without it, expose fails with Tailscale’s access-denied error and prints that command as a hint. t3cm finds the tailscale CLI on PATH, or at T3CM_TAILSCALE_BIN. Under WSL with no Linux tailscale, it uses Windows’ tailscale.exe through interop, and the operator step does not apply.

    While any Serve handler on the node serves a local path or a Unix socket, tailscaled refuses every Serve change from anyone but root, operator included. expose then names that handler and prints the sudo tailscale serve ... command that adds the board route as root. Run it and rerun expose, which reuses the board route it finds and writes board.remote without another Serve change.

  2. Expose the board and write board.remote in config.json:

    t3cm board expose --tailscale
    

    This runs tailscale serve --bg --https=47732 http://127.0.0.1:47731 and writes board.remote with mode: "tailscale" and origin: "https://box.acme.ts.net:47732". Restart the t3cm service so the new config takes effect.

    Before it writes board.remote, expose checks the Serve port on this machine’s Tailscale IPv4 address. The listener there must belong to tailscaled, and a TLS handshake for the board’s origin must succeed. When another process holds that address and port, tailscaled may serve the port on IPv6 only, and HTTPS over IPv4 fails. expose then names the process when it can, removes the board route it added, and stops. Stop that process and rerun expose with the same flags. The rerun applies the Serve route again, so tailscaled binds the IPv4 listener. When the Tailscale address is not on this machine, as with Windows’ tailscale.exe under WSL or tailscaled in userspace networking, there is nothing to check locally and expose skips the check.

    Optional flags:

    • --https-port <PORT>: serve on a port other than 47732 (refuses to overwrite a port already serving a different target).
    • --port <PORT>: target a non-default local t3cm port (defaults to T3CM_PORT or 47731). Pass the same --port to t3cm status and t3cm board unexpose.
    • --allow-user <LOGIN>: repeatable explicit Tailscale login allowlist, written to allowUsers. Without it, only the host’s own login, as tailscale status --json reports it, gets in. A list replaces that default, so include your own login to keep your access.
    • --require-pairing: also require a per-browser pairing cookie on top of Tailscale-User-Login. With this enabled, run t3cm board pair for each remote browser.
    • --json: machine-readable output.

    This mode needs no pairing. Tailscale Serve authenticates each request and adds its Tailscale-User-Login header, and t3cm admits the request when that login is allowed. Until you set requirePairing, t3cm board pair refuses and says so.

  3. Restart the service, then check the result:

    t3cm status
    

    Its remote object, which loopback GET /healthz also returns, shows what the running service enforces. enabled is true, and origin is the URL to open on the other device:

    "remote": {
      "mode": "tailscale",
      "enabled": true,
      "origin": "https://box.acme.ts.net:47732",
      "requirePairing": false,
      "allowUsers": ["alice@acme.example"],
      "allowUsersSource": "tailscale",
      "hostLogin": "alice@acme.example",
      "tailscaleError": null,
      "activeSessions": 0
    }
    

    enabled: false after an expose means the service has not restarted onto the new config. allowUsersSource is "config" when allowUsers comes from config.json, as --allow-user writes it, and "tailscale" when it is the host’s own login. It is "unavailable" when the service could not read the host’s login, and then tailscaleError says why and the service refuses every Tailscale caller. In pairing mode the object carries only mode, enabled, origin, requirePairing and activeSessions.

    • t3cm doctor verifies that config.json, the running service, Tailscale status, MagicDNS, HTTPS certificates (CertDomains), and tailscale serve status agree, and flags any drift or accidental Funnel / raw-TCP exposure. It also runs the IPv4 listener and TLS check that expose runs.
    • t3cm serve never mutates Tailscale state on start or restart; only t3cm board expose and t3cm board unexpose change tailscale serve.
  4. To turn remote access back off:

    t3cm board unexpose
    

    It removes the Serve routes that proxy to the board’s local port on the port in board.remote.origin, or on --https-port <PORT>, and leaves other Serve handlers alone. When you exposed a non-default local port, pass the same --port <PORT>. Without it, unexpose does not recognize the board’s Serve route, so it can turn board.remote off and leave the route in place, or refuse. It refuses, naming the command to run, when that port forwards the board over plain HTTP or raw TCP. Then it sets board.remote to {"mode": "off"} and prints the restart command. Restart the service to apply it.

Pairing a browser

Use pairing mode behind Caddy, Cloudflare Tunnel, or nginx, or layer it on top of Tailscale Serve with requirePairing: true:

  1. Enable pairing mode with your public HTTPS origin in config.json (or run t3cm board expose --tailscale --require-pairing) and restart the service:

    {
      "board": {
        "remote": {
          "mode": "pairing",
          "origin": "https://board.example.com"
        }
      }
    }
    

    After the restart, t3cm status shows remote.enabled: true, and remote.origin is the HTTPS origin you configured, such as "https://board.example.com" behind a proxy.

  2. Mint a single-use 5-minute pairing URL and QR code on the host:

    t3cm board pair --label "Phone"
    

    Pass --no-qr to print only the URL, or --json for machine-readable output. t3cm board pair refuses while board.remote is off, and in tailscale mode without requirePairing.

  3. Scan the QR code or open the https://board.example.com/pair#<token> link in the remote browser. The /pair page reads the token from the URL fragment, clears the fragment from browser history, and posts it to POST /api/pair so the raw token never appears in proxy logs or Referer headers. On success the service sets a 30-day HttpOnly; Secure; SameSite=Strict; Path=/ session cookie and redirects to /.

  4. List or revoke sessions from the host CLI:

    t3cm board sessions
    t3cm board revoke s1
    t3cm board revoke --all
    

    Revoking a session cuts off its API calls immediately with 401 and closes any open /api/events stream. Both pairing tokens and session tokens are stored only as SHA-256 hashes in store.db.

Using the board from a phone or laptop

Once remote access is enabled over HTTPS, the board adapts to remote devices without changing direct loopback behavior:

  • Thread links open on the device you clicked from. On direct loopback (127.0.0.1, localhost, or [::1]), clicking a T3 thread link still calls POST /api/open to focus the desktop app on the host (unless board.openLinks is "tab"). On any remote host, the browser opens the https://app.t3.codes/threads/... URL directly on that device and never calls POST /api/open; server-side, authenticated remote POST /api/open requests receive 403 while unauthenticated or disallowed requests receive the usual 401/403 guard refusal.
  • Settings open for the Tailscale owner only. In "tailscale" mode, the host’s own login, or each login in board.remote.settingsUsers, sees the full Settings dialog over HTTPS. Every other remote board sees only the model pickers there, and the settings API refuses its requests with 403, reads included. The board’s guard refuses an unauthenticated remote request with its usual 401 or 403.
  • Add to Home Screen. The board serves an embedded /manifest.webmanifest and icons (/icon.svg, /icon-192.png, /icon-512.png) behind the same authentication guards and zero-external-request CSP. On iOS Safari, open the HTTPS board URL and tap Share -> Add to Home Screen. On Android Chrome or desktop Chromium, use the browser’s Install app or Add to Home screen menu.
  • Phone layout and notifications. Narrow viewports (under 820 px) put the view tabs on their own row under the command bar, stack each view into one column, and use touch-sized controls; Launch and Ask open as a band on demand. Because the remote board runs over HTTPS, browser notifications (Notify me) work on browsers that support direct page notifications (new Notification(), such as desktop browsers). Mobile browsers that require a service worker for notifications (such as Chrome on Android) mark notifications unavailable instead of failing silently.
  • Sign-in and expired sessions. Opening / in a remote browser without an active session, or losing access while the tab is open (for example after t3cm board revoke, 30-day session expiry, or a Tailscale login change that causes the /api/events live auth recheck to close the stream), stops background reconnect retries and displays a sign-in or access-denied screen explaining whether to pair again with t3cm board pair or check Tailscale access.

Reverse-proxy examples

Any proxy fronting the board must follow the rules in Security model: terminate TLS, refuse /mcp, /healthz and /reload, strip client-supplied forwarding and identity headers, always inject a trusted forwarding header, and reject or overwrite any Host that does not match board.remote.origin. Do not configure the proxy to log POST /api/pair request bodies, which carry the raw pairing token during redemption. Never front the board with a raw TCP forwarder such as ssh -L, socat, or tailscale serve --tcp.

Caddy

Caddy terminates TLS automatically, rejects requests whose Host does not match the site address, preserves Host, and injects X-Forwarded-For, X-Forwarded-Proto, and X-Forwarded-Host (replacing untrusted client values by default). Strip Tailscale-User-Login, Forwarded, and X-Forwarded-Port, block /mcp, /healthz and /reload, and set flush_interval -1 for SSE:

board.example.com {
    @blocked path /mcp /mcp/* /healthz /healthz/* /reload /reload/*
    respond @blocked 403

    reverse_proxy 127.0.0.1:47731 {
        flush_interval -1
        header_up -Tailscale-User-Login
        header_up -Forwarded
        header_up -X-Forwarded-Port
    }
}

Cloudflare Tunnel (cloudflared)

Place the /mcp, /healthz and /reload deny rule ahead of the board rule in your tunnel’s config.yml:

ingress:
  - hostname: board.example.com
    path: ^/(mcp|healthz|reload)(/.*)?$
    service: http_status:403
  - hostname: board.example.com
    service: http://127.0.0.1:47731
  - service: http_status:404

Cloudflare terminates TLS, enforces hostname, preserves Host, and sets X-Forwarded-For and X-Forwarded-Proto: https. To satisfy the proxy rules in Security model, also add a Cloudflare Request Header Transform Rule on board.example.com that removes client-supplied Tailscale-User-Login, Forwarded, X-Forwarded-Host, and X-Forwarded-Port headers before requests reach cloudflared.

nginx

nginx’s default proxy_pass rewrites Host to the upstream and sends no forwarding header, so configure both a catch-all default_server that drops unknown Host values and explicit proxy_set_header directives. At the edge, set X-Forwarded-For $remote_addr so client-supplied headers are overwritten rather than appended, and pass Host $http_host (or an explicit host:port such as board.example.com:47732 when serving on a non-443 port, since $host drops the port):

server {
    listen 443 ssl default_server;
    ssl_certificate     /path/to/fullchain.pem;
    ssl_certificate_key /path/to/privkey.pem;
    return 444;
}

server {
    listen 443 ssl;
    server_name board.example.com;

    ssl_certificate     /path/to/fullchain.pem;
    ssl_certificate_key /path/to/privkey.pem;

    location = /mcp { return 403; }
    location ^~ /mcp/ { return 403; }
    location = /healthz { return 403; }
    location ^~ /healthz/ { return 403; }
    location = /reload { return 403; }
    location ^~ /reload/ { return 403; }

    location / {
        proxy_pass http://127.0.0.1:47731;
        proxy_http_version 1.1;
        proxy_set_header Connection "";
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header X-Forwarded-Proto https;
        proxy_set_header X-Forwarded-Host "";
        proxy_set_header X-Forwarded-Port "";
        proxy_set_header Forwarded "";
        proxy_set_header Tailscale-User-Login "";
        proxy_buffering off;
        proxy_cache off;
        proxy_read_timeout 1h;
    }
}

Settings API

/api/settings reads and saves all of t3cm’s config.json. Its routes answer direct loopback requests, and remote requests from the Tailscale owner as Settings describes. Any other signed-in remote browser gets 403, reads included. A PUT needs the X-T3CM-CSRF token either way. The service logs each remote save with the Tailscale login and the keys it changed.

GET /api/settings returns these fields:

FieldHolds
pathThe config file
revisionAn id for the file’s content, which a save sends back
fileThe file as parsed JSON, or {} when there is none. The file sets a key when the key is present here, even at its default. null when the file is invalid JSON.
valuesThe file merged over the defaults, as t3cm config get prints it. A null in a child role inherits the top-level value. null when the file is invalid.
defaultsThe built-in defaults in the shape of values. A key returns to its default when a save omits it.
runningThe config the service runs. It differs from values after a hand edit, and while a restart-only key waits for a restart.
restartEvery restart-only key whose saved value differs from the running one. null when the file is invalid.
errorsWhy the file is invalid, as {field, message}, or an empty list

A client saves by changing a copy of file and sending PUT /api/settings with {"revision": "<revision>", "file": {...}}. It starts from file because a save of values would write every default into the file, and it omits a key to return that key to its default.

The route requires whole values and takes no edits by path, so a client adds an item to a list by sending the whole list. When file lacks the list, the client copies it from values first, because a list in the file replaces the default one. A child role with no wake of its own copies the top-level wake.

A save runs the checks of config load, keeps the layout of the values it does not change and reloads the service. It answers with one of these:

StatusBodyMeans
200{revision, restart, warnings}The file is saved and revision is the one for the next save. restart lists every key that waits for a restart, earlier changes included. It is null, with a warning, when the save worked and the reload failed.
400{error}The body lacks a revision or a file object, or has another key.
409{error}The file changed after the client read that revision, so t3cm wrote nothing and the client reads it again.
422{error, errors}The result is invalid, so t3cm wrote nothing. Each of errors is {field, message}, and field is a dotted path such as board.feed or pools."gpt-6.1".members.0.weight.
500{error}t3cm could not read or write the file.

Config validation reports the first error it finds, and the member check reports one error for each bad pool. The member check asks T3 about the pools that the save adds or changes. It skips a pool the save leaves alone, including when the save repairs an error elsewhere in the file. When T3 does not answer, the save goes on and warnings says that t3cm did not check the members. The route refuses to replace broken JSON, which t3cm config edit can repair.

GET /api/settings/pools returns {pools}, which is the list wf.pools() gives for the running config, with each member’s live state. It is a separate route so that a refresh leaves a form’s revision alone and the settings still load while T3 is down.

GET /api/models supplies the instance, model and effort choices. A client changes the ticket launch model with PUT /api/models/ticket, which writes models.ticket and leaves the legacy board ticket keys alone.

HTTP routes

RouteDoes
GET /The page, with a per-process CSRF token embedded (unauthenticated remote browser navigations with Accept: text/html receive a 401/403 sign-in or access-denied page with no CSRF token)
GET /manifest.webmanifestEmbedded web app manifest for Add to Home Screen (same board auth guards, zero external requests)
GET /icon.svg, /icon-192.png, /icon-512.pngEmbedded board icons for browser tabs, notifications, and Add to Home Screen (same board auth guards)
GET /pairRemote browser pairing page (enabled when board.remote.mode is "pairing", or "tailscale" with requirePairing: true); reads the token from #<token>, clears the fragment, and posts to POST /api/pair
POST /api/pair {token, label?}Redeem a single-use 5-minute pairing token (Content-Type: application/json) over the remote HTTPS origin and set a 30-day HttpOnly; Secure; SameSite=Strict; Path=/ session cookie
GET /api/state{rev, cards, tree, feed, asks, settled, contexts, newIssues, dismissedIssues, flow, flowTriage, flowMaxTickets, maxTicketsTotal, openTickets, counts, service, routing}, with counts.newIssues. Each new or dismissed issue carries coveredBy (new issues). flow is true when the config has a flow block. flowTriage holds the latest unsettled Triage DAG run ({id, status, summary, changes, counts, ...}) or null. flowMaxTickets is that block’s maxTickets, or null without one. openTickets is the count the ticket cap checks: every open board ticket plus every launch still waiting to join. routing is the launch routing view from the watcher’s last pass, the wf.usageStats() result for the default 24-hour window, or null before the first pass. rev is the board revision: it goes up with every change, keeps going up across a restart, and a state whose rev is at least a write’s rev already holds that write; tickets, cards and feed items carry repo (owner/repo) and project ({id, title}), and tickets their thread title, with last.dismissed when the last message is a gate whose card you dismissed. A ticket’s or worker’s open pr carries readiness once a GitHub reconcile has read it open: isDraft, mergeStateStatus and reviewDecision as GitHub gives them, and checks. reviewDecision is null when the repository requires no review. checks is failing when a check at the head failed, pending while one runs, passing when every check succeeded or was cancelled, skipped or neutral, and null when the head has no checks or has more than 100 and none of the first 100 failed. A pull request that no reconcile has read yet has no readiness. Every pr also carries verdict, the board’s one-word reading of its state and readiness, and ready, true when that word is ready or queued. verdict is merged, closed or queued from the state, open before a reconcile has read the pull request, and otherwise one of ready, failing (approved, but a check failed), draft, changes, checksFailing, checksPending, conflict, behind or review, the same order the pill words follow. Tickets and workers carry humanTitle, the thread title without its leading label when the rest reads as a title, or else the issue’s title, or null when neither is known. A rest that is empty, a URL, an issue reference or one word with no spaces, such as a gate slug, does not read as a title. issueTitle is the title of the node’s issue, as the board last read it from the flow, a wf.issue report, a launch title, or GitHub. On each pass the board reads GitHub for up to 8 issues of open tickets and workers that have neither title, and an issue GitHub cannot find is not read again until a restart. step is part as numbers, {n, of}, or null. A ticket’s progress is {step, of, merged} across its workers: step from its last unfinished worker with a part (else the highest), of the largest total, and merged the number of workers whose pull request merged, or null when no worker has a part. Tickets and workers carry issue, parentIssue and part (each null when unset; see wf), paused, pausedAt while paused, and status: "paused" in place of idle (pausing). Times come as local clock strings with an ISO twin for ages: a ticket’s lastUp and upAt, a settled ticket’s settledAt and settledIso, and service.watcher.lastPass and lastPassAt. service.update is null while updateCheck is false or until a release check has answered, then {current, latest, available, notes, command}. service.skills is the skills check that /healthz also reports (getting started)
GET /api/eventsSSE: a state event on every change, carrying the same rev (closes when a remote pairing session is revoked or expires, or when a Tailscale login is no longer allowed)
GET /api/msg/{handle}One stored message in full
POST /api/cards/{id}/answer {text}Reply to the card’s ticket and resolve it; a flow launch card takes launch or skip instead (The flow)
POST /api/cards/{id}/dismissResolve without messaging
POST /api/launch {issues: [...]}wf.launchTicket for each (at most 20); each entry is an issue reference string or {issue, project?} with an explicit T3 project id or title. An entry refused at the ticket cap comes back with ok: false, atCap: true and the error card
POST /api/ask {question}Ask a scratch thread about the board, or for work it launches with wf.dispatch, using board.askPool or board.askInstanceId/askModel/askEffort; returns the ask view with instanceId, model, effort, modelSource (and pool, reason for pools)
GET /api/usage-stats?window=The wf.usageStats({ window }) view of launch routing, computed fresh, which the routing panel reads. window is optional: all, or a count of m, h or d such as 24h (the default), and may be percent-encoded. Any other query parameter, a repeated window, or a bad duration is a 400
GET /api/modelsCurrent ticket and ask model resolution (ticket, ask), enabled providers/models/efforts from orchestrator_capabilities (providers), configured pools (pools), active T3 projects with parsed origin remotes (projects), trackers mappings (trackers), and per-project repo overrides (repoOverrides)
PUT /api/models/ticket {mode, ...}Persist models.ticket to the user workflow config (mode: "model" with provider, model, effort?, or mode: "pool" with pool) after validating against live capabilities or configured pools; returns the updated /api/models view
PUT /api/models/ask {mode, ...}Persist the ask box mode to t3cm’s config.json (board.askInstanceId/askModel/askEffort or board.askPool) and apply it live with no restart; returns the updated /api/models view
GET /api/settingsLoopback or the Tailscale owner: the config file, its revision, the saved, default and running values, the keys that need a restart, and any errors. See Settings API
PUT /api/settings {revision, file}Loopback or the Tailscale owner: check and save the whole config, then reload it; returns {revision, restart, warnings} (409 for a stale revision, 422 with per-field errors for an invalid result)
GET /api/settings/poolsLoopback or the Tailscale owner: {pools}, each pool’s live member state as wf.pools() reports it
POST /api/tickets/{thread}/close {notify?}Close an idle, paused or failed open ticket’s link, resolve its open cards, and move it to Done; with notify: true, also message the thread (404 if not a board ticket, 400 if running, waiting or already done, 503 if T3 cannot verify the thread)
POST /api/tickets/{thread}/settle, /restoreSettle a done ticket, or bring a settled one back (400 if open, or not settled)
POST /api/links/{thread}/pause, /resumePause an open ticket or worker link, or resume it; returns {thread, paused} (404 for a thread that is neither, 400 for a done one)
POST /api/asks/{id}/settle, /restoreThe same for a closed ask; id is q<n>
GET /api/new-issues{issues, dismissed}, newest first; an issue that has a board ticket is in neither
GET /api/flowWhat wf.flow({ graph: true }) returns: {enabled, launch, maxTickets, maxTicketsTotal, free, running, queue, blocked, skipped, graph}, read-only (The up-next panel, the dependency graph); 502 with error when GitHub fails
POST /api/flow/sync-linksWrite every current source: "body" blockedBy and parent edge in the dependency graph to GitHub through addBlockedBy and addSubIssue idempotently with replaceParent: false, refresh the graph, and return {ok, total, synced, alreadyLinked, failed, results, errors, flow, refreshError?} with per-link permission, conflict and existingParent fields; 400 on malformed JSON or unknown keys, 502 with error when GitHub cannot be read
POST /api/flow/edge {action, from, to, kind, replaceParent?}Edit one graph edge and refresh the graph: action is add, remove, confirm, dismiss or restore; kind is blockedBy, parent, fileConflict or codeDep (add/remove apply to blockedBy and parent only). confirm writes native GitHub links (promoting fileConflict/codeDep to blockedBy and hiding the advisory hint on success); dismiss/restore update flow_dismissed_edges in store.db. Returns {ok, action, from, to, kind, status, error?, permission?, conflict?, existingParent?, flow, refreshError?} (400 on invalid input or unknown keys)
POST /api/flow/issue {issue, track?, priority?}Set or clear (null / empty string) an issue’s track: <slug> and/or priority: <high|medium|low> labels on GitHub (removing conflicting track:/priority: labels first without touching other labels), refresh the graph, and return {ok, issue, track?, priority?, labels, errors, flow, refreshError?} (400 when neither field is provided or on invalid input/unknown keys)
POST /api/flow/opt-in {issue, on}Add (on: true) or remove (on: false) the flow.optIn.label label on an open issue in a covered repository, refresh the graph, and return {ok, issue, on, label, status, error?, permission?, labels, errors, flow, refreshError?}. status is added, removed, unchanged (a repeat toggle, which writes nothing), refused (closed, external, running or uncovered, with the reason in error) or error (GitHub’s message in error). 400 when flow.optIn.label is not set, or on invalid input or unknown keys
POST /api/flow/triage {}Start a read-only scratch thread over open issues and tracked repo files to propose missing blockedBy, parent, track, and priority changes; writes nothing to GitHub. Returns the triage view ({id, status, issueCount, repos, ...}), 409 if a triage run is already active, or 400 when no open issues exist or unknown keys are sent
POST /api/flow/triage/{id}/apply {changeIds?, all?, replaceParent?}Apply user-confirmed triage changes (all: true for all pending changes, or explicit changeIds) through GitHub mutations, update the triage row, refresh the graph, and return {ok, applied, alreadySet, failed, results, triage, flow, refreshError?} (404 for unknown t<n>, 400 while still running or on unknown keys/ids)
POST /api/flow/triage/{id}/dismiss {changeIds?, all?}Skip specific triage proposals (changeIds) or dismiss/cancel the entire triage run (archiving a running scratch thread) without writing to GitHub; returns {ok, dismissed, id, triage} (404 for unknown t<n>)
POST /api/new-issues/{id}/launchLaunch a ticket for the entry, as POST /api/launch does for one issue; the result adds id (404 for no such entry)
POST /api/new-issues/{id}/dismiss, /restoreDismiss the entry, or bring a dismissed one back (400 if already dismissed, or not dismissed)
POST /api/settle-doneSettle every done ticket and closed ask; returns {tickets, asks} counts
GET /api/contexts{contexts: [...]}, sorted by name; each is {id, name, spec, createdAt, updatedAt}, and spec is {projects, statuses, kinds, q?}. Each project is a T3 project id, or, for an item with no project id, its lowercased owner/repo or title. A context saved before project ids holds an owner/repo or a project title instead, and an item matches it ignoring case
PUT /api/contexts/{id} {name, spec}Create the context (201) or replace its name and filter (200), answering {context, rev}. Leave out spec to rename an existing context, or name to change only its filter; either form needs the context to exist (404 if it does not). id is 1 to 64 letters, digits, - or _. Names are unique ignoring case (409), at most 60 characters, and never “All”. Statuses are running, waiting, blocked, done, paused, pr-green, pr-review, alert, ready and external, and kinds are the card kinds. The board keeps at most 100 contexts
DELETE /api/contexts/{id}Delete the context (404 if there is none), answering {deleted, rev}
POST /api/open {link}Loopback-only: open a T3 thread link in the running Windows desktop app (on Windows, or from WSL); returns {opened}, and the page opens a new tab when it is false (400 for a link that is not a T3 thread; 403 for authenticated remote requests, or the usual 401/403 guard refusal otherwise)

Direct loopback requests require Host to be 127.0.0.1:<port>, localhost:<port>, or [::1]:<port> with no proxy headers and refuse any other Origin. When board.remote is enabled, remote requests must match the configured https:// origin and pass remote authentication (except GET /pair and POST /api/pair in pairing mode, which sit before session auth). Every mutating board route (except POST /api/pair, which requires Content-Type: application/json) also requires the X-T3CM-CSRF header, which the page reads from its embedded token. See Security model.

Upstreams

An upstream is another MCP server, over stdio or Streamable HTTP (the legacy HTTP+SSE transport is not supported), listed under upstreams in the config file. Its tools join the catalog under its namespace. The service holds its credentials and redacts them from what reaches the sandbox, tool output, /healthz and logs, within the limits under Secret references: tracked values of 4 or more bytes, in raw or JSON-escaped form. T3 itself stays built in as the namespace t3, with its own OAuth client.

A change under upstreams needs a restart, since a config reload keeps the connections the service started with.

Config

{
  "upstreams": [
    {
      "name": "cbm",
      "transport": "stdio",
      "stdio": { "command": "codebase-memory-mcp" },
      "timeout_ms": 120000,
      "deny": ["delete_project", "index_repository"]
    },
    {
      "name": "linear",
      "transport": "http",
      "http": {
        "url": "https://mcp.linear.app/mcp",
        "headers": { "Authorization": "Bearer ${file:~/.config/t3-codemode/linear.token}" }
      },
      "allow": ["list_*", "get_*", "search_*"]
    }
  ]
}
KeyDefaultRule
namerequiredthe JS namespace: ^[a-z][a-z0-9_]{0,31}$, unique, and none of t3, mem, vars, wf, console, tools, catalog or a JS reserved word
transportrequired"stdio" or "http"; exactly the matching section is present
stdio.commandrequireda bare name (searched on PATH, then $HOME/.local/bin) or a path; a relative path (./bin/srv) is resolved against stdio.cwd; on Windows a name with no extension also tries each PATHEXT extension (npx finds npx.cmd)
stdio.args, stdio.cwd[], service cwdno references
stdio.env{}values may hold references
http.urlrequiredhttp:// or https://; references allowed in the userinfo, path and query; the host takes none
http.allow_insecurefalsetrue allows credentials (any reference in the URL or headers) over http:// to a non-loopback host
http.headers{}values may hold references
enabledtruefalse: no global, no catalog entries, never connects
timeout_ms60000per request, 100 to 600000
allow, deny["*"], []tool-name globs (*, ?); deny wins. A denied tool is absent from the catalog and its calls throw
aboutnonewhat the server is for, in one line of at most 120 characters with no control characters; t3cm adds it to its MCP instructions and tool descriptions

t3cm status lists every configured upstream, disabled ones included, in config order, with name, transport, enabled, state (disabled, idle, connecting, ready, backoff), tools, restarts, lastError (redacted), retryAt and server (the upstream’s serverInfo name, title and version, each cut to 100 characters).

Namespacing

Each upstream’s name is its namespace: one frozen global in execute (cbm.search_graph(input), cbm.call(name, input)), the server of its catalog entries, and the prefix of their names (cbm.search_graph). tools.call("cbm.search_graph", input) reaches the same tool by its qualified name. T3 tools keep their bare names (t3_thread_send) and the built-ins are mem.*, wf.* and vars; the reserved names keep the three sets disjoint. A tool name that is not an identifier is reached as cbm["get-thing"], with a sanitized alias (cbm.get_thing) when no other tool claims it.

Instructions

MCP clients put the instructions from t3cm’s initialize response into the model’s system prompt, and t3cm names every enabled upstream there, so the model knows which servers it can reach through t3cm before it loads either tool. For example:

T3 Code and these MCP servers, reached through search then execute: quotes (Example brokerage API: quotes, price history), kb (internal documentation search), browser. Prefer these over the web or a browser for the same data.

Each upstream’s description is its about. An upstream with no about gets the serverInfo.title from its last successful connect, or else the first line of the instructions it sent on that connect, cut to 120 characters and redacted. One that has not connected since the service started gets its bare name. The names come from config, so the list is complete before any upstream connects, while a fallback description appears only after a connect. Set an about on each upstream, because a bare name is easy to misread: a model that sees only the name of a brokerage may go to the brokerage’s website.

The list leaves out disabled upstreams. With no upstreams configured, instructions keeps its general sentence about T3 Code and the configured MCP servers. The list is capped at 2,000 characters. Past the cap, descriptions drop from the end of the list first, and every name stays. The search and execute tool descriptions end with the same list, as MCP server namespaces: quotes (Example brokerage API: ...), kb (...), browser., so a client’s tool search for a word in an about finds both tools.

Clients read instructions only at initialize and tool descriptions at tools/list. A change to about needs a service restart, like the rest of upstreams, and then a new client session. A fallback description learned on a later connect reaches only the client sessions that start after it.

Secret references

A value in stdio.env, http.headers or http.url may mix literal text with ${env:NAME} (the service’s environment; under systemd, the unit’s) and ${file:/abs/path} or ${file:~/path} (the file’s content, trailing newlines trimmed); $${ is a literal ${. Put each secret, whole, inside a reference. An Authorization, Proxy-Authorization or Cookie header, or any header or env name containing TOKEN, SECRET, KEY, PASSWORD, PASSWD, AUTH, COOKIE or CREDENTIAL, whose value holds no reference is a config error. A literal under any other name is accepted. The service resolves references at every connect, so it picks up a rotated file on the next reconnect.

For redaction the service tracks each resolved reference, the whole resolved value of any env var or header that holds a reference, a URL’s password, and the values of query parameters whose name looks like a secret (?api_key=). Literal text beside a reference is redacted only as part of that whole value, so it can appear unredacted on its own. Every tracked value of 4 or more bytes is redacted ([redacted]) from tool results before they enter the sandbox, and from errors and output, including its JSON-escaped form. Two fields are cut before redaction runs: a tool error at 1,000 characters, and each serverInfo field that /healthz reports at 100 characters. A secret that straddles either cut keeps its leading part and no longer matches.

Lifecycle

Nothing connects at start-up beyond a background warm-up; each upstream connects on first use (search, execute or the 10-minute catalog refresh). Connects run in the background: search and execute wait at most 2 s, and only for an upstream whose tools have never been listed; otherwise they use the last tool list, and a call into a namespace waits for its own connect. A connect (spawn or HTTP handshake plus the full tools/list) may take timeout_ms or 15 s, whichever is longer. A failure puts only that upstream in backoff: the first failure retries on next use, repeated failures back off from 1 s doubling to 60 s. Its last tool list stays in the catalog. A failed call is never retried, with one exception: when an HTTP upstream answers 404 to an established session, the client starts a new session and sends the call once more, so a server that acted before answering 404 acts twice. A stdio server that exits between calls is restarted on the next use without failing that call, and three timeouts in a row restart a connection. A re-list is capped at 15 s, and the watcher refreshes upstreams on their own task, so a hung upstream never delays the workflow watcher. A server’s tools/list_changed notification re-lists it, and the next search or execute sees the new catalog. The service logs connects and failures (upstream connected, upstream unavailable: <redacted reason>), and logs an upstream’s stderr at debug only, redacted.

Security

  • The service resolves ${env:..} and ${file:..} references in stdio.env, http.headers and http.url at connect time. It replaces each tracked value (see Secret references) of 4 or more bytes in results before they enter the sandbox, and filters errors, final output, /healthz lastError and log lines the same way. The filter matches exact values (raw and JSON-escaped), so a shorter secret, an untracked literal, or a secret an upstream returns in another encoding gets past it.
  • A stdio upstream runs as a child of the service, in its own process group or, on Windows, its own Job Object, with only PATH, HOME, USER, LOGNAME, SHELL, LANG, LANGUAGE, LC_*, TZ, TMPDIR, TERM and the XDG_* base directories from the service’s environment, plus its own env. It inherits another upstream’s ${env:..} credential only when that variable’s name is on the allowlist, such as an LC_* name, so keep credentials in variables outside it. The filter controls inheritance only. The child runs as the service’s user, so it can read that user’s files, other upstreams’ credential files included, and, where the OS allows it, the service’s environment. Run only stdio upstreams you trust with that access. Pass anything else it needs through its env ("NODE_OPTIONS": "${env:NODE_OPTIONS}"). Stopping it kills the whole group, so a server behind a wrapper (npx, uvx, sh) stops too. args are visible in ps, which is why they cannot hold references. On Windows the allowlist also passes the system variables programs need to start (SYSTEMROOT, COMSPEC, PATHEXT, TEMP, USERPROFILE, APPDATA, LOCALAPPDATA and the rest of client_stdio::INHERITED_ENV_WINDOWS), and matches names in any case.
  • An HTTP upstream never follows redirects (a 3xx is an error), so its headers never reach another host. A reference in the URL or headers over http:// to a non-loopback host needs http.allow_insecure: true. The check looks for references only, so a credential written literally into http.url goes out over http:// without it. Use https:// and references. Transport errors leave out the URL, but an HTTP error status adds up to 300 characters of the response body, redacted of tracked values only, so an upstream that echoes its URL can put an untracked literal from it into the error.
  • One message from an upstream (a stdio line, an HTTP body or SSE event) is capped at 16 MiB; a larger one fails the connection.
  • The host enforces allow/deny. A denied tool has no catalog entry and no global, and tools.call on it throws without contacting the upstream. Use deny for destructive tools you never want a script to reach.
  • An upstream’s tool descriptions and results are its own text. Treat them as data from that server, as you would its direct MCP tools.

The design and its acceptance tests are in the upstreams contract, a design record that has not kept up with the code. Where the two differ, this page and the code govern.

Security model

t3cm is a local, single-user service. It holds a T3 session with full-access rights and runs code that a model wrote. The model below keeps that code inside a sandbox and keeps the service off the network.

Trust boundary

Any local process that can reach the loopback port directly acts with the service’s T3 session. That is the same trust boundary as the t3 CLI for the same user. Direct loopback callers are not authenticated beyond that.

The HTTP server splits /mcp, /healthz and /reload from the web board (/, /api/*) into separate middleware boundaries:

  • /mcp, /healthz and /reload are strictly loopback-only. When fronted by a proxy that adds trusted forwarding headers and rejects or overwrites non-public Host values, they refuse remote hosts, remote origins, and proxied requests even when remote board access is enabled.
  • The board stays loopback-only by default (board.remote is off). When explicitly enabled behind an HTTPS reverse proxy such as Tailscale Serve, Caddy, nginx, or cloudflared, only the board routes accept requests for the configured https:// origin, and every remote read and write route requires remote authentication.

See ADR 0008 for the split trust boundary and reverse-proxy trust assumptions.

Board settings

A config write can loosen deny immediately. It can also add a stdio upstream, which is a command the service runs after a restart, or change who may reach the remote board after a restart. The board’s settings routes, /api/settings and /api/settings/pools, therefore answer only two kinds of request, for reads and writes alike:

  • a direct loopback request;
  • a remote request in board.remote.mode: "tailscale" that passed the board’s remote checks, carries X-Forwarded-Proto: https, and whose Tailscale-User-Login is in board.remote.settingsUsers or, when that list is empty, is the host’s own Tailscale login.

Every other remote request gets 403, including a pairing-mode session and an allowed Tailscale user who is not a settings user. A page served to a remote request shows Settings only after its own GET /api/settings answers 200. The routes enforce the limit. A save also needs the CSRF token, and the service logs each remote save at info level with the login and the dotted paths of the keys it changed, never their values.

Whoever holds a device signed in to a settings login can therefore rewrite the config directly, including the commands the host runs and who may reach the board. Keep settingsUsers to accounts you would trust with a shell on the host.

The /api/models routes still answer an authenticated remote board. They write only the ticket and ask model keys, and an ask save applies no other change that waits in the file.

GET /api/settings returns the file as written, so an ${env:..} or ${file:..} reference stays unresolved and a credential written literally into the file comes back literally. A remote read is not redacted either: a settings user can already make the host run any command, and a save sends the whole file back, so placeholders would overwrite the real values. Use a reference to keep a credential off remote devices.

execute has no config global, so sandboxed code cannot clear its own deny list through wf. Code that acts outside the sandbox can still change the config as any local process can. That includes an agent thread that a script launches, and an upstream tool that can write files or send HTTP to loopback. A remote board user can likewise launch a ticket or answer a card, and the agent that receives it could edit the file. Both restrictions block direct edits only, as ADR 0010 records. ADR 0011 opens the settings routes to the Tailscale owner.

Config reload

POST /reload makes the service read its own config file again. It takes no config from the request, refuses a caller that names another file, and changes neither board.remote nor upstreams until a restart. It does apply deny, so whoever can write the config file can loosen that list without a restart. The sandbox has no network access and no reload global, so execute code cannot call the route directly.

Network

  • The service binds 127.0.0.1 only.
  • /mcp, /healthz and /reload require a single Host naming 127.0.0.1, localhost, or [::1] (any valid port), refuse any non-loopback Origin (including a configured remote board origin), and refuse any request carrying proxy headers (Tailscale-User-Login, X-Forwarded-Host, X-Forwarded-For, X-Forwarded-Proto, X-Forwarded-Port, Forwarded) with 403.
  • Board routes (/, /api/*) classify each request before running any handler:
    • A request is local only when it carries none of the proxy headers above and has a single Host naming 127.0.0.1:<port>, localhost:<port>, or [::1]:<port> on the service’s own port. Local requests require any Origin header to match the service’s own http:// loopback origin and require X-T3CM-CSRF on every mutating method (POST, PUT, DELETE).
    • Any other request (non-loopback Host, wrong port, missing or duplicate Host, or any proxy header) is remote. Because reverse proxies connect over 127.0.0.1, proxy headers prevent a proxied request from falling into local zero-auth access.
  • With board.remote off (the default), every remote request to every board read and write route is refused with 403.
  • With board.remote enabled (mode and an https:// origin), a remote board request must satisfy all of the following on both read routes (/, /manifest.webmanifest, /icon.svg, /icon-192.png, /icon-512.png, /api/state, /api/events, /api/msg/*, /api/contexts, /api/new-issues, /api/flow, /api/usage-stats) and mutating routes:
    • X-Forwarded-Proto, when present, must be https.
    • Host must match the configured origin, or Host must be the service’s own loopback host while X-Forwarded-Host matches the configured origin. If X-Forwarded-Host is present alongside a non-loopback Host, both must match the configured origin.
    • Origin, when present, must match the configured https:// origin.
    • Remote authentication must succeed:
      • In pairing mode, the request must carry a valid __Host-t3cm_session cookie (HttpOnly; Secure; SameSite=Strict; Path=/) backed by a SHA-256-hashed 30-day session in store.db, minted from a single-use 5-minute /pair#<token> token via t3cm board pair and POST /api/pair (GET /pair and POST /api/pair enforce the same remote Host, X-Forwarded-Proto, and Origin checks before session auth; /pair never embeds the board CSRF token, and POST /api/pair requires Content-Type: application/json). Revoking or expiring a session cuts off API calls with 401 and closes open /api/events streams.
      • In tailscale mode, the request must carry a single Tailscale-User-Login header matching board.remote.allowUsers (or, when allowUsers is empty, the host’s own login from tailscale status --json). Any other login is refused with 403, and a missing header or unavailable host login is refused with 401. When requirePairing: true is also set, the request must also carry a valid __Host-t3cm_session cookie (and /pair and POST /api/pair require an allowed Tailscale-User-Login before redeeming a token). Tailscale-User-Login grants no access when board.remote.mode is "off" or "pairing".
    • Every mutating method (POST, PUT, DELETE) on authenticated board routes still requires the per-process X-T3CM-CSRF header.
    • GET and PUT /api/settings and GET /api/settings/pools answer a remote request only from the Tailscale owner over X-Forwarded-Proto: https, as Board settings describes. Any other authenticated remote request receives 403.
    • POST /api/open is strictly loopback-only: authenticated remote requests receive 403, while unauthenticated or disallowed remote requests receive the usual 401/403 guard refusal, so remote clients cannot trigger desktop app launches on the host.
    • Unauthenticated remote GET / requests that send Accept: text/html receive a 401/403 HTML sign-in or access-denied screen with no CSRF token, no board data, and no scripts; API and non-HTML requests receive JSON.
    • The board’s Content-Security-Policy keeps default-src 'none' with zero external requests (manifest-src 'self', img-src 'self' data:), and the page fetches /manifest.webmanifest with crossorigin="use-credentials" so authenticated remote browsers stay behind the same guard.
  • Reverse-proxy trust assumption. Because t3cm listens on 127.0.0.1, any forwarder that sends a loopback Host with no forwarding headers looks identical on the wire to a direct loopback client. Any proxy fronting the board must terminate TLS, forward only board routes (never /mcp, /healthz or /reload), strip client-supplied forwarding and identity headers (X-Forwarded-*, Forwarded, Tailscale-User-Login), always add a trusted forwarding header (X-Forwarded-For, X-Forwarded-Host, X-Forwarded-Proto, or Forwarded; Tailscale Serve adds its own), and reject or overwrite any client Host that does not match the configured public name. nginx’s default proxy_pass rewrites Host to the upstream and adds no X-Forwarded-* header, so nginx requires explicit proxy_set_header lines (Host $http_host or an explicit public host:port when non-443, X-Forwarded-For $remote_addr at the edge so client-supplied headers are overwritten rather than appended, and X-Forwarded-Proto https). Raw TCP forwarders such as ssh -L, socat, and tailscale serve --tcp are indistinguishable from direct loopback and hand out zero-auth board access, so they must never front the board. Through one, a remote client could also use the settings routes to add a command that the host runs. See Remote access.

The sandbox

Each run gets a fresh QuickJS runtime:

  • 64 MB memory and a 512 KB stack,
  • a JavaScript CPU budget, cpuBudgetMs, 2 s by default (time awaiting host calls does not count),
  • a wall timeout, timeout_ms, 60 s by default and capped at maxTimeoutMs (600 s by default),
  • no fs, network, timers, modules, SharedArrayBuffer or Atomics.

The only way out of the sandbox is the host functions behind t3, the upstream namespaces, tools, mem, vars and wf. The host functions enforce the deny list themselves, so a denied T3 tool throws however the script reaches it, whatever the prompt says. At most maxConcurrentRuns (16) runs execute at once.

GitHub

wf.merge is the one host function that reaches GitHub. The service runs gh api graphql itself, as the user it runs under, with that user’s existing gh login. Sandboxed code cannot run gh or send GraphQL of its own: it passes a repo, a pull request number, a head SHA and a merge method, the service checks their shape, and the service sends one of three fixed operations (read the pull request, enqueuePullRequest, mergePullRequest). The service never reads the gh token.

The board’s GitHub reconcile uses the same gh login. It sends one fixed read query, with each tracked pull request’s owner, name and number as GraphQL variables, and the same two fixed mutations, only for a pull request someone approved through wf.merge and only at the head they approved.

The T3 token

The token lives only in the store and in memory. It never enters the sandbox, tool output or logs, and the service redacts any error text that contains it.

T3 sign-in

On start, and when the stored token has under 3 days left or T3 answers 401, the service runs T3’s MCP OAuth flow against the local server:

  1. It registers a client.
  2. It mints a 5-minute pairing code with the t3 CLI.
  3. It approves the code as full-access.
  4. It exchanges the code with PKCE for a 30-day bearer token.

The T3 origin comes from ~/.t3/userdata/server-runtime.json (T3CODE_HOME moves ~/.t3, and T3CM_T3_ORIGIN overrides the origin). The t3 binary is $T3CM_T3_BIN, else the running server’s executable when it is named t3 (t3.exe on Windows), else the newest ~/.t3/wsl-runtime/sha256-*/t3, else the newest ~/.t3/runtime/versions/*/t3 that T3’s installer unpacks.

t3cm auth runs the flow on demand and prints only the new token’s expiry.

Upstream credentials

  • Put every credential, whole, in an ${env:..} or ${file:..} reference in stdio.env, http.headers or http.url. The service resolves references at connect time and tracks each resolved reference, the whole value of any env var or header that holds a reference, a URL’s password, and the values of secret-named query parameters. It rejects a literal value only under a secret-looking name. A literal under another name is accepted and not tracked, and literal text beside a reference is redacted only as part of the whole value, never on its own.
  • The service replaces each tracked value of 4 or more bytes with [redacted] in upstream results before they enter the sandbox, and filters errors, final output, /healthz lastError and log lines the same way. The filter matches exact values in raw and JSON-escaped forms, so a credential shorter than 4 bytes, or one an upstream returns in another encoding, gets past it. Tool errors (1,000 characters) and serverInfo fields (100 characters) are cut before redaction, so a secret that straddles the cut can leak its leading part.
  • Each stdio upstream inherits only an allowlisted environment plus its own env, so it does not inherit another upstream’s credential unless the variable holding it has an allowlisted name, such as an LC_* name. That filter is not an isolation boundary. A stdio upstream runs as the service’s user and can read whatever that user can, including other upstreams’ credential files and, where the OS allows it, the service’s own environment. Run only stdio upstreams you trust with that access.
  • An HTTP upstream never follows redirects, so its headers never reach another host. A credential written literally into http.url goes out over http:// without http.allow_insecure, so use https:// and references.
  • The host enforces allow and deny on every call.

Upstreams has the details.

On disk

The store is 0700 and 0600 on Linux and macOS. On Windows it relies on the per-user ACL of %LOCALAPPDATA%, and t3cm sets no ACL of its own, so a --state-dir elsewhere gets whatever its parent grants. Protect a custom state directory yourself, because the store holds the T3 token. See Configuration.

Reporting a vulnerability

Report suspected vulnerabilities privately through the security policy, not in a public issue or pull request.

Troubleshooting

Start with t3cm status. It prints the running service’s /healthz, and most problems show up there:

FieldTells you
version, uptimeSecsWhich build is running, and whether it restarted recently
t3connected, origin, tokenExpiresAt and lastError for the T3 session
toolsHow many T3 tools the catalog holds
watcherlastPass, alive and intervalSecs for the workflow watcher
runsrunning, queued and max for sandbox runs
storeThe path of store.db
upstreamsOne object per configured upstream, with its state and lastError

The service logs to:

OSLogsService state
Linuxjournalctl --user -u t3-codemodesystemctl --user status t3-codemode
macOS~/Library/Logs/t3-codemode/t3cm.log, and launchd.log beside it for what the service writes to stderrlaunchctl print gui/$(id -u)/com.ottoops.t3-codemode
Windows%LOCALAPPDATA%\t3-codemode\logs\t3cm.logGet-ScheduledTask t3-codemode | Get-ScheduledTaskInfo

A log file rolls to t3cm.log.1 at start once it passes 10 MB. Set RUST_LOG=debug in the service’s environment for more.

is t3cm serving on 127.0.0.1:47731?

t3cm status, exec or search could not reach the service. The message goes on with the command that starts the service on your OS and where its logs are.

  • The service-state command in the table above shows whether it runs, and the log shows why it stopped. On Windows a stopped task starts again within five minutes unless it is disabled; Enable-ScheduledTask t3-codemode and Start-ScheduledTask t3-codemode bring it back now.
  • serve fails with binding 127.0.0.1:47731 when something else holds the port. Pick another with --port or T3CM_PORT, and register the MCP server with the same port.
  • A service on another port needs --port or T3CM_PORT on the CLI too.

t3.connected is false

t3.lastError says why:

  • T3 Code is not running here: no readable .../server-runtime.json: start T3 Code. If T3 keeps its home somewhere other than ~/.t3, set T3CODE_HOME for the service.
  • no t3 binary found; set T3CM_T3_BIN: the service could not find the t3 CLI it uses to mint pairing codes. Set T3CM_T3_BIN to its path.
  • `t3 ...` failed:: the t3 CLI ran and failed. The rest of the message is its stderr.

If lastError is empty, the service log has the reason: a failed sign-in at start goes to the log as T3 auth not ready yet. After fixing the cause, run t3cm auth to sign in from your shell, with the service’s --state-dir or T3CM_STATE_DIR if it uses one, then restart the service. It loads the saved token from that state directory, or signs in again on its own. See T3 sign-in for the whole flow.

A tool is missing from the catalog

  • A new T3 tool. The catalog comes from T3’s tools/list, refreshed every 10 minutes. Restart the service to pick it up sooner.
  • An upstream’s tools. Check the upstream’s state in t3cm status. backoff means it failed to connect; lastError says why and retryAt says when it tries again. disabled means enabled: false in the config. A tool that allow leaves out, or deny names, has no catalog entry at all.
  • The client’s tool list. Claude Code and Antigravity load MCP servers at session start. A thread opened before you installed or re-registered t3cm keeps its old tool list until a new session starts.

Antigravity text generation is unavailable

T3 Code checks <profile>/config/mcp_config.json before using an Antigravity profile for system text-generation tasks such as title generation, and disables that role whenever mcpServers is non-empty. Antigravity agent threads still run as normal. Pick another provider as T3’s system model, or remove t3cm from mcpServers in ~/.t3/userdata/providers/antigravity/<hash>/config/mcp_config.json when no other servers remain in that object if you want Antigravity for system text generation.

t3cm is busy

t3cm is busy: N runs are in progress and none finished within M ms; retry shortly means other runs held every one of the maxConcurrentRuns slots for runQueueMs. It is safe to retry. If it happens often, runs in t3cm status shows the load; raise maxConcurrentRuns only with the memory math on Configuration in mind.

A script is cut off

  • CPU budget exceeded: the script spent more than cpuBudgetMs (2 s) running JavaScript. Time waiting on t3, mem or wf calls does not count, so the cause is a loop over a large result. Filter earlier, or split the work across runs and keep the progress in vars.
  • timed out after N ms (timeout_ms): the wall clock ran out, usually waiting on a slow tool. Pass a larger timeout_ms, up to maxTimeoutMs.
  • vars keeps what a script set before a thrown error, but not what it set before a CPU or wall kill.

A call says target_required or “not running inside a T3 thread”

t3 calls reach T3 as the service’s own MCP client, so T3 cannot tell which thread ran the script. The X-T3-Thread header tells t3cm who is calling, for mem, vars and wf, but T3 never sees it. A T3 tool that defaults to “this thread” or “this project” therefore needs an explicit target in every script: pass allProjects: true, a projectId or a threadId.

... is denied by the t3-codemode deny list

The tool is on the config’s deny list, and the host refuses it however the script calls it. Retrying will not help. Remove it from deny if scripts should reach it.

The board answers 403

The board answers only on its own host and port: http://127.0.0.1:<port>/ or http://localhost:<port>/, where <port> is 47731 unless you changed it. A proxy, another hostname, or a page on another origin gets 403. POSTs from your own scripts also need the X-T3CM-CSRF token embedded in the page.

t3cm update rolled back

t3cm update puts the old binary back when the restarted service stops, or does not report the new version on /healthz within 45 seconds. The service log says why the new version did not start. If the release changed the systemd unit, the message names the saved copy. Install it as the update printed, then run t3cm update again. If the rollback fails too, the error says which step failed; check the service state with the command it names before you retry. To install a release by hand, download the installer as Install shows and run it for that release: bash install.sh --version vX.Y.Z, or on Windows powershell -ExecutionPolicy Bypass -File install.ps1 -Version vX.Y.Z.

After an update with --no-restart, or one that found the service stopped, nothing was restarted, so there is nothing to roll back. If the new version misbehaves after you restart the service, run the command the update printed to go back to t3cm.old.

the service runs ..., but this is ... means you ran a different t3cm than the one the service runs. Run the installed one, which the message names.

another t3cm update is running means a second update started while one was still going. Let the first one finish, then run it again if you still need to.

the service is running but nothing answers on 127.0.0.1:<port> means the service serves another port, or it is up but not answering. Pass its port with --port (or T3CM_PORT) so the update can check the restart. If the port is right and the service is stuck, stop it with the command the message names (systemctl --user stop t3-codemode.service, launchctl kill TERM on macOS, or schtasks /End on Windows) and run t3cm update again. The update changed nothing.

a t3cm <version> answers on 127.0.0.1:<port>, but ... is t3cm <other> means the service runs a different version than the binary on disk, usually after an update with --no-restart. Restart the service with the command the message names, so it runs the binary on disk, then run the update again. The update changed nothing.

the service on 127.0.0.1:<port> still runs t3cm <old> comes from an update that found t3cm current but the service behind, and could not restart it: you passed --no-restart, or no systemd unit, launchd agent or scheduled task manages the service. Restart it with the command the message names.

a t3cm <version> answers on 127.0.0.1:<port>, but that listener is not the service (or could not tell whether that listener is the service) means an unmanaged t3cm is listening on that port, or t3cm update could not confirm the service owns it, so it left the service running. Stop that process, pass the service’s port with --port (or T3CM_PORT), or restart the service with the command the message names.

Still stuck

Search the issues, and open one with the t3cm status output (secrets removed) and the steps that led there. Report anything that looks like a security problem through the security policy instead.

API reference

The site build runs t3cm types --from tests/fixtures/t3-tools.json and puts its output below. Each declaration is the signature of a search catalog entry, grouped by global. The fixture is a snapshot of T3’s tools. A live service takes its catalog from T3’s current tools/list and from any upstreams you configure, so its declarations can differ from this page.

declare const t3: {
  /** Accept or dismiss the dialog `preview_status` reports. Pass `promptText` to accept a prompt. Needs your own tab, or an unclaimed one. Desktop hosts may not support this. */
  preview_dialog(input: {
    tabId?: string;
    accept: boolean;
    promptText?: string;
  }): Promise<{
    available: boolean;
    /** True while a client shows this tab: a streamed live view, or the desktop app's own browser panel. */
    visible: boolean;
    tabId: string | null;
    url: string | null;
    title: string | null;
    loading: boolean;
    loadError?: {
      url: string;
      code: number;
      description: string;
    } | null;
    control?: {
      owner: "agent" | "human" | "unclaimed";
      ownedByCaller: boolean;
      generation: number | "Infinity" | "-Infinity" | "NaN";
    } | null;
    dialog?: {
      type: string;
      message: string;
      defaultValue: string;
    } | null;
    viewportSetting?: {
      _tag: "fill";
    } | {
      _tag: "freeform";
      width: number;
      height: number;
    } | {
      _tag: "preset";
      width: number;
      height: number;
      presetId: "iphone-se" | "iphone-xr" | "iphone-12-pro" | "iphone-14-pro-max" | "pixel-7" | "samsung-galaxy-s8-plus" | "samsung-galaxy-s20-ultra" | "ipad-mini" | "ipad-air" | "ipad-pro" | "surface-pro-7" | "surface-duo" | "galaxy-z-fold-5" | "asus-zenbook-fold" | "samsung-galaxy-a51-71" | "nest-hub" | "nest-hub-max" | "desktop-1920x1080" | "desktop-1440x900" | "laptop-1366x768" | "laptop-1280x800" | "ipad-pro-11" | "iphone-15-pro" | "pixel-8" | "galaxy-s24";
    } | null;
    viewport?: {
      width: number;
      height: number;
    } | null;
    fileChooser?: {
      multiple: boolean;
      accept: string;
    } | null;
    downloads?: {
      fileName: string;
      path: string;
      sizeBytes: number | "Infinity" | "-Infinity" | "NaN";
      url: string;
      completedAt: string;
    }[] | null;
    tabs?: {
      tabId: string;
      url: string | null;
      openerTabId?: string | null;
      owner?: "agent" | "human" | "unclaimed" | null;
      ownedByCaller?: boolean | null;
      visible?: boolean | null;
      profileId?: string | null;
    }[] | null;
    profiles?: {
      id: string;
      name: string;
      incognito?: boolean | null;
    }[] | null;
    defaultProfileId?: string | null;
  }>;
  /** Report preview tab state: owner, pending dialog, URL, title, loading, viewport, and size. `tabs` lists this thread's tabs. `profiles` lists logins for `preview_open`. Read any listed tab. Act only on your tab, or an unclaimed tab with no human in control. */
  preview_status(input?: {
    tabId?: string;
  }): Promise<{
    available: boolean;
    /** True while a client shows this tab: a streamed live view, or the desktop app's own browser panel. */
    visible: boolean;
    tabId: string | null;
    url: string | null;
    title: string | null;
    loading: boolean;
    loadError?: {
      url: string;
      code: number;
      description: string;
    } | null;
    control?: {
      owner: "agent" | "human" | "unclaimed";
      ownedByCaller: boolean;
      generation: number | "Infinity" | "-Infinity" | "NaN";
    } | null;
    dialog?: {
      type: string;
      message: string;
      defaultValue: string;
    } | null;
    viewportSetting?: {
      _tag: "fill";
    } | {
      _tag: "freeform";
      width: number;
      height: number;
    } | {
      _tag: "preset";
      width: number;
      height: number;
      presetId: "iphone-se" | "iphone-xr" | "iphone-12-pro" | "iphone-14-pro-max" | "pixel-7" | "samsung-galaxy-s8-plus" | "samsung-galaxy-s20-ultra" | "ipad-mini" | "ipad-air" | "ipad-pro" | "surface-pro-7" | "surface-duo" | "galaxy-z-fold-5" | "asus-zenbook-fold" | "samsung-galaxy-a51-71" | "nest-hub" | "nest-hub-max" | "desktop-1920x1080" | "desktop-1440x900" | "laptop-1366x768" | "laptop-1280x800" | "ipad-pro-11" | "iphone-15-pro" | "pixel-8" | "galaxy-s24";
    } | null;
    viewport?: {
      width: number;
      height: number;
    } | null;
    fileChooser?: {
      multiple: boolean;
      accept: string;
    } | null;
    downloads?: {
      fileName: string;
      path: string;
      sizeBytes: number | "Infinity" | "-Infinity" | "NaN";
      url: string;
      completedAt: string;
    }[] | null;
    tabs?: {
      tabId: string;
      url: string | null;
      openerTabId?: string | null;
      owner?: "agent" | "human" | "unclaimed" | null;
      ownedByCaller?: boolean | null;
      visible?: boolean | null;
      profileId?: string | null;
    }[] | null;
    profiles?: {
      id: string;
      name: string;
      incognito?: boolean | null;
    }[] | null;
    defaultProfileId?: string | null;
  }>;
  /** Open a preview tab in this thread and show it. For a dev server, pass `target` instead of `url`. `open=false` keeps it in the background. Reuses your current tab unless `tabId` or `reuseExistingTab=false` says otherwise. Parallel subagents in one session must each use `reuseExistingTab=false`, then their own returned `tabId`. */
  preview_open(input?: {
    tabId?: string;
    /** First page URL. Absolute http(s) URL, or a bare host (https; http for loopback). Omit to open a blank tab. */
    url?: string;
    /** Show the preview to the user. Default true. False for background only. */
    open?: boolean;
    /** Old alias for `open`. */
    show?: boolean;
    /** Reuse `tabId`, or your current tab. Default true. False makes a new tab. */
    reuseExistingTab?: boolean;
    /** Profile id or name from preview_status, for a new tab. Default: the user's. A tab keeps its profile. */
    profileId?: string;
    target?: {
      kind: "environment-port";
      /** Dev-server port here. */
      port: number;
      /** Default http. */
      protocol?: "http" | "https";
      /** Path, query, and fragment, such as /settings?tab=account. */
      path?: string;
    };
  }): Promise<{
    available: boolean;
    /** True while a client shows this tab: a streamed live view, or the desktop app's own browser panel. */
    visible: boolean;
    tabId: string | null;
    url: string | null;
    title: string | null;
    loading: boolean;
    loadError?: {
      url: string;
      code: number;
      description: string;
    } | null;
    control?: {
      owner: "agent" | "human" | "unclaimed";
      ownedByCaller: boolean;
      generation: number | "Infinity" | "-Infinity" | "NaN";
    } | null;
    dialog?: {
      type: string;
      message: string;
      defaultValue: string;
    } | null;
    viewportSetting?: {
      _tag: "fill";
    } | {
      _tag: "freeform";
      width: number;
      height: number;
    } | {
      _tag: "preset";
      width: number;
      height: number;
      presetId: "iphone-se" | "iphone-xr" | "iphone-12-pro" | "iphone-14-pro-max" | "pixel-7" | "samsung-galaxy-s8-plus" | "samsung-galaxy-s20-ultra" | "ipad-mini" | "ipad-air" | "ipad-pro" | "surface-pro-7" | "surface-duo" | "galaxy-z-fold-5" | "asus-zenbook-fold" | "samsung-galaxy-a51-71" | "nest-hub" | "nest-hub-max" | "desktop-1920x1080" | "desktop-1440x900" | "laptop-1366x768" | "laptop-1280x800" | "ipad-pro-11" | "iphone-15-pro" | "pixel-8" | "galaxy-s24";
    } | null;
    viewport?: {
      width: number;
      height: number;
    } | null;
    fileChooser?: {
      multiple: boolean;
      accept: string;
    } | null;
    downloads?: {
      fileName: string;
      path: string;
      sizeBytes: number | "Infinity" | "-Infinity" | "NaN";
      url: string;
      completedAt: string;
    }[] | null;
    tabs?: {
      tabId: string;
      url: string | null;
      openerTabId?: string | null;
      owner?: "agent" | "human" | "unclaimed" | null;
      ownedByCaller?: boolean | null;
      visible?: boolean | null;
      profileId?: string | null;
    }[] | null;
    profiles?: {
      id: string;
      name: string;
      incognito?: boolean | null;
    }[] | null;
    defaultProfileId?: string | null;
  }>;
  /** Navigate the chosen tab. Pass `url` for a website, or `target:{kind:'environment-port',port}` for a dev server. Exactly one of `url` and `target`. */
  preview_navigate(input?: {
    tabId?: string;
    /** Website URL. Absolute http(s) URL, or a bare host (https; http for loopback). For public pages. */
    url?: string;
    target?: {
      kind: "url" | "environment-port";
      /** Website URL. Absolute http(s) URL, or a bare host (https; http for loopback). */
      url?: string;
      /** Dev-server port here. */
      port?: number;
      /** Default http. */
      protocol?: "http" | "https";
      /** Path, query, and fragment, such as /settings?tab=account. */
      path?: string;
    };
    /** Default 'load'. 'none': return at once. */
    readiness?: "load" | "domContentLoaded" | "none";
    /** Default 15000. */
    timeoutMs?: number;
  }): Promise<{
    available: boolean;
    /** True while a client shows this tab: a streamed live view, or the desktop app's own browser panel. */
    visible: boolean;
    tabId: string | null;
    url: string | null;
    title: string | null;
    loading: boolean;
    loadError?: {
      url: string;
      code: number;
      description: string;
    } | null;
    control?: {
      owner: "agent" | "human" | "unclaimed";
      ownedByCaller: boolean;
      generation: number | "Infinity" | "-Infinity" | "NaN";
    } | null;
    dialog?: {
      type: string;
      message: string;
      defaultValue: string;
    } | null;
    viewportSetting?: {
      _tag: "fill";
    } | {
      _tag: "freeform";
      width: number;
      height: number;
    } | {
      _tag: "preset";
      width: number;
      height: number;
      presetId: "iphone-se" | "iphone-xr" | "iphone-12-pro" | "iphone-14-pro-max" | "pixel-7" | "samsung-galaxy-s8-plus" | "samsung-galaxy-s20-ultra" | "ipad-mini" | "ipad-air" | "ipad-pro" | "surface-pro-7" | "surface-duo" | "galaxy-z-fold-5" | "asus-zenbook-fold" | "samsung-galaxy-a51-71" | "nest-hub" | "nest-hub-max" | "desktop-1920x1080" | "desktop-1440x900" | "laptop-1366x768" | "laptop-1280x800" | "ipad-pro-11" | "iphone-15-pro" | "pixel-8" | "galaxy-s24";
    } | null;
    viewport?: {
      width: number;
      height: number;
    } | null;
    fileChooser?: {
      multiple: boolean;
      accept: string;
    } | null;
    downloads?: {
      fileName: string;
      path: string;
      sizeBytes: number | "Infinity" | "-Infinity" | "NaN";
      url: string;
      completedAt: string;
    }[] | null;
    tabs?: {
      tabId: string;
      url: string | null;
      openerTabId?: string | null;
      owner?: "agent" | "human" | "unclaimed" | null;
      ownedByCaller?: boolean | null;
      visible?: boolean | null;
      profileId?: string | null;
    }[] | null;
    profiles?: {
      id: string;
      name: string;
      incognito?: boolean | null;
    }[] | null;
    defaultProfileId?: string | null;
  }>;
  /** Resize the chosen tab: {mode:'fill'}, {mode:'freeform',width,height}, or {mode:'preset',preset,orientation}. Changes CSS size only, not the user agent. */
  preview_resize(input: {
    tabId?: string;
    mode: "fill" | "freeform" | "preset";
    preset?: "iphone-se" | "iphone-xr" | "iphone-12-pro" | "iphone-14-pro-max" | "pixel-7" | "samsung-galaxy-s8-plus" | "samsung-galaxy-s20-ultra" | "ipad-mini" | "ipad-air" | "ipad-pro" | "surface-pro-7" | "surface-duo" | "galaxy-z-fold-5" | "asus-zenbook-fold" | "samsung-galaxy-a51-71" | "nest-hub" | "nest-hub-max";
    width?: number;
    height?: number;
    orientation?: "portrait" | "landscape";
    /** Default 15000. */
    timeoutMs?: number;
  }): Promise<{
    tabId: string;
    setting: {
      _tag: "fill";
    } | {
      _tag: "freeform";
      width: number;
      height: number;
    } | {
      _tag: "preset";
      width: number;
      height: number;
      presetId: "iphone-se" | "iphone-xr" | "iphone-12-pro" | "iphone-14-pro-max" | "pixel-7" | "samsung-galaxy-s8-plus" | "samsung-galaxy-s20-ultra" | "ipad-mini" | "ipad-air" | "ipad-pro" | "surface-pro-7" | "surface-duo" | "galaxy-z-fold-5" | "asus-zenbook-fold" | "samsung-galaxy-a51-71" | "nest-hub" | "nest-hub-max" | "desktop-1920x1080" | "desktop-1440x900" | "laptop-1366x768" | "laptop-1280x800" | "ipad-pro-11" | "iphone-15-pro" | "pixel-8" | "galaxy-s24";
    };
    /** Viewport size after the resize. Omitted when it could not be measured. */
    viewport?: {
      width: number;
      height: number;
    } | null;
    toolIcon?: {
      _tag: "website";
      pageUrl: string;
      faviconUrl?: string | null;
      faviconUrlDark?: string | null;
    } | {
      _tag: "native-app";
      app: {
        _tag: "app-id";
        appId: string;
      } | {
        _tag: "display-name";
        displayName: string;
      };
    } | {
      _tag: "themed-logo";
      logoUrl: string;
      logoUrlDark?: string | null;
    } | null;
  }>;
  /** Set `prefers-color-scheme` for the chosen tab: 'dark', 'light', or 'system' to clear the override. */
  preview_set_appearance(input: {
    tabId?: string;
    colorScheme: "system" | "light" | "dark";
  }): Promise<{
    tabId: string;
    colorScheme: "system" | "light" | "dark";
    toolIcon?: {
      _tag: "website";
      pageUrl: string;
      faviconUrl?: string | null;
      faviconUrlDark?: string | null;
    } | {
      _tag: "native-app";
      app: {
        _tag: "app-id";
        appId: string;
      } | {
        _tag: "display-name";
        displayName: string;
      };
    } | {
      _tag: "themed-logo";
      logoUrl: string;
      logoUrlDark?: string | null;
    } | null;
  }>;
  /** Act on the chosen tab. Target with `locator='aria-ref=<ref>'` from `preview_snapshot`; `x` and `y` go together. `timeoutMs` defaults to 15000. click: `button`, `clickCount` 1 to 3. type: literal `text`, `clear=true` replaces it. hover: shows menus or tooltips. select: `values` in one native <select>, by value or label; for a custom dropdown, click it open, then click the option. drag: `source` onto `target`. upload: absolute `paths` answer the file picker `preview_status` reports, [] cancels it, or a `locator` sets an <input type=file>. press: one `key`, such as 'Enter', with `modifiers`, to the focused element; click a field first to focus it. scroll: the tab, or one container with a locator; positive `deltaY` scrolls down, positive `deltaX` right. */
  preview_act(input: {
    action: "click" | "type" | "hover" | "select" | "drag" | "upload" | "press" | "scroll";
    tabId?: string;
    locator?: string;
    selector?: string;
    x?: number;
    y?: number;
    button?: "left" | "right" | "middle";
    clickCount?: number;
    text?: string;
    clear?: boolean;
    values?: string[];
    source?: string;
    target?: string;
    paths?: string[];
    key?: string;
    modifiers?: ("Alt" | "Control" | "Meta" | "Shift")[];
    deltaX?: number;
    deltaY?: number;
    timeoutMs?: number;
  }): Promise<unknown>;
  /** Run JavaScript in the page. It can change page state. Returns `{value}`, up to 64 KB. Needs your tab, or an unclaimed one. To read a tab the user drives, use `preview_snapshot`. Page tools write only on user request. Show results with `html_render`, never page tools. */
  preview_evaluate(input: {
    tabId?: string;
    expression: string;
    /** Default true. */
    awaitPromise?: boolean;
  }): Promise<{
    toolIcon?: {
      _tag: "website";
      pageUrl: string;
      faviconUrl?: string | null;
      faviconUrlDark?: string | null;
    } | {
      _tag: "native-app";
      app: {
        _tag: "app-id";
        appId: string;
      } | {
        _tag: "display-name";
        displayName: string;
      };
    } | {
      _tag: "themed-logo";
      logoUrl: string;
      logoUrlDark?: string | null;
    } | null;
    value: unknown;
  }>;
  /** Wait until all given locator, selector, text, and URL conditions match in the chosen tab. */
  preview_wait_for(input?: {
    tabId?: string;
    selector?: string;
    locator?: string;
    /** Case counts. */
    text?: string;
    urlIncludes?: string;
    /** Default 15000. */
    timeoutMs?: number;
  }): Promise<{
    toolIcon?: {
      _tag: "website";
      pageUrl: string;
      faviconUrl?: string | null;
      faviconUrlDark?: string | null;
    } | {
      _tag: "native-app";
      app: {
        _tag: "app-id";
        appId: string;
      } | {
        _tag: "display-name";
        displayName: string;
      };
    } | {
      _tag: "themed-logo";
      logoUrl: string;
      logoUrlDark?: string | null;
    } | null;
  }>;
  /** Start recording the chosen tab. */
  preview_recording_start(input?: {
    tabId?: string;
  }): Promise<{
    tabId: string;
    recording: boolean;
    startedAt: string | null;
    toolIcon?: {
      _tag: "website";
      pageUrl: string;
      faviconUrl?: string | null;
      faviconUrlDark?: string | null;
    } | {
      _tag: "native-app";
      app: {
        _tag: "app-id";
        appId: string;
      } | {
        _tag: "display-name";
        displayName: string;
      };
    } | {
      _tag: "themed-logo";
      logoUrl: string;
      logoUrlDark?: string | null;
    } | null;
  }>;
  /** Stop recording the chosen tab. Returns a local path to the recording file (max 50 MiB). */
  preview_recording_stop(input?: {
    tabId?: string;
  }): Promise<{
    id: string;
    tabId: string;
    path: string;
    mimeType: string;
    sizeBytes: number;
    createdAt: string;
    toolIcon?: {
      _tag: "website";
      pageUrl: string;
      faviconUrl?: string | null;
      faviconUrlDark?: string | null;
    } | {
      _tag: "native-app";
      app: {
        _tag: "app-id";
        appId: string;
      } | {
        _tag: "display-name";
        displayName: string;
      };
    } | {
      _tag: "themed-logo";
      logoUrl: string;
      logoUrlDark?: string | null;
    } | null;
  }>;
  /** Use it only when the current request asks for browser work, including checking an edit in the browser. Never use it unasked to verify your own edit, or to repeat a snapshot from an earlier turn. Works on a tab the user is driving. Returns page state, elements, diagnostics, and screenshot size. Target one element with `locator='aria-ref=<ref>'` from `accessibilityTree`, even in frames. Refs die on navigation, a new snapshot, or handoff. Text caps near 20 KB; on your own or an unclaimed tab, `preview_evaluate` reads more. To show a screenshot when asked: `save=true`, then embed ![alt](screenshotPath). */
  preview_snapshot(input?: {
    tabId?: string;
    /** Default false. True only to see the page. */
    includeImage?: boolean;
    /** Write PNG, return `screenshotPath`. */
    save?: boolean;
  }): Promise<unknown>;
  /** List providers, models, options, and runtime modes for `delegate_task`. Short list. `search` finds others. Any catalog model works. */
  orchestrator_capabilities(input?: {
    environmentId?: string;
    search?: string;
  }): Promise<{
    parentThreadId: string | null;
    inheritedProviderInstanceId: string | null;
    inheritedModel: string | null;
    inheritedOptions?: {
      id: string;
      value: string | boolean;
    }[] | null;
    runtimeMode: "approval-required" | "auto-accept-edits" | "auto" | "full-access";
    interactionMode: "default" | "plan";
    providers: {
      providerInstanceId: string;
      driverKind: string;
      displayName: string | null;
      models: {
        id: string;
        label?: string | null;
        options?: {
          id: string;
          values: (string | boolean)[];
          default?: string | boolean | null;
        }[] | null;
      }[];
      omittedModels?: number | null;
      runtimeModes?: ("approval-required" | "auto-accept-edits" | "auto" | "full-access")[] | null;
      canRunChildTask: boolean;
      canRunCrossProviderChildTask: boolean;
      constraints: string[];
    }[];
    features: {
      appOwnedSubagents: boolean;
      asyncPolling: boolean;
      cancellation: boolean;
      batchThreadCreation: boolean;
      threadManagement: boolean;
      incrementalThreadRead: boolean;
      scheduledTasks: boolean;
      maxBatchThreads: number | "Infinity" | "-Infinity" | "NaN";
    };
  }>;
  /** Start one child agent with only `task`. No parent history. Separate checkout or PR per child: `isolation:'worktree'`. Keep `taskId` for `task_status` and `task_cancel`. No secrets in `task`. */
  delegate_task(input: {
    task: string;
    target?: {
      providerInstanceId?: string;
      driverKind?: string;
      model?: string;
      /** Options from `orchestrator_capabilities`, such as {effort:'max'}. Given values override inherited. [] or {} clears. */
      options?: {
        id: string;
        value: string | boolean;
      }[] | Record<string, string | boolean>;
      environmentId?: string;
      projectId?: string;
    };
    title?: string;
    role?: "implementation" | "research" | "review" | "design" | "test" | "general";
    /** 'shared' (default): parent checkout. 'worktree': new prepared checkout from the parent commit, for a separate checkout or PR per child. Uncommitted edits stay out. */
    isolation?: "shared" | "worktree";
    /** Default 'async'. 'wait' only if this turn needs the result. A question or approval ends the wait. */
    mode?: "async" | "wait";
    /** Mode 'wait' only. Default 4 min. A timeout does not cancel the child. */
    timeoutMs?: number;
    clientRequestId?: string;
    /** Omit unless the user asks for a supervised child. Narrow modes pause for human approval, not read-only. Above yours is rejected. */
    runtimeMode?: "inherit" | "approval-required" | "auto-accept-edits" | "auto" | "full-access";
    interactionMode?: "inherit" | "default" | "plan";
  }): Promise<{
    taskId: string;
    childThreadId: string | null;
    remoteChild?: {
      environmentId: string;
      threadId: string;
      label: string;
    } | null;
    link?: string | null;
    childRunId: string | null;
    childNodeId: string;
    /** starting means the child's provider has not started its turn yet, so no work has begun. */
    status: "queued" | "starting" | "running" | "waiting" | "completed" | "failed" | "cancelled" | "interrupted";
    workState: "working" | "waiting_for_children" | "result_available";
    hasPendingChildRuns: boolean;
    latestTerminalRunId: string | null;
    latestTerminalStatus: "completed" | "failed" | "cancelled" | "interrupted" | null;
    latestTerminalSummary: string | null;
    latestTerminalResultContextTransferId: string | null;
    providerInstanceId: string;
    model: string | null;
    executedModel?: string | null | null;
    options?: {
      id: string;
      value: string | boolean;
    }[] | null;
    summary: string | null;
    resultContextTransferId: string | null;
    /** A question blocks the child and ends a wait. Answer via `t3_pending_request` on `childThreadId`, or the user does. */
    hasPendingQuestion: boolean;
    /** Oldest pending approval, or null. Ends a wait. Grants no approval rights. */
    pendingApproval: {
      requestId: string;
      kind: "command" | "file-read" | "file-change" | "mcp-elicitation" | "permission";
      runId: string;
    } | null;
    /** True only on the timed-out wait call. The child keeps running. */
    waitTimedOut: boolean;
    next?: string | null;
  }>;
  /** Read one delegated task you started. Do not call it on a running task before its completion wakes you. `workState`: working, waiting_for_children, result_available. A finished turn with live child work is not done. `summary`: final result. Reading it marks it delivered. */
  task_status(input: {
    taskId: string;
  }): Promise<{
    taskId: string;
    childThreadId: string | null;
    remoteChild?: {
      environmentId: string;
      threadId: string;
      label: string;
    } | null;
    link?: string | null;
    childRunId: string | null;
    childNodeId: string;
    /** starting means the child's provider has not started its turn yet, so no work has begun. */
    status: "queued" | "starting" | "running" | "waiting" | "completed" | "failed" | "cancelled" | "interrupted";
    workState: "working" | "waiting_for_children" | "result_available";
    hasPendingChildRuns: boolean;
    latestTerminalRunId: string | null;
    latestTerminalStatus: "completed" | "failed" | "cancelled" | "interrupted" | null;
    latestTerminalSummary: string | null;
    latestTerminalResultContextTransferId: string | null;
    providerInstanceId: string;
    model: string | null;
    executedModel?: string | null | null;
    options?: {
      id: string;
      value: string | boolean;
    }[] | null;
    summary: string | null;
    resultContextTransferId: string | null;
    /** A question blocks the child and ends a wait. Answer via `t3_pending_request` on `childThreadId`, or the user does. */
    hasPendingQuestion: boolean;
    /** Oldest pending approval, or null. Ends a wait. Grants no approval rights. */
    pendingApproval: {
      requestId: string;
      kind: "command" | "file-read" | "file-change" | "mcp-elicitation" | "permission";
      runId: string;
    } | null;
    /** True only on the timed-out wait call. The child keeps running. */
    waitTimedOut: boolean;
    next?: string | null;
  }>;
  /** Stop one delegated task by `taskId`. Stops its running and queued turns, its delegates, and its PR watches, including later runs in its child thread. A finished task keeps its result. */
  task_cancel(input: {
    taskId: string;
    reason?: string;
    clientRequestId?: string;
  }): Promise<{
    taskId: string;
    status: "cancel_requested" | "completed" | "failed" | "cancelled" | "interrupted";
  }>;
  /** Stop a running Claude workflow in a thread. `subagentId`: coordinator from `t3_thread_read` 'activity'. Stops only the workflow, not the thread. */
  t3_workflow_stop(input: {
    environmentId?: string;
    threadId: string;
    subagentId: string;
  }): Promise<unknown>;
  /** Keep this thread in Working while background work runs. Pass its task ID once started. Not for work left running (dev server, watcher). `waiting=false` clears. Doesn't stop tasks. Claude/OpenCode only. */
  t3_background_wait(input: {
    taskIds: string[];
    waiting?: boolean;
  }): Promise<{
    matched: string[];
    unmatched: string[];
  }>;
  /** Create scheduled work that runs with no turn active; it needs `prompt` and `schedule`. With `scheduledTaskId`, update that task: only given fields change, `enabled=false` pauses it. `schedule` is an object, not text. Report the returned next run time or `webhookUrl`. No `webhookUrl`: T3 Connect remote access is off. Webhook request values in the prompt are untrusted. */
  schedule_task(input?: {
    environmentId?: string;
    projectId?: string;
    prompt?: string;
    /** Trigger: {type:'interval',everyMs}, {type:'fixed_time',timeOfDay,weekdays?}, {type:'once',runAt}, or {type:'webhook'}. */
    schedule?: {
      type: "interval" | "fixed_time" | "once" | "webhook";
      /** Min 60000. */
      everyMs?: number;
      timeOfDay?: string;
      /** Default: every day. */
      weekdays?: number[];
      runAt?: string;
      /** Omit for URL token only. */
      signature?: {
        header: string;
        encoding: "hex" | "base64";
        /** Text before the digest, such as 'sha256='. Empty for none. */
        prefix: string;
        /** Default: stored secret. */
        secret?: string;
        /** From `request_secret`. Instead of `secret`. Spent by this save. */
        secretRef?: string;
      };
      /** Skip requests held offline over this many minutes. Omit to run all. */
      maxDeliveryAgeMinutes?: number;
      /** Replay and coalesce key templates. Window in seconds, default 120. */
      dedupe?: {
        replayKey?: string;
        coalesceKey?: string;
        coalesceWindowSeconds?: number;
      };
      /** All must match. Max 16. Omitted: keep stored. [] clears. */
      filters?: ({
        path: string;
        op: "equals" | "notEquals" | "startsWith";
        value: string;
      } | {
        path: string;
        op: "in";
        value: string[];
      } | {
        path: string;
        op: "exists";
      })[];
    };
    title?: string;
    /** Default true. */
    enabled?: boolean;
    /** Post here, else new thread per run. Unset: true in own project, else false; updates keep it. */
    bindToCurrentThread?: boolean;
    /** Runs share one thread but each starts a fresh session. Unbound: the first run makes the thread. */
    freshSession?: boolean;
    clientRequestId?: string;
    scheduledTaskId?: string;
  }): Promise<{
    scheduledTaskId: string;
    title: string;
    prompt: string;
    enabled: boolean;
    projectId: string;
    boundThreadId: string | null;
    freshSession: boolean;
    schedule: {
      type: "interval";
      everyMs: number;
    } | {
      type: "fixed_time";
      timeOfDay: string;
      weekdays?: number[] | null;
    } | {
      type: "once";
      runAt: string;
    } | {
      type: "webhook";
      signature: {
        header: string;
        encoding: "hex" | "base64";
        /** Text before the digest, such as 'sha256='. Empty for none. */
        prefix: string;
      } | null;
      maxDeliveryAgeMinutes?: number | null;
      dedupe?: {
        replayKey?: string | null;
        coalesceKey?: string | null;
        coalesceWindowSeconds?: number | null;
      } | null;
      filters?: ({
        path: string;
        op: "equals" | "notEquals" | "startsWith";
        value: string;
      } | {
        path: string;
        op: "in";
        value: string[];
      } | {
        path: string;
        op: "exists";
      })[] | null;
    };
    nextRunAt: string | null;
    lastRunStatus: "never" | "running" | "succeeded" | "failed";
    /** Public URL for the sender. Absent: no T3 Connect tunnel. The user must enable T3 Connect remote access. */
    webhookUrl?: string | null;
    webhookSignature?: "none" | "set" | null;
    /** Present when an administrator's policy stops this task from running. */
    blockedByPolicy?: string | null;
  }>;
  /** List scheduled tasks. Omit `projectId` for this thread's project. Pass a `scheduledTaskId` to `schedule_task` or `delete_scheduled_task`. In a scheduled run, do not call this to find your task. Do the prompt. */
  list_scheduled_tasks(input?: {
    environmentId?: string;
    projectId?: string;
  }): Promise<{
    tasks: {
      scheduledTaskId: string;
      title: string;
      prompt: string;
      enabled: boolean;
      projectId: string;
      boundThreadId: string | null;
      freshSession: boolean;
      schedule: {
        type: "interval";
        everyMs: number;
      } | {
        type: "fixed_time";
        timeOfDay: string;
        weekdays?: number[] | null;
      } | {
        type: "once";
        runAt: string;
      } | {
        type: "webhook";
        signature: {
          header: string;
          encoding: "hex" | "base64";
          /** Text before the digest, such as 'sha256='. Empty for none. */
          prefix: string;
        } | null;
        maxDeliveryAgeMinutes?: number | null;
        dedupe?: {
          replayKey?: string | null;
          coalesceKey?: string | null;
          coalesceWindowSeconds?: number | null;
        } | null;
        filters?: ({
          path: string;
          op: "equals" | "notEquals" | "startsWith";
          value: string;
        } | {
          path: string;
          op: "in";
          value: string[];
        } | {
          path: string;
          op: "exists";
        })[] | null;
      };
      nextRunAt: string | null;
      lastRunStatus: "never" | "running" | "succeeded" | "failed";
      /** Public URL for the sender. Absent: no T3 Connect tunnel. The user must enable T3 Connect remote access. */
      webhookUrl?: string | null;
      webhookSignature?: "none" | "set" | null;
      /** Present when an administrator's policy stops this task from running. */
      blockedByPolicy?: string | null;
    }[];
  }>;
  /** Delete one scheduled task by `scheduledTaskId`. It stops at once. To pause instead, use `schedule_task` with `enabled=false`. */
  delete_scheduled_task(input: {
    environmentId?: string;
    scheduledTaskId: string;
  }): Promise<{
    scheduledTaskId: string;
    deleted: boolean;
  }>;
  /** Ask for one secret per single-line card; never combine values. Open it, don't offer it. Returns one-use `secretRef`, or `delivery: "file"` a file read only in its command, e.g. `adb pair <ip:port> "$(cat <file>)"`. Asked how: call now. Sign-in link: `url`. Pasted secret for child/script: `value`. Never from an old thread. */
  request_secret(input: {
    label: string;
    reason: string;
    /** Sign-in or setup page for the value. Shown as a button. */
    url?: string;
    placeholder?: string;
    /** secretRef (default) for a T3 tool; file for a command. */
    delivery?: "secretRef" | "file";
    /** Pasted in this thread; no card. */
    value?: string;
    timeoutMs?: number;
    /** Retry key. */
    clientRequestId?: string;
  }): Promise<unknown>;
  /** Create new top-level threads in this checkout. Not delegation. One thread or its own worktree: `t3_thread_launch`. Project, branch, and worktree inherit. */
  create_threads(input: {
    threads: {
      prompt?: string;
      title?: string;
      target?: {
        providerInstanceId?: string;
        driverKind?: string;
        model?: string;
        /** Options from `orchestrator_capabilities`, such as {effort:'max'}. Given values override inherited. [] or {} clears. */
        options?: {
          id: string;
          value: string | boolean;
        }[] | Record<string, string | boolean>;
        environmentId?: string;
        projectId?: string;
      };
      runtimeMode?: "inherit" | "approval-required" | "auto-accept-edits" | "auto" | "full-access";
      interactionMode?: "inherit" | "default" | "plan";
    }[];
    clientRequestId?: string;
  }): Promise<{
    threads: {
      threadId: string;
      link?: string | null;
      runId: string | null;
      status: "idle" | "preparing" | "queued" | "starting" | "running" | "waiting" | "completed" | "failed" | "cancelled" | "interrupted" | "rolled_back";
      title: string;
      createdBy: "user" | "agent" | "system";
      creationSource: "web" | "mobile" | "mcp" | "provider" | "server";
      providerInstanceId: string;
      model: string;
    }[];
  }>;
  /** List threads newest first, in one project or with `allProjects`. Page with `cursor`. */
  t3_thread_list(input?: {
    environmentId?: string;
    projectId?: string;
    allProjects?: boolean;
    statuses?: ("idle" | "preparing" | "queued" | "starting" | "running" | "waiting" | "completed" | "interrupted" | "failed" | "cancelled" | "rolled_back")[];
    titleContains?: string;
    settled?: boolean;
    snoozed?: boolean;
    includeSubagents?: boolean;
    cursor?: number;
    limit?: number;
  }): Promise<{
    projectId: string | null;
    currentThreadId: string | null;
    threads: {
      threadId: string;
      projectId: string;
      title: string;
      link?: string | null;
      createdBy: "user" | "agent" | "system";
      creationSource: "web" | "mobile" | "mcp" | "provider" | "server";
      status: "idle" | "preparing" | "queued" | "starting" | "running" | "waiting" | "completed" | "interrupted" | "failed" | "cancelled" | "rolled_back";
      latestRunId: string | null;
      providerInstanceId: string;
      model: string;
      runtimeMode: "approval-required" | "auto-accept-edits" | "auto" | "full-access";
      interactionMode: "default" | "plan";
      linkedPullRequest: {
        projectId: string;
        repository: string;
        number: number;
        url: string;
      } | null;
      pullRequests?: {
        host: string;
        repository: string;
        number: number;
        url: string;
        source: "manual" | "created" | "agent" | "stack" | "stack-dismissed";
        state: "open" | "closed" | "merged" | null;
        watching: boolean;
        watchStartedAt: string | null;
      }[] | null;
      pullRequestCount?: number | null;
      openPullRequestCount?: number | null;
      settled: boolean;
      settledAt: string | null;
      snoozed: boolean;
      snoozedUntil: string | null;
      blockedOnThreadWait?: boolean | null;
      pendingBackgroundTasks?: {
        taskId: string;
        kind: "subagent" | "command" | "monitor" | "background_task";
        description?: string | null;
        awaited?: true | null;
        childThreadId?: string | null;
      }[] | null;
      parentThreadId: string | null;
      relationshipToParent: "fork" | "subagent" | null;
      itemCount: number;
      createdAt: string;
      updatedAt: string;
    }[];
    nextCursor: number | null;
    total: number;
  }>;
  /** Read any thread by id. View `messages` (default) or `activity` (all items). Newest first; older: `beforePosition=earlierPosition`; from the start: `afterPosition=-1`, then `nextPosition`. Cut-off text: `itemId`, `textOffset=nextTextOffset`. Reading a child's final result marks it delivered. In your reply, name it as its `link` verbatim. */
  t3_thread_read(input: {
    environmentId?: string;
    threadId: string;
    itemId?: string;
    textOffset?: number;
    view?: "messages" | "activity";
    afterPosition?: number;
    beforePosition?: number;
    /** Max 100. */
    limit?: number;
    /** Max 50. */
    runLimit?: number;
    /** Max 20000. */
    maxCharsPerItem?: number;
  }): Promise<{
    thread: {
      threadId: string;
      projectId: string;
      title: string;
      link?: string | null;
      createdBy: "user" | "agent" | "system";
      creationSource: "web" | "mobile" | "mcp" | "provider" | "server";
      status: "idle" | "preparing" | "queued" | "starting" | "running" | "waiting" | "completed" | "interrupted" | "failed" | "cancelled" | "rolled_back";
      latestRunId: string | null;
      activeRunId: string | null;
      providerInstanceId: string;
      model: string;
      runtimeMode: "approval-required" | "auto-accept-edits" | "auto" | "full-access";
      interactionMode: "default" | "plan";
      linkedPullRequest: {
        projectId: string;
        repository: string;
        number: number;
        url: string;
      } | null;
      pullRequests?: {
        host: string;
        repository: string;
        number: number;
        url: string;
        source: "manual" | "created" | "agent" | "stack" | "stack-dismissed";
        state: "open" | "closed" | "merged" | null;
        watching: boolean;
        watchStartedAt: string | null;
      }[] | null;
      pullRequestCount?: number | null;
      openPullRequestCount?: number | null;
      titleRegeneration: {
        requestId: string;
        startedAt: string;
      } | null;
      lastTitleRegeneration?: {
        status: "renamed" | "unchanged" | "failed";
        message?: string | null;
        requestId: string;
        completedAt: string;
      } | null;
      branch: string | null;
      worktreePath: string | null;
      parentThreadId: string | null;
      relationshipToParent: "fork" | "subagent" | null;
      runCount: number;
      itemCount: number;
      pendingRequestCount: number;
      archived: boolean;
      settled: boolean;
      settledAt: string | null;
      snoozed: boolean;
      snoozedUntil: string | null;
      blockedOnThreadWait?: boolean | null;
      pendingBackgroundTasks?: {
        taskId: string;
        kind: "subagent" | "command" | "monitor" | "background_task";
        description?: string | null;
        awaited?: true | null;
        childThreadId?: string | null;
      }[] | null;
      createdAt: string;
      updatedAt: string;
    };
    recentRuns: {
      runId: string;
      ordinal: number;
      status: "preparing" | "queued" | "starting" | "running" | "waiting" | "completed" | "interrupted" | "failed" | "cancelled" | "rolled_back";
      providerInstanceId: string;
      model: string;
      executedModel?: string | null | null;
      requestedAt: string;
      startedAt: string | null;
      completedAt: string | null;
    }[];
    items: {
      position: number;
      visibility: "local" | "inherited" | "synthetic";
      sourceThreadId: string;
      itemId: string;
      subagentId?: string | null;
      runId: string | null;
      messageId: string | null;
      createdBy: "user" | "agent" | "system" | null;
      creationSource: "web" | "mobile" | "mcp" | "provider" | "server" | null;
      senderThreadId?: string | null;
      type: string;
      status: "idle" | "pending" | "running" | "waiting" | "completed" | "failed" | "cancelled" | "interrupted";
      title: string | null;
      text: string | null;
      textTruncated: boolean;
      nextTextOffset?: number | null;
      updatedAt: string;
    }[];
    nextPosition: number | null;
    hasMore: boolean;
    earlierPosition?: number | null;
  }>;
  /** Rename a thread (`action:'rename'` with `title`) or regenerate its title. Omit `threadId` for this thread. Workspace and branch cannot change here. */
  t3_thread_update(input: {
    threadId?: string;
    action: "rename" | "regenerate_title";
    title?: string;
    clientRequestId?: string;
    environmentId?: string;
  }): Promise<{
    threadId: string;
    action: "rename" | "regenerate_title";
    commandId: string;
    sequence: number;
    title: string;
    titleRegeneration: {
      requestId: string;
      startedAt: string;
    } | null;
    linkedPullRequest: {
      projectId: string;
      repository: string;
      number: number;
      url: string;
    } | null;
    updatedAt: string;
  }>;
  /** Send a message to any thread. The target cannot run with broader modes than yours. `mode:'auto'` starts an idle thread, steers a running turn, or queues. `queue`: new turn. `steer`: mid-turn update. `restart`: interrupt and restart. A send to a finished child thread starts a fresh task and returns its `taskId`. In your reply, name it as its `link` verbatim. */
  t3_thread_send(input: {
    environmentId?: string;
    threadId: string;
    message: string;
    mode?: "auto" | "queue" | "steer" | "restart";
    /** Start a new provider session without the thread's earlier context, like /clear. Never steers. */
    freshContext?: boolean;
    clientRequestId?: string;
  }): Promise<{
    threadId: string;
    link?: string | null;
    messageId: string;
    runId: string;
    taskId?: string | null;
    status: "preparing" | "queued" | "starting" | "running" | "waiting" | "completed" | "interrupted" | "failed" | "cancelled" | "rolled_back";
    delivery: "started" | "queued" | "steered" | "restarted";
  }>;
  /** Wait for a thread's run to finish. No `runId`: latest. Idle: at once. On timeout, with `next` end your turn; without, call again. */
  t3_thread_wait(input: {
    environmentId?: string;
    threadId: string;
    runId?: string;
    timeoutMs?: number;
    /** Also wait for its delegated and background tasks and their completions to settle. `resultRun` then names the run with its final answer. */
    untilDelegatedWorkSettled?: boolean;
  }): Promise<{
    threadId: string;
    runId: string | null;
    status: "idle" | "preparing" | "queued" | "starting" | "running" | "waiting" | "completed" | "interrupted" | "failed" | "cancelled" | "rolled_back";
    timedOut: boolean;
    next?: string | null;
    resultRun?: {
      runId: string;
      status: "preparing" | "queued" | "starting" | "running" | "waiting" | "completed" | "interrupted" | "failed" | "cancelled" | "rolled_back";
    } | null;
  }>;
  /** Interrupt a top-level thread's running turn. No `runId`: newest running turn. No effect when idle. For a delegate, use `task_cancel`. */
  t3_thread_interrupt(input: {
    environmentId?: string;
    threadId: string;
    runId?: string;
    reason?: string;
    stop?: boolean;
    clientRequestId?: string;
  }): Promise<{
    threadId: string;
    runId: string | null;
    status: "interrupt_requested" | "no_active_run" | "completed" | "failed" | "cancelled" | "interrupted" | "rolled_back";
  }>;
  /** List linked environments (the user's other machines) and whether each answers now. Pass one's `environmentId` to a tool to act there; `delegate_task` takes `target.environmentId`. Expired: link it again with `t3_environment_link`. */
  t3_environment_links(input?: {}): Promise<{
    environmentId: string;
    links: {
      environmentId: string;
      label: string;
      status: "reachable" | "unreachable" | "expired";
      access: "read-only" | "approval-required" | "auto-accept-edits" | "auto" | "full-access";
      expiresAt: string;
      lastError: string | null;
    }[];
    notListed: string;
  }>;
  /** Ask the user to link another machine, in a card. For a machine the user names that is not linked. Pass `hint` from their words, `environmentId` when one names it (already linked: returns `linked`), `url` only when the user gave an address. Returns `pending`; the outcome arrives as a message in this thread. Do not wait, poll, or call it again to check. Never ask for a pairing code in chat. */
  t3_environment_link(input?: {
    /** The machine, when known, e.g. from a mentioned machine. Otherwise the user picks it in the card. */
    environmentId?: string;
    /** Only an address the user gave: https, Tailscale, LAN or loopback. Never guess one. */
    url?: string;
    /** The user's words for the machine, e.g. "vps". Preselects it in the card. */
    hint?: string;
    /** One sentence for the card. */
    reason?: string;
    /** Suggested access. The user picks; default approval-required. */
    requestedAccess?: "read-only" | "approval-required" | "auto-accept-edits" | "auto" | "full-access";
    clientRequestId?: string;
  }): Promise<unknown>;
  /** Forget a linked environment. That machine's Connections list its session until revoked there. */
  t3_environment_unlink(input: {
    environmentId: string;
  }): Promise<{
    environmentId: string;
    removed: boolean;
  }>;
  /** Run one scheduled task now. Needs a full-access or default caller. Returns its thread, or null if not started. Success means started, not finished. */
  run_scheduled_task_now(input: {
    environmentId?: string;
    taskId: string;
  }): Promise<{
    taskId: string;
    threadId: string | null;
    link?: string | null;
    lastRunStatus: "never" | "running" | "succeeded" | "failed";
    runCount: number;
    nextRunAt: string | null;
  }>;
  /** Search active threads by title, branch, PR, project, then message text. Skips subagent threads. `projectId`: one project, else yours, else all outside a thread. Not exhaustive. */
  t3_thread_search(input: {
    environmentId?: string;
    query: string;
    limit?: number;
    projectId?: string;
  }): Promise<{
    currentThreadId?: string | null;
    matches: {
      threadId: string;
      projectId: string;
      title: string;
      link?: string | null;
      source: "title" | "user" | "assistant";
      snippet?: string | null;
      messageCreatedAt?: string | null;
    }[];
  }>;
  /** Read a thread's provider, model, and modes, or set its provider, model, and options with `modelSelection`. Omit `threadId` for this thread. Permission modes stay. Values from `orchestrator_capabilities`. */
  t3_thread_configure(input?: {
    environmentId?: string;
    threadId?: string;
    modelSelection?: {
      provider?: unknown;
      instanceId?: unknown;
      model: unknown;
      options?: unknown;
    };
  }): Promise<unknown>;
  /** Move context between threads. Omit `threadId` for this thread. fork: copy it from `sourcePoint` (default latest stable run) into a new thread with the same setup; no turn runs yet. merge_back: merge it from `sourcePoint` into a related `targetThreadId` in the same project. status: its context transfers. */
  t3_thread_transfer(input: {
    action: "fork" | "merge_back" | "status";
    environmentId?: string;
    threadId?: string;
    sourcePoint?: {
      type: "latest_stable" | "run" | "checkpoint";
      runId?: string;
      checkpointId?: string;
    };
    targetThreadId?: string;
    title?: string;
  }): Promise<unknown>;
  /** Pin, snooze, settle, archive, or mark a thread unread. Omit `threadId` for this thread. `snooze` needs `snoozedUntil`. Settling this thread applies at turn end. A failed turn or queued message leaves it active. */
  t3_thread_organize(input: {
    environmentId?: string;
    threadId?: string;
    action: "pin" | "unpin" | "snooze" | "unsnooze" | "settle" | "unsettle" | "archive" | "unarchive" | "mark_unread";
    snoozedUntil?: string;
  }): Promise<unknown>;
  /** Pending user questions in a thread. Omit `threadId` for this thread. list: their ids; approvals are not listed. read: one by `requestId`. respond: answer one with `answers`; this cannot approve a permission request. */
  t3_pending_request(input: {
    action: "list" | "read" | "respond";
    environmentId?: string;
    threadId?: string;
    requestId?: string;
    answers?: Record<string, unknown>;
  }): Promise<unknown>;
  /** Manage a thread's queued messages. Omit `threadId` for this thread. list: send order, paged by `cursor` and `limit`. read: up to 16,000 chars of one. edit: replace its `text`; attachments stay. cancel. reorder: before `beforeRunId`, or to the end with null. promote_to_steer: send it now as steering to active `targetRunId`. Writes fail once the run is no longer queued. */
  t3_queue(input: {
    action: "list" | "read" | "edit" | "cancel" | "reorder" | "promote_to_steer";
    environmentId?: string;
    threadId?: string;
    queuedRunId?: string;
    text?: string;
    beforeRunId?: string;
    targetRunId?: string;
    cursor?: number;
    limit?: number;
  }): Promise<unknown>;
  /** Get an upload URL. POST the file's exact bytes to `uploadUrl` (else this server's `relativeUrl`), then send via `t3_thread_send_attachments` with the returned `attachmentId`. */
  t3_attachment_prepare_upload(input: {
    upload: {
      type: "image" | "file";
      name: string;
      mimeType: "image/gif" | "image/jpeg" | "image/png" | "image/webp" | string;
      sizeBytes: number;
    };
  }): Promise<{
    attachmentId: string;
    relativeUrl: string;
    expiresAt: number | "Infinity" | "-Infinity" | "NaN";
    uploadUrl?: string;
  }>;
  /** Discard a pending upload (not a sent attachment). */
  t3_attachment_discard(input: {
    attachmentId: string;
  }): Promise<unknown>;
  /** Send uploaded attachments as a new message to a thread. No retry key. Target modes cannot exceed yours. Success does not mean the provider read them or finished. */
  t3_thread_send_attachments(input: {
    threadId?: string;
    message?: string;
    attachments: {
      type: "image" | "file";
      id: string;
      name: string;
      mimeType: string;
      sizeBytes: number;
      source?: {
        _tag: "pasted-text";
      };
    }[];
  }): Promise<{
    threadId: string;
    messageId: string;
    runId: string;
    status: "preparing" | "queued" | "starting" | "running" | "waiting" | "completed" | "interrupted" | "failed" | "cancelled" | "rolled_back";
  }>;
  /** Create one new top-level thread, bound to its workspace before the agent starts. Task in `message`. Omit `projectId`, model and modes to inherit yours (outside a thread, pass `projectId` or `scratch`); modes cannot exceed yours. After an error or lost reply, retry with the same `clientRequestId`. Follow it with `t3_thread_read` or `t3_thread_wait`. Mention it with its `link`. */
  t3_thread_launch(input: {
    environmentId?: string;
    projectId?: string;
    /** No project: a new Scratch folder. Not with `projectId` or `workspaceStrategy`. */
    scratch?: boolean;
    title: string;
    modelSelection?: {
      provider?: unknown;
      instanceId?: unknown;
      model: unknown;
      options?: unknown;
    };
    runtimeMode?: "approval-required" | "auto-accept-edits" | "auto" | "full-access";
    interactionMode?: "default" | "plan";
    /** 'worktree': new checkout from `baseRef`. Honor a requested base. Otherwise, independent work uses the default branch as `remote/branch` (e.g. `origin/main`) with `startFromOrigin: true`; with no remote, use the local default branch. Required unpublished commits and dependent or stacked work use their local base with `startFromOrigin: false`. 'existing_worktree': bind `worktreePath`, a project worktree. 'root': project checkout, the default, not your worktree. Uncommitted edits are not copied. */
    workspaceStrategy?: {
      type: "root" | "existing_worktree" | "worktree";
      branch?: string;
      worktreePath?: string;
      baseRef?: string;
      startFromOrigin?: boolean;
    };
    /** First prompt. Omit it and `attachments` for idle. */
    message?: string;
    attachments?: {
      type: "image" | "file";
      id: string;
      name: string;
      mimeType: string;
      sizeBytes: number;
      source?: {
        _tag: "pasted-text";
      };
    }[];
    clientRequestId?: string;
    delegatedFrom?: {
      environmentId: string;
      threadId: string;
      title: string;
    };
  }): Promise<{
    threadId: string;
    link?: string | null;
    projectId: string;
    modelSelection: {
      provider?: unknown;
      instanceId?: unknown;
      model: unknown;
      options?: unknown;
    };
    runId: string | null;
    status: "preparing" | "queued" | "starting" | "running" | "waiting" | "completed" | "interrupted" | "failed" | "cancelled" | "rolled_back" | null;
  }>;
  /** List projects. Pages can shift. */
  t3_project_list(input?: {
    environmentId?: string;
    cursor?: number;
    limit?: number;
  }): Promise<{
    projects: {
      id: string;
      title: string;
      workspaceRoot: string;
      repositoryIdentity?: {
        canonicalKey: string;
        locator: {
          source: "git-remote";
          remoteName: string;
          remoteUrl: string;
        };
        webUrl?: string;
        rootPath?: string;
        displayName?: string;
        provider?: string;
        owner?: string;
        name?: string;
        origin?: {
          canonicalKey: string;
          remoteUrl?: string;
          displayName?: string;
        };
      } | null;
      faviconPath?: string | null;
      projectIcon?: {
        kind: "lucide";
        name: string;
        color: "gray" | "red" | "orange" | "amber" | "yellow" | "lime" | "green" | "emerald" | "teal" | "cyan" | "sky" | "blue" | "indigo" | "violet" | "purple" | "fuchsia" | "pink" | "rose";
        monogramText?: string | null;
        monogram?: string | null;
      } | {
        kind: "emoji";
        emoji: string;
      } | {
        kind: "monogram";
        text: string;
        color: "gray" | "red" | "orange" | "amber" | "yellow" | "lime" | "green" | "emerald" | "teal" | "cyan" | "sky" | "blue" | "indigo" | "violet" | "purple" | "fuchsia" | "pink" | "rose";
      } | {
        kind: string;
      } | null;
      defaultModelSelection: {
        provider?: unknown;
        instanceId?: unknown;
        model: unknown;
        options?: unknown;
      } | null;
      defaultThreadEnvMode?: "local" | "worktree" | null;
      autoPull?: boolean | null;
      scripts: {
        id: string;
        name: string;
        command: string;
        icon: "play" | "test" | "lint" | "configure" | "build" | "debug";
        runOnWorktreeCreate: boolean;
        runOnSettle?: boolean | null;
        stopOnSettle?: boolean | null;
        async?: boolean | null;
        previewUrl?: string | null;
        autoOpenPreview?: boolean | null;
      }[];
      pinnedAt?: string | null;
      archivedAt?: string | null;
      createdAt: string;
      updatedAt: string;
      deletedAt: string | null;
    }[];
    nextCursor: number | null;
  }>;
  /** Read one project: workspace and saved scripts. */
  t3_project_read(input: {
    environmentId?: string;
    projectId: string;
  }): Promise<{
    id: string;
    title: string;
    workspaceRoot: string;
    repositoryIdentity?: {
      canonicalKey: string;
      locator: {
        source: "git-remote";
        remoteName: string;
        remoteUrl: string;
      };
      webUrl?: string;
      rootPath?: string;
      displayName?: string;
      provider?: string;
      owner?: string;
      name?: string;
      origin?: {
        canonicalKey: string;
        remoteUrl?: string;
        displayName?: string;
      };
    } | null;
    faviconPath?: string | null;
    projectIcon?: {
      kind: "lucide";
      name: string;
      color: "gray" | "red" | "orange" | "amber" | "yellow" | "lime" | "green" | "emerald" | "teal" | "cyan" | "sky" | "blue" | "indigo" | "violet" | "purple" | "fuchsia" | "pink" | "rose";
      monogramText?: string | null;
      monogram?: string | null;
    } | {
      kind: "emoji";
      emoji: string;
    } | {
      kind: "monogram";
      text: string;
      color: "gray" | "red" | "orange" | "amber" | "yellow" | "lime" | "green" | "emerald" | "teal" | "cyan" | "sky" | "blue" | "indigo" | "violet" | "purple" | "fuchsia" | "pink" | "rose";
    } | {
      kind: string;
    } | null;
    defaultModelSelection: {
      provider?: unknown;
      instanceId?: unknown;
      model: unknown;
      options?: unknown;
    } | null;
    defaultThreadEnvMode?: "local" | "worktree" | null;
    autoPull?: boolean | null;
    scripts: {
      id: string;
      name: string;
      command: string;
      icon: "play" | "test" | "lint" | "configure" | "build" | "debug";
      runOnWorktreeCreate: boolean;
      runOnSettle?: boolean | null;
      stopOnSettle?: boolean | null;
      async?: boolean | null;
      previewUrl?: string | null;
      autoOpenPreview?: boolean | null;
    }[];
    pinnedAt?: string | null;
    archivedAt?: string | null;
    createdAt: string;
    updatedAt: string;
    deletedAt: string | null;
  }>;
  /** Register a project folder. `createWorkspaceRootIfMissing` creates it; a registered folder is rejected. No `workspaceRoot`: makes a git repo from `title` with README, icon, first commit (`commitError` on failure; project still exists). Clone first with `t3_project_clone` if needed. */
  t3_project_create(input: {
    environmentId?: string;
    title: string;
    workspaceRoot?: string;
    createWorkspaceRootIfMissing?: boolean;
    defaultModelSelection?: {
      provider?: unknown;
      instanceId?: unknown;
      model: unknown;
      options?: unknown;
    };
    scripts?: {
      id: string;
      name: string;
      command: string;
      icon: "play" | "test" | "lint" | "configure" | "build" | "debug";
      runOnWorktreeCreate: boolean;
      runOnSettle?: boolean;
      stopOnSettle?: boolean;
      async?: boolean;
      previewUrl?: string;
      autoOpenPreview?: boolean;
    }[];
  }): Promise<{
    id: string;
    title: string;
    workspaceRoot: string;
    repositoryIdentity?: {
      canonicalKey: string;
      locator: {
        source: "git-remote";
        remoteName: string;
        remoteUrl: string;
      };
      webUrl?: string;
      rootPath?: string;
      displayName?: string;
      provider?: string;
      owner?: string;
      name?: string;
      origin?: {
        canonicalKey: string;
        remoteUrl?: string;
        displayName?: string;
      };
    } | null;
    faviconPath?: string | null;
    projectIcon?: {
      kind: "lucide";
      name: string;
      color: "gray" | "red" | "orange" | "amber" | "yellow" | "lime" | "green" | "emerald" | "teal" | "cyan" | "sky" | "blue" | "indigo" | "violet" | "purple" | "fuchsia" | "pink" | "rose";
      monogramText?: string | null;
      monogram?: string | null;
    } | {
      kind: "emoji";
      emoji: string;
    } | {
      kind: "monogram";
      text: string;
      color: "gray" | "red" | "orange" | "amber" | "yellow" | "lime" | "green" | "emerald" | "teal" | "cyan" | "sky" | "blue" | "indigo" | "violet" | "purple" | "fuchsia" | "pink" | "rose";
    } | {
      kind: string;
    } | null;
    defaultModelSelection: {
      provider?: unknown;
      instanceId?: unknown;
      model: unknown;
      options?: unknown;
    } | null;
    defaultThreadEnvMode?: "local" | "worktree" | null;
    autoPull?: boolean | null;
    scripts: {
      id: string;
      name: string;
      command: string;
      icon: "play" | "test" | "lint" | "configure" | "build" | "debug";
      runOnWorktreeCreate: boolean;
      runOnSettle?: boolean | null;
      stopOnSettle?: boolean | null;
      async?: boolean | null;
      previewUrl?: string | null;
      autoOpenPreview?: boolean | null;
    }[];
    pinnedAt?: string | null;
    archivedAt?: string | null;
    createdAt: string;
    updatedAt: string;
    deletedAt: string | null;
    commitError?: string | null;
  }>;
  /** Update one project's settings. Omitted fields are unchanged. */
  t3_project_update(input: {
    environmentId?: string;
    projectId: string;
    title?: string;
    workspaceRoot?: string;
    defaultModelSelection?: {
      provider?: unknown;
      instanceId?: unknown;
      model: unknown;
      options?: unknown;
    };
    autoPull?: boolean;
    projectIcon?: {
      kind: "lucide" | "emoji" | "monogram";
      name?: string;
      color?: "gray" | "red" | "orange" | "amber" | "yellow" | "lime" | "green" | "emerald" | "teal" | "cyan" | "sky" | "blue" | "indigo" | "violet" | "purple" | "fuchsia" | "pink" | "rose";
      emoji?: string;
      text?: string;
    };
    faviconPath?: string;
    defaultThreadEnvMode?: "local" | "worktree";
    scripts?: {
      id: string;
      name: string;
      command: string;
      icon: "play" | "test" | "lint" | "configure" | "build" | "debug";
      runOnWorktreeCreate: boolean;
      runOnSettle?: boolean;
      stopOnSettle?: boolean;
      async?: boolean;
      previewUrl?: string;
      autoOpenPreview?: boolean;
    }[];
    pinned?: boolean;
    /** Threads and files are kept. */
    archived?: boolean;
  }): Promise<{
    id: string;
    title: string;
    workspaceRoot: string;
    repositoryIdentity?: {
      canonicalKey: string;
      locator: {
        source: "git-remote";
        remoteName: string;
        remoteUrl: string;
      };
      webUrl?: string;
      rootPath?: string;
      displayName?: string;
      provider?: string;
      owner?: string;
      name?: string;
      origin?: {
        canonicalKey: string;
        remoteUrl?: string;
        displayName?: string;
      };
    } | null;
    faviconPath?: string | null;
    projectIcon?: {
      kind: "lucide";
      name: string;
      color: "gray" | "red" | "orange" | "amber" | "yellow" | "lime" | "green" | "emerald" | "teal" | "cyan" | "sky" | "blue" | "indigo" | "violet" | "purple" | "fuchsia" | "pink" | "rose";
      monogramText?: string | null;
      monogram?: string | null;
    } | {
      kind: "emoji";
      emoji: string;
    } | {
      kind: "monogram";
      text: string;
      color: "gray" | "red" | "orange" | "amber" | "yellow" | "lime" | "green" | "emerald" | "teal" | "cyan" | "sky" | "blue" | "indigo" | "violet" | "purple" | "fuchsia" | "pink" | "rose";
    } | {
      kind: string;
    } | null;
    defaultModelSelection: {
      provider?: unknown;
      instanceId?: unknown;
      model: unknown;
      options?: unknown;
    } | null;
    defaultThreadEnvMode?: "local" | "worktree" | null;
    autoPull?: boolean | null;
    scripts: {
      id: string;
      name: string;
      command: string;
      icon: "play" | "test" | "lint" | "configure" | "build" | "debug";
      runOnWorktreeCreate: boolean;
      runOnSettle?: boolean | null;
      stopOnSettle?: boolean | null;
      async?: boolean | null;
      previewUrl?: string | null;
      autoOpenPreview?: boolean | null;
    }[];
    pinnedAt?: string | null;
    archivedAt?: string | null;
    createdAt: string;
    updatedAt: string;
    deletedAt: string | null;
  }>;
  /** Delete one project. Nonempty needs `force: true`. Folder on disk stays. */
  t3_project_delete(input: {
    environmentId?: string;
    projectId: string;
    force?: boolean;
  }): Promise<{
    id: string;
    title: string;
    workspaceRoot: string;
    repositoryIdentity?: {
      canonicalKey: string;
      locator: {
        source: "git-remote";
        remoteName: string;
        remoteUrl: string;
      };
      webUrl?: string;
      rootPath?: string;
      displayName?: string;
      provider?: string;
      owner?: string;
      name?: string;
      origin?: {
        canonicalKey: string;
        remoteUrl?: string;
        displayName?: string;
      };
    } | null;
    faviconPath?: string | null;
    projectIcon?: {
      kind: "lucide";
      name: string;
      color: "gray" | "red" | "orange" | "amber" | "yellow" | "lime" | "green" | "emerald" | "teal" | "cyan" | "sky" | "blue" | "indigo" | "violet" | "purple" | "fuchsia" | "pink" | "rose";
      monogramText?: string | null;
      monogram?: string | null;
    } | {
      kind: "emoji";
      emoji: string;
    } | {
      kind: "monogram";
      text: string;
      color: "gray" | "red" | "orange" | "amber" | "yellow" | "lime" | "green" | "emerald" | "teal" | "cyan" | "sky" | "blue" | "indigo" | "violet" | "purple" | "fuchsia" | "pink" | "rose";
    } | {
      kind: string;
    } | null;
    defaultModelSelection: {
      provider?: unknown;
      instanceId?: unknown;
      model: unknown;
      options?: unknown;
    } | null;
    defaultThreadEnvMode?: "local" | "worktree" | null;
    autoPull?: boolean | null;
    scripts: {
      id: string;
      name: string;
      command: string;
      icon: "play" | "test" | "lint" | "configure" | "build" | "debug";
      runOnWorktreeCreate: boolean;
      runOnSettle?: boolean | null;
      stopOnSettle?: boolean | null;
      async?: boolean | null;
      previewUrl?: string | null;
      autoOpenPreview?: boolean | null;
    }[];
    pinnedAt?: string | null;
    archivedAt?: string | null;
    createdAt: string;
    updatedAt: string;
    deletedAt: string | null;
  }>;
  /** Clone a repository (`destinationPath` new or empty). Register after with `t3_project_create`, with the same `environmentId`. */
  t3_project_clone(input: {
    environmentId?: string;
    provider?: string;
    repository?: string;
    remoteUrl?: string;
    destinationPath: string;
    protocol?: "auto" | "ssh" | "https";
  }): Promise<{
    cwd: string;
    remoteUrl: string;
    repository: {
      provider: string;
      nameWithOwner: string;
      url: string;
      sshUrl: string;
    } | null;
  }>;
  /** Read this server's identity and preferences. Providers and models: `orchestrator_capabilities`. */
  t3_environment_read(input?: {
    environmentId?: string;
  }): Promise<{
    environmentId: string;
    label: string;
    serverVersion: string;
    platform: {
      os: "darwin" | "linux" | "windows" | "unknown";
      arch: "arm64" | "x64" | "other";
      machine?: unknown;
    };
    preferences: {
      defaultThreadEnvMode?: unknown;
      newWorktreesStartFromOrigin?: boolean | null;
      enableProviderUpdateChecks?: boolean | null;
      backgroundActivity: {
        profile: "balanced" | "performance" | "battery-saver" | "custom";
      };
      sourceControlWritingStyle: {
        mode: string;
        followChangeRequestTemplates: boolean;
        customInstructions: string;
        truncated: boolean;
      };
    };
  }>;
  /** Update environment-wide preferences. Live full-access or default caller thread only. Omitted fields are unchanged; `customInstructions: ''` clears it. */
  t3_environment_preferences_update(input?: {
    environmentId?: string;
    defaultThreadEnvMode?: "local" | "worktree";
    newWorktreesStartFromOrigin?: boolean;
    enableProviderUpdateChecks?: boolean;
    backgroundActivity?: {
      profile: "balanced" | "performance" | "battery-saver";
    };
    sourceControlWritingStyle?: {
      mode?: "repo_conventions" | "conventional_commits" | "custom";
      customInstructions?: string;
      followChangeRequestTemplates?: boolean;
    };
  }): Promise<{
    defaultThreadEnvMode?: unknown;
    newWorktreesStartFromOrigin?: boolean | null;
    enableProviderUpdateChecks?: boolean | null;
    backgroundActivity: {
      profile: "balanced" | "performance" | "battery-saver" | "custom";
    };
    sourceControlWritingStyle: {
      mode: string;
      followChangeRequestTemplates: boolean;
      customInstructions: string;
      truncated: boolean;
    };
  }>;
  /** Read T3 Code's own themes and the guide to restyle it: color roles and CSS selectors. Call before `t3_theme_set`. */
  t3_theme_read(input?: {
    /** Also return this published theme's file. */
    themeId?: string;
  }): Promise<{
    current: string;
    builtIn: string[];
    published: {
      id: string;
      name: string;
      hasCss: boolean;
    }[];
    theme?: {
      version?: 1 | null;
      name: string;
      appearance: "light" | "dark";
      canvas?: string | null;
      accent?: string | null;
      colors?: Record<string, unknown> | null;
      variants?: {
        light?: Record<string, unknown> | null;
        dark?: Record<string, unknown> | null;
      } | null;
      css?: string | null;
    };
    guide: string;
  }>;
  /** Restyle T3 Code itself, only when the user asks. With `theme`, publish it as `themeId` (the same id updates it) and switch this machine's web and desktop clients to it. Without `theme`, switch to a built-in or published `themeId`. `appearance` switches them to light, dark, or system mode, with or without a theme. Live full-access or default caller thread only. */
  t3_theme_set(input?: {
    themeId?: string;
    theme?: {
      version?: 1;
      name: string;
      appearance: "light" | "dark";
      canvas?: string;
      accent?: string;
      colors?: Record<string, unknown>;
      variants?: {
        light?: Record<string, unknown>;
        dark?: Record<string, unknown>;
      };
      css?: string;
    };
    appearance?: "light" | "dark" | "system";
  }): Promise<{
    themeId?: string;
    appearance?: "light" | "dark" | "system";
    published: boolean;
  }>;
  /** List this thread's preview tabs. Only `runtime:'server'` entries can be automated here. Others are in the user's local desktop app. Never pass a non-server `tabId` to a `preview_*` tool. Tell the user that tab is on their local desktop and this environment cannot reach it. */
  t3_preview_list(input?: {
    cursor?: number;
    limit?: number;
  }): Promise<{
    sessions: {
      threadId: string;
      tabId: string;
      navStatus: {
        _tag: "Idle";
      } | {
        _tag: "Loading";
        url: string;
        title: string;
      } | {
        _tag: "Success";
        url: string;
        title: string;
      } | {
        _tag: "LoadFailed";
        url: string;
        title: string;
        code: number;
        description: string;
        download?: {
          id: string;
          fileName: string;
        } | null;
      };
      canGoBack: boolean;
      canGoForward: boolean;
      viewport?: {
        _tag: "fill";
      } | {
        _tag: "freeform";
        width: number;
        height: number;
      } | {
        _tag: "preset";
        width: number;
        height: number;
        presetId: "iphone-se" | "iphone-xr" | "iphone-12-pro" | "iphone-14-pro-max" | "pixel-7" | "samsung-galaxy-s8-plus" | "samsung-galaxy-s20-ultra" | "ipad-mini" | "ipad-air" | "ipad-pro" | "surface-pro-7" | "surface-duo" | "galaxy-z-fold-5" | "asus-zenbook-fold" | "samsung-galaxy-a51-71" | "nest-hub" | "nest-hub-max" | "desktop-1920x1080" | "desktop-1440x900" | "laptop-1366x768" | "laptop-1280x800" | "ipad-pro-11" | "iphone-15-pro" | "pixel-8" | "galaxy-s24";
      } | null;
      colorScheme?: "system" | "light" | "dark" | null;
      zoomFactor?: 0.25 | 0.33 | 0.5 | 0.67 | 0.75 | 0.8 | 0.9 | 1 | 1.1 | 1.25 | 1.5 | 1.75 | 2 | 2.5 | 3 | 4 | 5 | null;
      profileId?: string | null;
      runtime?: "desktop" | "server" | null;
      headless?: boolean | null;
      automationOwner?: string | null;
      reveal?: boolean | null;
      revealRequest?: {
        id: string;
        force: boolean;
      } | null;
      updatedAt: string;
    }[];
    serverEpoch: string;
    revision: number;
    nextCursor: number | null;
  }>;
  /** Close one preview tab this thread owns. Use it on a tab you opened for your own check when you finish. */
  t3_preview_close(input: {
    tabId: string;
  }): Promise<unknown>;
  /** Move THIS thread into a new git worktree on a new branch. Runs the setup script by default. A separate agent in a worktree: `t3_thread_launch` with `workspaceStrategy`. Call last in your turn. The move ends the live session. `continuationPrompt` resumes work there next turn. Without it, the thread waits. The worktree stays after the thread is deleted. Fails if this thread has a worktree. */
  t3_worktree_handoff(input: {
    branch: string;
    baseRef?: string;
    /** True: fetch, start from the remote ref; check `startedFromOrigin`. Default: server setting. */
    startFromOrigin?: boolean;
    /** Default true. */
    runSetupScript?: boolean;
    continuationPrompt?: string;
  }): Promise<{
    worktreePath: string;
    branch: string;
    baseRef: string;
    startedFromOrigin: boolean;
    setupScript: {
      status: "started";
      scriptName: string;
      terminalId: string;
    } | {
      status: "no-script";
    } | {
      status: "skipped";
    } | {
      status: "failed";
      detail: string;
    };
    continuation: {
      status: "scheduled";
      delivery: "started" | "queued" | "steered" | "restarted";
    } | {
      status: "skipped";
    } | {
      status: "failed";
      detail: string;
    };
    note: string;
  }>;
  /** Report this thread's worktree: attached or not, path, branch, project root, and the `startFromOrigin` default. Check before `t3_worktree_handoff`. */
  t3_worktree_status(input?: {}): Promise<{
    attached: boolean;
    worktreePath: string | null;
    branch: string | null;
    projectWorkspaceRoot: string;
    /** `startFromOrigin` default for `t3_worktree_handoff`. */
    defaultStartFromOrigin: boolean;
  }>;
  /** List branch refs and checkout paths for a thread's workspace. Omit `threadId` for this thread. Detached worktrees with no branch are left out. */
  t3_worktree_list(input?: {
    environmentId?: string;
    threadId?: string;
    query?: string;
    cursor?: number;
    limit?: number;
    refKind?: "all" | "local" | "remote";
    includeMatchingRemoteRefs?: boolean;
  }): Promise<{
    isAtRepositoryRoot?: boolean | null;
    refs: {
      name: string;
      isRemote?: boolean | null;
      remoteName?: string | null;
      upstreamRef?: string | null;
      current: boolean;
      isDefault: boolean;
      worktreePath: string | null;
    }[];
    isRepo: boolean;
    hasPrimaryRemote: boolean;
    nextCursor: number | null;
    totalCount: number;
  }>;
  /** Link a PR to this thread. T3 shows its status and settles the thread on merge. For several PRs, use `link_pull_requests`. */
  link_pull_request(input?: {
    environmentId?: string;
    threadId?: string;
    url?: string;
    repository?: string;
    /** With `repository`, when no `url`. */
    number?: number;
    host?: string;
  }): Promise<{
    host: string;
    repository: string;
    number: number;
    url: string;
    alreadyLinked: boolean;
    next?: string | null;
  }>;
  /** Link several PRs to a thread. Use it instead of one `link_pull_request` per PR. URLs that are not PRs come back in `invalidUrls`. */
  link_pull_requests(input: {
    environmentId?: string;
    threadId?: string;
    urls: string[];
  }): Promise<{
    linked: {
      host: string;
      repository: string;
      numbers: number[];
    }[];
    alreadyLinked: {
      host: string;
      repository: string;
      numbers: number[];
    }[];
    linkedCount: number;
    invalidUrls?: string[] | null;
    next?: string | null;
  }>;
  /** Remove a PR link from this thread. Succeeds with `wasLinked=false` when it was not linked. */
  unlink_pull_request(input?: {
    environmentId?: string;
    threadId?: string;
    url?: string;
    repository?: string;
    /** With `repository`, when no `url`. */
    number?: number;
    host?: string;
  }): Promise<{
    host: string;
    repository: string;
    number: number;
    wasLinked: boolean;
  }>;
  /** Unlink a thread's PRs whose last known state is in `states`. Use it instead of one `unlink_pull_request` per PR. PRs with no known state stay linked. */
  unlink_pull_requests(input: {
    environmentId?: string;
    threadId?: string;
    states: ("open" | "closed" | "merged")[];
  }): Promise<{
    unlinked: {
      host: string;
      repository: string;
      state: "open" | "closed" | "merged";
      numbers: number[];
    }[];
    unlinkedCount: number;
    remaining: number;
  }>;
  /** List a thread's PRs, with last known state and stack order (bottom to top). Not an end-of-work check. */
  list_thread_pull_requests(input?: {
    environmentId?: string;
    threadId?: string;
    states?: ("open" | "closed" | "merged")[];
    cursor?: string;
  }): Promise<{
    pullRequests: {
      host: string;
      repository: string;
      number: number;
      url: string;
      source: "manual" | "created" | "agent" | "stack" | "stack-dismissed";
      watching: boolean;
      state: "open" | "closed" | "merged" | null;
      title: string | null;
      headBranch: string | null;
      baseBranch: string | null;
      isDraft: boolean | null;
      stack: {
        kind: "native" | "derived";
        position: number;
        size: number;
      } | null;
    }[];
    chains: {
      kind: "native" | "derived";
      numbers: number[];
    }[];
    nextCursor: string | null;
  }>;
  /** Watch an open PR for this thread, linking it first if needed. T3 wakes you on failed checks, passed required checks, new comments or reviews, or conflicts. Handle old comments first. Only later ones wake you. After this call, end your turn. The watch stays on after each wake, so do not call this again on a wake. A wake is not a merge decision. Check readiness yourself. */
  watch_pull_request(input?: {
    environmentId?: string;
    threadId?: string;
    url?: string;
    repository?: string;
    /** With `repository`, when no `url`. */
    number?: number;
    host?: string;
  }): Promise<{
    host: string;
    repository: string;
    number: number;
    url: string;
    watching: boolean;
    wasWatching: boolean;
  }>;
  /** Stop watching a PR for this thread. It stays linked. */
  unwatch_pull_request(input?: {
    environmentId?: string;
    threadId?: string;
    url?: string;
    repository?: string;
    /** With `repository`, when no `url`. */
    number?: number;
    host?: string;
  }): Promise<{
    host: string;
    repository: string;
    number: number;
    url: string;
    watching: boolean;
    wasWatching: boolean;
  }>;
  /** Write review guides for up to 20 PRs (the tour in the PR Guide tab). Returns once runs start. Each run takes minutes in a temporary checkout. A run for the same head is joined. Read with `read_pull_request_guide`. Fails while guides are off. */
  write_pull_request_guides(input: {
    environmentId?: string;
    pullRequests: {
      url?: string;
      repository?: string;
      /** With `repository`, when no `url`. */
      number?: number;
      host?: string;
    }[];
  }): Promise<{
    guides: {
      host: string;
      repository: string;
      number: number;
      url: string;
      /** started: a run began. running: joined a run for this head. failed: see detail. */
      outcome: "started" | "running" | "failed";
      detail: string | null;
    }[];
  }>;
  /** Read a PR's stored review guide and run state. `guide` is null when none exists. Never starts a run. */
  read_pull_request_guide(input?: {
    environmentId?: string;
    url?: string;
    repository?: string;
    /** With `repository`, when no `url`. */
    number?: number;
    host?: string;
  }): Promise<{
    host: string;
    repository: string;
    number: number;
    url: string;
    guide: {
      headSha: string;
      generatedAt: string;
      modelSelection: {
        provider?: unknown;
        instanceId?: unknown;
        model: unknown;
        options?: unknown;
      };
      stops: {
        title: string;
        summary: string;
        attention: {
          kind: "tradeoff" | "contract" | "product" | "risk" | "accessibility";
          note: string;
        } | null;
        excerpts: {
          path: string;
          side: "new" | "old";
          start: number;
          end: number;
          caption: string;
        }[];
        files: {
          path: string;
          note?: string;
        }[];
        notes: {
          path: string;
          line: number;
          title: string;
          body: string;
        }[];
        questions: string[];
      }[];
    } | null;
    run: {
      _tag: "Running";
      headSha: string;
      startedAt: string;
    } | {
      _tag: "Failed";
      headSha: string;
      failedAt: string;
      detail: string;
    } | null;
    currentHeadSha: string | null;
    /** True when the PR head moved after the guide was written. */
    stale: boolean;
  }>;
  /** List iOS Simulators and Android Emulators on every device host, what each host can run, and what is open in this thread's Device panel. Call before `device_open` when you do not know a device id. */
  device_list(input?: {
    /** Limit to one device host. Defaults to all hosts. */
    hostId?: string;
  }): Promise<{
    hostStatuses: Record<string, {
      status: "disabled" | "idle" | "installing" | "starting" | "ready" | "failed";
      detail?: string | null;
      androidDiscoveryIncomplete?: boolean | null;
      incompletePlatforms?: ("ios" | "android")[] | null;
    }>;
    hosts: ({
      id: string;
      label: string;
      platforms: {
        platform: "ios" | "android";
        available: boolean;
        reason?: string | null;
      }[];
      tools?: {
        hub: {
          requiredVersion: string;
          installedVersions: string[];
          runningVersion: string | null;
        };
        agent: {
          requiredVersion: string;
          installedVersions: string[];
          runningVersion: string | null;
        };
      } | null;
      toolInspectionError?: string | null;
      hubInstalled: boolean;
      agentDeviceInstalled: boolean;
      kind: "local" | "ssh";
    } | {
      id: string;
      label: string;
      platforms: {
        platform: "ios" | "android";
        available: boolean;
        reason?: string | null;
      }[];
      tools?: {
        hub: {
          requiredVersion: string;
          installedVersions: string[];
          runningVersion: string | null;
        };
        agent: {
          requiredVersion: string;
          installedVersions: string[];
          runningVersion: string | null;
        };
      } | null;
      toolInspectionError?: string | null;
      hubInstalled: boolean;
      agentDeviceInstalled: boolean;
      kind: "eas";
    } | {
      id: string;
      label: string;
      platforms: {
        platform: "ios" | "android";
        available: boolean;
        reason?: string | null;
      }[];
      tools?: {
        hub: {
          requiredVersion: string;
          installedVersions: string[];
          runningVersion: string | null;
        };
        agent: {
          requiredVersion: string;
          installedVersions: string[];
          runningVersion: string | null;
        };
      } | null;
      toolInspectionError?: string | null;
      hubInstalled: boolean;
      agentDeviceInstalled: boolean;
      kind: "simlock";
    })[];
    devices: {
      hostId: string;
      id: string;
      platform: "ios" | "android";
      name: string;
      version: string;
      booted: boolean;
      physical: boolean;
    }[];
    open: {
      hostId: string;
      deviceId: string;
    }[];
  }>;
  /** Open a simulator or emulator for this thread. Pass `deviceId` and `hostId` from `device_list`. Boots it if needed and shows it in the user's Device panel. Returns the `agent-device` CLI call pinned to that device. Drive the device with that CLI. */
  device_open(input?: {
    deviceId?: string;
    /** Needed with no `deviceId` when both platforms exist. */
    platform?: "ios" | "android";
    hostId?: string;
  }): Promise<{
    device: {
      hostId: string;
      id: string;
      platform: "ios" | "android";
      name: string;
      version: string;
      booted: boolean;
      physical: boolean;
    };
    agentDevice: {
      command: string;
      targetArgs: string[];
      session: string;
    };
    quickStart: string;
  }>;
  /** Remove a device from this thread's Device panel. `shutdown=true` also turns it off. */
  device_close(input?: {
    deviceId?: string;
    hostId?: string;
    /** Also turn it off. Default false. */
    shutdown?: boolean;
  }): Promise<{}>;
  /** Get a PNG of an open device's screen. For taps and text, use the `agent-device` CLI. */
  device_screenshot(input?: {
    deviceId?: string;
    hostId?: string;
  }): Promise<unknown>;
  /** Show the user a Markdown message in this thread, exactly as written, before your turn ends. Use it for content the user must read in full mid-turn, such as a draft, a code block, or what a question you are about to ask refers to. Don't repeat it in your reply. */
  send_to_user(input: {
    /** Markdown, shown verbatim. */
    message: string;
  }): Promise<{
    sentMessage: string;
    message: string;
  }>;
  /** Show a finished HTML page (chart, diagram, mockup) inline in this thread, above your final reply. Do not announce or restate the page. Frame fits height to 20000px. On mobile, content past the given height scrolls. Frame width is reply width (728px desktop, about 360px phones), on the thread background. Leave html, body, and the outer element with no background color, no outer card, border, banner title, or side padding. This wins over any rule that sets a page background. T3 adds an overridable 8px html gutter for selection rings and shadows. Use fluid widths within it. A box that needs its own background gets 16px padding and var(--radius) corners. Give charts fixed pixel heights. Let content set the height. Do not use vh units or height:100% on html or body. Both are rejected or loop. Use theme CSS variables on :root, not fixed colors: --background, --foreground, --muted, --card, --popover, --secondary, --border, --ring, --primary, --accent, --destructive, --warning, --success, --info, --code-background (most have a matching -foreground; accent, destructive, and warning also have -surface), --chart-1 to --chart-6, --radius, --font-sans, --font-mono. The base sheet sets background, text, and font. */
  html_render(input: {
    /** Absolute .html file path. */
    path?: string;
    /** Inline HTML. */
    html?: string;
    title: string;
    /** Frame height in CSS pixels, 80 to 2000. Use the contentHeight from html_preview. */
    height: number;
  }): Promise<{
    htmlRender: {
      attachmentId: string;
      title: string;
      height: number | "Infinity" | "-Infinity" | "NaN";
      heights?: [number, number][] | null;
    };
    message: string;
  }>;
  /** Check an HTML page before html_render. Returns PNG, contentHeight, and console output. Self-contained: inline <style> and <script>. Local images as absolute paths are inlined. Remote URLs load as-is. Theme and layout rules are in html_render. */
  html_preview(input?: {
    /** Absolute .html file path. */
    path?: string;
    /** Inline HTML. */
    html?: string;
    /** CSS pixels, 240 to 1600. Default 728. Use about 390 for phones. */
    width?: number;
    /** Default dark. */
    appearance?: "dark" | "light";
  }): Promise<unknown>;
  call(name: string, input?: object): Promise<unknown>;
};
declare const tools: {
  call(name: string, input?: object): Promise<unknown>;
};
/** Read a JSON value from this session's namespace; null when absent. */
mem.get(key: string): Promise<unknown | null>;
/** Store a JSON value (up to 1 MB) under key. Survives restarts. */
mem.set(key: string, value: unknown): Promise<null>;
/** Delete a key; true when it existed. */
mem.del(key: string): Promise<boolean>;
/** Keys in the namespace, sorted, optionally starting with prefix. */
mem.list(prefix?: string): Promise<string[]>;
/** The same get/set/del/list API on another namespace, shared across threads (for example "work:widgets#41"). Synchronous. */
mem.ns(name: string): { get; set; del; list };
/** A plain object restored before each execute and saved after it, per session (default: your thread). Assign fields; keep it JSON-serializable. */
vars: Record<string, unknown>;
/** Start this thread with a role: overseer, ticket or worker. A role the overseer role lists as a child (ticket by default) with no open link joins the board (parent "board"), labeled from its board launch, `label`, or its T3 title, so its gates become board cards; root: true keeps it a standalone root. Other roles start as roots. A thread the board launched clears its own pending launch, matched by thread id. Optional issue, parentIssue and part are stored on the board link it joins. */
wf.init(input: { role: string; label?: string; root?: boolean; issue?: string; parentIssue?: string; part?: string }): Promise<{ thread: string; role: string; root: boolean; parent?: string; label?: string; watcher: string }>;
/** Prepare a link to a child thread you are about to launch. Paste the returned brief, verbatim, at the end of the child's launch brief; the child binds the link with wf.join, whose call in the brief carries any issue, parentIssue and part given here. pr stores the PR description format on the child's link, so wf.pr can check a worker's opened event without the ticket, and pr.method lets t3cm merge the PR on the board's "merge" answer without the ticket. issue and parentIssue (a GitHub issue ref, GitLab issue URL, or Jira key/URL) name the issue the child works and the epic it belongs to, and part (n/N, such as "1/4") says which of the epic's PRs it is; wf.board() and the board return all three. */
wf.openChild(input: { role: string; label: string; issue?: string; parentIssue?: string; part?: string; pr?: { format?: string; sections?: Record<string, string[]>; passes?: string[]; mergeOnly?: boolean; method?: "merge" | "squash" | "rebase" } }): Promise<{ brief: string; params: { down: number; miss: number; stall: number } }>;
/** Join the link a parent opened (the call is in your launch brief). The watcher then nudges you after `down` idle minutes with no gate open. A rejoin without issue, parentIssue or part keeps the ones the link has. A worker link with no issue takes one from the closing-issue references (Closes #N) of its PR at the next GitHub reconcile. */
wf.join(input: { parent: string; label: string; role: string; down?: number; miss?: number; stall?: number; issue?: string; parentIssue?: string; part?: string }): Promise<{ parent: string; label: string; params: { down: number; miss: number; stall: number } }>;
/** Send to your parent. note: stored, never wakes, reaches the parent as a digest line at its next wake. event/gate/blocker/report wake it per link policy (overseer links turn events into notes). gate also opens a gate (no nudges until cleared). handoff/closed close the link. wake overrides the policy. With parent "board": note/event go to the board's feed, gate/blocker/report become a decision card (delivery "board", card id, and the card's reply buttons as options), handoff/closed mark the ticket done. options (gate/blocker/report only) sets the card's buttons in place of parsing the body: each one line, 1-60 chars, unique ignoring case, at most 8; a bad entry fails the send. A gate card with no buttons also returns a warning. */
wf.send(input: { kind: "note" | "event" | "gate" | "blocker" | "report" | "handoff" | "closed"; body: string; gate?: string; wake?: boolean; options?: string[] }): Promise<{ handle: string; delivery: "noted" | "sent" | "queued" | "board"; detail?: string; card?: string; options?: string[]; warning?: string; closed?: boolean }>;
/** Send to one of your children (by label or thread id). A closed link needs reopen: true. */
wf.reply(input: { to: string; body: string; reopen?: boolean }): Promise<{ handle: string; delivery: "noted" | "sent" | "queued" | "board"; detail?: string; card?: string; options?: string[]; warning?: string; closed?: boolean }>;
/** Open a gate while you wait on a person ({open: "merge"}); the watcher does not nudge you until {clear: true}. */
wf.gate(input: { open: string } | { clear: true }): Promise<{ gate: string | null }>;
/** Pause a link the work is meant to sit on: your own parent link, or a child's ({child: label or thread id}). The watcher sends a paused link no nudges, escalations or reports, and the board shows it as paused, not idle. {paused: false} resumes it with a fresh nudge count. */
wf.pause(input?: { child?: string; paused?: boolean }): Promise<{ label: string; paused: boolean }>;
/** Close a child link without a handoff (by label or thread id); the watcher stops watching it. */
wf.close(input: { child: string }): Promise<{ closed: string }>;
/** Unread notes from your children, oldest first; marks them read. */
wf.inbox(): Promise<{ handle: string; at: string; label: string; kind: string; head: string }[]>;
/** One stored message in full, by handle ("m12"). */
wf.show(handle: string): Promise<{ handle: string; kind: string; from: string; to: string; at: string; body: string }>;
/** Your parent link and one object per child link, with live T3 status. all: include closed links. parent: show that node's tree instead, each child with its workers (parent: "board" is the whole t3-codemode board, no caller needed). */
wf.board(input?: { all?: boolean; parent?: string }): Promise<{ parent: { thread: string; label: string; closed: boolean; gate: string | null } | null; children: { label: string; role: string; thread: string; link: string | null; status: string; asks: number; background: number; gate: string | null; paused: boolean; issue: string | null; parentIssue: string | null; part: string | null; lastUp: string; nudges: number; unread: number; last: { handle: string; kind: string; head: string } | null }[] }>;
/** Take over a retiring thread's open child links, pending links and queued messages. */
wf.adopt(input: { from: string }): Promise<{ adopted: string[]; pending: string[] }>;
/** Before finishing: open child links, never-joined links (dropped now), and whether your own parent link is still open. */
wf.sweep(): Promise<{ open: string[]; dropped: string[]; parentOpen: boolean }>;
/** Launch a t3-ticket thread for a GitHub, GitLab, or Jira issue that reports to the t3-codemode board (the root overseer). When project (id or title) is given it selects the T3 project directly; otherwise GitHub and GitLab refs match the T3 project whose workspace origin remote has that host and repo path, and Jira keys or unmatched GitLab/Jira hosts fall back to the user config's trackers mappings. The model resolves through the models.ticket slot for the issue's project in this order: launch arguments (model/effort), the repo's .t3-workflow.json and AGENTS.md, the user config's models.ticket, legacy board.* ticket keys, and the built-in default. A pool value picks through that pool (as wf.pick does) and adds pool and reason to the result. The result always carries instanceId, model, effort and modelSource. An unmapped ref, an invalid or unavailable model/instance/effort/pool, or a failed launch throws and leaves an error card on the board, never falling back to the built-in default. The ticket's link stores the canonical issue slug (GitHub <owner>/<repo>#<n>, GitLab <host>/<group/...>/<project>#<n>, or Jira KEY-N or <host>/KEY-N), with the optional parentIssue and part. The ticket is labeled <repo>#<n> for GitHub/GitLab or KEY-N for Jira (falling back to the slug if that label is already open), and an issue that already has a ticket or a pending launch throws. Every launch counts against the global cap, maxTicketsTotal (default 8): when the board already has that many open tickets, whatever launched them, the launch throws and leaves an error card, and nothing at run time raises the cap. */
wf.launchTicket(input: { issue: string; parentIssue?: string; part?: string; project?: string; title?: string; model?: string; effort?: string }): Promise<{ ok: true; label: string; thread: string; link: string | null; projectId: string; title: string; instanceId: string; model: string; effort: string | null; modelSource: "argument" | ".t3-workflow.json" | "AGENTS.md" | "user" | "board" | "default"; pool?: string; reason?: string }>;
/** Launch a thread in a T3 project (id or title) to carry out a request, on the models.ticket slot resolved for that project exactly as wf.launchTicket resolves it (pools included). The brief is the request word for word plus a board link, so the thread joins the board as a ticket labeled "<project title>: <title>" (title defaults to the request's first words), with " (2)", " (3)" and so on added when that label is already on the board. When the caller is the scratch thread of a board question (Ask), that question records dispatched: { thread, link, projectId, project, label }. An unknown project throws and launches nothing; an unavailable model, a board already at the maxTicketsTotal cap of open tickets, or a failed launch throws and leaves an error card. */
wf.dispatch(input: { project: string; request: string; title?: string }): Promise<{ ok: true; label: string; thread: string; link: string | null; projectId: string; title: string; instanceId: string; model: string; effort: string | null; modelSource: "argument" | ".t3-workflow.json" | "AGENTS.md" | "user" | "board" | "default"; pool?: string; reason?: string }>;
/** Report a GitHub issue this thread just filed, so it shows on the board's new-issues list with a link back to this thread and when it was filed. Needs no parent link. Reporting an issue already on the list, dismissed or not, or one that already has a board ticket, adds nothing: added is false, reason says which, and message says so. When blockedBy, parent, track or priority is given and sync is not false (sync defaults to true when any of those is passed), also wires native GitHub blocked-by links (addBlockedBy), sub-issue parent link (addSubIssue), and track:/priority: labels idempotently (creating missing labels as needed). Already-linked relationships and already-applied labels succeed; GitHub and permission errors are reported in wiring.errors rather than discarded. From the list the user launches a ticket for it (the same path as wf.launchTicket) or dismisses it. */
wf.issue(input: { url: string; title?: string; note?: string; blockedBy?: string[]; parent?: string; track?: string; priority?: "high" | "medium" | "low"; sync?: boolean }): Promise<{ added: boolean; reason?: "reported" | "ticket"; message: string; issue?: { id: string; url: string; repo: string; number: number; label: string; title: string | null; note: string | null; thread: string; threadLink: string | null; threadTitle: string | null; at: string; atLocal: string; dismissed: boolean; dismissedAt: string | null; dismissedAtLocal: string | null; restoredAt: string | null }; ticket?: { label: string; thread: string | null; link: string | null; done: boolean }; wiring?: { ok: boolean; blockedBy: { ref: string; status: "linked" | "alreadyLinked" | "error"; error?: string }[]; parent: { ref: string; status: "linked" | "alreadyLinked" | "error"; error?: string } | null; labels: { name: string; status: "added" | "createdAndAdded" | "alreadyApplied" | "error"; error?: string }[]; errors: { op: string; target: string; message: string; permission: boolean }[] } }>;
/** Create a batch of GitHub issues forming a dependency DAG in one call. Items may carry symbolic local ids (for example "P0", "P1") referenced by other items' blockedBy and parent fields alongside external GitHub issue refs (#N, owner/repo#N, or URL). Validates every item, topologically sorts the batch across both parent and blockedBy edges, and rejects cycles or invalid references before making any GitHub write. Creates issues in topological order so real #N numbers are known, writes the canonical ## Flow block (Parent, Blocked by, Track, Priority, Touches) with resolved #N (or owner/repo#N across repos) into each issue body, wires native GitHub addBlockedBy, addSubIssue, and labels (track:, priority:, queue opt-in label from flow.optIn.label when queue is true, plus custom labels) when sync is not false, and reports created issues to the board's new-issues list when called from a thread (unless report is false). Permission or wiring errors are reported in each item's wiring and top-level errors without being swallowed. */
wf.fileIssues(input: { repo?: string; parent?: string; track?: string; priority?: "high" | "medium" | "low"; labels?: string[]; queue?: boolean; report?: boolean; sync?: boolean; issues: { id?: string; repo?: string; title: string; body?: string; blockedBy?: string[]; parent?: string; track?: string; priority?: "high" | "medium" | "low"; touches?: string[]; labels?: string[]; queue?: boolean; note?: string }[] }): Promise<{ ok: boolean; order: string[]; issues: ({ id: string | null; inputIndex: number; repo: string; number: number; label: string; url: string; title: string; body: string; parent: string | null; blockedBy: string[]; labels: string[]; reported: { added: boolean; reason?: "reported" | "ticket"; issue?: { id: string; url: string; repo: string; number: number; label: string; title: string | null; note: string | null; thread: string; threadLink: string | null; threadTitle: string | null; at: string; atLocal: string; dismissed: boolean; dismissedAt: string | null; dismissedAtLocal: string | null; restoredAt: string | null }; ticket?: { label: string; thread: string | null; link: string | null; done: boolean }; message?: string; error?: string } | null; wiring: { ok: boolean; blockedBy: { ref: string; status: "linked" | "alreadyLinked" | "error"; error?: string }[]; parent: { ref: string; status: "linked" | "alreadyLinked" | "error"; error?: string } | null; labels: { name: string; status: "added" | "createdAndAdded" | "alreadyApplied" | "error"; error?: string }[]; errors: { op: string; target: string; message: string; permission: boolean }[] } | null })[]; byId: Record<string, { repo: string; number: number; label: string; url: string }>; errors: { issue: string; op: string; target: string; message: string; permission: boolean }[] }>;
/** Pick a provider instance from a configured pool for one launch. The result and its reason name the driver, model and effort chosen: the pool's model and effort, or in a mixed pool the chosen member's own. Skips members T3 reports disabled or constrained, members that do not list their model or offer their effort, and members marked limited; a member with a reserve is a last resort, picked only when every other member is out. Under strategy cheapest, the lowest-cost members that can run take every launch, by weight among themselves. Pass modelSelection to t3_thread_launch, then report the launched thread with wf.picked. Throws, naming the pool, when no member can run or, in a pool that is not mixed, a member is not an instance of the pool's driver; nothing is launched. */
wf.pick(input: { pool: string }): Promise<{ pool: string; pick: number; instanceId: string; driver: string; model: string; effort: string | null; options: { id: string; value: string }[]; reason: string; skipped: { instanceId: string; reason: string }[]; modelSelection: { instanceId: string; model: string; options?: { id: string; value: string }[] } }>;
/** Record the thread a wf.pick launched, so the board can offer to move that thread to another member of its pool when it stops on a usage limit. A thread launched without a recorded pick never gets that offer. Throws when the pick is unknown or already launched another thread. */
wf.picked(input: { pick: number; thread: string }): Promise<{ pick: number; pool: string; instanceId: string; thread: string }>;
/** Each configured pool with its members: driver, model and effort, weight, reserve, cost, state (ready, limited, disabled, constrained, missing-model, missing-effort, or unknown when T3 did not answer), why, the limit's reset time (ISO and local), running threads, and pick count and last pick. A mixed pool has no pool-level driver, model or effort (null), and in a mixed pool a member's driver is null when T3 did not answer. error names a member that is not an instance of the pool's driver, or says T3 did not answer. warnings flags a member that is the only one able to run the pool's model, or in a mixed pool the only one of its driver able to run its model, and suggests a reserve on it when it has none. */
wf.pools(): Promise<{ pool: string; mixed: boolean; driver: string | null; model: string | null; effort: string | null; strategy: "weighted" | "priority" | "cheapest"; moveOnLimit: "ask" | "auto" | "never"; error: string | null; warnings: string[]; members: { instanceId: string; driver: string | null; model: string; effort: string | null; weight: number; reserve: number; cost: number; state: string; reason: string | null; limitedUntil: string | null; limitedUntilLocal: string | null; limitReason: string | null; usageLeft: number | null; running: number | null; picks: number; lastPick: string | null; lastPickLocal: string | null }[] }[]>;
/** How board ticket launches are routed now and over a recent window. It reads the ticket launch selection the board resolves (models.ticket in the user config, else legacy board.pool or board ticket keys, else the default). With a pool (mode pool), each member carries its state as wf.pools reports it, status (ready, reserve when it is held at its reserve, limited, disabled when it cannot run, or unknown when T3 did not answer), why, the limit's reset time, running threads, its picks in the window, share (its fraction of every pick in the window, former members' included, or of the configured weight when the window has none, as shareBasis says), weightShare, reasons (its picks by kind: weighted, priority, cheapest, last-resort or moved) and skips (the window's picks that passed it over, by kind: limited, reserve, disabled, constrained, missing-model, missing-effort or other). reasons counts every pick in the window by kind, series splits the window into 24 buckets of pick counts per member, recent lists the latest 20 picks, and former counts picks of instances no longer in the pool. Without a pool (mode single), members holds the one instance, model and effort launches use, with share 1 and no pick history. running lists the active threads (preparing, queued, starting or running, counted as wf.pools counts them) of every provider instance, or is null with runningError when T3 did not answer. window is "all" or a count of m, h or d (default 24h); since is null for all. The picks history keeps the latest 2000 picks. tokens totals the input and output tokens of the runs that ended in the window, with byInstance and byProvider (by driver), each member carries its own tokens, and tokenSeries splits them into the same buckets as series; all are null while no token source reports counts, which is always the case against T3 today. */
wf.usageStats(input?: { window?: string }): Promise<{ window: string; since: string | null; sinceLocal: string | null; at: string; mode: "pool" | "single"; source: string; pool: string | null; strategy: "weighted" | "priority" | "cheapest" | null; error: string | null; warnings: string[]; picks: number; shareBasis: "picks" | "weight" | "single"; members: { instanceId: string | null; driver: string | null; model: string | null; effort: string | null; weight?: number; reserve?: number; cost?: number; state: string; status: "ready" | "reserve" | "limited" | "disabled" | "unknown"; reason: string | null; limitedUntil: string | null; limitedUntilLocal: string | null; limitReason: string | null; usageLeft?: number | null; running: number | null; picks: number; lastPick?: string | null; lastPickLocal?: string | null; share: number | null; weightShare?: number | null; reasons?: Record<string, number>; skips?: Record<string, number>; tokens: { input: number; output: number; runs: number } | null }[]; reasons: Record<string, number>; series: { start: string; bucketMinutes: number; buckets: { start: string; counts: Record<string, number> }[] } | null; tokens: { input: number; output: number; runs: number; byInstance: Record<string, { input: number; output: number; runs: number }>; byProvider: Record<string, { input: number; output: number; runs: number }> } | null; tokenSeries: { start: string; bucketMinutes: number; buckets: { start: string; input: Record<string, number>; output: Record<string, number> }[] } | null; recent: { at: string; atLocal: string; instanceId: string; kind: string; reason: string; thread: string | null }[]; former: { instanceId: string; picks: number }[]; running: { instanceId: string; threads: number }[] | null; runningError: string | null }>;
/** The service's own state, as the board header shows it: version, T3 connection, watcher, the release check, and skills, which compares the installed T3 workflow skills and recorded setup steps against this release. skills.current is false when the skills are behind, edited, missing, installed by npx skills, or an automatic setup step is missing; present is false when no skills are installed at all; fixes lists the commands to run, in order. Reads the skills fresh on each call. */
wf.status(): Promise<{ version: string; t3: { connected: boolean; lastError: string | null }; tokenExpiresAt: string | null; watcher: { lastPass: string | null; lastPassAt: string | null; alive: boolean }; openLinks: "desktop" | "tab"; update: { current: string; latest: string; available: boolean; notes: string; command: string } | null; skills: { release: string; installed: string | null; present: boolean; current: boolean; fix: string | null; foreign: { tool: string; lock: string | null; commit: string | null; skills: string[]; matchesRelease: boolean; differingFiles: number } | null; missingSteps: { id: string; kind: "auto" | "interview"; since: string; slot?: string; fix: string }[]; configState: "absent" | "legacy" | "recorded" | "problem" | null; problem?: string; fixes: string[]; error?: string } }>;
/** One T3 workflow slot, looked up by the step that uses it: review before opening a PR, passes when publishing, delivery for delivery stages and gates, models when launching. The service resolves it for your thread's T3 instance and project, the way your own session would see it: defaults, the user config, the repo's AGENTS.md Agent workflow block, the repo's .t3-workflow.json, and the skills your agent's config folder has installed and enabled. Each skill carries how to run it (the Skill tool, or the inline SKILL.md to read) or why it is skipped. For delivery, files filters steps with paths globs against changed repo-relative file paths and reports unmatched steps in skipped. line is the one-line summary; warnings names config problems and a connection that reported no config folder. repo overrides the project's workspace root, for example with your worktree. */
wf.slot(name: "review" | "passes" | "delivery" | "models" | "credentials", input?: { repo?: string; instance?: string; skills?: string[]; files?: string[] }): Promise<{ slot: string; source?: string; line: string; warnings: string[]; skill?: { ref: string; status: "ok" | "ambiguous" | "missing"; name?: string; path?: string | null; where?: string; invoke?: "skill" | "inline"; others?: string[]; how?: string } | null; note?: string; skills?: ({ ref: string; status: "ok" | "ambiguous" | "missing"; name?: string; path?: string | null; where?: string; invoke?: "skill" | "inline"; others?: string[]; how?: string } | null)[]; renewals?: { match: string; skill: { ref: string; status: "ok" | "ambiguous" | "missing"; name?: string; path?: string | null; where?: string; invoke?: "skill" | "inline"; others?: string[]; how?: string } | null }[]; steps?: { id: string; kind: "builtin" | "skill" | "manual"; skill?: { ref: string; status: "ok" | "ambiguous" | "missing"; name?: string; path?: string | null; where?: string; invoke?: "skill" | "inline"; others?: string[]; how?: string } | null; prompt?: string; gate: "always" | "chain" | "never"; scope: "pr" | "ticket" | "post-handoff"; paths?: string[]; watch?: boolean }[]; closeAfter?: "pr" | "ticket" | "all"; skipped?: { id: string; reason: string; paths?: string[] }[]; mode?: string; problem?: string; ticket?: { slot: string; source: string; spec: { model?: string; effort?: string; provider?: string; pool?: string } | null; note?: string | null; problem?: string; modelSelection: { instanceId: string; model: string; options?: { id: string; value: string }[] } | { pool: string; pick: string } | null }; worker?: { slot: string; source: string; spec: { model?: string; effort?: string; provider?: string; pool?: string } | null; note?: string | null; problem?: string; modelSelection: { instanceId: string; model: string; options?: { id: string; value: string }[] } | { pool: string; pick: string } | null } }>;
/** A command failed: pass its output, and the service matches it against the credentials slot's patterns. Returns the renewal skill to run, then retry the command once, or null when no pattern matches. skipped is true when the matching renewal skill no longer resolves; carry on as if none were configured. */
wf.renewal(input: { output: string; repo?: string; instance?: string }): Promise<{ match: string; skill: { ref: string; status: "ok" | "ambiguous" | "missing"; name?: string; path?: string | null; where?: string; invoke?: "skill" | "inline"; others?: string[]; how?: string } | null; how: string; skipped: boolean; reason?: string; warnings: string[] } | null>;
/** Every T3 workflow slot at once, as setup and the board need them, in the shape `t3cm slots --json` prints. A role looks up the one slot its step needs with wf.slot instead. */
wf.slots(input?: { repo?: string; instance?: string; skills?: string[] }): Promise<{ repo: string; config: string | null; repoConfig?: string | null; review: object; passes: object; credentials: object; delivery: object; models: { ticket: object; worker: object }; problems: string[]; warnings: string[]; context: { instance: string | null; driver: string | null; claudeDir: string; codexHome: string; folderFrom: "reported" | "recorded" | "default"; config: string } }>;
/** The project flow's ready queue and dependency graph, read live from GitHub across the covered repositories (explicit flow.repos, or discovered from active T3 projects' GitHub remotes with optional flow.includeRepos and flow.excludeRepos overrides). When flow launch settings (flow.maxTickets) are configured, queue lists each covered repo's open issues matching the optional flow.optIn filter (label and/or milestone) that have no open blocker (native GitHub blocked-by links, parsed issue-body dependencies from ## Flow blocks and prose directives such as Depends on, Blocked by and After, or hard prStack dependencies from stacked open PRs, local worktree branch ancestry, or active t3-ticket part: n/N chains), have no unresolved blocker reference, are not labelled "blocked" or "blocked: external", have no open board ticket, are not sub-issues of an issue with an open board ticket, and (when flow.serializeFileConflicts is true) do not overlap files with an actively running ticket, in launch order: priority label (priority: high, medium, low, then none), then milestone due date (none last), then oldest. blocked lists the matching issues held by an open blocker, a prStack edge (in prStack), a serialized file conflict against a running ticket (in fileConflicts), an unresolved blocker reference, a plain "blocked" label, or "blocked: external", each with its open blockers. skipped lists the ready issues someone skipped on a launch card; each stays out of queue until its labels or blockers change. running is the open board tickets for issues in covered repos, leaving out a ticket whose issue is closed; free is maxTickets minus running, and never more than maxTicketsTotal (the global cap, default 8, which flow.maxTickets may not exceed) minus every open board ticket, whatever launched it. Without flow.maxTickets, enabled is false and the queue lists are empty (wf.flow() with graph omitted reads nothing from GitHub). With graph: true it also returns graph, the dependency graph the board reads from GET /api/flow even with no flow block: a node for each open issue across the covered repos and each active board ticket (tracked: true), plus a node for each issue they point at (a closed blocker, an uncovered-repo blocker or parent), an edge for each blocked-by, parent, prStack (source "git", with branch/baseBranch/pr/basePr/part metadata), fileConflict (source "code", carrying overlapping repo-relative files from open PRs, local worktrees, Touches:, and verified issue-body paths) and advisory codeDep (source "code", carrying static module/workspace/import edges in modules and referenced symbol definitions in symbols from the local checkout; strictly advisory, never holds readiness or launches, never raises cycle warnings, and skipped on queue-only reads) link, and warnings for dependency or parent cycles, unresolved dependency references, and plain "blocked" labels with no open blocker linked. Each node lists blockedBy, unlocks (the reverse of blockedBy), parent and subIssues by node id ("owner/name#N"), its flowList, ready (in queue), external (labelled "blocked: external", or every open hard blocker is outside the covered repos), its track and trackBy ("label" from track:<name>, *-track, area:<name> or ## Flow Track:; else "epic" from its parent epic; else "milestone"; else "component" when its connected component has at least 2 nodes; else "independent" in a shared per-repo lane), its board ticket, its warnings, and (when flow.optIn is set) optIn: on (carries flow.optIn.label), inFlow (matches the whole filter) and locked (why the board cannot toggle it). Read-only; throws when gh cannot read a covered repo. */
wf.flow(input?: { graph?: boolean }): Promise<{ enabled: boolean; launch: "ask" | "auto" | "off" | null; maxTickets: number; maxTicketsTotal: number; free: number; running: { label: string; repo: string; number: number; url: string; thread: string | null; link: string | null }[]; queue: { repo: string; number: number; label: string; url: string; title: string; priority: "high" | "medium" | "low" | null; milestone: { title: string; dueOn: string | null } | null; createdAt: string; parent: { repo: string; number: number; label: string; url: string; title: string | null } | null; unblockedBy: { repo: string; number: number; label: string; url: string; title: string | null }[] }[]; blocked: ({ repo: string; number: number; label: string; url: string; title: string; priority: "high" | "medium" | "low" | null; milestone: { title: string; dueOn: string | null } | null; createdAt: string; parent: { repo: string; number: number; label: string; url: string; title: string | null } | null; unblockedBy: { repo: string; number: number; label: string; url: string; title: string | null }[] } & { blockers: { repo: string; number: number; label: string; url: string; title: string | null }[]; moreBlockers: boolean; external: boolean; blockedLabel?: boolean; unresolved?: string[]; prStack?: { repo: string; number: number; label: string; url: string; branch?: string; baseBranch?: string; pr?: number; basePr?: number; part?: string }[]; fileConflicts?: { repo: string; number: number; label: string; url: string; files: string[] }[] })[]; skipped: { repo: string; number: number; label: string; url: string; title: string; priority: "high" | "medium" | "low" | null; milestone: { title: string; dueOn: string | null } | null; createdAt: string; parent: { repo: string; number: number; label: string; url: string; title: string | null } | null; unblockedBy: { repo: string; number: number; label: string; url: string; title: string | null }[] }[]; graph?: { nodes: { id: string; repo: string; number: number; label: string; url: string; title: string | null; state: "open" | "closed" | null; tracked: boolean; labels: string[]; priority: "high" | "medium" | "low" | null; milestone: { title: string; dueOn: string | null } | null; track: string; trackBy: "label" | "epic" | "milestone" | "component" | "independent"; parent: string | null; subIssues: string[]; moreSubIssues: boolean; blockedBy: string[]; moreBlockers: boolean; unlocks: string[]; flowList: "queue" | "blocked" | "skipped" | null; ready: boolean; external: boolean; ticket: { thread: string | null; link: string | null; status: string } | null; warnings: { kind: "cycle" | "unresolved" | "blockedLabel"; message: string; raw?: string }[]; optIn?: { on: boolean; inFlow: boolean; locked?: string } }[]; edges: { from: string; to: string; kind: "blockedBy" | "parent" | "prStack" | "fileConflict" | "codeDep"; source: "github" | "body" | "git" | "code"; branch?: string; baseBranch?: string; pr?: number; basePr?: number; part?: string; files?: string[]; modules?: string[]; symbols?: string[] }[]; warnings: { kind: "cycle" | "unresolved" | "blockedLabel"; message: string; nodes: string[]; raw?: string }[] } }>;
/** Run one flow pick by hand, under the rules the board applies when a slot opens. With launch "ask" it raises a board card "Launch <label> next? (priority: X, unblocked by #N)" with launch and skip buttons for the first ready issue that has no card yet; with "auto" it launches that issue through wf.launchTicket and posts a feed event; with "off", or no flow.maxTickets, it reads nothing and launches nothing. An open launch card holds its slot, so nothing is picked when every free slot already has a card; free also stops at the maxTicketsTotal cap on open board tickets, so the queue holds at the cap and picks again when a ticket closes; reason says why picked is empty. offered lists the launch cards still open, and retired the cards this pick closed because their issue is no longer ready or no slot is free. An auto launch that fails leaves its error card and skips the issue until its labels or blockers change, except a launch refused at the cap, which stays queued. Throws when gh cannot read a covered repo. */
wf.flow.next(): Promise<{ launch: "ask" | "auto" | "off" | null; free: number; picked: { label: string; url: string; title: string; priority: "high" | "medium" | "low" | null; why: string; card?: string; launched?: object; error?: string }[]; offered: { label: string; card: string }[]; retired?: string[]; reason?: string }>;
/** Merge a GitHub pull request through the service's gh login, or a GitLab merge request on a host listed under forges through its glab login, only at the approved head commit (refused when the head differs). On a repo with a merge queue or a GitLab project with merge trains: a mergeable PR is enqueued or joins the train (never auto-merge); one not yet mergeable is recorded as waiting and returns waiting. Without one: merged directly with method, or the repo's default method (on GitLab, the merge request's squash setting; squash is the only method GitLab takes per merge). A GitLab answer that it cannot merge yet (HTTP 405), or an auto-merge it set that t3cm takes back, returns waiting with reason. Throws when gh or glab cannot reach the forge. */
wf.merge(input: { repo: string; pr?: number; head: string; method?: "merge" | "squash" | "rebase" }): Promise<{ repo: string; pr: number; head: string } & ({ status: "queued"; position: number | null; approval: string } | { status: "merged"; commit: string | null; method?: "merge" | "squash" | "rebase" } | { status: "waiting"; mergeState: string; approval: string; reason?: string } | { status: "refused"; reason: string })>;
/** A worker reports its PR. opened (with publishing, the Publishing line, and checks "none" in a repo with no CI) checks the Publishing line and the description on GitHub, or GitLab for a merge request on a host listed under forges, against the format the ticket's wf.openChild stored, and returns status rewrite with the rewrite request when one falls short. updated records a new head and drops any merge card for the old one. ready checks the PR on its forge (open, not a draft, at head, every check or pipeline finished with none failed), resolves the delivery slot for its changed files and opens the merge card on the board with the answers the slot calls for. A pending check returns waiting, and PR reconcile opens the card once the checks finish; a failing one returns failing. None of these wakes the ticket. Each lands in its digest as a handled-for-you line. Where t3cm cannot decide (no board ticket, relay off, a follow-up PR, a targeted fix PR, no builtin merge stage, or a PR it cannot read), the event goes to the ticket as before and returns status ticket with why. */
wf.pr(input: { event: "opened" | "updated" | "ready"; repo: string; pr?: number; head: string; publishing?: string; checks?: "pending" | "none"; body?: string }): Promise<{ status: "open" | "rewrite" | "recorded" | "gated" | "waiting" | "failing" | "refused" | "ticket"; handle?: string; message?: string; missing?: string[]; dropped?: string[]; card?: string; options?: string[]; head?: string; pending?: string; checks?: string; reason?: string; why?: string; detail?: string }>;
/** The board's open decision cards, oldest first: gates, blockers, reports and escalations from ticket threads, with their reply options (the sender's options, else those parsed from their text) and their ticket's repo and project. all: include resolved cards, each with resolved (local time) and resolution. context (a saved context's id or name) or projects (project ids, or old repo or title values) keeps only the cards of those projects, matched as the board page matches them; an empty list keeps every card. */
wf.cards(input?: { all?: boolean; context?: string; projects?: string[] }): Promise<{ id: string; kind: string; label: string | null; ticket: string | null; link: string | null; text: string; handle: string | null; options: string[]; at: string; atLocal: string; resolved?: string; resolution?: string | null; token: string; approval?: string; repo: string | null; project: { id: string; title: string | null } | null }[]>;
/** Answer a board card for the user: sends the ticket a [t3cm reply] 'The user says "<text>" about <id>: <card text>' and resolves the card. Same as a button on the board page. */
wf.answer(id: string, text: string): Promise<{ handle: string; delivery: "noted" | "sent" | "queued" | "board"; detail?: string; card?: string; options?: string[]; warning?: string; closed?: boolean }>;
/** The board's activity feed: the latest notes and events from ticket and worker threads, newest first, each with its ticket's repo and project. context (a saved context's id or name) or projects (project ids, or old repo or title values) keeps only the rows of those projects, matched as the board page matches them: up to limit matching rows from the latest 200. */
wf.feed(input?: { limit?: number; context?: string; projects?: string[] }): Promise<{ handle: string; at: string; iso: string; label: string; kind: string; head: string; ticket: string | null; repo: string | null; project: { id: string; title: string | null } | null }[]>;
/** Add an item to your waiting list (decisions the user owes). Ids cycle a1..a9, b1..d9, skipping open ones. */
wf.waiting.add(input: { text: string; from?: string; link?: string }): Promise<{ id: string }>;
/** Resolve an open waiting-list item. */
wf.waiting.resolve(id: string, note?: string): Promise<{ id: string; text: string; resolved: true }>;
/** Your open waiting-list items, oldest first. */
wf.waiting.list(): Promise<{ id: string; text: string; from: string | null; link: string | null; at: string }[]>;

Upstreams contract

This is the design record the upstreams feature was built from, and it has not kept up with the code. Some rules here, such as where http.url accepts references, differ from what the service does. Upstreams and the code are the current reference.

t3-codemode becomes a Code Mode for any MCP servers. An upstream is another MCP server (stdio or Streamable HTTP) listed in config.json. Its tools join the catalog under the upstream’s namespace: search finds them, execute calls them. The service holds the upstream’s credentials; they never reach the sandbox, tool output, /healthz or logs. T3 stays built in as namespace t3 with its OAuth client and every existing behavior.

This file is the interface three builders work against in parallel. The shared types, the trait and every public signature already exist and compile (src/upstream/mod.rs, stubs in the owned files). Builders change bodies and private items in their own files only.

1. How T3 fits

T3 implements the Upstream trait through T3Upstream (an adapter over the existing T3Client, done in mod.rs). It is not owned by UpstreamManager: its lifecycle stays with HttpT3 (OAuth, token refresh, re-auth on 401), and App keeps the T3 path it has today (the t3_ prefix alias, config.deny, the cached tool list in the store, kind: "t3"). The manager owns only configured upstreams. Routing in App:

  • namespace t3 goes to the existing T3 path;
  • any other namespace goes to UpstreamManager::call(ns, tool, args).

wf keeps using T3Client directly. T3Upstream exists so code that wants “every namespace” (status, a future uniform catalog) has one shape.

2. Config schema

~/.config/t3-codemode/config.json (or $T3CM_CONFIG) gains a top-level upstreams array. Arrays replace the built-in default ([]) in the deep merge. Keys inside an upstream are snake_case, as below.

KeyTypeDefaultRule
namestringrequiredthe JS namespace; identifier rules in section 4
transport"stdio" | "http"requiredselects the section below
stdio.commandstringrequired for stdiobare name (searched on PATH, then $HOME/.local/bin; on Windows each PATHEXT extension too) or a path (~ expanded); no references
stdio.argsstring[][]no references (argv is visible in ps)
stdio.env{string: string}{}values may hold references
stdio.cwdstringservice cwd~ expanded; must exist at connect; no references
http.urlstringrequired for httphttp:// or https://; references allowed outside the host
http.headers{string: string}{}values may hold references
enabledbooltruefalse: no global, no catalog entries, never connects
timeout_msinteger60000per request, 100..=600000
allowstring[]["*"]tool-name globs (*, ?), matched on the upstream’s raw tool name
denystring[][]globs; deny wins over allow

Exactly one of stdio / http is present and it matches transport. Unknown keys are errors (deny_unknown_fields). At most 32 upstreams.

References (secrets)

A value in stdio.env or http.headers may contain any mix of literal text and references:

  • ${env:NAME}: the service process’s environment variable NAME ([A-Za-z_][A-Za-z0-9_]*). Note: under systemd this is the unit’s environment, not the caller’s shell.
  • ${file:/abs/path} or ${file:~/path} (on Windows also C:\path or ~\path): the file’s UTF-8 content with trailing \r/\n trimmed.
  • $${ is a literal ${. Any other ${ is a config error.

Examples: "Bearer ${env:LINEAR_TOKEN}", "${file:~/.config/t3-codemode/gh.pat}".

Secrets only by reference: a header named Authorization, Proxy-Authorization or Cookie, or any header or env name containing one of SECRET_NAME_HINTS (TOKEN, SECRET, KEY, PASSWORD, PASSWD, AUTH, COOKIE, CREDENTIAL, case-insensitive), whose value holds no reference is a config error. ${ in command, args, cwd or url is a config error.

References are parsed at load (syntax errors fail the load) and resolved at connect time, every connect, so a rotated file or env value is picked up on the next reconnect. An unset or empty env var, or an unreadable file, fails that connect with UpstreamError::Config naming the variable or path, never the value; the upstream goes to backoff, others are unaffected. Resolved values are held in Secret (its Debug/Display print [redacted]) and listed in ResolvedUpstream::secrets: every reference’s resolved value and every composed value that contains one.

Example

{
  "upstreams": [
    {
      "name": "cbm",
      "transport": "stdio",
      "stdio": { "command": "codebase-memory-mcp" },
      "timeout_ms": 120000,
      "deny": ["delete_project", "index_repository"]
    },
    {
      "name": "linear",
      "transport": "http",
      "http": {
        "url": "https://mcp.linear.app/mcp",
        "headers": { "Authorization": "Bearer ${file:~/.config/t3-codemode/linear.token}" }
      },
      "allow": ["list_*", "get_*", "search_*"]
    },
    {
      "name": "gh",
      "transport": "stdio",
      "enabled": false,
      "stdio": {
        "command": "github-mcp-server",
        "args": ["stdio"],
        "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "${env:GH_PAT}" },
        "cwd": "~"
      }
    }
  ]
}

codebase-memory-mcp (installed at ~/.local/bin/codebase-memory-mcp) runs an MCP server on stdio with no arguments; the bare command resolves through the $HOME/.local/bin fallback even when the unit’s PATH lacks it.

3. Rust layout and signatures

src/upstream/mod.rs          shared types, Upstream + Connector traits, McpConnector, T3Upstream, helpers  (architect; frozen)
src/upstream/fake.rs         FakeUpstream + FakeConnector for tests                                       (architect; frozen)
src/upstream/config.rs       validate, references, resolve, globs, ToolFilter impl                         (manager)
src/upstream/manager.rs      UpstreamManager                                                              (manager)
src/upstream/client_stdio.rs StdioClient                                                                  (client)
src/upstream/client_http.rs  HttpClient                                                                   (client)
tests/support/fake_mcp_server.rs  [[bin]] t3cm-fake-mcp, a scriptable stdio MCP server                    (client)

src/config.rs already has #[serde(default)] pub upstreams: Vec<UpstreamConfig> and calls crate::upstream::config::validate(&self.upstreams) from Config::validate. App already has pub upstreams: Arc<UpstreamManager>; App::new builds it from config.upstreams with McpConnector, and App::with_upstreams(config, store, t3, clock, upstreams) injects one (tests). main.rs warms it (upstreams.tools() in the background at start) and calls upstreams.shutdown() after the server stops.

Shared (mod.rs, implemented)

#![allow(unused)]
fn main() {
pub const T3_NAMESPACE: &str = "t3";
pub const RESERVED_NAMES: &[&str] = &["t3", "mem", "vars", "wf", "console", "tools", "catalog"];
pub const RESERVED_JS: &[&str] = &["eval", "undefined", "arguments", "escape", "unescape", "async", "globalThis"];
pub const MAX_NAME_LEN: usize = 32;
pub const DEFAULT_TIMEOUT_MS: u64 = 60_000;  MIN_TIMEOUT_MS = 100;  MAX_TIMEOUT_MS = 600_000;
pub const CONNECT_TIMEOUT: Duration = 15 s;   // spawn/handshake + initialize + first tools/list
pub const BACKOFF_MIN: Duration = 1 s;  BACKOFF_MAX: Duration = 60 s;
pub const MCP_PROTOCOL_VERSION: &str = "2025-06-18";  CLIENT_NAME = "t3-codemode";
pub const STDERR_LINES: usize = 50;  ERROR_CHARS = 1000;  MIN_SECRET_LEN = 4;  REDACTED = "[redacted]";
pub const SECRET_NAME_HINTS: &[&str];

pub enum Transport { Stdio, Http }                         // serde "stdio" | "http"
pub struct StdioConfig { command, args: Vec<String>, env: BTreeMap<String, String>, cwd: Option<String> }
pub struct HttpConfig { url, headers: BTreeMap<String, String> }
pub struct UpstreamConfig { name, transport, stdio: Option<StdioConfig>, http: Option<HttpConfig>,
                            enabled: bool, timeout_ms: u64, allow: Vec<String>, deny: Vec<String> }
pub enum Reference { Literal(String), Env(String), File(PathBuf) }
pub struct Secret(..);  fn new(String) -> Secret;  fn expose(&self) -> &str;   // Debug/Display: [redacted]
pub enum ResolvedTransport {
    Stdio { command: PathBuf, args: Vec<String>, env: Vec<(String, Secret)>, cwd: Option<PathBuf> },
    Http { url: String, headers: Vec<(String, Secret)> },
}
pub struct ResolvedUpstream { name, transport: ResolvedTransport, timeout: Duration, secrets: Vec<Secret> }
    fn redact(&self, String) -> String;
pub struct ToolFilter { pub allow: Vec<String>, pub deny: Vec<String> }      // impl in config.rs
pub struct ToolDef { name, description, input_schema: Value, output_schema: Option<Value>, annotations: Option<Value> }
    fn from_mcp(&Value) -> Option<ToolDef>;  fn to_mcp(&self) -> Value;
pub enum UpstreamError { Tool, Unavailable, Timeout, Denied, UnknownTool, UnknownNamespace, Config }  // each (String)
    fn message(&self) -> &str;  fn restarts_connection(&self) -> bool /* Unavailable only */;  fn not_implemented(&str) -> Self;
    impl Display, Error, From<T3Error>
pub enum UpstreamState { Disabled, Idle, Connecting, Ready, Backoff }        // serde lowercase
pub struct UpstreamStatus { name, transport, enabled, state, tools: usize, restarts: u32,
                            last_error: Option<String>, retry_at: Option<String>, server: Option<Value> }  // serde camelCase

pub trait Upstream: Send + Sync {
    fn name(&self) -> &str;
    fn list_tools(&self) -> BoxFut<'_, Result<Vec<ToolDef>, UpstreamError>>;      // unfiltered, all pages
    fn call<'a>(&'a self, tool: &'a str, args: Value) -> BoxFut<'a, Result<Value, UpstreamError>>;  // unwrapped result
    fn status(&self) -> UpstreamStatus;                                            // connection view; manager overlays
    fn tools_changed(&self) -> bool { false }                                      // true once after list_changed
    fn redact(&self, text: String) -> String { text }
    fn shutdown(&self) -> BoxFut<'_, ()> { no-op }
}
pub trait Connector: Send + Sync {
    fn connect<'a>(&'a self, spec: &'a ResolvedUpstream) -> BoxFut<'a, Result<Arc<dyn Upstream>, UpstreamError>>;
}
pub struct McpConnector;   // Stdio -> StdioClient::connect, Http -> HttpClient::connect
pub struct T3Upstream;     // T3Upstream::new(Arc<dyn T3Client>)

pub fn qualified(ns, tool) -> String;                          // "ns.tool"
pub fn split_qualified(&str) -> Option<(&str, &str)>;          // splits at the FIRST '.'
pub fn redact_secrets(String, &[Secret]) -> String;            // secrets shorter than MIN_SECRET_LEN are skipped
pub fn unwrap_call_result(qualified, &Value) -> Result<Value, UpstreamError>;
}

unwrap_call_result: isError gives Tool("ns.tool: <text, cut at 1000>"); else structuredContent when present; else, when every content part is text, the joined text parsed as JSON (or the string); else the content array as is.

BoxFut is crate::t3::BoxFut (Pin<Box<dyn Future + Send>>). Every future a builder returns, including those of async fns on UpstreamManager, must be Send: App awaits them inside 'static + Send host futures.

client (client_stdio.rs, client_http.rs)

#![allow(unused)]
fn main() {
impl StdioClient { pub async fn connect(spec: &ResolvedUpstream) -> Result<StdioClient, UpstreamError>; pub fn pid(&self) -> Option<u32>; }
impl HttpClient  { pub async fn connect(spec: &ResolvedUpstream) -> Result<HttpClient, UpstreamError>;  pub fn session_id(&self) -> Option<String>; }
impl Upstream for StdioClient / HttpClient
}

connect finishes the handshake before returning: initialize with {protocolVersion: MCP_PROTOCOL_VERSION, capabilities: {}, clientInfo: {name: CLIENT_NAME, version: CARGO_PKG_VERSION}}, a server protocolVersion in crate::mcp::SUPPORTED_VERSIONS (else Unavailable), then notifications/initialized. status().server is the server’s serverInfo. list_tools follows nextCursor (at most 50 pages). call sends tools/call {name, arguments} and returns unwrap_call_result(qualified(ns, tool), result). A JSON-RPC error answer to tools/call is Tool("ns.tool: <message>"); to initialize or tools/list, Unavailable. Requests are multiplexed by id; calls run concurrently. Server-to-client requests: ping answers {}, anything else answers -32601. Notifications: notifications/tools/list_changed sets the tools_changed flag; others are ignored. Each request is bounded by spec.timeout (Timeout("ns.tool: timed out after N ms")); the connection is kept (stdio sends notifications/cancelled). Every error string passes through spec.redact before it leaves the client.

Stdio specifics: spawn with kill_on_drop, stdin/stdout piped, stderr drained continuously into a ring of the last STDERR_LINES lines (redacted; the last lines are appended to a connect failure and logged at debug, never at a higher level). The child gets only an allowlist of the service environment (client_stdio::INHERITED_ENV and LC_*; on Windows INHERITED_ENV and INHERITED_ENV_WINDOWS, matched in any case), plus the resolved env, and runs in its own process group, or its own Job Object on Windows. Non-JSON stdout lines are ignored. A dead child (EOF, write error, exit) fails every pending and later request with Unavailable("ns: process exited (<status>)") at once, no hang. shutdown: close stdin, wait up to 2 s, then kill.

HTTP specifics (Streamable HTTP only; the legacy HTTP+SSE transport is not supported): POST to url with the resolved headers, Content-Type: application/json, Accept: application/json, text/event-stream, MCP-Protocol-Version after initialize, and Mcp-Session-Id once issued. Responses are JSON or SSE (read events until the response with the request’s id). 202 for notifications. 404 while holding a session id: re-initialize once and resend once. 401/403: Unavailable("ns: HTTP 401 unauthorized") with no header values. Other non-2xx: Unavailable with the status and the first 300 chars of the body, redacted. Connect timeout 10 s. No proxy for loopback hosts. shutdown sends DELETE with the session id, best effort.

manager (manager.rs, config.rs)

#![allow(unused)]
fn main() {
// config.rs
pub fn validate(upstreams: &[UpstreamConfig]) -> anyhow::Result<()>;
pub fn validate_name(name: &str) -> anyhow::Result<()>;
pub fn parse_references(raw: &str) -> anyhow::Result<Vec<Reference>>;
pub fn has_reference(raw: &str) -> bool;
pub fn resolve_value(raw: &str) -> Result<Secret, UpstreamError>;                 // Config on failure
pub fn resolve(cfg: &UpstreamConfig) -> Result<ResolvedUpstream, UpstreamError>;  // Config on failure
pub fn glob_match(pattern: &str, name: &str) -> bool;
impl ToolFilter { pub fn new(allow: &[String], deny: &[String]) -> ToolFilter; pub fn allows(&self, tool: &str) -> bool; }

// manager.rs
impl UpstreamManager {
    pub fn new(configs: Vec<UpstreamConfig>) -> UpstreamManager;                   // McpConnector; no I/O, no spawn
    pub fn with_connector(configs: Vec<UpstreamConfig>, connector: Arc<dyn Connector>) -> UpstreamManager;
    pub fn empty() -> UpstreamManager;
    pub fn namespaces(&self) -> Vec<String>;                                       // enabled, config order
    pub fn is_namespace(&self, ns: &str) -> bool;
    pub async fn tools(&self) -> Vec<(String, Vec<ToolDef>)>;                      // lazy connect, filtered
    pub fn cached_tools(&self) -> Vec<(String, Vec<ToolDef>)>;                     // no I/O, filtered
    pub fn generation(&self) -> u64;
    pub async fn refresh(&self) -> Vec<(String, Result<usize, String>)>;
    pub async fn call(&self, ns: &str, tool: &str, args: Value) -> Result<Value, UpstreamError>;
    pub fn status(&self) -> Vec<UpstreamStatus>;                                   // every configured upstream, config order
    pub fn redact(&self, text: String) -> String;
    pub async fn shutdown(&self);
}
}

validate errors name the upstream (upstreams[2] "linear": ...) and the field. resolve expands ~, resolves the command (/, or \ on Windows, in it: a path; else PATH, then $HOME/.local/bin; on Windows each PATHEXT extension is tried too; not found is Config naming the command), resolves references, checks cwd exists, and fills secrets.

Lifecycle per upstream (UpstreamState):

  • Disabled (enabled: false): not a namespace, never connects; call gives UnknownNamespace. It still appears in status().
  • Idle until first use. Nothing connects in new. tools(), call and refresh connect lazily: resolve then Connector::connect then list_tools, all under CONNECT_TIMEOUT. Connects are single-flight: concurrent callers share one attempt. tools() connects all idle or due upstreams concurrently.
  • Ready after a successful connect and list.
  • Backoff after any Unavailable (from connect, list or call), a Config from resolve, or a connect timeout: the connection is dropped (shutdown()), restarts += 1, last_error set (redacted), and retry_at = now + delay, where the delay is 0 for the first consecutive failure, then BACKOFF_MIN doubling up to BACKOFF_MAX. Before retry_at, call fails fast with Unavailable("ns is unavailable (retry at <ISO time>): <last error>") and tools() does not reconnect it. After retry_at the next use reconnects. A successful connect resets the failure count.
  • A failed call is never retried automatically (tools need not be idempotent). Tool, Timeout, Denied and UnknownTool do not touch the connection.
  • call wraps the upstream call in tokio::time::timeout(timeout_ms) as a backstop (Timeout("ns.tool: timed out after N ms")).
  • After each call and in tools()/refresh(), tools_changed() true means re-list. generation() increases whenever any upstream’s filtered list changes, including its first listing. cached_tools() keeps the last list through Backoff, so search still shows the tools.
  • Duplicate tool names in one upstream’s list: the first wins.
  • call order of checks: unknown namespace (UnknownNamespace("unknown namespace \"x\"; namespaces are t3, cbm")); filter (Denied("ns.tool is not allowed by the t3-codemode config for upstream ns; do not retry it"), without contacting the upstream); backoff; connect if needed; unknown tool against the known list (UnknownTool("unknown tool ns.tool; use the search tool to find the right name"), without calling); then the call.
  • redact applies every secret resolved so far, for every upstream, plus each live connection’s redact. status().last_error is always redacted.
  • No lock is held across an await on an upstream call.
  • shutdown calls shutdown() on every live connection, concurrently.

catalog (catalog.rs, app.rs, mcp.rs, server.rs /healthz, sandbox.rs and types.rs only if needed, README.md)

#![allow(unused)]
fn main() {
pub struct Entry { name, kind: &'static str, server: String, description, signature, input_schema }   // server added
pub struct Catalog { entries, t3_names, upstream_names: BTreeMap<String, BTreeSet<String>>, json }       // upstream_names added
impl Catalog {
    pub fn build(t3_tools: &[Value]) -> Catalog;                                     // unchanged behavior = build_with(t3, &[])
    pub fn build_with(t3_tools: &[Value], upstreams: &[(String, Vec<ToolDef>)]) -> Catalog;
    pub fn declarations(&self) -> String;
}
impl App {
    pub fn new(config, store, t3, clock) -> Arc<App>;                                // unchanged signature
    pub fn with_upstreams(config, store, t3, clock, upstreams: Arc<UpstreamManager>) -> Arc<App>;
}
}
  • Entries: T3 tools first (name unchanged, kind: "t3", server: "t3"), then upstream tools grouped by namespace in config order and tool order as listed (name: "ns.tool", kind: "mcp", server: ns), then the built-ins (server = their kind: mem or wf). signature uses ns.<tool> when the raw tool name is an identifier, else ns["raw-name"].
  • declarations(): the existing t3 block unchanged, then one declare const <ns>: { ...signatures...; call(name: string, input?: object): Promise<unknown>; }; per upstream, then declare const tools: { call(name: string, input?: object): Promise<unknown>; };, then the built-ins.
  • execute globals: t3, one frozen, non-writable, non-configurable global per enabled upstream namespace (from upstreams.namespaces(), present even before its tool list is known), tools, mem, vars, wf, console. An upstream global has each tool by exact name, a sanitized alias (types::sanitize_identifier) when it differs and collides with nothing, and call(name, input). tools.call("ns.tool", input) reaches any namespace including t3 (which keeps the t3_ alias and config.deny). The ReferenceError hint lists the real globals in that order.
  • Host side: one op for upstream calls; t3 goes to the existing path, any other namespace to upstreams.call. Input undefined/null becomes {}; a non-object is ns.tool(input): input must be an object. Every error and the final output pass through t3.redact and upstreams.redact.
  • Catalog freshness: catalog_for_run calls upstreams.tools() (lazy connect; returns at once for upstreams in backoff) and rebuilds when upstreams.generation() differs from the generation the current catalog was built from. refresh_catalog keeps its T3 return value and also calls upstreams.refresh() (the watcher already calls it every 10 minutes).
  • mcp.rs descriptions: identical bytes for every caller and every request for a given config. They describe upstreams generically (kind: "mcp", server, <namespace>.<tool>(input), tools.call("ns.tool", input)) and may list the enabled namespace names from config; never connection state, tool counts or anything per caller. With no upstreams they still read correctly.
  • /healthz adds "upstreams": upstreams.status(); every existing key stays.
  • README: document the upstreams config, references, globals and /healthz.

4. Namespacing and identifier rules

  • name matches ^[a-z][a-z0-9_]{0,31}$.
  • Not in RESERVED_NAMES (t3, mem, vars, wf, console, tools, catalog), not in RESERVED_JS, and not a JS reserved word (types::sanitize_identifier(name) == name must hold).
  • Unique across upstreams (disabled ones included).
  • Catalog names: T3 tools keep their bare names (t3_thread_send); upstream tools are ns.tool; built-ins are mem.*, wf.*, vars. Reserved namespaces make these disjoint.

5. Collision rules

CaseResult
upstream named like a reserved name, keyword or another upstreamconfig error, service does not start
two tools in one upstream with the same namefirst wins
raw tool name not an identifier (get-thing)ns["get-thing"], alias ns.get_thing if free
two tools sanitize to the same aliasno alias for either; both by exact name
alias equals another tool’s exact namethe exact name wins; no alias
a tool named callns.call is the method; reach the tool with ns.call("call", input) or tools.call("ns.call", input)
a tool name with dots (a.b)ns["a.b"]; tools.call("ns.a.b") splits at the first dot
denied tool (allow/deny)absent from catalog and global; calls give Denied

6. Error semantics

VariantRaised byMessage shapeConnectionIn the sandbox
Toolclient (isError, JSON-RPC error on call)ns.tool: <text>keptthrows Error(message)
Timeoutclient, manager backstopns.tool: timed out after N mskeptthrows
Unavailableclient (spawn, I/O, exit, HTTP status), manager (backoff)ns: <reason> / ns is unavailable (retry at T): <last>dropped, backoffthrows
Configresolve (unset env, unreadable file, missing command or cwd)ns: env var NAME is not setbackoffthrows
Deniedmanager filter... do not retry ituntouchedthrows
UnknownToolmanagerunknown tool ns.tool; use the search tool ...untouchedthrows
UnknownNamespacemanager, tools.callunknown namespace "x"; namespaces are ...n/athrows

Static config errors (validate) fail Config::load, as today. No message ever contains a resolved secret or the code being run.

7. Ownership

BuilderOwns (may edit)
clientsrc/upstream/client_stdio.rs, src/upstream/client_http.rs, tests/upstream_client.rs, tests/support/fake_mcp_server.rs (the t3cm-fake-mcp bin, declared), any new file under tests/support/
managersrc/upstream/manager.rs, src/upstream/config.rs, tests/upstream_manager.rs
catalogsrc/catalog.rs, src/app.rs, src/mcp.rs, src/server.rs (/healthz only), src/sandbox.rs and src/types.rs only if needed, README.md, tests/upstream_catalog.rs

Frozen for all three: Cargo.toml, Cargo.lock, src/lib.rs, src/config.rs, src/main.rs, src/upstream/mod.rs, src/upstream/fake.rs, tests/common/, every existing test file, and this contract. A builder that needs a change there stops and asks. Public signatures listed above do not change; private items are free. Every builder keeps CARGO_BUILD_JOBS=8 cargo test, cargo clippy --all-targets (no warnings) and cargo fmt --check clean; no code comments; no em dashes.

Test fixtures available to everyone: upstream::fake::{FakeUpstream, FakeConnector, tool}. FakeConnector::connect records the ResolvedUpstream (last_spec), counts connects, can refuse(name, Some(msg)), and brings a set_down(true) fake back up on reconnect. FakeUpstream answers its listed tools with {server, tool, args}, takes canned reply(tool, result), set_delay, set_tools (raises tools_changed), and records calls() and shutdowns().

Dependencies available: reqwest (json, stream, rustls-tls), futures-util, tokio (process, io-util, time, sync, net, …), serde_json (preserve_order), axum (dev: form), tempfile (dev).

8. Acceptance tests

client: tests/upstream_client.rs

The fake server is env!("CARGO_BIN_EXE_t3cm-fake-mcp"); its tools and behaviors are the client builder’s to design (suggested: echo, structured, image, fail, rpc_error, sleep{ms}, crash, env{name}, fail_with_env{name}, notify_changed, ping_first, two pages of tools/list). HTTP tests use an in-process axum server.

  1. Stdio connect completes the handshake; status().server is the fake’s serverInfo; list_tools returns both pages.
  2. call returns structuredContent, parsed text JSON, plain text, and the raw content array for non-text content.
  3. isError and a JSON-RPC error both give Tool starting ns.tool:.
  4. Ten concurrent calls with different sleep values all resolve to their own results.
  5. A server ping sent mid-call is answered and the call completes.
  6. list_changed makes tools_changed() true exactly once.
  7. A call past timeout gives Timeout; the next call on the same client succeeds.
  8. crash gives Unavailable; later calls fail at once with Unavailable.
  9. Configured env reaches the child; a secret echoed into an error or into stderr shows as [redacted] in the error and in status().last_error.
  10. A missing command gives Unavailable naming it.
  11. shutdown ends the child process within 3 s.
  12. HTTP: JSON and SSE responses; Mcp-Session-Id and MCP-Protocol-Version sent after initialize; configured headers sent; 404 re-initializes once and succeeds; 401 gives Unavailable naming 401 and not the header value; isError gives Tool.
  13. McpConnector dispatches by transport.

manager: tests/upstream_manager.rs

  1. The section 2 example parses through Config::from_value and validates; defaults apply (enabled, timeout_ms, allow).
  2. Each rejection: every reserved name, a keyword (class), uppercase, a bad char, 33 chars, a duplicate, transport/section mismatch, both sections, a bad URL scheme, ${ in command/args/url/cwd, malformed references (${env:}, ${foo:x}, unterminated), a literal Authorization header, a literal FOO_TOKEN env, timeout_ms out of range, an empty glob. Each error names the upstream and field.
  3. resolve: ${env:..} (test-unique variable), ${file:..} trimmed, "Bearer ${env:..}", $${ escape; unset variable gives Config naming the variable, not a value; secrets holds the resolved values; the Debug of a ResolvedUpstream contains no secret.
  4. glob_match and ToolFilter (deny wins).
  5. namespaces() is enabled-only in config order; a disabled upstream’s call gives UnknownNamespace.
  6. new/with_connector connect nothing (connects == 0) until first use.
  7. tools() is filtered; a denied call gives Denied and the fake records no call.
  8. An unknown tool gives UnknownTool without a call.
  9. set_down(true): the call gives Unavailable, status backoff, restarts == 1; the next call reconnects and succeeds. With refuse, the second consecutive failure sets retry_at at least 1 s ahead and calls before it fail fast without connecting; success resets the backoff.
  10. Ten concurrent first calls connect once.
  11. set_tools leads to a re-list and a higher generation(); cached_tools() keeps the last list during backoff.
  12. redact hides a resolved secret in any text; a refused connect whose message carries the secret is redacted in the error and in status().last_error.
  13. A fake delay past timeout_ms gives Timeout.
  14. shutdown() reaches each live connection.
  15. An unset env reference puts only that upstream in backoff with last_error naming the variable; the others work.

catalog: tests/upstream_catalog.rs

Pure catalog tests run on their own; App-level tests use App::with_upstreams with UpstreamManager::with_connector and a FakeConnector, and pass once the manager lands.

  1. build_with(fixture, [("cbm", [search_graph, get-thing])]): entries cbm.search_graph with kind: "mcp", server: "cbm"; T3 entries have server: "t3"; built-ins have server = kind; build(fixture) gives the same T3 entries in the same order as before; the get-thing signature uses cbm["get-thing"].
  2. declarations() holds declare const cbm: { and declare const tools: {.
  3. search: catalog.filter(t => t.server === "cbm") returns the fake’s tools.
  4. execute: cbm.search_graph(...), cbm["get-thing"]({}), cbm.get_thing({}), cbm.call("search_graph", {}), tools.call("cbm.search_graph", {}), and tools.call("t3.thread_list") (reaches FakeT3) all work; tools.call("t3.t3_project_delete") is still denied.
  5. Errors: a Tool error throws its message; a denied tool throws with “do not retry”; an unknown namespace via tools.call lists namespaces; a non-object input is rejected.
  6. typeof cbm === "object", and it cannot be reassigned or redefined; a disabled upstream is not a global; a ReferenceError lists the upstream namespaces and tools.
  7. A result or error containing a resolved secret comes back [redacted].
  8. tools/list is byte-identical with and without X-T3-Thread and across two requests; it mentions upstreams; with no upstreams it is still valid.
  9. /healthz has upstreams with name, state and tools, and every old key.
  10. After the fake’s set_tools, the next search sees the new tool.
  11. Every pre-existing test still passes unchanged.

Contributing

Bug reports, fixes, tests, documentation, ports to other platforms and new upstream integrations are welcome. Start with the contribution guide. It covers the DCO signoff every commit carries (git commit -s), how pull requests merge, and what the project will not take.

Report vulnerabilities privately through the security policy. Participation follows the Code of Conduct. The code is under the MIT license.

Checks

Run the checks CI runs, from the repository root:

cargo fmt --check
cargo clippy --all-targets -- -D warnings
cargo test --locked
python3 -m unittest discover -s tests/skills -v
shellcheck deploy/*.sh              # when you change an installer
actionlint                          # when you change a workflow

To change the installers or workflows, also install ShellCheck and actionlint. deploy/install.ps1 must run on Windows PowerShell 5.1. The contribution guide shows how to try install.sh against a scratch HOME.

The test suite runs against an in-process fake T3 and fake MCP servers, so most work needs no T3 Code server. tests/fixtures/t3-tools.json is a snapshot of T3’s 74 tools. At runtime the catalog comes live from tools/list, refreshed every 10 minutes and cached in the store for when T3 is down.

Fault rules

FakeT3 and FakeGitHub fail or hold calls by rule. A rule names an op, an optional target, and the matching call it fires on. The op is a T3 tool such as t3_thread_send, or a GitHub operation such as read or mergePullRequest, and * matches every call. The target is a thread id on T3, or owner/name#number on GitHub:

#![allow(unused)]
fn main() {
h.github.fault(Rule::on("read").pr("acme/widgets", 7).call(1).fail(Failure::refused("try again")));
h.fake.fault(Rule::on("t3_thread_send").fail_after_effect(Failure::down("reply lost")));
}

A gate holds one call while the test runs another, on a harness with no other t3_thread_send rule:

#![allow(unused)]
fn main() {
let gate = Gate::new();
h.fake.fault(Rule::on("t3_thread_send").call(1).gate(&gate));
let parked = h.fake.call("t3_thread_send", json!({"threadId": "mcp:a", "message": "first"}));
let race = async {
    gate.arrived().await;
    h.fake.call("t3_thread_send", json!({"threadId": "mcp:b", "message": "second"})).await.unwrap();
    gate.release();
};
let (parked, ()) = tokio::join!(parked, race);
}
  • fail returns the error before the call takes effect.
  • fail_after_effect applies the call, then returns the error.
  • gate parks the call until release(), and arrived() waits for it to park. A call that matches two gates arrives at both before it waits on either.

The op reconcile.pr targets one pull request inside the batched reconcile read, and a Failure::typed there keeps its type on that pull request’s error. After alias_repo, a pull request target matches the repository’s old name and its new one. set_jitter(Some(seed)) adds seeded yield_now() calls to every fake call, and the concurrent chaos tests pass their seed.

A hidden bench command measures latency and RSS against the in-process fake T3:

t3cm bench -n 1000 --tools tests/fixtures/t3-tools.json

Thread lifecycle

FakeT3 reads the test clock, H::clock, so a thread’s run lasts in virtual minutes:

  • start_run(id, Some(minutes)) sets the thread running. Once the clock passes that many minutes it reads idle, with updatedAt at the run’s end. None runs until finish_run.
  • run_on_send(id, minutes) starts a run on every t3_thread_send to the thread, or pushes out the end of the run already going.
  • finish_run(id, status) ends the run as idle, completed, failed, interrupted or cancelled.
  • archive(id) archives the thread, and remove(id) deletes it.
#![allow(unused)]
fn main() {
h.fake.run_on_send(WORKER, 20);
h.wf(TICKET, "reply", json!({"to": WORKER, "body": "rebase"})).await; // Sent. The worker runs for 20 minutes.
h.wf(TICKET, "reply", json!({"to": WORKER, "body": "lint"})).await; // Queued in the outbox.
h.tick(21).await; // The run has ended, so the watcher delivers the queued reply.
}

tests/all/lifecycle.rs drives each watcher branch this reaches and checks its Reach counter: OutboxHeld, StallReported, IdleEscalated, BadEndNudged, WorkerArchived, WorkerThreadGone, TicketArchived and TicketThreadGone.

GitHub pull request state

FakeGitHub keeps each pull request’s state and changes it the way GitHub does:

CallEffect
push(repo, n, head)Moves the head, starts a pending ci check on it, and takes the pull request out of the merge queue.
set_status(repo, n, merge_state, draft)Sets the merge state and the draft flag.
set_checks(repo, n, checks)Replaces the check runs on the head.
set_queue(repo, n, enabled, queued)Turns the merge queue on or off for the pull request, and adds it to the queue or takes it out.
drop_from_queue(repo, n, reason, at)Takes it out of the queue with a timeline reason.
advance_queue(repo, at)Merges the pull request at the front of the queue and moves the rest up.
finish(repo, n, state, at, commit)Merges or closes it and takes it out of the queue.
reopen(repo, n)Reopens a closed pull request.
reassign_id(repo, n)Gives it a new node ID, so a merge by the old ID fails.

enqueuePullRequest and mergePullRequest work on the same queue, and queue positions follow queue order. The chaos tests change GitHub only through these calls, and after each op pr_chaos checks that the fake matches the shadow model.

Chaos testing

tests/all/pr_chaos.rs runs seeded Swarm-weighted sequential chaos and concurrent race tests against the shadow model, and it replays every committed NDJSON op list in tests/chaos_corpus/*.ops. Among its ops, a ticket calls wf.merge, the merge queue merges its front pull request, and a worker’s run ends completed, failed, interrupted or cancelled.

VariableEffect
CHAOS_SEED=<n>Run one seed in seeded_sequential_chaos or concurrent_chaos.
CHAOS_SEED_START=<n>, CHAOS_SEEDS=<k>Run k seeds starting at n. Defaults are 150 sequential seeds and 30 concurrent seeds.
CHAOS_REACH=1Print ReachSnapshot and OpStats execution coverage after sequential chaos.
CHAOS_SHRINK=1On a sequential failure, run 1-minimal ddmin and value simplification, write tests/chaos_corpus/<hash>.ops or $CHAOS_CORPUS_DIR/<hash>.ops, and print a ready-to-paste #[tokio::test].
CHAOS_OPS=<path>Replay one .ops file in pr_chaos::seeded_sequential_chaos. Combines with CHAOS_SHRINK=1.
CHAOS_SENTINEL=<name>With --features test-sentinels, enable one planted sentinel during seeded or CHAOS_OPS runs.

Examples:

# Shrink a failing seed into tests/chaos_corpus/<hash>.ops
CHAOS_SHRINK=1 CHAOS_SEED=42 cargo test --locked --test all pr_chaos::seeded_sequential_chaos -- --nocapture

# Replay one saved .ops file
CHAOS_OPS=tests/chaos_corpus/<hash>.ops cargo test --locked --test all pr_chaos::seeded_sequential_chaos -- --nocapture

# Run the planted-sentinel acceptance and shrink checks
cargo test --locked --features test-sentinels --test all sentinel_acceptance -- --nocapture

pr_chaos::chaos_corpus_replays_cleanly replays every .ops file committed under tests/chaos_corpus/ during plain cargo test --locked. The NDJSON loader ignores blank lines and # comment lines, so a file can carry # source: and # failure: headers above its ops.

Nightly chaos

.github/workflows/chaos-nightly.yml runs every night on Linux, and on demand from the Actions tab. It has three parts:

  • Swarm sweep. 200,000 sequential seeds in a release build, split across the runner’s cores with each shard’s temporary files on /dev/shm. The first seed is the last eight digits of the run ID times the seed count, so runs sweep different ranges until those digits repeat. A failing shard’s seed is shrunk with CHAOS_SHRINK=1, and the chaos-failures artifact holds one <hash>/ folder per distinct shrunk .ops file. Each folder has the .ops file, the shrink log, a replay trace and the seeds that shrank to it. The job summary lists each hash and the Reach hit rates per 1,000 seeds.
  • Coverage and reach. cargo-llvm-cov line and region coverage of src/ by the pr_chaos tests, with the text summary and the Reach table in the job summary and an lcov.info in the chaos-coverage artifact.
  • Mutation grading. cargo-mutants, configured in .cargo/mutants.toml, mutates src/reconcile.rs, src/wf_pr.rs, src/merge.rs, src/board.rs and src/wf.rs and grades each mutant with the pr_chaos tests only, so a survivor is a change the chaos oracle does not notice. Eight shards run in parallel, and the mutants-survivors artifact collects missed.txt and timeout.txt.

A dispatch can set the seed count, the first seed, and a planted sentinel. A sentinel builds with test-sentinels, so the sweep fails on purpose and shows the shrink path working. To promote a failure, download its .ops file, check that it replays, and commit it under tests/chaos_corpus/ with the fix:

CHAOS_OPS=<hash>.ops cargo test --locked --test all pr_chaos::seeded_sequential_chaos_holds_all_invariants -- --exact --nocapture

The workflow does not file issues. A later job could read the hashes from the chaos-failures artifact and open or comment on one tracking issue per hash, with issues: write granted to that job alone.

Diff mutation check

.github/workflows/mutants-diff.yml runs the same mutation grading on a pull request, limited to the lines the PR changes. It starts only when the PR touches a Rust file under src/, .cargo/mutants.toml, or the workflow and its scripts, and its first step skips the rest when none of the changed files is in .cargo/mutants.toml’s examine_globs. Otherwise it diffs the merge commit against the base it was merged onto, runs cargo mutants --in-diff with the mutants profile and the pr_chaos tests, and writes the caught, missed, timeout and unviable counts per file to the job summary, with each missed and timed-out mutant listed below the table. The mutants-diff artifact holds the same files.

The check is advisory. It runs in its own workflow, outside the required check job in ci.yml, and it passes when mutants survive. It fails only when cargo-mutants itself fails, such as when the unmutated tree does not build. Expect survivors in src/board.rs rendering code, which the chaos tests do not reach. A survivor in code your PR adds is worth a look: either a pr_chaos invariant should notice the change, or the line is outside what the chaos oracle checks. It needs no secrets and runs with contents: read, so it works the same on pull requests from forks.

Fuzzing

fuzz/ holds a cargo-fuzz target, decode_ops, that decodes libFuzzer’s bytes into a chaos program with OpWeights::UNIFORM and runs it through the pr_chaos sequential executor and oracle on the in-memory store. It includes tests/common/mod.rs and tests/all/pr_chaos.rs with #[path], so it checks the same invariants as the Swarm sweep, and it is its own workspace, so cargo test never builds it. It needs a nightly toolchain and cargo install --locked cargo-fuzz@0.13.2:

cd fuzz
cargo +nightly fuzz run decode_ops -- -max_total_time=300 -max_len=768

The default build uses AddressSanitizer, which also instruments the bundled SQLite and QuickJS C code on x86_64 Linux. -s none runs two to three times faster, which suits a session that hunts oracle failures and can do without the memory checks. FUZZ_FILE_STORE=1 switches to the file-backed store, and FUZZ_DUMP_OPS=1 prints each input as an .ops file, which turns a crasher into a CHAOS_OPS replay for the shrinker.

.github/workflows/fuzz-nightly.yml runs the target for 30 minutes every night on Linux, from the cached corpus plus 16 random 768-byte inputs, keeps the corpus in the Actions cache from one run to the next, and uploads crashers, with their .ops files, as the fuzz-crashers artifact. docs/research/decode-ops-fuzzing-2026-11.md has the exec/s measurements and the sanitizer results.

This site

docs/build.sh generates the API reference page from t3cm types, then builds the site into docs/book/ with mdBook 0.5.4. CI builds it on every pull request, checks its links with lychee, and deploys it to GitHub Pages from main. The pages are Markdown under docs/src/, and docs/src/SUMMARY.md lists them in order.