find_invariants
Identify recurring assistant response patterns that remain consistent across varied user prompts by clustering response embeddings and scoring invariance.
Instructions
Find recurring assistant-side patterns that survive prompt variance.
Algorithm:
Pull recent assistant messages from dialog_messages (with embeddings).
Greedy cluster by response embedding cosine ≥ response_cohesion.
For each cluster (size ≥ min_cluster_size), find each response's immediately-preceding user prompt in the same conversation.
Score = avg_response_similarity × (1 - avg_prompt_similarity). High = my response stays the same shape while prompts vary widely.
Returns top_n clusters with sample response, scores, and counts. Requires semantic embeddings (sentence-transformers) — without them returns ERR.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| window_days | No | ||
| min_cluster_size | No | ||
| response_cohesion | No | ||
| top_n | No | ||
| max_messages | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |