Overview
Filesystem tools provide safe file operations with built-in workspace sandboxing, trust management, and recoverable deletion. All paths are resolved relative to the workspace, and operations outside the workspace require explicit user trust.Tools
read_file
Read the contents of a file with optional pagination for large files.File path to read (relative to workspace or absolute)
Starting line number (1-based). Omit to read from the beginning.
Maximum number of lines to read. Omit to read the entire file.
write_file
Create or overwrite a file with the given content. Uses atomic writes with a temporary file to prevent corruption.File path to write (relative to workspace or absolute)
Content to write to the file
edit_file
Find and replace a specific text string within a file. The old_text must appear exactly once to ensure precision.File path to edit
Exact text to find (must occur exactly once in the file)
Replacement text
append_file
Append content to the end of a file. Creates the file if it does not exist.File path to append to
Content to append
list_dir
List the contents of a directory with file sizes and types.Directory path to list (relative to workspace or absolute)
delete_file
Safely delete a file or directory by moving it to a date-stamped trash folder. This is NOT a permanent delete.File or directory path to delete (moved to trash)
memory, sessions, skills, cron, state, logs, .trash cannot be deleted.
trash_list
List files in the trash folder, grouped by deletion date. Example:trash_restore
Restore a file from trash back to a target path in the workspace.Name of the file in trash to restore
Trash date folder (YYYY-MM-DD). Defaults to most recent.
Target path to restore to (relative to workspace or absolute)
save_file
Save content to the structured Downloads directory (Downloads/YYYY-MM-DD/filename). Use for generated outputs, reports, and exports.Name of the file to save (e.g. ‘report.csv’, ‘output.json’)
Content to write to the file
Security Features
Workspace Sandboxing
Whenrestrict_to_workspace is enabled, all file operations are confined to the workspace directory. Attempts to access files outside the workspace are blocked with a clear error message.
Trust System
For paths outside the workspace (when sandboxing is disabled), the TrustManager prompts the user interactively before granting access. Use/trust [directory] to pre-authorize directories.
Safe Deletion
Deleted files are moved to.trash/YYYY-MM-DD/ instead of being permanently removed. This allows recovery via trash_restore if a deletion was accidental.
Implementation
All tools are defined ingrip/tools/filesystem.py and use:
- Path resolution with
_resolve_path()for workspace enforcement - Atomic writes with
.tmpfiles to prevent corruption - Human-readable file sizes for directory listings
- Date-stamped trash organization for easy recovery