# `LlmToolkit.CodeTools`
[🔗](https://github.com/fosferon/llm_toolkit/blob/v0.1.0/{path}#L{line})

Base code tools implementing `LlmToolkit.ToolResolver`.

Provides 12 tools every agentic consumer needs to interact with a
filesystem, shell, and the web.

## Tools

| Tool | Purpose |
|---|---|
| `read_file` | Read file contents with offset/limit |
| `write_file` | Write or overwrite a file |
| `edit_file` | Exact-match single edit (pi safety model) |
| `multi_edit` | Multiple edits in one call with rollback |
| `append_to_file` | Append content to a file |
| `bash` | Execute shell commands |
| `grep` | Search file contents (ripgrep) |
| `glob` | Find files by name pattern |
| `list_directory` | List directory contents |
| `tree` | Visual directory tree with sizes |
| `file_info` | File metadata (size, type, mtime) |
| `http_get` | Fetch a URL |

## Safety Model

The edit_file tool uses exact string matching with uniqueness validation —
the same model as pi's edit tool: oldText must match exactly once before any
write occurs. No silent corruption.

multi_edit extends this with transactional semantics: if any edit in the
batch fails, all changes are rolled back. The file is never left in a
partial state.

## Path Resolution

All file paths are resolved relative to `cwd`. When called through
`resolve/1` (the ToolResolver callback), cwd defaults to ".". When called
through `resolve/2`, the caller provides the working directory.

# `resolve`

```elixir
@spec resolve(LlmToolkit.Tool.Call.t(), String.t()) ::
  {:ok, String.t()} | {:error, String.t()}
```

Resolve and execute a tool call within the given working directory.

The `cwd` parameter is the dispatch working directory. Falls back to "."
if no cwd is provided (via `resolve/1`).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
