# AGENTS.md Instructions for any AI agent (Claude Code, Codex, Cursor, Gemini CLI, etc.) using or modifying this repository. ## 0. First thing Asked to *set this up*, *install it*, or *explain what it is* (often after someone pasted the repo link)? Follow [`docs/SETUP_WIZARD.md`](docs/SETUP_WIZARD.md): detect where you run, ask the short interview, install, connect accounts read-only first, verify with `adsgm doctor` / `/ads:doctor`, then onboard the first client. Everything below applies throughout. ## Using it to manage ads 1. Read `skills/ads-core/SKILL.md` first; it defines client resolution, connector routing and the write rules. Then load only the platform skill (`skills/meta-ads` or `skills/google-ads`) and the one task skill/workflow the request needs. 2. All safety state goes through `python adsgm.py ...` (JSON output). Before any write: `adsgm use `, verify CLIENT / PLATFORM / ACCOUNT / ENTITY from fresh reads, `adsgm plan ...`, show the summary, then act. 3. Create campaigns, ad sets, ads PAUSED. Activation, deletes, tracking changes, geo expansion and out-of-policy budget changes require explicit human approval. Billing and admin changes are never made by an agent. 4. Hosts without Claude Code hooks do not get the PreToolUse gate automatically. Call `python hooks/write_gate.py pre` with the hook JSON shape (`tool_name`, `tool_input`, `permission_mode`) before every ad-platform write and obey its decision, or do not enable write-capable connectors. 5. Never print or request credentials. Never mix clients. 6. Several clients: one active client at a time (`adsgm use`). For all-clients work use `skills/ads-portfolio` (`/ads:sweep`, `/ads:learn`, `/ads:schedule`). Sweeps are read-only. Scheduled runs set `ADS_GODMODE_UNATTENDED=1` and are read-only unless a client opts in. Graphic ads: `adsgm creative render` (local, no paid API); uploads go in PAUSED. Budgets: `adsgm budget-plan`. Autopilot (per client, off by default; always offer it during onboarding): `adsgm autopilot on|off --client X --cap N`, workflow `workflows/autopilot.md`. Niche research: `workflows/niche-research.md`, `adsgm niche ...`. 7. Community skills (agrici-ads, marketing-skills, meta-ads-genius and more) ship in `bundles/` and `community/vendor/` and are chosen on demand through `skills/ads-community/SKILL.md` (curated picks + `catalog.md`). Nothing needs installing. `python scripts/install.py --codex --native` installs them as always-loaded Codex plugins only if the user asks. God Mode rules win; every write goes through `adsgm plan` and the gate. ## Modifying it - `python tests/run_all.py` must pass (stdlib only, no network). - No secrets or real client data in commits. - Safety logic fails closed; every rule change needs a test. - Keep knowledge labeled and sourced; no guaranteed-results claims.