Skip to content

architecture runtime

github-actions[bot] edited this page Nov 4, 2026 · 53 revisions

Runtime hub

Purpose

internal/agent/runtime/ is Solomon's orchestration core: the Runtime type, REPL loop wiring, LLM turn execution, tool dispatch, MCP, checkpoints, and integrations. This page is the index; detail lives in linked articles.

Subpackages (shape)

flowchart TB
  cmd[cmd/solomon]
  repl_run[repl_run.go Run]
  repl_pkg[repl/]
  replcomplete[replcomplete/]
  slash_deps[slash_deps.go]
  turns[turns.go]
  core[core.go]
  exec[exec.go]
  cmd --> repl_run
  repl_run --> repl_pkg
  repl_pkg --> slash_deps
  repl_pkg --> turns
  turns --> core
  turns --> exec
  repl_pkg --> replcomplete
  repl_run --> core
Loading

Flow: Runtime.Run (repl_run.go) builds a repl.Loop. Chat lines call onUserMessage → runAgentTurns in turns.go. Slash lines call slash_deps.handleSlash → slash.Dispatch.

Articles

Article Topics
Runtime — REPL input Raw-mode editor, completion, @ mentions, highlight, shell history
Runtime — orchestration Turns, tools, MCP, legacy XML, nested subagent, CI mode, checkpoints
Deep research Background research jobs, internal web adapters, persistence, and cross-surface status
Agent turn pipeline Stream loop sequence, compaction, legacy XML rules
Checkpoints /goto, staging, file restore

Root file map

File Responsibility Called from / calls
core.go Runtime struct, NewRuntime, RunPromptOnce, systemPrompt, persistSession, session mutation cmd, REPL callbacks, turns
repl_run.go Run — banner, MCP goroutine, repl.Loop wiring, clipboard hooks cmd
turns.go onUserMessage, runAgentTurns, stream + tool loop, SIGINT cancel repl/loop, RunPromptOnce
exec.go execTool, toolEnv → tools.Exec turns
legacy.go ResolveTurnInvocations, legacy config helpers turns
tool_print.go Terminal tool lines, legacy stream writer setup, correction messages turns
nested.go runNested, subagent stream (build tools + optional custom prompt) tools/subagent
mcp.go InitMCP, MCP tools in toolParams Run, turns
slash_deps.go slashDeps, handleSlash, commands.Deps callbacks repl/loop
usershell.go runUserShellLine for ! / shell-first lines repl/loop
checkpoint.go ApplyGotoCheckpoint, edit staging on rewind slash /goto, turns
instructions.go Activate AGENTS.md dirs after tools/shell touch paths exec, shell
ci_run.go exec --json / --jsonl event emission, machine-mode stream opts RunPromptOnce, turns
deferred_chat_title.go Background chat title finalize after first turn turns
cursor_sidecar.go ensureCursorSidecar for Cursor API provider /connect, tool env
cursor_native_display.go Legacy Cursor native tool event display (deprecated with cursor_internal_tools) stream callbacks
update.go GitHub release check, startup autoupdate install, /update Run, /update
restart.go ErrRestartSolomon for in-process restart after upgrade slash /upgrade → cmd
replcomplete_runtime.go Build replcomplete.ReplCompleteEnv from Runtime repl_run

Subpackage map

Path Role Detail
repl/ Interactive input loop, editor, banner, display Runtime — REPL input
replcomplete/ Tab completion and @ index Runtime — REPL input
multiline/ Bracketed paste, terminal raw mode, platform stdin Runtime — REPL input
repl/replhl/ Draft-line syntax highlight Runtime — REPL input
repl/shellhist/ History for shell/! lines Runtime — REPL input
repl/shelllex/ Shell tokenization for highlight/completion Runtime — REPL input

Runtime fields (reference)

Field Role
RL readline instance — terminal writers/width; prompt editing is in repl editor
Backend, Model, Cfg, Prov Active LLM provider
ProjHex, ProjRoot Canonical workspace
Mode plan or build
Session In-memory transcript
EphemeralSession Skip chatstore writes
ReplShellFirst Plain lines → shell; ! → chat
MCP Connected MCP manager
ToolOut Tool result truncation/spill
Instructions Cached AGENTS.md loader
EventSink, FailOnToolError CI / machine output
CompactionThresholdTokens Auto /summarize threshold
stagingCache Checkpoint file snapshots for /goto

Full struct: core.go.

Debug playbook

Symptom Start here Tests
Tab completion wrong / missing repl/editor/read.go complete, replcomplete/ test/repl_complete_test.go, test/repl_complete_path_test.go, test/repl_complete_shell_test.go
@ picker or expansion broken repl/editor/at_picker.go, internal/atmention/ test/atmention_test.go
Multiline / paste / image paste repl/editor/read.go, repl/paste.go, multiline/ test/repl_editor_test.go, test/session_images_test.go
Slash unknown or /skill: wrong slash/dispatch.go, slash_deps.go test/slash_dispatch_test.go
Turn hangs / SIGINT odd turns.go runAgentTurns test/legacy_runtime_test.go
Legacy XML tools legacy.go, tool_print.go test/legacy_tools_test.go
Subagent timeout / nested prompt nested.go —
/goto transcript or files wrong checkpoint.go, Checkpoints test/checkpoint_staging_test.go, test/checkpoint_truncate_test.go
exec --jsonl events ci_run.go test/cievents_test.go
Cursor sidecar / native tools display cursor_sidecar.go, cursor_native_display.go Cursor integration, test/cursor_native_display_test.go, test/stream_cursor_tool_test.go
Autoupdate / restart update.go, restart.go test/updater_test.go, test/commands_update_test.go

Disable completion: SOLOMON_NO_COMPLETE=1. Disable autosuggest ghost text: SOLOMON_NO_AUTOSUGGEST=1.

Extension points

Change Where
REPL keys / redraw repl/editor/read.go, repl/editor/refresh.go
New slash command commands/builtin_slash.go — not runtime, wired via slash_deps
Turn loop / tools turns.go, exec.go
System prompt sections core.go systemPrompt

REPL tests can import editor helpers via repl/editor/editorhistory.go (test-only exports).

See also

Clone this wiki locally