# Catalog Audit & Enrichment

Sweep product catalog records for missing or weak fields, draft improved titles, descriptions, and attributes, and either write the fixes back directly or stage them for human approval.

## When to use

- A merchant's product feed has gaps: missing images, thin descriptions, blank attributes (size, material, color), or inconsistent categorization.
- Search or ads performance is suffering because product copy is generic or keyword-poor.
- A catalog needs a periodic health sweep after a bulk import or supplier feed update.

## Tools

- `http-get`
- `http-request`
- `browser-extract`
- `write-file`

## Playbook

1. Pull the current catalog page or export via `http-get` against the commerce platform's REST API (e.g. GET `https://api.storeplatform.com/v1/products?limit=100&page=1`). Auth is injected by the org's Integration row for this host — never ask for, echo, or hardcode credentials.
2. For each product record, check for gaps: missing description, missing images, blank attributes, missing SEO title/meta, or category mismatch.
3. When a product's own manufacturer or reference page has richer specs, use `browser-extract` on the public product URL to pull structured details (dimensions, materials, compatibility) to fill gaps.
4. Draft improved copy: a clearer title, a benefit-led description, and normalized attribute values, keeping tone consistent with existing catalog entries.
5. Write the audit findings and drafted copy to a staging file with `write-file` (e.g. `catalog-audit-2024-06.json`) so a human can review before anything goes live, unless the org has explicitly authorized direct writes for this feed.
6. If direct writes are authorized and the change is a low-risk field (description, image alt text, attribute value), apply it with `http-request` using PATCH (e.g. PATCH `https://api.storeplatform.com/v1/products/{id}`).
7. If the update involves a price change or a bulk operation above the org-set threshold, do not apply it — instead raise a `create-task` for human approval, describing the proposed change and its scope.
8. On 401/403 or a missing Integration for the commerce platform host, stop and message a human via `send-message` naming the service and the scopes needed.
9. Re-run the sweep on a schedule (or on demand after a feed import) to catch new gaps as inventory changes.

## Failure modes

- Treating a price or bulk catalog change as low-risk and applying it directly instead of routing it through `create-task` approval.
- Scraping a manufacturer page that blocks automated access, producing empty or malformed `browser-extract` results that get written as if verified.
- Overwriting existing attribute values with lower-quality drafted copy when the original was already accurate.
- Missing pagination on the initial `http-get` sweep, so only the first page of the catalog gets audited.

## Done when

- Every product in the target catalog range has been checked for the defined gap categories.
- All proposed changes are either applied (for authorized low-risk fields) or staged/escalated via `write-file` output or `create-task` for anything at or above the refund/price/bulk threshold.