REM phase: write proposed-changes.md with skill patches#46
Merged
Conversation
added 5 commits
May 11, 2026 03:53
- Add paths.GetProposedChangesPath() mirroring GetDreamDiaryPath() - Add DreamerConfig.ProposedChangesPath + Dreamer.proposedChangesPath struct field - Add config.DreamConfig.ProposedChangesPath with yaml tag and mapping - Implement WriteProposedChanges method on Dreamer (append-only, mutex-protected) - Implement buildSkillPatchPrompt for LLM-generated [SKILL PATCH] sections - Extend Run() to call WriteProposedChanges after WriteDiary when REM has insights - Extend extractBehavioralInsights to add proposed_changes_link metadata to procedure memories - Add fallback skill patch content when LLM is unavailable - Add all 10 required tests for proposed-changes functionality
1. Remove O(N) redundant DB queries in WriteProposedChanges by carrying categorySamples on BehavioralInsight struct (populated in extractBehavioralInsights). WriteProposedChanges now uses insight.Samples instead of re-querying the DB for each insight. 2. Fix parseLLMDirectiveResponse fallback using string literal 'category' instead of the actual category name. Added category parameter so the fallback correctly uses e.g. 'ERROR_HANDLING' instead of literal 'category'. 3. Fix silently discarded d.store.Search error in WriteProposedChanges by removing the redundant query entirely (issue 1 fix eliminates the problem at the source). The only Search for self_assessments is now in extractBehavioralInsights where errors ARE logged. Added tests: - TestParseLLMDirectiveResponse_FallbackUsesCategory - TestParseLLMDirectiveResponse_ExtractsDoLines - TestDreamer_RemPhase_BehavioralInsight_SamplesPopulated - TestDreamer_WriteProposedChanges_UsesSamplesFromInsight
…fy:** markdown format The parseLLMDirectiveResponse function could not extract Verify content from the **Verify:** markdown bold format because extractAfterColon looks for ': ' (colon-space), but **Verify:** has the colon followed by '**' not a space. Fix: Strip ** markers before extracting content after colon, so '**Verify:** Run tests' becomes 'Verify: Run tests' which extractAfterColon can parse. Also handle Verify on a separate line after the header. Also removed the dead-code else-if branch (lines 1008-1011) that had an empty body and was intended to capture verify content but did nothing. Added table-driven test TestParseLLMDirectiveResponse_ExtractsVerifyFromBoldFormat covering bold/inline, plain/colon-space, combined bold Do+Verify, and Verify on own line after header. Updated TestParseLLMDirectiveResponse_ExtractsDoLines to assert the actual Verify content is extracted (not just that verifyLine is non-empty).
…Clone+Update pattern - Add ctx context.Context parameter to WriteProposedChanges, propagate to all context.WithTimeout calls instead of context.Background(). This enables cancellation on shutdown (reviewer issue ll-k3pro-ak7mo). - Include proposed_changes_link in initial AddParams metadata instead of using separate Get+Clone+Update pattern, eliminating 3 redundant DB ops per insight and the silent error path (reviewer issue ll-k3pro-dw4du). - Remove unused 'maps' import after eliminating maps.Clone. - Update all test calls to pass context.Background(). - Add TestDreamer_WriteProposedChanges_AcceptsContext contract test.
…eam docs - CONFIGURATION.md: Add proposed_changes_path to config.yaml reference, remove from unwired-fields list (now wired in Go CLI) - DREAM.md: Update REM phase description (skill patches, proposed-changes.md append-only output, proposed_changes_link metadata), add ProposedChangesPath to DreamerConfig table and code example, add Samples field to BehavioralInsight struct, add WriteProposedChanges to Go API section - CLI.md: Update llmem dream REM phase description with proposed-changes.md output details
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.
Closes droplet ll-k3pro.