Skip to content

Add agent memory example for hybrid context retrieval - #1

Open
CalebKiragu wants to merge 1 commit into
Evokoa:masterfrom
DataYetu:feature/agent-memory-example
Open

Add agent memory example for hybrid context retrieval#1
CalebKiragu wants to merge 1 commit into
Evokoa:masterfrom
DataYetu:feature/agent-memory-example

Conversation

@CalebKiragu

Copy link
Copy Markdown

Summary

  • Add a runnable agent-memory SQL example over ordinary Postgres tables (users, sessions, decisions) with filtered dense search, hybrid retrieval (pgcontext.query), and a hydrated context pack for LLM prompts.
  • Add scripts/quickstart.sh agent-memory, playground script, and user guide so the hosted Memory demo story is reproducible from the OSS checkout.

Motivation

Polygres markets Postgres-as-agent-memory, but the open-source quickstart did not yet show how to model durable decision memory or run hybrid retrieval locally. This closes that adoption gap without touching extension internals.

Implementation

  • examples/sql/06_agent_memory.sql — full walkthrough with 4-D fixture embeddings
  • playground/agent_memory.sql — Docker-friendly demo with stage output
  • docs/user_guide/agent_memory.md — schema, walkthrough, optional GraphRAG appendix
  • scripts/quickstart.sh agent-memory — one-command local run

Benefits

  • Developers can reproduce the Memory demo in ~5 minutes with Docker only
  • Shows the product thesis in SQL: rows + embeddings + scoped filters = queryable agent memory
  • Low-risk docs/example PR; no Rust or HNSW changes

Tradeoffs

  • Uses fixture vectors, not a live embedding model (documented explicitly)
  • GraphRAG composition is documented as optional appendix, not a fused API

Testing

docker run -d --name pgcontext-review \
  -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=pgcontext \
  -p 5433:5432 ghcr.io/evokoa/pgcontext:pg17-v0.2.0

PGPASSWORD=postgres psql -h 127.0.0.1 -p 5433 -U postgres -d pgcontext \
  -f playground/agent_memory.sql

Verified locally: filtered billing search returns d-billing-refund; hybrid search ranks billing decision first; context pack hydrates summary + session topic.

python3 scripts/check-public-docs.py --check

Future work

  • Companion SDK example in Evokoa/polygres-sdk (separate PR)
  • Dual-extension Compose playground when graph-augmented retrieval APIs land

Made with Cursor

Make the hosted Memory demo reproducible from the OSS checkout with a
runnable SQL walkthrough, quickstart mode, and user guide for durable
agent decision memory over ordinary Postgres tables.

Co-authored-by: Cursor <cursoragent@cursor.com>
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