Campaign strategy

From Othmane-Khadri/YALC-the-GTM-operating-system · View interactive version

Campaign strategy is an AI agent skill from the GitHub repository Othmane-Khadri/YALC-the-GTM-operating-system. Pre-flight strategy advisor for a new campaign. Analyses every past campaign in the local YALC DB (HeyReach campaigns auto-sync on each run), their real outbound copy, where in the sequence each conversation first replied, every prior retro brief, and the validated/proven intelligence file. Then it

How to use this skill

Skill file

Campaign Strategy (pre-flight)

The forward-looking sibling of improve-campaign. Where improve-campaign asks "what should we change after this campaign?", strategy asks "what should we do for the next campaign, given everything we know?"

Goal (per David's standing direction): "Improve our campaigns constantly. The goal is not execution and completion — it's performance and results." The skill exists at the moment a new campaign is being built, because that is when analysis is most useful.

Key idea: the reasoning happens in chat — not via a duplicate API call. The CLI helpers load the raw data and persist the output; the strategic thinking happens between them.

When this skill applies

Not this skill:

Inputs

Just one: concept — a short description of the campaign the user wants to launch. e.g. "Reddit GEO Specialists hire", "datascalehr CHRO Tier-1 follow-up". Don't ask anything else up front.

Procedure

Step 0 — Guard

test ! -e ~/.gtm-os/.in-flight-setup

If the file exists, stop and tell the user setup is in progress.

Step 1 — Auto-sync HeyReach (proactive — do not ask)

Per David's standing rule: if the user doesn't need to do something because you have access, do it. Before pulling data, refresh the local DB so the strategy reasons against the latest funnel + copy + reply attribution:

npx tsx src/cli/index.ts campaign:import-heyreach

This is idempotent and cached (5-min TTL on stats, 1-hour TTL on chatrooms), so it's cheap on re-runs. It auto-extracts the real DM copy and reply-step attribution from chatrooms via the HeyReach MCP. If the user has other senders besides David, repeat with --sender-account-id <id>.

Surface a one-line note ("Synced N HeyReach campaigns") so the user sees the refresh happened — don't dump the full output.

Step 2 — Pull the strategy data block

npx tsx src/cli/index.ts campaign:strategy --data-only --concept "<one-line concept>"

Emits JSON with three top-level arrays plus the concept:

{
  "concept": "...",
  "tenantId": "default",
  "intelligenceDir": ".../data/intelligence",
  "outputDir": ".../data/intelligence",
  "pastCampaigns": [
    {
      "id": "heyreach:412427",
      "title": "GEO/SEO Talents Batch #1",
      "hypothesis": "...",
      "funnel": { "leads": 43, "connectsSent": 42, "connectsAccepted": 24, "dmsSent": 18, "replies": 15, "acceptRate": 0.57, "replyRate": 0.83 },
      "replyAttribution": [ { "after_step": 1, "replies": 11 }, { "after_step": 2, "replies": 10 } ],
      "conversationsSampled": 18,
      "variants": [ { "name": "...", "connectNote": "...", "dm1Template": "<the real DM1 text>", "dm2Template": "<the real DM2 text>", "sends": 42, "accepts": 24, "acceptRate": 0.57, "dmsSent": 18, "replies": 15, "replyRate": 0.83 } ]
    }
  ],
  "retroBriefs": [ /* every campaign_improvement_*.json */ ],
  "intelligence": [ /* every validated/proven entry in data/intelligence/ */ ]
}

dm1Template / dm2Template are the real outbound messages David sent, extracted from chatrooms. replyAttribution shows where in the sequence each conversation first replied (after_step: 1 = after DM1, after_step: 2 = after DM2, etc.). The connect-request note is NOT recoverable via LinkedIn's API — if the user wants it factored in, ask them to paste it via campaign:annotate --connect-note "..." before continuing. Otherwise, proceed using DM1+ data only.

Step 3 — Reason in chat (this is the work)

Read the data block and write a strategy brief that matches this shape:

{
  "proposed_campaign_concept": "<echo back the concept>",
  "summary": "one-line strategic take",
  "closest_past_campaigns": [
    { "id": "heyreach:412427", "name": "...", "why_similar": "...", "headline_metric": "57% accept / 83% reply on 43 leads" }
  ],
  "what_worked_before": [
    { "observation": "...", "evidence": "...", "confidence": "hypothesis|validated|proven" }
  ],
  "what_to_carry_forward": [
    { "decision": "...", "rationale": "...", "confidence": "..." }
  ],
  "copy_devices_to_test": [
    { "device": "...", "seen_in": "<campaign id or '(new)'>", "why_might_work": "...", "confidence": "..." }
  ],
  "what_to_test": [
    { "hypothesis": "...", "test_design": "...", "rationale": "..." }
  ],
  "open_strategic_questions": [
    "one-line question the user must answer before launch"
  ]
}

Reasoning rules:

Step 4 — Save the brief

echo "$STRATEGY_JSON" > /tmp/campaign_strategy_<slug>.json
npx tsx src/cli/index.ts campaign:strategy --from-file /tmp/campaign_strategy_<slug>.json

The CLI validates the schema and writes data/intelligence/campaign_strategy_<slug>_<YYYYMMDD>.json.

Step 5 — Render the result in chat

Show the user six sections:

When relevant, include a small reply-attribution table showing which step caught replies for each closest-past campaign — it's load-bearing data the user will want to see.

Then tell the user where the file landed.

Step 6 — Follow-up offer

After rendering, offer:

Want me to draft outbound copy for this strategy now? For a YALC tenant (client) campaign I'd route to refine-outbound-copy. For an Earleads-internal campaign I'll draft in chat directly against this brief and your voice rules.

If yes: chain forward. If they want to refine the strategy first, iterate in chat and re-write the file.

Step 7 — Surface CLI failures verbatim

Print stderr unchanged. Common failure modes:

Hard rules

Reference

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.