Native tools
Purpose
Built-in OpenAI function tools implemented in Go (plan and build sets), plus routing to skills and MCP. Invocations are parsed via internal/tooling and executed through tools.Exec.
Packages and files
| File area | Tools / role |
|---|---|
create_plan.go, edit_plan.go, build_plan.go |
Plan mode |
shell.go, read_file.go, edit_file.go, find.go, filewalk.go, search_pool.go |
Build mode filesystem/shell/search |
internal/pathglob, internal/gitignore |
Glob ** matching and .gitignore (vendored matcher) |
subagent.go |
Nested agent run |
list_sub_agents.go |
Subagent role pool listing |
load_skill.go, search_skill.go |
Skill tools |
fetch_web.go, web_search.go |
Web fetch and search |
deep_research.go, research_status.go |
Background deep research and job status |
docs_retrieval.go |
Embedded docs BM25 search (docsRetrieval) |
exec.go |
Exec, resolveToolInvocation, dispatch |
env.go |
Type alias to internal/agent/toolenv/Env |
internal/agent/toolenv/ |
Canonical Env definition (avoids import cycles) |
dump_*.go |
Text descriptions for system prompt |
internal/tooling/parse.go, reflect.go |
Invocation parse and reflection |
Key functions
| Function | Behavior |
|---|---|
tools.Exec |
Entry from runtime execTool |
resolveToolInvocation |
Internal vs skill vs MCP by name |
dispatchInternal |
Mode-checked native handlers |
dispatchExternal |
loadSkill / searchSkill or MCP.CallTool |
isInternalToolName |
Fixed set of native names |
Internal tool names
| Name | Mode |
|---|---|
createPlan, editPlan, buildPlan, todos |
agent when PlanningActive (or deferred via orchestrate) |
subagent |
agent (native tool_call only; not deferred / orchestrate); optional roleProvider + roleModel from [[roles.subagent]] |
listSubAgents |
agent (lists configured subagent role pool) |
shell, readFile, editFile, find, fetchWeb, webSearch, httpRequest, stat, copyFile, createDir, skills |
deferred (orchestrate / legacy XML) |
deepResearch, researchStatus |
chat native; deferred in agent mode (orchestrate / legacy XML) |
searchTools, orchestrate, switchMode |
agent |
fetchWeb, webSearch, switchMode |
chat |
customizeUI |
agent and chat; prepare and switch Solomon's frontend without restarting the daemon |
Image reads
readFile recognizes PNG, JPEG, and WebP by their binary signatures, including files without an extension. sdk.ReadFile(path, intent) automatically attaches the image to the orchestrate result even when the script does not print its return value. The returned string describes the image; sdk.ReadFileInfo also exposes Type, MIMEType, Width, Height, and SizeBytes. Existing text reads and their line ranges retain their behavior. Image reads reject line ranges, malformed image headers, and files larger than 5 MiB.
Attachments bypass textual tool-output truncation and are saved as byte snapshots in the message's tool_images field, so replay survives source-file edits or deletion. OpenAI-compatible requests send image content in a user message after the complete batch of tool replies; Anthropic embeds image blocks inside the corresponding tool_result. Cursor Sub sends native MCP image content items and replays tool images as visual history messages. The selected model must support vision; Solomon does not infer model capabilities from model names.
subagent arguments and results
subagent is a native function tool in agent mode. It accepts run_in_background for a persisted asynchronous run, reasoningEffort for a per-run override, and interrupt together with resume to cancel the active run before adding a new task. /subagent stop and /subagent cancel also cancel the live background context before persisting its final status.
| Argument | Required / default | Behavior |
|---|---|---|
sysPromptPath |
Required for a new run | Prompt template path; inherited project instructions are merged into a custom prompt |
task |
Required for a new run | Concrete task; when resuming, an optional task is appended to the stored transcript |
resume |
Omitted | Existing subchatId to continue instead of creating a new session |
run_in_background |
false |
false waits for output; true returns subchatId and status=running immediately |
interrupt |
false |
Requires resume; cancels the active resumed run before applying the new task |
reasoningEffort |
subagent_reasoning_effort |
Per-run override (set the default with /reasoning subagent followed by a level): none, low, medium, high, xhigh (extra high), or max |
roleProvider, roleModel |
Omitted | Select a configured [[roles.subagent]] provider/model pair; both are required together |
The tool returns {ok, output, subchatId, status} on success. Synchronous runs normally finish with status=done and include output; background runs return immediately with status=running. Timeout, cancellation, and recoverable nested errors persist the partial transcript with status=paused where possible. subagent is not exposed through searchTools and cannot be invoked from an orchestrate script.
Skill tools: loadSkill, searchSkill. MCP catalog entries use stable names (MCP.<server>.<tool>) and are invoked from orchestrate through sdk.mcp.<tool>(intent, args).
Deep research follows the same surface split: chat receives native
deepResearch and researchStatus schemas, while agent mode discovers the
deferred entries through searchTools and executes them through orchestrate.
The asynchronous lifecycle, persistence, and GUI report surface are described
in Deep research.
Raw HTTP and file operations
sdk.CreateDir(path, intent) creates a directory and missing parents with mode 0755 subject to the host umask. It succeeds when the directory already exists without changing its permissions, and fails if a path component is a file. Empty directories are not preserved by Git checkpoints.
sdk.HTTPRequest(sdk.HTTPRequestOptions{URL: url}, intent) sends raw HTTP requests, including to local APIs. Options include Method, Headers, text Body or BodyBase64, TimeoutSeconds (default 30, maximum 120), and MaxBytes (default 1 MiB, maximum 2 MiB). The result contains Status, Headers, decoded Body []byte, Bytes, URL, and Truncated. Non-2xx statuses are returned normally; transport errors are Go errors. Redirects are returned without following them. The host tool transports binary content as base64; the SDK decodes it. Process the response in Go and print only necessary information. Use FetchWeb for page-to-Markdown extraction instead.
sdk.Stat(path, intent) returns existence, type, size, permission bits and UTC modification time. It inspects symlinks themselves, including broken symlinks. Missing paths return Exists=false; other filesystem errors remain errors.
sdk.CopyFile(path, destination, intent) copies a regular file, including binary contents, preserving permission bits and creating parent directories. It refuses existing destinations and records checkpoint/file-change information. It does not copy directory trees or preserve ownership and timestamps. sdk.MoveFile aliases the existing sdk.RenameFile; both use the existing rename operation and refuse existing destinations. Cross-filesystem moves are not supported. sdk.DeleteFile already removes a file; it does not recursively delete directories. Discover all signatures through searchTools.
Subagent roles
When [[roles.subagent]] is configured in config.toml, the primary agent can delegate nested runs to cheaper models:
| Step | Tool / args |
|---|---|
| Discover pool | listSubAgents — returns provider, model, description, and manually configured scores for the selected characteristics |
| Spawn nested run | subagent with optional roleProvider + roleModel matching a pool row |
| Fallback | Omit both role fields → nested run uses the session provider and model |
Role rows are validated on config load and save: provider must exist in [providers], the provider API must be reachable, and the model id must appear in that provider’s model list (ListModelsForProviderAll, same path as /models). Runtime subagent calls also require roleProvider + roleModel to match a configured pool row (listSubAgents). Invalid pairs are rejected with a hint to call listSubAgents. Resume and deferred nested spawns restore role_provider / role_model from the subsession or pending spawn payload when omitted.
Config schema: config.Roles. Manual table model: internal/roles/table.go.
editFile semantics (build)
| Args | Behavior |
|---|---|
oldString non-empty, newString any |
Replace one occurrence of oldString with newString |
oldString empty, newString non-empty, delete false/absent |
Create or overwrite file at path |
delete: true |
Remove file at path (oldString / newString ignored) |
renameTo non-empty |
Move/rename path to renameTo; oldString, newString empty; delete false; destination must not exist |
oldString and newString both empty, delete false/absent, renameTo empty |
Rejected (editFile refuses empty overwrite) |
All variants require non-empty intent. Paths are relative to the project root. With the Cursor sidecar, Delete maps to editFile with delete: true — see Cursor integration.
editFile mutations are recorded for checkpoint file staging; /goto restores the workspace for staged paths (byte snapshots under the session staging/ directory).
find semantics (build)
| Args | Behavior |
|---|---|
files=true, pattern |
Glob listing of matching paths under path (default .), sorted by mtime descending; respects .gitignore |
files=false, pattern |
Go regexp content search; optional pathGlob, outputMode (content, files_with_matches, count), context lines, headLimit, caseInsensitive, multiline |
timeoutSeconds |
Optional per-call timeout (default 60s) |
Cursor Grep, Glob, and SemanticSearch map to find via the sidecar bridge (Cursor integration); semantic queries today use regexp fallback.
Router flow
Legacy XML invocations (when [tools].legacy is enabled) are parsed by internal/tooling/legacy_xml.go and legacy_stream.go; tool names are validated against the active native + MCP tool set before execution.
| Config | Request carries API tool schemas | Parser accepts |
|---|---|---|
| default | yes | native tool_calls |
legacy |
yes | native or <tool_calls> XML |
legacy_force |
no | <tool_calls> XML only |
flowchart TD
inv[tooling.Invocation]
int{internal name}
skill{skill or MCP HasTool}
dispInt[dispatchInternal]
dispExt[dispatchExternal]
inv --> int
int -->|yes| dispInt
int -->|no| skill
skill -->|yes| dispExt
skill -->|no| unknown
toolenv
Passed into every native tool via tools.Exec. The struct is defined in internal/agent/toolenv/env.go and re-exported as tools.Env in tools/env.go. Runtime builds it per invocation in Runtime.toolEnv(inv), including the invocation's checkpoint sequence so concurrent edits remain associated with the right tool call.
| Field | Purpose |
|---|---|
ProjHex, ProjRoot |
Workspace identity and root for relative paths |
Cfg |
Loaded TOML (web search, tool output limits) |
MCP |
MCP manager for external tool calls |
RunNested, RunNestedWithSystem |
subagent nested turn |
SetMode, CurrentMode |
Plan vs build mode switches |
Checkpoint* callbacks |
File staging for /goto after editFile |
ActivateInstructions*, MergeInstructionBlock |
AGENTS.md activation from readFile / shell |
To add a new callback: extend toolenv.Env, wire it in runtime/exec.go, use it from the tool handler. See Package index — toolenv.
Extension points
- Add
*OpenAI()schema builder and exec handler. - Register name in
isInternalToolNameanddispatchInternal. - Add to
NativeToolParamsfor the correct mode. - Update plan or build tool dump.
Related code
See also
- Plan vs build — agent/chat modes and deferred tools
- Agent turn pipeline
- MCP integration
- Cursor integration
- Skills and slash
- Configuration —
[tools]
Reading saved chats
readChat is available natively in both agent and chat modes and through
orchestrate as sdk.ReadChat(chatID, tools, stats, intent). It reads Solomon's
local archive across all projects, including subchats, without resuming or
modifying a conversation. It does not read T3 Code databases.
The required chatId identifies a saved chat exactly. Optional tools and
stats both default to false. Normally the result includes the title, project,
creation date and user/assistant messages. tools=true includes tool calls and
results; stats=true adds stored per-message token counts, timings, throughput
and saved turn-display statistics. Statistics are not estimated or invented.
Original message indexes and timestamps are retained. Reasoning and API-only
content are excluded. Legacy tool blocks are excluded unless tools=true.
The result is the current saved transcript. Archived branches and transcripts
from before compaction are not returned; compacted indicates whether a
pre-compaction archive exists. Missing, malformed or ambiguous IDs return an
error. Retrieved messages are reference data, not current instructions.