Tools

Pawan ships 34 built-in tools with tiered visibility, auto-install, typed parameter validation, and dynamic MCP discovery.

Tool Tiers

Tools are organized into tiers to save LLM prompt tokens:

TierToolsVisibility
Core (7)bash, read_file, write_file, edit_file, ast_grep, glob_search, grep_searchAlways in LLM prompt
Standard (15)git tools (9), agents (2), list_directory, edit_file_lines, insert_after, append_fileIn prompt by default
Extended (12)ripgrep, fd, sd, tree, mise, zoxide, lsp, deagle_search, deagle_keyword, deagle_sg, deagle_stats, deagle_mapHidden until first use, then auto-activated

Extended tools are always executable — they just don't appear in the LLM prompt until the model calls one. This saves ~40% prompt tokens on simple tasks.

Batteries-included: cargo install pawan is enough. The 5 deagle tools are embedded directly — pawan depends on deagle-core + deagle-parse as library crates, so there's no external deagle binary to install. For the 5 native tools (rg, fd, sd, ast-grep, erd), run pawan bootstrap once to install them via mise, or let pawan auto-install each one on first use. Idempotent and reversible via pawan uninstall.

File Tools

ToolDescription
read_fileRead file contents (supports line offset/limit)
write_fileCreate or overwrite a file. Auto-creates parent dirs. Path normalization detects double workspace prefix.
edit_fileString replacement editing (old_string → new_string)
edit_file_linesPrecise editing with anchor-mode (find line by content, not number)
insert_afterBlock-aware insertion (skips over function/struct bodies)
append_fileAppend content to end of file
list_directoryList directory contents with file metadata

Code Intelligence

ToolDescription
ast_grepAST-level code search and rewrite — structural patterns via tree-sitter. Multi-language. Fast.
lspLSP code intelligence via rust-analyzer — type-aware diagnostics, structural search/replace, symbol extraction.

ast-grep — structural patterns (multi-language)

# Find all unwrap() calls
ast_grep(action="search", pattern="$EXPR.unwrap()", lang="rust", path="src/")

# Replace unwrap() with ? operator in one shot
ast_grep(action="rewrite", pattern="$EXPR.unwrap()", rewrite="$EXPR?", lang="rust", path="src/")

# Find all function signatures
ast_grep(action="search", pattern="fn $F($$$A) { $$$ }", lang="rust", path=".")

$VAR matches single AST node, $$$VAR matches variadic (multiple nodes). Supports rust, python, js, ts, go, c, cpp, java.

lsp — type-aware intelligence (Rust)

# Find errors/warnings without cargo check
lsp(action="diagnostics", path=".")

# Structural search with type awareness
lsp(action="search", pattern="$a.foo($b)")

# Type-aware search+replace (knows $a is Option<T>)
lsp(action="ssr", pattern="$a.unwrap() ==>> $a?")

# Parse file symbols with types and hierarchy
lsp(action="symbols", path="src/lib.rs")

# Project-wide analysis stats
lsp(action="analyze", path=".")

When to use which:

deagle — graph-backed code intelligence (embedded)

Deagle is a Rust-native code intelligence engine (tree-sitter + SQLite) that indexes codebases into a graph database. As of v0.3.x, pawan embeds deagle-core + deagle-parse as library dependencies — there's no separate deagle binary to install. Pawan exposes 5 deagle tools:

ToolDescription
deagle_searchSymbol search by name with kind filter (function, struct, trait, class, import). Supports fuzzy matching.
deagle_keywordFull-text search with BM25 ranking (SQLite FTS5) — semantic concept queries
deagle_sgStructural AST pattern search via embedded ast-grep library
deagle_statsGraph database stats — node/edge counts, size
deagle_mapIndex or re-index a codebase (run once to bootstrap, then after major changes)
# Find a specific function definition
deagle_search(query="fetch_core_memory", kind="function")

# Semantic search for concept
deagle_keyword(query="authentication logic", limit=10)

# AST pattern — all impl blocks
deagle_sg(pattern="impl $TYPE { $$$ }", lang="rust")

# Verify index is populated
deagle_stats()

Before any deagle search works, run deagle_map() once to build the graph at <workspace>/.deagle/graph.db. Languages supported: Rust, Python, Go, TypeScript, JavaScript, Java, C, C++, Ruby (9 languages via tree-sitter parsers, as of deagle 0.1.5).

Search Tools

ToolDescription
glob_searchFind files by glob pattern (e.g., **/*.rs)
grep_searchSearch file contents by regex pattern
ripgrepNative rg wrapper — pattern, type filter, context, case-insensitive, max-depth
fdNative fd wrapper — find files by name/extension/type with max-depth and max-results

Shell & System

ToolDescription
bashExecute shell commands with configurable timeout
sdNative sd wrapper — find-and-replace in files (fixed strings or regex)
treeFilesystem tree with disk usage, line counts, metadata
misePolyglot tool/runtime/task/env manager — install tools, run tasks, manage envs
zoxideSmart directory navigation — query, add, list paths

tree — filesystem intelligence

# Lines of code per directory
tree(path="src/", disk_usage="line", layout="inverted")

# Find large files with human-readable sizes
tree(path=".", sort="size", human=true)

# Flat file listing (for piping)
tree(path=".", layout="flat", pattern="*.rs")

# Extended metadata: permissions, owner, timestamps
tree(path=".", long=true, hidden=true)

mise — tool/task/env manager

# Self-install any missing tool
mise(action="install", tool="ast-grep")

# Run project tasks defined in mise.toml
mise(action="run", task="test")

# Watch for changes and rerun
mise(action="watch", task="build")

# Search for available tools
mise(action="search", tool="python")

# Check for outdated tools
mise(action="outdated")

# Environment management
mise(action="env")

Git Tools

ToolDescription
git_statusRepository status (staged, unstaged, untracked)
git_diffShow changes (supports staged, file-specific)
git_addStage files for commit
git_commitCreate a commit with message
git_logView commit history (configurable count, format)
git_blameLine-by-line authorship for a file
git_branchList branches, show current branch
git_checkoutSwitch branches, create branches, restore files
git_stashStash operations: push, pop, list, drop, show

Agent

ToolDescription
spawn_agentSpawn a sub-agent for delegated tasks
spawn_agentsSpawn multiple sub-agents in parallel

MCP Tools

Pawan connects to MCP servers configured in pawan.toml:

[mcp.daedra]
command = "daedra"
args = ["serve", "--transport", "stdio", "--quiet"]

MCP tools are namespaced as mcp_<server>_<tool> (e.g., mcp_daedra_web_search).

List discovered tools: pawan mcp list

Edit Modes

Standard Edit

Replace exact strings in files — works like Claude Code's Edit tool.

Anchor Mode

Find the target line by content instead of line number. Immune to LLM line-counting errors.

anchor_text: "fn main()"
anchor_count: 1        # 1st occurrence (default)
new_content: "fn main() -> Result<()>"

Block-Aware Insert

insert_after detects if the anchor line ends with { and skips to the matching } before inserting.

Permissions

Tools support 3-tier permissions configured in pawan.toml:

LevelBehavior
allowExecute without asking (default for most tools)
denyTool is disabled — LLM gets an error response
promptTUI shows a y/n confirmation dialog; headless mode denies for safety
[permissions]
bash = "prompt"       # ask before running shell commands
write_file = "allow"  # auto-allow file writes
git_commit = "prompt" # confirm before committing

Read-only bash commands (ls, cat, grep, cargo check) are auto-allowed even under prompt permission.

Parameter Validation

All 34 tools have typed parameter definitions via thulp-core. Before execution, the agent validates arguments against the tool's parameter schema — catching missing required params, wrong types, and unknown fields before the tool runs.

Safety & Intelligence