# Capsule
**Compact, source-linked context packs for coding agents.**
[](https://www.npmjs.com/package/capsulectx)
[](LICENSE)
[](package.json)
[](https://github.com/dawitlabs/capsule/actions)
[Docs](https://capsulectx.vercel.app) · [Quickstart](https://capsulectx.vercel.app/guide/quickstart) · [Commands](https://capsulectx.vercel.app/reference/commands)
---
MCP gives agents tools. Skills give agents procedures. Capsules give agents compact project context.
Large repositories make coding agents burn tokens rediscovering the same files, decisions, conventions, and setup details over and over. Capsule targets a **50–70% reduction in repeated repository-discovery context** for large, multi-session agent work.
## Install
**No install required — run directly with npx (always gets the latest version):**
```bash
npx capsulectx init
```
**Or install globally with your package manager:**
```bash
# npm
npm install -g capsulectx
# pnpm
pnpm add -g capsulectx
# yarn
yarn global add capsulectx
# bun
bun add -g capsulectx
```
**Keep it up to date:**
```bash
npm install -g capsulectx --prefer-online
```
> **Tip:** `npx` is the easiest option — it always runs the latest published version with no manual update step.
## Quickstart
```bash
npx capsulectx init
```
Capsule scans your repo, optionally enriches capsules with AI (using your installed Claude CLI, API keys, or a generated prompt for any browser-based AI), and creates:
```
.capsules/
index.md
architecture.md
setup.md
api.md
data.md
ui.md
testing.md
deployment.md
```
Each capsule is a Markdown file with source fingerprints in JSON frontmatter:
```md
---json
{
"name": "api",
"sources": ["src/api/**"],
"fingerprints": { "src/api/users.ts": "sha256:..." },
"updated_at": "2026-06-20T14:00:00.000Z"
}
---
# API Capsule
## Purpose
Request handlers, routes, controllers, and service boundaries.
## Key Files
- `src/api/users.ts`: source file matched by this capsule.
## Decisions
- Record stable decisions here so future agents do not rediscover them.
```
Agents read `.capsules/index.md`, choose the relevant capsule, check staleness, then inspect only the source files that actually matter.
## Commands
| Command | What it does |
|---|---|
| `capsule init` | Scan repo, run AI enrichment (optional), write all capsules |
| `capsule enrich` | Re-run AI enrichment on existing capsules |
| `capsule apply` | Apply AI-generated JSON to capsule Conventions and Decisions |
| `capsule write