Skip to content

Restore episodic Range filters (#40) + SDK client wrappers + docs for all new RPCs - #54

Merged
mkorbi merged 4 commits into
mainfrom
feat/docs-and-sdk-wrappers
Jul 20, 2026
Merged

Restore episodic Range filters (#40) + SDK client wrappers + docs for all new RPCs#54
mkorbi merged 4 commits into
mainfrom
feat/docs-and-sdk-wrappers

Conversation

@mkorbi

@mkorbi mkorbi commented Jul 19, 2026

Copy link
Copy Markdown
Member

Brings the SDKs and docs up to date with the episodic lifecycle work and the enumerate/discovery parity RPCs — and restores a feature that was lost from main.

⚠️ Restores #40 (episodic Range filters)

While auditing docs I found the session_id/role/type Range predicates + migration 0005 were missing from main: PR #49 (which closed #40) was merged into the stacked #48 branch, but that content didn't reach main when #48 landed. This PR cherry-picks the original, verified #40 commit back onto main (proto tags 9/10/11 preserved for wire compatibility). Re-verified: buf, go vet, go test -race, golangci-lint all clean; conformance passes on memory + real Postgres.

SDK client wrappers (Python + TypeScript)

The generated stubs were stale (no episodic Expire, kv MultiGet, artifact/lease List, admin) and neither client wrapped them. Regenerated both SDKs' stubs (adds the admin package) and added idiomatic wrappers:

  • kv: multiGet / multi_get; scan gains startAfter keyset cursor.
  • episodic: append gains dedupKey/supersedes/source; range gains includeDeleted + sessionId/role/type; new expire.
  • artifact: list; lease: list.
  • New admin sub-client (m.admin.list_namespaces / m.admin.listNamespaces).
  • Python verified (import + request construction against the regenerated descriptors); TS verified (tsc typecheck + build + offline smoke tests).

Docs (website/docs)

Every new RPC/field/op documented: the episodic, kv, artifact, lease block pages (API, drivers, gRPC + Python examples, op tables), a new Admin page + sidebar/nav entry, and the Python SDK client page. Docusaurus build is clean (no broken links / MDX errors).

Closes #40 (again 😅) and finishes documenting #39/#41.

mkorbi and others added 4 commits July 19, 2026 22:17
Reconstructing one conversation (Zep get_session_messages, Letta recall) is a
core recall primitive. R2 made role/session_id first-class Event fields, but
Range only windowed by cursor/timestamp — so "get all messages for session X"
forced an O(namespace) transfer for O(session) data that policy caps couldn't
bound.

- RangeRequest / RangeOptions gain session_id, role, and type equality
  predicates. Each is independent (empty = no filter) and ANDs with the other
  predicates and with the cursor/time window. Additive proto tags; gen/
  regenerated via buf.
- Postgres appends the predicates to the Range WHERE clause; migration 0005 adds
  a partial (namespace, session_id, cursor) index (WHERE session_id <> '') so the
  session-reconstruction path is index-backed and rows with no session stay out
  of the index. Memory filters in its existing scan.
- Conformance (both harnesses) covers each predicate alone, their AND
  combination, ANDing with the cursor window, empty = no filter, and no-match.
  buf lint/format, go vet, golangci-lint, go test -race all clean; verified on
  memory and a real Postgres.

Composes with the write-path parity work (#39); stacked on that branch.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The Python SDK stubs were stale (no episodic Expire, kv MultiGet, artifact/lease
List, admin) and the client had no wrappers for them. Regenerate all *_pb2 /
*_pb2_grpc from the current proto (adds the admin package) and add idiomatic
wrappers:

- kv.multi_get(namespace, keys); kv.scan gains start_after (keyset cursor).
- episodic.append gains dedup_key / supersedes / source; episodic.range gains
  include_deleted + session_id / role / type filters; new episodic.expire.
- artifact.list (metadata filter + start_after cursor); lease.list.
- New m.admin sub-client with list_namespaces.
- Makefile proto-python now touches the graph + admin package __init__.py too.

Verified: SDK imports, the new stub messages/fields exist, and every wrapper's
request object constructs against the regenerated descriptors.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Mirror the Python SDK additions in the TS client and regenerate the protobuf-es
stubs from the current proto (adds the admin package).

- kv.multiGet(namespace, keys); kv.scan gains a startAfter keyset cursor.
- episodic.append gains dedupKey / supersedes / source; episodic.range gains
  includeDeleted + sessionId / role / type filters; new episodic.expire (its
  ExpireAction is re-exported as EpisodicExpireAction to avoid colliding with
  the semantic one).
- artifact.list (metadata filter + startAfter cursor); lease.list.
- New m.admin client with listNamespaces; admin message types re-exported.

Verified: tsc typecheck + build clean and the offline smoke tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Bring website/docs current with the episodic lifecycle/filter work and the
enumerate/discovery parity RPCs.

- episodic: Expire, dedup_key, supersedes/source, include_deleted, and the
  session_id/role/type Range filters — API, drivers, gRPC + Python examples,
  and the episodic.expire op.
- kv: MultiGet, Scan start_after keyset cursor, KVItem.content_type on
  Scan/MultiGet, and the postgres COLLATE "C" note.
- artifact: List (metadata filter + start_after cursor) + artifact.list op.
- lease: List + lease.list op.
- New Building blocks → Admin page (ListNamespaces, admin.inspect,
  has_count semantics) + sidebar entry + intro/grpc reflection listing.
- Python SDK client page: new methods per block and an Admin section.

Docusaurus build is clean (no broken links / MDX errors).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mkorbi
mkorbi merged commit 8b81c5c into main Jul 20, 2026
3 checks passed
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.

feat(episodic): session_id/role/type predicate on Range

1 participant