Skip to content
andrkelemenPublic

About

Agent memory substrate — hybrid SQLite FTS5 + vector retrieval. Dual-mode MCP server (library or multi-agent service).

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

wmem

Memory + identity + judgment for AI agents. One SQLite file. Zero API cost.

Runs two ways:

  • As a personal MCP companion (single-user, zero-infra): stdio MCP, one agent, local SQLite. npx wmem init.
  • As a multi-agent memory service: node server.mjs exposes an HTTP API with optional bearer-token auth on writes, shared DB across MCP clients, agent-to-agent mail, capability registry, runtime identity switching for operator sessions.

One codebase, two deployment patterns. Library-mode users can ignore the service-mode tools entirely (the mail_*, capability_*, agent_* MCP surface).

Quick Start

npx wmem init

One command. It installs dependencies, imports your CLAUDE.md, indexes your existing sessions, creates a personality, registers the MCP server through claude mcp add, and registers the hooks — then verifies each of those rather than reporting that it tried.

Preview everything first:

npx wmem init --dry-run

Then start a new session (hooks only fire on the next one), and check they actually ran:

wmem doctor --hooks
SessionStart  registered       last fired 2026-10-26 13:45:31
SessionEnd    registered       last fired 2026-10-26 13:45:30
PostToolUse   registered       NEVER FIRED

registered and last fired are reported separately on purpose. Registered and never fired is a real state, and without this view it is indistinguishable from a quiet one — which is how three features sat dead for months behind an unregistered hook (#16).

The CLI

command what it does
wmem run as an MCP server over stdio — this is what Claude Code invokes
wmem init the full setup above (scripts/setup.mjs)
wmem doctor integrity, status, --secrets, --hooks, --dedup
wmem hooks register/verify hooks only — --uninstall, --print-only
wmem help the list

As a Claude Code plugin

The plugin's own hooks are still bash — Linux and macOS only for now. plugins/wmem/hooks/ registers Setup, SessionStart, SessionEnd and PreCompact as .sh files. On Windows those do nothing, silently, which is the whole of #19 in the one install path this README used to list first. The scripts/ route above is node and works everywhere. Port tracked as a follow-up.

claude plugins marketplace add github.com/andrkelemen/wmem
claude plugins install wmem@wmem

The plugin ships two skills (using-wmem, wmem-compact-protocol) and slash commands (/recall, /chunks, /projects, /wmem-doctor). Run npx wmem init once alongside it for the database, the personality and the hooks.

From a clone

git clone https://github.com/andrkelemen/wmem.git && cd wmem
node scripts/setup.mjs --agent myname

Same installer. wmem init is an alias for it, not a second path — there is exactly one.

Windows, macOS, Linux

The hooks installed by wmem init are node, not shell. They used to be .sh files that used bash-only syntax and shelled out to python3 for JSON, so on a Windows host they silently did nothing (#19). Node is already a hard dependency of wmem, which makes it the one interpreter guaranteed to be present wherever wmem runs at all.

Not yet true of the plugin route. plugins/wmem/hooks/ is still four .sh files, so claude plugins install is Linux and macOS only until that is ported. Said plainly here because a route that silently does nothing is worse than one that is not offered.

Why

AI agents forget. Every compaction, every restart — knowledge is lost. wmem fixes this with a layered memory system, hybrid search, and three features nobody else has:

  1. Personality switching — change who the agent IS, not just what it remembers
  2. Proactive behavior — AI that knows when to speak and when to shut up
  3. Knowledge graph — relationships emerge from data, no graph database needed

Features

One-Command Setup

npx wmem init --agent myname

Detects OS, verifies node, installs deps, imports existing files, indexes sessions, creates a personality, registers the MCP server via claude mcp add, registers the hooks — then verifies each of those by reading back what is on disk rather than reporting that it tried. Linux, macOS, Windows.

Hybrid Search (FTS5 + Vector + Session Dedupe)

Multi-stage retrieval in one SQLite file. memory_search auto-routes based on what's in the DB — hybrid when vectors exist, tag-boosted FTS5 otherwise.

  • FTS5 keyword search — exact match, <10ms, zero cost
  • Tag boost — chunks whose auto-tags match query-derived tags rank higher (always on, no flag)
  • Query expansion — 200+ synonym mappings, zero LLM
  • sqlite-vec semantic search — local bge-large (1024d) or MiniLM (384d) embeddings (pre-1.0 at ^0.1.9 — fine for personal-scale; flag before broader deployment)
  • Hybrid mode — position-normalized merge of BM25 + cosine similarity, plus 2x boost for user-message chunks
  • Session dedupe — top-K returns K distinct sessions, not K chunks (better coverage for multi-session and temporal questions)
  • Cross-encoder reranker — ms-marco-MiniLM-L-6-v2 (22MB), available in scripts/benchmark-experimental.mjs for offline runs; off in the interactive MCP path
  • Sub-query splitting — "how many days between X and Y" → search X and Y independently

Benchmark scripts are in scripts/ for anyone who wants to measure on their own workloads.

Personality Switcher

Switch who the agent IS. Each personality has its own memories, voice, capabilities, and decision thresholds.

node scripts/personality.mjs create dev --template coder
node scripts/personality.mjs create planner --template architect
node scripts/personality.mjs use dev                                # instant switch
node scripts/personality.mjs update dev --voice "Terse. No hedging." # tweak in place
node scripts/personality.mjs create dawn --interactive              # guided Q&A

Built-in templates: coder, architect, reviewer, writer, researcher, confidant.

Eleven commands cover the full lifecycle: list, use, create (with --template and/or --interactive), update, show, active, delete, templates, import, export. See docs/personalities.md for the full reference, the JSON export schema, and how personality files / decision config layer on top.

Export/import as JSON. Share personalities between machines.

Proactive Personalities (Decision Engine)

Deterministic silence decisions. Asking an LLM whether to speak makes the model the judge of its own output — the decision and the output get coupled. Move the decision into a state machine with auditable thresholds instead. Don't ask the model. Build a state machine.

Four output modes:

  • SILENCE — do nothing (default, most common)
  • NOTIFY — logged, searchable, not pushed. "Worth remembering but not worth saying."
  • SPEAK — deliver via preferred channel
  • ACT — execute action without speaking

Each personality defines its own thresholds:

{
  "decision": {
    "actionThreshold": 0.6,
    "cooldownMinutes": 15,
    "quietHours": [1, 7],
    "salienceModifiers": { "error": 1.3, "task_failed": 1.5 },
    "responseStyle": { "maxWords": 10, "register": "technical" }
  }
}

Same event, different personality, different behavior. Coder stays silent during focus. Researcher proactively shares findings. Writer barely speaks at all.

Knowledge Graph

Relationships emerge from co-occurrence. No graph database.

# "What relates to authentication?"
graph_related → direct tag matches + co-occurring chunks from same sessions

# "What topics appear alongside auth?"
graph_topics → deployment (63 sessions), config (68), api (64)

# "How does auth relate to deployment?"
graph_path → strong (10 shared sessions), connecting chunks shown

Four node types: topic, directory, project, agent. Unified kg_relations table with typed edges. Directories auto-detect project from git remote. Related directories discovered by shared project, tag overlap (3+), or time proximity (24h).

Pure SQLite queries over existing tags + sessions tables. <50ms.

Shared Memory + Privacy

Cross-personality shared memory with privacy controls.

  • _shared — all personalities see it (projects, decisions, facts)
  • private — only this personality (conversations, session history)
  • personal — locked, cannot be shared. Ever.

memory_share copies to shared. memory_personal locks permanently.

Universal Importer

Import whatever you already have. No reformatting.

# Dry run — preview sections + classifications
node scripts/setup.mjs --agent myname --dry-run

# Handles: markdown (.md), plain text (.txt), CLAUDE.md section splitting
# Classifies: personality vs memory vs config (with confidence scores)
# Low confidence → flagged for review, not guessed
# Atomic: whole file imports or none (SQLite transaction)
# Source tracing: file + section + line number in metadata

Auto-Tags

25 topic + action patterns, generated on insert. No manual organization.

Tags: auth, debugging, deployment, decision, fix, shipped, api, database, performance, security, frontend, testing, config, networking, automation, observability, and more.

Session-Aware Indexing

  • Incremental — byte-offset tracking, only reads new content
  • Session-partitioned — query by session or across all
  • Crash-safe — validates trailing lines before advancing offset

L1 Hot Memory Block

Auto-generated context loaded on every session start. Zero API cost.

TEMPORAL ANCHOR:       Today, agent age
PERSONALITY:           System prompt + voice + always-load files
CAPABILITIES:          Manually maintained list
RECENT SESSIONS:       Time-windowed compression (2h/6h/18h)
CROSS-FOLDER PICK-UP:  "you were also working on X in another folder" (v1.3)
PROJECTS:              Active/shipped/blocked state

~1,200 tokens. >95% of context window stays free.

The CROSS-FOLDER PICK-UP section is fed by session_bookmarks (written on SessionEnd by scripts/session-end-bookmark.mjs) and surfaces parallel work from other directories — same project, shared topics, or recent time overlap.

Personality Files

Named documents per personality (identity notes, preferences, style guides). Stored in DB, travel with personality on export.

Mark as always_load: true → injected into L1 every session.

Multi-Instance Safety (v1.2)

Run one canonical master + N read-only mirrors without forking the dataset.

  • Role gate — every wmem instance stamps itself master / mirror / unknown at first boot (default master for single-user; override WMEM_ROLE=mirror on follower boxes). Non-master writes get 403 wmem_role_not_master.
  • /api/wmem/role — clients check before writing; surfaces hostname + set-by metadata.
  • POST /api/write dispatcher — single endpoint covering 22 admin ops (projects, sessions, personality core/traits, memory share). One server-side allowlist, one gate, no per-op route sprawl.
  • wmem-outbox daemon — local proxy at :18421. MCP/scripts post writes to it instead of straight upstream. Forwards while master reachable, buffers to local SQLite when not, drains on reconnect with exponential backoff + dead-letter. Survives upstream outages without losing writes.

Library-mode users see no change — master is auto-stamped, writes work as before. Multi-instance topologies opt in by setting WMEM_ROLE=mirror on followers and running modules/wmem-outbox/install/install.sh on each.

See modules/wmem-outbox/README.md and migrations/0010_wmem_role.sql.

Configuration

Ports

What Default Set via
HTTP server (node server.mjs) 18420 PORT= env, or port in wmem.config.json
Outbox daemon listen 18421 WMEM_OUTBOX_PORT= env, or outboxPort in wmem.config.json
Outbox → upstream 127.0.0.1:18420 WMEM_UPSTREAM_HOST= + WMEM_UPSTREAM_PORT= env, or upstreamHost + upstreamPort in config

Defaults sit at 18420/18421 to avoid collision with Angular CLI (4200), Vite (5173), and other common dev ports.

Interactive port picker — probes candidates, prompts if taken, writes wmem.config.json:

node scripts/configure-ports.mjs                 # interactive: probe + prompt
node scripts/configure-ports.mjs --port 19420    # non-interactive
node scripts/configure-ports.mjs --print         # show resolved config

wmem.config.json is gitignored (per-machine). wmem.config.example.json ships as the template. Env vars always win over the file, which always wins over the default.

Where the database lives

~/.wmem/memory.db, and every component resolves it the same way — the MCP server, the hooks and the migration runner all call one resolver. Before v1.3.1 they did not: the hooks defaulted to ~/.wmem/memory.db while the server was registered against <install>/data/memory.db, so sessions were written to one store and searched for in another, with nothing reporting an error.

  • MEMORY_DB wins when set, and a relative value is made absolute against the working directory. A cwd-relative default is how you get a new empty database per folder, so there is no longer one.
  • setup.mjs writes MEMORY_DB into ~/.wmemrc, which both halves read. That is the only channel that reaches a hook, which is handed no environment at all.
  • Upgrading moves nothing. A populated database in any previously-defaulted location is found and kept; if two of them hold data, wmem doctor --status names both and refuses to choose for you.

The database is deliberately not inside the install directory: WMEM_ROOT can be an npx cache or a node_modules folder that a reinstall deletes.

Other env vars

Var Purpose Default
MEMORY_DB SQLite DB path ~/.wmem/memory.db — see Where the database lives
WMEM_TOKEN_FILE Bearer-auth token file path ./.wmem-token (auth disabled if file missing)
WMEM_ROLE Force role master/mirror/unknown at boot auto-detect → master for single-user
WMEM_OUTBOX_* Outbox tuning (tick, batch, backoff, dead-letter) see modules/wmem-outbox/README.md
WMEM_CALLER Session identity. Set per MCP server entry, not globally unset → NULL attribution
WMEM_AGENT Agent whose memory this session reads and writes active personality, else default
WMEM_ADMIN Allows acting as another agent. Read lazily, so a flip needs no restart unset

Running more than one agent on one machine: give each MCP server entry its own WMEM_CALLER. stdio is process-per-connection, so the environment variable is the session identity, and attribution in the shared store comes from it. Agent keys are canonicalised (trimmed, lower-cased) at every writer, so Alice and alice are one agent rather than two halves of one history (#13) — including on both ends of a mail address, where a mismatch makes a message invisible rather than mis-filed.

Architecture

wmem/
├── core/
│   ├── db.mjs              ← SQLite + FTS5 + sqlite-vec + tags + sessions + aliases + privacy + kg_relations
│   ├── indexer.mjs          ← incremental JSONL indexer + auto-agent detection
│   ├── importer.mjs         ← universal file importer (markdown, text, CLAUDE.md)
│   ├── context.mjs          ← L-tier classification + validation + compression
│   ├── embeddings.mjs       ← local embeddings (transformers.js, all-MiniLM-L6-v2)
│   ├── autotag.mjs          ← pattern-based auto-tagging (40+ categories)
│   ├── personality.mjs      ← personality CRUD, files, activation, L1 integration
│   ├── decision.mjs         ← proactive behavior engine (salience + thresholds)
│   ├── graph.mjs            ← knowledge graph (topic/directory/project/agent nodes)
│   ├── expander.mjs         ← query expansion (200+ synonym mappings, zero LLM)
│   ├── facts.mjs            ← regex-based fact extraction (25+ patterns)
│   ├── temporal.mjs         ← date resolver (yesterday, last tuesday, N days ago)
│   ├── subquery.mjs         ← sub-query splitting for multi-event temporal
│   └── doctor.mjs           ← integrity checks, recovery, purge, checkpoints
├── scripts/
│   ├── setup.mjs            ← one-command setup (9 steps, cross-platform)
│   ├── index-sessions.mjs   ← CLI: indexing + --auto-agent + --merge aliases
│   ├── generate-l1.mjs      ← CLI: generate L1 hot memory block
│   ├── personality.mjs      ← CLI: create, use, list, show, export, import
│   ├── doctor.mjs           ← CLI: status, health check, fix, dedup, purge, recover
│   ├── import.mjs           ← CLI: import external files with tier placement
│   ├── session-start-hook.sh ← Claude Code hook: index + L1 + personality
│   └── session-end-hook.sh  ← Claude Code hook: index new content
│   ├── benchmark-ingest.mjs  ← ingest LongMemEval into wmem DB
│   └── benchmark-retrieval.mjs ← benchmark retrieval (keyword/expanded/hybrid/full)
├── mcp-server.mjs           <- MCP server (69 stdio tools)
├── server.mjs               <- HTTP service (read endpoints + 22-op /api/write dispatcher, v1.2)
├── modules/wmem-outbox/     <- local proxy daemon for multi-instance topologies (v1.2)
├── server.mjs               ← HTTP API server (Express, optional)
├── capabilities.md          ← what the agent can do (manually maintained)
├── LICENSE                  ← MIT
└── data/                    ← SQLite DB (gitignored)

Tools

wmem exposes 69 stdio MCP tools (library mode) and an additional HTTP surface when running server.mjs (service mode, v1.2+):

  • 69 stdio MCP tools — full inventory below, organised by domain
  • HTTP read endpoints — /api/search, /api/recent, /api/stats, /api/mail/*, /api/wmem/role, /health
  • HTTP write endpoints — /api/ingest, /api/amend, /api/import, /api/reimport, /api/preferences/write, /api/facts/write, /api/capabilities/*, /api/mail/send
  • HTTP dispatcher /api/write (22 ops, v1.2) — memory.{amend,share,personal}, project.{upsert,ship,scope.*}, session.file.touch, personality.{upsert,delete,enable,sfw,activate,file.set}, personality.core.{add,update,delete}, personality.trait.{add,update,enable,disable,delete,promote}
  • Outbox admin (when running modules/wmem-outbox/) — /health, /role, /admin/{drain,outbox,outbox/dead-letter}

All write endpoints are gated by the role middleware (refuses 403 on non-master instances). See docs/mcp-tools.md for the full HTTP surface.

MCP stdio tools (69)

Tool Description
Memory
memory_search FTS5 keyword search (scope: default/private/shared/all, snippet previews)
memory_ingest Store content manually
memory_l1 Generate L1 hot memory block
memory_capabilities Return capabilities list
memory_recent Recent chunks by agent
memory_stats Index statistics
memory_share Share a chunk across all personalities
memory_personal Lock a chunk to this personality (cannot be shared)
memory_import Import a file or raw text (section splitting, auto-tags, source tracing)
memory_delete Delete a chunk (preview first, confirm to execute)
memory_last_session Where did we leave off? Current dir + parallel work across directories
memory_sessions List recent session bookmarks by project/agent
Projects
project_update Create/update project state
project_ship Mark project as shipped
project_list List projects by status
Personality
personality_use Switch active personality (atomic, with checkpoint)
personality_list List all personalities
personality_create Create new (with templates + decision config)
personality_show Show personality details
personality_file_set Create/update personality file
personality_file_list List personality files
Knowledge Graph
graph_related Find chunks related to a topic
graph_topics Find co-occurring topics
graph_path Relationship between two topics
graph_map Full topic graph (nodes + edges)
System
wmem_status Full status report (chunks, sessions, agents, DB size)
wmem_doctor Integrity checks (orphans, duplicates, stale sessions)
wmem_dedup Remove duplicate chunks

What's Shipped

  • One-command setup (node scripts/setup.mjs --agent myname)
  • MCP server with 69 tools, registered via claude mcp add
  • Hybrid search (FTS5 keyword + sqlite-vec semantic + cross-encoder reranker)
  • Query expansion (200+ synonym mappings, zero LLM)
  • Cross-encoder reranker (ms-marco-MiniLM-L-6-v2, 22MB local model)
  • Sub-query splitting for multi-event temporal questions
  • Fact extraction (25+ regex patterns: name, age, location, etc.)
  • Temporal date resolver (yesterday, last tuesday, N days ago)
  • FTS5 snippet previews (match-anchored with >>>markers<<<)
  • FTS5 auto-OR for multi-word queries
  • Personality switching with 6 built-in templates + decision config
  • Personality files (named docs, always-load option)
  • Shared memory + privacy controls (private/shared/personal)
  • Proactive behavior engine (salience scoring, 4 output modes)
  • Knowledge graph (co-occurrence, 4 graph tools)
  • Universal importer (markdown section parsing, classification, atomic)
  • Manual document import CLI + MCP tool (scripts/import.mjs)
  • Session-aware incremental indexing (byte-offset, streaming 8MB chunks)
  • Auto-agent detection (content scan + CLAUDE.md on disk + path fallback)
  • Agent alias system (--merge false positives, retroactive re-tag)
  • No file size limit (300MB+ sessions in constant memory)
  • 40+ category auto-tagging (tech + personal/life categories)
  • Session bookmarking ("where did we leave off?" with cross-directory awareness)
  • Unified knowledge graph (topic/directory/project/agent nodes, materialized edges)
  • Benchmark scripts (LongMemEval ingest + retrieval)
  • L-tier validation (classify, validate, idempotent compression)
  • L1 hot memory block generator
  • Atomic personality switch (transaction + checkpoint + restore)
  • Crash recovery (session health check, auto-recover on startup)
  • Safe delete/purge (cascade, dry-run, --force gates)
  • Doctor CLI + MCP (wmem_status, wmem_doctor, wmem_dedup)
  • Session hooks (SessionStart + SessionEnd)
  • Preamble stripping on ingest
  • Import registry with staleness detection
  • Cross-platform support (Linux, macOS, Windows)
  • MIT License
  • (v1.2) Multi-instance safety: wmem_role table + role gate (writes refused on non-master)
  • (v1.2) GET /api/wmem/role endpoint for client probes
  • (v1.2) POST /api/write generic dispatcher (22 ops, server-side allowlist)
  • (v1.2) wmem-outbox daemon — local proxy with offline buffering + drain on reconnect
  • (v1.2) Interactive port picker (scripts/configure-ports.mjs) — probe + prompt + write wmem.config.json
  • (v1.2) Tests: role gate, dispatcher, outbox passthrough/buffer/drain
  • Preference signals aggregation (aggregatePreferences in core/db.mjs)
  • Batch purge size limit (500/batch under SQLite 999 param cap — core/doctor.mjs)

Roadmap

Shipped since this list was last touched — it was stale in both directions, claiming pending work that had landed and listing nothing that had been found since:

  • Session hooks auto-registration in the setup script
  • Hook-based auto-bookmarking on session end — the writer existed all along; the hook that reaches it did not
  • Hook-based KG materialization
  • Secret scanning in doctor (--secrets)
  • L1 pick-up prompt ("you were also working on X in another folder")
  • Build-tools / native-module detection in setup — it now proves better-sqlite3 loads, not that its directory exists, because a prebuilt binary for the wrong node ABI passes an existence check and then throws far from the cause

Still open:

  • Port the plugin route's hooks to node — plugins/wmem/hooks/ is Setup, SessionStart, SessionEnd and PreCompact as .sh, so #19 is fixed for scripts/ and open for plugins/. Includes PreCompact, which the node port does not yet have at all — and which is the natural WRITE side for the rulings memory_last_session reads, since the compact boundary is the one moment where "bank this now" has a deadline.
  • Mid-session L1 refresh (time-based, every 30min)
  • Drift supervisor — temporal anchor, capability staleness, fact contradictions; the signals are already in L1
  • wmem personality generate — interactive builder
  • personality update CLI (create/delete/use exist; update missing)
  • Plugin architecture for extending wmem
  • Speaker-attribution surface (writtenBy / about on the ingest path; schema exists in 0004_messages_and_written_by.sql)
  • Run wmem-eval and publish retrieval scores here
  • npm publish flow — files whitelist is in; version tagging and prepublishOnly are not
  • examples/multi-instance-walkthrough.mjs — runnable master + mirror + outbox demo
  • CI workflow (GitHub Actions running npm test on push and PR)
  • getStatus hashes every registered file on every call. Staleness is "sha256 of the file on disk differs from the stored hash", so it cannot be a SQL predicate, and the read is streamed rather than materialised — which bounds the footprint, not the work. At 37 registered transcripts that is nothing; at a few thousand it is hashing gigabytes on the call everything reaches for, and the memory fix makes that cost less visible rather than smaller. The fix is to compare statSync().mtimeMs and size against stored values first and hash only on a difference — two more columns on import_registry. Not built: at this table size it would be optimising something that has not grown, and a version that trusts mtime with no fallback is worse than hashing.
  • Independent agents on one instance — per-request identity exists on the HTTP path and reads route over it when WMEM_HTTP_URL is set, but writes still go direct to SQLite in-process, so sessions cannot yet share one server safely. Identity enforcement on the HTTP path comes first: it currently trusts X-Caller without checking it against the env anchor.

Examples

  • examples/preference-loop-walkthrough.mjs — runnable demo of the zero-LLM preference consolidation loop (tier 1 signals → tier 2 preferences → tier 3 facts). Observable output at each stage. Run against a scratch DB:
    MEMORY_DB=/tmp/wmem-pref-demo.db node examples/preference-loop-walkthrough.mjs

Documentation

Two behaviours that surprise people

wmem_dedup and doctor --dedup are a DRY RUN by default. They report what would go and delete nothing until force: true / --force, matching --purge-agent and --purge-personality, which have always required it. This is not caution for its own sake: on a 380,000-chunk store the preview revealed that dedup grouped without session_id while insertChunk dedups with it deliberately — so it would have removed 96,258 chunks, a quarter of the database, every one a false positive (#15). Making a destructive operation explain itself first is what found the bug.

memory_last_session returns rulings, not the tail. The five newest chunks by timestamp are whatever was executing when a session ended — a tool result, a file write, a status line. What a resuming session needs is the decision that changed the work, which was usually made hours earlier. So it returns the chunks somebody chose to bank — memory-chunk, observation, scene-digest, session-summary, identity — printed above the tail, with the tail labelled as not-a-decision. There is no classifier and no prose matching: deliberate writing is the only honest signal, because conversation rows arrive by the hundred thousand on their own. A session that banked nothing gets an empty list that says so, rather than the tail dressed up as a ruling.

memory_ingest's sourceType is an enum for this reason — if the vocabulary lives only in a description, a free-typed decision lands a chunk that recall can never return, and nothing at write time tells you.

Design Principles

  • L1 is a script, not a model call. Zero API cost. No hallucination risk.
  • FTS5 before semantic search. Cheapest layer first.
  • The memory system is invisible. The user sees remembering, not retrieval.
  • Memories organize themselves. Auto-tags, not manual folders.
  • Identity is portable. Export a personality, load it anywhere.
  • Silence is the default. AI that knows when to shut up.
  • Atomic imports. Whole file lands or none of it does.
  • Don't ask the LLM to decide silence. Build a state machine.

Secrets

wmem is not a password manager. By deliberate scope.

Encrypted-at-rest key-value storage (API tokens, credentials, private material) belongs in a specialized tool with a mature threat model. We recommend:

  • pass — GPG-backed, the UNIX-idiomatic answer
  • OS keychain — libsecret (Linux), Keychain (macOS), Credential Manager (Windows)
  • age / sops — file-level encryption
  • 1Password CLI / Bitwarden CLI — if you already use a password manager

What wmem does provide:

Secret pattern scanning + redaction. core/secret-patterns.mjs recognizes common shapes (OpenAI / Anthropic / GitHub / AWS / GCP keys, JWTs, bearer tokens, PEM blocks, password assignments). Used in two places:

  1. Amend and delete previews. When you call memory_amend or memory_delete on a chunk that contains a secret, the preview response redacts the secret before returning — so the secret never traverses an API response on its way to your review.
  2. Doctor scanner (coming) — wmem_doctor --secrets surfaces chunks where secrets were accidentally indexed so you can amend or delete them.

memory_amend tool. If you find a leaked credential in memory, amend replaces the content in place (regenerates tags, drops the vector, FTS re-syncs). The original content is NOT preserved — this is redaction, not revision history. See docs/mcp-tools.md.

The design discipline: wmem ingests a lot. Sometimes it ingests something it shouldn't have. Our job is to help you find and remove those, not to become a storage backend for the thing that got ingested.

History

The public repository starts at the point where the code was scrubbed for public release. Earlier development history is not published. Source of truth from the fork point forward is this repository.

License

MIT

About

Agent memory substrate — hybrid SQLite FTS5 + vector retrieval. Dual-mode MCP server (library or multi-agent service).

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages