Skip to main content

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:

  1. 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.
  2. 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.
  3. 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 .md files on disk (~/.cortistrate/). Delete all databases, and indexes rebuild 100% from Markdown.
  • โฑ๏ธ Sub-Second Cascade Watcher โ€” Edit .md files 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, and session_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 pgvector semantic 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


๐Ÿ›  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

Apache-2.0 License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cortistrate-0.1.0.tar.gz (553.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cortistrate-0.1.0-py3-none-any.whl (795.1 kB view details)

Uploaded Python 3

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

Hashes for cortistrate-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e5fe45ae4b028dcc11152d3b43f9ccb7d27cceb2abbab1b6e3482859c0454249
MD5 eb636bc0d8493dff1792b9b655605504
BLAKE2b-256 91152cee0ec53247217f2b32089780fe3cc0aa5bfe55848af7c005475bab9d46

See more details on using hashes here.

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

Hashes for cortistrate-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3105a7eafd9f761981155c588aea9c56514685f388df9c450d6ce0807f5c3256
MD5 802117915a5ed70af4ab375fc95b6008
BLAKE2b-256 47e201326e417024d5ec55aadd04cd1eb81db14dda378b2ddfb6e50422e373d1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page