Skip to content

How to build a CRM hygiene agent with Tray Helix

Duplicates split pipeline and bad fields break routing, and nobody owns the cleanup. This agent finds both, proposes fixes, and waits for approval.

Last reviewed November 2026

App, built with Tray Helix

The short answer

A CRM hygiene agent scans accounts, contacts and leads on a schedule, finds likely duplicates and fields that break your rules, and proposes a merge or a fix with the evidence for each. Merging and updating are tools marked for approval, so nothing in the CRM changes until the record owner approves the exact change. Approved fixes are applied and logged.

crm-hygiene.helix-app.ai

CRM Hygiene

38

Proposed tonight

12

Duplicates

26

Field fixes

Record Problem Proposed change Evidence Owner
Acme Corp Duplicate account Merge into Acme Corporation Same domain, same billing address R. Diaz
J. Chen Duplicate contact Merge into Jamie Chen Same email, one older record M. Patel
Northwind Ltd Industry blank Set to Logistics Company website and 3 sibling accounts R. Diaz
Globex Country is 'USA' Set to United States Picklist value required A. Novak
A sketch of tonight's proposals. Each one carries its evidence and goes to the record owner, and nothing changes until they approve.

What matters here

  • A CRM hygiene agent proposes merges and field fixes with evidence, and the CRM changes only after the record owner approves.
  • Merging is the riskiest write in a CRM, so the merge tool always waits for approval and names which record survives.
  • Rules catch the obvious problems, and the agent handles the judgment calls rules miss, such as two account names for one company.
  • Routing each proposal to the record owner puts the decision with the person who knows the account.
  • Every proposal, approval and change is logged, so a bad merge can be traced to who approved it and why.

Who this is for

You run revenue operations or own the CRM. You know duplicates and blank fields are costing you routing and reporting accuracy, and a one-time cleanup never stays clean.

How it works in practice

A nightly pass, and a morning queue of proposals the owners can clear in minutes.

  1. 1

    A scheduled run starts

    A scheduled function runs the agent each night over records created or changed since the last run.

  2. 2

    It finds likely duplicates

    Same domain, same email, near-identical names and addresses. The agent judges the close calls rules miss.

  3. 3

    It checks fields against your rules

    Required fields, picklist values, formats such as country and phone, and values that contradict each other.

  4. 4

    It proposes with evidence

    Each merge names the record that survives and why. Each fix shows the old value, the new one and where it came from.

  5. 5

    The owner approves

    merge_records and update_fields are marked for approval. The owner approves, edits or declines each proposal.

  6. 6

    It applies and logs

    Approved changes go to the CRM, and the run log records who approved what.

What a CRM hygiene agent is made of

Rules for the obvious, the agent for judgment, and approval on every write.

Your data rules

Required fields, allowed values and formats, kept in the app's database where revenue operations can edit them.

Find tools

Search for likely duplicates and records that break a rule. Read only.

Two write tools, gated

merge_records and update_fields, both marked for approval, so every change waits for the owner.

A proposal queue

Each proposal with its evidence, its owner, and its outcome: approved, edited or declined.

The prompts

Paste these into Claude Code, Codex or Cursor in order. Each one leaves you with something that runs, so you can stop after any step.

These prompts start from a Helix project, which is what handles sign-in, credentials and hosting. Start with Helix.

1

Rules and the proposal queue

What clean means, and where proposals wait.

Claude Code, Codex or Cursor

Create a Helix app: a CRM hygiene agent with a proposal queue.

Store data rules that revenue operations can edit: required fields per object, allowed values for picklists, formats for country, state and phone, and pairs of fields that must agree.

Store proposals: the record, the problem, the proposed change, the evidence, the record owner, and the outcome (waiting, approved, edited, declined) with who decided and when.

Show each owner their own waiting proposals, with approve, edit and decline on each, and a way to approve several at once.

2

The agent and its tools

Find, judge, propose, wait.

Claude Code, Codex or Cursor

Add an agent to the app that finds and proposes CRM fixes.

Give it these tools:

- find_duplicates: return groups of likely duplicate accounts, contacts

or leads, with what they share.

- find_rule_breaks: return records that break a data rule, and which rule.

- lookup_company: read company details from an outside source.

- merge_records: merge records into the one that survives.

- update_fields: set field values on a record.

Mark merge_records and update_fields as needing approval every time.

For each duplicate group, propose which record survives and why: most activity, most complete, oldest. For each rule break, propose the fixed value and where it came from. If the evidence is weak, say so and do not propose a change.

Asking the agent to say when evidence is weak keeps the queue short and the approvals meaningful.
3

Run it every night

Hygiene that keeps up with the data.

Claude Code, Codex or Cursor

Run the agent every night over records created or changed since the last run, and once a week over everything.

In the morning, post each owner a Slack message with how many proposals they have and a link to their queue.

Show a weekly view: proposals made, approved, declined, and the share of records that pass every rule.

4

Connect it to real systems

Your CRM, your data sources.

Claude Code, Codex or Cursor

Now connect it to the systems we actually run.

Anything in angle brackets is a placeholder. Swap it for whatever we use.

<Salesforce>. Read accounts, contacts and leads, and merge or update them when a proposal is approved.

<Clearbit>. Read company details to fill blank fields.

<Slack>. Send each owner their morning summary.

Only write through merge_records and update_fields. Everything else is read only.

Tray holds each credential as a workspace authentication, so the app references a name and never the secret itself.
5

Ship it

A URL, and the owners on it.

Claude Code, Codex or Cursor

Deploy my app.

Your assistant runs helix deploy and the app comes back as a URL. Set Access Control so owners see and approve only their own records.

What it connects to

The agent reads the CRM and outside sources, and writes back only after approval.

Named systems are the ones most teams actually run, not a list of the only ones that work. Swap in whatever you use.

Running it for real

The build gets you a working agent. It changes your system of record, so approvals, credentials and the log matter most.

  1. 1

    Deploy the app and its agent together

    One command, or Deploy from CI on every merge, takes the app to a live URL. The agent ships with its app, so you can roll back any deployment.

  2. 2

    Approval on every merge and fix

    merge_records and update_fields wait for the record owner, who sees the tool and the exact change. SSO decides who owns what.

  3. 3

    Credentials held by Tray

    The CRM credential is held in Tray, not in the code, so it can be rotated without a redeploy.

  4. 4

    A named owner and every step logged

    The app and its agent have a named owner. Every run, proposal and approved change is logged, and Tray streams the logs to your SIEM.

  5. 5

    Know what a clean CRM costs

    AI usage shows per app, so the nightly run's cost is visible next to the records it fixed.

Questions people ask

What does a CRM hygiene agent do?

It finds likely duplicates and fields that break your data rules, proposes a merge or fix with the evidence for each, and changes the CRM only after the record owner approves.

Will the agent merge records on its own?

No. merge_records is marked for approval every time, and each proposal names the record that survives and why. The owner approves, edits or declines.

Why use an agent and not just deduplication rules?

Rules catch exact matches. An agent can judge close calls, such as a trading name and a legal name for the same company, and explain its reasoning so the owner can check it.

Does it work with Salesforce and HubSpot?

Yes. The agent's tools reach your CRM through Tray, which connects to 12,000+ apps, databases, APIs, and services. Writes still wait for approval.

Build it, then run it properly

Helix is the governed runtime for AI-built apps and agents. Deploy what you build, put SSO in front of it, connect it to your systems with managed credentials, and give it a named owner.