madeleine

Official registry AI and agents

Involuntary memory for agents: time, place, sound and IoT cues surface memories unasked

Install

Add this to your client's MCP configuration (Claude Desktop: claude_desktop_config.json; Cursor: .cursor/mcp.json; VS Code and others use the same "mcpServers" shape).

PYPI package madeleine-mcp
Claude Code
claude mcp add madeleine -e 'MADELEINE_DB=<MADELEINE_DB>' -e 'MADELEINE_TEXT_BACKEND=<MADELEINE_TEXT_BACKEND>' -- uvx madeleine-mcp==0.1.0 serve
JSON configuration (Claude Desktop, Cursor, VS Code)
{
    "mcpServers": {
        "madeleine": {
            "command": "uvx",
            "args": [
                "madeleine-mcp==0.1.0",
                "serve"
            ],
            "env": {
                "MADELEINE_DB": "<MADELEINE_DB>",
                "MADELEINE_TEXT_BACKEND": "<MADELEINE_TEXT_BACKEND>"
            }
        }
    }
}

Environment variables

  • MADELEINE_DB SQLite database path (default ~/.madeleine/madeleine.db)
  • MADELEINE_TEXT_BACKEND auto | sentence-transformers | hash (offline lexical)

Documentation

From the project's README on GitHub, refreshed weekly. Links open on GitHub.

Contents
  1. madeleine
  2. 60-second quickstart
  3. How it works
  4. Sending cues
  5. Privacy and security defaults
  6. Benchmark (and where it fails)
  7. Configuration
  8. As a Python library
  9. Development
  10. License

madeleine

Involuntary memory for AI agents. A place, an hour, a sound, a photo or a sensor reading brings back a related memory on its own, without the agent having to ask. It works the way the taste of a madeleine brought back Proust's childhood.

· Python 3.11–3.13 · Apache-2.0 · local-first (SQLite) · MCP server + Python library

Most agent memory is voluntary: the agent decides to search, writes a query, and gets results. madeleine adds the other pathway. Every memory is stored with the sensory fingerprint present when it was encoded: where, when, what was said, seen or heard. Incoming cues from webhooks, phones, smart homes and wearables are matched against those fingerprints all the time. When enough channels line up, the memory is queued as an involuntary recollection, and the agent receives it with its next prompt. This is encoding specificity applied to agents (concepts).

60-second quickstart

# 1. See the whole loop, offline (nothing is downloaded, nothing leaves your machine)
uvx madeleine-mcp demo

The demo remembers three moments. Then a cue arrives that carries only a place and a time of day: 30 m from grandmother's house, on a Sunday afternoon. The matching memory surfaces by itself, is delivered through the MCP tool pending_recollections, and does not fire again for a repeated cue:

[madeleine 0.80 via geo+time] Sunday afternoons in grandmother's kitchen: lime-blossom tea and a madeleine (2019-04-14)
  channel similarity geo=0.97, time=1.00; salience x1.16, age decay x0.70
# 2. Give Claude Code the tools
claude mcp add madeleine -- uvx madeleine-mcp serve
  1. Let involuntary recollections reach every prompt. Add this to .claude/settings.json:
{"hooks": {"UserPromptSubmit": [{"hooks": [
  {"type": "command", "command": "uvx madeleine-mcp hook claude-code", "timeout": 10}
]}]}}

The hook works even if your client ignores MCP notifications. See examples/claude_code for options such as --sense-prompt, which treats what you type as a cue too.

Semantic text needs the [text] extra. The base install is small and offline. Without the extra, text is matched lexically by a hashing embedder, so "car" and "automobile" count as unrelated. For real sentence embeddings (this pulls in PyTorch):

claude mcp add madeleine -- uvx --from 'madeleine-mcp[text]' madeleine-mcp serve

Images ([image], open_clip) and sound ([audio], LAION CLAP) are opt-in the same way. [all] installs everything. Models download lazily on first use, never at import.

How it works

flowchart LR
    subgraph Sources
      HA[Home Assistant] -->|webhook| HTTP
      IOS[iOS Shortcuts] -->|webhook| HTTP
      AG[Agent] -->|MCP tools| MCP
    end
    HTTP[HTTP API /cues] --> ENG
    MCP[MCP server] --> ENG
    subgraph ENG[engine]
      direction TB
      CH["channels<br/>adapter → embedder → similarity"] --> FU["fusion<br/>base · coverage · salience · decay"]
      FU --> RF{"push?<br/>threshold + refractory"}
    end
    ENG <--> DB[(SQLite + sqlite-vec)]
    RF -->|enqueue| Q[(recollection queue)]
    Q -->|drain| HOOK[Claude Code hook]
    Q -->|drain / notify| MCP
  • Channels are pluggable senses. Each one has an adapter (raw signal → normalised observation), an embedder (observation → vector) and a similarity function (→ [0, 1]). Built in: text, time (hour, weekday and season, all cyclical), geo (distance on the sphere), biometric, image, audio. smell is a documented stub for future e-noses.
  • Recall combines per-channel similarity over the channels the cue and the memory share, adjusts for how much of the cue is covered, boosts salient memories, and decays with age down to a floor, so decades-old memories stay reachable. The formula is short and explainable; every result says which channels matched (ADR 0001).
  • Two modes. Pull: the agent asks (recall). Push: a cue arrives (sense, POST /cues) and memories that clear the threshold are queued without anyone asking.
  • Habituation. A memory that fired stays quiet for a refractory period (default 6 h). Walking past the same café all afternoon reminds you of it once.
  • Context alone never fires. "It's 9 am" matches every memory made at 9 am, so time (and biometric) can strengthen a match but never cause one.

Sending cues

madeleine serve --transport http          # REST + MCP (streamable HTTP at /mcp/) on 127.0.0.1:8765
curl -s localhost:8765/cues -H 'content-type: application/json' \
  -d '{"lat": 48.30195, "lon": 1.24650, "signals": [{"channel": "text", "value": "smell of lime-blossom tea"}]}'
RoutePurpose
POST /cuesGeneric cue: signals, at, geohash or lat/lon, tags, source
POST /cues/{generic,home_assistant,ios_shortcuts}Payloads straight from those tools (examples)
POST /memories, POST /recall, DELETE /memories/{id}Same as the MCP tools
GET /recollections/pending · POST /recollections/drainPeek / take queued involuntary recollections

Ready-made integrations: Home Assistant (arriving home, media starts playing, wearable sensors), iOS Shortcuts ("Arrive at location" personal automation), curl.

MCP surface:

  • Tools: remember, recall, sense, pending_recollections, forget.
  • Resource: recollections://pending, with resources/updated notifications when something surfaces. These notifications also work across processes that share the database.

Privacy and security defaults

  • Local-first. Everything lives in one SQLite file (~/.madeleine/madeleine.db, owner-only permissions). There is no telemetry and no cloud.
  • Raw media is not kept. Image and audio bytes are embedded and then discarded. Only vectors and metadata are stored, unless you pass store_raw=True (per call or MADELEINE_STORE_RAW=1).
  • No local file access by default. Clients must send media bytes. Allowing file paths takes madeleine serve --allow-file-uris.
  • HTTP binds to 127.0.0.1. Host and Origin checks block DNS rebinding. Set MADELEINE_API_TOKEN to require a bearer token. Binding to another interface without a token is refused unless you pass --insecure-no-auth.
  • forget deletes everywhere: memory, vectors, raw bytes, trigger history and queued recollections, with SQLite secure_delete on.
  • Recollections are data, not instructions. The hook wraps them in delimiters and labels them as such. Anyone who can write memories can still put text in your agent's context, so keep write access to yourself. See SECURITY.md.

Benchmark (and where it fails)

madeleine bench runs an offline synthetic benchmark: 500 memories across 3 cities, 300 cues with known ground truth, distractors and hard negatives. The numbers below are for the offline hash text backend. Full tables, methodology and blind spots are in docs/benchmarks.md.

cue categorypull R@1pull R@10fires its memory (hit rate)precision of fires
place + hour0.570.600.810.56
text paraphrase only0.931.000.211.00
text + place + hour0.791.000.670.80
exact same photo / sound1.001.001.001.00
slightly altered photo / sound0.080.210.00–
memory several years old0.630.930.400.86
negatives (distractors, time-only, same place + other topic)false-trigger rate 0.00

Latency with 500 memories: sense p50 11 ms and p95 23 ms, in pure Python.

Honest limitations

  • Involuntary recall is tuned to be conservative: no negative cue fired, but only about half of positive cues fire their memory.
  • With the hash backend, text alone rarely intrudes (21 %) even when it is findable (R@10 = 1). Semantic embeddings ([text]) should help, but those numbers are not reported here yet.
  • Altered media never matches with the hash backend. That needs the CLIP and CLAP extras, and their similarity rescaling has only been calibrated on synthetic inputs.
  • Place + hour cues saturate (3 fires per cue), and only 56 % of those fall in the strict "same place, same hour ±1 h" ground truth.
  • The fusion is a hand-designed formula, not a learned one. The data is synthetic English text. There is no multi-user auth and no UI. The olfactory channel is a stub.
  • Hour-of-day uses each timestamp's own UTC offset. Send local offsets (+02:00), or "evening" means UTC evening.

Configuration

Env varDefaultMeaning
MADELEINE_DB~/.madeleine/madeleine.dbSQLite path (:memory: allowed)
MADELEINE_TEXT_BACKENDautoauto (sentence-transformers if installed), sentence-transformers, hash
MADELEINE_CHANNELSall built-insComma-separated enabled channels
MADELEINE_STORE_RAWoffPersist raw media bytes
MADELEINE_ALLOW_LOCAL_FILESoffLet media signals reference local files
MADELEINE_API_TOKENunsetBearer token for the HTTP API (and the hook's --url mode)
MADELEINE_ALLOWED_HOSTSloopbackExtra Host/Origin names accepted by the HTTP server

CLI: madeleine serve | remember | sense | recall | pending | forget | demo | bench | hook claude-code (madeleine --help).

As a Python library

from madeleine.config import load_config
from madeleine.core.serde import context_from_fields
from madeleine.engine import create_engine

engine = create_engine(load_config(db_path="memories.db", text_backend="hash"))
now = engine.now()
engine.remember("Ana proposed at the Eiffel Tower",
                context=context_from_fields(now=now, lat=48.8584, lon=2.2945, salience=0.9))
cue = engine.build_cue(context=context_from_fields(now=now, lat=48.8585, lon=2.2946))
for rec in engine.sense(cue):          # involuntary: fires on place (+ time) alone
    print(rec.to_prompt_line())

Write your own sense with an Adapter, an Embedder and a similarity function (docs/channels.md). ImageBind is deliberately not a dependency because its license is CC-BY-NC, but you can plug it in yourself as an Embedder.

Development

See CONTRIBUTING.md. Run uv sync once, then before every commit: uv run pytest, uv run ruff check src tests, uv run mypy. The architecture is in ARCHITECTURE.md and the design decisions are in docs/adr.

License

Apache-2.0. See LICENSE.

Frequently asked questions

What is madeleine?

Involuntary memory for agents: time, place, sound and IoT cues surface memories unasked

How do I install madeleine?

It runs on your machine. In Claude Code: claude mcp add madeleine -e 'MADELEINE_DB=<MADELEINE_DB>' -e 'MADELEINE_TEXT_BACKEND=<MADELEINE_TEXT_BACKEND>' -- uvx madeleine-mcp==0.1.0 serve. For other clients, paste the JSON configuration from this page into their MCP settings.

Does madeleine need an API key?

Its registry entry lists no required key or secret. Some features may still need an account with the service it connects to.

Is madeleine open source?

Yes. Its code is on GitHub under the Apache-2.0 license.

Who maintains madeleine?

It is published by fabianimv. AI.tn lists it but does not maintain or endorse it.

From the official MCP Registry. Listing is not an endorsement: review a server's code and permissions before giving it access to your data.