Skip to content

How to build pipeline hygiene automation

The forecast is built on close dates that moved three times and next steps written in April. How hygiene automation changes the data itself, and the prompts that build it.

Last reviewed September 2026

Automation, built with Tray Headless

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.

Stage 4 of 8: Pipeline hygiene. Part of Revenue operations automation, end to end: every stage, the systems it runs on and the guide that builds it.

The flow: Salesforce, then Staleness by stage and value, then Nudge owner, then Slack, then Escalate by value. Salesforce System Staleness by stage and value Step Nudge owner Step Slack System Escalate by value Also
Thresholds vary by stage and deal size, and nothing commercial is written back.

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. 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. 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. 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. 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. 5

    Nothing commercial is edited automatically

    The app flags and asks. A close date moved by an integration is a forecast nobody trusts.

  6. 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 programs 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.

  • build-workflow
Claude Code or Codex

Use 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.

  • build-workflow
Claude Code or Codex

Use 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.

Claude Code or Codex

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.

  • tray-gotchas
Claude Code or Codex

Use 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.

Claude Code or Codex

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.

Claude Code or Codex

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.

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.

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.

Connections in this build

Field mapping, templates and common problems for each pairing: Salesforce + Slack, Gong.io + Salesforce, Gong.io + Slack and Outreach + Salesforce.

Running it in production

This messages the sales team weekly. Get it wrong and it is ignored permanently.

  1. 1

    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.

  2. 2

    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.

  3. 3

    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.

  4. 4

    RevOps owns the thresholds

    The staleness table and escalation rules open in Tray Build, tuned by the team that owns the sales motion.

  5. 5

    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.

Build it as an app with Tray 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.

Further reading

Background on the same subject, for the case rather than the build.

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?

No, not 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.

See it working for your business.

Bring your stack and your ideas. See what's possible.

Great, a couple more details

This helps us connect you with the right person. Optional, and you can skip it.