feat(memory): hindsight-wire compat mount on the REST surface (#414) - #423
Merged
Merged
Conversation
serve --hindsight-compat aliases the exact HTTP wire omp's
memory.backend:"hindsight" client speaks onto the existing memory
banks: PUT bank ensure, items[] retain, tag-filtered recall returning
{results:[{text}]}, and a reflect digest. Retain lands via the new
cursorless memory.RetainRaw (the hindsight wire has no
retained_through_user_turn, and Retain's 0-cursor gate would silently
drop every batch after the first). Additive alias only: the native
/api/v1/memory/* surface is unchanged and the compat routes 404
without the flag.
Closes #414.
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.
What
Implements #414: an opt-in
--hindsight-compatmount on the REST listener that speaks **omps Hindsight client wire byte-for-byte**, somemory.backend="hindsight"can point native agent memory at LeanKG with zero omp changes (thememory.backendenum is closed; thehindsight` arm takes a configurable base URL — we now serve its server side).PUT /v1/default/banks/{bank}→ 200 (ensure)POST .../memories→{items:[{content,timestamp,context,metadata,document_id,tags}]}retained into the bank JSONLPOST .../memories/recall→{results:[{text,id,type,tags,mentioned_at}]}with all/any tag filtering (page 8 = OMP recall limit)POST .../reflect→{text}digest of top recall rowsKey decisions
memory.RetainRaw: the hindsight retain wire has noretained_through_user_turn; routing throughRetainhits itsthroughUserTurn <= bankCursorgate and would silently drop every write after the first (0 <= 0).RetainRawshares Retain defaults, skips the cursor;TestRetainRawNoCursorpins the contrast./api/v1/memory/*untouched; compat 404s without--hindsight-compat(pinned). Documents/mental-models endpoints deliberately unmounted (the wiring disables mental models client-side).update_mode:"replace"treated as append (JSONL has no revision).Verification
go vet ./...+ fullgo test ./...green (54 pkgs); gofmt clean.hindsight/client.tsshapes (buildMemoryItem keys, the fields the client reads) against a scratchserve --rest :9799 --memory --hindsight-compat: bank ensure 200; 2-item retainwritten:2; second-batch retain lands (cursorless proof); ranked recall{results:[{text:…}]}; disjointtags_match:allexcludes; reflect{text}— all PASS.Harness wiring once merged:
memory.backend="hindsight",hindsight.apiUrl=http://127.0.0.1:<rest>,hindsight.mentalModelsEnabled=false.