TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Effectful-Tech/clanka/llms.txt
Use this file to discover all available pages before exploring further.
AgentTools module provides the core set of tools available to Clanka agents. It exports context services that agents depend on, a Toolkit containing all built-in tools, and Layer implementations that wire up real or mock handler backends.
Context services
These three services are required by specific tools and must be provided in the agent’sContext before the toolkit is executed.
CurrentDirectory
string. Tools such as readFile, bash, ls, and glob resolve relative paths against this value.
TaskCompleter
taskComplete tool when the agent signals that its task is finished.
SubagentExecutor
delegate tool to spawn a sub-agent and return its result.
makeContextNoop
Context with no-op implementations of all three services. The TaskCompleter is a no-op (Effect.void), and SubagentExecutor calls Effect.die. Useful in unit tests where agent context side-effects should not run.
Optional working directory to inject as
CurrentDirectory. Defaults to "/".Toolkits
AgentTools
search. Use this when the SemanticSearch layer is not available.
AgentToolsWithSearch
AgentTools merged with the search tool. The search tool requires the SemanticSearch service in context. Use this toolkit when you have a SemanticSearch layer wired up.
AgentToolsWithSearch is produced by Toolkit.merge(SearchTool, AgentTools). The search tool is only usable when a SemanticSearch layer is provided.Layers
AgentToolHandlers
Layer that provides handler implementations for all tools in AgentToolsWithSearch. It includes real ExaSearch and WebToMarkdown service implementations backed by external HTTP calls.
Requirements: FileSystem, Path, ChildProcessSpawner, HttpClient.
AgentToolHandlersTest
Layer identical to AgentToolHandlers but with ExaSearch and WebToMarkdown replaced by empty mock implementations. No HTTP client is required.
Tools
Each tool is registered inAgentTools (or AgentToolsWithSearch) via Tool.make. The sections below document each tool’s parameter schema and return type.
readFile
Read a file and return its content. Returns null if the file does not exist.
Path to the file. Resolved relative to
CurrentDirectory.1-based line number to start reading from. Lines before this are skipped.
1-based line number to stop reading at (inclusive).
string | null
writeFile
Write content to a file. Parent directories are created automatically. Prefer applyPatch when updating existing files.
Destination path, resolved relative to
CurrentDirectory.Full text content to write.
void. If SemanticSearch is available, the written file is re-indexed automatically.
removeFile
Remove a file from the filesystem.
Path of the file to remove, resolved relative to
CurrentDirectory.void. Removal is also forwarded to SemanticSearch when available.
renameFile
Rename or move a file. Parent directories for the destination are created automatically.
Source path, resolved relative to
CurrentDirectory.Destination path, resolved relative to
CurrentDirectory.void.
ls
List the entries in a directory.
Directory path, resolved relative to
CurrentDirectory.string[] — a list of entry names.
glob
Find files whose paths match a glob pattern.
A glob expression (e.g.
"src/**/*.ts"). Matched against paths under CurrentDirectory.string[] — matching paths relative to CurrentDirectory.
rg
Search for a regex pattern in files using ripgrep.
The regex or literal pattern to search for.
--glob filter passed to ripgrep (e.g. "*.ts").When
true, uses --files-with-matches to return only matching file paths instead of matching lines.Maximum number of output lines to return across all files. Defaults to
500.string — ripgrep output, with headings and line numbers.
bash
Run a bash command and return combined stdout and stderr output.
The shell command to run.
Timeout in milliseconds. Defaults to
120000 (2 minutes). Maximum is 240000 (4 minutes).string — the command output.
gh
Run the GitHub CLI (gh) with the given arguments. Prefer this over bash for GitHub operations.
Arguments to pass to the
gh binary (e.g. ["pr", "list", "--state", "open"]).string — the command output.
applyPatch
Apply a git-style unified diff to add, update, or delete one or more files in a single operation.
A git diff / unified diff / wrapped patch string.
string — a summary listing each affected file with its change type (A, M, or D).
webSearch
Search the web for recent information using the Exa search API.
The search query string.
Number of search results to retrieve. Defaults to
3.string — the text content of the top result.
fetchMarkdown
Fetch a web page and return its content converted to Markdown.
The URL to fetch.
string — the page content as Markdown.
delegate
Delegate a task to a sub-agent via SubagentExecutor. The sub-agent receives the task description as a prompt and its result is returned.
A description of the task to perform.
string — the sub-agent’s output.
taskComplete
Signal that the current task is complete and deliver the final output message. Only call this when all work is finished.
The final output message to send.
void. Invokes the TaskCompleter callback.
listTodos
Read the agent’s current todo list.
Parameters: none.
Returns: TodoItem[]
addTodo
Add a new item to the todo list.
The text of the todo item.
void.
updateTodo
Update an existing todo item by its numeric ID.
The ID of the todo item to update.
New text for the todo item.
New completion status.
void. Calls Effect.die if no item with the given ID exists.
clearTodos
Remove all items from the todo list.
Parameters: none.
Returns: void.
sleep
Pause execution for a given duration.
Number of milliseconds to sleep.
void.
search
Perform a semantic code search against the indexed codebase. Only available in AgentToolsWithSearch when a SemanticSearch layer is provided.
A natural-language description of what you are looking for (e.g.
"function that validates email addresses").string — the top-5 matching code chunks, joined with double newlines.