> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mapping.travel/llms.txt
> Use this file to discover all available pages before exploring further.

# Recipe: Triage mismatches to pending

> Group similar mismatch reports, draft a proposed resolution, and queue them for human review.

When mismatch reports pile up, a human can spend hours just **grouping** them before any real triage happens. This recipe sets up an agent that listens for new `MismatchReportedEvent`s, groups similar reports (same partner row, same suggested correction), drafts a proposed resolution, and files it as a pending item.

## What you'll build

An agent that:

1. Subscribes to `MismatchReportedEvent`.
2. Reads the existing open mismatch reports for the same partner row.
3. If there's a similar one, marks them as a group.
4. Drafts a 1-2 sentence proposed resolution (e.g. *"All three reports converge on referenceHotelId `ref_01J...` — agree."*) and posts it as a pending `MISMATCH_PROPOSED_RESOLUTION` item.

The agent **never** sets `FIXED` or `REJECTED` — that stays with a human.

## Steps

<Steps>
  <Step title="Create the agent">
    Name: *"Mismatch triage"*. Goal:

    > Watch new mismatch reports. Group similar ones, draft a proposed resolution as a pending item. Never mark fixed or rejected.
  </Step>

  <Step title="Rules">
    ```json theme={null}
    {
      "mismatch_reports": {
        "auto_transition_open_to_in_progress": true,
        "group_similar": true,
        "post_proposed_resolution": true
      },
      "notifications": { "on_escalation": true }
    }
    ```
  </Step>

  <Step title="Activate">
    The agent runs on the next `MismatchReportedEvent` (no cron needed).
  </Step>
</Steps>

## What a reviewer sees

In **Pending → MISMATCH\_PROPOSED\_RESOLUTION**, each item shows:

* The grouped mismatch reports (count + links).
* The agent's proposed resolution text.
* **Apply** (advances reports to `FIXED` with the resolution body) / **Modify** / **Reject** buttons.

## Equivalent API call

```bash theme={null}
curl -X POST https://api.mapping.travel/api/v1/agents/{id}/rule-sets \
  -H 'X-API-Key: mt_...' \
  -H 'Content-Type: application/json' \
  -d '{
    "mismatch_reports": {
      "auto_transition_open_to_in_progress": true,
      "group_similar": true,
      "post_proposed_resolution": true
    },
    "notifications": { "on_escalation": true }
  }'
```

## Undo

Marking `IN_PROGRESS` is undoable (reverts to `OPEN`) for 7 days from the workspace Undo Center. Filing pending items is undoable via dismiss.

## Related

* [Agents overview](/agents/overview) — broader context.
* [Audit and undo](/agents/audit-and-undo) — what's undoable.
* [Rules and decisions](/agents/rules-and-decisions) — the mismatch rule group.
