claude-memory

claude-memory is a skill for Claude Code, Codex from mkupermann/throughline. It costs 81 tokens per session (1,215 once invoked), scanned A, original, MIT.

A skill for saving and retrieving long-term project context across Claude Code sessions using a local PostgreSQL database.

In plain words
What is it for?
Use it to look up remembered decisions, search similar conversations, retrieve project context, query stored memory, and access saved prompt templates.
Why use it?
It helps recover past decisions, conversations, project details, and reusable prompts instead of relying on the current session alone.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/mkupermann/throughline/skill
Any agent
npx skills add mkupermann/throughline --skill skill
Clone the repo
git clone --depth 1 https://github.com/mkupermann/throughline

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for claude-memory

README.md
[![agentmods](https://agentmods.dev/badge/skills/mkupermann/throughline/skill.svg)](https://agentmods.dev/skills/mkupermann/throughline/skill)
Your own site
<a href="https://agentmods.dev/skills/mkupermann/throughline/skill"><img src="https://agentmods.dev/badge/skills/mkupermann/throughline/skill.svg" alt="Measured on agentmods" height="20"></a>
Per session 81 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,215 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00081 $0.01215
Opus 5 $0.00041 $0.00607
Sonnet 5 $0.00016 $0.00243
Haiku 4.5 $0.00008 $0.00121

Measured today against content hash d7e462e7bc84, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

claude-memory scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.

The scan reads SKILL.md. This mod also ships 2 executable files (scripts/add.py, scripts/query.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skill/SKILL.md · 139 lines

How it starts

The opening of the file, as written. The whole thing — 139 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Claude Memory

Persistent long-term context for Claude Code sessions via a local PostgreSQL DB.

DB connection

Host: localhost:5432
Database: claude_memory
User: $PGUSER (defaults to the current OS user; trust auth, no password)

Python (via psycopg2):

import os, getpass, psycopg2
user = os.environ.get("PGUSER") or getpass.getuser()
conn = psycopg2.connect(host="localhost", port=5432, dbname="claude_memory", user=user)

SQL shell: psql -d claude_memory (use /opt/homebrew/opt/postgresql@16/bin/psql on macOS if $PATH is not set).

Tables

Table Purpose Columns
conversations Claude Code sessions id, session_id, project_name, model, started_at, message_count, summary
messages Individual messages conversation_id, role, content, tool_name, created_at
memory_chunks Extracted insights content, category, tags, confidence, project_name
skills Skill metadata name, description, path, triggers, use_count
projects Project context name, description, contacts JSONB, decisions JSONB
prompts Reusable templates name, category, content, tags

memory_chunks.category enum: decision | pattern | insight | preference | contact | error_solution | project_context | workflow

Workflows

1. Recall ("what do I know about X?")

psql -d claude_memory -c "
SELECT category::text, content, confidence, project_name, created_at
FROM memory_chunks
WHERE content ILIKE '%SEARCH_TERM%'
   OR 'SEARCH_TERM' = ANY(tags)
   OR project_name ILIKE '%SEARCH_TERM%'
ORDER BY confidence DESC, created_at DESC
LIMIT 20;
"

Use scripts/query.py for structured queries:

python3 ~/.claude/skills/claude-memory/scripts/query.py search "pgvector tuning"
python3 ~/.claude/skills/claude-memory/scripts/query.py project "Project Alpha"
python3 ~/.claude/skills/claude-memory/scripts/query.py contact "Jane Doe"
python3 ~/.claude/skills/claude-memory/scripts/query.py decisions
python3 ~/.claude/skills/claude-memory/scripts/query.py stats

Read the full file on GitHub · 139 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. today Changed · +2 lines d7e462e7bc84
  2. 4d ago First seen · 137 lines · 81 tokens per session scan A 22c5957317f7

Subscribe to this mod's changes

claude-memory is a skill published in the GitHub repository mkupermann/throughline (21 stars, last pushed today), licensed MIT. It adds 81 tokens to every session and 1,215 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.