Skip to content

REM phase: write proposed-changes.md with skill patches#46

Merged
MichielDean merged 5 commits into
mainfrom
feat/ll-k3pro
May 11, 2026
Merged

REM phase: write proposed-changes.md with skill patches#46
MichielDean merged 5 commits into
mainfrom
feat/ll-k3pro

Conversation

@MichielDean
Copy link
Copy Markdown
Owner

Closes droplet ll-k3pro.

Lobsterdog Contributors 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
@MichielDean MichielDean merged commit 04196d3 into main May 11, 2026
0 of 4 checks passed
@MichielDean MichielDean deleted the feat/ll-k3pro branch May 11, 2026 09:57
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