Skip to content

Commit 433be90

Browse files
author
STARGA Inc
committed
release: v3.10.2 — canonical Memory Protocol snippet on install-all
mm install-all now writes the full memory-protocol system-prompt into every detected CLI's instructions file (AGENTS.md, .cursorrules, .windsurfrules, .clinerules, .roo/system-prompt.md) instead of the previous 1-line stub. Closes the gap audit found 2026-05-08: protocol-level MCP wiring is necessary but not sufficient. Without an explicit instruction the LLM in each CLI does not reliably call mcp__mind-mem__recall before answering, producing hallucinations on memory-grounded questions. Single source of truth: MEMORY_PROTOCOL_SNIPPET in hook_installer.py, mirrored at docs/agent-memory-protocol.md.
1 parent a42cf45 commit 433be90

6 files changed

Lines changed: 147 additions & 17 deletions

File tree

ANATOMY.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
> Re-generate with: `anatomy .`
66
77
**Project:** `mind-mem`
8-
**Files:** 738 | **Est. tokens:** ~1,507,695
9-
**Generated:** 2026-05-08 02:28 UTC
8+
**Files:** 739 | **Est. tokens:** ~1,508,637
9+
**Generated:** 2026-05-09 00:39 UTC
1010

1111
## Token Budget Guide
1212

@@ -30,7 +30,7 @@
3030
| `deploy/docker/` | 1 | ~495 |
3131
| `deploy/edge/` | 2 | ~1,149 |
3232
| `deploy/grafana/` | 1 | ~1,145 |
33-
| `docs/` | 64 | ~104,404 |
33+
| `docs/` | 65 | ~105,000 |
3434
| `docs/adr/` | 2 | ~521 |
3535
| `docs/design/` | 2 | ~2,416 |
3636
| `docs/security-baselines/` | 1 | ~18,974 |
@@ -56,7 +56,7 @@
5656
| `skills/integrity-scan/` | 1 | ~376 |
5757
| `skills/memory-recall/` | 1 | ~549 |
5858
| `src/` | 1 | ~280 |
59-
| `src/mind_mem/` | 155 | ~535,862 |
59+
| `src/mind_mem/` | 155 | ~536,208 |
6060
| `src/mind_mem/api/` | 5 | ~15,751 |
6161
| `src/mind_mem/mcp/` | 3 | ~3,960 |
6262
| `src/mind_mem/mcp/infra/` | 8 | ~6,924 |
@@ -170,6 +170,7 @@
170170
- `002-bm25f-scoring.md` (~205 tok, medium) — ADR-002: BM25F as Primary Scoring Algorithm
171171
### `docs/`
172172

173+
- `agent-memory-protocol.md` (~596 tok, large) — Agent Memory Protocol — canonical system-prompt snippet
173174
- `api-reference.md` (~1477 tok, large) — API Reference
174175
- `architecture.md` (~1936 tok, huge) — Architecture
175176
- `audit_response.md` (~956 tok, large) — MIND-Mem — response to the 2026-05-02 ecosystem audit
@@ -457,7 +458,7 @@
457458
- `governance_raft.py` (~2208 tok, huge) — Raft-style consensus wrapper for governance writes (v4.0 prep).
458459
- `graph_recall.py` (~1907 tok, huge) — Multi-hop graph traversal for recall (v3.3.0 Tier 1 #2).
459460
- `hash_chain_v2.py` (~5512 tok, huge) — # Copyright 2026 STARGA, Inc.
460-
- `hook_installer.py` (~9883 tok, huge) — # Copyright 2026 STARGA, Inc.
461+
- `hook_installer.py` (~10229 tok, huge) — # Copyright 2026 STARGA, Inc.
461462
- `http_transport.py` (~5592 tok, huge) — HTTP transport adapter for mind-mem (v3.9.0 candidate).
462463
- `hybrid_recall.py` (~8896 tok, huge) — mind-mem Hybrid Recall -- BM25 + Vector + RRF fusion.
463464
- `inbox.py` (~3595 tok, huge) — Inbox folder ingestion — `mm inbox-watch` (v3.9.0 candidate).

CHANGELOG.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,42 @@
22

33
All notable changes to MIND-Mem are documented in this file.
44

5+
## v3.10.2 — Canonical Memory Protocol injected on `mm install-all`
6+
7+
Released 2026-05-08. Closes a gap discovered during a sibling product
8+
audit: every CLI that `mm install-all` wires at the protocol level
9+
(MCP entry, hooks) now also receives the **canonical Memory Protocol
10+
system-prompt snippet** in its instructions file. Wiring without
11+
instruction was producing hallucinations because the LLM in each CLI
12+
wasn't told to actually call `mcp__mind-mem__recall` before answering.
13+
14+
### Added
15+
- `docs/agent-memory-protocol.md` — canonical text of the snippet,
16+
also rendered in this CHANGELOG section for searchability.
17+
- `MEMORY_PROTOCOL_SNIPPET` constant in `hook_installer.py`. Single
18+
source of truth.
19+
20+
### Changed
21+
- `AGENT_REGISTRY` `content_tmpl` values for **codex / vibe / cursor /
22+
windsurf / cline / roo** now point at `MEMORY_PROTOCOL_SNIPPET`
23+
(replacing per-agent 1-line stubs). Re-running `mm install-all
24+
--force` upgrades the user's existing `AGENTS.md` /
25+
`.cursorrules` / `.windsurfrules` / `.clinerules` /
26+
`.roo/system-prompt.md` files in place.
27+
- Aider (yaml `auto-config`) and claude-code (json hooks) keep their
28+
format-specific templates — they're not text system prompts.
29+
30+
### Why
31+
A 9-LLM consensus product based on OpenClaw was hallucinating on
32+
memory-grounded questions despite mind-mem's Postgres backend
33+
holding the right answers. Audit traced this to MCP wiring being
34+
present but the agent system-prompt only saying *"run `mm context`
35+
before responding"* — a 13-word stub. The new snippet is the full
36+
recall / propose_update / hybrid_search / hallucination-guardrail
37+
protocol that has been working for Claude Code via its `CLAUDE.md`.
38+
Anyone who `pip install mind-mem && mm install-all --force` now
39+
gets the same protocol on every supported CLI.
40+
541
## v3.10.1 — Vibe (Mistral CLI) MCP auto-wire
642

743
Released 2026-05-07. Adds the long-standing TODO Vibe MCP adapter so

docs/agent-memory-protocol.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Agent Memory Protocol — canonical system-prompt snippet
2+
3+
This is the **canonical** memory-protocol text that `mm install-all`
4+
writes into each detected CLI's system-prompt file (`AGENTS.md`,
5+
`GEMINI.md`, `.cursorrules`, `.windsurfrules`, `.clinerules`,
6+
`.roo/system-prompt.md`, `.aider.conf.yml`, etc.).
7+
8+
If you're operating a CLI that already has its own system prompt
9+
(`CLAUDE.md`, `AGENTS.md`, `GEMINI.md`, …), append this section. If
10+
you're starting fresh, this is the entire prompt.
11+
12+
The hook installer (`src/mind_mem/hook_installer.py`,
13+
`AGENT_REGISTRY`) reads `MEMORY_PROTOCOL_SNIPPET` from
14+
`hook_installer/memory_protocol.py` so a single canonical edit
15+
propagates to every wired agent.
16+
17+
---
18+
19+
## Memory Protocol (mind-mem MCP — USE CONSTANTLY)
20+
21+
The mind-mem MCP server is wired into this CLI. Before answering ANY
22+
question that touches prior work, decisions, project state, people,
23+
companies, technical choices, or "remember when..." — call mind-mem
24+
first. The governed blocks in mind-mem's Postgres backend are the
25+
source of truth.
26+
27+
### Always recall before answering
28+
Run `mcp__mind-mem__recall` (or `mm recall "$query"` via bash) with
29+
relevant keywords FIRST. If recall returns results, cite them. If
30+
not, say "no record found" — do not guess.
31+
32+
### Always propose_update after learning new facts
33+
When the user shares a new decision, project status, relationship,
34+
contact, or technical finding worth preserving — run
35+
`mcp__mind-mem__propose_update` to store it. Don't wait to be asked.
36+
37+
### Use hybrid_search for complex queries
38+
For multi-faceted questions, use `mcp__mind-mem__hybrid_search`
39+
(BM25 + vector + RRF fusion) for best recall.
40+
41+
### Hallucination guardrail
42+
If you find yourself writing about prior projects, repos, or
43+
decisions without having called recall in this session, you are
44+
about to hallucinate. Stop and call recall first.
45+
46+
---
47+
48+
## Why this exists
49+
50+
Audit on 2026-05-08 of a sibling product (a 9-LLM consensus engine
51+
also based on OpenClaw) showed it had its own internal memory plugin
52+
and **zero call paths to mind-mem MCP**. The result was repeated
53+
hallucinations on memory-grounded questions. Adding this prompt block
54+
into each CLI's system-prompt closes the gap by *instructing* the LLM
55+
to use the MCP tools that `mm install-all` wires at the protocol
56+
level.
57+
58+
Wiring without instruction is not enough. This file is the
59+
instruction half.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "mind-mem"
3-
version = "3.10.1"
3+
version = "3.10.2"
44
description = "Drop-in memory for Claude Code, OpenClaw, and any MCP-compatible agent."
55
readme = "README.md"
66
license = { text = "Apache-2.0" }

src/mind_mem/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
)
4444
from .storage import get_block_store
4545

46-
__version__ = "3.10.1"
46+
__version__ = "3.10.2"
4747

4848
# Best-effort import-time integrity check. Fails open unless
4949
# MIND_MEM_INTEGRITY=strict, so editable installs and source checkouts

src/mind_mem/hook_installer.py

Lines changed: 44 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,44 @@ def observation_to_block(
172172

173173
_MM_MARKER = "# mind-mem"
174174

175+
# Canonical Memory Protocol snippet — written into every detected CLI's
176+
# system-prompt file by ``mm install-all``. The companion document is
177+
# ``docs/agent-memory-protocol.md``; both must be kept in sync.
178+
#
179+
# Wiring at the protocol level (MCP entries) is necessary but not
180+
# sufficient — without an explicit instruction the LLM in each CLI does
181+
# not reliably call the MCP tools. This snippet is the instruction half.
182+
MEMORY_PROTOCOL_SNIPPET = (
183+
f"{_MM_MARKER}: agent instructions (auto-written by `mm install-all`)\n"
184+
"\n"
185+
"## Memory Protocol (mind-mem MCP — USE CONSTANTLY)\n"
186+
"\n"
187+
"The mind-mem MCP server is wired into this CLI. Before answering ANY\n"
188+
"question that touches prior work, decisions, project state, people,\n"
189+
"companies, technical choices, or \"remember when…\" — call mind-mem\n"
190+
"first. The governed blocks in mind-mem's Postgres backend are the\n"
191+
"source of truth.\n"
192+
"\n"
193+
"### Always recall before answering\n"
194+
"Run `mcp__mind-mem__recall` (or `mm recall \"$query\"` via bash) with\n"
195+
"relevant keywords FIRST. If recall returns results, cite them. If\n"
196+
"not, say \"no record found\" — do not guess.\n"
197+
"\n"
198+
"### Always propose_update after learning new facts\n"
199+
"When the user shares a new decision, project status, relationship,\n"
200+
"contact, or technical finding worth preserving — run\n"
201+
"`mcp__mind-mem__propose_update` to store it. Don't wait to be asked.\n"
202+
"\n"
203+
"### Use hybrid_search for complex queries\n"
204+
"For multi-faceted questions, use `mcp__mind-mem__hybrid_search`\n"
205+
"(BM25 + vector + RRF fusion) for best recall.\n"
206+
"\n"
207+
"### Hallucination guardrail\n"
208+
"If you find yourself writing about prior projects, repos, or\n"
209+
"decisions without having called recall in this session, you are\n"
210+
"about to hallucinate. Stop and call recall first.\n"
211+
)
212+
175213

176214
# ---------------------------------------------------------------------------
177215
# MCP server command — every client that supports MCP points at this.
@@ -605,9 +643,7 @@ def _merge_mcp_vibe_toml(existing_text: str, ws: str, srv: dict) -> tuple[str, b
605643
description="OpenAI Codex CLI",
606644
config_fmt="text-block",
607645
path_tmpl="{ws}/AGENTS.md",
608-
content_tmpl=(
609-
f'{_MM_MARKER}: agent instructions (auto-written)\n\nBefore every response, run `mm context "$QUERY"` and prepend the output.\n'
610-
),
646+
content_tmpl=MEMORY_PROTOCOL_SNIPPET,
611647
detect_binaries=("codex",),
612648
mcp_fmt="mcp-toml-codex",
613649
mcp_path_tmpl="{home}/.codex/config.toml",
@@ -617,9 +653,7 @@ def _merge_mcp_vibe_toml(existing_text: str, ws: str, srv: dict) -> tuple[str, b
617653
description="Mistral Vibe CLI",
618654
config_fmt="text-block",
619655
path_tmpl="{ws}/AGENTS.md",
620-
content_tmpl=(
621-
f'{_MM_MARKER}: agent instructions (auto-written)\n\nBefore every response, run `mm context "$QUERY"` and prepend the output.\n'
622-
),
656+
content_tmpl=MEMORY_PROTOCOL_SNIPPET,
623657
detect_paths=("{home}/.vibe",),
624658
detect_binaries=("vibe",),
625659
mcp_fmt="mcp-toml-vibe",
@@ -640,7 +674,7 @@ def _merge_mcp_vibe_toml(existing_text: str, ws: str, srv: dict) -> tuple[str, b
640674
description="Cursor editor",
641675
config_fmt="text-block",
642676
path_tmpl="{ws}/.cursorrules",
643-
content_tmpl=(f"{_MM_MARKER}\nmind-mem workspace: {{ws}}\nUse `mm inject --agent cursor` before answering.\n"),
677+
content_tmpl=MEMORY_PROTOCOL_SNIPPET,
644678
detect_paths=(
645679
"{home}/.cursor",
646680
"{home}/Library/Application Support/Cursor",
@@ -655,7 +689,7 @@ def _merge_mcp_vibe_toml(existing_text: str, ws: str, srv: dict) -> tuple[str, b
655689
description="Windsurf editor (Codeium)",
656690
config_fmt="text-block",
657691
path_tmpl="{ws}/.windsurfrules",
658-
content_tmpl=(f"{_MM_MARKER}\nworkspace: {{ws}}\nprefer `mm inject --agent windsurf`.\n"),
692+
content_tmpl=MEMORY_PROTOCOL_SNIPPET,
659693
detect_paths=(
660694
"{home}/.codeium/windsurf",
661695
"{home}/.windsurf",
@@ -711,7 +745,7 @@ def _merge_mcp_vibe_toml(existing_text: str, ws: str, srv: dict) -> tuple[str, b
711745
description="Cline (VS Code extension)",
712746
config_fmt="text-block",
713747
path_tmpl="{ws}/.clinerules",
714-
content_tmpl=(f"{_MM_MARKER}\nmind-mem workspace: {{ws}}\nRun `mm inject --agent cline` before tool use.\n"),
748+
content_tmpl=MEMORY_PROTOCOL_SNIPPET,
715749
detect_paths=(
716750
"{home}/.vscode/extensions",
717751
"{home}/.vscode-server/extensions",
@@ -724,7 +758,7 @@ def _merge_mcp_vibe_toml(existing_text: str, ws: str, srv: dict) -> tuple[str, b
724758
description="Roo Code (VS Code fork / extension)",
725759
config_fmt="text-block",
726760
path_tmpl="{ws}/.roo/system-prompt.md",
727-
content_tmpl=(f"{_MM_MARKER}\nmind-mem workspace: {{ws}}\nUse `mm inject --agent roo` before answering.\n"),
761+
content_tmpl=MEMORY_PROTOCOL_SNIPPET,
728762
detect_paths=(
729763
"{home}/.roo",
730764
"{home}/.vscode/extensions",

0 commit comments

Comments
 (0)