Ultron

CRM Hygiene Bot

Dedupe leads, enrich missing firmographics, flag stale records, and queue cleanup tasks so your pipeline reports stay trustworthy.

Next.jsTypeScriptExa.aiZod

Capabilities

Detect duplicate leads using at least 2 matching signals
Enrich records with missing firmographics, every claim cited to a URL
Flag stale records while protecting open opps above $10k
Queue every cleanup as a human-approved task, never auto-mutate
System Prompt
You are a CRM data steward. You keep the database clean without breaking it.

WORKFLOW:
1. Call detect_duplicates by email + domain + fuzzy company name.
2. Call enrich_record for accounts missing firmographics.
3. Call flag_stale records with no activity in 90+ days and no open opp.
4. Call queue_cleanup tasks rather than auto-deleting; humans approve before merge or archive.

RULES:
- Never auto-merge or delete records. Always queue for human approval.
- Duplicate detection must use at least 2 signals (email + domain, name + phone).
- Enrichment must cite the source URL so reps can verify.
- Stale records with open opps over $10k are protected from any cleanup queue.
Agent Source
import { agent, tool } from "@agent-sdk"
import Exa from "exa-js"
import { z } from "zod"

const dedupeInput = z.object({
  records: z.array(z.object({
    id: z.string(),
    email: z.string().email(),
    company: z.string(),
    domain: z.string().optional(),
  })),
})

export default agent({
  model: "claude-sonnet-4-6",
  permissionMode: "bypassPermissions",
  maxTurns: 30,
  systemPrompt: `...`, // see System Prompt section above
  tools: {
    detect_duplicates: tool({
      description: "Find dupes using email + domain + fuzzy company name",
      inputSchema: dedupeInput,
      execute: async ({ records }) => { /* clusters */ },
    }),
    enrich_record: tool({
      description: "Fill missing firmographics with cited sources",
      inputSchema: z.object({ recordId: z.string() }),
      execute: async ({ recordId }) => {
        const exa = new Exa(process.env.EXA_API_KEY)
        return exa.search(recordId, { numResults: 4 })
      },
    }),
    flag_stale: tool({
      description: "Flag records with no activity in 90+ days",
      inputSchema: z.object({ days: z.number().int().min(30) }),
      execute: async ({ days }) => { /* stale[] */ },
    }),
    queue_cleanup: tool({
      description: "Queue merge/archive tasks for human approval",
      inputSchema: z.object({ tasks: z.array(z.any()) }),
      execute: async ({ tasks }) => { /* job ids */ },
    }),
  },
})

File Structure

agents/
crm-hygiene-bot.ts
lib/crm/
dedupe.ts
enrich.ts
stale.ts
app/api/crm-hygiene/
route.ts
Setup
$ npm install
$ cp .env.example .env.local
# Add CRM credentials and EXA_API_KEY
$ npm run dev

Environment Variables

EXA_API_KEYExa.ai key for enrichment
CRM_API_KEYSalesforce / HubSpot API key

Sell This Agent

Dirty CRM data costs more than dirty code. This runs nightly, queues clean fixes for humans, and never breaks pipeline reports.

Setup fee
$2,600
Monthly retainer
$420/mo
Target marketRevOps, Sales managers, B2B SaaS

Included

Full agent source code
Multi-signal dedupe
Open-opp protection
Connect to Ultron pipelineUnlock
Approve queue UI in UltronUnlock
Turn views into income.Drop your video link, get paid as the view count climbs.
Submit a video