skills/inbox-outreach-pilot/SKILL.md
Autonomous pilot for the InboxMate EMAIL outreach (Demo-Postfach/INBOX track). Assesses where the inbox pipeline stands (leads → demos → review → campaign → drafts) and executes the next sensible step end-to-end, always finishing with the inbox sanity check and a summary of what the user should do next (ideally: just schedule the mails). Runs in save mode by default: orchestration + all quality gates on the top model, data collection on haiku subagents, content generation on sonnet subagents (pass 'full' to disable). Use when asked to 'advance the email outreach', 'run the inbox pipeline', or 'what's next for the Demo-Postfach motion'.
npx skillsauth add psquared-development/psquared-skills inbox-outreach-pilotInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
One command that moves the EMAIL outreach forward, wherever it stands. It NEVER touches the chatbot track (demoType: CHATBOT/null) and it NEVER sends emails — sending/scheduling stays human, at notifications.psquared.dev → sidebar switch "Inbox".
Run autonomously through the stages. Only stop to ask when a step inherently needs the user (offer deadline for a new batch, confirmation of a new campaign's offer text). Process → report at the end.
/inbox-outreach-pilot [full] — save mode is the default; pass full to run everything on the main model.
YOU (the orchestrator, on the session's top model) keep all judgment. Delegate volume work to subagents via the Agent tool with an explicit model override:
| Work | Who/model | Examples |
|------|-----------|----------|
| Orchestration, decisions, ALL quality gates | Main loop (no delegation) — never delegate: sanity-result interpretation, hallucination spot-checks of drafts vs website, review verdicts (OK_TO_SEND/NEEDS_FIX), anything that writes demoStatus | STEP 2 routing, STEP 3 entirely |
| Mechanical data collection | Subagent, model: "haiku" | CRM state queries + client-side joins (STEP 1b), website reachability checks, skip-list lookups, scraping page content for research, collecting draft lists from the notification API |
| Customer-facing content generation | Subagent, model: "sonnet" | Per-company inbox demo building (research synthesis → Befund → seeded threads → create_inbox_demo → CRM opp), outreach draft copy via /setup-email-drafts variables. One subagent per company, parallel where independent. |
Rules:
full mode: same flow, no model overrides.Read .env (agenthub repo root or cwd): PSQUARED_CRM_TOKEN, NUXT_MCP_DEMO_TOKEN, OPENBRAND_API_KEY, EMAIL_DRAFT_ONLY_BEARER (and NOTIFICATIONS_SERVICE_BEARER_TOKEN if present). Missing token → stop and ask.
Gather ALL of these counts before deciding anything (announce the table):
# a) INBOX opportunities per stage
curl -s -X POST https://crm.psquared.dev/graphql -H "Content-Type: application/json" -H "Authorization: Bearer $PSQUARED_CRM_TOKEN" -d '{"query":"{ pending: opportunities(filter: { demoType: { eq: INBOX }, demoStatus: { eq: PENDING_REVIEW } }) { totalCount } needsFix: opportunities(filter: { demoType: { eq: INBOX }, demoStatus: { eq: NEEDS_FIX } }) { totalCount } okUnassigned: opportunities(filter: { demoType: { eq: INBOX }, demoStatus: { eq: OK_TO_SEND }, campaignId: { is: NULL } }) { totalCount } okAssigned: opportunities(filter: { demoType: { eq: INBOX }, demoStatus: { eq: OK_TO_SEND }, campaignId: { is: NOT_NULL } }, first: 100) { edges { node { id campaignId } } totalCount } sent: opportunities(filter: { demoType: { eq: INBOX }, demoStatus: { eq: SENT } }) { totalCount } }"}'
# b) INBOX-track leads without a demo: companies tagged INBOX_MATE whose
# qualification note says "Track: INBOX" and that have NO opportunity yet.
# Fetch companies + their notes + opportunities and join client-side
# (same approach as /inboxmate-batch-demo Step 1).
# c) Inbox drafts awaiting action (DRAFT = unscheduled, QUEUED = scheduled)
curl -s "https://notifications.psquared.dev/drafts?track=inbox&status=DRAFT&pageSize=200" -H "Authorization: Bearer $EMAIL_DRAFT_ONLY_BEARER"
curl -s "https://notifications.psquared.dev/drafts?track=inbox&status=QUEUED&pageSize=200" -H "Authorization: Bearer $EMAIL_DRAFT_ONLY_BEARER"
Work TOP-DOWN through this priority list. Execute the FIRST matching action; after it completes, re-assess (STEP 1) and continue down the list in the same run as long as steps complete autonomously. Stop looping when you hit a human gate (drafts ready to schedule, or a question like the offer deadline).
| # | Condition | Action |
|---|-----------|--------|
| 1 | Unscheduled inbox drafts exist (DRAFT > 0) | Sanity-gate them (STEP 3), then stop — the user's move is scheduling. Do NOT create more work in parallel; a pending send batch has priority. |
| 2 | okAssigned > 0 but those campaigns have no drafts yet | Run /setup-email-drafts for that campaign (it routes INBOX opps to the inbox-demo-outreach template UUIDs automatically). |
| 3 | okUnassigned > 0 | Run /plan-campaign inbox (ask the user for offer text + deadline — that's a legitimate stop). |
| 4 | needsFix > 0 | Fix inbox demos: read demoReviewIssues from the CRM, repair via update_inbox_demo (full inboxThreads replacement), reset to PENDING_REVIEW — then continue to #5. |
| 5 | pending > 0 | Run /review-demos inbox. |
| 6 | INBOX-track leads without demos exist (b) | Run /inboxmate-inbox-demo per company (or /inboxmate-batch-demo inbox for >3). Ask ONCE for the offer deadline. |
| 7 | No INBOX leads at all | Run /find-leads 15 inbox. |
| 8 | Everything empty AND sent > 0 | Run /check-outreach-status and report follow-up state. |
Whenever drafts are involved (created this run, or found in DRAFT/QUEUED status), ALWAYS run the inbox-aware sanity check before the final summary — no exceptions:
curl -s -X POST https://notifications.psquared.dev/drafts/sanity-check \
-H "Content-Type: application/json" -H "Authorization: Bearer $EMAIL_DRAFT_ONLY_BEARER" \
-d '{"draft_ids": ["<id>", ...]}' # or {"campaign_id": "<uuid>"}
The backend detects demoType: INBOX automatically and checks: demo API reachable with type=inbox, ≥3 seeded threads, ≥1 AI draft present, action mix (archive thread), countdown not expired, not already claimed, draft HTML (CTA href = demo link, footer, campaign_id set, umlauts, body length), follow-up linkage.
healthy: false → fix the cause first (demo via update_inbox_demo, draft via PUT /drafts/:id), re-run the check, only then hand over.━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
INBOX OUTREACH — Status nach diesem Lauf
Leads (Track INBOX, ohne Demo): [n]
Demos PENDING_REVIEW: [n]
Demos NEEDS_FIX: [n]
OK_TO_SEND (ohne Kampagne): [n]
Kampagne [Name]: [n] Drafts, Sanity: [n]/[n] healthy
Bereits SENT: [n]
Was diesem Lauf passiert ist: [1-3 Zeilen]
➡ DEIN NÄCHSTER SCHRITT: [exactly ONE action, e.g.
"Drafts prüfen & schedulen: notifications.psquared.dev/drafts → Sidebar 'Inbox' → Kampagne [X] → Schedule"
or "Offer-Deadline bestätigen, dann läuft /plan-campaign inbox weiter"]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
/setup-email-drafts (sent drafts or expired offer ⇒ refuse) applies unchanged.outreachFor contains PERSONAL_ONLY: hands off, always.tools
Set up a personalized InboxMate INBOX demo (Demo-Postfach) for a sales prospect: a public, read-only seeded inbox showing 5-7 pre-triaged emails in their industry's language, with categories, routing and ready AI drafts. Use for email-automation outreach (the €49-349 product), NOT for chatbot outreach. No agent is created.
development
Build InboxMate demos AND write personalised outreach drafts in a single pass per company — eliminating the double-research that happens when /inboxmate-batch-demo and /setup-email-drafts run separately. Use when kicking off a new campaign where the campaign already exists (plan via /plan-campaign first). For each target company, dispatches ONE subagent that researches the site, builds the demo, creates the CRM opportunity, and drafts the outreach email — reusing the same research across all three. After all subagents return, runs a single batch call to auto-generate follow-ups.
tools
Generate a polished psquared client offer as a multi-page PDF (title, project description, screenshots, Angebot/pricing, AGB). Walks the user through gathering inputs (or accepts a JSON config), renders branded HTML templates with Playwright in two passes (title page edge-to-edge + body pages with margins and pagination), then merges with pdf-lib.
data-ai
Create email drafts for approved InboxMate demos. Verifies all demos are ready, pulls contacts from CRM, creates CRM tasks, and creates draft emails via the notification service. Run after /review-demos has processed all pending demos.