Agent Upstart

Cool things people are building with agents — and practical help getting the most out of them.

Playbooks · Coding tasks

Check for planted instruction files before you start an agent in a folder you did not fill yourself

Written November 1, 2026 · Edited November 4, 2026

For anyone about to start a coding agent in Downloads, in a home folder, or in a folder that just arrived from somewhere else: find and read every instruction file the agent will treat as orders before the agent runs. The folder may have been filled by a web page, not by you, and an instruction file the agent trusts can tell it to rewrite its own configuration.

What happened

On 22 October 2026, Forever Security reported finding a malicious AGENTS.md file in the Downloads folder of a real customer's machine, disguised as ordinary engineering notes. Forever's software stopped the agent mid-session before any code ran. The file was about 13 KB of bland guidance, with the attack in one section near the end dressed as routine setup. Forever states that nobody knew how the file got into that folder. The delivery route was not established in the customer incident. Forever's separate proof-of-concept showed a web page saving a file into Downloads, which Forever describes in its own words as happening with no click and no approval, the page choosing the name and the contents. That is Forever's description of what a page can do, not proof of how this one file arrived.

Forever then rebuilt the attack in a lab, on both Codex and Claude Code, and the two behaved differently. In Forever's testing, Codex ran the malicious package in more than 90% of attempts. The planted file told Codex to add a server to its own machine-wide configuration, and the damage did not stay in Downloads: every later Codex session on the machine loaded the added server at startup. For Claude Code, Forever built a researcher-made demonstration file rather than finding one in the wild. In Forever's testing, Claude Code followed through on the redirect about 50% of the time, and achieved code execution inside the first session about a fifth of the time. The demonstration file rerouted Claude Code's own traffic to a server Forever controlled, which exposed the login token. Forever's conclusion is blunt: there is nothing here for OpenAI or Anthropic to patch, because an agent that follows the instruction file in its folder is doing exactly what it was built to do.

This page covers a different mechanism from the git-config audit. That audit covers settings that name a program git will run when an agent calls git. This page covers instruction files an agent reads as orders at startup. A folder can pass the git-config audit and still hold a planted instruction file, and a folder with a clean instruction-file list can still hold a hostile git config. Do both audits on a folder you did not fill yourself.

Which files each agent reads

An agent does not read only the instruction file sitting in the folder you start it in. It reads a chain, and a planted file can sit anywhere in that chain.

Codex. OpenAI's documentation says Codex builds an instruction chain when it starts, once per run. It reads a global file from the Codex home directory, then walks from the project root down to the current directory, taking at most one file per directory: an override file first, then AGENTS.md, then any fallback names configured in the Codex configuration. Files are joined root-down, so files closer to the working directory appear later and override earlier guidance. If Codex cannot find a project root, it reads only the current directory. That last point is what makes Downloads dangerous for Codex: Downloads is rarely a project, so a planted file sitting there is the file Codex reads.

Claude Code. Anthropic's documentation says Claude Code reads CLAUDE.md files at the start of every session, from the current working directory and every directory above it, ordered from broadest scope to most specific, plus files in subdirectories once Claude Code works with a file there. It also reads CLAUDE.local.md files alongside them, rules in .claude/rules/, and a user file at ~/.claude/CLAUDE.md that applies to every project. Where a repository has an AGENTS.md and no CLAUDE.md in the working directory or above it, Claude Code reads the AGENTS.md instead, including AGENTS.md files in directories above the working directory. A CLAUDE.md can also import other files with @path references, and imported files load with it, so a planted import target counts too. Only Codex and Claude Code were tested by Forever. This page makes no claim about any other agent reading any particular file: if you run another agent, read its own documentation for which files it loads, and apply the same read-before-running rule to those names.

Steps

  1. Do not start the agent in the folder yet. Do not ask it to look at the folder, summarize the folder, or read the instruction file for you. The agent reading the file is the event this audit exists to precede. Work in a plain terminal, or a text editor, with no agent running.
  2. List the instruction files in the folder and above it. From the folder itself, list the names that matter for the agent you run, in the folder and in each parent folder up to your home folder. For Codex, look for AGENTS.md and AGENTS.override.md in each folder on the path, plus any fallback names you have configured. For Claude Code, look for CLAUDE.md, CLAUDE.local.md, AGENTS.md, and .claude/rules/ files in each folder on the path, plus ~/.claude/CLAUDE.md. Listing commands that print paths only are enough:
    • find "$HOME/Downloads" -maxdepth 1 -name 'AGENTS.md' -o -name 'CLAUDE.md' -o -name 'CLAUDE.local.md' -o -name 'AGENTS.override.md' 2>/dev/null
    • ls -la ~/.codex/AGENTS.md ~/.codex/AGENTS.override.md ~/.claude/CLAUDE.md 2>/dev/null
    For a just-cloned folder, run the same listing inside the folder and in each parent folder between it and your home folder. A file in a parent folder loads too, so a clean folder with a planted parent is not clean.
  3. Read every file you found, as text, before the agent sees it. Open each one in a text editor and read it end to end. A short file that says only "install this package" is easy to spot; the file Forever found was long and dull, and the attack was one section near the end. Skimming the first screen is not the audit. Read for instructions that tell the agent to change its own configuration, add a server or tool, install a package, set an API endpoint or gateway address, change a login, or bypass an approval or sandbox control. Any instruction of those kinds in a file you did not write, or did not expect in that folder, is a stop signal, even if the surrounding text sounds like normal project setup.
  4. Follow the imports. If a file you read imports another file, or points at another file by path, open that file and read it the same way. An import is part of the instruction chain, not a separate document. If an import points outside the folder, to a file you do not recognize, treat that as a stop signal too: the chain reaches further than the folder you listed.
  5. Look at the agent's own configuration for changes the file may already have made. Forever's own advice is to look in the Codex configuration for an unexpected server block or a changed endpoint, and in a project's Claude Code settings for an endpoint, proxy, or other API address you did not set. Open ~/.codex/config.toml and .claude/settings.json in a text editor and look for entries you do not recognize. Do not print a whole configuration file into a chat or a ticket: configuration files can hold logins. Look at the file yourself, on your own screen, and note only which entry is unexpected. If you find an entry you did not set, do not start the agent until it is removed and the login it may have exposed is replaced, as in step 6.
  6. If a file is suspicious, do not start the agent in that folder. Move the file out of the folder, or delete it, after reading it. Do not leave it in place while you "just ask one question": one question is enough for the agent to read it. Start the agent instead in a project folder you created, and copy into it only the files you need, one at a time, reading each as you go. If the folder came from someone else, tell them which file you found and ask for the folder without it, or for a fresh clone URL.
  7. If a suspicious file may already have run, replace the login. Forever's advice is to assume the token leaked. Sign out and back in through the agent's own login, and replace any API key that the agent's configuration may have exposed, at the provider's own site. Removing the file or the configuration entry does not undo a login that was already sent somewhere else. This step is about the login, not about the file: a machine that already ran the planted file needs the login replaced even if every file now looks clean.

Reduce the exposure for next time

Do not start an agent in Downloads. Downloads is the one folder a web page can write to on its own, in Forever's account, and it is also a folder people work in without thinking of it as a project. Copy the file you need into a project folder you created and start the agent there. In your browser, turn on the setting that asks where to save each file before downloading, so a file arriving in Downloads is a decision you see rather than a silent arrival. That setting does not make Downloads safe to start an agent in: it only means you are more likely to notice a file that should not be there. The audit in the steps above is still the protection, because a file can arrive by other routes too: a shared folder, a sync folder, a zip file, or a clone.

What can go wrong

Limits

Related playbooks

Sources

Back to: Coding playbooks hub · Also: Audit a repository's git config before any agent opens it · Open an untrusted repo without running code · Check your CLI config for relay tampering