fix(learning-readback): surface CONTEXT.md summaries instead of mangled dir slugs#1388
Open
dd-solving wants to merge 1 commit into
Open
Conversation
…ed dir slugs loadFailurePatterns() read each failure's CONTEXT.md into memory and then discarded it, injecting the de-slugified directory name instead — hard-cut at 70 chars with no word boundary. Session starts received garbled, low-signal lines while the clean human-readable Summary line written by FailureCapture sat unused in the file it had just read. - Prefer CONTEXT.md's **Summary:** line; fall back to the first line of '## What Happened'; fall back to the de-slugged dir name. - Truncate at a word boundary (~110 chars) with ellipsis. - Dedupe captures whose summaries are identical (double-fires produce two dirs for one event). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Problem
In
Releases/v5.0.0/.claude/hooks/lib/learning-readback.ts,loadFailurePatterns()reads each failure capture'sCONTEXT.mdintocontentand then never uses it — it injects the de-slugified directory name instead, hard-truncated at 70 characters with no word boundary. Every session start gets garbled lines like:while the discarded
CONTEXT.mdcontains a clean**Summary:**one-liner thatFailureCapture.tswrote at capture time. Additionally, if one event is captured twice (two dirs, different slugs, identical summaries), both lines are injected.Fix
CONTEXT.md's**Summary:**line; fall back to the first line of## What Happened; fall back to the de-slugged dir name (previous behavior).Before / after (same capture)
Behavior is unchanged when
CONTEXT.mdhas no Summary/What-Happened sections — the slug fallback path is preserved.Related (not in this PR)
loadLearningDigest()has the same discard pattern — it keeps an 80-char**Feedback:**stub and drops the Context paragraph. Happy to follow up with the same treatment if wanted.🤖 Generated with Claude Code