Automation · Revenue operations
How to build pipeline hygiene automation
The forecast is built on close dates that moved three times and next steps written in April. Here is the model behind hygiene automation that actually changes the data, the prompts that build it, and what it takes to run in production.
Built with Tray Headless
- System Salesforce
- Step Staleness by stage and value
- Step Nudge owner
- System Slack
Thresholds vary by stage and deal size, and nothing commercial is written back.
The short answer
What is pipeline hygiene automation?
Done well, pipeline hygiene automation is four things: detection rules that describe staleness in terms of deal value and stage rather than one blanket age, nudges that reach the owner where they work instead of a report nobody opens, escalation weighted to the deals that matter, and a measurement of whether the data actually changed. The part teams get wrong is the blanket rule. Fourteen days without activity means nothing on a 90 day enterprise cycle and means everything on a transactional one.
What matters here
- One staleness threshold across all deals is wrong for most of them. Scale it by stage and by deal size.
- Nudge the owner directly. A dashboard of dirty deals is a report about a problem, not an intervention.
- Escalate by value, not by count. Twenty stale small deals matter less than one stale deal that carries the quarter.
- Measure whether the field changed after the nudge. If it did not, the nudge is noise and should be redesigned or removed.
- Never auto-edit a commercial field. Closing a deal or moving a date on the rep's behalf destroys trust in the forecast.
Who this is for
You run revenue operations. The forecast review spends its first twenty minutes on data quality, and the weekly hygiene report has been emailed for a year without the underlying numbers changing.
How it works in practice
Everything that sits between a deal going stale and somebody doing something about it.
- 1
Staleness is defined per stage and per value band
Fourteen days in discovery on a transactional deal, thirty in negotiation on an enterprise one. One number fits neither.
- 2
Detection runs on the fields that actually predict risk
Next step missing, close date in the past, close date moved more than twice, no activity, amount unchanged since creation.
- 3
The owner is nudged where they work
One message, their deals, the specific field, and a link straight to it. Not a digest of the whole team.
- 4
Escalation is weighted by value
The manager hears about the deal carrying the quarter, not about twenty small ones with a blank next step.
- 5
Nothing commercial is edited automatically
The app flags and asks. A close date moved by an integration is a forecast nobody trusts.
- 6
The change rate is measured
Did the field get fixed after the nudge. That number decides whether the rule stays.
What hygiene automation is made of
This is not a report. It is four parts, and the last one is what stops it becoming one.
Value-aware detection
Thresholds by stage and deal size, because the same age means different things on a two week cycle and a two quarter one.
Nudges to the owner
Direct, specific, and linked to the record. A shared dashboard is where hygiene programmes go to be ignored.
Weighted escalation
Ranked by value at risk instead of by count, so a manager sees the deal that matters first.
A change measurement
The proportion of nudges followed by an actual field change. A rule that never changes anything is noise with a schedule.
The Tray Headless prompts
Paste these into Claude Code or Codex with the Tray Headless plugin installed. Each stage runs on its own. The systems named in them are the worked example rather than a requirement, and every prompt says so.
Once per project, run
/tray-workflows:set-workspace
to pick the workspace these build in. Point it at a sandbox first.
- 1
Set up, then find the fields that predict risk
Hygiene rules built on the wrong fields generate noise forever.
Headless skills
build-workflowUse build-workflow. The systems in play are Salesforce, or whatever we run in those seats. I need Opportunity with its stage model, close date, amount, next step, last activity date and the history object that records field changes. Specifically: how do I query how many times a close date has been changed. That is a better slip signal than any single stale date, and it lives in history rather than on the record.
- 2
Define staleness by stage and by value
One blanket threshold is wrong for nearly every deal it touches.
Headless skills
build-workflowUse build-workflow. Build a detection table I can edit, not rules in code: stage value band stale after Discovery under 25k 10 days no activity Discovery 25k and above 21 days no activity Negotiation under 25k 7 days no activity Negotiation 25k and above 14 days no activity Plus these regardless of band: Next step empty or older than the last activity Close date in the past and the stage is not closed Close date changed more than twice Amount unchanged since creation and past discovery Every flag carries which rule fired, so a rep can be told exactly what to fix instead of that their deal is dirty.
- 3
Nudge the owner, not the room
The difference between an intervention and a report.
Send each rep one message, weekly, in Slack. Their deals only, ordered by value, with the specific problem and a direct link to each record. Keep it short. Five deals maximum in the message with a link to the rest. A message listing thirty things gets the same treatment as a dashboard. Never send a rep a message about a colleague deal, and never post a league table of who has the dirtiest pipeline. That produces gaming rather than accurate data, and inaccurate data is the thing you were trying to fix.
The five deal cap matters more than it looks. A nudge that feels achievable gets actioned; an exhaustive list gets archived.
- 4
Escalate on value, and never edit a commercial field
Two rules that decide whether the sales team trusts this.
Headless skills
tray-gotchasUse tray-gotchas, then build escalation. Escalate to the manager only when: the deal is above a value threshold, it is in a late stage, and it has been flagged for two consecutive weeks. Rank by value at risk, not by count of problems. Two things the automation must never do: Never change a close date, a stage, an amount or a forecast category. It flags and it asks. A forecast that an integration has been editing is a forecast nobody defends in a board meeting. Never close a deal as lost on age. A stale deal is a question, not a verdict. The only field it may write is a hygiene flag and the timestamp of the last nudge.
- 5
Measure whether anything actually changed
The step that separates this from the report it replaces.
For every nudge, record whether the specific flagged field changed within seven days. Then report: Change rate per rule. A rule below 20% is noise, and should be redesigned or deleted instead of kept out of politeness. Flags per rep and per team, trending. Value at risk from flagged deals, which is the number for the forecast review. Repeat offenders by rule, which usually indicates a process gap rather than an individual one. If the overall change rate does not improve within a quarter, this is a report with extra steps and should be turned off.
- 6
Prove it works, then hand the thresholds to RevOps
Because thresholds change with the sales motion.
Run the per-step schema checks and the whole-workflow audit before this touches production. Then open the same workflow in Tray Build so revenue operations can tune the staleness table and the escalation thresholds in the visual canvas. Those change whenever the sales motion changes, which is more often than anybody expects.
What it connects to
Hygiene reads the pipeline and reaches the people who own it.
Salesforce
Read opportunities, their history and activity. Write only a hygiene flag and the nudge timestamp, never a commercial field.
Reads and writes
Gong
Read real call and email activity, which is a truer engagement signal than a logged task.
Reads
Outreach
Read sequence activity, so a deal being worked through sequences is not flagged as silent.
Reads
Snowflake
Land flags and outcomes, so change rate per rule is measurable rather than assumed.
Writes
Looker
Publish value at risk where sales leadership already looks, beside the forecast it affects.
Writes
Same build, other stacks
The design does not change if you run something else in one of these seats. The same prompts build it against Microsoft Dynamics 365, Google BigQuery, Microsoft Teams, Power BI, HubSpot or Databricks.
Named systems are the ones most teams run, not the only ones that work. Each is an authentication in your Tray workspace, referenced by name, so the workflow never holds a credential. Where we have a connector page, the name links to it.
Running it in production
This messages the sales team weekly. Get it wrong and it is ignored permanently.
It lives on the platform, not in a terminal window
Weekly detection, nudges and outcome tracking execute on the same engine, with history for every message sent.
It writes almost nothing
A hygiene flag and a timestamp. The commercial fields belong to the rep, and that boundary is why the data stays honest.
Credentials are managed, never written into the build
This one needs almost no write access, so grant almost none. A hygiene workflow with permission to edit an amount is a workflow that eventually will.
RevOps owns the thresholds
The staleness table and escalation rules open in Tray Build, tuned by the team that owns the sales motion.
Rules that do not work get deleted
Change rate per rule is reported. A rule below 20% is noise, and keeping it trains people to ignore the rest.
Questions people ask
Why not one staleness threshold for everything?
Because fourteen days without activity means nothing on a 90 day enterprise cycle and means everything on a transactional one. A single number generates noise on one motion and misses problems on the other.
Why nudge instead of building a dashboard?
Because a dashboard of dirty deals is a report about a problem. A short weekly message to the owner, with the specific field and a direct link, is an intervention.
Should the automation fix the data itself?
Never for a commercial field. A close date, stage, amount or forecast category changed by an integration produces a forecast nobody defends. It flags and asks.
How do I know if it is working?
Measure whether the flagged field changed within seven days of the nudge. Any rule below a 20% change rate is noise and should be redesigned or removed.
Who owns the staleness rules once this is running?
Yes. The staleness table and escalation thresholds open in Tray Build, so the team that owns the sales motion owns the rules.
Vibe-coding app guides
Vibe-code an entire app with Helix
This moves the data between systems. It does not give anybody a screen to work in. Build that app in Claude Code, Codex or Cursor, then deploy and run it governed on Tray Helix. Same kind of guide, same kind of prompts.
How to build a pipeline hygiene dashboard (opens helix.tray.ai in a new tab)
Further reading
Background on the same subject, for the case rather than the build.
Related guides
Revenue operations
How to build lead routing that assigns in seconds
Match the lead to an account first, evaluate rules in a fixed order, catch what they miss, and time it from arrival. The Headless prompts that build it.
Revenue operations
How to build lead deduplication and merge
Detect on a scored rule set, survive the merge with field-level rules, keep the activity history, and never silently reassign an owner. The prompts that build it.
Data operations
How to build a CRM to warehouse sync
Capture history instead of current state, handle deletes and field changes, land raw then model, and prove the row counts. The Headless prompts that build it.
Revenue operations
How to build a sales engagement to CRM sync
Log activity without flooding the timeline, suppress sequences on the accounts you must not touch, and keep one definition of engagement. The prompts that build it.
Revenue operations
How to build a conversation intelligence to CRM sync
Write the few fields a rep will act on, keep every claim linked to its moment in the call, and never let a model set a close date. The prompts that build it.
Last reviewed September 2026.