io.github.AlekseiMarchenko/central-intelligence

Persistent memory for AI agents. Store, recall, and share knowledge across sessions.

1MITdevtools

Install

Config snippet generator goes here (5 client tabs)

README

# Central Intelligence

**Agents forget. CI remembers.**

Persistent memory for AI agents. Store, recall, and share information across sessions. Works with Claude Code, Cursor, LangChain, CrewAI, and any agent that supports MCP.

[![npm](https://img.shields.io/npm/v/central-intelligence-mcp)](https://www.npmjs.com/package/central-intelligence-mcp)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

[![Central Intelligence MCP server](https://glama.ai/mcp/servers/AlekseiMarchenko/central-intelligence/badges/card.svg)](https://glama.ai/mcp/servers/AlekseiMarchenko/central-intelligence)

## Quick Start (30 seconds)

```bash
# 1. Get an API key
npx central-intelligence-cli signup

# 2. Add to Claude Code
npx central-intelligence-cli init claude

# Done. Your agent now has persistent memory.
```

## When to Use Central Intelligence

> **Heuristic:** If you would write it in a note to your future self, store it in Central Intelligence.

| Scenario | What to do |
|----------|-----------|
| Starting a new session, need context from before | `recall` or `context` |
| Discovered something important (architecture, preferences, fixes) | `remember` |
| Multiple agents working on the same project | `share` with user/org scope |
| You keep re-learning the same things each session | `remember` once, `recall` forever |
| Handing off a task to another agent or session | `remember` key decisions, next agent calls `context` |
| User tells you the same preferences repeatedly | `remember` them, check with `recall` next time |

**Don't store:** secrets, passwords, API keys, PII, large binary files, or ephemeral scratch data.

## The Problem

Every AI agent session starts from zero. Your agent learns your preferences, understands your codebase, figures out your architecture — then the session ends and it forgets everything. Next session? Same questions. Same mistakes. Same context-building from scratch.

Central Intelligence fixes this.

## What It Does

Five MCP tools give your agent a long-term memory:

| Tool | Description | Example |
|------|-------------|---------|
| **`remember`** | Store information for later | "User prefers TypeScript and deploys to Fly.io" |
| **`recall`** | Semantic search across past memories | "What does the user prefer?" |
| **`context`** | Auto-load relevant memories for the current task | "Working on the auth system refactor" |
| **`forget`** | Delete outdated or incorrect memories | `forget("memory_abc123")` |
| **`share`** | Make memories available to other agents | scope: "agent" → "org" |

## How It Works

```
Agent (Claude, GPT, etc.)
    ↓ MCP protocol
Central Intelligence MCP Server (local, thin client)
    ↓ HTTPS
Central Intelligence API (hosted)
    ↓
PostgreSQL + vector embeddings (semantic search)
```

Memories are stored as text with vector embeddings. Recall uses cosine similarity to find semantically relevant memories, not just keyword matches.

## Memory Scopes

| Scope | Visible to | Use case |
|-------|-----------|----------|
| `agent` | Only the agent that stored it | Personal context, session continuity |
| `user` | All agents serving the same user | User preferences, cross-tool context |
| `org` | All agents in the organization | Shared knowledge, team decisions |

## MCP Server Setup

### Claude Code

Add to `~/.claude/settings.json` under `mcpServers`:

```json
{
  "central-intelligence": {
    "command": "npx",
    "args": ["-y", "central-intelligence-mcp"],
    "env": {
      "CI_API_KEY": "your-api-key"
    }
  }
}
```

### Cursor

Add to `~/.cursor/mcp.json`:

```json
{
  "mcpServers": {
    "central-intelligence": {
      "command": "npx",
      "args": ["-y", "central-intelligence-mcp"],
      "env": {
        "CI_API_KEY": "your-api-key"
      }
    }
  }
}
```

### Any MCP-Compatible Client

The MCP server is published as [`central-intelligence-mcp`](https://www.npmjs.com/package/central-intelligence-mcp) on npm. Point your MCP client to it with the `CI_API_KEY` environment variable set.

## CLI Usage

```bash
# Sign up and get an API key
npx central-intelligence-cli signup

# Add to Claude Code / Cursor
npx central-intelligence-cli init claude
npx central-intelligence-cli init cursor

# Store a memory
npx central-intelligence-cli remember "The user prefers dark mode and TypeScript"

# Search memories
npx central-intelligence-cli recall "what are the user's preferences?"

# Delete a memory
npx central-intelligence-cli forget <memory-id>

# Check connection
npx central-intelligence-cli status
```

Or install globally for shorter commands:

```bash
npm install -g central-intelligence-cli
ci-memory signup
ci-memory remember "User prefers TypeScript"
ci-memory recall "language preferences"
```

## REST API

Base URL: `https://central-intelligence-api.fly.dev`

All endpoints require `Authorization: Bearer <api-key>` header.

### Create API Key

```bash
curl -X POST https://central-intelligence-api.fly.dev/keys \
  -H