Add validation pass to memory extraction prompt#466
Merged
Conversation
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>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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
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
🤖 Generated with Claude Code