Capsule Memory is an open-source long-term memory service for AI agents. The monorepo packages everything you need to run the storage engine, build UIs, and consume the API from external tools. A private sibling repository (Capsule Cloud) can layer multi-tenant governance, billing, dashboards, and managed connectors on top of the OSS core.
| Path | Description |
|---|---|
packages/core |
Engine, server modules, OpenAPI spec, and Modelence wiring. Publishes as @capsule/core. |
packages/dsl-recipes |
Default retrieval recipes and recipe types (@capsule/dsl-recipes). |
packages/meta-schema |
Shared metadata types/JSON Schema (@capsule/meta-schema). |
packages/connectors-sdk |
Connector interfaces for ingest workers (@capsule/connectors-sdk). |
packages/sdk-js |
TypeScript/Node HTTP client (@capsule/sdk-js). |
packages/adapters/* |
Storage adapters (Mongo, pgvector, Qdrant) published individually. |
packages/cli |
CLI wrapper around the Capsule HTTP API (@capsule/cli). |
examples/basic-node |
Minimal script that uses @capsule/core in-memory store. |
tools/ |
Helper scripts (ingest, router, Capsule Local, MCP bridge). |
docs/ |
OSS documentation, roadmap, and Cloud overlay notes. |
See docs/RELEASING.md for the end-to-end playbook that turns these packages into published artefacts consumed by Capsule Cloud.
The top-level src/ directory contains the Vite UI that Modelence serves when you run the development server.
- Node.js ≥ 18.17
- pnpm (enable with
corepack enableif needed) - MongoDB or another adapter backend if you want persistence
pnpm install
cp .env.example .env # populate MongoDB/Voyage credentials as needed
pnpm run dev # launches Modelence server + Vite UIVisit http://localhost:5173/memory for the operator console. The API is exposed at http://localhost:3000 with an OpenAPI document at http://localhost:3000/openapi.yaml.
To exercise the HTTP API programmatically, install the SDK after building (see below) or run the example script:
pnpm --filter examples/basic-node run devpnpm run build– builds every publishable package using tsuppnpm run clean– removes build outputspnpm run typecheck– TypeScript structural checkspnpm run lint– lint all workspaces (if ESLint is configured locally)
Each package exposes its own scripts if you prefer scoped builds, e.g. pnpm --filter @capsule/core run build.
The server serves /openapi.yaml directly from packages/core. Schemathesis-based CI in .github/workflows/contract.yml verifies PRs against this contract. Keep the spec up to date when you introduce new endpoints.
To regenerate TypeScript types in consumer projects:
pnpm exec openapi-typescript http://localhost:3000/openapi.yaml -o src/types.gen.tsCapsule Memory uses Changesets and two GitHub Actions:
pnpm changeset– choose packages and bump versionspnpm changeset version– apply version updates- Commit changes and push to
mainfor a canary release (nexttag on GitHub Packages) - Tag the commit (
git tag v0.x.y && git push --tags) to publish stable versions to npm
Secrets required:
NPM_TOKEN– npm publish access (stable job)- Built-in
GITHUB_TOKEN– used for canary publishes
| Script | Description |
|---|---|
pnpm run router |
Launches the Capsule router proxy (configure via capsule-router.config.example.json). |
pnpm run bench |
Evaluates retrieval quality/latency using the Capsule Bench CLI. |
pnpm run ingest |
Kicks off ingest workers defined in config/connectors.json. |
pnpm run local |
Starts the Capsule Local SQLite cache for offline use. |
pnpm run local:sync |
Synchronises between Capsule Local and a remote node. |
pnpm run mcp |
Runs the MCP bridge for Claude/other MCP-compatible hosts. |
pnpm run eval:retrieval |
Measures retrieval behaviour against datasets in datasets/. |
pnpm run eval:capture |
Scores capture pipeline datasets. |
pnpm run check:pii |
Validates PII flag handling on public/shared memories. |
Additional scripts are documented inline within tools/.
- Use pnpm (
pnpm install), not npm/yarn - Run
pnpm run buildbefore sending PRs - Update Changesets whenever you modify a published package
- Keep formatting/strict TypeScript checks green (lint/typecheck targets)
- Document new scripts or API surface in this README or relevant package README
import { CapsuleClient } from '@capsule/sdk-js';
const client = new CapsuleClient({
baseUrl: 'http://localhost:3000',
apiKey: 'demo-key',
orgId: 'local-org',
projectId: 'memory-lab',
defaultSubjectId: 'agent-007'
});
await client.storeMemory({
content: 'Remind me to send the demo deck every Monday morning.',
pinned: true,
tags: ['reminder', 'demo']
});
const results = await client.search({ query: 'demo deck reminder' });
console.log(results.results.map((hit) => hit.id));See examples/basic-node for a full running sample.
The open-source roadmap lives in docs/memory-roadmap.md. Guidance for structuring a private Cloud overlay (multi-tenancy, billing, dashboards, managed connectors) is available in docs/cloud/structure.md and the cloud/ scaffold.
Licensed under the Capsule Source License v1.0. You may self-host and modify Capsule Memory for your own applications, but you may not provide it as a hosted service or sell it commercially without a Capsule agreement. See LICENSE for full details or email [email protected] for enterprise licensing.