---
name: sales_pipeline_leak_diagnosis
description: "Diagnose where a sales pipeline leaks, stalls, or goes stale from CRM data: stage-by-stage conversion, days-in-stage aging, stall detection, dollar impact of the biggest leak. Trigger when a user asks why deals are stalling, where pipeline leaks, to analyze pipeline health, forecast risk, or review stage conversion and deal aging."
---

# Sales Pipeline Leak Diagnosis

## Purpose

Read CRM pipeline data, find where deals leak or stall, benchmark each stage against the team's own baseline, and name the biggest leak with its dollar impact. Tool-agnostic: works from any CRM export (HubSpot, Salesforce, Pipedrive, spreadsheet) via a CSV the CLI reads.

## Workflow

1. **Get the data.** Export deals with at minimum: deal id, stage, amount, stage entry date, deal created date, outcome (open/won/lost). Strongly preferred additions: last activity date, expected close date, owner, next step. See `references/input_schema.md`.
2. **Run the diagnosis.** `python3 scripts/leak_diagnosis.py --csv deals.csv [--stages "Qualification,Discovery,Demo,Proposal,Negotiation"]` prints a report and writes `diagnosis.json`. See `references/`.
3. **Name the leak.** The report ranks every stage by estimated revenue lost: `entered_count x (1 - conversion_to_next) x avg_deal_value`. The top row is the biggest leak. State it in dollars, not percentages: "$41K lost last quarter at Proposal-to-Negotiation" beats "38% conversion".
4. **Check stalls separately.** A healthy win rate can hide leakage when high-value deals sit stuck late-stage. List every open deal past 2x its stage's median days-in-stage, with severity (2.0x stuck, 3.0x+ dead weight) and risk flags (no activity 14+ days, no next step, close date past).
5. **Benchmark, carefully.** Compare each stage's conversion against the team's own baseline (median days-in-stage, stage conversion from last quarter). Industry reference ranges live in `references/benchmarks.md` but they are practice-based guides, not targets. Never present a rough industry range as a fact about the user's business.
6. **Deliver findings + fixes.** Follow `references/output_template.md`: the leak, the stalls, coverage and velocity numbers, and the highest-ROI fix (tighten qualification, add stage exit criteria, kill zombie deals, fix follow-up cadence). One recommended action, with the dollar math showing why.

## Output Contract

Every diagnosis delivers, in this order:
1. Funnel table: per stage, deals entered, converted to next, conversion %, median/p90 days-in-stage.
2. The biggest leak: stage pair, dollar value lost, share of total leakage.
3. Stall list: open deals past 2x stage median, with age multiple and risk flags.
4. Coverage ratio (pipeline / quota) and pipeline velocity (($ opps x win rate x avg deal value) / avg cycle days).
5. One prioritized fix, priced in dollars recovered.

## Operating Rules

- Accuracy rule: every number in the report comes from the input data. No invented benchmarks, no confident claims about data you were not given. Unverifiable = cut or frame as opinion.
- Never diagnose a stage the data cannot support. If there is no stage history, say stage *distribution* only, not conversion. A current-stage snapshot alone cannot produce true stage-to-stage conversion.
- Label every industry benchmark as a rough reference with its source. The team's own baseline is always the primary comparison.
- Zombie deals (3x+ median days-in-stage, no activity 14+ days) get named, not averaged into the stage stats silently. Flag and offer the qualify-out-or-revive decision.
- Do not advise fabricating CRM activity or editing deal history to make numbers look better. Diagnosis means seeing the real picture, not dressing it.
- The CLI is the source of truth for the math. Recompute, never estimate, the leak dollars.
