Skip to content

fix(learning-readback): surface CONTEXT.md summaries instead of mangled dir slugs#1388

Open
dd-solving wants to merge 1 commit into
danielmiessler:mainfrom
dd-solving:fix/learning-readback-surface-context-summaries
Open

fix(learning-readback): surface CONTEXT.md summaries instead of mangled dir slugs#1388
dd-solving wants to merge 1 commit into
danielmiessler:mainfrom
dd-solving:fix/learning-readback-surface-context-summaries

Conversation

@dd-solving

Copy link
Copy Markdown

Problem

In Releases/v5.0.0/.claude/hooks/lib/learning-readback.ts, loadFailurePatterns() reads each failure capture's CONTEXT.md into content and 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:

[2026-06-15] userfrustrated analysis incomplete demanding comprehensive audit of all sub

while the discarded CONTEXT.md contains a clean **Summary:** one-liner that FailureCapture.ts wrote at capture time. Additionally, if one event is captured twice (two dirs, different slugs, identical summaries), both lines are injected.

Fix

  1. Prefer CONTEXT.md's **Summary:** line; fall back to the first line of ## What Happened; fall back to the de-slugged dir name (previous behavior).
  2. Truncate at a word boundary (~110 chars) with an ellipsis instead of a hard 70-char mid-word cut.
  3. Skip captures whose summary is already in the pattern list (dedupes double-fires).

Before / after (same capture)

before: [2026-06-15] userfrustrated analysis incomplete demanding comprehensive audit of all sub
after:  [2026-06-15] Frustrated — analysis incomplete, requesting comprehensive audit of all submissions

Behavior is unchanged when CONTEXT.md has 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

…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>
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