feat: raw-text observe, identity provenance, knowledge-graph service - #5
Merged
Merged
Conversation
Parity with @memmesh/sdk v0.9.0 (thinkfleet-memory-sdk#21). Go was the
furthest behind of the five SDKs — it had no raw-text observe at all.
Observe now takes Text and routes it to /memory/observe, the engine's
extraction pipeline, returning what it kept:
res, _ := c.Memory.Observe(ctx, memmesh.Observe{
Text: "I just moved to Denver.", UserID: "u1", SessionID: "t1",
})
CandidateCount is what extraction proposed; Saved is what survived dedupe
and the token budget. Filler comes back with an empty Saved — success, not
an error. UserID / AgentID / SessionID are provenance, omitted when unset,
and are NOT a tenancy boundary.
The legacy Content path still posts verbatim to /admin/memory, wrapped in
the same response so callers don't branch on which path ran.
New c.Graph — Stats, ListEntities, GetEntity, ListEdges, Traverse. Edges
decode as GraphTraversalEdge: Subject and Object are hydrated entities,
not ids, plus a Hop counter. The raw memory_edge row is not modelled
because no read route returns it — assuming otherwise broke the Rust port
outright.
Prefer Graph.Stats over len(ListEntities(..)) for size questions; the list
routes page, so their length is the page size (1000 vs an actual 12142).
BREAKING: Observe returns *ObserveResponse, was *MemoryItem. The old
return is now res.Saved[0] on the Content path.
Verified live against app.memmesh.ai — 12142 entities / 287698 edges,
decoding NVIDIA CORP -[reported_metric]-> Cost of Revenue. 12 new tests.
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.
Go parity with
@memmesh/sdkv0.9.0 — seethinkfleet-memory-sdk#21.
Go was the furthest behind of the five SDKs: it had no raw-text
Observeatall, only the legacy verbatim path posting to
/admin/memory.Observereaches the engineSet
Textand the raw turn goes to/memory/observe— extract → dedupe → graph→ embed — and comes back with what survived.
CandidateCountis what extractionproposed;
Savedis what was kept. Filler returns an emptySaved, which isthe engine working, not an error.
UserID/AgentID/SessionIDare forwarded, omitted when unset. Provenance,not a tenancy boundary — search filters
chatIdentityId IS NULL OR = $1,permissive by design.
The legacy
Contentpath still posts verbatim to/admin/memory, wrapped in thesame response shape so callers don't branch on which path ran.
New:
c.GraphStats(ctx)GET /admin/memory/graph/statsListEntities(ctx, params)GET /admin/memory/entitiesGetEntity(ctx, id, asOf)GET /admin/memory/entities/:idListEdges(ctx, asOf, limit)GET /admin/memory/graph/edgesTraverse(ctx, id, params)POST /admin/memory/graph/traverseUse
Stats, notlen(ListEntities(..))for any "how big is it" question.The list routes page, so their length is the page size — against a real project,
1,000 vs the actual 12,142.
Edges come back hydrated
ListEdges,Traverse, andGetEntity().EdgesreturnGraphTraversalEdge:SubjectandObjectare full entities, not ids, plus aHopcounter. Theraw
memory_edgerow is deliberately not modelled — no read route returns it,and assuming otherwise broke the Rust port outright with
missing field 'subjectId'.Hopis 0 fromListEdges(no seed) and 1-indexed fromTraverse.Breaking
Observereturns*ObserveResponse, was*MemoryItem. On the legacyContentpath the old value is now
res.Saved[0]. This matches the same change alreadymade in the TypeScript, Python, Rust, and .NET SDKs.
Verification
go build,go vet, andgo test ./...clean; 12 new tests coveringroute + body shaping, filter omission, query escaping, the hydrated and
literal-object edge shapes, and legacy-path compatibility.
app.memmesh.ai: 12,142 entities / 287,698 edges,decoding
NVIDIA CORP -[reported_metric]-> Cost of RevenueandNVIDIA CORP -[ticker_symbol]-> NVDA.Note
This branch is cut from
origin/mainand does not include the separateuncommitted work sitting in the local checkout (
brains.go,consent.go,financial.go,pagination.go, and their tests).mainbuilds fine withoutit, so I left it alone rather than folding someone else's staged work into this
PR — but it is worth landing on its own.