# Postgres (rolled by hand)

Postgres (rolled by hand) is a memory option for building AI agents. A messages table and a summaries table. Boring, auditable, yours.

## Facts

- Layer: Memory (What it knows)
- Vendor: PostgreSQL
- Licence: open source
- Pricing: open source
- Self-hostable: yes
- Docs: https://www.postgresql.org/
- Last verified: 2026-08-21

## When to reach for it

- You are choosing a memory component — what it knows.
- You need to run it on your own infrastructure, or your procurement process requires source access.
- You want to start without a commercial conversation.

## Worth knowing

Start here. Move to a memory product when you can name the query it makes fast.

## Alternatives in the memory layer

| Option | What it does | Licence | Self-host |
| --- | --- | --- | --- |
| Mem0 | Extracts durable facts from conversations and recalls them on the next turn. | open source | yes |
| Zep | Temporal knowledge graph memory — facts with validity windows, not just embeddings. | open source | yes |
| Honcho | Treats memory as a reasoning problem, not a retrieval one — you ask its Dialectic API a question about the user and get a synthesised answer. | open source | yes |
| Supermemory | Memory graph plus automatic user profiles, with connectors that sync from Drive, Gmail, Notion and GitHub. | proprietary | no |
| LangMem | Memory primitives that plug straight into LangGraph checkpoints. | open source | yes |
| Cognee | Builds a graph + vector memory layer over your agent's history and documents. | open source | yes |

Head to head:

- https://newagent.build/compare/postgres-memory-vs-mem0
- https://newagent.build/compare/postgres-memory-vs-zep
- https://newagent.build/compare/postgres-memory-vs-honcho
- https://newagent.build/compare/postgres-memory-vs-supermemory
- https://newagent.build/compare/postgres-memory-vs-langmem
- https://newagent.build/compare/postgres-memory-vs-cognee

## Curated stacks using it

- Weekend prototype: Smallest thing that is still honest. Local, cheap, no accounts beyond one model key.
- Regulated / on-prem: Nothing leaves the estate. Every component runs on infrastructure you control.

## Add it to a stack

```bash
curl -fsSL "https://newagent.build/api/stack?memory=postgres-memory&format=sh" | sh
```

## Machine interfaces

- `GET https://newagent.build/api/registry` — every component as JSON
- `GET https://newagent.build/api/vendors` — vendors, with the repo and releases feed to watch
- `GET https://newagent.build/api/advise?q=<plain english>` — recommended stack for a description
- `GET https://newagent.build/api/stack?<layer>=<id>&format=sh|json|md|yml|agents|env` — a stack as files
- `GET https://newagent.build/llms.txt` — the whole registry in one fetch

Any page here also returns markdown if you send `Accept: text/markdown`.