Skip to main content
Glama

halflife-mcp

PyPI Python License Oleg67/halflife-mcp MCP server

Agent memory that forgets on purpose. Memories fade unless used, inferences stay provisional until confirmed, and corrections supersede instead of overwriting, all in plain Markdown files on your own machine.

A preference is stored, corrected, and the old version archived with a link to its replacement

Local long-term memory for AI agents, served over MCP. It runs on your own laptop: no account, no cloud service, no telemetry. Works with any MCP client that can launch a stdio server, such as Claude Code, Claude Desktop, Cursor, Zed or VS Code.

The agent gets five kinds of memory:

Kind

Holds

Fades (half-life)

preference

how you like things done ("use uv, not pip")

180 days

procedural

workflows that worked ("release = tag, then make release")

365 days

fact

durable facts not in the code or docs

180 days

episodic

what happened in a past task: goal, decisions, open items

30 days

trace

short-lived log of files/commands, for resuming work

7 days, deleted after 30

Memories you use get reinforced and stay. Unused ones fade and are archived: moved, never silently deleted. Inferred memories stay provisional (hidden) until confirmed. A correction supersedes the old memory instead of contradicting it.

Install

You need uv. Then add the server to your client.

Claude Code

claude mcp add memory --scope user -- uvx halflife-mcp

Claude Desktop (Settings → Developer → Edit Config → claude_desktop_config.json), Cursor (~/.cursor/mcp.json) and most other clients use the same shape:

{
  "mcpServers": {
    "memory": {
      "command": "uvx",
      "args": ["halflife-mcp"]
    }
  }
}

If the client can't find uvx, put its absolute path in command (which uvx).

Local HTTP mode

For clients that connect by URL instead of launching a command, run the server yourself:

uvx halflife-mcp serve --http  # http://127.0.0.1:8765/mcp
claude mcp add --transport http memory http://127.0.0.1:8765/mcp  # e.g. Claude Code

There is no authentication, so it listens on loopback only: other machines can't reach it. Requests whose Host or Origin isn't local are rejected, which stops a web page from talking to it. --port changes the port. A non-loopback --host is refused unless you pass --allow-network; don't use that flag on a network you don't control.

claude.ai (web/mobile) can't use this. Its custom connectors are called from Anthropic's servers, so they can't reach your localhost. They need a public HTTPS URL with authentication, which this project doesn't provide.

The default install is light: keyword (BM25) and graph search, with no ML dependencies. For semantic matching (finding "k8s workloads" from a memory about "the kubernetes cluster"), use the vector extra:

"args": ["--with", "fastembed>=0.4", "--with", "numpy>=1.24", "halflife-mcp"]

This adds fastembed (ONNX, CPU only). The first start downloads a 65 MB model (BAAI/bge-small-en-v1.5); after that it runs offline. Existing memories are embedded automatically.

Related MCP server: heropen

Tools

Tool

What it does

memory_brief(scope?)

Start-of-task pack: top preferences and procedures, the strongest facts, recent episodes (capped at 8/6/5/3)

memory_recall(query, scope?, k?, kinds?)

Hybrid search: keyword + vector + graph, fused by reciprocal-rank fusion. Read-only

memory_remember(kind, content, scope?, description?, provisional?, contradicts?, entities?, relations?, source?)

Store a memory; a near-duplicate reinforces the existing one instead

memory_reinforce(id)

A memory was confirmed or useful: confidence up, decay reset, provisional → active

memory_forget(id)

Permanently delete (file, graph, archived copy, index)

memory_get(id) / memory_list(scope?, kind?, status?) / memory_stats()

Inspect

The server sends the model instructions on when to use each tool. It should call brief and recall at the start of a task, remember preferences when you state them, write an episode at the end, and forget on request. Memory only works as well as the model follows them, because an MCP server can't see the conversation. If memory isn't being used, tell the agent "check your memory" or "remember that…".

Scope. Pass the project path as scope and it is normalized to the git root, so subfolders share one project memory. Omit it, or use global, for things that apply everywhere. Project queries include global memories but not other projects' memories. Scope keeps memory organized; it is not access control: any connected client can ask for any scope, and project paths that differ only in punctuation (my-app, my_app) share one scope.

Where your data lives

OS

Default location

Linux

~/.local/share/halflife (or $XDG_DATA_HOME/halflife)

macOS

~/Library/Application Support/halflife

Windows

%APPDATA%\halflife

Set HALFLIFE_HOME to put it elsewhere, for example a synced folder.

memories/<scope>/<name>.md            one memory per Markdown file: readable, editable, greppable
memories/<scope>/_graph/<name>.json   its entities and relations
memories/<scope>/_archive/            faded and superseded memories
index.sqlite3                         derived index (SQL, vectors, graph); rebuildable
models/                               embedding model (vector extra only)

The Markdown files are the source of truth. Edit or delete them by hand and the index catches up on the next call. halflife-mcp rebuild recreates the index from the files.

Privacy

  • Memories are stored only on your machine, and the server makes no network calls apart from the one-time model download with the vector extra. But whatever the agent recalls goes into its prompt, so a client that uses a cloud model sends those memories to its provider.

  • Writes that look like secrets are refused, not redacted. That covers API keys, tokens, passwords, private keys, user:pass@ URLs and JWTs.

  • memory_forget deletes for real, including archived copies.

  • The data directory is created with mode 0700.

CLI

uvx halflife-mcp stats              # what's stored, where
uvx halflife-mcp brief --scope ~/code/my-app
uvx halflife-mcp recall "how do we deploy" --scope ~/code/my-app
uvx halflife-mcp maintain           # archive faded, expire traces
uvx halflife-mcp rebuild            # rebuild the index from files

Configuration

Variable

Default

HALFLIFE_HOME

per-OS path above

data directory

HALFLIFE_EMBED

on (if the extra is installed)

off disables vector search

HALFLIFE_EMBED_MODEL

BAAI/bge-small-en-v1.5

another fastembed model (recall thresholds are tuned for the default)

Development

uv venv && uv pip install -e ".[vector]" pytest anyio
.venv/bin/python -m pytest -q

uvx --from <local path> caches the built package. After changing the code, run it once with uvx --no-cache --from …, or use the editable venv's .venv/bin/halflife-mcp as the client command.

License

Apache License 2.0; see the LICENSE file.

Available Tools

8 tools
memory_briefA
Read-only

What to know before starting work: the top preferences (up to 8) and procedures (6), the strongest facts (5) and the most recent episodes (3) for this scope (plus global). Bodies are clipped; use memory_get for a full memory.

Inputs: scope. Returns: object

memory_forgetA
Destructive

Permanently delete a memory (file, graph, archived copy, index). Only when the user asks to forget something.

Inputs: id (required). Returns: object

memory_getB
Read-only

One memory in full, with its metadata and graph.

Inputs: id (required). Returns: object

memory_listA
Read-only

List memories of a scope (plus global), newest first. status: active | provisional. Use when the user asks what you remember.

Inputs: kind, limit, scope, status. Returns: object

memory_recallA
Read-only

Search memory with hybrid keyword + vector + graph ranking. query: a short description of the task or question (names of files, tools and projects help). kinds defaults to all except trace. Returns the best matches, best first, with the signals that found them. Read-only.

Inputs: query (required), k, kinds, scope, +1 more. Returns: object

memory_reinforceA

A memory was confirmed or proved useful: raises its confidence, resets its decay and activates it if provisional.

Inputs: id (required). Returns: object

memory_rememberA

Store one memory. kind: preference | procedural | fact | episodic | trace. content: the memory itself, short (for preference/procedural include why and how to apply). description: one keyword-rich line (used for matching; defaults to the first line). provisional: true when inferred rather than stated by the user. contradicts: id of a memory this one replaces. entities: [{"name", "type"}] for the specific files/tools/projects/people/concepts it is about (type: file, repo, tool, library, service, person, concept, ticket, command, project, organization). relations: [{"src", "rel", "dst"}] between those entities (rel: uses, depends_on, part_of, configures, fixed, caused, contradicts, supersedes, related_to, owns, prefers). source: where it came from (URL, file path). A near-duplicate reinforces the existing memory instead of creating a new one.

Inputs: kind (required), content (required), name, scope, +7 more. Returns: object

memory_statsB
Read-only

Counts per scope, kind and status; where the data lives; whether vector search is on.

Inputs: no named parameters. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 8 tools

    Disambiguation4/5

    The verbs are largely distinct: remember/get/forget/reinforce/stats are unambiguous. However, memory_recall, memory_list, and memory_brief all surface memories and could be confused—recall is query-driven search, list is scoped enumeration, and brief is a curated pre-work digest. The descriptions do clarify the boundary, so it's a minor overlap rather than a real ambiguity.

    Naming Consistency5/5

    Every tool uses the same memory_ prefix followed by a short, readable suffix (recall, reinforce, forget, get, list, stats, brief, remember). The pattern is uniform throughout with no casing or convention drift.

    Tool Count5/5

    Eight tools is well-scoped for a memory subsystem, with each tool earning its place (store, search, get, list, stats, reinforce, forget, brief). Nothing feels padded or missing.

    Completeness5/5

    The lifecycle is fully covered: create (remember), read (get/list/recall/brief), reinforce, and delete (forget), plus stats. Updates are handled via the contradicts/supersedes fields and reinforcement, so there is no dead end for the memory domain.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Provides a local, persistent long-term memory service for MCP-compatible AI agents, enabling them to store, search, and recall information across sessions.
      1
      GPL 3.0
    • A
      license
      Not graded
      quality
      B
      maintenance
      A local memory server for AI agents that stores and retrieves information via MCP, keeping all data in SQLite on your machine.
      53 PyPI
      1
      Apache 2.0
    • A
      license
      C
      quality
      A
      maintenance
      Provides AI agents with a human-inspired memory layer via MCP, enabling episodic and semantic memory recall, forgetting curves, consolidation, and contradiction detection. It integrates with MCP clients to offer local-first, dependency-free memory management.
      98
      1
      MIT
    • A
      license
      C
      quality
      C
      maintenance
      Local-first, governable long-term memory for AI agents. Provides SQLite-backed storage, cross-session recall, and traceable memory corrections through a standard MCP interface.
      40
      1
      MIT