feat: mirror reflection slice rows into the daily memory journal#943
Draft
gorkem2020 wants to merge 4 commits into
Draft
feat: mirror reflection slice rows into the daily memory journal#943gorkem2020 wants to merge 4 commits into
gorkem2020 wants to merge 4 commits into
Conversation
…Mirror storeReflectionToLanceDB gains an optional onPersisted(entry, kind) hook, fired after each event/item-invariant/item-derived row is stored (the combined-legacy row is intentionally excluded, matching the task's scoped target types). Failures in the callback are swallowed so a mirror bug can never abort reflection persistence, matching the existing SmartExtractor onPersisted convention. index.ts wires mdMirror through this hook with source labels reflection-slice:event / :invariant / :derived. The event row's multi-line key=value text collapses to one line for free via createMdMirrorWriter's existing newline-to-space formatting, so no changes were needed there.
gorkem2020
force-pushed
the
feat/mirror-reflection-slices
branch
from
July 18, 2026 15:53
9563030 to
0a511d1
Compare
…irror The memory-reflection-event row is bookkeeping (its text is a kv stamp); the daily journal already records each run via its 'Reflection generated' line, so mirroring the stamp only produced content-less journal entries.
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.
The mdMirror daily journal (
memory/<date>.md) mirrors writer-1 reflection mapped rows, smart-extraction rows, and manualmemory_storerows, but not the reflection writer-2 slice rows (storeReflectionToLanceDB's event / invariant / derived rows). Those rows entered the database invisibly; the daily file only got the "Reflection generated:<path>" pointer line. This PR closes that gap so every row that enters the database is observable in the daily file without CLI tools.storeReflectionToLanceDB(src/reflection-store.ts) gains an optionalonPersisted(entry, kind)hook, fired after eachevent/item-invariant/item-derivedrow is stored. Thecombined-legacyrow is intentionally excluded since it is out of scope for this change (it is a distinct legacy row type, not one of the writer-2 slice rows this PR targets).SmartExtractor.notifyPersistedconvention for the same kind of hook.index.tswiresmdMirrorthrough this hook with source labelsreflection-slice:event,reflection-slice:invariant, andreflection-slice:derived.key=valueblock. It renders as one line for free, becausecreateMdMirrorWriter's existing line formatter already replaces\nwith a space before appending to the daily file - no changes were needed there.Test plan
test/memory-reflection.test.mjsassertingonPersistedfires for event/invariant/derived rows, is skipped for the legacy row, does not break storage when absent, does not abort remaining stores if it throws, and that the event row's multi-line text collapses to one line under the existing mirror formatting contract. All five failed before the implementation and pass after.npm run build(tsc) clean.npm testchain green (one test skipped: a known host-side port 11434 conflict unrelated to this change).Notes for reviewers
While working on this I found that
test/memory-reflection.test.mjsitself (the file with the most direct coverage ofstoreReflectionToLanceDB) is not wired into eitherpackage.json'stestscript orscripts/ci-test-manifest.mjson master, and separately has four pre-existing failing tests unrelated to this change. Both are out of scope here and are called out separately rather than folded into this PR.