Skip to content

incordai/memory

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

memory

Incord Memory

The local-first memory engine for AI — and for you.

Per-user, per-tenant chat-memory and memory API with true hybrid search, a self-wiring knowledge graph, and on-device embeddings. Runs entirely free and offline on your machine, or syncs on demand with the cloud. No vendor lock-in. No data leaves your laptop unless you say so.

Install · Architecture · How sync works · For AI agents · Comparison


Why incord memory

Most "AI memory" products are cloud-only, vector-only, and paid: your conversations live on someone else's servers, search is a single nearest-neighbour lookup, and you pay per month. incord memory takes the opposite approach.

Principle What it means in practice
Local-first and free One small binary plus a downloadable model. Your memory lives in a file on your disk. Works on a plane.
Private by default Embeddings run on-device (Apple Silicon NEON / x86 AVX-512). Nothing leaves your machine unless you link a cloud account.
Real hybrid retrieval BM25 keyword scoring + vector similarity + reciprocal-rank fusion + cross-encoder rerank + recency/title boosts — not just "top-k cosine."
Self-wiring knowledge graph Conversations, topics, and days auto-link into a graph with zero LLM calls. Traverse neighbours; trace how a topic evolved over time.
AI-native A built-in MCP server (with an operating manual baked into the handshake) gives any agent — Claude, Cursor, your own — memory tools out of the box.
Optional, conflict-free sync Link a cloud account and it stays in sync across devices. Offline edits reconcile on reconnect — no merge prompts, ever.
One engine, four APIs REST, MCP, OpenAI-compatible embeddings, and Tavily-compatible search share the same core.

Install

One command. The installer auto-detects your OS, downloads both on-device models — the embedder and the MiniLM reranker (SHA-256 verified) — and sets up ~/.incord/. Everything runs locally; no Python, no cloud dependency.

Windows (PowerShell):

irm https://raw.githubusercontent.com/incordai/memory/main/install.ps1 | iex

macOS / Linux:

curl -fsSL https://raw.githubusercontent.com/incordai/memory/main/install.sh | bash

Then:

incord-memory serve     # start the server  →  http://127.0.0.1:9180
incord-memory doctor    # check model / config / health

No model? It still runs — search gracefully falls back to keyword-only until the model is present. The model is an upgrade, never a hard dependency.

Prefer manual installation? Download your platform's binary from Releases (Windows · macOS Apple Silicon · Linux x86-64) plus the incord-rag model bundle.


Architecture

flowchart TB
    subgraph Clients
        A[Claude / Cursor / any MCP agent]
        B[Your app]
        C[OpenAI-compatible clients]
        D[Tavily-compatible clients]
    end

    subgraph Engine["incord memory — single binary"]
        API["API layer<br/>REST · MCP · OpenAI · Tavily"]
        RET["Hybrid retrieval pipeline"]
        GRAPH["Self-wiring knowledge graph"]
        EMB["On-device embeddings<br/>incord-rag · Qwen3 0.6B"]
        RR["Cross-encoder reranker<br/>MiniLM · pure Rust"]
        DB[("redb store<br/>tenant\0user\0… key isolation")]
    end

    CLOUD[("Optional cloud hub<br/>api.incord.ai")]

    A --> API
    B --> API
    C --> API
    D --> API
    API --> RET
    RET --> EMB
    RET --> RR
    RET --> DB
    API --> GRAPH
    GRAPH --> DB
    DB <-. "opt-in delta sync" .-> CLOUD
Loading

Retrieval pipeline

Every query runs through a four-stage pipeline:

flowchart LR
    Q[Query] --> BM25[BM25<br/>keyword scoring]
    Q --> VEC[Vector<br/>cosine similarity]
    BM25 --> RRF[Reciprocal-rank fusion<br/>intent-weighted]
    VEC --> RRF
    RRF --> CE[Cross-encoder rerank<br/>MiniLM · &lt;0.2 s CPU]
    CE --> BOOST[Boosts<br/>recency · title · diversity · floor-gate]
    BOOST --> R[Calibrated, ranked results]
Loading
  1. BM25 keyword scoring and vector cosine similarity run in parallel.
  2. Reciprocal-rank fusion (intent-weighted) merges the two channels.
  3. Cross-encoder rerank of the top candidates — a pure-Rust MiniLM cross-encoder (ms-marco-MiniLM-L-6-v2, ONNX via tract, batched), on by default locally, reranking ~20 candidates in under 0.2 s on CPU. No Python, no GPU, no external service. Scores are calibrated: a spot-on hit scores well above 0 and pure noise scores far below, so an agent can distinguish "real memory" from "nothing relevant" instead of always receiving top-k.
  4. Boosts: recency half-life, title match, session diversification, floor-gating.

Scale

A per-user HNSW/ANN index (pure-Rust instant-distance) activates past a size threshold; below it, exact brute-force search runs with no recall loss. The index rebuilds off the hot path, and only the small post-build delta is brute-forced.

Self-wiring graph

Each message auto-creates Conversation, Tag, and Day nodes plus AboutTopic edges — zero LLM calls. find_trajectory and N-hop neighbour traversal run on top.

graph LR
    M[Message] --> C[Conversation]
    M -- AboutTopic --> T1[Tag: rust]
    M -- AboutTopic --> T2[Tag: retrieval]
    C --> D[Day: 2026-07-06]
    T1 --- T2
Loading

Background "dream-cycle" (opt-in)

Embedding backfill, auto-titling, daily rollups, ANN reindexing, and tombstone reaping run in the background without blocking reads or writes.

On-device model

incord-rag (Qwen3-Embedding 0.6B, Matryoshka-256) loads via mmap. SIMD math selects NEON on Apple Silicon, AVX-512 on x86-64, and a scalar fallback elsewhere — chosen at runtime. The same ~670 MB model bundle is portable across every OS.

Storage

redb — embedded and transactional. Keys are prefixed by tenant\0user\0…, so a scan physically cannot cross a tenant or user boundary.


How sync works

incord memory is local-first: the on-disk database is always the source of truth, and everything works offline. The cloud is an optional hub you opt into — never a requirement.

sequenceDiagram
    participant L as Local DB (source of truth)
    participant S as Sync engine
    participant H as Cloud hub (optional)

    Note over L: Install — no account, no key,<br/>fully working offline
    L->>L: ingest / search / recall / graph
    Note over S: incord-memory link --key KEY
    loop Background auto-sync
        S->>H: push local delta
        H->>S: pull remote delta
        S->>L: dedup by stable message ID
    end
    Note over S,H: Offline? Sync quietly waits.<br/>Back online? Only the delta moves.
Loading
Situation What happens
Install No account, no key, no internet (after the one-time model download). Fully working, private, local.
Use locally Ingest, search, recall, graph — all against your local DB. Works offline forever.
Link a cloud account (optional) incord-memory link --url https://api.incord.ai/v1/memory --key <KEY> --user <id> — stores the credential locally.
Synced Auto-sync runs in the background once linked. Or trigger manually: incord-memory sync.
Offline Nothing breaks — local reads and writes continue; sync quietly waits.
Back online The next sync reconciles only the delta, in both directions.
Multiple devices Each device syncs with the cloud hub; your memory converges everywhere.

Why it never conflicts. Chat memory is an append-only log. Sync is delta-exchange plus deduplication by a stable message ID — not operational transformation. The only mutable data (a conversation's title, deletions) resolves by last-writer-wins with tombstones. No CRDTs, no "which version wins" prompts.


For AI agents (MCP-native)

Point any MCP client at a running instance and it gets memory tools immediately:

claude mcp add incord-memory --transport sse \
  --url http://127.0.0.1:9180/v1/memory/mcp/sse \
  --header "X-API-Key: <your key>"
Tool Purpose
recall Full context in one call — ranked matches, graph neighbours, recent threads, and timeline.
memory_search Ranked source snippets for a query.
think A synthesized, cited answer plus an explicit list of what is still unknown.
remember / ingest_message Save a fact or a conversation turn.
ingest_code Save a concise code summary as knowledge — never raw source.
find_trajectory How a topic evolved over time.
user_graph_* Put / get / list / search knowledge-graph nodes.

The initialize handshake ships an operating manual telling the agent when to retrieve versus save, and what never to store (secrets, raw code). Search matches by meaning, so agents don't need matching keywords.

Zero-friction by default. On a local install you don't pass a user_id — every REST/MCP call falls back to the signed-in local user (MEMORY_LOCAL_USER), so any agent can call recall or memory_search and it just works. On a shared or cloud deployment, user_id is still required — a multi-tenant server cannot guess whose memory to read.

Auto-capture — zero tokens spent on writing memory. Point the install-provided hooks at your agent (session-start / code-edit / capture) and every session and code edit is embedded automatically in the background. The agent never has to decide what to save, generate a remember call, or summarize a turn — so it spends no output tokens, no extra turns, and no latency on memory writes. Compare that with cloud memory tools where the agent (or an extra LLM pass) must author every memory entry, paying tokens on both write and read. Here the agent only ever recalls; capture is free.


How it compares

incord memory Mem0 Zep ChatGPT Memory Raw vector DB¹
Ownership & privacy
Runs 100% local Yes Partial Partial No Partial
Works fully offline Yes No No No No
On-device private embeddings Yes No No No No
Free and self-hostable Yes Partial Partial No Partial
Retrieval quality
Hybrid retrieval (keyword + vector + rerank) Yes Partial Partial No No
Self-wiring knowledge graph (no LLM) Yes Partial Yes No No
Agent integration
MCP-native for agents Yes Partial Partial No No
Token-free auto-capture (no LLM writes) Yes No Partial No No
One engine, multiple APIs (REST / MCP / OpenAI / Tavily) Yes No No No No
Operations
Offline-first bidirectional sync Yes No No No No
Per-user multi-tenant isolation Yes Yes Yes n/a Partial
One-binary install, no infrastructure Yes No No n/a No

Partial = available only via an add-on, self-managed setup, or a paid tier.

¹ Pinecone, Chroma, Weaviate, etc. are storage primitives — you build the memory logic, ranking, graph, and tenancy yourself. Comparison reflects the general public positioning of each project and is intended as architecture-level guidance; capabilities evolve — verify current features.

The short version: other tools give you a vector lookup in the cloud. incord gives you a private, offline, hybrid-ranked memory with a knowledge graph and an agent-native API — that you own.


Free local vs. cloud

Free local Cloud
Cost Free Hosted (managed)
Data location Your disk Hosted, per-tenant
Offline Yes
Multi-device Via sync The hub
Setup One command API key

Same binary, same model, same API — the only difference is where it runs. Start local and free; link the cloud whenever you want multi-device sync.


Tech stack

Rust · axum (HTTP) · redb (embedded store) · instant-distance (HNSW) · tokio · incord-rag + incord-simd (on-device Qwen3 embeddings) · incord-rerank (tract-onnx MiniLM cross-encoder — pure-Rust, on-device rerank) · reqwest · MCP (JSON-RPC + SSE).

Ships as a single binary per OS (Windows / macOS Apple Silicon / Linux x86-64) and a Docker image (ghcr.io/incordai/incord-memory-service). Releases are built automatically by CI on every version tag.


License & links

Built with incord. Your memory, your machine, your rules.

Licensed under AGPL-3.0 · © 2026 Incord AI

About

Incord Memory — local-first, per-user memory engine for AI. Hybrid retrieval + self-wiring graph. Free & offline, optional cloud sync.

Topics

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Packages

 
 
 

Contributors