Skip to main content

Module fs

Module fs 

Source
Expand description

Filesystem tools for the tcode tool registry.

Why: AI coding loops (e.g. the ai-coding-bake-off L1 agentic loop) need the agent to create, read, and patch files on the host filesystem. Providing typed ToolExecutor implementations instead of raw shell-exec keeps error handling structured, scoping to a working directory enforced, and path traversal impossible. What: Three ToolExecutor impls — ReadFileTool, WriteFileTool, and EditTool — each with an OpenAI-function-call schema and registration helpers. EditTool (#2068) supports three edit wire formats — SEARCH/REPLACE, unified-diff, and whole-file — selected per-model via edit_format. Errors use thiserror for clean structured error types. Test: read.rs, write.rs, and edit.rs each carry tempdir-based unit tests; edit_format carries its own matrix/application tests; registry_tests verifies all three tools appear in schemas() and dispatch through dispatch_gated.

Re-exports§

pub use edit::EditTool;
pub use read::ReadFileTool;
pub use write::WriteFileTool;

Modules§

edit
edit tool — per-model edit-format selection (#2068).
edit_format
Per-model edit-format selection for the edit tool (#2068, P1B-1).
read
read_file tool — read file contents, optionally limited to a line range.
write
write_file tool — create or overwrite a file, creating parent dirs as needed.

Enums§

FsError
Errors produced by filesystem tools.