Skip to content

Comments

feat: add MineRatings.ts and ReflectionCapture hook — learning pipeline#735

Closed
nbost130 wants to merge 2 commits intodanielmiessler:mainfrom
nbost130:feat/mine-ratings-v2
Closed

feat: add MineRatings.ts and ReflectionCapture hook — learning pipeline#735
nbost130 wants to merge 2 commits intodanielmiessler:mainfrom
nbost130:feat/mine-ratings-v2

Conversation

@nbost130
Copy link

@nbost130 nbost130 commented Feb 19, 2026

Summary

Two additions that complete the PAI learning feedback pipeline: automated rating mining and automated LEARN phase reflection capture.

1. Tools/MineRatings.ts — Rating Pattern Extraction

New Bun CLI tool that mines ratings.jsonl + failure captures for actionable behavioral patterns. Closes the feedback loop between rating capture and corrective action.

  • Reads implicit/explicit rating data captured by RatingCapture.hook.ts
  • Clusters ratings into low (1-4) and high (8-10) tiers
  • Uses Haiku inference to extract "STOP doing" and "DO MORE of" patterns
  • Auto-generates draft steering rules in Statement/Bad/Correct format
  • High-water-mark tracking — only analyzes NEW ratings since last run
bun MineRatings.ts              # Analyze only NEW ratings since last run
bun MineRatings.ts --all        # Analyze ALL ratings (ignore high-water-mark)
bun MineRatings.ts --dry-run    # Print stats only, no AI inference
bun MineRatings.ts --since 7    # Only analyze last 7 days

2. ReflectionCapture.hook.ts — Auto-Capture LEARN Reflections

New SessionEnd hook that scans transcripts for Algorithm LEARN phase content and writes structured JSONL to algorithm-reflections.jsonl, feeding MineReflections downstream analysis.

  • Extracts Q1 (Self), Q2 (Algorithm), Q3 (AI) reflection fields
  • Supports both **Q1 (Self):** and Q1 — Self: output formats
  • Deduplicates by session_id to prevent double writes on resumed sessions
  • Reads AlgorithmTracker state for criteria counts and effort level
  • Tested against real transcripts with verified extraction

Pipeline Flow

Session → RatingCapture (implicit/explicit) → ratings.jsonl → MineRatings.ts → steering rules
Session → LEARN phase → ReflectionCapture.hook → algorithm-reflections.jsonl → MineReflections

Test plan

  • MineRatings: --dry-run mode verified against real ratings data
  • ReflectionCapture: Extracted Q1/Q2/Q3 from real transcripts (2 LEARN blocks)
  • ReflectionCapture: Deduplication confirmed (second run with same session_id skips)
  • ReflectionCapture: Registered in settings.json SessionEnd hooks

🤖 Generated with Claude Code

nbost130 and others added 2 commits February 18, 2026 20:23
Reads implicit/explicit rating data from RatingCapture hook, clusters
low/high ratings, uses Haiku inference to extract actionable patterns,
and generates draft steering rules in Statement/Bad/Correct format.

Features:
- High-water-mark tracking (only analyzes new ratings by default)
- Draft steering rule auto-generation from patterns
- Failure capture enrichment for low ratings
- --all, --dry-run, --since N flags

Co-Authored-By: Claude <noreply@anthropic.com>
…tions

SessionEnd hook that scans transcripts for Algorithm LEARN phase content
(Q1/Q2/Q3 reflections and LEARNING line), writing structured JSONL to
algorithm-reflections.jsonl. Feeds MineReflections downstream analysis.

- Extracts Q1 (Self), Q2 (Algorithm), Q3 (AI) reflection fields
- Supports both "Q1 (Self):" and "Q1 — Self:" output formats
- Deduplicates by session_id to prevent double writes
- Reads AlgorithmTracker state for criteria counts and effort level
- Tested against real transcripts with verified extraction

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@nbost130 nbost130 changed the title feat: add MineRatings.ts — mine ratings for behavioral pattern extraction feat: add MineRatings.ts and ReflectionCapture hook — learning pipeline Feb 19, 2026
@nbost130 nbost130 closed this Feb 25, 2026
@nbost130 nbost130 deleted the feat/mine-ratings-v2 branch February 25, 2026 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant