> ## Documentation Index
> Fetch the complete documentation index at: https://80x.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Keep the pipeline honest

> Pipeline hygiene runs on a schedule that flags and tasks drifted records, never auto-closes, and stays cheap because it writes only on the true branch.

Pipeline hygiene runs on a schedule that flags and tasks drifted records, never auto-closes, and stays cheap because it writes only on the true branch. A drifted record is a deal that has gone quiet, or one that is about to renew without anyone touching it. The true branch is the path the workflow takes only when a deal really has drifted. This path turns the polite fiction in your pipeline into a system that cleans itself. A workflow wakes on a clock, finds those deals, and acts on them. No human has to open a single view.

This is a guided path. It teaches the approach, then walks you through the matching [Guides](/guides) builds in order. Come here to learn the sequence; go straight to [Guides](/guides) when you just need one build.

You finish with five builds. One surfaces aging deals. One stops duplicates at creation. One watches renewals. One hands off closed-won deals. One reports. You also leave with a clear mental model for why each build flags a deal instead of closing it.

<Note>
  **Prerequisites:** finish [Capture and qualify](/learn/capture-and-qualify). Then skim [Loops & processing many records](/explanation/loops) and [Runs, debugging & publishing](/explanation/runs-and-debugging), so per-record cost and run history already make sense.

  **By the end you can:** stand up a scheduled sweep that flags and tasks drifted deals on its own, with no false positives and no manual cleanup.
</Note>

## The mental model

Hygiene runs on a clock, not on a click. A scheduled workflow fires on its own, finds the records that have drifted, and acts on them. But it only flags the deal and creates a task. It never auto-closes a deal. Holding that line keeps a false positive cheap. A deal flagged in error costs an owner one glance, not a lost record.

Two things can go wrong, and each has a specific fix. The first is false positives, where the system flags deals that are actually fine. When that happens, people stop trusting it. So you tune the age threshold per stage instead of applying one global age to every deal. The second is runaway loop cost, where a sweep does far more work than expected. When that happens, finance stops trusting you. To prevent it, keep the [Find records](/reference/records/find-records) filter tight. Then cap the test run before you let the sweep loose on the whole pipeline.

The cost depends on where the writes happen. Logic and lookup blocks are free. You spend nothing to find the records and step through them. Those free blocks are the [Recurring schedule](/reference/triggers/recurring-schedule) trigger, [Find records](/reference/records/find-records), the [Loop](/reference/utilities/loop), and an [If](/reference/conditions/if) condition. You pay only on the branch that writes. That branch holds the [Update record](/reference/records/update-record) flag and the [Create task](/reference/tasks/create-task) for the owner. Putting those writes behind the condition is what keeps a quiet week cheap.

## Build the scheduled sweep

These steps build the path's flagship sweep at lesson altitude. That is enough to grasp the shape and the credit math. The full configuration tables, variable mapping, and test plan live in the Challenge guide, [Stale-deal sweep](/guides/pipeline-hygiene/stale-deal-sweep).

<Steps>
  <Step title="Wake the workflow on a schedule">
    Add the [Recurring schedule](/reference/triggers/recurring-schedule) trigger and set it to run weekly, early on Monday, in the time zone your reps actually work in. Pick the team's zone rather than the workspace default. For example, use `Europe/London` for a team in Europe, the Middle East, and Africa (EMEA). That way "Monday morning" lands the same for everyone, and the sweep finishes before the pipeline review.
  </Step>

  <Step title="Find only the open, owned deals">
    Add a [Find records](/reference/records/find-records) block on the **Deals** object and filter hard. Restrict it to open stages such as `Qualified`, `Proposal`, and `Negotiation`. Require an **Owner**, and add a wide activity bound so you never pull the whole pipeline. A tight filter is your main defense against a loop credit blow-up. Every record it returns becomes one loop iteration.
  </Step>

  <Step title="Cap the test run at five records">
    Set the [Find records](/reference/records/find-records) limit to `5` while you build. An untuned sweep over a four-thousand-deal pipeline can fire four thousand task writes in a single run. So you watch the credit math on five records first. Raise the limit only after a clean test, and keep the stage filter narrow.
  </Step>

  <Step title="Loop over the matches">
    Add a [Loop](/reference/utilities/loop) block and point it at the records from the find step. Inside the loop, the current deal appears as the loop's `Current item`, and the blocks inside the loop read from it. The loop itself is free, but what runs inside it is not. So every block that writes lives inside the loop, and the condition before it decides whether it runs.
  </Step>

  <Step title="Gate on a stage-specific age">
    Inside the loop, work out a cutoff date that depends on the deal's stage. Then add an [If](/reference/conditions/if) condition that continues only when the deal's last interaction falls before that cutoff. A `Qualified` deal idle for eight days is genuinely stale. Flagging a `Proposal` deal at the same age just trains reps to ignore the flag. Stage-specific thresholds are how you keep false positives near zero. A condition that stops a run is free.
  </Step>

  <Step title="Flag the deal and task the owner">
    On the true branch only, add an [Update record](/reference/records/update-record) block to set a **Needs review** flag. Then add a [Create task](/reference/tasks/create-task) block assigned to the deal owner and linked to the deal. Name the deal and stage in the task text, such as `Stale deal review: Acme renewal (Proposal)`. That way the owner, Priya Sharma, opens straight into context. The flag write is idempotent, which means re-running it has no extra effect. Re-running the sweep on an already-flagged deal just re-sets the same value.
  </Step>

  <Step title="Publish and watch the first runs">
    Use the **Run test** button to fire the trigger by hand instead of waiting for Monday. Then read the run in history to confirm the writes happened only on the stale branch. I check this weekly for the first month. A sweep that flags the wrong deals erodes trust faster than no sweep at all.
  </Step>
</Steps>

<Note>
  Each stale deal costs only the two writes on the true branch, the flag and the task. The schedule, find, loop, and condition stay free, and fresh deals cost nothing. For per-block credit amounts and your plan's monthly allowance, see [Credits & pricing explained](/reference/credits-and-pricing) rather than assuming a number from another page. Per-workflow credit caps were removed in the new engine. So the only lever that matters is keeping the stale count honest, with a tight filter and accurate per-stage thresholds.
</Note>

## Modules

Work these in order, or jump to the one that hurts most. Each is a complete, follow-along build you ship into your own workspace.

<CardGroup cols={2}>
  <Card title="Stale-deal sweep" icon="broom" href="/guides/pipeline-hygiene/stale-deal-sweep">
    Surface aging deals with a stage-specific age threshold, flag each and task the owner, and keep false positives at zero.
  </Card>

  <Card title="Dedupe on create" icon="copy" href="/guides/pipeline-hygiene/dedupe-on-create">
    Catch duplicates the instant a record is created, not in a quarterly cleanup.
  </Card>

  <Card title="Daily renewal watch at 90, 60, and 30 days" icon="calendar-clock" href="/guides/pipeline-hygiene/renewal-watch">
    Never miss a renewal: a daily watch fires owner tasks at three windows before the date.
  </Card>

  <Card title="Hand off closed-won deals to Customer Success" icon="handshake" href="/guides/pipeline-hygiene/closed-won-handoff">
    Hand off cleanly the moment a deal closes, so nothing falls between sales and onboarding.
  </Card>

  <Card title="Daily pipeline digest to Slack" icon="slack" href="/guides/pipeline-hygiene/pipeline-digest">
    Report without a standup, in one Slack post that spends no AI credits.
  </Card>
</CardGroup>

## Challenge

Stand up the [Stale-deal sweep](/guides/pipeline-hygiene/stale-deal-sweep) end to end. A Monday schedule finds open deals past a stage-specific age, loops them, flags each, and tasks the owner. It then posts a single review digest. Cap the test run at five records so you watch the credit math before you let it loose on the whole pipeline.

## Where this goes next

This path makes the pipeline tell the truth on its own. The next path hands a whole funnel segment to an AI agent that researches and routes. That agent works under the read-only, "Run as" permission model, in [Let AI own a stage](/learn/let-ai-own-a-stage).

## See also

* [Stale-deal sweep](/guides/pipeline-hygiene/stale-deal-sweep)
* [Let AI own a stage](/learn/let-ai-own-a-stage)
* [Loops & processing many records](/explanation/loops)
* [Credits & pricing explained](/reference/credits-and-pricing)

*Sources: [Overview of workflows](https://attio.com/help/reference/automations/workflows/overview-of-workflows) and [Create a workflow](https://attio.com/help/reference/automations/workflows/create-a-workflow). Last reviewed against the Attio Help Center, June 2026.*


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.