Score every closed-lost HubSpot deal and draft revival emails for the best ones
A script reads your lost deals in HubSpot, scores each one out of 100 on how long ago it was lost, its size, why it was lost and recent signs of life, and drafts an email for the top few. Nothing is sent without a person approving it.
Curated by Andrew Donato, Editor. Reviewed .
Get one setup like this every Thursday, by email.
Written for sales leaders running leaner teams.
Free. One email a week. Unsubscribe anytime.
Paste this into ChatGPT, Claude or your agent tool. See the prompt
- Pipeline Hygiene / CRM
- intermediate
- Sales leader
- AE
- RevOps
- Founder
- Category
- Pipeline Hygiene / CRM
- Difficulty
- Intermediate
- Est. cost
- Free repo (MIT); needs a HubSpot private app token, and any model fees depend on the agent you run it in
Works with
What problem does this solve?
Most CRMs hold years of lost deals that nobody looks at again, even though some were lost on timing or budget and would buy now. Reps do not have time to reread every one, so revival depends on who happens to remember an account.
How is the agent set up?
Eric Siu, founder of the marketing agency Single Grain, shared a deal revival script his team built for its own pipeline on HubSpot, released in the MIT-licensed ai-marketing-skills repo as deal_resurrector.py with a Claude Code skill file. You hand the folder to Claude Code or another agent and ask it to pull lost deals from a set period, score them, and show the top ten with a draft email each, without sending. The script pulls closed-lost deals from the stages you map, skips deals under a minimum value and companies on an exclusion list, and adds four parts into a score out of 100: time since loss (up to 35 points, with 60 to 90 days as the best window, fresh losses held down and very old ones counted only with a recent signal), deal size relative to your largest (up to 30), the loss reason (up to 20, so timing and budget rank above competitor or bad fit) and signs of life such as a recent email open (15). It then drafts a short revival email for the original contact and saves the ranked list to a file; a dry-run flag prints results without saving. The post and README also describe checking whether the contact still works there, finding a replacement, and following a departed champion to a new company that fits your customer profile. As the author put it: "It drafts every email and sends none of them without approval." The prompt below is our starter version of the review step.
What prompt does it use?
Starter prompt by The GTM Agent Weekly, written from the setup described on this page. It is not the source's own prompt; see the source link below for their write-up.
# ROLE
You are a deal revival analyst for {{COMPANY}}. You find lost deals worth reopening and draft first emails. You never send anything.
# INPUTS
- {{LOST_DEALS}}: closed-lost deals from {{CRM}} for the last {{MONTHS}} months, with close date, amount, loss reason, owner, contact and recent engagement.
- {{SCORING_WEIGHTS}}: how many points go to time since loss, deal size, loss reason and recent signals, and which time window scores best.
- {{LOSS_REASON_RANKING}}: which loss reasons are most worth revisiting for us (for example timing above bad fit).
- {{EXCLUSIONS}}: companies we should never contact again.
- {{WHAT_CHANGED}}: product, pricing or offer changes since these deals were lost.
# TASK
1. Drop deals under {{MIN_DEAL_VALUE}} and anything in {{EXCLUSIONS}}.
2. Score each remaining deal out of 100 with {{SCORING_WEIGHTS}} and {{LOSS_REASON_RANKING}}, and show the points behind each score.
3. For the top {{TOP_N}}, say whether the contact is confirmed still at the company, unknown, or gone. Do not guess.
4. Draft a short email for each that references the real loss reason and, when relevant, something from {{WHAT_CHANGED}}.
# OUTPUT FORMAT
- A table: company, owner, amount, days since lost, loss reason, score with breakdown, contact status.
- One draft email per top deal, under 90 words.
- "Needs a human": deals where the reason or contact is unclear.
# GUARDRAILS
- Do not send, schedule or log any email; the deal owner reviews every draft.
- Never invent a reason a deal was lost, a product change or a customer result.
- Skip anyone who asked not to be contacted. Replace every {{PLACEHOLDER}} before running. Works with any capable LLM and runner.
Get 5 setups like this every week, free.
Real agent setups with prompts, sources and failure modes, in one short weekly email.
Free. One email a week. Unsubscribe anytime.
What tools does it use?
How do you set it up?
- Clone the sales-pipeline folder of the ai-marketing-skills repo and add a HubSpot private app token to the .env file.
- Map your closed-lost stage IDs, set a minimum deal value, and adjust the loss reason weights to match which reasons actually come back for you.
- Run it in dry-run mode for the top ten and read the scores and breakdowns before saving anything.
- Add companies that must never be contacted to the exclusion list.
- Hand the ranked list to each deal owner with the drafted email, and let them edit and send from their own inbox.
- Review which revived deals turned into meetings and tune the weights from that.
What results are reported?
No results are claimed; the author says the team built it for its own pipeline.
Used in recipes
What goes wrong
Where does this break?
- The author's own guardrail: it drafts emails and sends none without approval.
- Fresh losses under 60 days are scored down on purpose, and deals older than about 18 months only count if there is a recent signal.
- In the public script we read, the contact still-there check and champion tracking return placeholders (status unknown, no replacement found), so confirm contacts yourself before outreach. (editor note)
- The drafted emails come from fixed templates with rotating sign-offs, not from the deal history, so expect to rewrite them. (editor note)
- The loss reason score depends on a keyword match in a free-text field; messy or empty loss reasons all land in the middle. (editor note)
- A blank loss reason leaves nothing to set the wait or the angle on. Kenny Damian of Frontal, describing a similar closed-lost play in a Nov 3, 2026 X article, has a rep fill in the reason before the deal enters the play and sets a different wait time for each loss reason.
This is where most teams get stuck. Want us to handle the setup?
Source and credit
Eric Siu (@ericosiu), Single Grain, ai-marketing-skills repo (shared on X) · x
Source dated 2026-10-28 · last reviewed 2026-11-04. Summarized in our own words; see the source for details.