Skip to main content

Files, Search, and Memory

These tools read, write, and search files, and they store memory notes. Use Read before Edit, because Edit replaces an exact string in a file. For example, Grep with output_mode set to files_with_matches lists only the files that match. Tools explains the Yes and No columns.

You can also read or edit files yourself and let Claude see the result. Deny the tool name in permissions.deny, or leave it out of a subagent tools list, to turn a tool off. The memory tools need a server-side flag.

Tools​

Source: Tools Reference, Configure Permissions, and the program (the tool input schemas).

ToolStatusWhat It DoesHow It WorksAvailable InRead-OnlyParallelDeferred
Read
Documented: An official docs page names this item.
Reads files, images, PDFs, and notebooks.See Read Parameters.Main session and subagents. Kept in background subagents.✅✅❌
Write
Documented: An official docs page names this item.
Creates or overwrites a file.file_path (string, required, absolute), content (string, required), machine (optional). A deny rule wins.Main session and subagents. Kept in background subagents.❌❌❌
Edit
Documented: An official docs page names this item.
Replaces an exact string in a file.file_path (required), old_string (required), new_string (required, must differ), replace_all (boolean, default false), machine (optional).Main session and subagents. Kept in background subagents.❌❌❌
NotebookEdit
Documented: An official docs page names this item.
Edits a cell of a Jupyter notebook.See NotebookEdit Parameters.Main session and subagents. Kept in background subagents.❌❌✅
Glob
Documented: An official docs page names this item.
Finds files by glob pattern.pattern (string, required), path (string, optional, directory), machine (optional).Main session and subagents. The docs say a subagent can get Glob and Grep when the main session lacks them (macOS, Linux, WSL).✅✅❌
Grep
Documented: An official docs page names this item.
Searches file contents with ripgrep.See Grep Parameters.Same as Glob.✅✅❌
LSP
Documented: An official docs page names this item.
Code intelligence: definitions, references, symbols, hover, call hierarchy.operation, filePath (required), line (int, 1 or more, required), character (int, 1 or more, required), query (optional, workspaceSymbol only).Main session and subagents. Background subagents keep it since 2.1.280.✅✅✅
memory_read
Undocumented: Only the program shows this item. It can change without notice.
Gated: Works only behind a flag or a server gate. hidden server-side flag
Reads a document from a memory store.store (string, required), path (string, required).Only when auto memory is on (autoMemoryEnabled, no CLAUDE_CODE_DISABLE_AUTO_MEMORY) and the memory mode is tools. The mode is tools when the server flag tengu_linen_orbit is on (default off) or organization memory is not closed. Organization memory needs the server flag tengu_haze_glass, no CLAUDE_CODE_DISABLE_ORG_MEMORY or CLAUDE_MEMORY_STORES, and the allow_memory_sync policy. The mode stays files in cloud sessions that set CLAUDE_CODE_REMOTE_MEMORY_DIR, and when you set CLAUDE_COWORK_MEMORY_GUIDELINES.✅✅❌
memory_write
Undocumented: Only the program shows this item. It can change without notice.
Gated: Works only behind a flag or a server gate. hidden server-side flag
Saves a document to a memory store.store, path, content (all strings, required), if_version (string, max 64, version token for compare-and-set). content replaces the whole document.Only when auto memory is on (autoMemoryEnabled, no CLAUDE_CODE_DISABLE_AUTO_MEMORY) and the memory mode is tools. The mode is tools when the server flag tengu_linen_orbit is on (default off) or organization memory is not closed. Organization memory needs the server flag tengu_haze_glass, no CLAUDE_CODE_DISABLE_ORG_MEMORY or CLAUDE_MEMORY_STORES, and the allow_memory_sync policy. The mode stays files in cloud sessions that set CLAUDE_CODE_REMOTE_MEMORY_DIR, and when you set CLAUDE_COWORK_MEMORY_GUIDELINES.❌❌❌
memory_list
Undocumented: Only the program shows this item. It can change without notice.
Gated: Works only behind a flag or a server gate. hidden server-side flag
Lists memory stores and their documents.store (optional), path_prefix (optional, directory-aligned), cursor (optional).Only when auto memory is on (autoMemoryEnabled, no CLAUDE_CODE_DISABLE_AUTO_MEMORY) and the memory mode is tools. The mode is tools when the server flag tengu_linen_orbit is on (default off) or organization memory is not closed. Organization memory needs the server flag tengu_haze_glass, no CLAUDE_CODE_DISABLE_ORG_MEMORY or CLAUDE_MEMORY_STORES, and the allow_memory_sync policy. The mode stays files in cloud sessions that set CLAUDE_CODE_REMOTE_MEMORY_DIR, and when you set CLAUDE_COWORK_MEMORY_GUIDELINES.✅✅❌

Read Parameters​

ParameterWhat It DoesRequired
file_pathAbsolute path of the file.✅
offsetLine to start from, 0 or more.❌
limitNumber of lines to read, more than 0.❌
pagesPDF page range such as 1-5, at most 20 pages at a time.❌
allow_largeReads a file or range over the usual size limits, as far as the context allows.❌
machineName of an attached machine. Offered only when machines are attached.❌

NotebookEdit Parameters​

ParameterWhat It DoesRequired
notebook_pathAbsolute path of the .ipynb file.✅
new_sourceThe new source of the cell.✅
cell_idCell to edit. For insert, the new cell goes after it.❌
cell_typecode or markdown. Required for insert.❌
edit_modereplace (default), insert, or delete.❌

Grep Parameters​

ParameterWhat It DoesRequired
patternThe regular expression to search for.✅
pathFile or directory to search.❌
globGlob filter such as **/*.tsx.❌
output_modecontent, files_with_matches (default), or count.❌
-BLines before each match. Needs content mode.❌
-ALines after each match. Needs content mode.❌
-CAlias for context.❌
contextLines before and after each match. Needs content mode.❌
-nShows line numbers. Needs content mode, default true.❌
-iCase-insensitive search.❌
-oPrints only the matched parts. Needs content mode.❌
typeFile type such as js, py, or rust.❌
head_limitLimits the first N entries. Default 250, 0 for no limit.❌
offsetSkips the first N entries before head_limit.❌
multilineLets . match newlines and patterns span lines.❌
machineName of an attached machine. Offered only when machines are attached.❌

Example​

Block reads of secret files and all edits to lock files.

.claude/settings.json
{
"permissions": {
"deny": ["Read(./.env)", "Read(./secrets/**)", "Edit(./package-lock.json)"]
}
}

How It Works​

  • machine is an extra optional field that Claude Code adds to a tool schema when an attached-machines feature is on.
  • File tools check permissions with the rule syntax in Permission Rules.
  • Read, Glob, Grep, Write, and Edit carry remoteExecution metadata in the program. It marks them as runnable on a remote host.
  • Read has no result size cap. So use offset and limit for large files.

Write on a File That Claude Read Only in Part​

Since 2.1.312, Write refuses to overwrite some very large instruction files. The files are a CLAUDE.md file, a rules file, or an @-included file that Claude Code loads for a subdirectory.

ItemStatusWhat it doesNotes
Size test
Gated: Works only behind a flag or a server gate. Server flag tengu_quizzical_mango, on by default
Claude Code cuts a loaded file when its text is longer than a limit. It adds the line Only the start of this file is shown. and marks the file as read in part.The limit is the larger of 40,000 characters and 5% of the model context window, scaled by the bytes per token of the model. A managed file is never cut.
Write refusal
Undocumented: Only the program shows this item. It can change without notice.
While the mark holds, Write on the file fails with error code 19.The message says that Claude has only the start of the file. A Write could lose the rest. It tells Claude to use Edit to change part of it. To replace the file, Claude must first Read it in one call with no offset or limit.
Clear the mark
Undocumented: Only the program shows this item. It can change without notice.
A Read of the whole file removes the refusal.The program tests that the stored view holds the whole file and began at line 1.

Source: the program (chunk-r5cyd28m.js lines 164229 to 164274, 73050 to 73054, 9596 to 9609, and 77622; chunk-s2tghjwy.js line 4530; chunk-b09ckz08.js line 8515).

Errors​

Each row is a family of messages. The backticked text is the start that every message in the family shares. A row marked Various gathers the messages of one feature that do not share one start.

Start of MessageStatusWhat It MeansCases
Various
Undocumented: Only the program shows this item. It can change without notice.
File tools. Read, Edit, Write, or NotebookEdit refused a call.A Read deny rule covers the file. Claude has not read it yet. It changed since Claude last read it. It is too large. It is a pipe or device. It is a symbolic link. It is not a valid image, PDF page, or notebook. The edit does not match (string not found, no change). A write failed after the file was truncated.