# Theme clustering

A reusable skill the "Synthesize the week's feedback into themes" recipe pulls in. Add it once and every agent on the team can use it.

Group raw feedback messages into named, topic-based themes instead of leaving them as an unsorted list.

## Method
1. Collect every raw feedback item pulled this run from slack, zendesk, and intercom.
2. Read each item and identify the underlying topic, not just the surface keyword — two messages using different words can be the same theme.
3. Group items into named themes; use a short, specific theme name (e.g. "CSV export missing columns", not "exports").
4. Check existing theme names in memory before creating a new one; reuse an existing name if the topic matches.
5. Count distinct customers per theme, not raw message count — one customer posting five times is one vote.
6. Merge near-duplicate themes; split a theme that actually covers two distinct topics.
7. Store the final theme list with customer counts for this run.

## Rules
- A theme needs at least (set on first run, then stored in memory) distinct customers to surface in the digest.
- Never invent a theme from a single ambiguous message — leave it unclustered instead.
- Theme names stay stable across weeks; renaming a theme requires a deliberate merge decision, not a fresh label each run.
- Keep the split between "feedback channel" and "support issue" as defined on first run.

## Output
A list of themes, each with: theme name, distinct customer count, and the list of source message/ticket IDs it was built from.
