# memharness [Health: Active]

**Category:** 🧠 Knowledge & Memory  
**Repository:** https://github.com/las7/memharness  
**GitHub Stars:** 6  
**npm Downloads (last month):** 207  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/memharness

## Description
Bi-temporal, provenance-carrying long-term memory for AI agents, in one SQLite file.

## Tools
Capabilities this server exposes over MCP:

- **remember** — Store ONE atomic fact in long-term memory: a single assertion, ideally one sentence (aim for under 250 characters; writes over 1500 are rejected). Split compound knowledge into multiple remember calls so each piece can be revised independently later. Use for durable knowledge about the user, their projects, preferences, decisions, and environment — not transient task state. If this contradicts an existing belief, find it with recall and use revise instead. Always fill source_ref with where this came from (session, file, URL) if known. If the fact describes code you just read at a known commit, also set source_commit (and source_path) so staleness checking can flag it when the repo moves past that commit.
- **recall** — Retrieve relevant memories. A plain call returns current beliefs ranked by relevance × confidence × importance × recency (recency is freshened each time a fact is recalled). as_of (ISO date, e.g. '2026-06-01') returns what was believed AT THAT TIME — including facts since revised or retracted. Use as_of to answer 'what did you think before I corrected you?'. subject filters to one entity; kind filters to semantic/episodic/procedural.
- **revise** — Replace a belief with an updated one. The old fact is closed and linked to its successor — history is preserved, never deleted. Use when the user corrects you or circumstances change. Find the old fact's id with recall first. valid_from can backdate when the new state actually began (e.g. 'moved last month'). importance and kind are inherited from the old fact unless you override them.
- **diff** — What changed in memory since a given ISO date: new facts learned, beliefs revised, facts retracted. The 'what have you learned about X since Monday?' query.
- **why** — Full provenance and revision chain for a fact: where it came from, when it was learned, what it superseded, and what superseded it. Use to answer 'why do you believe that?' or to audit a belief before revising it.
- **forget** — Retract a fact by id, or retract EVERYTHING from a given source_ref (provenance-based deletion: 'forget everything from that session'). Tombstoned, not erased: as_of queries before the retraction still show history; current recall never returns it.
- **stats** — Memory database statistics: counts, top subjects, schema version, db path.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "memharness": {
    "command": "npx",
    "args": ["-y","@memharness/mcp"],
    "env": {
      "MEMHARNESS_DB": "",
      "MEMHARNESS_HYBRID": "",
      "XDG_DATA_HOME": ""
    }
  }
}
```

**Requires environment variables:** `MEMHARNESS_DB`, `MEMHARNESS_HYBRID`, `XDG_DATA_HOME` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## What memharness does

The memharness MCP server stores atomic facts for AI agents in SQLite rather than treating memory as an undifferentiated text archive. Each fact can include confidence and provenance, including who supplied it, where it came from, and when it was recorded. The data model separates when a fact was true from when the agent learned it, allowing historical queries about past beliefs.

The memharness MCP server is designed for cases where memory must remain inspectable. Corrections supersede earlier facts and preserve the revision chain. This supports questions such as what the agent believed at a particular time, what changed after a given date, and why a fact is currently trusted. Provenance-based forgetting can remove records by fact ID or source.

## How it works

The server uses a local SQLite database and has no background daemon, model dependency, or network requirement in its storage path. The default database is `~/.memharness/memory.db`, with the location configurable through `MEMHARNESS_DB`; Linux installations also honor `XDG_DATA_HOME`.

Current recall uses SQLite FTS5 keyword search, confidence, and recency ranking. Queries can use an `as_of` time to reconstruct beliefs as held at an earlier transaction point. A substring fallback handles partial words and typos. Optional hybrid recall adds a local BGE-small embedding model, downloaded once from Hugging Face and then used offline; it is not installed by default.

## Setup and configuration

Install and launch the stdio package with `npx -y @memharness/mcp`. Claude Code can register it with `claude mcp add memharness -- npx -y @memharness/mcp`. Claude Desktop and Cursor use an MCP configuration containing the `npx` command and package argument, while Codex uses the equivalent TOML configuration.

The first `remember` call creates the database. No API key or signup is needed. To enable semantic recall, install `@memharness/embed` alongside the MCP package and set `MEMHARNESS_HYBRID=1`. A bundled `memharness-context` command can also be used from a Claude Code SessionStart hook to inject relevant memories at session start.

## Tools and capabilities

The seven MCP tools are:

- `remember` records an atomic fact with confidence and provenance.
- `recall` returns ranked beliefs, optionally as they existed at a specified time.
- `revise` replaces a belief while retaining the earlier version.
- `diff` reports facts learned, revised, or retracted since a date.
- `why` returns provenance and the fact's revision chain.
- `forget` tombstones a fact by ID or removes memories associated with a source.
- `stats` reports counts, subjects, and the schema version.

The underlying TypeScript packages also provide a library interface through `@memharness/core`. The optional `@memharness/embed` package supplies semantic indexing for hybrid recall.

## Limitations and notes

The memharness MCP server does not automatically extract facts from raw conversations. A client, agent, or skill must decide what should be stored and call `remember`. It is therefore a storage and retrieval layer, not an LLM-based memory ingestion service.

For small, static histories that fit comfortably in a prompt or `CLAUDE.md`, a simpler file may be more appropriate. Hybrid recall requires an optional model download of roughly 130 MB, and the default keyword mode remains fully offline without that package. The server uses stdio transport as described in the setup instructions.

_Full upstream README: https://allmcps.com/mcp/memharness/readme_

