Skip to main content
Version: 0.21.0

Interface: FileScope

Defined in: core/hooks/fileScopeGate.ts:10

Where the built-in file tools may act. Without this, the only boundary is the SDK's own working-directory scope — the whole project directory — so keeping the agent out of the user's own files (a config file holding a password, the originals in sources/) would rest on the system prompt alone.

Properties​

PropertyTypeDescriptionDefined in
alsoReadable?string[]Readable too with readableDirs, but not named in a denial: the run folder, the plugin roots.core/hooks/fileScopeGate.ts:34
deniedPathsstring[]Never readable, searchable or writable.core/hooks/fileScopeGate.ts:20
projectDirstringBase for relative paths: the session's cwd.core/hooks/fileScopeGate.ts:12
readableDirs?string[]With it, Read and Glob are only allowed inside these (an allow-list, like writableDirs and searchableDirs), plus alsoReadable and the tool results under toolResultsRoot; deniedPaths still wins. Without it, they reach any path but the denied ones: any file the user can read, ~/.ssh included.core/hooks/fileScopeGate.ts:32
readOnlyDirs?string[]Readable and searchable but never writable; only affects the wording of the denial.core/hooks/fileScopeGate.ts:16
searchableDirsstring[]Grep is only allowed inside these — it prints file contents, so it isn't let loose on the whole project.core/hooks/fileScopeGate.ts:18
toolOnlyDirs?object[]Reached only through the kit's own tools, never the file tools: the knowledge folder when the agent has the knowledge_* tools (ADR-024). The denial says what to use instead.core/hooks/fileScopeGate.ts:25
toolResultsRoot?stringThe CLI's folder for this project (~/.claude/projects/<project>): with readableDirs, its sessions' tool-results/ folders, where the SDK leaves large tool outputs for the agent to Read, are readable; nothing else in it.core/hooks/fileScopeGate.ts:40
writableDirsstring[]Write/Edit are only allowed inside these.core/hooks/fileScopeGate.ts:14