feat(learning): close the feedback loop — rating-weighted readback & synthesis automation#966
Open
A13xSM wants to merge 1 commit intodanielmiessler:mainfrom
Open
Conversation
2079b3b to
34d6567
Compare
…ynthesis automation, effort-tier scaling The learning system captures extensively but reads back almost nothing useful at session start. This PR fixes the readback pipeline: - Fix loadLearningDigest: match both **Feedback:** and **Sentiment Summary:** patterns (dramatically improves hit rate), weight by rating (lowest = most informative), deduplicate - Fix loadFailurePatterns: read CONTEXT.md root cause analysis instead of directory slugs - Add loadSynthesisPatterns: read aggregated pattern reports from SYNTHESIS/ - Add synthesis automation: SessionEnd stale-check triggers LearningPatternSynthesis in background when >7 days or >50 new ratings since last run - Add learning-readback-cli.ts: CLI wrapper for Algorithm OBSERVE phase (Extended+) - Add effort-tier-aware learning enrichment to Algorithm v3.7.0 OBSERVE phase Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
34d6567 to
436faaf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PAI's learning system captures data aggressively but reads back almost nothing at session start. The readback pipeline has three critical issues:
loadLearningDigest()matches**Feedback:**which hits only a fraction of learning files. Most files use**Sentiment Summary:**insteadloadFailurePatterns()reads CONTEXT.md but only uses the directory slug, discarding the root cause analysisChanges
hooks/lib/learning-readback.tshooks/lib/learning-readback.tshooks/lib/learning-readback.tsloadSynthesisPatterns()reads Top Issues + Recommendationshooks/LoadContext.hook.tshooks/WorkCompletionLearning.hook.tshooks/lib/learning-readback-cli.ts--depth standard|extendedfor effort-tier-aware readbackPAI/Algorithm/v3.7.0.mdBefore / After
Before (session start context — directory slugs only):
After (session start context — root cause analysis + rating):
Plus synthesis patterns:
Test plan
bun run hooks/lib/learning-readback-cli.ts --depth standard— rating-weighted learnings, root cause failure analysisbun run hooks/lib/learning-readback-cli.ts --depth extended— more failures + learnings + synthesisbun run hooks/lib/learning-readback-cli.ts --synthesis— reads Top Issues + Recommendations from SYNTHESIS/bun run PAI/Tools/LearningPatternSynthesis.ts --month— bootstraps SYNTHESIS/ directory🤖 Generated with Claude Code