Documentation · v1.0

LawdMemory Docs

The complete reference for building persistent memory into your AI engineering workflow. From first install to self-hosted production deployments.

Overview

Introduction

LawdMemory is a persistent memory layer for AI engineering teams. It ingests your repositories, PRs, incidents, and decisions, builds a temporal knowledge graph, and exposes it to AI agents via a simple API.

Use it to give Claude, Copilot, Cursor, or any custom agent actual memory of why your architecture looks the way it does — across sessions, sprints, and team members.

Memory Graph

Every commit, incident, and decision becomes a queryable node.

AI-Native

MCP-compatible. Works with Claude, GPT, and custom agents.

Self-hostable

MIT-licensed. Run on your infra or our managed cloud.

5-minute install

Quick Start

Get a working memory graph from your first repo in under 5 minutes.

1. Install the CLI

terminal
npm install -g @lawdmemory/cli
# or use npx — no install required
npx create-lawdmemory@latest --org your-team

2. Authenticate

LawdMemory uses keypair-based identity. The CLI generates a DID for you on first run:

terminal
lawdmemory auth init

▸ generating Ed25519 keypair...
✓ identity created: did:key:z6MkpTHR8VNs...
✓ stored in ~/.lawdmemory/identity.json

3. Connect your first repo

terminal
lawdmemory connect github \
    --org acme-corp \
    --repo backend \
    --history 365d

▸ scanning 14,328 commits...
▸ extracting decisions from 482 PRs...
▸ indexing 1,204 incident reports...
✓ ingested 142,418 memories in 2m 38s

4. Query the graph

terminal
lawdmemory ask "why was Redis added?"

✓ retrieved 3 memories · 2ms
Redis was introduced in commit a3f92b on 2024-01-15...
That's it. Your team's memory is now queryable via CLI, REST, GraphQL, and MCP.

Identity & Tokens

Authentication

LawdMemory uses decentralized identifiers (DIDs) for human and agent identity. Every actor — human or AI — is identified by a cryptographic keypair.

API tokens

For server-to-server calls, mint a scoped API token:

terminal
lawdmemory tokens create \
  --name "ci-pipeline" \
  --scopes "graph:read,memory:write" \
  --expires 90d

Using tokens

example.ts
import { LawdMemory } from "@lawdmemory/sdk";

const lm = new LawdMemory({
  apiKey: process.env.LAWDMEMORY_API_KEY,
  org:    "acme-corp",
});

const results = await lm.search("authentication decisions");

Core Concept

Memory Graph

Every signal LawdMemory ingests becomes a typed Node in a graph, connected by typed Edge relationships.

Node types

  • repo — a repository
  • service — a microservice or module
  • commit — a git commit with extracted context
  • pr — a pull request and its discussion
  • incident — an outage or postmortem
  • decision — an extracted architectural choice
  • agent — an AI agent that interacted with the graph

Querying the graph

ts
const trace = await lm.graph.traverse({
  start:    "decision:redis-caching",
  edges:    ["caused_by", "fixed_by", "discussed_in"],
  depth:    3,
  direction: "both",
});

trace.nodes.forEach(n => console.log(n.type, n.label));

Core Concept

Temporal Memory

Every memory is timestamped and versioned. You can query the graph as of any point in time.

ts
// What did our architecture look like before INC-047?
const snapshot = await lm.recall({
  query: "current architecture",
  asOf:  "2024-01-11",
});

// Diff between two points in time
const diff = await lm.diff({
  from: "2024-01-01",
  to:   "2024-06-01",
  scope: "auth",
});

Integration

MCP Server (Claude)

LawdMemory ships a Model Context Protocol server with 25 tools that Claude and other MCP agents can call directly.

Claude Desktop config

claude_desktop_config.json
{
  "mcpServers": {
    "lawdmemory": {
      "command": "npx",
      "args": ["-y", "@lawdmemory/mcp"],
      "env": {
        "LAWDMEMORY_API_KEY": "lm_...",
        "LAWDMEMORY_ORG":      "acme-corp"
      }
    }
  }
}

Available tools

Claude gains: recall_memory, search_graph, traverse_decisions, get_incident_history, find_related_commits, and 20 more.

Integration

GitHub

Install the GitHub App on your organization to auto-ingest commits, PRs, issues, and discussions.

terminal
lawdmemory connect github --org acme-corp --repos "*"

The app subscribes to webhooks and ingests every event in real time. Historical backfill happens in parallel.

Integration

Webhooks

Stream events from any source into the memory graph:

server.ts
import express from "express";
import { LawdMemory } from "@lawdmemory/sdk";

const app = express();
const lm  = new LawdMemory({ apiKey: process.env.LM_KEY! });

app.post("/webhook/sentry", express.json(), async (req, res) => {
  await lm.ingest.incident({
    source:  "sentry",
    title:   req.body.event.title,
    severity: req.body.event.level,
    metadata: req.body,
  });
  res.sendStatus(200);
});

Reference

REST API

Base URL: https://api.lawdmemory.dev/v1

Common endpoints

POST/recallRetrieve memories matching a natural-language query.
GET/memories/:idFetch a single memory by ID.
POST/graph/queryRun a graph traversal.
POST/searchSemantic vector search.
POST/ingestIngest a new memory event.

Example request

curl
curl -X POST https://api.lawdmemory.dev/v1/recall \
  -H "Authorization: Bearer $LM_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "why was Redis introduced",
    "depth": 3
  }'

Reference

GraphQL

The GraphQL endpoint supports queries, mutations, and subscriptions.

query.graphql
query MemoryQuery($q: String!) {
  recall(query: $q, depth: 3) {
    memories {
      id
      type
      label
      createdAt
      sources { type ref }
    }
    latencyMs
  }
}

Reference

SDKs

First-party SDKs for the two languages that matter for AI infra:

TypeScript

v1.0
npm install @lawdmemory/sdk

Python

v1.0
pip install lawdmemory
example.py
from lawdmemory import LawdMemory

lm = LawdMemory(api_key=os.environ["LM_KEY"], org="acme-corp")

result = lm.recall("why was Redis added?")
print(result.summary)

Operations

Self-Hosting

LawdMemory is MIT-licensed and ships as a single Docker image with a Postgres + pgvector dependency.

docker-compose.yml
services:
  lawdmemory:
    image: ghcr.io/lawdmemory/server:latest
    ports: ["8080:8080"]
    environment:
      DATABASE_URL: postgres://lm:lm@db:5432/lawdmemory
      JWT_SECRET:   ${JWT_SECRET}
  db:
    image: pgvector/pgvector:pg16
    volumes: ["pgdata:/var/lib/postgresql/data"]
volumes: { pgdata: {} }
For multi-region deployments and high-availability setup, see the .

Operations

CLI Reference

The CLI is the fastest way to interact with your workspace.

lawdmemory init

Initialize a new workspace

lawdmemory connect <source>

Connect a data source (github, linear, sentry...)

lawdmemory ask <query>

Query the memory graph from the terminal

lawdmemory tokens create

Mint an API token

lawdmemory sync

Force a re-sync of all sources

lawdmemory status

Show ingestion and indexing health

Resources

FAQs

Is LawdMemory really open source?

Yes — MIT licensed, source available on GitHub. You can self-host indefinitely without paying us a cent.

What's the difference between LawdMemory and a vector database?

Vector stores answer 'find me similar text'. LawdMemory answers 'why did this happen, when, and what changed because of it' — semantic + temporal + causal.

Do you train on my code?

No. Embeddings are generated locally or via your chosen provider (OpenAI, Cohere, Voyage). We never see plaintext.

How do AI agents access the memory?

Via the MCP server (for Claude / MCP-compatible agents), REST API, GraphQL, or our TypeScript/Python SDKs.

Back to LawdMemory