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:Command type discriminator (e.g.,
"project.create")Unique command identifier (UUID)
ISO 8601 timestamp (required for most commands)
Project Commands
Manage project lifecycle and metadata.project.create
Create a new project.New project identifier (UUID)
Project display name
Absolute path to project directory
Default AI model (e.g.,
"gpt-5-codex")ISO 8601 timestamp
Example
project.meta.update
Update project metadata.Target project identifier
New project title (optional)
New workspace root path (optional)
New default model (optional)
New project scripts array (optional)
Example
project.delete
Soft-delete a project.Project to delete
Example
Thread Commands
Manage conversation threads and their lifecycle.thread.create
Create a new conversation thread.New thread identifier (UUID)
Parent project ID
Thread display name
AI model to use (e.g.,
"gpt-5-codex")Permission level for provider
Provider interaction style (default:
"default")Git branch name
Git worktree path
ISO 8601 timestamp
Example
thread.delete
Soft-delete a thread.Thread to delete
thread.meta.update
Update thread metadata.New title (optional)
New model (optional)
New branch (optional)
New worktree path (optional)
thread.runtime-mode.set
Change thread runtime permission mode.New runtime mode
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.New interaction mode
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).User message to send
Provider to use (optional, defaults to project default)
Model to use (optional)
Service tier for provider (optional)
How to deliver assistant messages (optional)
Runtime mode for this turn
Interaction mode for this turn
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.Specific turn to interrupt (optional, defaults to active turn)
Example
thread.approval.respond
Respond to a provider approval request.Approval request identifier
User’s approval decision
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.User input request identifier
Key-value map of answers to provider questions
thread.checkpoint.revert
Revert the thread to a previous checkpoint.Number of turns to revert (from end)
Example
thread.session.stop
Stop the active provider session for a thread.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
