Skip to content

Filesystem adapter

This adapter gives coding flows sandboxed filesystem access. It can read, write, edit, delete, list, glob, and grep files, and all of these are confined to a workspace root. Every action requires workspaceRoot, which is an absolute path to the project folder. All path and pattern values are confined to that folder, and any access outside it is refused.

Required fieldTypeDescription
workspaceRootstringAbsolute path to the project folder
pathstringFile path relative to workspaceRoot
read_main[action: "Read main"] {
adapter: "fs"
actionId: "read-file"
workspaceRoot: "/Users/me/project"
path: "src/main.rs"
}

Create or overwrite a file (parent directories auto-created).

Required fieldTypeDescription
workspaceRootstringAbsolute path to the project folder
pathstringFile path relative to workspaceRoot
contentstringFull file contents to write
write_cfg[action: "Write config"] {
adapter: "fs"
actionId: "write-file"
workspaceRoot: "/Users/me/project"
path: "config/app.toml"
content: "debug = true"
}

Replace an exact substring in a file (must be unique unless replaceAll).

FieldTypeDescription
workspaceRoot (required)stringAbsolute path to the project folder
path (required)stringFile path relative to workspaceRoot
oldString (required)stringExact text to replace; must occur once unless replaceAll
newString (required)stringReplacement text
replaceAll (optional)boolReplace every occurrence (default false)
bump[action: "Bump version"] {
adapter: "fs"
actionId: "edit-file"
workspaceRoot: "/Users/me/project"
path: "Cargo.toml"
oldString: "version = \"0.1.0\""
newString: "version = \"0.2.0\""
}

Delete a single file inside the workspace. This works on a file, not a directory. Deletions are flagged by the destructive-action gate.

rm_lock[action: "Remove lockfile"] {
adapter: "fs"
actionId: "delete-file"
workspaceRoot: "/Users/me/project"
path: "package-lock.json"
}

List the immediate files and subdirectories of a directory. Optional path defaults to the workspace root itself.

ls_src[action: "List src"] {
adapter: "fs"
actionId: "list-dir"
workspaceRoot: "/Users/me/project"
path: "src"
}

List files matching a glob pattern.

find_rs[action: "Find Rust files"] {
adapter: "fs"
actionId: "glob"
workspaceRoot: "/Users/me/project"
pattern: "src/**/*.rs"
}

Search file contents by regex, per line. Optional glob restricts the search to matching files (default **/*).

find_todo[action: "Find TODOs"] {
adapter: "fs"
actionId: "grep"
workspaceRoot: "/Users/me/project"
pattern: "TODO|FIXME"
glob: "src/**/*.rs"
}