Skip to content

Bikz/capsule-memory

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Capsule Memory

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.

Repository Layout

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.

Requirements

  • Node.js ≥ 18.17
  • pnpm (enable with corepack enable if needed)
  • MongoDB or another adapter backend if you want persistence

Quick Start

pnpm install
cp .env.example .env     # populate MongoDB/Voyage credentials as needed
pnpm run dev             # launches Modelence server + Vite UI

Visit 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 dev

Building & Testing

  • pnpm run build – builds every publishable package using tsup
  • pnpm run clean – removes build outputs
  • pnpm run typecheck – TypeScript structural checks
  • pnpm 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.

OpenAPI Contract & CI

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.ts

Publishing & Release Flow

Capsule Memory uses Changesets and two GitHub Actions:

  1. pnpm changeset – choose packages and bump versions
  2. pnpm changeset version – apply version updates
  3. Commit changes and push to main for a canary release (next tag on GitHub Packages)
  4. 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

Toolkit Overview

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/.

Contribution Guidelines

  1. Use pnpm (pnpm install), not npm/yarn
  2. Run pnpm run build before sending PRs
  3. Update Changesets whenever you modify a published package
  4. Keep formatting/strict TypeScript checks green (lint/typecheck targets)
  5. Document new scripts or API surface in this README or relevant package README

Example: Using the SDK

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.

Roadmap & Cloud Overlay

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.

License

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.

About

Unified Capsule Memory Router (RaaS) for the Agentic Memory MongoDB hackathon: RaaS is an open-source “memory substrate” that any AI agent can call to store, retrieve, summarize, pin, and forget information with explanations and policy controls, powered by MongoDB Atlas Vector Search and Voyage AI embeddings.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors