Cortistrate โ markdown memory framework for AI agent swarms; cross-machine, multi-agent, self-hosted
Project description
๐ง Cortistrate
The Agent Swarm Memory Cortex (ๅคง่็ฎๅฑ)
Markdown Source of Truth ยท Sub-second Cascade Sync ยท Postgres Vector Search ยท Multi-Agent Adaptive
Quick Start ยท Install ยท Research & Philosophy ยท Docs ยท Integrations
๐ What is Cortistrate?
Cortistrate is a Python framework and runtime memory engine that gives AI coding assistants, chat applications, and autonomous agents a portable, persistent, and self-evolving memory layer. Built for Agent Swarm readiness โ multiple agents across multiple machines share one memory server.
While current LLMs provide powerful raw reasoning, their APIs are inherently stateless. Agent frameworks supply the execution loops and tool bindings ("hands and feet"), but without a long-term memory layer, agents remain transient execution scripts.
Cortistrate acts as the Cortex (ๅคง่็ฎๅฑ) for AI Agents โ storing conversations, user preferences, codebase knowledge, and execution trajectories as plain Markdown on disk, and syncing them into high-performance vector/keyword indexes for instant context retrieval.
๐ฌ Top-Level Philosophy & Research
Cortistrate is grounded in deep research on cognitive architectures, memory models, and agentic workflows (published in our Research & Philosophy Paper).
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
| AI AGENT COGNITIVE ARCHITECTURE |
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
| 1. LLM Backend (API) --> Brainstem / Basal Ganglia (Stateless Core) |
| 2. Agent Framework --> Sensorimotor Exoskeleton (Hands & Feet) |
| 3. Cortistrate Substrate --> Agent Cortex (ๅคง่็ฎๅฑ - Persistent State) |
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Key Research Insights:
- Sensorimotor Exoskeleton + Cortex: Backend LLMs handle raw computation; client-side agent loops form the Sensorimotor Exoskeleton (ๆ่ง่ฟๅจๅค้ชจ้ชผ). Cortistrate provides the Cortex (ๅคง่็ฎๅฑ), turning stateless models into persistent AGI assistants.
- State-Weight Decoupling: Managed cloud agents and managed APIs (CoT, Code Interpreters) cannot replace local memory layers. Trillion-parameter static model weights cannot be mutated for local company codebases or specific user projects. Agent runtime state must be decoupled from static weights.
- Isomorphism of Memory & Knowledge: Traditional, rigid Knowledge Graphs (Wikipedia, WordNet) are high-maintenance and brittle. Cortistrate leverages Semantic Vector Space + Hybrid BM25 Retrieval, capturing deep implicit context and solving the LLM's epistemic blindness ("doesn't know what it doesn't know").
๐ Read the Full Research Paper & Reference Philosophy
โก Key Features
- ๐ Markdown Source of Truth โ Human-readable, diffable, and Git-versioned
.mdfiles on disk (~/.cortistrate/). Delete all databases, and indexes rebuild 100% from Markdown. - โฑ๏ธ Sub-Second Cascade Watcher โ Edit
.mdfiles directly in VS Code, Obsidian, or Neovim; the background watcher automatically syncs SQLite state and Postgres vector indexes. - ๐งฌ Dual-Track & 5-Axis Namespace โ Explicit separation between User Track (episodes, user profile) and Agent Track (trajectories, skills), isolated across
user_id,agent_id,app_id,project_id, andsession_id. - ๐ Self-Evolving Offline Memory Engine (OME) โ Background reflection cycles consolidate raw conversation episodes into atomic facts, dynamic user profiles, and reusable workflow skills.
- ๐ Hybrid Postgres / PGLite Vector Search โ Combines
pgvectorsemantic similarity with BM25 keyword matching and scalar filtering. - ๐ Seamless Agent Integrations โ Ready-to-use plugins for Hermes Agent, Claude Code, FastAPI HTTP API, and a full-featured CLI.
๐ Quick Start
1. Installation
# One-liner automated setup (checks Python >= 3.12, installs cortistrate, runs init)
curl -fsSL https://cortistrate.dev/install.sh | bash
Or via PyPI:
pip install cortistrate
cortistrate init
cortistrate server start # Starts HTTP API server on http://127.0.0.1:8000
2. Write & Search Memories
# Memorize a user preference
cortistrate memorize \
--user-id me \
--text "I prefer dark mode, strict Python typing, and concise responses"
# Perform hybrid semantic search
cortistrate search --user-id me --query "developer UI preferences"
๐ Benchmark Performance
Cortistrate includes a self-contained runner for the LoCoMo (Long Conversation Memory) benchmark (Maharana et al., 2024), evaluating multi-session retrieval across single-hop, multi-hop, open-domain, and temporal questions:
| Category | Description | Cortistrate Accuracy |
|---|---|---|
| Single-hop | Direct fact retrieval from single session | 94.0% |
| Multi-hop | Cross-session reasoning and synthesis | 91.0% |
| Open-domain | General knowledge grounded in dialogue | 80.2% |
| Temporal | Time-sensitive questions & date reasoning | 95.5% |
| Overall Majority | 1,540 multi-session QA evaluations | 93.3% |
See benchmarks/README.md to reproduce the LoCoMo benchmark locally.
๐งฉ Integrations
Hermes Agent
hermes plugins install cortistrate
See integrations/hermes/ for full configuration and tools.
Claude Code
claude plugin marketplace add cortistrate/cortistrate-claude-code
claude plugin install cortistrate
See integrations/claude-code/ for details.
HTTP API Endpoints
Cortistrate exposes a FastAPI server (http://localhost:8000):
POST /api/v1/memory/flushโ Extract & store memories from conversation sessions.GET /api/v1/memory/searchโ Hybrid vector + BM25 memory retrieval.GET /api/v1/memory/profileโ Fetch structured user profile.POST /api/v1/memory/reflectโ Trigger background memory consolidation.
Interactive OpenAPI docs available at http://127.0.0.1:8000/docs.
๐ Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Markdown Truth Files (`.md`) โ
โ `~/.cortistrate/{users, agents, knowledge}/*.md` โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
[Cascade Watcher]
โ
โโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโ
โผ โผ
โโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโ
โ SQLite State โ โ Postgres / PGLite โ
โ (system.db metadata) โ โ (pgvector + BM25) โ
โโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโ
- Markdown Files: Single source of truth. Human-readable, diffable, editable.
- SQLite: Queue state, cascade audit logs, and metadata isolation.
- Postgres / PGLite: Vector ANN search + BM25 full-text + scalar filter in a single query.
See docs/architecture.md for the complete architecture blueprint.
๐ Documentation
- ๐ Research & Philosophy Paper โ Architectural philosophy, Cortex paradigm, and theory.
- ๐ Architecture Overview โ Layered DDD design, dependencies, and index pipeline.
- โก How Memory Works โ Step-by-step memory extraction, storage, and retrieval.
- โ๏ธ Configuration Guide โ TOML & environment variable settings.
- ๐ API Reference โ Complete OpenAPI endpoint specifications.
๐ Development
git clone https://github.com/mark1kwok/cortistrate.git
cd Cortistrate
uv sync # Install dependencies & set up virtualenv
make ci # Run linting, unit tests, and integration tests
See docs/engineering.md for build and CI conventions.
๐ง What changed from EverOS
Cortistrate is a fork of EverOS by EverMind AI, licensed under Apache-2.0. The core memory pipeline, Markdown-first storage model, and OME reflection engine originate from the EverOS project.
The algorithm library EverAlgo
(boundary detection, memory extraction, ranking, clustering) is vendored under
src/everalgo/ under the MIT License.
See ACKNOWLEDGMENTS.md for the full list.
Key modifications from the original EverOS:
Production-grade database (LanceDB โ PostgreSQL). EverOS shipped with LanceDB โ an embedded, research-grade column store that loads entire tables into memory and copies on every mutation, causing memory leaks unsuitable for long-running processes. Cortistrate replaces it with PostgreSQL (or embedded PGLite for single-user setups) backed by pgvector, turning a research prototype into a transactional memory store.
Always-on HTTP server. EverOS was a CLI tool โ each invocation loaded, ran, and exited. Cortistrate runs as a persistent HTTP server with a REST API, enabling remote calls from multiple agents simultaneously.
Memory fragment mechanism. The original Episode mechanism loaded one or two full conversation records into context on every turn. Cortistrate's philosophy: remembering the full detail of the last two sessions is pointless โ relevance beats recency. We replaced it with a title-based retrieval model that loads 20 concise fact titles into the semantic context, dramatically widening coverage and recall probability without bloating the prompt.
Hermes plugin rewrite. The Hermes provider was rewritten for the Cortistrate server architecture. The original EverOS provider loaded full episode bodies into the system prompt; the rewrite uses title-based memory fragments, keeping the prompt lean while widening coverage.
Claude Code plugin rewrite. The Claude Code plugin was rewritten from the EverMem Cloud plugin (shipped inside the EverOS repo under Apache-2.0). The API client layer, hook scripts, and MCP server target the self-hosted Cortistrate server (no auth, app/project/user scoping) instead of cloud endpoints (Bearer auth, group scoping).
Multi-agent shared memory (Agent Swarm).
Multiple agents can share a single Cortistrate instance. In practice this does
not cause "personality bleed" โ each agent sees the broader context of what
others in the swarm are doing, similar to how humans stay informed through
communication. Agents that need isolation (e.g. business profiles) can be
configured with separate app_id / user_id scopes.
๐ License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cortistrate-0.1.0.tar.gz.
File metadata
- Download URL: cortistrate-0.1.0.tar.gz
- Upload date:
- Size: 553.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5fe45ae4b028dcc11152d3b43f9ccb7d27cceb2abbab1b6e3482859c0454249
|
|
| MD5 |
eb636bc0d8493dff1792b9b655605504
|
|
| BLAKE2b-256 |
91152cee0ec53247217f2b32089780fe3cc0aa5bfe55848af7c005475bab9d46
|
File details
Details for the file cortistrate-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cortistrate-0.1.0-py3-none-any.whl
- Upload date:
- Size: 795.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3105a7eafd9f761981155c588aea9c56514685f388df9c450d6ce0807f5c3256
|
|
| MD5 |
802117915a5ed70af4ab375fc95b6008
|
|
| BLAKE2b-256 |
47e201326e417024d5ec55aadd04cd1eb81db14dda378b2ddfb6e50422e373d1
|