Skip to content

Add validation pass to memory extraction prompt#466

Merged
rjroy merged 1 commit intomainfrom
feat/review-memory-9w8jm
Feb 6, 2026
Merged

Add validation pass to memory extraction prompt#466
rjroy merged 1 commit intomainfrom
feat/review-memory-9w8jm

Conversation

@rjroy
Copy link
Copy Markdown
Owner

@rjroy rjroy commented Feb 6, 2026

Summary

  • Added a verification step (step 6) to the extraction process: after writing the memory file, the model re-reads it and validates against a 6-point checklist
  • Sharpened merge behavior with tactical vs. durable distinction, "distill don't accumulate" rule, and people entry guidelines
  • Validation checklist uses an additive test ("what does this add?") instead of a behavior-change test ("would AI respond differently?"), flipping the default from keep to cut

The core problem: the extraction prompt said the right things about brevity but didn't enforce them. Haiku is loss-averse and accumulated tactical status, duplicate entries, and coaching journals instead of distilling durable facts. The validation pass forces a second look, and the additive framing gives the model permission to prune aggressively.

Tested by running the new prompt against the current memory.md via sub-agent: 137 lines reduced to 79 with no loss of actionable context.

Test plan

  • Existing fact-extractor tests pass (18/18)
  • Pre-commit hooks pass (typecheck, lint, unit tests, build)
  • Monitor next scheduled extraction run (3:00 AM) for output quality

🤖 Generated with Claude Code

The extraction prompt produced overwrought memory files because it lacked
a verification step and its merge guidance was too permissive. Tactical
status updates, duplicate entries, and coaching journals accumulated
instead of being distilled into durable facts.

Three changes to the extraction prompt in buildExtractionPrompt():

1. Added validation step (Process step 6): after writing the memory file,
   the model re-reads it and runs a 6-point checklist. Catches what the
   first pass misses.

2. Sharpened merge behavior: added "distill, don't accumulate" rule,
   tactical vs. durable distinction with examples, and people entry
   guidelines (name + role + working style, not task assignments).

3. Added validation checklist with concrete criteria: additive test
   (entry must earn its place vs. rest of file), no duplicates, no
   tactical status, compression check, people check, proportionality.

The additive test flips the default from "keep unless you can justify
cutting" to "cut unless the entry adds something the rest of the file
doesn't already provide." This matters for Haiku, which is loss-averse
and will otherwise accumulate rather than prune.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@rjroy rjroy merged commit 8ea2c2e into main Feb 6, 2026
1 check passed
@rjroy rjroy deleted the feat/review-memory-9w8jm branch February 6, 2026 20:43
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@rjroy rjroy mentioned this pull request Feb 6, 2026
2 tasks
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