Overview
Commands are the primary way to modify system state in T3 Code. Each command is validated, processed by the orchestration engine, and results in one or more domain events.Command Structure
All commands share these base fields:string
required
Command type discriminator (e.g.,
"project.create")string
required
Unique command identifier (UUID)
string
ISO 8601 timestamp (required for most commands)
Project Commands
Manage project lifecycle and metadata.project.create
Create a new project.literal
default:"project.create"
string
required
string
required
New project identifier (UUID)
string
required
Project display name
string
required
Absolute path to project directory
string
Default AI model (e.g.,
"gpt-5-codex")string
required
ISO 8601 timestamp
Example
project.meta.update
Update project metadata.literal
default:"project.meta.update"
string
required
string
required
Target project identifier
string
New project title (optional)
string
New workspace root path (optional)
string
New default model (optional)
array
New project scripts array (optional)
Example
project.delete
Soft-delete a project.literal
default:"project.delete"
string
required
string
required
Project to delete
Example
Thread Commands
Manage conversation threads and their lifecycle.thread.create
Create a new conversation thread.literal
default:"thread.create"
string
required
string
required
New thread identifier (UUID)
string
required
Parent project ID
string
required
Thread display name
string
required
AI model to use (e.g.,
"gpt-5-codex")'approval-required' | 'full-access'
required
Permission level for provider
'default' | 'plan'
required
Provider interaction style (default:
"default")string | null
Git branch name
string | null
Git worktree path
string
required
ISO 8601 timestamp
Example
thread.delete
Soft-delete a thread.literal
default:"thread.delete"
string
required
string
required
Thread to delete
thread.meta.update
Update thread metadata.literal
default:"thread.meta.update"
string
required
string
required
string
New title (optional)
string
New model (optional)
string | null
New branch (optional)
string | null
New worktree path (optional)
thread.runtime-mode.set
Change thread runtime permission mode.literal
default:"thread.runtime-mode.set"
string
required
string
required
'approval-required' | 'full-access'
required
New runtime mode
string
required
Runtime Modes
approval-required
Provider must request approval for file changes and commands
full-access
Provider can execute file changes and commands without approval
thread.interaction-mode.set
Change thread interaction style.literal
default:"thread.interaction-mode.set"
string
required
string
required
'default' | 'plan'
required
New interaction mode
string
required
Interaction Modes
default
Standard back-and-forth conversation with immediate execution
plan
Provider proposes a plan before execution (Codex-specific)
thread.turn.start
Start a new turn (user message + provider response).literal
default:"thread.turn.start"
string
required
string
required
object
required
User message to send
'codex'
Provider to use (optional, defaults to project default)
string
Model to use (optional)
'fast' | 'flex' | null
Service tier for provider (optional)
'buffered' | 'streaming'
How to deliver assistant messages (optional)
'approval-required' | 'full-access'
required
Runtime mode for this turn
'default' | 'plan'
required
Interaction mode for this turn
string
required
Example
The client sends attachments as base64 data URLs. The server persists them and converts to attachment references.
thread.turn.interrupt
Interrupt the currently running turn.literal
default:"thread.turn.interrupt"
string
required
string
required
string
Specific turn to interrupt (optional, defaults to active turn)
string
required
Example
thread.approval.respond
Respond to a provider approval request.literal
default:"thread.approval.respond"
string
required
string
required
string
required
Approval request identifier
'accept' | 'acceptForSession' | 'decline' | 'cancel'
required
User’s approval decision
string
required
Approval Decisions
accept
Approve this specific action
acceptForSession
Approve this action and all similar ones for the session
decline
Reject this action
cancel
Cancel the entire turn
thread.user-input.respond
Respond to a provider user input request.literal
default:"thread.user-input.respond"
string
required
string
required
string
required
User input request identifier
object
required
Key-value map of answers to provider questions
string
required
thread.checkpoint.revert
Revert the thread to a previous checkpoint.literal
default:"thread.checkpoint.revert"
string
required
string
required
number
required
Number of turns to revert (from end)
string
required
Example
thread.session.stop
Stop the active provider session for a thread.literal
default:"thread.session.stop"
string
required
string
required
string
required
Internal Commands
These commands are dispatched by the server internally and are not available to clients:thread.session.set- Update session statethread.message.assistant.delta- Append streaming assistant message chunkthread.message.assistant.complete- Mark assistant message completethread.proposed-plan.upsert- Update proposed planthread.turn.diff.complete- Record turn checkpointthread.activity.append- Add activity log entrythread.revert.complete- Confirm checkpoint revert
Dispatch Example
To dispatch a command via WebSocket:Source Code
Command schemas are defined in:- Contracts:
packages/contracts/src/orchestration.ts:281-555 - Command Handler:
apps/server/src/orchestration/commandHandlers.ts - Dispatch Route:
apps/server/src/wsServer.ts:688-692
Validation
All commands are validated using Effect Schema:- String IDs are trimmed and checked for non-empty
- Timestamps are validated as ISO 8601
- Enum fields are checked against allowed values
- Image attachments are size-limited (10MB max)
- Turn count ranges are validated (fromTurnCount ≤ toTurnCount)
Next Steps
Events
Learn about domain events resulting from commands
Orchestration API
Explore queries and read model
