Open Source Tool

prism-mem

Every coding session leaves behind artifacts. Prism reads them and turns them into structured, reusable knowledge. Automatically.

View on GitHub
v0.1.5 on PyPIMIT LicensePython 3.13+
Demo

See it in action

The Problem

The problem with manual context files

Session 1

You write CLAUDE.md. Tech stack, decisions, conventions. It is accurate.

Session 3

You migrated from SQLite to PostgreSQL. You forgot to update CLAUDE.md.

Session 5

The agent confidently uses SQLite APIs. Because that is what the context file says.

Results

Real numbers from a 3-session demo

35x
compression ratio
700
triples extracted
45.7%
auto-detected as stale
416
cross-session links

411,463 bytes of raw Claude Code transcripts condensed to 11,707 characters of structured, queryable knowledge

Pipeline

How it works

1

Ingest

Reads Claude Code session transcripts from ~/.claude/projects/ and the git diff after every commit.

2

Extract

kg-gen passes the combined text through an LLM and returns (subject, predicate, object) triples.

3

Store + Link

Triples are embedded locally with sentence-transformers, stored in SQLite, and linked by cosine similarity. Facts that contradict newer ones are marked stale automatically.

4

Generate

The top 30 triples by recency and confidence score go to your configured LLM. CLAUDE.md, .cursorrules, and AGENTS.md are rewritten in place.

Key Feature

Automatic staleness detection

No config. No prompt. No manual update. Prism detected the migration automatically.

After session 1
(snap-url) [uses] (SQLite) ← active
After session 3 (PostgreSQL migration)
(snap-url) [uses] (SQLite) ← stale, auto-detected
(snap-url) [uses] (PostgreSQL) ← active
(snap-url) [uses] (Redis) ← active
Setup

Get started in 3 commands

1. Install

pip install prism-mem

2. Configure your LLM provider

prism config set provider anthropic
prism config set model claude-haiku-4-5-20251001
prism config set api-key <your-api-key>

3. Install the post-commit hook. Runs in the background after every commit.

prism hook install --project .
Integrations

Works with Claude Code, Cursor, and Codex

Claude Codeterminal
claude mcp add prism -- \
  prism serve --project /path/to/project
Cursor.cursor/mcp.json
{
  "mcpServers": {
    "prism": {
      "command": "prism",
      "args": [
        "serve",
        "--project",
        "/path/to/project"
      ]
    }
  }
}
Codexagents.json
{
  "mcpServers": {
    "prism": {
      "command": "prism",
      "args": [
        "serve",
        "--project",
        "/path/to/project"
      ]
    }
  }
}