The proposed runtime contract is a narrow layer that sits above model and tool SDKs and below heavier orchestration or product-specific shells. Its purpose is to standardize execution semantics for coding agents without dictating product UX or business-domain logic.
TaskTurnToolCallToolResultCompletionAttemptRecoveryAttemptAgentStateRequiredActionContextCompactionSubagentRunPolicyDecisionJournalEvent
- A task is not complete merely because the model says so.
- Completion must be explicit and guarded.
- Tool failures remain part of task state unless classified as terminal by runtime or policy.
- Runtime state must be inspectable independently of the transcript.
- Context management is part of the runtime contract.
- Delegation must be bounded and observable.
- Policy interception should exist at tool and stop boundaries.
- Domain-specific rules belong above or beside the runtime core.
- Create task.
- Build initial runtime context.
- Enter turn loop.
- Execute tools or handle required actions.
- Reinject results.
- Evaluate completion attempts.
- Compact or checkpoint when needed.
- Stop only when completion is accepted or an explicit blocker is raised.
type AgentState =
| 'idle'
| 'running'
| 'streaming'
| 'waiting_for_permission'
| 'waiting_for_input'
| 'compacting'
| 'resumable'
| 'completed'
| 'failed_terminal';
interface RuntimeTask {
id: string;
goal: string;
state: AgentState;
openRequirements: RequiredAction[];
journal: JournalEvent[];
}
interface ToolResult {
callId: string;
status: 'success' | 'failure';
output?: string;
errorType?: string;
retryable?: boolean;
}
interface CompletionDecision {
accepted: boolean;
reasons: string[];
}- task lifecycle,
- execution loop,
- completion gating,
- failure reinjection,
- state transitions,
- compaction hooks,
- subagent contracts,
- journals and telemetry events.
- repository-specific coding rules,
- product UI styling,
- Git-specific workflow policies,
- business-domain approval semantics,
- vendor-specific instruction file conventions.
The existence of a narrow runtime layer is a speculative proposal, but many of the entities and invariants inside it are supported by stronger convergence signals.