Recipes
Six patterns that show what PerSQL is for. Each is ≤20 lines of code and works
against new PerSQL({ local: ":memory:" }) or a real psql_live_… token.
| Recipe | When you reach for it |
|---|---|
| Per-agent sandbox | Every agent run gets a fresh DB or branch. Idempotent, auto-deletes. |
| Agent memory | Durable, queryable memory in plain SQL — facts, working scratch, episodes. Keyword recall, no vector DB. |
| Sub-agent handoff | Delegate a scoped, single-use token to a sub-agent. |
| Cost-aware loop | Self-throttle on meta.costUsd instead of a usage endpoint. |
| PR-preview DB | Idempotent branch per pull request, auto-clean. |
| MCP quickstart | Add PerSQL to Claude Desktop / Cursor in 30 seconds. |
Each recipe ends with a one-line “next step” — usually db.describe(),
db.search(), or db.doctor() — so you can keep building without leaving
the agent loop.