Skip to main content
ClaudeWave
willykeenan avatar
willykeenan

agentbrain-contextlib

Ver en GitHub

ContextLib: a project's long-term memory as plain Markdown files you can read in Finder, on an SSD, with no database required. Append-only decisions, facts and lessons, a tamper-evident ledger, an 8 KB always-loaded brief, a CLI and an MCP server. Python stdlib only.

MCP ServersRegistry oficial1 estrellas0 forks● PythonApache-2.0Actualizado today
ClaudeWave Trust Score
95/100
✓ Verified
Passed
  • ✓Open-source license (Apache-2.0)
  • ✓Actively maintained (<30d)
  • ✓Clear description
  • ✓Topics declared
  • ✓Documented (README)
Last scanned: 9/27/2026
Install in Claude Code / Claude Desktop
Method: Docker · ghcr.io/willykeenan/agentbrain-contextlib
Claude Code CLI
claude mcp add agentbrain-contextlib -- docker run -i --rm ghcr.io/willykeenan/agentbrain-contextlib
claude_desktop_config.json (Claude Desktop)
{
  "mcpServers": {
    "agentbrain-contextlib": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "ghcr.io/willykeenan/agentbrain-contextlib"]
    }
  }
}
1. Run the command above in your terminal (Claude Code), or paste the JSON config into claude_desktop_config.json (Claude Desktop).
2. Replace any <placeholder> values with your API keys or paths.
3. Restart Claude. The MCP server and its tools appear automatically.
Casos de uso

Resumen de MCP Servers

# ContextLib

**A project library that outlives every agent session.**

![The sample library rendered read-only: project brief, current decisions, open requirements and key facts](docs/images/sample-library.png)

<sub>Real screenshot of the sample library (an invented project).</sub>

<table><tr><td width="50%"><img src="docs/images/cli.png" alt="A ctxlib session: an owner's decision lands current, an agent's lesson waits in the inbox, a secret is refused, and doctor passes"><br><sub>A ctxlib session: an owner's decision lands current, an agent's lesson waits in the inbox, a secret is refused, and doctor passes.</sub></td></tr></table>

Each project's knowledge — decisions, requirements, facts, lessons, glossary, sources and returned work — is stored as plain Markdown files with a small front-matter block, in one folder per project. The folders can sit on an external SSD. A person can understand a project from Finder alone. Agents read and write the same files through a CLI (`ctxlib`) and an MCP server (`context_*` tools). Any database is a search index rebuilt from the files, never the source of truth.

It is the open core of the context plugin of [AgentBrain](https://agentrooms.io).

The Python package is `agentbrain_contextlib`. The CLI is `ctxlib`. Python 3.9+, standard library only. Git is optional.

## Why

Agent sessions end. Chat logs drift. A store that only a model can parse is a dead end the first time you open Finder on an airplane.

ContextLib keeps the durable layer as files you can read, diff, copy, and take to another Mac. The search index is disposable. The Markdown is the product.

## 60-second quickstart

```bash
pip install "git+https://github.com/willykeenan/agentbrain-contextlib"

ctxlib init ~/ContextLib --project lighthouse-app \
  --name "Lighthouse App" \
  --purpose "Harbor dashboard for lamp status, fog signals, and traffic"

ctxlib add lighthouse-app decision "Use keeper logs as lamp status" \
  --body "**Decision:** Lamp status comes from keeper logs, not AIS." \
  --author mara \
  --tag lamp --tag keeper-log

ctxlib brief lighthouse-app
ctxlib doctor lighthouse-app --ten-minute
```

The library path is `--library PATH`, else env `CONTEXTLIB_ROOT`, else `~/ContextLib`.

A finished sample you can open in Finder without installing anything lives at [`examples/sample-library/`](examples/sample-library/). Start at that README, then the project BRIEF, then `decisions/INDEX.md`.

Full walkthrough: [docs/QUICKSTART.md](docs/QUICKSTART.md).

## CLI (`ctxlib`)

```
ctxlib [--library PATH] COMMAND
```

| Command | What it does |
| --- | --- |
| `init PATH [--project SLUG --name NAME --purpose TEXT]` | Create a library (and optionally the first project) |
| `project add SLUG NAME [--purpose]` | Add a project folder |
| `project list` | List projects |
| `add PROJECT TYPE TITLE (--body TEXT \| --body-file F) --author ID [options]` | Write a record (`--evidence`, `--tag`, `--review-by`, `--approved-by`) |
| `get PROJECT ID` | Print one record, with evidence state and supersession chain |
| `search PROJECT QUERY [--type] [--all]` | Search the rebuildable index |
| `brief PROJECT` | Print the always-loaded summary (≤ 8192 bytes) |
| `supersede PROJECT OLD NEW --reason TEXT --author ID` | Mark old superseded, move the file, keep the body hash |
| `review PROJECT ID confirm\|retire --note TEXT --author ID` | Confirm or retire a record |
| `inbox PROJECT` | List proposed records |
| `accept PROJECT ID --author ID` | Move inbox → current |
| `reject PROJECT ID --reason TEXT --author ID` | Move inbox → rejected |
| `due PROJECT` | Records whose `review_by` is due |
| `regen PROJECT\|--all` | Rewrite BRIEF, INDEX, GLOSSARY, TIMELINE, README |
| `rebuild` | Rebuild the SQLite search index from files |
| `capture PROJECT RESULT.json` | Turn a result file into a `return` (and proposed lessons) |
| `import-md PROJECT FILE --type TYPE --author ID` | Markdown file → record |
| `export PROJECT OUT_DIR [--include-private]` | Zip a project |
| `import BUNDLE` | Import a zip |
| `doctor [PROJECT] [--ten-minute]` | Plain-English health check |
| `sync` | `git pull` / `git push` when the library is a git repo; otherwise a no-op with a message |
| `mcp --identity ID` | Stdio MCP server; the identity is fixed for the process |

Types: `decision`, `requirement`, `fact`, `lesson`, `glossary`, `source`, `return`, `brief-note`.

## MCP (`context_*` tools)

`ctxlib mcp --identity ID` is a stdio JSON-RPC server. Protocol versions: `2024-11-05`, `2025-03-26`, `2025-06-18`.

Tools: `context_brief`, `context_search`, `context_get`, `context_record`, `context_supersede`, `context_review_due`, `context_review`, `context_capture`, `context_export`, `context_import`, `context_status`.

The identity is fixed at start. Tools cannot write as another identity. Errors come back as `isError` results.

### Claude Code

```json
{
  "mcpServers": {
    "contextlib": {
      "command": "ctxlib",
      "args": ["mcp", "--identity", "claude:project"],
      "env": { "CONTEXTLIB_ROOT": "/Volumes/SSD/ContextLib" }
    }
  }
}
```

### Codex

```json
{
  "mcpServers": {
    "contextlib": {
      "command": "ctxlib",
      "args": ["mcp", "--identity", "codex:project"],
      "env": { "CONTEXTLIB_ROOT": "/Volumes/SSD/ContextLib" }
    }
  }
}
```

### Cursor

In `.cursor/mcp.json` (project) or `~/.cursor/mcp.json` (user):

```json
{
  "mcpServers": {
    "contextlib": {
      "command": "ctxlib",
      "args": ["mcp", "--identity", "cursor:project"],
      "env": { "CONTEXTLIB_ROOT": "/Volumes/SSD/ContextLib" }
    }
  }
}
```

Details: [docs/MCP.md](docs/MCP.md).

## Record format

A record is UTF-8 Markdown. It starts with a YAML-like front-matter block (scalars, quoted strings, lists of scalars, lists of flat maps) and a Markdown body. The body hash is stored in the front-matter; bodies are not rewritten.

```
---
id: dec-20260926-7f3a
type: decision
title: Use plain files as the source of truth
status: current
project: lighthouse-app
scope: {lane: workstream, team: owner}
created: 2026-09-26T14:03:00Z
author: mara
approved_by: mara — "files first, database is only an index"
evidence:
  - {ref: "project:BRIEF.md"}
  - {ref: "url:https://example.com/x"}
supersedes: []
superseded_by: null
review_by: 2027-03-25
tags: [storage, library]
sensitivity: normal
body_sha256: "…"
---
**Decision:** …
**Why:** …
**Consequences:** …
**How to verify:** …
```

Evidence refs are `project:<relative path>`, `ssd:<relative path>`, `room:<name>#<seq>`, `url:<https url>`, or `note:<text>`. Absolute home paths and secrets are refused at write time.

Ids: `<prefix>-<YYYYMMDD>-<4 hex>` with prefixes `dec`, `req`, `fact`, `les`, `glo`, `src`, `ret`, `note`.

Files: `<YYYY-MM-DD>_<title-slug>_<id-suffix>.md`. Superseded records move to `superseded/` with the body hash still valid.

## Library layout

```
<library root>/
├── README.md              how to read this in 10 minutes
├── INDEX.md               one line per project
├── library.json           {"format": "contextlib/1", "library_id", "created"}
└── projects/<slug>/
    ├── README.md BRIEF.md GLOSSARY.md TIMELINE.md project.json
    ├── decisions/ requirements/ facts/ lessons/ glossary/ sources/ returns/
    │   ├── INDEX.md
    │   ├── <YYYY-MM-DD>_<title-slug>_<id-suffix>.md
    │   └── superseded/
    ├── inbox/             proposed records
    ├── exports/
    └── .contextlib/       ledger + rebuildable index.sqlite
```

Keeping the library on an SSD, using it unplugged, and moving it between Macs: [docs/SSD.md](docs/SSD.md).

## Develop

```bash
PYTHONPATH=src python3 -m unittest discover -s tests
python3 tools/check.py packaging
```

Python 3.9+, standard library only. See [CONTRIBUTING.md](CONTRIBUTING.md) and [CHANGELOG.md](CHANGELOG.md).

Apache-2.0, copyright KE Studios. [SECURITY.md](SECURITY.md) for reports.

ContextLib is the open library layer of AgentBrain (agentrooms.io).

## Run with Docker

The image is published at `ghcr.io/willykeenan/agentbrain-contextlib` for Apple silicon and Intel. Mount your library at `/library`:

```bash
claude mcp add contextlib -- docker run -i --rm --user "$(id -u):$(id -g)" -v ~/ContextLib:/library ghcr.io/willykeenan/agentbrain-contextlib mcp --identity you
```
ai-agentscontextknowledge-basemarkdownmcppython

Lo que la gente pregunta sobre agentbrain-contextlib

¿Qué es willykeenan/agentbrain-contextlib?

+

willykeenan/agentbrain-contextlib es mcp servers para el ecosistema de Claude AI. ContextLib: a project's long-term memory as plain Markdown files you can read in Finder, on an SSD, with no database required. Append-only decisions, facts and lessons, a tamper-evident ledger, an 8 KB always-loaded brief, a CLI and an MCP server. Python stdlib only. Tiene 1 estrellas en GitHub y su última actualización registrada es del 2026-09-26.

¿Cómo se instala agentbrain-contextlib?

+

Puedes instalar agentbrain-contextlib clonando el repositorio (https://github.com/willykeenan/agentbrain-contextlib) o siguiendo las instrucciones del README en GitHub. ClaudeWave también te ofrece bloques de instalación rápida en esta misma página.

¿Es seguro usar willykeenan/agentbrain-contextlib?

+

Nuestro agente de seguridad ha analizado willykeenan/agentbrain-contextlib y le ha asignado un Trust Score de 95/100 (tier: Verified). Revisa el desglose completo de comprobaciones superadas y flags en esta página.

¿Quién mantiene willykeenan/agentbrain-contextlib?

+

willykeenan/agentbrain-contextlib es mantenido por willykeenan. La última actividad registrada en GitHub es del 2026-09-26, con 0 issues abiertos.

¿Hay alternativas a agentbrain-contextlib?

+

Sí. En ClaudeWave puedes explorar mcp servers similares en /categories/mcp, ordenados por popularidad o actividad reciente.

Despliega agentbrain-contextlib en tu cloud

Lleva este repo a producción en minutos. Cada plataforma genera su propio entorno con variables de entorno editables.

¿Mantienes este repo? Añade un badge a tu README

Pega el badge en tu README de GitHub para mostrar que está auditado por ClaudeWave. Cada badge enlaza de vuelta a esta página y muestra el Trust Score actual.

Featured on ClaudeWave: willykeenan/agentbrain-contextlib
[![Featured on ClaudeWave](https://claudewave.com/api/badge/willykeenan-agentbrain-contextlib)](https://claudewave.com/repo/willykeenan-agentbrain-contextlib)
<a href="https://claudewave.com/repo/willykeenan-agentbrain-contextlib"><img src="https://claudewave.com/api/badge/willykeenan-agentbrain-contextlib" alt="Featured on ClaudeWave: willykeenan/agentbrain-contextlib" width="320" height="64" /></a>

Más MCP Servers

Alternativas a agentbrain-contextlib