Skip to main content
Loom provides a comprehensive set of built-in tools that enable AI agents to interact with codebases, execute commands, and track decisions. All tools are implemented as Jido Actions with structured schemas and consistent error handling.

Tool Categories

File Operations

Read, write, and edit files with line-numbered output and exact string replacement

Search

Find files by glob patterns and search content with regex

Shell & Git

Execute shell commands and perform git operations

Decision Tracking

Log and query decisions, goals, actions, and observations

Common Patterns

Path Resolution

All file and directory paths are relative to the project root. Loom automatically:
  • Validates paths to prevent directory traversal attacks
  • Resolves relative paths against the project directory
  • Returns absolute paths in results for clarity

Error Handling

All tools return structured results:
# Success
{:ok, %{result: "Operation completed successfully"}}

# Error
{:error, "Descriptive error message"}

Output Formatting

Tools format output consistently:
  • File paths are relative to project root
  • Line numbers use 1-based indexing
  • Results include headers with counts and metadata

Safety Features

All file operations use safe_path!/2 to prevent access outside the project directory:
# Blocked
file_path: "../../../etc/passwd"
# Allowed  
file_path: "lib/my_app/router.ex"
Search and shell tools limit output to prevent overwhelming responses:
  • Content search: 100 matches maximum
  • Shell output: 10,000 characters maximum
  • File read: configurable with offset and limit parameters
Search tools automatically exclude common build and dependency directories:
  • .git, _build, deps, node_modules
  • .elixir_ls, .lexical

Tool Schema Format

All tools use NimbleOptions schemas with typed parameters:
schema: [
  file_path: [type: :string, required: true, doc: "Path to the file"],
  offset: [type: :integer, doc: "Line number to start from"],
  limit: [type: :integer, doc: "Maximum lines to return"]
]

Next Steps

File Operations

Learn about reading, writing, and editing files

Search Tools

Explore file and content search capabilities

Build docs developers (and LLMs) love