agentleFS
mkupermannmkupermann/throughline/skill/SKILL.md

claude-memory

Skill0 starsChanged 14 days agoApache-2.0View on GitHub

Access the persistent memory database (PostgreSQL `claude_memory`) for long-term context across Claude Code sessions. Triggers on "what do I know about", "memory lookup", "recall", "memory db", "what did we decide about", "similar conversations", "lookup context", "/memory". Provides semantic search, SQL queries and the ability to add new insights.

4 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions4 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 4

    1. codebyalexx/claude-skills★ 0same name
    2. EmanueleNene/claude-skills★ 0same name
    3. hypone233/claude-skills★ 0same name
    4. TheWatcher01/skills★ 0same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

The file

We split this skill into the rules it gives an agent

3 rules. 0 are common, 2 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use scripts/query.py for structured queries:

    line 57
  2. Distinctive:

    When the user asks:

    line 102
  3. Distinctive:

    Run the ingestion scripts from wherever you cloned the repo (adjust path as needed):

    line 120

“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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

TablePurposeColumns
conversationsClaude Code sessionsid, session_id, project_name, model, started_at, message_count, summary
messagesIndividual messagesconversation_id, role, content, tool_name, created_at
memory_chunksExtracted insightscontent, category, tags, confidence, project_name
skillsSkill metadataname, description, path, triggers, use_count
projectsProject contextname, description, contacts JSONB, decisions JSONB
promptsReusable templatesname, 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

2. Add an insight

python3 ~/.claude/skills/claude-memory/scripts/add.py \
  --category decision \
  --content "We use pgvector instead of Milvus because of lower operational complexity" \
  --project claude-memory \
  --tags postgresql,pgvector,architecture \
  --confidence 0.9

Valid categories: decision, pattern, insight, preference, contact, error_solution, project_context, workflow

3. Find similar conversations

SELECT c.id, c.project_name, c.started_at, substring(m.content, 1, 200)
FROM conversations c
JOIN messages m ON m.conversation_id = c.id
WHERE m.content ILIKE '%SEARCH_TERM%'
ORDER BY c.started_at DESC
LIMIT 10;

4. Load project knowledge

SELECT category::text, content, tags, confidence
FROM memory_chunks
WHERE project_name = 'Project Alpha'
ORDER BY category, confidence DESC;

Typical queries during Claude Code sessions

When the user asks:

  • "What do I know about topic X?" -> search with ILIKE over content + tags
  • "Who is person Y?" -> filter by category=contact
  • "What did we decide about Z?" -> category=decision + ILIKE
  • "How did we solve problem A?" -> category=error_solution
  • "Any patterns for B?" -> category=pattern
  • "User preferences?" -> category=preference

Scripts

ScriptPurpose
scripts/query.pyStructured queries (search, project, contact, decisions, stats)
scripts/add.pyAdd a new memory chunk

DB maintenance

Run the ingestion scripts from wherever you cloned the repo (adjust path as needed):

# Ingestion scripts (in the claude-memory repo)
python3 /path/to/claude-memory/scripts/ingest_sessions.py
python3 /path/to/claude-memory/scripts/scan_skills.py
python3 /path/to/claude-memory/scripts/extract_memory.py

# Open the web UI
throughline serve  # -> http://127.0.0.1:8787

Best practices

  • Set confidence deliberately: 0.9+ for clear facts, 0.7-0.8 for interpretations, avoid anything under 0.5
  • Keep tags low-cardinality: e.g. postgresql, migration rather than full sentences
  • Use the project field: enables project-specific filters
  • Avoid duplicates: search first before adding
  • Pick categories carefully: one chunk = one category

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.