Inbox

From Infrasity-Labs/dev-gtm-claude-skills · View interactive version

Inbox is an AI agent skill from the GitHub repository Infrasity-Labs/dev-gtm-claude-skills. Email triage system that handles both one-time setup and recurring triage in a single skill. Auto-detects state: if no knowledge base exists at ${WORKSPACE}/Email/, runs an 8-section onboarding interview (grill-me discipline, one question at a time) to build a 7-file personalized KB, then offers to

How to use this skill

Skill file

Inbox — Email Triage System

Self-contained email triage skill. Handles setup and recurring triage in a single command. Detects its own state and routes accordingly — no need to remember which mode to run.

State Detection (Always First)

Before anything else, check for the KB:

| State | Route |

|---|---|

| Argument is update | → Update Mode |

| ${WORKSPACE}/Email/email-taxonomy.md does NOT exist | → Setup Mode |

| ${WORKSPACE}/Email/email-taxonomy.md exists | → Triage Mode |

Edge cases:


SETUP MODE — Build the Knowledge Base

Runs when no KB exists.

Conduct Discipline

Do NOT generate all files at once. Walk through the 8 sections one at a time. Each section commits its file(s) before moving on. Partial completion (user drops off mid-interview) still produces a usable partial KB.

See references/grill_me_section_walk.md for the 8-section discipline detail.

Knowledge Base — 7 Files to Produce

Write to ${WORKSPACE}/Email/:

| File | Purpose | Required? |

|---|---|---|

| email-taxonomy.md | Classification system + report preferences | Yes |

| email-patterns.md | Reply voice, tone, templates, hard rules | Yes |

| evaluation-framework.md | Decision tree for opportunity emails | Only if user receives pitches/opportunities |

| rate-card.md | Pricing, terms, negotiation posture | Only if user has pricing |

| blocklist.md | Auto-skip senders + learned decline patterns | Yes (seeded, grows over time) |

| tracker.md | Active follow-ups, overdue items, deadlines | Yes (starts mostly empty) |

| triage-log/ | Directory for per-run logs | Yes (created empty) |

Stop Condition

~25–31 questions total across 8 sections. Hard ceiling: 35 questions including sub-clarifications. Section 4 (Evaluation Framework) is skipped entirely when Section 1 surfaced no opportunity-email category. After Section 8's confirmation + handoff message, intake is closed — to change preferences, use update mode.

Section 1: The Big Picture

Six grill-me questions, one at a time:

Action: Build mental model. Do NOT write files yet. Note whether opportunity emails are a category (drives S4 skip-logic).

Section 2: Email Categories

Propose 5–7 categories based on Section 1 — pre-recommend a subset:

Three forcing questions, one at a time:

Action: Generate email-taxonomy.md with categories, signals, and default actions per category.

Section 3: Reply Style & Voice

Six grill-me questions plus the critical sample request:

S3.SAMPLES (highest-quality input):

Paste 3–5 real sent emails from your inbox.

Why I'm asking: Self-description of voice is unreliable. Real samples are the best signal — use scripts/voice_sample_analyzer.py to extract patterns.

Action: Generate email-patterns.md. See references/voice_calibration.md for the sample-extraction discipline.

Section 4: Evaluation Framework (Conditional)

Skip if Section 1 surfaced no opportunity emails. Otherwise six grill-me questions:

Action: Generate evaluation-framework.md + rate-card.md (if pricing exists).

Section 5: Blocklist & Patterns

Action: Generate blocklist.md.

Section 6: Current State

Action: Generate tracker.md + create empty triage-log/ directory.

Section 7: Report Preferences

Action: Append report preferences to email-taxonomy.md.

Section 8: Confirmation & Handoff

List every file created with a one-sentence summary. Run scripts/kb_validator.py --workspace ${WORKSPACE} to confirm the 7-file contract is satisfied.

Then ask:

Your triage system is ready. Run triage now?

1. Yes — process my inbox immediately

2. No — I'll invoke it separately

If yes → transition directly to Triage Mode below.

Privacy Boundary

Never persist passwords, full account numbers, SSNs, or other sensitive credentials in KB files. If volunteered during the interview, acknowledge but don't store — write [stored separately by user] in the relevant file.


TRIAGE MODE — Recurring Email Triage

Runs when KB exists. Light-intake by design.

DRAFTS ONLY — Never Send

This skill creates drafts. It NEVER sends.

Non-negotiable. The scripts/draft_safety_validator.py enforces it post-run. Any send-shaped tool call in the action log fails validation. See references/drafts_only_safety.md.

Step 0: Grill-Me Intake (0–2 Optional Override Questions)

Q1 (only when on-demand run is outside normal cadence):

Override the default 9-hour search window? yes (specify hours) / no.

Why I'm asking: If you're running outside your normal cadence, you may want a wider or narrower window.

Q2 (only when user invokes with category-skip intent):

Skip any categories this run? E.g., "skip newsletters".

Why I'm asking: Sometimes you just want to scan opportunities or clear active threads.

Max 2 questions. Default invocations skip both and run with KB-default preferences.

Step 1: Determine Search Window

Use scripts/search_window_calculator.py --cadence <CADENCE> --now <ISO>:

| Cadence (from email-taxonomy.md) | Default window |

|---|---|

| once daily | 26h |

| 2x daily | 9h |

| 3x daily | 6h |

| on-demand only | 24h (asks Q1) |

Step 2: Email Search

Two queries:

Collect per email: sender, subject, date, snippet, thread ID, labels.

Provider adapter:

| Provider | Tool |

|---|---|

| Gmail | Gmail MCP |

| Outlook / Microsoft 365 | Outlook MCP |

| IMAP (Fastmail, ProtonMail, etc.) | IMAP MCP if available; halt otherwise |

| (no email tool available) | Halt: "No email tool registered for this session." |

Step 3: Classification

Apply taxonomy from email-taxonomy.md. For lowest-priority category (newsletters/automation/spam): skip thread reads entirely. For everything else: read full thread.

Step 4: Sender Research

For senders not in tracker / blocklist / prior logs:

  1. Check blocklist.md → if matched, auto-skip
  2. Check tracker.md → if known thread, note existing context
  3. For opportunity senders: web search for legitimacy, social presence, intermediary status

Skip entirely for: known senders, internal email, automated notifications, obvious low-priority.

Step 5: Recommendations

Apply evaluation-framework.md (skip this step entirely if file doesn't exist):

| Category | When | Output |

|---|---|---|

| TAKE IT | Meets criteria | Recommend engaging; draft reply (Step 6) |

| WORTH CONSIDERING | Has potential, needs user judgment | Surface context; draft for user to edit |

| PASS | Doesn't meet criteria | Brief "why" (1–3 sentences); draft polite decline |

| FLAG FOR REVIEW | Unusual; needs direct user decision | Surface fully; NO draft |

See references/triage_decision_framework.md for the framework canon.

Step 6: Drafts

Draft using email-patterns.md voice rules. NEVER call any send operation. Only create drafts.

Draft body must honor:

Do NOT draft for: newsletters, automation, FYI threads, already-replied threads, blocked senders.

Tone by recommendation:

Step 7: Report Delivery

Honor preference from email-taxonomy.md. Default: email draft to self.

Subject: Inbox Triage — [Day], [Month Date] ([Run Label])

Sections (in order):

  1. Overview — 2–3 sentences. What happened? Anything urgent?
  2. Stats — Processed / drafts created / action needed / skipped
  3. Action Needed — Overdue items, decisions, drafts to review, deadlines
  4. Quick Reference — One line per email: **Sender** — summary + recommendation
  5. Detailed Cards — Opportunities, active threads, flags. No draft text previews.
  6. Footer — Timestamp + KB update summary

HTML formatting (if applicable): inline CSS only (Gmail strips <style>). Color-coded: green → TAKE IT, amber → WORTH CONSIDERING, red → PASS, purple → FLAG FOR REVIEW, blue → active conversation.

Step 8: Knowledge Base Update

blocklist.md: append new declined senders + patterns; remove if user overrode.

tracker.md: append new follow-ups, update existing, mark resolved, flag overdue, remove resolved items older than 30 days, add entry to update log.

After 5+ runs, suggest KB improvements: "You always decline emails from X — add as auto-skip?"

Step 9: Internal Log

Save to ${WORKSPACE}/Email/triage-log/[YYYY-MM-DD]-[run-label].md:

Audit trail for scripts/draft_safety_validator.py.

Step 10: Empty Inbox Handling

Even with zero new emails:

  1. Check tracker.md for items due today or overdue
  2. Generate minimal report: "No new actionable emails since last run"
  3. Flag overdue items

Skip Steps 3–6 entirely on empty inbox.


UPDATE MODE — Refresh Preferences

Triggered by /notion inbox update or "update my inbox preferences."

  1. Detect existing files at ${WORKSPACE}/Email/
  2. For each file, ask: replace / merge / skip
  3. Walk only the sections whose files the user chose to update
  4. Skip sections whose files the user kept

Critical Rules

  1. DRAFTS ONLY — NEVER SEND. Non-negotiable.
  2. Privacy. No passwords / credentials in KB files.
  3. Accuracy over speed. When unsure, flag for review.
  4. Respect the KB. Documented preferences are source of truth. Don't override with judgment.
  5. Transparency. Note every KB change in the triage log.
  6. First runs need oversight. Document this expectation for the user.

Error Handling

| Situation | Behavior |

|---|---|

| No KB + triage invoked | Run setup first, then triage |

| KB exists + setup invoked | Acknowledge; offer triage / update / both |

| Partial KB (missing files) | List gaps; offer full setup or fill missing sections only |

| Workspace inaccessible | Stop; tell user where files would go; ask for path |

| Email tool unavailable | Halt with clear message |

| User refuses voice samples | Use self-description; flag in patterns file that calibration may need iteration |

| User drops off mid-interview | Honor partial KB; committed files are usable |

| 100+ new emails | Flag volume; offer to focus on priority categories only |

| Sender in both blocklist and tracker | Tracker wins; note inconsistency in log |

Portability

Tooling

| Script | Role |

|---|---|

| scripts/kb_validator.py | Validates the 7-file KB after setup (required files present, conditional files match sections run, headers + structure correct). |

| scripts/section_progress_tracker.py | JSON-backed walk state across the 8 interview sections. |

| scripts/voice_sample_analyzer.py | Extracts voice patterns from pasted sent-email samples. |

| scripts/kb_reader.py | Reads + validates the 7-file KB at triage start. Halts on missing required files. |

| scripts/search_window_calculator.py | Computes window_start from cadence + current time. Returns run_label. Honors Q1 override. |

| scripts/draft_safety_validator.py | Post-run scan of action log for any send-shaped tool call. FAIL if detected. |

References

Anti-Patterns To Reject

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.