Everything you need. For builders.
Persistent memory for AI agents. Store, recall, dream, reflect. Run locally or sync across devices via the cloud.
Contents
Overview
Vitalis equips AI agents with persistent memory that behaves like a living system. Store experiences, retrieve them through hybrid search, consolidate through dream cycles, and let a self-model emerge naturally.
Each memory carries a decay factor that drops when unused and recovers on access. Retrieved memories link to related ones, forming an association graph that reflects actual usage patterns. Dream cycles compress and cross-reference accumulated experience. Active reflection generates novel introspective entries from that corpus.
Available as a Python package, a TypeScript SDK, and an MCP server that connects to any compatible editor. Storage runs locally on SQLite or through Vitalis-managed infrastructure for cross-device access.
Vitalis ships generic memory primitives for any AI agent, with first-class CAD support for Onshape and FreeCAD on top.
Ecosystem
Vitalis is a modular stack. Grab the layer that fits your use case.
Packages
Architecture
3 Ways to Use Vitalis
Python - pip install vitalis and call the Cortex API with a clean async interface.
TypeScript - Compose vitalis-brain with your choice of provider (vitalis-cloud or vitalis-local).
MCP - npx vitaliscad mcp-serve to use memory from any MCP-compatible editor (Claude Code, Cursor, etc.).
Quick Start
Three setup paths: local-first with no API keys, hosted on managed infrastructure, or self-hosted against your own Supabase instance. All three share the same SDK interface.
Install
Option A: Local-first (recommended)
Zero API keys. Zero network calls. Runs entirely offline using SQLite and local embeddings.
Option B: Hosted (cloud sync)
Keep memories in sync across machines. Sign up for an API key to get started.
Option C: Self-hosted (Supabase)
Bring your own Supabase + pgvector instance for complete data ownership.
Configure your .env with SUPABASE_URL and SUPABASE_SERVICE_KEY, then run the schema:
Store & Recall
The API is the same regardless of mode:
Export & Visualize
Export your agent's memories and explore them visually:
Then drag the file into vitaliscad.com/explore to visualize your agent's memory network.
npx vitalis export at any point.Hosted Mode
Hosted mode runs on managed infrastructure. No database to provision, no schema to migrate. Register for an API key, configure it in your project, and start storing memories.
1. Register for an API key
You'll be asked for your agent name and Ethereum mainnet wallet address. Save the API key, it won't be shown again.
2. Use in your code
3. Export, import, and sync
Download your agent's memories, import from other sources, or sync to a context file:
Then visualize them at vitaliscad.com/explore, drag and drop the file to see your agent's neural map.
npx vitalis export, import into a self-hosted instance whenever you want, and switch providers without data loss.Cortex API
REST endpoints for the hosted Cortex service. Every request needs a Bearer token in the Authorization header.
POST/api/cortex/store
Store a new memory.
POST/api/cortex/recall
Find and retrieve memories using multi-signal hybrid scoring.
Recall Pipeline
Five signals feed the scorer: recency, relevance, importance, vector similarity, and graph connectivity. Each result is gated by the memory's current decay factor before it appears in the output.
POST/api/cortex/clinamen
Surface surprising, loosely related memories through creative lateral retrieval.
GET/api/cortex/stats
Pulls aggregate stats: counts per type, averages, dream session history, and the most frequent tags and concepts.
Python SDK
Async Python client for the Cortex API. Persist memories, query them, and trigger dream cycles, all from Python.
Install
Usage
Under the hood, the Python SDK calls the Cortex HTTP API. Every method is async. Drop it into any async Python environment: FastAPI, Discord.py, or plain scripts with asyncio.run().
TypeScript SDK
Wire vitalis-brain together with your preferred storage backend and embedding provider.
Production (Supabase + Voyage)
Offline (SQLite + local embeddings)
MCP Server
Access Vitalis memory straight from your editor. The MCP server makes recall, store, and stats available as tools inside Claude Code, Cursor, and any other MCP-compatible IDE.
Quick Setup
Two Modes
Available Tools
Claude Code Setup
Add to your .mcp.json:
Local Mode
Fully offline. No API keys, no outbound connections, no external services. Memories are written to a JSON file on your local disk.
Install
This auto-configures your IDE's MCP settings for local-only memory.
How It Works
All memories go into ~/.vitalis/memories.json, a plain JSON file sitting on your disk. No database engine, no cloud dependency, no outbound connections.
Search runs on keyword matching without needing embeddings. Tag scoring, importance decay, and graph-based associations all operate entirely locally.
When to Use
Local mode is ideal for:
Air-gapped or privacy-sensitive environments
Quick prototyping without API key setup
Single-agent personal memory
Offline development
npx vitalis export and import into a hosted instance. Same data, same format.CAD Overview
Vitalis provides persistent memory primitives for CAD agents working in Onshape or FreeCAD. An agent can record why a design decision was made, what constraints apply to a part, or what naming conventions govern a document, and recall that context in any future session.
Three MCP tools expose this capability. Register them by starting the MCP server with the --onshape flag or by setting VITALISCAD_ONSHAPE=1 in the environment:
See Onshape for authentication setup and FreeCAD for macro installation. Tool definitions are in CAD MCP Tools.
Onshape
Connect Vitalis to Onshape using either an API key (default, simpler) or OAuth 2.0 (browser flow, use --oauth flag). Both flows save credentials to ~/.vitaliscad/onshape.json with mode 0600.
API Key (default)
Get your access key and secret key from the Onshape developer portal at dev-portal.onshape.com/keys. Then run the interactive prompt:
OAuth 2.0
Register an OAuth app in the Onshape developer portal. Set the redirect URI to http://localhost:3737/callback, then set the env vars and run:
REST Methods
The Onshape client exposes the following REST methods to MCP tools and the CLI:
FreeCAD
The FreeCAD integration is a Python macro that runs inside FreeCAD and POSTs design decisions to the Vitalis server. Install it with one command, then run it from the FreeCAD macro menu.
Install
This copies Vitaliscad.FCMacro to the platform-specific FreeCAD macro directory:
Usage
Open FreeCAD, select a part in the model tree, then navigate to Macro > Macros... > Vitaliscad.FCMacro and click Execute. A dialog appears with four fields:
On submit, the macro POSTs JSON to http://localhost:3000/api/cad/record-decision. See the endpoint reference for the full request shape.
Authentication
The macro sends the cortex-api-key header. It reads the key from the VITALIS_API_KEY environment variable, falling back to ~/.vitaliscad/macro.json:
CAD MCP Tools
Three tools are registered when the MCP server starts in Onshape mode (pass --onshape to mcp-serve, or set VITALISCAD_ONSHAPE=1). All tools write to and read from the standard Vitalis memory store.
record_decision
Store a CAD design decision, constraint, tolerance, or naming convention for a part or document element.
Returns:
recall_part_intent
Fetch all memories scoped to a specific document element, in relevance order.
The query uses a JSONB containment filter (metadata @> {docId, partId}) pushed to the database, so results are never silently truncated regardless of memory count.
list_constraints
Fetch all constraint and tolerance memories for an entire Onshape document (all elements).
npx vitaliscad onshape mcp, or set VITALISCAD_ONSHAPE=1 before running mcp-serve. The three CAD tools are registered automatically when the flag is active.CAD Memory Schema
CAD memories are stored as memory_type: 'semantic' records. The metadata JSONB column carries the CAD-specific fields. No additional database tables are created.
part_id Format
Slugification is applied to FreeCAD names: spaces become hyphens, all characters are lowercased. Onshape IDs are used verbatim.
Metadata Shape
Recall queries push a metadata @> { docId, partId } containment filter to the Postgres JSONB GIN index. This means the database returns only the exact matching rows, with no client-side post-filtering or silent truncation regardless of how many CAD memories exist for a document.
POST /api/cad/record-decision
HTTP endpoint for headless callers: the FreeCAD macro, CI pipelines, or any tool that cannot use MCP stdio. Accepts the same decision data as the record_decision MCP tool and writes to the same memory store.
POST/api/cad/record-decision
Authentication
Two methods are accepted. The API key header is preferred for headless callers:
Request Body
Response
200 on success:
Storing Memories
Persist memories with automatic importance scoring, concept extraction, and optional on-chain anchoring.
StoreMemoryOptions
Memory Types
Each type decays at its own rate, modeled after how biological memory works:
Concept Ontology
Memories are automatically tagged with structured concepts from a controlled vocabulary of 12 labels:
market_eventholder_behaviorself_insightsocial_interactioncommunity_patterntoken_economicssentiment_shiftrecurring_userwhale_activityprice_actionengagement_patternidentity_evolutionRecalling
Multi-signal retrieval that blends vector similarity, keyword matching, tag relevance, and graph traversal. Results are ranked using the Generative Agents scoring formula.
recall(opts?)
Returns full Memory objects ranked by composite score.
RecallOptions
Retrieval Scoring
Each memory is scored with the additive formula from Park et al. 2023:
All scores are gated by each memory's decay_factor.
recallSummaries(opts?)
Returns lightweight MemorySummary objects (no content field). Use for progressive disclosure, list summaries first, then hydrate the ones you need.
hydrate(ids)
Fetch full Memory objects by ID. Useful after recallSummaries() to get content for specific memories.
Export & Import
Your memories are portable. Export them to a file, visualize them in the browser, or move them between providers.
CLI Export
The fastest way to get your memories out:
Works with both hosted and self-hosted modes, reads your .env to detect which.
Memory Explorer
Visualize your exported memories at vitaliscad.com/explore. Three ways to load:
Once loaded, you'll see a 3D neural map of your agent's brain, searchable memory cards, and can export again in JSON or Markdown format.
SDK Export
Programmatic export via the SDK:
REST API Export
For hosted users, the Cortex API exposes export/import endpoints:
Association Graph
Typed, weighted edges between memories. Links grow stronger when memories are retrieved together, classic Hebbian reinforcement.
link(sourceId, targetId, type, strength?)
Link Types
Hebbian Reinforcement
When two linked memories appear together in a recall result, their edge weight increases by 0.05. No manual configuration required: the graph topology reflects retrieval history, not upfront declarations.
At recall time, connected memories get a 1.5x graph boost in the scoring formula.
Dream Cycles
A six-phase cycle that consolidates, compacts, and cross-links accumulated memories. Modeled loosely on biological memory consolidation during sleep. Requires anthropic config to run.
dream(opts?)
Run one full dream cycle: consolidation, compaction, reflection, contradiction resolution, learning, emergence.
Dream Phases
startDreamSchedule() / stopDreamSchedule()
Run dream cycles on a 6-hour cron schedule with daily memory decay.
Active Reflection
A generative meditation cycle that runs between dream cycles. While dreams look backward (consolidation), reflection looks forward (journaling). Requires anthropic config.
reflect(opts?)
Run a single active reflection session. Returns a journal entry.
ReflectionJournal
startReflectionSchedule() / stopReflectionSchedule()
Run active reflection on a 3-hour schedule, offset from dream cycles.
How It Works
Each session: select seed memories (recent events + high-importance + one random older memory), generate a theme, free-write journal entry, store as introspective memory, link to seed memories.
Journal entries build on previous reflections, creating a continuity chain of original thought.
Clinamen
Lateral retrieval by design. Drawn from Lucretius's concept of the swerve, clinamen digs up memories you weren't searching for but turn out to matter.
Where standard recall optimizes for similarity, clinamen perturbs the retrieval pipeline with a controlled noise term. The result is a set of loosely related memories: tangential associations, older insights, and cross-domain links that a similarity search would filter out.
Reach for clinamen when your agent hits a wall, when you want serendipity in the reasoning process, or during creative work where sideways thinking makes the difference.
Configuration
Pass a CortexConfig object to the Cortex constructor. Use hosted to skip infrastructure or supabase when you want to run your own backend.
hosted (zero-setup)
supabase (self-hosted)
anthropic (optional)
embedding (optional)
ethereum (optional)
Database Schema
Vitalis runs on Supabase PostgreSQL with pgvector handling vector similarity search.
Setup
The schema file is included in the npm package:
Or import it directly:
Tables
pgvector
The schema sets up HNSW indexes for efficient vector lookups. Confirm that the vector extension is active in your Supabase project (enabled by default).
Degradation
Start with bare-minimum config and unlock more capabilities as you add providers.
Utilities
decay()Run type-specific memory decay across all stored memories.
stats()Return a snapshot of counts, type breakdown, and graph size.
recent(hours, types?, limit?)Get memories from the last N hours, optionally filtered.
selfModel()Return all self_model memories sorted by importance.
scoreImportance(desc)Rate a text description from 0 to 1 using the LLM scorer.
formatContext(memories)Format a memory array into a prompt-ready context string.
inferConcepts(summary, source, tags)Extract structured concept labels from raw text.
destroy()Tear down the instance and release all resources.
Events
Subscribe to memory lifecycle events using the standard EventEmitter interface.
Episodic memories with importance above 0.7 automatically build stronger graph connections to co-occurring memories.
Links
Source code, issue tracker, and contribution guide. Stars welcome.