Overview
The orchestration schemas define the core domain model for T3 Code’s event-sourced architecture. These schemas handle projects, threads, messages, turns, and provider sessions using Effect Schema for validation and type safety.Core Domain Models
OrchestrationProject
Represents a workspace project with configuration and scripts.Unique project identifier
Project display name
Absolute path to the workspace root directory
Default AI model for new threads in this project
Configured project scripts (build, test, lint, etc.)
Project creation timestamp
Last update timestamp
Soft deletion timestamp
ProjectScript
Configurable script that can be run in the project context.Script identifier
Display name
Shell command to execute
Icon identifier:
"play" | "test" | "lint" | "configure" | "build" | "debug"Whether to automatically run when creating a new worktree
OrchestrationThread
A conversation thread with an AI provider.Unique thread identifier
Parent project ID
Thread title
AI model slug for this thread
Runtime mode:
"approval-required" | "full-access"Interaction mode:
"default" | "plan"Git branch associated with this thread
Git worktree path if using worktrees
Current or most recent turn state
All messages in the thread
Plans proposed by the assistant (when in plan mode)
Activity log (tool calls, approvals, errors)
Git checkpoints for rollback
Active provider session
Thread creation timestamp
Last update timestamp
Soft deletion timestamp
OrchestrationMessage
A single message in a thread conversation.Unique message identifier
Message role:
"user" | "assistant" | "system"Message content
Attached images or files
Associated turn ID
Whether the message is currently streaming
Message creation timestamp
Last update timestamp
OrchestrationSession
Active provider session state.Associated thread ID
Session status:
"idle" | "starting" | "running" | "ready" | "interrupted" | "stopped" | "error"Provider name (e.g., “codex”)
Current runtime mode
Currently active turn ID
Last error message if status is “error”
Last update timestamp
Commands
Thread Commands
Commands for managing threads and turns.ThreadTurnStartCommand
Starts a new turn in a thread.Command type discriminator
Unique command identifier
Target thread ID
ID for the user message
User input text (max 120,000 characters)
Attached images (max 8 attachments)
Override model for this turn
Service tier for the turn
Model-specific options
How to deliver assistant responses
Runtime mode for this turn
Interaction mode for this turn
ThreadTurnInterruptCommand
Interrupts an active turn.ThreadApprovalRespondCommand
Responds to an approval request from the provider.Approval decision:
"accept" | "acceptForSession" | "decline" | "cancel"Project Commands
ProjectCreateCommand
Creates a new project.Events
Event Types
All orchestration events:Event Structure
All events share these base fields:Global event sequence number
Unique event identifier
Type of aggregate this event belongs to
Aggregate root ID
Event occurrence timestamp
Command that caused this event
Event that caused this event
Correlation ID for event chain (equals commandId)
Additional metadata (provider turn ID, adapter key, etc.)
Event Payloads
ThreadCreatedPayload
ThreadMessageSentPayload
Read Model
OrchestrationReadModel
The current state projection of all projects and threads.RPC Schemas
WebSocket Methods
Method Schemas
Usage Examples
Dispatching a Command
Reading the Snapshot
Handling Events
Constants
Validation Limits
Default Values
Related Types
See also:- Base Schemas - Primitive type definitions
- Model Contracts - Model configuration types
- Provider Types - Provider session types
