Tools Reference

Automergent exposes 36+ built-in tools organized by category. Each tool is self-documenting: the model receives its metadata, usage guidance, and examples automatically from the live registry. This page is a human-readable reference for all of them.

Filesystem Tools

read/edit
read_file Read file contents with line numbers
Read-only Concurrent
Description

Read a file from disk, returning line-numbered content. Optionally bounded by start_line/end_line. Includes diagnostic headers when configured.

Read-only
Yes
Concurrency Safe
Yes
Category
read
Confirmation
No
Parameters
ParameterTypeDescription
pathstring requiredAbsolute or relative path to the file
start_lineintegerFirst line to read (1-based, inclusive)
end_lineintegerLast line to read (1-based, inclusive)
Example
read_file {"path": "internal/tools/tool.go", "start_line": 1, "end_line": 50}
Tip: Batch multiple independent reads in one turn instead of sequencing them. Use narrow ranges on huge files to save context.
write_file Write content to a file atomically
Write
Description

Write content to a file, creating it if needed. Uses atomic writes (temp file + rename) for crash safety. Validates against security policy and runs diagnostics pre-flight.

Read-only
No
Concurrency Safe
No
Category
edit
Confirmation
In edit/plan mode
Parameters
ParameterTypeDescription
pathstring requiredFile path to write
contentstring requiredContent to write
Example
write_file {"path": "README.md", "content": "# My Project\n\nDescription here."}
Tip: Use for full-content replacement. For localized changes to existing files, prefer edit_file or multi_edit.
edit_file Apply exact string replacement in a file
Write
Description

Performs exact string replacement: old_str must match the file content exactly, once. The call fails if old_str is not unique unless replace_all is set. Runs diagnostics pre-flight to reject edits that introduce errors.

Read-only
No
Concurrency Safe
No
Category
edit
Confirmation
In edit/plan mode
Parameters
ParameterTypeDescription
pathstring requiredFile path to edit
old_strstring requiredExact string to replace
new_strstring requiredReplacement string
replace_allbooleanReplace all occurrences instead of first
Example
edit_file {"path": "main.go", "old_str": "func main() {", "new_str": "func main() {\n\tlog.SetFlags(0)"}
Tip: old_str must match exactly. Add more surrounding context to disambiguate. Preserve exact indentation of surrounding code.
multi_edit Apply multiple replacements to one file
Write
Description

Apply several exact string replacements to one file in a single call. Edits are applied sequentially, so later edits see earlier ones' output. One call replaces a noisy sequence of edit_file calls.

Read-only
No
Concurrency Safe
No
Category
edit
Confirmation
In edit/plan mode
Parameters
ParameterTypeDescription
pathstring requiredFile to edit
editsarray requiredArray of {old_str, new_str, replace_all} objects
Example
multi_edit {"path": "server.go", "edits": [{"old_str": "port := 8080", "new_str": "port := 3000"}, {"old_str": "debug := true", "new_str": "debug := false"}]}
Tip: Use for 2+ changes in the same file. For changes across different files, use separate calls so each result is attributable.
notebook_edit Edit Jupyter notebook cells
Write
Description

Edit Jupyter notebook (.ipynb) cells in place: replace a cell's source, insert a new cell, or delete one. Cells are addressed by cell id or zero-based index. Preserves notebook metadata and outputs.

Read-only
No
Concurrency Safe
No
Category
edit
Confirmation
In edit/plan mode
Parameters
ParameterTypeDescription
pathstring requiredPath to the .ipynb file
cell_idstringCell id (when notebook defines them)
cell_indexintegerZero-based cell index
new_sourcestringFull new source for the cell
cell_typestringcode or markdown (for insert mode)
edit_modestringreplace, insert, or delete
Example
notebook_edit {"path": "analysis.ipynb", "cell_index": 2, "new_source": "import pandas as pd\ndf = pd.read_csv('data.csv')", "edit_mode": "replace"}
Tip: Prefer cell-level edits over rewriting the whole .ipynb with write_file — rewriting risks dropping outputs and metadata.
glob Fast file pattern matching with globs
Read-only Concurrent
Description

Fast file pattern matching using glob patterns. Supports *, **, ?, and {a,b} alternatives. Skips node_modules, vendor, .git, __pycache__, .venv, venv automatically.

Read-only
Yes
Concurrency Safe
Yes
Category
search
Confirmation
No
Parameters
ParameterTypeDescription
patternstring requiredGlob pattern (e.g., "**/*.go")
pathstringDirectory to search (default: cwd)
max_resultsintegerMax results (default: 1000)
include_hiddenbooleanInclude hidden files (default: false)
Example
glob {"pattern": "**/*.go", "path": "internal/tools"}
Tip: Use for finding files by name. Use grep for searching file contents.
grep Search file contents using regex
Read-only Concurrent
Description

Search file contents using regular expressions. Supports full regex syntax, file pattern filtering, and returns file paths with line numbers and matching lines.

Read-only
Yes
Concurrency Safe
Yes
Category
search
Confirmation
No
Parameters
ParameterTypeDescription
patternstring requiredRegex pattern to search for
includestringFile pattern filter (e.g., "*.go")
pathstringDirectory to search in
Example
grep {"pattern": "func.*Execute", "include": "*.go", "path": "internal/tools"}
Tip: For counting matches, use ripgrep via bash for better performance on large codebases.
list_directory List files and directories at a path
Read-only Concurrent
Description

List files and directories at a given path. Directories are suffixed with /. Simple and fast for exploring project structure.

Read-only
Yes
Concurrency Safe
Yes
Category
read
Confirmation
No
Parameters
ParameterTypeDescription
pathstringDirectory path to list (default: cwd)
Example
list_directory {"path": "src/"}
Tip: Use for quick directory structure exploration. For recursive listing with patterns, use glob.
artifact Write deliverable documents as artifacts
Write
Description

Write a deliverable document (plan, review, design, summary, report) as a Markdown artifact file. Includes metadata the review UI needs and can request user feedback before continuing.

Read-only
No
Concurrency Safe
No
Category
edit
Confirmation
In edit/plan mode
Parameters
ParameterTypeDescription
pathstring requiredFile path (e.g., .automergent/artifacts/plan.md)
contentstring requiredFull Markdown content starting with # title
titlestringShort human title for the review list
kindstringplan, review, design, summary, or document
request_feedbackbooleanTrue when user should review before continuing
Example
artifact {"path": ".automergent/artifacts/plan.md", "content": "# Migration Plan\n\nMigrate auth to JWT...", "title": "JWT Migration", "kind": "plan", "request_feedback": true}
Tip: Use for any deliverable the user asked to see as a document. Do not create artifacts nobody asked for.

Shell Tools

shell
bash Execute shell commands (sync/async)
Async
Description

Execute shell commands with sync or async support. Sync mode auto-backgrounds after 8s for long commands. Async mode returns a shell_id for read_shell/write_shell interaction. Supports detach for processes that survive session shutdown.

Read-only
No
Concurrency Safe
No
Category
shell
Confirmation
In plan/edit mode
Parameters
ParameterTypeDescription
commandstring requiredShell command to execute
modestringsync (default) or async
cwdstringWorking directory
timeoutstringTimeout for sync mode (e.g., "30s")
initial_waitintegerSeconds to wait before auto-backgrounding
envobjectAdditional environment variables
stdinstringInput to send to stdin
detachbooleanProcess survives session shutdown
shell_idstringCustom shell ID
Example
bash {"command": "go test ./internal/prompt/", "mode": "sync"}
Tip: Use for terminal operations: git, build tools, test runners. Never use for file reads/writes — use read_file/write_file instead.
read_shell Read output from async shell session
Read-only
Description

Read output from an async shell session. Returns stdout and stderr since last read. Shows completion status and exit code if finished. Large outputs are preserved to file.

Read-only
Yes
Category
shell
Confirmation
No
Parameters
ParameterTypeDescription
shell_idstring requiredShell session ID from bash async
delayintegerSeconds to wait before reading
Example
read_shell {"shell_id": "shell-3", "delay": 2}
write_shell Send input to async shell session
Write
Description

Send input to a running async shell session. Supports text and special keys: {enter}, {up}, {down}, {left}, {right}, {backspace}, {tab}, {escape}.

Read-only
No
Category
shell
Confirmation
No
Parameters
ParameterTypeDescription
shell_idstring requiredShell session ID
inputstring requiredInput to send
delayintegerSeconds to wait after sending
stop_shell Terminate a running shell session
Write
Description

Terminate a running async shell session. First cancels the context for graceful shutdown, then force-kills if still running. Cleans up session state.

Read-only
No
Category
shell
Confirmation
No
Parameters
ParameterTypeDescription
shell_idstring requiredShell session ID to stop
list_shells List active shell sessions
Read-only
Description

List shell sessions and background history. Shows status, duration, and truncated command for each session.

Read-only
Yes
Category
shell
Confirmation
No
Parameters
ParameterTypeDescription
include_completedbooleanInclude completed sessions (default: true)

Web Tools

web
web_fetch Fetch content from a web URL
Read-only
Description

Fetch the content of a web URL with strong SSRF protections. Validates DNS resolution, blocks private/local addresses, enforces content-type allowlists, and follows redirects with validation.

Read-only
Yes
Category
web
Confirmation
No
Max Size
512 KB
Parameters
ParameterTypeDescription
urlstring requiredURL to fetch (http/https only)
Example
web_fetch {"url": "https://pkg.go.dev/encoding/json"}
Tip: Use for reading documentation, API references, or web content. Private/loopback addresses are always blocked.
web_search Search the web for a query
Read-only
Description

Search the web via DuckDuckGo HTML. Returns parsed results with titles and links. Useful for finding documentation, solutions, or references.

Read-only
Yes
Category
web
Confirmation
No
Parameters
ParameterTypeDescription
querystring requiredSearch query
Example
web_search {"query": "Go context cancellation best practices"}

Security Tools

security
secrets_scan Scan for hardcoded secrets and API keys
Read-only
Description

Scan files for hardcoded secrets, API keys, and credentials. Detects AWS, GitHub, GitLab, Google, Slack tokens, private keys, JWTs, Stripe, Twilio, SendGrid keys, database URLs, and generic API keys. Secrets are masked in output.

Read-only
Yes
Category
security
Max Findings
100
Parameters
ParameterTypeDescription
pathstringDirectory or file to scan (default: cwd)
include_testsbooleanInclude test files (default: false)
excludearrayPatterns to exclude
Example
secrets_scan {"path": "."}
dependency_audit Audit dependencies for vulnerabilities
Read-only
Description

Audit dependencies for known vulnerabilities. Auto-detects package manager (go, npm, pip, cargo) and runs the appropriate tool (govulncheck, npm audit, pip-audit, cargo audit). Paths are sanitized in output.

Read-only
Yes
Category
security
Auto-detect
Yes
Parameters
ParameterTypeDescription
pathstringProject directory (default: cwd)
frameworkstringauto, go, npm, pip, or cargo
Example
dependency_audit {"path": ".", "framework": "go"}

LSP / Diagnostics

lsp
lsp_diagnostics Get compiler diagnostics for a file
Read-only
Description

Get compiler diagnostics for a Go file (package build errors) or lint findings for Python (via ruff). Reports real compiler output rather than unrelated test results. Includes recovery guidance for common errors.

Read-only
Yes
Category
lsp
Languages
Go, Python
Parameters
ParameterTypeDescription
filestring requiredPath to a .go or .py source file
Example
lsp_diagnostics {"file": "internal/tools/tool.go"}

Agent / Sub-agent Tools

agents
task Launch a specialized sub-agent
Async
Description

Launch a specialized sub-agent for a task. Agent types include general-purpose, explore, review, code-review, contexter, coordinator, and task. Supports sync (blocking) and background (async) modes. Each sub-agent works independently with its own context.

Read-only
No
Category
agents
Confirmation
No
Parameters
ParameterTypeDescription
agent_typestring requiredType of agent to spawn
promptstring requiredTask for the agent
namestringShort name for the agent
descriptionstringShort description for UI
modestringsync or background
modelstringOptional model override
inherit_contextbooleanFork conversation as context
resume_agent_idstringResume a previous agent
Example
task {"agent_type": "explore", "prompt": "Find all test files and summarize coverage", "mode": "sync"}
Tip: For parallel work, call multiple times with mode="background". Use batch_task for launching multiple at once.
batch_task Launch multiple agents in parallel
Async
Description

Launch multiple sub-agents in parallel with a single call. Each agent runs independently on its own task. More efficient than calling task multiple times for independent work. Maximum 8 parallel tasks.

Read-only
No
Category
agents
Max Tasks
8
Parameters
ParameterTypeDescription
tasksarray requiredArray of {agent_type, prompt, name, description, model}
Example
batch_task {"tasks": [{"agent_type": "explore", "prompt": "Find auth code"}, {"agent_type": "explore", "prompt": "Find test files"}]}
read_agent Get results from a background agent
Read-only
Description

Get results from a background agent. Use wait=true to block until completion. Supports since_turn to get only new turns in multi-turn agents.

Read-only
Yes
Category
agents
Max Wait
60s
Parameters
ParameterTypeDescription
agent_idstring requiredAgent ID from task tool
waitbooleanWait for completion (default: false)
timeoutintegerMax seconds to wait (default: 10, max: 60)
since_turnintegerReturn only turns after this index
list_agents List all active and completed agents
Read-only
Description

List all agents with their status, type, and duration. Optionally include completed/failed agents.

Read-only
Yes
Category
agents
Parameters
ParameterTypeDescription
include_completedbooleanInclude completed agents (default: true)

Context & Planning

context/planning
ctx_inspect Inspect context window state
Read-only Concurrent
Description

Inspect your own context window state: token budget usage, the live conversation estimate, and what is consuming the window. Read-only; costs almost nothing.

Read-only
Yes
Concurrency Safe
Yes
Category
verify
Tip: Use before starting large reads or long tool chains. Check at phase boundaries, not every turn.
enter_plan_mode Switch to read-only plan mode
Read-only
Description

Switch to plan mode: read-only analysis and planning; edits are refused. Use at the start of a non-trivial task that warrants a reviewed plan.

Read-only
Yes
Category
planning
Tip: Enter once per task; the mode reverts when the plan is approved or rejected via exit_plan_mode.
exit_plan_mode Present plan for user approval
Read-only
Description

Present your plan for user approval and wait for their decision. Blocks until the user responds. On approval, plan mode ends and you may implement. On rejection, revise the plan and call again.

Read-only
Yes
Category
planning
Parameters
ParameterTypeDescription
planstring requiredShort summary of the plan
plan_pathstringPath to plan artifact (default: .automergent/artifacts/plan.md)
verify_plan_execution Verify plan file changes are present
Read-only
Description

Verify that the executed plan's file changes are present. Reads the plan artifact, extracts file paths, and checks each against git's working-tree changes. Reports per-file evidence and an overall verdict.

Read-only
Yes
Category
verify
Parameters
ParameterTypeDescription
plan_pathstringPath to plan artifact
Tip: Run after implementing a plan, before reporting done. Evidence beats memory.

Interaction

interaction
ask_user Prompt user for input or choices
Blocking
Description

Ask the user one or more questions with optional multiple-choice options and get their answers. Supports structured questionnaires, timeout, and retry on empty responses. Blocks until user responds.

Read-only
Yes
Category
interaction
Default Timeout
3600s
Parameters
ParameterTypeDescription
questionstringSingle free-text question
questionsarrayStructured questionnaire with options
timeout_secsintegerTimeout in seconds
allow_emptybooleanAllow empty responses (default: false)
max_attemptsintegerMax retry attempts (default: 3)
notify Show notification to the user
Read-only
Description

Show a notification message to the user. Supports info, warning, and error levels. Rate-limited to prevent spam (default: 10 per minute).

Read-only
Yes
Category
interaction
Rate Limit
10/min
Parameters
ParameterTypeDescription
messagestring requiredMessage to display
titlestringShort title
levelstringinfo, warning, or error

Skills

memory
discover_skills List available project skills
Read-only Concurrent
Description

List available skills with their descriptions. Skills are reusable, project-specific playbooks (SKILL.md files) covering how this repo does things. Optionally filter by query.

Read-only
Yes
Concurrency Safe
Yes
Category
memory
Parameters
ParameterTypeDescription
querystringOptional filter by name or description
Tip: Call when starting a task that might have project-specific conventions.
skill Load a skill's instructions
Read-only Concurrent
Description

Load a skill's instructions by name. Returns the full skill body; follow it inline for the rest of the task. Skills are re-read on every call for hot-reload support.

Read-only
Yes
Concurrency Safe
Yes
Category
memory
Parameters
ParameterTypeDescription
namestring requiredSkill name (from discover_skills)
Tip: Load once per task; its guidance stays in the conversation. Do not load skills speculatively.

Database

db
sql Execute SQL queries on session DB
Write
Description

Execute SQL queries against the session SQLite database. Pre-built tables: todos, todo_deps, session_state. Supports SELECT, INSERT, UPDATE, DELETE. Includes SQL injection detection as defense-in-depth.

Read-only
No
Category
db
Engine
SQLite
Parameters
ParameterTypeDescription
querystring requiredSQL query to execute
descriptionstring required2-5 word summary of the query
databasestringsession or session_store
Example
sql {"query": "INSERT INTO todos (id, title, status) VALUES ('auth', 'Implement auth', 'pending')", "description": "Create auth todo"}

MCP Resources

mcp
list_mcp_resources List resources from MCP servers
Read-only Concurrent
Description

List resources exposed by connected MCP servers. Resources are addressable data (files, schemas, records) that servers publish. Returns URI, server name, and description.

Read-only
Yes
Concurrency Safe
Yes
Category
general
Tip: Server names pair with /mcp status. URIs are stable across calls.
read_mcp_resource Read one MCP resource by URI
Read-only Concurrent
Description

Read one MCP resource by URI. Returns the resource's text content. Resources can be large; prefer narrow URIs when available.

Read-only
Yes
Concurrency Safe
Yes
Category
general
Parameters
ParameterTypeDescription
uristring requiredResource URI from list_mcp_resources
Tip: Do not call with guessed URIs — list first.

Policy

policy
violation_detected Report a policy violation
Read-only
Description

Report a policy violation (hacking, illegal acts, harmful code, credential theft, security bypass). Triggers escalation: warn (1st) → block_imminent (2nd) → blocked (3rd). User can override with valid justification.

Read-only
Yes
Category
policy
Escalation
3 strikes
Parameters
ParameterTypeDescription
typestring requiredhacking, illegal, harmful_code, credential_theft, security_bypass
severitystring requiredlow, medium, high, critical
user_messagestring requiredThe user's triggering message
agent_responsestring requiredAgent's response before detection
justificationstringUser's justification for override
block_session Block the current session
Read-only
Description

Block the current session due to persistent policy violations. Use after violation_detected returns 'blocked' action.

Read-only
Yes
Category
policy
Parameters
ParameterTypeDescription
reasonstring requiredReason for blocking the session
override_violation Override a violation with justification
Read-only
Description

Override a violation detection with user justification (e.g., authorized security research, educational purpose). Resets violation count.

Read-only
Yes
Category
policy
Parameters
ParameterTypeDescription
violation_typestring requiredType of violation to override
reasonstring requiredJustification for the override

How Tools Work

Tool Registry

Every tool is registered in a global tools.Registry at startup. The registry is thread-safe and supports cloning for sub-agent isolation. Tools provide a ToolMeta struct that documents itself: display name, category, when to use, when not to, examples, and per-model-family tuning.

Auto-documentation

Tool documentation is assembled from the LIVE registry every turn. RenderToolSections() groups tools by category, orders them deterministically (by category rank, inject order, then name), and renders each tool's metadata. Newly registered tools are documented automatically — no manual prompt maintenance required.

Execution Flow
  • The model emits a tool call with name and JSON arguments
  • The orchestrator looks up the tool in the registry
  • Arguments are coerced and validated against the tool's schema
  • Confirmation is checked (if required in current mode)
  • The tool executes and returns a Result (content + summary + metadata)
  • Output is truncated or ghosted if it exceeds limits
  • The result is appended to the conversation for the model to continue
Cost Estimation

Each tool provides an EstimatedCost() returning token approximation, typical latency, and risk level (low/medium/high). The orchestrator uses these to budget tool calls and prioritize cheaper tools when possible.

Confirmation System

How It Works

Tools declare whether they require confirmation via RequiresConfirmation(mode). The mode is the current agent phase (plan, edit, act). In plan mode, all mutating tools require user approval. In edit mode, write operations require approval. In act mode, most tools execute immediately.

Confirmation Behavior
  • Read-only tools (read_file, glob, grep): Never require confirmation
  • Write tools (write_file, edit_file): Require confirmation in edit/plan modes
  • Shell tools (bash): Require confirmation in plan/edit modes
  • Agent tools (task): Never require confirmation (they manage their own lifecycle)
User Override

When a confirmation dialog appears, the user can approve, reject, or provide feedback. Rejected tools return an error result that the model can react to. The user can also configure auto-approval for specific tools.

Per-tool Permissions

Configuration

You can configure per-tool permissions to control which tools the agent can use without confirmation. This is useful for automating repetitive tasks while keeping dangerous operations gated.

Commands
/permissions add <tool> # Allow tool without confirmation
/permissions remove <tool> # Restore confirmation requirement
/permissions list # Show current permissions
Examples
/permissions add read_file # Auto-approve all reads
/permissions add bash # Auto-approve shell commands
/permissions remove bash # Require confirmation for shell again
Tip: Start restrictive and add permissions as you trust the agent. Read-only tools are safe to auto-approve. Shell and write tools should require confirmation for new projects.

Tool Output Handling

Max Output

Tool output is bounded to prevent context window overflow:

  • read_file: Max 10,000 lines per call; use start_line/end_line for large files
  • bash output: Preserved to file (up to 5 GB); RAM buffer capped at 256 KB
  • grep: Results truncated at configurable limit
  • web_fetch: Body capped at 512 KB
  • secrets_scan: Max 100 findings per scan
Ghosting

When tool output exceeds a threshold, it is "ghosted" — a summary replaces the full content, with a pointer to the full output file. This keeps the context window manageable while preserving access to complete data.

Shell Output Files

Each async shell session writes output to ~/.automergent/shells/{id}.log. The RAM buffer holds only the last 256 KB. read_shell returns only new output since the last read, and points at the full file when the buffer was trimmed.

Security & Sandboxing

Blocked Write Paths

The configuration supports blocked_write_paths — directories where write_file, edit_file, multi_edit, and notebook_edit refuse to write. This protects critical system files, config directories, and vendor code.

Allowed Write Paths

When allowed_write_paths is set, ONLY those paths can be written to. This is a whitelist mode for maximum restriction — the agent can only modify files in specified directories.

Shell Sandboxing
  • Commands run in their own process group for clean termination
  • Sensitive environment variables (API keys, tokens) are stripped
  • Compound commands run sandboxed per policy
  • The size watchdog kills sessions exceeding 5 GB of output
  • The stall watchdog detects interactive prompts and advises the model
Web Fetch Protections
  • DNS rebinding protection: resolves once, validates all IPs
  • Blocks private/loopback/link-local addresses
  • Blocks cloud metadata endpoints (169.254.169.254)
  • Content-type allowlist (text/*, application/json, etc.)
  • Max redirect chain: 10, each validated
  • Body capped at 512 KB
File Reads
  • Symlinks are refused (TOCTOU protection via O_NOFOLLOW)
  • Binary files are detected and refused
  • Diagnostics are run pre-write to block error-introducing changes
Tip: Configure blockedWritePaths in your .automergent/config.yaml to protect sensitive directories. Start with the defaults and tighten as needed for your project.