peepshow/ sinks/ mem0

Reel #21 Agent memory

peepshow sink / mem0

Mem0Distil every run into Mem0 long-term memory.

Mem0 turns the peepshow summary + frame list into retrievable, user-scoped memories.

What it does

Write peepshow runs to Mem0 so any agent wired into the same user's memory can recall specific clips by natural-language query. The sink sends a system summary plus one user message per frame; Mem0 handles the distillation.

When to reach for it

  • Multi-agent apps sharing a single user's memory across tool boundaries
  • Scope memory per agent or per app via `MEM0_AGENT_ID` / `MEM0_APP_ID`
  • Mix video memory with chat memory in the same Mem0 account

Install

npm i -g peepshow

Use it

MEM0_API_KEY=... \
MEM0_USER_ID=alice \
peepshow ./repro.mov --sink mem0

Make it automatic

Register the sink once — every run fires it afterward. Scope by --when so it only runs for matching videos.

peepshow sinks add mem0
peepshow sinks add mem0 --when extension=mp4,mov
peepshow sinks add mem0 --when path=/Volumes/Work/

Configuration

  • MEM0_API_KEY Mem0 cloud / self-hosted API key. required
  • MEM0_USER_ID User the memory is written for. required
  • MEM0_API_URL Override for self-hosted. Default `https://api.mem0.ai`.
  • MEM0_AGENT_ID Scope the memory to a specific agent.
  • MEM0_APP_ID Scope the memory to a specific app.

Use with an LLM agent

Every peepshow sink reads its config from env vars and receives a single JSON payload on stdin. An LLM agent (Claude Code, Cursor, Windsurf, Gemini, Codex) can drive the Mem0 sink automatically when three things are true:

  • the env vars below are exported in the agent's shell (or a project .env it can load),
  • the peepshow CLI is on PATH — install with npm i -g peepshow,
  • a peepshow auto-sink is registered for the run (optional but recommended — makes invocation zero-argument).

1. Set the environment

# Add to ~/.zshrc, ~/.bashrc, or a project .env the agent can load
export MEM0_API_KEY="..."
export MEM0_USER_ID="..."

2. Register as an auto-sink

peepshow sinks add mem0
peepshow sinks add mem0 --when extension=mp4,mov

3. Example LLM session

You → drop a .mov into Claude Code.

Claude → auto-invokes /peepshow:slides ./clip.mov. peepshow extracts frames + audio, the Mem0 sink forwards the run to the configured collection. Claude replies with a summary and a link to the created record.

The transcript text is a natural embedding target — index it next to the frames.

Write your own

A sink is any executable that reads the --emit json payload on stdin. Shell, Node, Python, Go — the spec's in docs/PLUGINS.md. Register persistent ones with peepshow sinks add-cmd 'your-command'.