Never Start Your Coding Agent in Downloads: Build a Safe Agent Workspace in 10 Minutes
بقلم EndOfCoding
Coding agents such as Codex and Claude Code read instruction files (AGENTS.md, CLAUDE.md) from the folder you launch them in, and treat those files as trusted context. In late October 2026, security firm Forever Security reported finding a malicious AGENTS.md in a customer's Downloads folder; it told Codex to install a malicious npm package, function-color, and per the reporting the install was blocked before it ran. In the researchers' tests, as summarized by Technori from BleepingComputer's coverage, Codex followed planted instructions in 90% of tests, and a planted CLAUDE.md redirected Claude Code's API traffic in roughly half of attempts. Those figures are the researchers' own and we could not review the underlying research, so read them as evidence of feasibility, not fixed failure rates. The fix is not exotic. It is a habit, and this tutorial turns it into a setup you can finish in ten minutes.
What You'll Learn
- Why an instruction file in the wrong folder becomes an attack
- How to create a dedicated workspace that agents are launched from
- A pre-flight check for stray AGENTS.md and CLAUDE.md files
- Which permissions and approvals to keep switched on
- How to review an unfamiliar instruction file before trusting it
Step 1: Understand the trust mistake
An instruction file exists to tell your agent how a project works. The agent cannot tell whether the file came from your team or from a web page that dropped it into your Downloads folder. Location is the only signal, which is why where you launch the agent matters as much as what you type.
Forever Security says Claude Code alone logged more than 1,300 sessions started from the Downloads folder, and that hundreds of its customers run Claude Code, Codex or Cursor CLI from there. The researchers showed a web page can silently download a harmless AGENTS.md to Downloads in Chrome, Edge and Firefox (Brave asks first). They could not determine how the file reached the victim in the real case.
Step 2: Create one workspace folder
Make a single parent folder just for projects, for example ~/projects, and put every repository inside it. Rule: you only launch an agent from inside a specific project folder, never from Downloads, your home directory, or the parent projects folder itself.
Make it automatic with a shell guard. In your shell profile, wrap the agent command so it refuses to run in risky places:
agent_guard() {
case "$PWD" in
"$HOME"|"$HOME"/Downloads*|"$HOME"/Desktop*)
echo "Refusing to start an agent in $PWD"; return 1;;
esac
command "$@"
}
alias claude='agent_guard claude'
alias codex='agent_guard codex'
Adjust the paths for your system. This is a convenience guard, not a security boundary, but it catches the exact mistake the reported attack depends on.
Step 3: Sweep for stray instruction files
Once, now, look for instruction files you did not put there:
find ~ -maxdepth 4 \( -name AGENTS.md -o -name CLAUDE.md \) -not -path '*/projects/*' -not -path '*/node_modules/*' 2>/dev/null
Anything listed outside your project folders deserves a look. Read it before deleting. If an agent ever ran in that folder, rotate the tokens that session could reach.
Step 4: Keep the guardrails on
The reported Codex package install was stopped before it ran; that is the approval and sandbox layer doing its job. Keep these on:
- Approval prompts for shell commands and package installs
- Sandboxing or a container for sessions that touch unfamiliar code
- Narrow access to credential locations such as cloud keys, Git config and package-registry tokens
A useful habit is to treat any npm install your agent proposes that is not already in the lockfile as a decision for you, not for the agent.
Step 5: Review before you trust
When you clone or download a project that includes an AGENTS.md or CLAUDE.md, open it first. Red flags: instructions to install packages, to change API endpoints or environment variables, to disable approvals, or to fetch and run remote scripts. Backslash Security, which published an earlier case in July, recommends monitoring instruction files for changes and attributing every edit; in a team repo, that means requiring code review on those files like any other config.
Conclusion
The lesson is not that agents are unsafe; it is that they obey the context you give them, including context you did not knowingly give. A dedicated workspace, a ten-second sweep, and approvals left on cover the attack path described in this reporting. For the broader picture of how AI agents get steered by untrusted content, see our companion threat analysis at CyberOS, and for the full security playbook for AI-assisted builders, the security chapter of the Vibe Coding Ebook. Want the next breaking change in plain English each week? Join the Academy newsletter.
SECOND OPINION · BY VIBE CODING ACADEMY
Your agent says it’s done. What needs checking?
Paste your coding-agent conversation for supported claims, visible problems, and useful next steps. Reviews only the material you provide; no account needed to start.
Review a session