Detect Patterns
Find recurring sequences, not preferences.
Read schemas in ../soulcatcher/reference.md.
Worked example: learned-skills/examples/pipeline-output/pattern-report.md
Input
- Set of BehavioralTrace artifacts (minimum 3 relevant sessions)
- Optional: problem_class filter from user
Process
- Group traces by
problem_class - For each group, extract ordered event sequences (generalize event descriptions to step labels)
- Find subsequences that repeat across sessions with stable order
- Score using confidence rules in reference.md
- Collect counterexamples (sessions where core steps were skipped)
- Rank patterns by confidence
Step Label Generalization
Convert literal events to reusable labels:
| Literal event | Step label |
|---|---|
| "Listed two candidate approaches" | generate_candidates |
| "Wrote pros and cons" | weigh_pros_cons |
| "Searched for failure cases" | search_counterexamples |
| "Identified strongest downside" | surface_strongest_downside |
| "Committed after risks explicit" | decide_after_risks_explicit |
Anti-Patterns (do not report)
- Single-session habits
- Tool or language preferences ("uses Python", "uses grep")
- Formatting or style quirks
- Steps that appear in different orders across sessions (unless marked optional)
Output Format
# PatternReport: {pattern_id}
```yaml
pattern_id: adversarial-decision-sequence
problem_class: decision-analysis
sequence:
- frame_decision
- generate_candidates
- weigh_pros_cons
- search_counterexamples
- surface_strongest_downside
- decide_after_risks_explicit
occurrences: 12
sessions_total: 15
sessions_matched:
- decision-analysis-01
- decision-analysis-02
# ...
confidence: 87
counterexamples:
- session_id: decision-analysis-13
deviation: Skipped counterexample search; decided on pros/cons alone
- session_id: decision-analysis-14
deviation: Committed before surfacing strongest downside
position_stability: high
context_diversity:
- product tradeoff
- architecture choice
- vendor selection
- hire decision
- research conclusion
## Handoff
Pass top PatternReport(s) to infer-procedure. If no pattern meets minimum threshold (3 sessions, confidence ≥ 60), report honestly and stop.