Skip to main content

Capsule

Atomic knowledge for AI agents.

Capsule stores one fact per .capsule.md file. The search index is SQLite locally, or PostgreSQL when you run Docker.

Quick start

pip install kapsule   # or: pip install korn / pip install pykorn
kapsule init          # or: capsule init / korn init

From a clone:

python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
capsule init
uvicorn services.api.main:app --host 127.0.0.1 --port 9100 --workers 1

In another terminal:

cd frontend
npm install
npm run dev
  • UI: http://localhost:5173
  • API: http://localhost:9100/api/v1
  • OpenAPI: http://localhost:9100/docs

Docker (Postgres + API + sync + UI):

./install.sh
  • UI: http://localhost:8080
  • API: http://localhost:9100

File format

---
id: 7c2a9f14-6b81-4d3e-9a0c-1f8e2b4d6c70
topic: "Auth middleware bypass in staging"
tags: [bug, auth, staging]
freshness: 2026-07-11T00:00:00
source: "incident-4482"
confidence: high
---

Staging skips JWT verification when `X-Debug-Override` is present.
This is intentional for E2E tests. Do not remove; mobile CI depends on it.

Creating a capsule via the UI, CLI, or API writes this file. Editing the file updates the index.

CLI

capsule new "Auth middleware bypass in staging" -t auth -t bug -c high
capsule search "JWT"
capsule compose -t auth -c medium -m 2000
capsule mcp    # stdio MCP server for agents

MCP

Point an MCP client at capsule mcp (official SDK, stdio). Optional: capsule mcp --http --port 9101.

Tools: search_capsules, compose_context, get_capsule, create_capsule, list_stale.

{
  "mcpServers": {
    "capsule": {
      "command": "capsule",
      "args": ["mcp"]
    }
  }
}

Architecture

One API process. It indexes CAPSULES_DIR on boot and watches for file changes. Do not run multiple uvicorn workers — SQLite plus the watcher assume a single writer.

See docs/ARCHITECTURE.md, docs/DEPLOY.md, and docs/API.md.

Tests

pytest

License

MIT

Metadata

Release files for kapsule 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kapsule 0.4.0
File Size Uploaded
kapsule-0.4.0.tar.gz 35.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kapsule 0.4.0
File Interpreter ABI Platform
kapsule-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 70.9 kB

Release files / kapsule-0.4.0.tar.gz

Download URL kapsule-0.4.0.tar.gz
Size 35.8 kB
Tags Source
SHA-256 checksum
How to use checksums
279e3537c54afd350b88157f7c0eb20cdb6419e08261434802419460728194aa
BLAKE2b-256 checksum
How to use checksums
126f720a8c59e7d9737e2dff03d1489319e0efb8dd7014d3ddcb7929a1445a1a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Release files / kapsule-0.4.0-py3-none-any.whl

Download URL kapsule-0.4.0-py3-none-any.whl
Size 35.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f734150a271dd8d83e4256c31513e04db42066c00959ac38d4b37b2ee103e077
BLAKE2b-256 checksum
How to use checksums
8994f487d998d6cf95f3bc4d4814422479f6984e0f6130babdd8080af3db3728
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Release history Release notifications | RSS feed

0.5.0

2 release files

This release

0.4.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page