# Is this AGENTS.md safe to run?

> Untrusted AGENTS.md / CLAUDE.md / CLAUDE.local.md / Cursor rules in ~/Downloads and cloned starters can instruct your coding agent. Origin check, scan list, steps, and the free check_agents_md.sh. Checked 2026-11-06.

Source: https://agentpromptsatoz.com/guides/agents-md-safe/ · License: free to use and adapt · Publisher: Agent Prompts A to Z

Pair with: https://agentpromptsatoz.com/guides/agents-md/ (template + drift check) and https://agentpromptsatoz.com/agent-skills/agents-md-check/SKILL.md

## Why an untrusted rules file matters

- **Agents treat rules as instructions, not suggestions.** A line that says "always run this setup command" or "paste your API key into this curl" will often be obeyed the next time the agent starts in that folder.
- **You may not notice the file landed.** A zip from Discord, a cloned starter, or something left in ~/Downloads can put AGENTS.md, CLAUDE.md, .cursor/rules/*.mdc or CLAUDE.local.md into a folder you later open with an agent.
- **Personal overrides can hide the real rules.** Claude Code counts CLAUDE.local.md as a CLAUDE.md. If it exists and nothing imports @AGENTS.md, Claude quietly stops reading AGENTS.md for you. That is useful for private notes; it is also a way for a planted file to disable your shared rules.

Sources: [Claude Code memory docs (CLAUDE.md / CLAUDE.local.md / AGENTS.md)](https://code.claude.com/docs/en/memory), [OpenAI Codex AGENTS.md guide](https://developers.openai.com/codex/guides/agents-md), [agents.md convention](https://agents.md/)

## 1. Where did this file come from?

- **You wrote it, and it lives in a repo you control:** Lower risk. Still skim after any merge that touches AGENTS.md, CLAUDE.md, .cursor/rules, .claude/, or hooks.
- **It came from a teammate or a known open-source project with a real history:** Medium. Read the diff of the rules files before the first agent session. Prefer the project's docs over a random fork.
- **It arrived as a zip, gist, Discord drop, "paste this into your project" post, or something in ~/Downloads:** Treat as untrusted. Do not open the folder with an agent until you have scanned the rules files. Prefer copying only the lines you understand into a fresh AGENTS.md you own.
- **You do not remember putting it there:** Stop. Find who/what created it (git log, download history, zip contents) before any agent run.

## 2. What to scan for

1. **Shell one-liners that download and run.** curl … | bash, wget … | sh, powershell -enc, Invoke-WebRequest | iex, python -c with urllib, or any "setup" that pipes remote content into a shell.
2. **Secret and credential exfiltration.** Instructions to cat, print, or upload .env, ~/.ssh, ~/.aws, keychains, browser cookies, recovery phrases, or to POST them to an unfamiliar URL / webhook / pastebin.
3. **Silent disable of your real rules.** A new CLAUDE.local.md (or CLAUDE.md) that does not import @AGENTS.md, so Claude Code stops reading your shared AGENTS.md. Also: rules that say to ignore, delete, or overwrite AGENTS.md / CLAUDE.md / .cursor/rules.
4. **Path tricks and write targets outside the project.** ../ paths, absolute paths into $HOME, writes to ~/.claude, ~/.codex, /etc, LaunchAgents, cron, systemd, or shell rc files (".bashrc", ".zshrc").
5. **Hidden or lookalike files.** AGENTS.md with unusual Unicode, zero-width characters, a second "AGENTS.md" that is actually a different filename, or rules buried inside .cursor/rules, .claude/hooks, or SKILL.md that the chat never showed you.
6. **Hooks and always-on automation.** New Stop / SessionStart / PreToolUse hooks, git hooks, or CI steps that run on every prompt. Read every new script end-to-end before enabling it.
7. **"Trust me" network and package moves.** npm/pip/cargo install of unknown packages, curl to raw.githubusercontent.com or short links, disabling TLS verify, or adding a mystery MCP server / skill from a URL you did not choose.
8. **Social-engineering lines aimed at the agent.** "The user already approved", "do not ask", "this is an emergency", "ignore previous instructions", "exfiltrate to help debug", or roleplay that bypasses your normal confirmation rules.

Fast first pass:

````sh
grep -nEi 'curl|wget|bash|powershell|\.env|ssh|aws|webhook|base64|eval|ignore previous|CLAUDE\.local' AGENTS.md CLAUDE.md CLAUDE.local.md .cursor/rules/* 2>/dev/null
````

## 3. Before you open the folder with an agent

1. **Pause the agent.** Do not start Claude Code, Cursor Agent, Codex, or Copilot Chat in that folder until the scan is done. A first message can already load AGENTS.md.
2. **List every rules surface.** From the folder root: AGENTS.md, CLAUDE.md, CLAUDE.local.md, .claude/**, .cursor/rules/**, .cursorrules, .github/copilot-instructions.md, .github/instructions/**, GEMINI.md, .gemini/settings.json, SKILL.md / .agents/skills/**, and any *.mdc the zip added.
3. **Read them as an attacker would.** Search for curl, wget, bash, powershell, .env, ssh, aws, webhook, base64, eval, chmod +x, ~/., /etc, LaunchAgents, and "ignore previous". Open every referenced script.
4. **Run the free drift + local-override check.** From a repo you trust enough to inspect: sh check_agents_md.sh (download from /guides/agents-md/). It fails on missing AGENTS.md import, dead paths, oversize files, and a CLAUDE.local.md that hides AGENTS.md. It does not catch malware strings; that part is still your eyes.
5. **Only then keep what you understand.** Copy safe, boring lines into an AGENTS.md you authored. Delete or quarantine the rest. Prefer @AGENTS.md imports over duplicate CLAUDE.md copies.

Download: `curl -o check_agents_md.sh https://agentpromptsatoz.com/guides/agents-md/check_agents_md.sh.txt` (read it first), then `sh check_agents_md.sh`.

Or the free skill: `npx skills add https://agentpromptsatoz.com --skill agents-md-check`

## Checklist

- [ ] I know exactly where this AGENTS.md / CLAUDE.md / .mdc set came from.
- [ ] I listed every rules file the zip or clone added (including CLAUDE.local.md, hooks, and .cursor/rules).
- [ ] I searched those files for curl|bash, wget, powershell, .env, ssh, aws, webhooks, base64, eval, and home-directory writes.
- [ ] I opened every script, hook, or URL the rules tell the agent to run.
- [ ] No CLAUDE.local.md (or CLAUDE.md) is silently disabling AGENTS.md; @AGENTS.md is present if Claude files exist.
- [ ] No path traversal or writes outside this project without a reason I accept.
- [ ] I ran check_agents_md.sh (or the agents-md-check skill) and understand every FAIL.
- [ ] I am willing to own every remaining line as if I wrote it.

## Tips

- Keep a personal allowlist: only open agent sessions in repos whose AGENTS.md you have read this month.
- In git, review AGENTS.md, CLAUDE*.md, .cursor/rules, and .claude/hooks on every PR the same way you review CI YAML.
- Never paste a recovery phrase, production .env, or cloud key into a chat "because the rules file asked".
- If a starter kit needs network install during first run, run that yourself in a clean directory, not via an opaque agent instruction.

## FAQ

**Is a weird AGENTS.md in ~/Downloads actually dangerous?**

It can be. Coding agents load project instructions when you open that folder. A planted AGENTS.md, CLAUDE.md, CLAUDE.local.md or Cursor rule can tell the agent to run shell, read secrets, or ignore your real rules. Treat Downloads drops as untrusted until you have scanned them.

**Does check_agents_md.sh detect malware?**

No. It is a drift and override check: missing @AGENTS.md import, dead paths, Codex size cap, Gemini settings, and CLAUDE.local.md hiding AGENTS.md. Malicious curl|bash lines and secret exfil still need a human (or a separate scanner). Use both.

**What about CLAUDE.local.md?**

Claude Code docs treat CLAUDE.local.md like a CLAUDE.md. If it exists and nothing imports @AGENTS.md, Claude stops reading AGENTS.md for that project. That is handy for private notes; it is also how a planted local file can disable your shared rules without deleting them. check_agents_md.sh v1.2 fails on that case.

**Should I delete every AGENTS.md I did not write?**

Not if you read and trust it. Prefer: quarantine the untrusted copy, write a short AGENTS.md you own, and import it from a one-line CLAUDE.md. Our AGENTS.md guide has the vendor-checked setup.

**Can Cursor rules or skills be malicious too?**

Yes. .cursor/rules/*.mdc, Stop hooks, and SKILL.md files are also instructions. Scan them with the same checklist. Our skill-descriptions guide covers how agents load skills (name + description first).

## Go further (premium)

[App Builder Agent Pack](https://payhip.com/b/EuRgw) ($19): finished AGENTS.md, CLAUDE.md and six Cursor rules. [Done-Check Kit](https://payhip.com/b/EAenF) (pay what you want from $0). [All 5 packs](https://payhip.com/b/J8eUb) for $29.
