What Files Can Claude Code and Cursor Access on a Developer's Laptop?
Claude Code reads files in the folder you start it in without asking, and runs read-only shell commands like cat without a prompt. Cursor, now Grok Build, lets its agent read outside the project by default. Ignore files and deny rules mainly limit the agents' own file tools. This guide compares the defaults, what leaves the laptop and how to test your setup with made-up files.
D
Dr. Marcus Chen
Principal Security Researcher
Dec 4, 2026
On this page
Claude Code and Cursor can both read more of a developer's laptop than most teams expect. Claude Code reads any file in the folder where you start it without asking, and its built-in read-only shell commands, such as cat and grep, run without a prompt in every mode. Cursor, now the Grok Build desktop app, lets its agent read files outside the open project without approval by default. In both tools, ignore files and deny rules mainly limit the agent's own file tools, not every shell command or MCP server. What an agent can read is also different from what it actually read.
This guide sets out what each tool can reach, what leaves the laptop, which settings narrow access and how to test your own setup with harmless files.
Last verified: 4 December 2026, against Anthropic's Claude Code documentation and Grok Build's documentation and data-use pages, listed under Sources. Cursor was renamed Grok Build on 30 November 2026, and its settings files still use the .cursor name. We checked documentation, not a lab laptop, so confirm the behavior of your own versions with the test below. Settings and defaults change often.
Figure 1. Each route to a file has its own controls. Rules that cover one route may not cover the others.
What can Claude Code read on a laptop?
Claude Code treats the folder you launch it from as its working directory. Anthropic's permissions page says file reads and searches inside the working directory and any additional directories run with no approval. Folders can be added with --add-dir or the additionalDirectories setting.
Outside that folder, the answer depends on how the file is read:
Claude Code's file tools ask first in Manual mode. The security page says Claude Code "asks you before its file tools read or write outside the folder where it was started and its subfolders."
Read-only shell commands run without a prompt. Claude Code recognizes a built-in set of read-only commands, including ls, cat, head, grep and find, and runs them "without a permission prompt in every mode." The exception is the permissions.blockReadsOutsideWorkingDirectories setting, which changes this for paths outside your working directories.
Instruction files load automatically. Claude Code loads CLAUDE.md and CLAUDE.local.md from the working directory and every directory above it, plus a user file in ~/.claude/ and any managed policy file.
Newer versions start in auto mode. From v2.1.283, auto mode is the built-in starting mode for interactive terminal and VS Code sessions, unless a setting or flag chooses another. In auto mode, "a separate classifier model reviews actions before they run and blocks the ones it judges risky." That classifier is a judgment, not a fixed boundary.
Do deny rules protect secrets?
Partly. Read and Edit deny rules use gitignore-style patterns, such as Read(./.env) and Read(./secrets/**). Anthropic says these rules "apply to Claude's built-in file tools." In shell commands Claude Code can analyze, they also cover file commands it recognizes, such as cat, head and tail. But the same page warns that "some commands can still read or change a denied file." Its examples include grep -r pattern ., which reads files without naming them, and scripts that open files themselves.
Two more details matter. A .claudeignore file has no effect, so its entries belong in Read deny rules. And Anthropic's sandboxing page says, "There is no built-in credential deny list." Nothing is protected until you list it.
What does the Claude Code sandbox change?
The sandbox wraps shell commands at the operating-system level, and it's off by default. It runs on macOS, Linux and WSL2. On native Windows, commands run unsandboxed. When the sandbox is on:
Commands can write only to the working directory, a temporary folder and added directories.
Commands can still read "most of the machine, including credential files such as ~/.ssh and ~/.aws/credentials," unless you restrict them.
Network traffic goes through a proxy, and the list of allowed domains starts empty.
Only shell commands are covered. File tools, MCP servers, hooks and the status-line command run outside the sandbox. Hooks and local MCP servers "run with your full access."
The sandbox.credentials setting can deny or mask chosen files and environment variables. Use it, because the sandbox's default read scope is wide.
What can Cursor, now Grok Build, read?
The rename doesn't change the files on disk. On 30 November 2026, Cursor became the Grok Build desktop app, and Grok Build's documentation still uses .cursorignore, .cursor/mcp.json and .cursor/sandbox.json.
Grok Build's security page says, "Reading files and searching code don't require approval." Its Read Access setting decides how far that goes. It needs Grok Build 3.23 or later and has two options:
System, the default. "The agent can read files outside the workspace without approval."
Workspace. The agent reads freely inside the workspace. "Anything outside needs your approval unless it's on your Read Allowlist."
Does .cursorignore keep secrets out?
It keeps files away from the agent's own tools, Tab completion and @ references. Grok Build also ignores files in .gitignore and a default ignore list that includes .env files. But the ignore-file page warns, "The terminal and MCP server tools used by Agent cannot block access to code governed by .cursorignore." It also says complete protection "isn't guaranteed due to LLM unpredictability," and that the Grok Build terminal app doesn't read ignore files at all.
What does the Grok Build sandbox change?
Terminal commands run under one of three run modes: Auto-review, Allowlist or Run Everything. In Auto-review, a classifier decides which commands need approval, and Grok Build says Auto-review "is not a security boundary." Commands can run in a sandbox. It uses Seatbelt on macOS and Landlock on Linux kernel 6.2 or later. On other Linux systems, Grok Build asks for approval instead.
The sandbox limits writes to the workspace and blocks network access, apart from a default list of allowed domains such as package registries. Reads follow a setting called readBoundary, which defaults to "system". With that default, "SSL certificate paths and ~/.ssh are always readable." Set it to "workspace", and sandboxed commands can read only ~/.ssh/known_hosts from that folder, plus certificate stores and other paths common tools need.
MCP connections are approved one by one. By default, each tool call also needs approval, and MCP follows the same run modes as terminal commands.
Figure 2. The defaults, as each vendor documents them on 4 December 2026.
How do the two tools compare?
Question
Claude Code
Grok Build (formerly Cursor)
Reads files in the project without asking?
Yes
Yes
Reads files outside the project?
File tools ask first in Manual mode. Built-in read-only shell commands run without a prompt.
Yes, without approval, under the default Read Access setting (System)
Setting that narrows reads outside the project
blockReadsOutsideWorkingDirectories
Read Access: Workspace, with a Read Allowlist
File-level blocking
Read deny rules. Some shell commands can still read denied files.
.cursorignore. It doesn't cover terminal or MCP tools.
Sandbox default
Off
Used by Auto-review where the operating system supports it. Optional in Allowlist.
Sandbox read scope by default
Most of the machine, including ~/.ssh
System, including ~/.ssh
MCP servers
Local servers run outside the sandbox, with the user's full access
Each connection and tool call needs approval by default
Local history of what was read
Plain-text transcripts in ~/.claude/projects/, kept 30 days by default
Not described in the documentation we read
What leaves the laptop?
Reading a file and sending it to a model provider are separate steps, but in practice a read usually means it's sent. Anthropic's data-usage page says Claude Code sends all user prompts and model outputs to its API. Under commercial terms, Anthropic doesn't train models on that code or those prompts, and keeps data for 30 days as standard. Zero data retention is available to qualified Claude for Enterprise accounts. On consumer plans, training depends on the user's setting.
Grok Build's privacy page says that when you use AI features, it "sends prompts and code context to model providers." Privacy Mode, which is on by default for teams, stops the code being used for training, but it doesn't stop it being sent. The data-use page adds that file contents are cached temporarily on Grok Build's servers to reduce latency. Its local search index, called Instant grep, stays on the laptop. Grok Build says it "does not upload file paths or code to build a search index."
Where is the record of what was actually read?
Permissions show what an agent could reach. To know what it did read, you need a record.
Claude Code keeps one on the laptop. Transcripts are "stored locally in plaintext under ~/.claude/projects/" and include file contents and command output. Anthropic's documentation notes that if a tool reads a .env file, the value is written to the transcript. The files are kept for 30 days by default, set by cleanupPeriodDays, and aren't encrypted at rest. That makes transcripts useful evidence, but also a new place where secrets end up.
We didn't find a description of local agent history in the Grok Build documentation we read. Check your version before relying on it.
How do you test what your agents can read?
Figure 3. Use made-up markers only. Never put real secrets in a test.
Use a test laptop or a separate user account, and only made-up values:
Plant markers. Create a test project with a fake .env file containing TEST_KEY=MARKER-ENV-001. Outside the project, create ~/agent-test/outside.txt containing MARKER-OUTSIDE-002.
Add your controls. Add a deny rule for the .env file in Claude Code, or a .cursorignore entry in Grok Build.
Ask for the markers in three ways. Ask the agent to open each file, to run cat on the outside file, and to search the project for MARKER. Record which requests asked for approval and which returned the value.
Check what reached the record. For Claude Code, search the transcripts with grep -r MARKER ~/.claude/projects.
Change one setting and repeat. Turn on the sandbox, block reads outside the working directory, or set Read Access to Workspace. Then repeat steps 3 and 4.
Delete the test files and transcripts afterward. The results show what your versions and settings really do, which matters more than any default described here.
What should a security team do now?
Narrow reads outside the project. For Claude Code, set blockReadsOutsideWorkingDirectories and Read deny rules in managed settings, which users can't override. Our guide to Claude Code managed settings covers the file. For Grok Build, set Read Access to Workspace.
Turn on the sandbox and narrow what it reads. In Claude Code, enable it and use sandbox.credentials. In Grok Build, set readBoundary to "workspace".
Move secrets out of plain-text files. No ignore list is complete. A key that isn't in a file can't be read from one.
Review MCP servers. They run outside these file rules. Score each one with our free MCP config scanner.
Check instruction files. Claude Code loads CLAUDE.md files automatically, and other agents load their own instruction files. Any of them can carry hidden instructions or secrets. Our free agent instruction file scanner checks them in the browser.
Shorten transcript retention. If you don't need 30 days of Claude Code transcripts, lower cleanupPeriodDays.
Vendor settings live on each laptop and can drift. Where AI tool call monitoring is on, AccuroAI Endpoint AI Governance grades every tool call a coding agent makes by risk. It then allows the call, asks the employee to confirm, or blocks it. For Claude Code, Cursor and Antigravity, results are recorded too. It also lists MCP servers on each device, scores them from 0 to 100, and can block a server by policy. Without a monitoring policy, tool calls aren't stored or checked.
Any file in the folder where you start it, and any added directories, without asking. Its file tools ask before reading elsewhere in Manual mode. Built-in read-only shell commands like cat run without a prompt in every mode, unless blockReadsOutsideWorkingDirectories is set.
Can Claude Code read my .env file?
Yes, if it's in the project and not denied. Add Read deny rules for .env files, but some shell commands can still read denied files. Keep real secrets out of plain-text files where you can.
Can Cursor read files outside my project?
Yes, by default. Grok Build, formerly Cursor, sets Read Access to System, which lets the agent read files outside the workspace without approval. Change it to Workspace to require approval.
Does .cursorignore stop the agent from reading a file?
It blocks the agent's file tools, Tab and @ references. It doesn't stop terminal commands or MCP tools, and the vendor says protection isn't guaranteed.
Is the sandbox enough to protect SSH keys?
Not by default. Claude Code's sandbox can read most of the machine, including ~/.ssh, and is off unless you turn it on. Grok Build's sandbox can read ~/.ssh unless readBoundary is set to "workspace".