Skip to content
Crystal CodeDocs
ENEnglish

Built-in tools

read, list, tree, glob, grep, search, edit, multi_edit, write, and apply_patch may use a path outside the workspace. Outside Full, that needs approval from you, or from the Review model in Review or Audit. Full auto-passes the call. Workspace write, edit, multi_edit, and apply_patch still follow the approval mode outside Full. A patch is judged by its riskiest path: one path outside the workspace makes the whole call an outside write, and one credential path makes it forbidden.

bash starts in the workspace root and is approved as a side effect. Its stdin is closed, so a command that reads input sees end of input instead of waiting on the terminal. Background Bash tasks are Work only. --disable-tool and /tools builtin can omit a built-in tool. See Modes.

Rule Detail
Background tasks bash_start returns a session-local task ID. Use bash_status or bash_logs to observe it, and bash_stop to stop it
Timeout backgroundBashTimeoutSeconds, default 10800 seconds (3 hours)
Lifetime Not saved. Stopped when the session closes. At most 32 active tasks. Completed tasks stay queryable and do not use a slot
Stdin Closed for foreground and background commands. A command that reads input sees end of input, and a shell never inherits your terminal or switches it out of raw mode
Credential paths .ssh, .gnupg, and credentials.json are prohibited in every approval mode, including Full
Skipped directories Glob, grep, search, list, and tree skip .git, .vs, bin, obj, node_modules, and dist
Links Tree lists a directory link once, under its resolved path, and skips a link that leaves the workspace root or an outside start path
Binary files Rejected for read and edit (NUL probe)
Tool Catalog Purpose
read Plan, Work Read a text file (path, optional 1-based offset and limit)
describe_image Plan, Work Describe an image through imageModel (path, optional question). Omitted when imageModel is unset
describe_audio Plan, Work Describe audio through audioModel. WAV, MP3, AIFF, AAC, OGG, FLAC, and M4A up to 20 MiB. Arguments are path and optional question. The matching model must be enabled.
describe_video Plan, Work Describe video through videoModel. MP4, MOV, WebM, AVI, FLV, MPEG, WMV, and 3GPP up to 20 MiB. Arguments are path and optional question. The matching model must be enabled.
describe_document Plan, Work Describe a document through documentModel. PDF and UTF-8 plain text up to 20 MiB. Arguments are path and optional question. The matching model must be enabled.
view_image Plan, Work Show an image to the current model (path). Present only while that model accepts images
list Plan, Work List immediate entries (path optional, 1-based offset and limit)
tree Plan, Work List structure under a path (path optional, depth default 2 capped at 4, files to include files). Depth-first. Subdirectories before files. Up to 1,000 entries and 20 files per directory
glob Plan, Work List files matching a glob (pattern, optional path, 1-based offset and limit)
grep Plan, Work Regular-expression search (one pattern or an array of 1 to 8 patterns, optional path and file-name glob). Array matches include 1-based pattern numbers in content mode. Each matching line counts once. output_mode is content (default), files for matching paths only, or count for matching lines per file. context adds 0 to 50 lines around each match in content mode. limit caps matches or files
search Plan, Work Rank files by name and content (query, optional path, glob, caseSensitive, 1-based offset and limit)
todowrite Plan, Work Replace or merge the session todo list
todoread Plan, Work Read the current todo list
question Plan, Work Ask one or more questions, with single or multiple choices and custom answers
skill Plan, Work Load a skill by name. Omitted when skills is false
task Plan, Work Delegate to a child Agent (agent, label, prompt, optional sessionId). Present only while child Agents are enabled and at least one Agent is available. work is omitted in Plan. A call without sessionId creates a child; a call with it continues that child
edit Work Replace one unique old_string, or every occurrence with replace_all. The result shows the changed lines with five lines of context on each side
multi_edit Work Apply ordered exact replacements to one or more existing UTF-8 files. Pass files, a nonempty array of entries with path and edits. Each edit has old_string, new_string, and optional replace_all. List each file once. By default a file error stops the batch. Set continue_on_error to true to record individual file errors and continue. The result gives failed paths and reasons, plus a replacement count for each completed file. Batch validation and approval still apply
write Work Create or overwrite a UTF-8 text file. The result shows the first lines of the file
apply_patch Work Change several files in one call with patchText: Add File, Update File (with optional Move to), and Delete File sections between *** Begin Patch and *** End Patch. Every section is checked before any file changes. A move needs a destination that does not exist. The result lists each file and shows the changed lines
bash Work Run one shell command after approval (bash -lc). Timeout is bashTimeoutSeconds (default 600 seconds)
bash_start Work Start a background command after approval and return its task ID
bash_status Work Read status, exit code, and log offsets
bash_logs Work Read bounded output by offset
bash_stop Work Stop a background task and its children after approval
Limit Value
read 1,000,000 characters or 20,000 lines
write 2 MiB
apply_patch 2 MiB per patch
grep 10,000 matches (default 2,000), 8 MiB per file
search 200 candidate files per page (default 50), 2 preview lines per file, 8 MiB per scanned file
glob 1,000 matches per page
list 1,000 entries per page
tree 1,000 entries, 4 levels, 20 files per directory
Tool output Truncated at 100,000 characters
Background output 1 MiB per task. bash_logs returns at most 100,000 characters per call