The runtime layer is centered on SharpClaw.Code.Runtime and especially ConversationRuntime, which implements:
- Session surface on
IConversationRuntime— create/get session,RunPromptAsync IRuntimeCommandService—ExecutePromptAsync,GetStatusAsync,RunDoctorAsync,InspectSessionAsync
Registration: RuntimeServiceCollectionExtensions.AddSharpClawRuntime.
DefaultTurnRunner is the ITurnRunner implementation used for prompt turns. It:
- Calls
IPromptContextAssembler.AssembleAsyncto buildPromptContext(prompt text, metadata such as resolvedmodel). - Maps
RunPromptRequest+ session intoAgentRunContext(session/turn ids, working directory, permission mode, output format,IToolExecutor, metadata). - Invokes
PrimaryCodingAgent.RunAsync.
The agent stack is described in agents.md.
IRuntimeStateMachine(DefaultRuntimeStateMachine) transitionsConversationSession.State.- Failures (including
ProviderExecutionExceptionand cancellation paths) update session state and appendSessionStateChangedEvent(and related events) whenAppendEventAsyncruns with persistence enabled.
PromptContextAssembler pulls workspace/session-aware data (skills registry, memory hooks, git context as wired today) into the prompt path before the agent runs.
OperationalDiagnosticsCoordinator runs injectable IOperationalCheck implementations:
- Workspace, configuration, session store, shell, git, provider auth, MCP registry/host, plugin registry.
Used by GetStatusAsync, RunDoctorAsync, and InspectSessionAsync to build Protocol reports (DoctorReport, RuntimeStatusReport, SessionInspectionReport).
RuntimeCoordinatorHostedServiceAdapter is registered as IHostedService and currently logs start/stop only (placeholder for future lifecycle coordination).
| Type | Project / path |
|---|---|
ConversationRuntime |
src/SharpClaw.Code.Runtime/Orchestration/ConversationRuntime.cs |
DefaultTurnRunner |
src/SharpClaw.Code.Runtime/Turns/DefaultTurnRunner.cs |
OperationalDiagnosticsCoordinator |
src/SharpClaw.Code.Runtime/Diagnostics/OperationalDiagnosticsCoordinator.cs |
IRuntimeCommandService |
src/SharpClaw.Code.Runtime/Abstractions/IRuntimeCommandService.cs |