Engine reference — generated from the canonical engineering source. Do not edit this page by hand.
Tool Reference
Luna registers 92 built-in tools from the tool loader (core/tools/_loader.lua) on a fully-provisioned host. Registration is probe-honest per tool: 51 tools register unconditionally, 19 register only when their backing binary is detected at startup (13 general + the 6 desktop-environment tools), 10 register when their Lua module loads, and 12 computer-use tools are gated on a real display probe plus a required-binary census. The 74 non-computer-use built-ins are therefore 51 always + 13 binary-probed + 10 module-probed; the remaining 18 are the 12 computer-use + 6 desktop-environment probe-conditional block. computer_use_force = true overrides the CU display gate for the rare remote-X posture — the tools then register and their handlers fail typed on absent binaries (the runtime refusal stays as defense-in-depth). Every condition is recorded in the registration_probe census of ci/tools_manifest.json, machine-checked against the registration source by ci/tools_manifest_lint.py, and the taxonomy numbers above are derived from that census by ci/tools_taxonomy_parity_lint.py (no hand-copied counts). Dynamic MCP tools (mcp__), workspace custom tools (custom__), and plugin tools (plugin__) join these at runtime. All built-ins are prefixed builtin__ on the wire; the bare name shown below is accepted as an alias. Permission modes and per-mode rulesets control which tools are available (see permissions.md).
File Operations
bash
Execute shell commands in the working directory.
| Parameter | Type | Required | Description |
|---|---|---|---|
command | string | Yes | Shell command to execute |
timeout | number | No | Timeout in milliseconds (clamped to tool_timeout_max_ms, default max 600000) |
Default timeout is config.tool_timeout_ms (60000 ms when unset); the model-supplied value is clamped to a floor of 1 ms and a ceiling of tool_timeout_max_ms (default max 600000 ms)
Output limited to 16KB (truncated beyond that)
Runs in the current working directory
Exit code included in result
Commands run through the command policy (core.command_policy) — denied commands fail with Command blocked by policy
Example:
> Run `git status` to check for uncommitted changes
read_file
Read file contents with optional line range. Automatically detects image files and returns base64-encoded content blocks for vision-capable models.
| Parameter | Type | Required | Description |
|---|---|---|---|
path | string | Yes | Absolute file path |
offset | number | No | Starting line number (1-indexed) |
limit | number | No | Maximum lines to read |
Image files are returned as vision content blocks only when the current model supports vision; otherwise a (binary image file:...) placeholder is returned
Paths outside the workspace boundary are rejected
The current file content is pushed onto the undo stack before a later edit
write_file
Create or overwrite a file atomically.
| Parameter | Type | Required | Description |
|---|---|---|---|
path | string | Yes | File path |
content | string | Yes | File content |
Max size: 10MB (MAX_WRITE_SIZE)
Uses atomic write (mkostemp in the target directory, then rename)
Paths outside the workspace boundary are rejected
Queued through the mutation queue to prevent race conditions
Pushes prior content onto the undo stack; git snapshots are debounced after mutating tools complete
edit_file
Search and replace in an existing file. Tries exact match first, then fuzzy matching (whitespace normalization, indentation, single-line fuzzy).
| Parameter | Type | Required | Description |
|---|---|---|---|
path | string | Yes | File path |
old_text | string | Yes | Text to find |
new_text | string | Yes | Replacement text |
replace_all | boolean | No | Replace all occurrences instead of requiring uniqueness |
With replace_all unset, exact matches must be unique; otherwise the fuzzy matcher (core.fuzzy_match) runs language-aware strategies and reports which strategy matched
Fuzzy edits are written via atomic tmp + rename
Fails with old_text not found in file (exact and fuzzy) when nothing matches
Queued through the mutation queue to prevent race conditions
Pushes prior content onto the undo stack
multi_edit
Edit multiple files atomically in a single tool call. If any edit fails, all changes are rolled back.
| Parameter | Type | Required | Description |
|---|---|---|---|
edits | array | Yes | Array of edit objects |
Each edit object:
| Field | Type | Required | Description |
|---|---|---|---|
file_path | string | Yes | Path to the file |
old_string | string | Yes | Text to find |
new_string | string | Yes | Replacement text |
Each file’s original content is backed up before editing; a failure restores every backup All edits are applied atomically — partial failures roll back all changes
apply_patch
Apply a unified diff patch to files.
| Parameter | Type | Required | Description |
|---|---|---|---|
patch | string | Yes | Unified diff text |
Applies hunks atomically per file
list_directory
List files and directories in a given path.
| Parameter | Type | Required | Description |
|---|---|---|---|
path | string | Yes | Directory path |
Returns one name (type) entry per line
Does not recurse into subdirectories (use glob_search with ** for recursive listing)
create_directory
Create a directory and any necessary parent directories (like mkdir -p).
| Parameter | Type | Required | Description |
|---|---|---|---|
path | string | Yes | Directory path |
Creates all intermediate directories if they don’t exist
delete_file
Delete a file from the filesystem.
| Parameter | Type | Required | Description |
|---|---|---|---|
path | string | Yes | Path to delete |
Deletes files (an empty directory is removable via os.remove; a non-empty directory fails)
Queued through the mutation queue to prevent race conditions
notebook
Read and edit Jupyter notebook cells (.ipynb files).
| Parameter | Type | Required | Description |
|---|---|---|---|
command | string | Yes | Operation: list_cells, read_cell, edit_cell, add_cell |
file_path | string | Yes | Path to the .ipynb file |
cell_index | number | No | Cell index (0-based, for read_cell/edit_cell) |
content | string | No | Cell content (for edit_cell/add_cell) |
cell_type | string | No | code or markdown (for add_cell, default: code) |
Parses and validates notebook JSON structure
Cell indices are 0-based
edit_cell writes go through the workspace write-path guard
notebook_sync
Convert between Jupyter notebooks and text files using jupytext.
| Parameter | Type | Required | Description |
|---|---|---|---|
action | string | Yes | Conversion direction (e.g. notebook_to_script, script_to_notebook) |
input_path | string | Yes | Source .ipynb or script path |
output_path | string | No | Destination path |
format | string | No | jupytext script format |
Requires jupytext on PATH
format_file
Format a source file using the appropriate formatter for its language.
| Parameter | Type | Required | Description |
|---|---|---|---|
path | string | Yes | File path |
formatter | string | No | Force a specific formatter |
dry_run | boolean | No | Report what would change without writing |
Supports Python (black + isort), Erlang (erlfmt), Lua (stylua), C/C++ (clang-format) Write-class: gated by RBAC write permission
lint_file
Lint a source file using all registered linters for its language.
| Parameter | Type | Required | Description |
|---|---|---|---|
path | string | Yes | File path |
linter | string | No | Restrict to a single linter |
Supports Python (flake8 + pylint), Lua (luacheck) Write-class: gated by RBAC write permission
Search
glob_search
Find files matching a glob pattern.
| Parameter | Type | Required | Description |
|---|---|---|---|
pattern | string | Yes | Glob pattern (supports ** recursive) |
path | string | No | Base directory (default: workspace root) |
Max 1000 results; beyond that a ... and N more results truncated line is appended
Supports standard glob patterns: *, **, ?, [...]
Results are returned in directory-walk order (not sorted by modification time)
grep_search
Search file contents with a regex pattern.
| Parameter | Type | Required | Description |
|---|---|---|---|
pattern | string | Yes | Regular expression pattern |
path | string | No | Base directory (default: workspace root) |
include | string | No | File pattern filter (e.g. *.lua) |
Engine ladder: ripgrep → silver searcher → grep -P (Perl regex) → grep -E (extended regex)
Returns matching lines with file paths and line numbers
Max 250 matched lines
Timeout defaults to config.tool_timeout_ms (30000 ms when unset)
code_search
Search code using language-server analysis or text search fallback.
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | Yes | Search query (symbol name or text pattern) |
search_type | string | Yes | Type: definition, references, symbols, text |
file_path | string | No | Limit search to this file |
language | string | No | Limit search to this language |
Falls back to text-based grep when no language server is available Results truncated at 2KB
Code Intelligence
lsp
Query a language server for code intelligence operations (fused entry point).
| Parameter | Type | Required | Description |
|---|---|---|---|
operation | string | Yes | LSP operation (see below) |
path | string | Yes | File path (relative to workspace) |
line | number | Yes | Line number (1-based) |
character | number | Yes | Column number (1-based) |
Supported operations:
| Operation | Description |
|---|---|
goToDefinition | Jump to the definition of the symbol at the given position |
findReferences | Find all references to the symbol at the given position |
hover | Get hover/type information for the symbol at the given position |
documentSymbol | List all symbols defined in the file (line/character not required) |
diagnostics | Get diagnostic messages (errors/warnings) for the file |
Requires a running language server for the file type (auto-started by the LSP manager)
The same operations are also exposed as six individual tools below (lsp_definition, lsp_references, lsp_hover, lsp_completion, lsp_symbols) plus tree-sitter ts_query
Diagnostics are also automatically injected into edit_file and write_file results
lsp_definition
Navigate to a symbol’s definition. Returns file path and line number.
| Parameter | Type | Required | Description |
|---|---|---|---|
path | string | Yes | File path |
line | number | Yes | Line number (1-based) |
character | number | Yes | Column number (1-based) |
lsp_references
Find all references to a symbol. Returns list of file, line, column, and text.
| Parameter | Type | Required | Description |
|---|---|---|---|
path | string | Yes | File path |
line | number | Yes | Line number (1-based) |
character | number | Yes | Column number (1-based) |
lsp_hover
Get hover documentation for a symbol. Returns type signature and doc string.
| Parameter | Type | Required | Description |
|---|---|---|---|
path | string | Yes | File path |
line | number | Yes | Line number (1-based) |
character | number | Yes | Column number (1-based) |
lsp_completion
Get code completion suggestions at a position. Returns list of completion items.
| Parameter | Type | Required | Description |
|---|---|---|---|
path | string | Yes | File path |
line | number | Yes | Line number (1-based) |
character | number | Yes | Column number (1-based) |
lsp_symbols
Get document symbols (outline with hierarchy). Returns symbol list with nesting.
| Parameter | Type | Required | Description |
|---|---|---|---|
path | string | Yes | File path |
ts_query
Query code structure using tree-sitter syntax patterns. Returns structured results for named query types.
| Parameter | Type | Required | Description |
|---|---|---|---|
file_path | string | Yes | Source file path |
query_type | string | Yes | One of functions, classes, imports, exports, calls, symbols |
language | string | No | Force language (auto-detected from extension otherwise) |
ast_query
Query a source file’s syntax tree using tree-sitter patterns.
| Parameter | Type | Required | Description |
|---|---|---|---|
file_path | string | Yes | Source file path |
query | string | Yes | Tree-sitter query/pattern |
language | string | No | Force language |
format | string | No | structured or text output |
code_stats
Get structure statistics for a source file.
| Parameter | Type | Required | Description |
|---|---|---|---|
file_path | string | Yes | Source file path |
symbol_lookup
Look up symbol definitions in the codebase using ctags. Returns structured list of {symbol, file, line, kind}.
| Parameter | Type | Required | Description |
|---|---|---|---|
symbol | string | Yes | Symbol name to look up |
kind | string | No | Filter by kind: function, variable, class, etc. |
file | string | No | Filter by file path pattern |
generate | boolean | No | Force regenerate tags file |
ctags_run
Run ctags to generate or update a tags file. Returns raw output with stats.
| Parameter | Type | Required | Description |
|---|---|---|---|
paths | array | No | Paths to index |
languages | string | No | Language filter |
extras | string | No | Extra ctags options |
Dev Tools
cmake_configure
Run cmake configure step. Generates build files.
| Parameter | Type | Required | Description |
|---|---|---|---|
source_dir | string | No | Source directory |
build_dir | string | No | Build directory |
generator | string | No | CMake generator |
args | array | No | Extra cmake arguments |
cmake_build
Run cmake build step.
| Parameter | Type | Required | Description |
|---|---|---|---|
build_dir | string | No | Build directory |
target | string | No | Build target |
jobs | number | No | Parallel jobs |
runtime_list
List available runtimes and their versions via asdf.
| Parameter | Type | Required | Description |
|---|---|---|---|
runtime | string | No | Restrict to one runtime name |
Code Execution
code_exec
Execute code in a sandboxed environment with resource limits.
| Parameter | Type | Required | Description |
|---|---|---|---|
language | string | Yes | One of python, lua, node, shell |
code | string | Yes | Source code to execute |
timeout | number | No | Timeout in seconds (default 30, clamped to max 120) |
stdin | string | No | Optional stdin input |
Unsupported languages fail with unsupported language: <name>
Git
git
Execute read-only structured git operations in the workspace repository.
| Parameter | Type | Required | Description |
|---|---|---|---|
command | string | Yes | Read sub-command (see below) |
args | string | No | Optional arguments for the command |
path | string | No | Optional file path (for diff) |
Supported sub-commands (all safe/read-class):
| Command | Description |
|---|---|
status | Show working tree status (--porcelain) |
diff | Show unstaged changes (optional file path) |
log | Show commit log (last 20, --oneline) |
branch | List all branches (-a) |
show | Show commit details |
stash_list | List stashed changes |
Mutating sub-commands are not accepted here — the tool answers mutating operations (add, commit, stash, checkout) require the git_write tool
Dangerous patterns are blocked in both command and args: force push, hard reset, clean, filter-branch, rebase, reflog expire, force branch delete, force worktree remove
Force flags (-f, --force, -D) are rejected unless the command is an approved write-class command
git_write
Execute mutating git operations in the workspace repository. Write-class: gated by RBAC write permission — the read-granted git tool never mutates.
| Parameter | Type | Required | Description |
|---|---|---|---|
command | string | Yes | One of add, commit, stash, checkout |
args | string | No | Optional arguments (e.g. commit message) |
path | string | No | Optional file path (for add) |
Same dangerous-pattern and force-flag blocklist as git
git_snapshot
Manage git snapshots for file-level undo and review. Snapshots are auto-created after mutating tools (write_file, edit_file, delete_file).
| Parameter | Type | Required | Description |
|---|---|---|---|
command | string | Yes | Operation: list, diff |
snapshot_id | string | No | Snapshot commit hash (for diff) |
count | number | No | Number of snapshots to list (default: 10) |
Snapshots use the [luna] commit prefix
Restore is a SEPARATE write-class tool — git_snapshot_restore: snapshot restore is a workspace-mutating checkout, so the read-granted git_snapshot never exposes it; permission-gate restore through the write-class tool instead.
git_snapshot_restore
Restore files from a git snapshot. Write-class: mutates the workspace — requires write permission, never reachable via the read-granted git_snapshot.
| Parameter | Type | Required | Description |
|---|---|---|---|
snapshot_id | string | Yes | Snapshot commit hash to restore |
files | array | No | File paths to restore (default: all files in the snapshot) |
Integrated with undo_edit — snapshot restore is available through the undo stack
Web
web_fetch
Fetch content from a URL.
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | URL to fetch (must start with http:// or https://) |
format | string | No | Response format: text (default) or markdown |
Bodies over 1MB are rejected (response too large)
Every redirect hop is re-validated by the shared fetch module (curl-side follow disabled)
Gated by the sandbox network policy (execution.sandbox.network); per-host policy applies
HTML is automatically stripped of scripts/styles/tags when format=text
web_search
Search the web using a configurable search backend (SearXNG or Brave Search API).
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | Yes | Search query |
max_results | number | No | Maximum results (default: 10) |
Returns results with titles, URLs, and snippets
SearXNG backend needs config.web_search_url; Brave backend needs config.brave_api_key
http_request
Make HTTP requests directly (GET, POST, PUT, PATCH, DELETE, HEAD).
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | Request URL |
method | string | Yes | HTTP method: GET, POST, PUT, PATCH, DELETE, HEAD |
headers | object | No | Request headers |
body | string | No | Request body |
timeout | number | No | Timeout in milliseconds (default 10000 buffered / 30000 streaming, max 600000) |
stream | boolean | No | Stream response (for large bodies) |
max_stream_bytes | number | No | Max bytes when streaming (default: 100KB) |
Only http:// and https:// URLs allowed
Response truncated at 10KB (use stream=true for larger responses)
More flexible than web_fetch — supports all HTTP methods and custom headers
MCP
mcp_read_resource
Read a resource from an MCP server.
| Parameter | Type | Required | Description |
|---|---|---|---|
uri | string | Yes | MCP resource URI |
server | string | No | Specific MCP server name (omitted = try all) |
If no server is specified, tries all connected MCP servers
mcp_get_prompt
Get a prompt template from an MCP server.
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Prompt template name |
arguments | object | No | Template arguments |
server | string | No | Specific MCP server name (omitted = try all) |
Vision
attach_image
Attach an image file to the conversation for multimodal analysis. Supports PNG, JPEG, GIF, and WebP formats.
| Parameter | Type | Required | Description |
|---|---|---|---|
path | string | Yes | Absolute path to the image file |
Max image size: 20MB Automatically detects MIME type from file content Requires a vision-capable model
Agent
clarify
Ask the user a clarifying question and wait for their response.
| Parameter | Type | Required | Description |
|---|---|---|---|
question | string | Yes | The question to ask |
options | array | No | Optional list of choices for the user to select from |
context | string | No | Optional context explaining why the question is being asked |
mixture_of_agents
Run multiple agents on the same task and aggregate results.
| Parameter | Type | Required | Description |
|---|---|---|---|
task | string | Yes | The task for all agents |
agents | integer | No | Number of agents (default: 3) |
strategy | string | No | vote (synthesize best), best (longest output), or merge (combine all) |
Ask-permission class: the user is consulted before the fan-out Requires a parent agent context
Session
todo
Manage a session-scoped task checklist for tracking progress on multi-step tasks.
| Parameter | Type | Required | Description |
|---|---|---|---|
action | string | Yes | Action: list, add, update, remove |
id | string | No | Task ID (for update/remove) |
text | string | No | Task description (for add) |
status | string | No | Status: pending, in_progress, completed |
priority | string | No | Priority: high, medium, low |
Persists across turns within the session
undo_edit
Undo the last file edit(s), reverting to the original content.
| Parameter | Type | Required | Description |
|---|---|---|---|
count | number | No | Number of edits to undo (default: 1) |
Maintains a stack of up to 50 undo entries Restores the file to its state before the edit Supports git snapshot undo when snapshots are available
Session Rollback
Use the /rollback [N] slash command to remove the last N conversation turns from the active message view. This is useful for recovering from unproductive tangents without losing the entire session.
Auto-branches before dropping turns (creates a snapshot) Returns branch ID and dropped turn count Works on the active message view, not compacted messages Default N = 1 if not specified
Example:
/rollback 3 # Remove last 3 turns, auto-branches first
/rollback # Remove last turn
task
Spawn a sub-agent to handle a specific task in isolation with its own context.
| Parameter | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | Task description for the sub-agent |
tools | array | No | Restrict sub-agent to these tools (default: same as parent) |
backend | string | No | Backend: local, zmq, team, background (default: local) |
Sub-agent runs with its own context, up to 20 steps 60-second timeout per sub-agent Returns the sub-agent’s output to the parent conversation
background_spawn
Spawn a background sub-agent that runs asynchronously. Returns immediately with a task_id.
| Parameter | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | Task description for the background sub-agent |
tools | array | No | Restrict sub-agent to these tools (default: same as parent) |
timeout | number | No | Timeout in seconds (default: 120) |
callback | string | No | Callback name for result delivery |
Collect results later via the background task check/await flow
check_background
List background sub-agent tasks: completed results (collected once, then removed) plus the ids still pending. Takes no parameters.
| Parameter | Type | Required | Description |
|---|---|---|---|
| — | — | — | No parameters |
await_background
Wait (bounded) for background sub-agent tasks to finish and return their results. With no ids, waits for every pending task.
| Parameter | Type | Required | Description |
|---|---|---|---|
task_id | string | No | A single background task id to await |
task_ids | array | No | Background task ids to await (default: all pending) |
timeout | number | No | Whole-wait budget in seconds (default 60, capped at 300) |
Unknown/already-collected ids do not busy-wait; use check_background for
the collected set.
read_tool_output
Read a persisted tool output by its handle (the tool_use_id or message id
shown in a [persisted-output] marker). Use offset/limit for long
outputs.
| Parameter | Type | Required | Description |
|---|---|---|---|
handle | string | Yes | Handle from the persisted-output marker |
offset | number | No | Byte offset (default 0) |
limit | number | No | Maximum bytes to read (default 4000, max 12000) |
switch_mode
Switch the agent to a different operating mode during execution.
| Parameter | Type | Required | Description |
|---|---|---|---|
mode | string | Yes | Mode name (build, plan, explore, review, general, or custom) |
reason | string | Yes | Why the mode switch is needed |
Available modes: build, plan, explore, review, general, plus user-defined modes
Updates tool permissions, system prompt, and TUI badge immediately
Subject to the agent.mode_switch_request hook (can be vetoed)
session_search
Search across all session message content using full-text search. Returns matching messages with highlighted snippets.
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | Yes | Search query |
limit | number | No | Maximum matches to return |
summarize | boolean | No | Return a summarized result set |
session_recent
List recent sessions with metadata (title, model, message count, date).
| Parameter | Type | Required | Description |
|---|---|---|---|
limit | number | No | Maximum sessions to list |
Team
Team work assignment is server-driven: enrolled workers receive signed
team_directive frames (leader-attributed + HMAC-verified), and the
team_mail tool below carries coordination messages. The retired
team_spawn tool could never succeed — it posted an empty worker_id,
which Sol refuses (400 invalid_worker_id); retired it.
team_mail
Send a message to team members via the team priority mailbox.
| Parameter | Type | Required | Description |
|---|---|---|---|
team_id | string | Yes | Team ID |
body | string | Yes | Message body |
to | string | No | Recipient worker ID or all |
subject | string | No | Message subject |
priority | string | No | Priority: high, normal, low |
Messages are delivered via the team priority mailbox with TTL expiry
Supports broadcast (to=all) and direct messaging
Goals
goal_create
Create a new goal for tracking progress on a multi-step task. Returns goal ID and metadata.
| Parameter | Type | Required | Description |
|---|---|---|---|
objective | string | Yes | What the goal should achieve |
tasks | array | No | Initial task list |
goal_get
Get the current status and details of a goal by ID.
| Parameter | Type | Required | Description |
|---|---|---|---|
goal_id | string | Yes | Goal ID |
goal_update
Update a goal’s status, progress, or notes.
| Parameter | Type | Required | Description |
|---|---|---|---|
goal_id | string | Yes | Goal ID |
status | string | No | New status |
progress | string | No | Progress note |
notes | string | No | Free-form notes |
goal_list
List goals with optional status filter.
| Parameter | Type | Required | Description |
|---|---|---|---|
status | string | No | Filter by status |
limit | number | No | Maximum goals to list |
Scheduler
schedule
Schedule a recurring or one-time task.
| Parameter | Type | Required | Description |
|---|---|---|---|
expression | string | Yes | Cron expression or natural language (every 5 minutes, at 3pm tomorrow) |
command | string | No | Shell command to execute (omit for reminder-only) |
description | string | No | Human-readable description |
schedule_list
List scheduled tasks with their status and next run times.
| Parameter | Type | Required | Description |
|---|---|---|---|
limit | number | No | Maximum jobs to list |
schedule_cancel
Cancel a scheduled task by job ID.
| Parameter | Type | Required | Description |
|---|---|---|---|
job_id | string | Yes | Scheduled job ID |
Shares
session_share_create
Create a public share link for session data (messages, summaries, exports).
| Parameter | Type | Required | Description |
|---|---|---|---|
session_data | string | Yes | Session data to share |
format | string | No | Output format |
ttl_days | number | No | Share lifetime in days |
Returns {share_id, url?} — url is only present when the server has base_url configured
session_share_get
Retrieve the data behind a session share link.
| Parameter | Type | Required | Description |
|---|---|---|---|
share_id | string | Yes | Share ID |
Returns {data, format, created_at}; errors on not-found (404 — expired
shares are indistinguishable from never-existed since )
System
port_check
Check which process is listening on a port or holding a file open. Requires lsof.
| Parameter | Type | Required | Description |
|---|---|---|---|
port | number | No | Port to inspect |
file | string | No | File to inspect |
strace_process
Trace system calls of a running or newly spawned process. Summary mode by default. Requires strace. Max duration 30s.
| Parameter | Type | Required | Description |
|---|---|---|---|
pid | number | No | Existing process ID to trace |
command | string | No | Spawn and trace a new command |
duration | number | No | Trace duration in seconds |
filter | string | No | Syscall filter |
numa_info
Get NUMA topology and hardware core information. Requires numactl.
| Parameter | Type | Required | Description |
|---|---|---|---|
| (none) |
json_from_shell
Generate JSON from shell arguments using jo. Example: jo name=test count=42. Requires jo.
| Parameter | Type | Required | Description |
|---|---|---|---|
args | array | Yes | jo-style key=value arguments |
Containers
container_list
List containers. Returns structured [{id, name, image, status, ports}].
| Parameter | Type | Required | Description |
|---|---|---|---|
all | boolean | No | Include stopped containers |
filter | string | No | Filter by name |
container_run
Run a container. Returns container ID.
| Parameter | Type | Required | Description |
|---|---|---|---|
image | string | Yes | Container image |
command | string | No | Command to run in the container |
name | string | No | Container name |
rm | boolean | No | Remove container on exit |
detach | boolean | No | Run detached |
SSH
ssh_agent_status
Show SSH agent status via keychain. Returns structured agent info, key fingerprints, and environment.
| Parameter | Type | Required | Description |
|---|---|---|---|
action | string | No | Sub-action |
key_path | string | No | Specific key path |
Utility
calculator
Evaluate mathematical expressions safely (no code execution).
| Parameter | Type | Required | Description |
|---|---|---|---|
expression | string | Yes | Math expression using +, -, *, /, ^, sqrt, sin, cos, tan, log, floor, ceil, abs, min, max, pi, e |
Safe evaluation — expressions run in a restricted math-only environment
Returns numeric result as string
Supports constants: pi, e
diagram
Generate Mermaid diagrams from descriptions.
| Parameter | Type | Required | Description |
|---|---|---|---|
description | string | Yes | Description of what the diagram should show |
diagram_type | string | No | Type: flowchart, sequence, class, state, er, gantt |
code | string | No | Direct Mermaid code (if provided, description is ignored) |
Returns Mermaid syntax that can be rendered by compatible viewers
Validates Mermaid syntax when code is provided directly
file_watcher
Watch a file or directory for changes and report when a modification is detected.
| Parameter | Type | Required | Description |
|---|---|---|---|
path | string | Yes | File or directory path to watch |
timeout | number | No | Seconds to watch (default: 10, max: 60) |
Uses inotify (FFI) when available, falls back to stat-based polling Returns change event details or “No changes detected” on timeout
repo_overview
Generate a structured overview of a repository including language detection, file counts, and directory structure.
| Parameter | Type | Required | Description |
|---|---|---|---|
path | string | No | Repository path (default: workspace root) |
depth | number | No | Directory-tree depth |
Desktop Environment Tools (Conditional)
Six desktop-environment tools register only when their backing binary is detected at startup:
| Tool | Permission | Probe (binary on PATH) | Description |
|---|---|---|---|
window_manage | execute | bspc | Manage windows: list, focus, close, move, resize, desktops, layout, fullscreen |
desktop_notify | execute | notify-send | Send desktop notifications |
display_layout | execute | xrandr | Get or set display/monitor configuration |
window_info | read | xwininfo or xprop | Get window geometry, title, class, and properties |
audio_control | execute | pactl | Control audio via PulseAudio/PipeWire (sinks, volume, mute) |
xrdb_query | write | xrdb | Query or load the X11 resource database |
window_manage
Manage windows via bspwm tiling window manager. Only available when bspwm is detected.
| Parameter | Type | Required | Description |
|---|---|---|---|
action | string | Yes | Action: list, focus, close, move, resize, desktops, layout, fullscreen |
node_id | string | No | Window/node ID (required for most actions) |
target | string | No | Target desktop name or direction |
direction | string | No | Resize direction: left, right, top, bottom |
pixels | number | No | Resize amount in pixels (default: 50) |
Requires bspwm window manager Input sanitized to prevent shell injection
desktop_notify
Send desktop notifications via notify-send. Only available when libnotify is detected.
| Parameter | Type | Required | Description |
|---|---|---|---|
title | string | Yes | Notification title (max 100 chars) |
body | string | No | Notification body (max 200 chars) |
urgency | string | No | Urgency: low, normal, critical (default: normal) |
Requires libnotify (notify-send)
Input sanitized to prevent shell injection
display_layout
Get or set display configuration through xrandr. Lists connected monitors,
changes resolution/rate, or arranges outputs.
| Parameter | Type | Required | Description |
|---|---|---|---|
action | string | No | list (default), arrange, or resolution |
monitor | string | No | Monitor output name (required for arrange/resolution) |
resolution | string | No | Resolution, e.g. 1920x1080 |
position | string | No | Arrangement, e.g. right-of DP-1 or an absolute position |
rate | number | No | Refresh rate in Hz |
primary | boolean | No | Set the output as primary |
Requires xrandr; execute-class.
window_info
Read detailed window geometry, title, WM_CLASS, and properties. Requires
xwininfo and/or xprop.
| Parameter | Type | Required | Description |
|---|---|---|---|
action | string | No | active (default), id, or children |
window_id | string | No | Window id (hex) for id/children |
Read-class.
audio_control
Control audio through PulseAudio/PipeWire. Lists sinks/sources, sets volume, mutes or unmutes.
| Parameter | Type | Required | Description |
|---|---|---|---|
action | string | Yes | list_sinks, set_volume, mute, or unmute |
sink | string | No | Sink name or index (default: @DEFAULT_SINK@) |
volume | number | No | Volume level 0–100 |
Requires pactl; execute-class.
xrdb_query
Query or load the X11 resource database.
| Parameter | Type | Required | Description |
|---|---|---|---|
action | string | No | query (default), get, or load |
resource | string | No | Resource name for get |
file | string | No | File to load (path is workspace-gated) |
Requires xrdb; write-class (mutates display state).
Computer Use Tools
Twelve computer-use tools register only when the display probe detects an X11/Wayland session (core.computer_use.detect_display_server) AND the per-tool required-binary census passes. On a headless host none register — the worker no longer advertises tools that can only fail. computer_use_force = true in the config re-registers the whole block for the remote-X posture; each handler then fails typed (no display server detected) on absent binaries, and the runtime refusal remains as defense-in-depth.
| Tool | Probe (X11 / Wayland) | Permission |
|---|---|---|
screenshot | scrot / grim | execute |
mouse_move | xdotool / ydotool | execute |
mouse_click | xdotool / ydotool | execute |
mouse_drag | xdotool / ydotool | execute |
type_text | xdotool / wtype | execute |
press_key | xdotool / wtype | execute |
scroll | xdotool / ydotool | execute |
get_cursor | xdotool / — (unsupported on Wayland) | read |
display_info | display only | read |
window_list | wmctrl / swaymsg | read |
clipboard_read | xclip / wl-paste | read |
clipboard_write | xclip / wl-copy | write |
screenshot
Capture the screen. Requires scrot (X11) or grim (Wayland).
| Parameter | Type | Required | Description |
|---|---|---|---|
mode | string | No | full (default), region, or window |
region | array | No | Crop region [x, y, width, height] in pixels |
Execute-class.
mouse_move
Move the pointer to the given screen coordinates. Requires xdotool or
ydotool.
| Parameter | Type | Required | Description |
|---|---|---|---|
x | number | Yes | X coordinate in pixels |
y | number | Yes | Y coordinate in pixels |
mouse_click
Click at the current pointer position. Requires xdotool or ydotool.
| Parameter | Type | Required | Description |
|---|---|---|---|
button | string | No | left (default), right, or middle |
count | number | No | Click count (default 1; use 2 for double-click) |
mouse_drag
Drag from one position to another (press, move, release). Requires xdotool
or ydotool.
| Parameter | Type | Required | Description |
|---|---|---|---|
start_x | number | Yes | Starting X coordinate |
start_y | number | Yes | Starting Y coordinate |
end_x | number | Yes | Ending X coordinate |
end_y | number | Yes | Ending Y coordinate |
type_text
Type text at the current cursor position. Requires xdotool or wtype.
| Parameter | Type | Required | Description |
|---|---|---|---|
text | string | Yes | Text to type |
press_key
Press a key or key combination. Requires xdotool or wtype.
| Parameter | Type | Required | Description |
|---|---|---|---|
keys | string | Yes | Key combination, e.g. ctrl+shift+a, Return, Escape |
scroll
Scroll at the current pointer position. Requires xdotool or ydotool.
| Parameter | Type | Required | Description |
|---|---|---|---|
direction | string | No | up or down (default down) |
amount | number | No | Number of scroll steps (default 3) |
get_cursor
Read the current pointer position. Requires xdotool; unsupported on
Wayland.
| Parameter | Type | Required | Description |
|---|---|---|---|
| — | — | — | No parameters |
Read-class.
display_info
Read screen resolution and display information.
| Parameter | Type | Required | Description |
|---|---|---|---|
| — | — | — | No parameters |
Read-class.
window_list
List visible windows on the desktop. Requires wmctrl or swaymsg.
| Parameter | Type | Required | Description |
|---|---|---|---|
| — | — | — | No parameters |
Read-class.
clipboard_read
Read the current clipboard contents. Execute-class: the clipboard can
carry passwords/OTPs from other applications, so consent is required.
Requires xclip or wl-paste.
| Parameter | Type | Required | Description |
|---|---|---|---|
| — | — | — | No parameters |
clipboard_write
Write text to the system clipboard. Requires xclip or wl-copy.
| Parameter | Type | Required | Description |
|---|---|---|---|
text | string | Yes | Text to write |
Write-class.
Budget Limits
Control per-session spending with the --budget CLI flag:
luajit client/main.lua --budget <USD> --print "Analyze this codebase"
--budget <USD> — set a per-session USD budget
session_budget_usd config key (default: 0 = unlimited)
Agent loop checks accumulated cost after each provider call
Returns {budget_exceeded: true} when cost exceeds budget
Cost tracking uses per-model rate tables (see core/cost_tracker.lua)
Tool Auto-Discovery (S71)
Luna scans the workspace for custom tool definitions and makes them available to the agent alongside built-in tools.
Workspace scanning — Discovers tools from .luna/tools/ and ~/.luna/tools/ directories
Hot-reload — Use /tools-reload slash command to rescan and pick up new tools without restarting
Listing — Use /tools-list slash command to display all available tools (built-in + discovered)
Namespacing — Custom tools are prefixed with custom__; MCP tools with mcp__; plugin tools with plugin__; built-in tools with builtin__
Tool Selection
The LLM agent selects tools based on the task. Common patterns:
| Task | Tools Used |
|---|---|
| Explore codebase | glob_search, grep_search, read_file, list_directory |
| Fix a bug | read_file, bash (to reproduce), edit_file, undo_edit |
| Create a new file | write_file |
| Refactor code | glob_search, read_file, edit_file, multi_edit |
| Run tests | bash |
| Research online | web_search, web_fetch |
| Make API calls | http_request |
| Code navigation | lsp (goToDefinition, findReferences, hover) |
| Track multi-step work | todo |
| Delegate subtask | task (sub-agent) |
| Team collaboration | team_mail (+ signed server-driven team directives) |
| Analyze images | attach_image (with vision-capable model) |
| Undo file changes | undo_edit, git_snapshot_restore |
| Work with notebooks | notebook |
| Generate diagrams | diagram |
| Quick math | calculator |
| Watch for file changes | file_watcher |
| Ask the user | clarify |
| Search past sessions | session_search, session_recent |