Repository navigation
architecture runtime orchestration
LLM turns, tool execution, persistence, MCP, checkpoints, nested subagents, and machine-output mode — everything in internal/agent/runtime/ that is not the REPL editor. REPL wiring: Runtime — REPL input. Index: Runtime hub.
sequenceDiagram
participant Main as cmd/main
participant RT as Runtime
participant REPL as repl.Loop
participant Turns as turns.go
participant LLM as llm
participant Tools as tools.Exec
Main->>RT: NewRuntime InitMCP
alt interactive
Main->>RT: Run
RT->>REPL: repl.Run
REPL->>Turns: onUserMessage
else exec
Main->>RT: RunPromptOnce
RT->>Turns: onUserMessage
end
loop until no tools
Turns->>LLM: StreamAssistantTurn
Turns->>Tools: execute tool batch (parallel where applicable)
Turns->>RT: persistSession
end
| File | Key symbols |
|---|---|
core.go |
NewRuntime, RunPromptOnce, systemPrompt, persistSession, mutateSession
|
deferred_chat_title.go |
scheduleDeferredChatTitleFinalize after first turn with placeholder chat id |
systemPrompt chooses plan vs build templates, injects instructions, rules, tool dumps, MCP dump, legacy syntax. See Plan vs build.
| File | Key symbols |
|---|---|
turns.go |
onUserMessage, onUserMessageWithAPIContent, runAgentTurns
|
legacy.go |
ResolveTurnInvocations, legacy enable/force helpers |
tool_print.go |
Tool intent lines, legacy stream writer, model correction messages |
exec.go |
execTool, toolEnv
|
Deep sequence: Agent turn pipeline.
nested.go runs an isolated stream for the subagent tool:
| Function | Behavior |
|---|---|
runNested |
Build-mode system prompt + task string |
runNestedWithSystem |
Custom sysPromptPath merged with inherited instructions |
buildNestedToolDump |
Build tools + MCP dump for nested context |
Returns consolidated text to the parent tool result. Background runs persist their subchat and can be stopped, cancelled, interrupted-and-resumed, or resumed later; see Sessions and storage. Wired from tools/subagent.go.
Optional roleProvider / roleModel select a row from [[roles.subagent]] (discovered via listSubAgents); the nested stream uses that provider’s backend and model instead of the session defaults. Background subagents validate the role before persisting the subsession. See Native tools — subagent roles.
researchmanager.go binds
the native and deferred research tools to the shared asynchronous
research.Manager. It passes the runtime model, configuration, internal web
routers, and terminal output callbacks into each job. deepResearch returns a
job id immediately; progress and completion are emitted as deferred system
messages in interactive terminal mode, while machine-output mode keeps them
out of stdout. Status reads are snapshots and can safely run while the
background engine is updating a job. Full lifecycle and persistence: Deep
research.
| File | Key symbols |
|---|---|
mcp.go |
InitMCP, project-root roots, expose the MCP catalog to searchTools and orchestrate
|
Started asynchronously from Run. Detail: MCP integration.
| File | Key symbols |
|---|---|
checkpoint.go |
ApplyGotoCheckpoint, coordinate edit staging restore |
instructions.go |
activateInstructionsFromAbsPath, activateInstructionsFromShellCommand
|
Checkpoints: Checkpoints. Instructions: Project instructions.
| File | Key symbols |
|---|---|
ci_run.go |
runPromptOnceCI, ciEmit, streamOptsCI, exit metadata |
Active when Runtime.EventSink is set (solomon exec --json / --jsonl). Schema: internal/agent/cievents/. User guide: Machine output.
| File | Role |
|---|---|
cursor_sidecar.go |
Ensure Node sidecar for Cursor API provider |
cursor_native_display.go |
REPL lines for solomon_cursor_tool_event when native tools enabled |
Full design, HTTP API, bridge table, debug playbook: Cursor integration.
| File | Role |
|---|---|
update.go |
refreshUpdateCheck, tryAutoUpdateInstall (startup install + restart), /update
|
restart.go |
ErrRestartSolomon — /upgrade triggers re-exec in cmd
|
Backend: internal/updater/.
onUserMessageWithAPIContent(visible, apiContent) supports:
-
@mention expansion (visible tags vs expanded file bodies) - Forced
/skill:(visible slash vs expanded skill body)
Both paths bump checkpoint, append user message, persist, then runAgentTurns.
| Change | Files |
|---|---|
| New native tool |
internal/agent/tools/ + exec.go env |
| Turn behavior | turns.go |
| Persist rules |
core.go persistSession
|
| MCP wiring | mcp.go |
| Area | Tests |
|---|---|
| Turn loop / legacy |
test/legacy_runtime_test.go, test/legacy_tools_test.go
|
| Checkpoints |
test/checkpoint_truncate_test.go, test/checkpoint_staging_test.go
|
| CI events | test/cievents_test.go |
| Deep research surfaces | test/web_surfaces_test.go |
| Tool display | test/tool_display_checkpoint_test.go |
| Instructions |
test/instructions_test.go, test/instructions_prompt_test.go
|
Full map: Runtime hub — Debug playbook.