feat: add MEMORY.md cleanup phase to daily memory task#705
Merged
Conversation
After generating the daily summary, the task now reads MEMORY.md and uses AI to split it into persistent knowledge (stays) and session-specific detail (archived to daily file). This keeps MEMORY.md lean for context window budget. Safety measures: - Skips cleanup if MEMORY.md is under 8KB threshold - Parse validation prevents write if AI output lacks persistent section - Size ratio check aborts if new content is <10% of original - Cleanup failures are logged but don't fail the overall job - Phase 2 runs regardless of Phase 1 (DM activity) since most agent work happens via Kimaki sessions not tracked as DM jobs
Homeboy Results —
|
| 'datamachine_log', | ||
| 'warning', | ||
| 'Memory cleanup parse failed — no persistent section found. MEMORY.md unchanged.', | ||
| array( 'date' => $date, 'ai_output_length' => strlen( $ai_output ) ) |
There was a problem hiding this comment.
❌ phpcs WordPress.Arrays.ArrayDeclarationSpacing.AssociativeArrayFound
When a multi-item array uses associative keys, each value should start on a new line.
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
How It Works
Phase 2 runs regardless of Phase 1 results — most agent work happens via Kimaki sessions which don't create DM jobs, but MEMORY.md still grows.
Safety Measures
===PERSISTENT===delimiterBehavioral Change
Previously, when there was no DM activity (no jobs, no chat sessions), the task returned early and did nothing. Now it still runs the cleanup phase, which is the more valuable operation since most agent work is via Kimaki.