Quick answer
Give a Nori agent read-only access to your customer or vendor master and a written matching policy. It finds duplicates and bad fields, then writes a change set: proposed merges and fixes, a before snapshot, an after preview and a rollback script. A data steward reviews it in Slack or a pull request. Only after approval does a separate, narrowly scoped job write the changes to your MDM system, verify them, and keep the rollback ready.
Why master data cleanups go wrong
Duplicate customers and vendors cost real money: split credit limits, duplicate payments, two account owners calling the same buyer. The fix looks simple, and that is the trap. A merge that picks the wrong surviving record or drops a bank account is hard to undo once invoices and orders point at it.
Agents are good at the tedious part: comparing thousands of records, normalizing names and addresses, and explaining why two rows match. The safe design keeps three rules:
- Read-only by default. The agent that finds and proposes changes has no write access to the master.
- Every change is a reviewable file. Proposals, snapshots and rollback live in a change set that a person can read line by line.
- Reversible before applied. No change set is approved unless its rollback script has been tested against a copy.
What a change set contains
Each run produces one folder in your data repository. It is the unit of review, approval and rollback:
changesets/2026-11-23-customer-dedupe/
README.md # summary, counts, open questions
policy.yml # copy of the matching policy used
proposals.csv # one row per merge or field fix, with evidence
before.parquet # snapshot of every affected record
after_preview.csv # what each surviving record will look like
apply.sql # the writes, in one transaction per merge group
rollback.sql # restores before.parquet values and unmerges
verify.sql # checks run after apply and after rollback
The matching policy is written by your data steward, not invented by the agent. It states what counts as a match, which record survives, and which fields must never be overwritten:
# mdm/policy/customer_match.yml
match:
strong: # any one is enough to propose a merge
- tax_id
- [normalized_name, postal_code, street_number]
weak: # proposed only with a second signal
- email_domain
- phone_e164
survivor:
prefer: [has_open_orders, most_recent_activity, oldest_created_at]
protected_fields: # never overwritten, flagged for a person
- bank_account
- credit_limit
- payment_terms
max_group_size: 4 # larger groups go to manual review
How to run a reviewed cleanup, step by step
- Connect read-only. Add a read-only credential for the MDM system or its warehouse replica to Nori as an integration scoped to the data agent.
- Write the policy. Your steward commits
customer_match.ymlwith finance or sales operations as required reviewers. - Ask for a proposal in Slack.
@nori run the customer dedupe against mdm/policy/customer_match.yml. Build a change set for groups with strong matches only. - The agent builds the change set. It snapshots every affected record, writes the proposals with evidence, generates
apply.sqlandrollback.sql, and runs apply then rollback against a scratch copy to prove the round trip returns the original rows. - A person reviews. The change set opens as a pull request, and a summary posts to Slack. The steward approves groups, rejects them, or answers the agent's questions in the thread.
- A separate job applies. After the pull request merges, an apply job with a write credential scoped to the merged change set runs
apply.sql, thenverify.sql, and posts the result. - Keep the rollback ready. The change set stays in the repository. Rolling back is one command, also gated on a person's approval.
Worked example: one duplicate customer group
Three rows for the same buyer, created by two sales reps and an e-commerce signup. The proposal row, as the steward sees it:
| Field | C-10422 (survivor) | C-18801 | C-20977 | After merge |
|---|---|---|---|---|
| Name | Harbor Supply Co. | Harbor Supply Company | HARBOR SUPPLY CO | Harbor Supply Co. |
| Tax ID | 84-1029376 | 84-1029376 | (blank) | 84-1029376 |
| Address | 12 Pier Rd, Portland ME 04101 | 12 Pier Road, Portland 04101 | 12 Pier Rd Ste 3, Portland ME | 12 Pier Rd Ste 3, Portland ME 04101 |
| Open orders | 7 | 0 | 1 | 8 (repointed) |
| Credit limit | $50,000 | $25,000 | (blank) | $50,000, flagged |
| Match evidence | Same tax ID | Name, postal code, street number |
The agent flags the credit limit because it is a protected field and the values differ. It keeps the survivor's value and asks: C-18801 has a $25,000 limit set by @dana.r in 2024. Keep $50,000 for the merged record? The steward answers in the thread, and the agent records the decision in proposals.csv.
The rollback for this group restores the two retired records and points the open order back:
-- rollback.sql, group G-0193
begin;
update mdm.customer set status = 'active', merged_into = null
where customer_id in ('C-18801', 'C-20977');
update mdm.customer set address_line1 = '12 Pier Rd',
address_line2 = null
where customer_id = 'C-10422';
update sales.order set customer_id = 'C-20977'
where order_id = 'SO-88213';
commit;
Every value in the rollback comes from before.parquet, so it restores what was there, not what the agent thinks should be there.
The approval message in Slack
Nori 10:42
Customer dedupe change set ready: PR #311
214 duplicate groups found, 196 strong matches proposed
18 groups held for review (weak match or group size > 4)
9 protected-field conflicts need a decision (listed in the PR)
Round trip on scratch copy: apply then rollback, 0 row differences
Approver: @steward-team. Nothing is written until the PR merges.
Approval is a merge by a named person, so your audit trail is the git history: who approved which groups, under which policy version, with the snapshot attached.
Running it as a team routine
Duplicates come back, so cleanup works best as a monthly automation. A cron line such as 0 7 1 * * starts a fresh run on the first of each month and posts the change set for review. Webhooks can also start a narrow check when a new vendor or customer is created.
Because the work runs on Nori, the whole team shares it. The steward approves from Slack. The matching rules and naming conventions live in your org skillset, and decisions like treat franchise locations as separate customers are saved as shared memories so the next run applies them. Any harness works: Claude Code, Codex, Gemini CLI, or Jiro, Nori's own agent, on your existing Claude or ChatGPT subscription. Nori never charges for tokens. Enterprise teams deploy the full stack in their own AWS VPC or Azure VNet so customer and vendor records stay inside their network.
For vendor records feeding accounts payable, see the vendor master cleanup example. For reference data with identifier cross-matching, see the agentic security master.
Frequently asked questions
Does the agent ever write to our MDM system directly?
No. The proposing agent has read-only access. Writes happen only through a separate apply job, with a write credential scoped to that job, after a named person merges the change set.
How do we know the rollback works?
Before the change set is offered for review, the agent applies it and then rolls it back on a scratch copy, and verify.sql compares the result with the before snapshot. The round trip result is shown in the summary.
Which MDM systems does this support?
Any system the agent can read through a database replica, an API, a CLI or an MCP server. Many teams start from a warehouse replica of the customer or vendor tables and apply through the system's own API.
What happens to fields like bank accounts or credit limits?
Fields listed as protected in the policy are never overwritten automatically. When duplicate records disagree on them, the agent flags the conflict and a person decides.
Can we approve part of a change set?
Yes. Each merge group is a separate row and transaction. The steward can reject groups in the review, and the agent regenerates apply and rollback scripts for the groups that remain.
How do we try this without risk?
Start with the 30-day free trial, no card needed, and run the proposal step only against a warehouse replica. You get a full change set to review without any write access in place.