Skip to content
All blogs

Agency operations

Claude Code for Paid Media: 10 Workflows Beyond Reporting

Marxx · 2026-10-31 · 12 min read

How can paid media teams use Claude Code with Meta ads? Treat it as a night shift. Connect an MCP server (claude mcp add --transport http marxx <url>), write a handover note in CLAUDE.md, and lock the doors with permissions and hooks. Then schedule the jobs that should run while you sleep: audits, pacing, fatigue, competitor teardowns. Wake up to a digest, a brief and drafts waiting for your yes.

The jobs that should happen while you sleep

Every paid media team has two kinds of work.

The first is thinking: deciding what to test, judging creative, talking to clients. That needs people, awake.

The second is checking: is the naming convention holding? Are any links broken? Are we on pace? Which ads are fading? What did competitors launch? These jobs are the same every week. They matter, they're dull, and they're usually done late, done badly or not done at all, because they lose every fight for attention against the thinking work.

Chat-based AI doesn't fix that, because someone still has to open the chat and ask. Claude Code, Anthropic's command-line tool, can. It runs jobs from files, on a schedule, under rules that are enforced even when nobody is watching.

So this guide treats Claude Code as a night shift. You'll set it up the way you'd set up any new overnight hire:

  1. The handover note: What it needs to know (CLAUDE.md).
  2. The locked doors: What it's not allowed to touch (permissions).
  3. The night guard: What stops it if it tries (hooks).
  4. The shift rota: Ten jobs, sorted by what runs alone, what waits for you, and what never runs without a human.

Along the way you'll see real output from two of the jobs, run on live Marxx data, and three starter files you can copy.

Commands and file locations are from Anthropic's Claude Code documentation, October 2026. Check the docs for changes.

The night shift: naming audit and link check at 2am, pacing and fatigue at 4am, competitor teardown and gap matrix at 6am, and a digest, brief and drafts waiting at 9am


Part 1: Why a night shift, and not a chat

Claude chat vs Claude Code: chat is best for asking and exploring; Claude Code is best for repeating and automating, with files, schedules, enforced rules and team sharing

Claude (chat) Claude Code
Best for Asking and exploring Repeating and automating
Output An answer in a conversation Files: CSV, Markdown, scripts
Memory Projects and chat history CLAUDE.md and rules in a folder
Runs on a schedule No Yes, with claude -p
Rules Approvals in the chat Permissions and hooks enforce them
Shared with the team Per user Committed to version control

The test for whether a job belongs on the night shift: Would you give it to a reliable junior with written instructions and no authority to spend money? If yes, it's a night-shift job. If it needs judgement, taste or a client conversation, it stays on the day shift.

When Claude Code is the wrong choice: If nobody on the team is comfortable in a terminal, start with chat (connecting Meta Ads to Claude) and move jobs over once you're repeating them.


Part 2: Hiring the night shift

Give it access

Claude Code adds remote MCP servers with one command. HTTP is the documented, recommended transport for remote servers:

claude mcp add --transport http marxx <your-marxx-mcp-url>

Then run /mcp inside Claude Code to sign in. Do this interactively, before you schedule anything: the docs note that headless runs can't complete an OAuth sign-in.

Servers can be added at three scopes. For agencies, use project scope, with one folder per client:

Scope Who gets it Stored in
Local (default) Only you, in the current project ~/.claude.json
Project Everyone using the folder, via version control .mcp.json in the project
User Only you, across all projects ~/.claude.json

What a paid media repo looks like: a client folder with CLAUDE.md, .mcp.json, settings, a weekly-digest skill, a competitor-analyst subagent, briefs and reports

The handover note, the locked doors and the night guard

Here's the single most important idea in this guide.

CLAUDE.md is advice, read every session and usually followed but not enforced; permissions and hooks are rules, enforced outside the model

Anthropic's documentation describes CLAUDE.md as context, not enforced configuration. Claude reads it at the start of every session and usually follows it, but nothing forces it to. That's exactly like a handover note to a new hire: good for guidance, useless as a security system.

For rules that must hold, you need two things a handover note can't provide:

  • Permissions (the locked doors): Rules in .claude/settings.json that allow, ask or deny specific tools. They're evaluated deny first, then ask, then allow. MCP tools are named mcp__<server>__<tool>, so you can deny a server's write tools while allowing its reads.
  • Hooks (the night guard): Commands that run automatically at set points. A PreToolUse hook runs before any tool call and can block it; exiting with code 2 prevents the call.

The quotable version: You wouldn't secure an office with a sticky note that says "please don't open the safe". Don't secure an ad account with CLAUDE.md. Put preferences in the note; put rules in locks.


Part 3: Three starter files

Three starter files: CLAUDE.md as the handover note, settings.json as the locked doors, block-spend.sh as the night guard

These are examples to adapt. Tool names vary by server; run /mcp in Claude Code to see the exact names your server exposes, and replace the placeholders below.

1. The handover note: CLAUDE.md

# Client: Acme (trampoline parks)

## Who we're talking to
- Parents of 4–12 year olds planning weekends and birthdays.
- Use their words: "kids burn off energy", "we don't have to organise anything".

## Voice
- Plain, warm, short sentences. No "unleash", "ultimate", "epic".

## Naming convention
- Campaign: ACME_[Objective]_[Audience]_[YYYYMM]
- Ad: [Hook]_[Format]_[Creator or Asset]_v[n]

## Thresholds (never judge below these)
- Fatigue: only ads with 20+ purchases per 7-day window.
- Pacing: flag campaigns more than 15% ahead or behind plan.

## Never
- Never draft changes to budgets or targeting. Recommend only.
- Never use AI-generated people as customers or testimonials.

Why it works: Each section answers a question a new hire would otherwise ask. The thresholds matter most: they stop automated checks crying wolf over tiny numbers.

2. The locked doors: .claude/settings.json

{
  "permissions": {
    "allow": [
      "mcp__marxx__get_*",
      "mcp__marxx__search_*"
    ],
    "deny": [
      "mcp__marxx__apply_*",
      "Bash(curl *)"
    ]
  }
}

Why it works: Read tools are allowed, so the night shift can do its job. Anything that applies a change is denied outright. Deny rules are checked first, so a deny always wins. Per the docs, allow patterns need a literal mcp__<server>__ prefix; a bare mcp__* in allow is ignored.

3. The night guard: A PreToolUse hook

In .claude/settings.json, register the hook:

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "mcp__marxx__.*",
        "hooks": [
          { "type": "command", "command": ".claude/hooks/block-spend.sh" }
        ]
      }
    ]
  }
}

And the script, .claude/hooks/block-spend.sh:

#!/bin/bash
# Reads the tool call from stdin. Blocks anything that could spend money.
input=$(cat)
if echo "$input" | grep -qiE 'budget|activate|publish|bid'; then
  echo "Blocked by the night guard: spending changes need a human." >&2
  exit 2   # exit code 2 blocks the tool call
fi
exit 0

Why both a permission and a hook? Permissions match tool names. A hook can inspect the content of a call, catching a risky change hidden inside a tool whose name looks harmless. Two independent locks mean one mistake isn't enough.


Part 4: The shift rota

The shift rota: overnight read-only jobs one to six, morning jobs seven to nine waiting for you, and job ten never running without a human yes

Overnight: Read-only, runs alone

1. Naming audit (2am). Check every live ad name against the convention in CLAUDE.md. Output a CSV: current name, problem, suggested name. Measure: The share of ads following the convention, month on month.

2. Link and tracking check (2am). Check every live ad URL loads, and flag missing or inconsistent tracking parameters. Measure: Broken links caught before they cost money.

3. Pacing check (4am). Compare month-to-date spend with budget.csv. Flag anything outside your threshold. Measure: Months that land within range.

4. Fatigue watch (4am). Apply the written rule: 20+ purchases, cost per purchase up two weeks running, spend steady, not in learning. Output a refresh list with evidence, not a pause.

A fatigue rule you can defend: volume, trend, spend, learning, and a refresh list where a human decides

Why the rule matters: Small numbers produce false alarms. One sale can flip which ad looks "best" (see analysing Meta ads in ChatGPT). Measure: The share of flagged ads confirmed as fatigued on review.

5. Competitor teardown (6am). A subagent, a "competitor analyst" with its own instructions, researches rivals and returns a dated summary to reports/.

6. Gap matrix (6am). A hook-by-format table of what competitors run that you don't, counting only ads live 30+ days.

Real output from jobs 5 and 6

Here's what these two jobs produced when run on live Marxx data for one brand (anonymised) in October 2026.

The gap matrix found six hook types that competitors used and this brand didn't. The biggest gap was price-focused hooks: 158 long-running competitor ads across 10 rivals, live 78 days on average. Negative hooks were nearly untouched, with only one rival using them.

Real gap list for one brand: price-focused hooks used in 158 competitor ads across 10 rivals averaging 78 days live, command hooks 83 ads, aspirational 71, minimalist hero 45, text overlay 23, negative 21

The teardown found what rivals were backing hardest, ranked by days live and copies:

Real competitor ads with days live: Smaaash 'Bowling at ₹9' 36 days, 'Make Monday your Sunday' 37 days, SHOTT 'Hit a strike, grab a drink' 48 days with 6 copies, 'Make it epic' 37 days

  • SHOTT's "Hit a strike, grab a drink": 48 days, 6 copies.
  • Smaaash's "Make Monday your Sunday": 37 days.
  • And one that stopped: Smaaash's "Countless ways to waste your time" ended on 22 October after 56 days and 8 copies. That's the line worth reading at 9am: what replaced it?

What a human did with it: Chose two gaps to test (a price hook and a negative hook), and asked the morning shift for briefs.

Morning: Waiting for you

7. The Monday digest. Headless mode, claude -p, runs a prompt non-interactively and can output JSON, so a scheduler can run it and post the result to Slack.

The scheduled digest pipeline: a scheduler triggers claude -p, which queries the Marxx MCP server and writes structured output to Slack

claude -p "Run the weekly-digest skill for Acme" --output-format json

8. The test brief. From the digest and gap matrix: hook, offer, format, competitor evidence, and the result that would count as a win, saved to briefs/.

9. Copy variants. Twenty variants following CLAUDE.md's voice rules, saved as a CSV with one row per variant for human review.

Never alone: A human yes

10. Change drafts. Pauses, budget moves, anything that spends. These are drafted, never applied, and pass four layers before anything changes:

Four layers before anything changes: permissions, hooks, Marxx drafts and a human yes

  1. Permissions deny apply tools.
  2. The hook blocks spending changes by content.
  3. Marxx drafts a before and after, rather than sending.
  4. A human approves, with a second confirmation for big moves. Nothing can be deleted.

One more warning from the docs: Project-level MCP servers load without approval prompts in headless runs, and servers that fetch external content can expose you to prompt injection. Review .mcp.json before you schedule anything. See guardrails for AI in your ad account.


Hire in four weeks

Week Do this Why
1 Jobs 1 and 2, run by hand twice, then scheduled Low risk; proves the setup
2 Write CLAUDE.md and the fatigue skill; add jobs 3 and 4 Make the rules explicit
3 Jobs 5 to 9 Intelligence and production, still no account changes
4 Permissions and hook, then job 10 Only add drafts once the locks are tested

A Marxx competitor brief delivered in Slack

Six mistakes, and how to spot them

Mistake Symptom Fix
Rules only in CLAUDE.md A rule "usually" followed Permissions and a hook
Scheduling before signing in Headless runs fail on auth Authenticate interactively first
One folder for all clients Rules and data leak between clients One folder and project-scoped server per client
No thresholds Fatigue alerts on tiny samples Write minimums into CLAUDE.md
Automating before it works Automated mistakes, every night Run each job by hand twice first
Trusting unknown servers Strange tool behaviour Vendor URLs only; review .mcp.json

What to take into your next team meeting

  • Give the checking work to a night shift; keep the thinking work for people.
  • CLAUDE.md is a handover note, not a lock. Enforce rules with permissions and hooks.
  • Two independent locks: Permissions match tool names; hooks inspect what the call does.
  • Write thresholds down, so automated checks don't cry wolf.
  • Nothing that spends money runs alone.

FAQ

Can Claude Code connect to Meta Ads? Yes, through an MCP server added with claude mcp add. Meta has an official ads server; Marxx adds competitor data and approval-based drafts.

Do I need to be a developer? You need to be comfortable in a terminal and willing to edit a few text files. The jobs themselves are plain-language prompts.

How do I stop Claude Code changing my ads? Deny apply tools in permissions, add a PreToolUse hook that blocks spending changes, and use a server that only drafts changes.

Can Claude Code run on a schedule? Yes. Headless mode (claude -p) runs a prompt non-interactively, so any scheduler can trigger it.

What's the difference between CLAUDE.md, skills and subagents? CLAUDE.md is always-on context. Skills are saved procedures Claude uses when relevant or when called. Subagents are specialised helpers with their own instructions that return a summary.


Hire the night shift

Add the Marxx MCP server to Claude Code: One command connects your ads and your competitors' ads, tagged by hook, offer and format, with every change waiting for your yes.

Add the Marxx MCP Server →

Related: How to Connect Meta Ads to Claude · Best MCP Servers for Marketing · Guardrails for Letting AI Touch Your Ad Account

Sources

One size fits none. Let’s build your exact setup.

Hop on a call with our founder to see real-world use cases, cut out the noise, and isolate the exact tools that drive results for your business — complete with a personalized pricing plan.