@kolivri/memoreal-mcp 0.0.0-stage → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +9 -0
- package/.cursor-plugin/plugin.json +26 -0
- package/.mcp.json +11 -0
- package/CLAUDE.md +54 -0
- package/LICENSE +21 -0
- package/README.md +302 -2
- package/agents/memoreal.md +139 -0
- package/agents/memoria.md +141 -0
- package/assets/logo.svg +9 -0
- package/bin/memoreal-hook.mjs +483 -0
- package/bin/memoreal-ns +61 -0
- package/bin/memoreal-ns.cmd +2 -0
- package/bin/memoreal-ns.mjs +945 -0
- package/bin/memoria-ns +65 -0
- package/glama.json +8 -0
- package/hooks/hooks.json +119 -0
- package/install.sh +792 -0
- package/manifest.json +18 -0
- package/mcp.json +11 -0
- package/opencode/memoreal-hooks.js +494 -0
- package/opencode/memoria-hooks.js +73 -0
- package/package.json +62 -4
- package/rules/memoreal.mdc +27 -0
- package/rules/memoria.mdc +14 -0
- package/server.json +50 -0
- package/skills/memoreal-connect/SKILL.md +247 -0
- package/skills/memoreal-doctor/SKILL.md +58 -0
- package/skills/memoreal-sync/SKILL.md +37 -0
- package/skills/memoreal-sync-code/SKILL.md +39 -0
- package/skills/memoreal-wrap-up/SKILL.md +32 -0
- package/skills/memoria-connect/SKILL.md +247 -0
- package/skills/memoria-doctor/SKILL.md +60 -0
- package/skills/memoria-sync/SKILL.md +18 -0
- package/skills/memoria-sync-code/SKILL.md +20 -0
- package/skills/memoria-wrap-up/SKILL.md +24 -0
- package/smithery.yaml +61 -0
- package/src/apify-main.mjs +346 -0
- package/src/bootstrap.mjs +2850 -0
- package/src/config-store.mjs +1549 -0
- package/src/schemas.mjs +1011 -0
- package/src/server.mjs +778 -0
- package/src/wizard.mjs +1015 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "memoreal",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Memoreal long-term memory and 32-tool polyglot code intelligence for Claude Code, OpenCode, Codex, Cursor, and 17 AI coding harnesses.",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Kolivri",
|
|
7
|
+
"url": "https://memoreal.kolivri.com"
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "memoreal",
|
|
3
|
+
"displayName": "Memoreal — Deterministic AI Memory & Code Intelligence",
|
|
4
|
+
"version": "1.1.0",
|
|
5
|
+
"description": "Deterministic long-term memory and code intelligence MCP plugin for Cursor (100% on LongMemEval in 12.9 ms, 0 LLM write tokens, 32 Cloud MCP tools, rules, skills, agents, and session hooks).",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "Kolivri",
|
|
8
|
+
"email": "stas@kolivri.com"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://memoreal.kolivri.com",
|
|
11
|
+
"repository": "https://github.com/kolivritech/memoreal-mcp",
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"keywords": [
|
|
14
|
+
"cursor",
|
|
15
|
+
"mcp",
|
|
16
|
+
"memory",
|
|
17
|
+
"long-term-memory",
|
|
18
|
+
"code-intelligence",
|
|
19
|
+
"knowledge-graph",
|
|
20
|
+
"skills",
|
|
21
|
+
"agents",
|
|
22
|
+
"hooks",
|
|
23
|
+
"memoreal"
|
|
24
|
+
],
|
|
25
|
+
"logo": "assets/logo.svg"
|
|
26
|
+
}
|
package/.mcp.json
ADDED
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<!-- memoreal:start -->
|
|
2
|
+
## Memoreal Long-Term Memory (32 MCP Tools)
|
|
3
|
+
|
|
4
|
+
This session has Memoreal MCP tools available. Use them to access deterministic long-term memory, cross-session recall, and code intelligence across sessions.
|
|
5
|
+
|
|
6
|
+
### Always Try Memoreal First
|
|
7
|
+
|
|
8
|
+
- **Turn-1 Cold Start**: Call `bootstrap_project` on Turn 1 of an unindexed repository to extract docs (`CLAUDE.md`, `AGENTS.md`, `README.md`) and up to 150 code symbols into Memoreal Cloud.
|
|
9
|
+
- **Finding context**: Call `build_context` with the canonical namespace and a query describing what you need. This returns token-budgeted context from all previous sessions, tasks, plans, and decisions.
|
|
10
|
+
- **Recalling past work**: Use `recall_memories` before assuming you don't have context.
|
|
11
|
+
- **Exploring code & symbols**: Try `search_code`, `explain_code`, and `find_file` before reading files directly.
|
|
12
|
+
- **Before changing a shared symbol**: Call `find_references` to get every workspace call-site, `impact` for blast radius, and `call_tree` (`direction: 'in' | 'out'`) to trace call paths.
|
|
13
|
+
- **Orienting in a project**: Use `navigate` (zoom/peek cursor walk) and `get_hierarchy` (ancestor & descendant tree) to inspect project structure coarse-to-fine before bulk file reads.
|
|
14
|
+
- **Architecture & quality**: Use `implementors` to locate interface implementations, `dead_code` to detect unreferenced code, and `test_gaps` to uncover missing coverage.
|
|
15
|
+
- **Changes, risk & diagnostics**: Use `diff_risk` to evaluate change risk, `downstream_effects` for cascading impacts, `root_cause` for error traces, `trace_provenance` for symbol evolution, `explain_diff` for git diff review, and `explain_error` for runtime/compiler diagnostics.
|
|
16
|
+
- **Safe refactoring**: Use `rename` to compute a comprehensive, safe symbol rename plan across all definitions and call-sites.
|
|
17
|
+
- **Multi-agent collaboration**: Use `list_agent_wings` and `handoff_to_agent` for structured handoffs between specialized wings (`architect`, `reviewer`, `qa`, `security`, `ops`).
|
|
18
|
+
- **Account & setup**: Use `connect_account` for in-chat 3-click authentication setup.
|
|
19
|
+
- **Storing & pruning knowledge**: Use `encode_memory` or `batch_encode` for durable decisions and bug root causes, `feedback` to adjust salience, and `forget_memory` or `delete_by_context` to remove obsolete memories.
|
|
20
|
+
|
|
21
|
+
### Hierarchical Navigation — use it before bulk file reads
|
|
22
|
+
|
|
23
|
+
Indexed namespaces (e.g. `code/{project}`) are a containment map: **project → directory → file → definition → chunk**, every node carrying a one-line note (a directory rolls up its files/defs; a function carries its signature + doc). When you need to understand structure — "how is this project laid out", "what's in this module", "where does this function sit", "what does it contain" — reach for the map *first*, not a pile of `Read`s.
|
|
24
|
+
|
|
25
|
+
**`navigate`** — stateless cursor walk over the map:
|
|
26
|
+
1. **Orient**: call `navigate` with just `namespace` → the root view: cursor, child summaries, legal `moves`.
|
|
27
|
+
2. **Zoom**: pass `cursor` (current node id) + `move`: `{"ZoomIn": {"child": "<id>"}}` to descend, `"ZoomOut"` to ascend, `"Next"`/`"Prev"` for siblings, `{"Expand": {"levels": N}}` to see N levels at once.
|
|
28
|
+
3. **Peek**: `{"Peek": {"node": "<id>"}}` returns a node's full content without moving the cursor.
|
|
29
|
+
4. Every response carries `breadcrumb` (where you are, by layer) and `moves` (what is legal next) — never guess; only issue moves the response offers.
|
|
30
|
+
|
|
31
|
+
**`get_hierarchy`** — one shot, all layers around an item: `{namespace, node}` returns `ancestors` (every layer above), the `node`, and `descendants` (the whole subtree below), with `descendants_total` flagging truncation. Use it to answer "what is this item's full place in the system" without a manual climb.
|
|
32
|
+
|
|
33
|
+
### Session Start & Turn-1 Cold-Start Indexing
|
|
34
|
+
|
|
35
|
+
1. **Turn-1 Indexing**: If working on an unindexed repository or fresh clone, call `bootstrap_project` with `{ project_dir }` to index markdown guidance and top-level code symbols.
|
|
36
|
+
2. **Context Load**: On every new session, load context by calling `build_context` with:
|
|
37
|
+
- `namespace`: canonical project namespace (optional; auto-resolves when omitted, see below)
|
|
38
|
+
- `query`: "previous tasks, plans, pending work, key decisions, progress, recent context"
|
|
39
|
+
- `token_budget`: 4096
|
|
40
|
+
3. **Engine Health**: Call `health` in parallel to verify Cloud engine connectivity.
|
|
41
|
+
|
|
42
|
+
### Namespace Derivation
|
|
43
|
+
|
|
44
|
+
All Memoreal operations require a namespace. The Memoreal MCP plugin automatically resolves the canonical project namespace from repository manifests (`package.json`, `Cargo.toml`, `pyproject.toml`, `go.mod`, `pom.xml`, etc., across 32 ecosystems), `.memoreal-namespace`, git remotes, and git worktrees — so agents can either omit `namespace` to let the MCP server resolve it automatically or pass the canonical project slug from `memoreal-ns`.
|
|
45
|
+
- **Worktree Stripping**: Always strip any worktree path components (`/.worktrees/*`, `/.claude/worktrees/*`, `/.opencode/worktrees/*`, `/.codex/worktrees/*`, `/.cursor/worktrees/*`).
|
|
46
|
+
- **No `org:` Prefix**: Never prepend an `org:` prefix to the namespace.
|
|
47
|
+
- **Worktree Consistency**: Git worktrees automatically resolve to the canonical repository project namespace, guaranteeing all worktrees share the exact same persistent memory namespace as the base repo.
|
|
48
|
+
|
|
49
|
+
### Memory Hygiene
|
|
50
|
+
|
|
51
|
+
- Search before encoding (`recall_memories`, `search_code`) to avoid duplicates.
|
|
52
|
+
- Give `feedback` on recalled memories (`useful: true | false`) to adjust retrieval salience.
|
|
53
|
+
- Run `consolidate` (and check `stats`) periodically to merge duplicates and promote high-salience memories.
|
|
54
|
+
<!-- memoreal:end -->
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kolivri
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,303 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@kolivri/memoreal-mcp` — Deterministic AI Memory & Code Intelligence MCP for Claude Code, OpenCode, Cursor, Codex & 17 AI Harnesses
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://glama.ai/mcp/servers/kolivritech/memoreal-mcp)
|
|
4
|
+
[](./package.json)
|
|
5
|
+
|
|
6
|
+
`@kolivri/memoreal-mcp` is the official zero-dependency Node.js ESM **Model Context Protocol (MCP)** connector (`stdio` & HTTP) for **[Memoreal Cloud](https://memoreal.kolivri.com)** — giving AI coding and operator agents across 17 local AI agent harnesses (**Claude Code, Claude Desktop, Cursor, OpenCode, OpenAI Codex, Windsurf, VS Code / GitHub Copilot, Zed, Gemini CLI, Cline, Roo Code, Kilo Code, Continue, Block Goose, Sourcegraph Amp, AWS Kiro & Amazon Q, Trae, and Aider**) deterministic long-term memory, cross-session recall, and polyglot code intelligence powered by `memoreal.kolivri.com`.
|
|
7
|
+
|
|
8
|
+
- **Memoreal Cloud Portal & API Keys**: [https://memoreal.kolivri.com](https://memoreal.kolivri.com) ([Get API Key](https://memoreal.kolivri.com/register) — includes **1,000 free API calls/memories**; paid tiers: **Developer $19/mo**, **Startup $79/mo**, **Business $299/mo**)
|
|
9
|
+
- **Documentation & Benchmarks**: [https://memoreal.kolivri.com/docs](https://memoreal.kolivri.com/docs) (`500/500 = 100.0%` LongMemEval at `12.9 ms` p50, `102/102 = 100.0%` Hebrew LongMemEval across 15 languages)
|
|
10
|
+
- **Support**: `stas@kolivri.com` · WhatsApp `054-787-5670`
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Environment Variables
|
|
15
|
+
|
|
16
|
+
| Variable | Required | Default | Description |
|
|
17
|
+
| --- | --- | --- | --- |
|
|
18
|
+
| `MEMOREAL_API_KEY` | **Yes** | — | Your Memoreal Cloud API key (`mem_dev_...`, `mem_start_...`, or `mem_biz_...`) from [memoreal.kolivri.com/register](https://memoreal.kolivri.com/register) |
|
|
19
|
+
| `MEMOREAL_API_URL` | Optional | `https://memoreal.kolivri.com` | Memoreal Cloud base URL |
|
|
20
|
+
| `MEMOREAL_NAMESPACE` | Optional | `default` | Default project/workspace namespace when omitted from tool arguments |
|
|
21
|
+
|
|
22
|
+
> **Backward Compatibility**: Legacy `MEMORIA_API_KEY`, `MEMORIA_API_URL`, and `MEMORIA_NAMESPACE` environment variables remain 100% supported as automatic fallbacks across all transports.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## The 5 Market Tracks & Automated Feature Showcases
|
|
27
|
+
|
|
28
|
+
Memoreal Cloud provides deterministic, high-speed memory architectures tailored to 5 primary market tracks. Each track leverages a dedicated context mode, domain-specific hooks, and live automated feature showcases:
|
|
29
|
+
|
|
30
|
+
### 1. Software Developers & Engineering Teams (`mode: "organizational"`)
|
|
31
|
+
- **Stack & Installation**: `npx -y @kolivri/memoreal-mcp setup` across Windows, Linux/WSL, and macOS supporting all 17 local AI agent harnesses.
|
|
32
|
+
- **Polyglot Code Intelligence**: Cold-start `bootstrap_project` parses instructions (`CLAUDE.md`, `AGENTS.md`, `README.md`) and indexes symbols across 15+ programming languages.
|
|
33
|
+
- **Belief Revision & Evolution**: `Supersedes` graph edges dynamically deprecate killed-RFC architectural decisions when new patterns are accepted.
|
|
34
|
+
- **Architectural Tools**: Deep caller/callee trees (`call_tree`), blast radius assessment (`impact`), and gap detection (`test_gaps`).
|
|
35
|
+
- **Compaction-Proof Hooks**: Session lifecycle hooks provide `70%+` prompt token savings through automated memory recall and compaction survival.
|
|
36
|
+
- **CI/CD Integration**: Seamless integration with GitHub via `/v1/webhooks/github` for automatic memory syncing on branch merges.
|
|
37
|
+
|
|
38
|
+
### 2. Automated Call & Customer Support Centers (`mode: "support"`)
|
|
39
|
+
- **Telephony & Helpdesk Connectors**: Native voice and support webhooks/SDKs for Kolivri Voice, Twilio, Vapi, LiveKit, WhatsApp, and Zendesk.
|
|
40
|
+
- **Sub-First-Ring Recall**: `12.9 ms*` p50 returning-caller memory recall eliminates dead air ($0 LLM dead air delay) before the first phone ring.
|
|
41
|
+
- **Multilingual Support**: Verified across 15 natural languages, including `102/102 = 100.0%` on Hebrew LongMemEval benchmark tests.
|
|
42
|
+
- **Dynamic Customer State**: `Supersedes` edges track live ticket status, address updates, and preference changes over time.
|
|
43
|
+
- **Privacy & Safety**: Pre-storage PII redaction ensures caller identity data and payment information are protected.
|
|
44
|
+
|
|
45
|
+
### 3. Autonomous & Multi-Agent Builders (`mode: "operational"`)
|
|
46
|
+
- **Agent Frameworks**: Streamable HTTP `/v1/mcp` transport and REST SDK integrations for LangGraph, CrewAI, OpenAI Agents SDK, AutoGen, and Mastra.
|
|
47
|
+
- **5 Specialist Agent Wings**: Multi-agent coordination across `architect`, `reviewer`, `qa`, `security`, and `ops` wings via `handoff_to_agent` and `/v1/rooms/handoff`.
|
|
48
|
+
- **Memory Tiering**: Isolation between scratchpad ideation in `Buffer` tier vs immutable production invariants in `Core` tier.
|
|
49
|
+
- **Causal Reasoning**: Graph-powered dependency tracking via `downstream_effects` and `root_cause` diagnostics for runtime failure recovery.
|
|
50
|
+
|
|
51
|
+
### 4. Sales, CRM & Revenue Operations AI (`mode: "sales"`)
|
|
52
|
+
- **RevOps Integrations**: Native connectors and webhooks for AI SDRs, HubSpot, Salesforce, Gong, n8n, and Make.
|
|
53
|
+
- **Deterministic Math**: Strict numeric reasoning and signed deal arithmetic (e.g. `$25k + $15k = $40k`) without LLM hallucination.
|
|
54
|
+
- **Entity Separation**: Strict graph boundary separation between first-party customer facts and competitor/vendor intelligence.
|
|
55
|
+
- **Pre-Call Briefs**: Automated account synthesis using `/v1/extract` and `/v1/reflect` to assemble instant executive briefing documents.
|
|
56
|
+
|
|
57
|
+
### 5. Security- & Compliance-First Organizations (`mode: "research"`)
|
|
58
|
+
- **Cryptographic Access Control**: Role-scoped API keys with explicit `Write` vs `Read`-only auditor access.
|
|
59
|
+
- **Enterprise Team RBAC**: Granular role-based access control supporting `owner`, `admin`, `manager`, and `member` tiers.
|
|
60
|
+
- **Zero-Trust Data Protection**: Pre-storage PII/secret scrubbing and prompt-injection quarantine prevent memory poisoning.
|
|
61
|
+
- **Auditability & Provenance**: Full memory trust chains via `trace_provenance`, immutable audit trails via `/v1/trace/recent`, and GDPR compliance via `/v1/export` and right-to-forget endpoints.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Cross-OS Support (Windows · Linux / WSL · macOS)
|
|
66
|
+
|
|
67
|
+
`@kolivri/memoreal-mcp` runs natively across all major operating systems with zero external shell dependencies:
|
|
68
|
+
|
|
69
|
+
- **Windows (`win32`)**:
|
|
70
|
+
- Full support for `PowerShell` and `cmd.exe`.
|
|
71
|
+
- Config paths resolved to `%APPDATA%` (Roaming) and `%LOCALAPPDATA%` with `%USERPROFILE%`.
|
|
72
|
+
- Lifecycle hooks run via pure Node.js (`bin/memoreal-hook.mjs`) and Windows batch wrappers (`bin/memoreal-ns.cmd`), requiring zero `/bin/sh` or `jq`.
|
|
73
|
+
- Safe OAuth browser launching via `rundll32` (`url.dll,FileProtocolHandler`), preventing URL query parameters (`&`) from breaking.
|
|
74
|
+
- **Linux & WSL (`linux`)**:
|
|
75
|
+
- Compliant with `$XDG_CONFIG_HOME` (defaulting to `~/.config`).
|
|
76
|
+
- Seamless WSL integration: automatically detects WSL environments (`WSL_DISTRO_NAME` / `WSL_INTEROP`) and opens the host Windows browser via `rundll32.exe`.
|
|
77
|
+
- **macOS (`darwin`)**:
|
|
78
|
+
- Idiomatic macOS application paths under `~/Library/Application Support` and `~/.config`.
|
|
79
|
+
- Works out of the box with standard Apple Silicon (`arm64`) and Intel (`x64`) architectures.
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Supported Local AI Agent Harnesses (17 Harnesses)
|
|
84
|
+
|
|
85
|
+
`@kolivri/memoreal-mcp` automatically detects and provisions MCP configurations, skills, and lifecycle hooks across **17 local AI agent harnesses**:
|
|
86
|
+
|
|
87
|
+
1. **Claude Code** (`~/.claude/settings.json`, `.claude.json`, hooks)
|
|
88
|
+
2. **Claude Desktop** (`claude_desktop_config.json` on macOS / Windows `%APPDATA%` / Linux)
|
|
89
|
+
3. **Cursor** (`~/.cursor/mcp.json`, `.cursor/rules/`)
|
|
90
|
+
4. **OpenCode** (`${XDG_CONFIG_HOME:-~/.config}/opencode/opencode.json`, plugins, hooks)
|
|
91
|
+
5. **OpenAI Codex** (`~/.codex/config.toml`, `.codex/skills/`, `.codex/AGENTS.md`)
|
|
92
|
+
6. **Windsurf** (`~/.codeium/windsurf/mcp_config.json`, `memories/global_rules.md`)
|
|
93
|
+
7. **VS Code / GitHub Copilot** (`~/.vscode/mcp.json`, `Code/User/mcp.json`, `.github/copilot-instructions.md`)
|
|
94
|
+
8. **Zed** (`~/.config/zed/settings.json` via `context_servers.memoreal`)
|
|
95
|
+
9. **Gemini CLI** (`~/.gemini/settings.json`, `.gemini/GEMINI.md`)
|
|
96
|
+
10. **Cline** (`cline_mcp_settings.json` in globalStorage / stdio with `cmd /c npx` on Windows)
|
|
97
|
+
11. **Roo Code** (`mcp_settings.json` in globalStorage / stdio)
|
|
98
|
+
12. **Kilo Code** (`mcp_settings.json` in globalStorage / stdio)
|
|
99
|
+
13. **Continue** (`~/.continue/mcpServers/memoreal.json`)
|
|
100
|
+
14. **Block Goose** (`~/.config/goose/config.yaml` via `extensions.memoreal`)
|
|
101
|
+
15. **Sourcegraph Amp** (`~/.config/amp/settings.json` via `amp.mcpServers`)
|
|
102
|
+
16. **AWS Kiro & Amazon Q** (`~/.kiro/settings/mcp.json`, `~/.aws/amazonq/mcp.json`, `.kiro/steering/memoreal.md`)
|
|
103
|
+
17. **Trae** (`Trae/User/mcp.json`)
|
|
104
|
+
*(Also supports conventions for **Aider** via `CONVENTIONS.md`)*
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Installation
|
|
109
|
+
|
|
110
|
+
### 1. Interactive CLI Setup & Auto-Hook Provisioning (Recommended)
|
|
111
|
+
|
|
112
|
+
Run the zero-dependency interactive setup wizard to configure your API key, auto-provision client lifecycle hooks and skills, and index your repository:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
# Interactive setup with automatic client detection
|
|
116
|
+
npx -y @kolivri/memoreal-mcp setup
|
|
117
|
+
|
|
118
|
+
# Or alias
|
|
119
|
+
npx -y @kolivri/memoreal-mcp init
|
|
120
|
+
|
|
121
|
+
# Setup with direct API key and target specific client
|
|
122
|
+
npx -y @kolivri/memoreal-mcp setup --key "mem_..." --tool opencode
|
|
123
|
+
|
|
124
|
+
# Setup without cold-start repository indexing
|
|
125
|
+
npx -y @kolivri/memoreal-mcp setup --no-bootstrap
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**What the setup wizard auto-provisions:**
|
|
129
|
+
- **Automated Client Detection**: Configures Claude Code, Cursor, OpenCode, Codex, Windsurf, and VS Code MCP configs.
|
|
130
|
+
- **Agent Lifecycle Hooks & Skills**: Copies plugins/skills and configures lifecycle hooks (`SessionStart`, `PreCompact`, `PostCompact`, `UserPromptSubmit`, `PostToolUse`, `TaskCompleted`, `Stop`) with `.bak` safety backups.
|
|
131
|
+
- **Canonical Worktree Resolver**: Installs `~/.memoreal/bin/memoreal-ns` (`0o755`) to ensure git worktrees share canonical repository memory namespaces without `org:` prefixes.
|
|
132
|
+
- **Turn-1 Cold-Start Indexing**: Automatically indexes repository guidance (`CLAUDE.md`, `AGENTS.md`, `README.md`) and code symbols into Memoreal Cloud (unless `--no-bootstrap` is passed).
|
|
133
|
+
|
|
134
|
+
### 2. One-Line Auto-Installer (15 AI Clients + Claude Code Lifecycle Hooks)
|
|
135
|
+
|
|
136
|
+
Automatically configures Claude Code, Cursor, Windsurf, VS Code, Claude Desktop, OpenCode, Cline, Roo Code, Continue, Zed, Goose, PearAI, Trae, Void, and Melty:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
# macOS / Linux / WSL
|
|
140
|
+
curl -fsSL --proto '=https' --tlsv1.2 https://memoreal.kolivri.com/downloads/install.sh | MEMOREAL_KEY=YOUR_MEMOREAL_API_KEY bash
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
```powershell
|
|
144
|
+
# Windows PowerShell
|
|
145
|
+
$env:MEMOREAL_KEY="YOUR_MEMOREAL_API_KEY"; irm https://memoreal.kolivri.com/downloads/install.ps1 | iex
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### 3. Claude Code (`claude mcp add`)
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
claude mcp add memoreal \
|
|
152
|
+
-e MEMOREAL_API_KEY="your-memoreal-api-key" \
|
|
153
|
+
-- npx -y @kolivri/memoreal-mcp
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### 4. Cursor (`~/.cursor/mcp.json`) & Claude Desktop (`claude_desktop_config.json`)
|
|
157
|
+
|
|
158
|
+
```json
|
|
159
|
+
{
|
|
160
|
+
"mcpServers": {
|
|
161
|
+
"memoreal": {
|
|
162
|
+
"command": "npx",
|
|
163
|
+
"args": ["-y", "@kolivri/memoreal-mcp"],
|
|
164
|
+
"env": {
|
|
165
|
+
"MEMOREAL_API_KEY": "your-memoreal-api-key",
|
|
166
|
+
"MEMOREAL_NAMESPACE": "my-project"
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### 5. OpenCode (`~/.config/opencode/opencode.json`)
|
|
174
|
+
|
|
175
|
+
```json
|
|
176
|
+
{
|
|
177
|
+
"mcp": {
|
|
178
|
+
"memoreal": {
|
|
179
|
+
"type": "local",
|
|
180
|
+
"command": ["npx", "-y", "@kolivri/memoreal-mcp"],
|
|
181
|
+
"environment": {
|
|
182
|
+
"MEMOREAL_API_KEY": "your-memoreal-api-key",
|
|
183
|
+
"MEMOREAL_NAMESPACE": "my-project"
|
|
184
|
+
},
|
|
185
|
+
"enabled": true
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### 6. OpenAI Codex (`~/.codex/config.toml`)
|
|
192
|
+
|
|
193
|
+
OpenAI Codex uses native TOML configuration (`~/.codex/config.toml`). Running `npx -y @kolivri/memoreal-mcp setup` automatically provisions the Streamable HTTP MCP server:
|
|
194
|
+
|
|
195
|
+
```toml
|
|
196
|
+
[mcp_servers.memoreal]
|
|
197
|
+
url = "https://memoreal.kolivri.com/v1/mcp"
|
|
198
|
+
http_headers = { "Authorization" = "Bearer your-memoreal-api-key" }
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Alternatively, you can configure local `stdio` execution:
|
|
202
|
+
|
|
203
|
+
```toml
|
|
204
|
+
[mcp_servers.memoreal]
|
|
205
|
+
command = "npx"
|
|
206
|
+
args = ["-y", "@kolivri/memoreal-mcp"]
|
|
207
|
+
env = { MEMOREAL_API_KEY = "your-memoreal-api-key", MEMOREAL_NAMESPACE = "my-project" }
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### 7. Docker
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
docker build -t memoreal-mcp .
|
|
214
|
+
docker run -i --rm \
|
|
215
|
+
-e MEMOREAL_API_KEY="your-memoreal-api-key" \
|
|
216
|
+
-e MEMOREAL_NAMESPACE="my-project" \
|
|
217
|
+
memoreal-mcp
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## 32 MCP Tools (`https://memoreal.kolivri.com/v1/mcp`)
|
|
223
|
+
|
|
224
|
+
### Core Memory & Context (10 Tools)
|
|
225
|
+
|
|
226
|
+
| Tool | Required Args | Description |
|
|
227
|
+
| --- | --- | --- |
|
|
228
|
+
| `build_context` | `query` | Assemble a token-budgeted `<memory_context>` block grouped into Core Rules, Established Facts, and Recent Context. |
|
|
229
|
+
| `recall_memories` | `query` | Retrieve top memories ranked deterministically by Memoreal Cloud within `token_budget`. |
|
|
230
|
+
| `encode_memory` | `content` | Store a new memory in Memoreal Cloud with tier (`episodic`, `semantic`, `buffer`, `core`), `salience` (`0.0–1.0`), `namespace`, and `context` pairs. |
|
|
231
|
+
| `batch_encode` | `memories` | Atomically encode an array of memories in a single call. |
|
|
232
|
+
| `forget_memory` | `id` | Delete a specific memory and its incident graph edges by ID. |
|
|
233
|
+
| `delete_by_context` | `key`, `value` | Delete all memories matching a specific `[key, value]` context metadata pair. |
|
|
234
|
+
| `feedback` | `id`, `useful` | Record positive/negative utility feedback on a memory and adjust its salience score. |
|
|
235
|
+
| `consolidate` | `namespace` | Deduplicate memories within a namespace and promote recurring high-salience episodic memories to `Semantic` tier. |
|
|
236
|
+
| `health` | *(none)* | Return Memoreal Cloud engine health, active memory/edge counts, and tier distribution. |
|
|
237
|
+
| `stats` | `namespace` | Return per-namespace memory count, edge count, and tier distribution. |
|
|
238
|
+
|
|
239
|
+
### Code Intelligence & Navigation (9 Tools)
|
|
240
|
+
|
|
241
|
+
| Tool | Required Args | Description |
|
|
242
|
+
| --- | --- | --- |
|
|
243
|
+
| `bootstrap_project` | *(optional: `project_dir`, `namespace`)* | Turn-1 cold-start project indexing: parses instructions (`CLAUDE.md`, `AGENTS.md`, `README.md`) and indexes top-level code symbols into Memoreal Cloud. |
|
|
244
|
+
| `search_code` | `query` | Search indexed code symbol definitions and references with file paths and line numbers. |
|
|
245
|
+
| `explain_code` | `target` | Explain a symbol: definitions, workspace references, related tests, and associated architectural memories. |
|
|
246
|
+
| `find_file` | `pattern` | Resolve file or directory paths matching a pattern or name across the workspace. |
|
|
247
|
+
| `find_references` | `symbol` | Find all call-sites and symbol references across the indexed workspace. |
|
|
248
|
+
| `call_tree` | `symbol` | Generate caller/callee hierarchy trees (`direction: "in" \| "out"`, `max_depth`). |
|
|
249
|
+
| `navigate` | *(optional: `namespace`, `cursor`, `move`)* | Stateless hierarchical cursor walk across project, directory, file, and definition layers. |
|
|
250
|
+
| `get_hierarchy` | `node` | Single-shot retrieval of all ancestor layers and full descendant subtree around a node. |
|
|
251
|
+
| `implementors` | `interface_name` | List concrete implementations and classes implementing an interface, trait, or abstract type. |
|
|
252
|
+
|
|
253
|
+
#### 15+ Supported Programming Languages
|
|
254
|
+
|
|
255
|
+
The 16 code-intelligence tools natively parse definitions, references, and hierarchies across:
|
|
256
|
+
- **TypeScript & JavaScript** (`.ts`, `.tsx`, `.js`, `.jsx`, `.mjs`, `.cjs`)
|
|
257
|
+
- **Python** (`.py`)
|
|
258
|
+
- **Go** (`.go`)
|
|
259
|
+
- **Rust** (`.rs`)
|
|
260
|
+
- **Java** (`.java`)
|
|
261
|
+
- **C#** (`.cs`)
|
|
262
|
+
- **C & C++** (`.c`, `.cc`, `.cpp`, `.h`, `.hpp`)
|
|
263
|
+
- **PHP** (`.php`)
|
|
264
|
+
- **Ruby** (`.rb`)
|
|
265
|
+
- **Kotlin** (`.kt`, `.kts`)
|
|
266
|
+
- **Swift** (`.swift`)
|
|
267
|
+
- **Scala** (`.scala`)
|
|
268
|
+
- **Shell / Bash** (`.sh`, `.bash`)
|
|
269
|
+
|
|
270
|
+
### Architecture, Quality & Diagnostics (10 Tools)
|
|
271
|
+
|
|
272
|
+
| Tool | Required Args | Description |
|
|
273
|
+
| --- | --- | --- |
|
|
274
|
+
| `impact` | `target` | Compute blast radius, affected call-sites, and test dependencies before changing a symbol or file. |
|
|
275
|
+
| `dead_code` | *(optional: `path`)* | Detect unreferenced symbols, orphan functions, and unreachable code paths across workspace. |
|
|
276
|
+
| `test_gaps` | *(optional: `path`)* | Identify untested symbols, uncovered edge cases, and missing test suites. |
|
|
277
|
+
| `diff_risk` | *(optional: `diff`, `path`)* | Compute deterministic risk score, hotspot warnings, and reviewer checklists for code diffs. |
|
|
278
|
+
| `downstream_effects` | `target` | Evaluate cascading architectural impact and downstream service dependencies. |
|
|
279
|
+
| `root_cause` | `error` | Trace error logs, crash signatures, and stack traces back to root cause symbols. |
|
|
280
|
+
| `trace_provenance` | `symbol` | Trace symbol origin, commit history, architectural decisions, and original rationale. |
|
|
281
|
+
| `explain_diff` | *(optional: `diff`, `path`)* | Provide structured code review explanations and risk highlights for git changes. |
|
|
282
|
+
| `explain_error` | `error` | Diagnose runtime exceptions, compiler errors, and stack traces with targeted fix advice. |
|
|
283
|
+
| `rename` | `old_name`, `new_name` | Calculate a complete, safe symbol rename plan across all call-sites and definitions. |
|
|
284
|
+
|
|
285
|
+
### Multi-Agent Coordination & Setup (3 Tools)
|
|
286
|
+
|
|
287
|
+
| Tool | Required Args | Description |
|
|
288
|
+
| --- | --- | --- |
|
|
289
|
+
| `list_agent_wings` | *(none)* | List specialist multi-agent wings (`architect`, `reviewer`, `qa`, `security`, `ops`) and active memory counts. |
|
|
290
|
+
| `handoff_to_agent` | `from_wing`, `to_wing`, `summary`, `task` | Record a structured context handoff between specialist agent wings. |
|
|
291
|
+
| `connect_account` | *(optional: `action`, `device_code`)* | Interactive 3-click in-chat setup wizard for Memoreal credentials and client configuration. |
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
## Running Connector Tests
|
|
296
|
+
|
|
297
|
+
```bash
|
|
298
|
+
npm test
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
## License
|
|
302
|
+
|
|
303
|
+
Connector package licensed under MIT. Memoreal Cloud (`https://memoreal.kolivri.com`) is a commercial hosted service by [Kolivri](https://kolivri.com).
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: memoreal
|
|
3
|
+
description: Deterministic long-term memory and code intelligence specialist agent for cross-session recall, compaction protection, and write-gated learning.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
You are the Memoreal memory assistant integrated into this AI session.
|
|
7
|
+
|
|
8
|
+
## Automatic Memory Hooks
|
|
9
|
+
|
|
10
|
+
Memoreal hooks fire automatically on key events. When you see these signals, act on them:
|
|
11
|
+
|
|
12
|
+
**`[memoreal-setup-wizard]`** (or `[memoria-setup-wizard]`) — Workspace is not yet connected to Memoreal Cloud or API key is unconfigured/expired (HTTP `401 Unauthorized`).
|
|
13
|
+
- **CRITICAL**: Do NOT call `build_context` or retry memory operations when you see `[memoreal-setup-wizard]` or receive HTTP `401 Unauthorized`. Calling `build_context` without valid authentication will fail.
|
|
14
|
+
- **Recovery Action**: Immediately guide the user to the 3-Click Setup Wizard `/memoreal-connect` (or `/memoria-connect`):
|
|
15
|
+
1. Ask the user: "Connect this workspace to Memoreal Cloud via Google / Browser OAuth in 1 click (`/memoreal-connect`)?"
|
|
16
|
+
2. If the user accepts, run the `/memoreal-connect` skill or present the interactive connect card.
|
|
17
|
+
3. Once connected (`status: "connected"` or `CONNECTED=true`), credentials and configurations are automatically hot-reloaded and you may proceed with normal session operations.
|
|
18
|
+
|
|
19
|
+
**`[memoreal-session-start]`** (or legacy `[memoria-session-start]`) — New session. The hook provides the project namespace (automatically resolved from 32 ecosystem manifests, git root, or worktree via `memoreal-ns`; or omit `namespace` for automatic cwd resolution).
|
|
20
|
+
- If the hook output contains `[memoreal-setup-wizard]` or if `/v1/health` or `/v1/memories/context` returns HTTP `401 Unauthorized`, do NOT call `build_context` — trigger the `/memoreal-connect` wizard immediately.
|
|
21
|
+
- Otherwise, you MUST act on this before responding to the user:
|
|
22
|
+
1. Fetch MCP tool schemas: `ToolSearch` with query `select:mcp__memoreal__health,mcp__memoreal__build_context` (or `memoria` server prefix)
|
|
23
|
+
2. Call `health` (no params) and `build_context` with the namespace (or omit namespace) and query from the hook — run both in parallel
|
|
24
|
+
3. Report a one-line summary: memory count, key context found, or "no prior context" if empty. Then proceed to the user's message.
|
|
25
|
+
|
|
26
|
+
**`[memoreal-pre-compact]`** (or `[memoria-pre-compact]`) — Context is about to be compressed. This is URGENT. Before doing anything else, encode the current working state into Memoreal:
|
|
27
|
+
1. What you were working on, what is done, what remains
|
|
28
|
+
2. Key findings: bugs found, root causes, decisions made this session
|
|
29
|
+
3. Open questions and blockers
|
|
30
|
+
4. Any code patterns or facts learned
|
|
31
|
+
Use `encode_memory` with type "episodic" and salience 0.8 for each. This preserves context that would otherwise be lost.
|
|
32
|
+
|
|
33
|
+
**`[memoreal-post-compact]`** (or `[memoria-post-compact]`) — Context was just compressed. Call `build_context` to restore what was lost:
|
|
34
|
+
- Query: "current task, recent progress, findings, decisions, open questions, what was I working on"
|
|
35
|
+
- Token budget: 2048
|
|
36
|
+
Review the restored context and continue seamlessly.
|
|
37
|
+
|
|
38
|
+
**`[memoreal-correction]`** (or `[memoria-correction]`) — The user is correcting your approach. After addressing their correction:
|
|
39
|
+
1. Encode the lesson as a semantic memory with salience 0.9
|
|
40
|
+
2. Content: what was wrong, what the correct approach is, and why
|
|
41
|
+
3. Include `[["source", "correction"]]` in context metadata
|
|
42
|
+
This ensures the mistake is never repeated in future sessions.
|
|
43
|
+
|
|
44
|
+
**`[memoreal-encode-task]`** (or `[memoria-encode-task]`) — A task was just created. Call `encode_memory` with:
|
|
45
|
+
- `type`: "episodic"
|
|
46
|
+
- `namespace`: provided by the hook or auto-resolved from project manifest
|
|
47
|
+
- Content: the task description, status, and any relevant context
|
|
48
|
+
|
|
49
|
+
**`[memoreal-encode-plan]`** (or `[memoria-encode-plan]`) — A plan was just written. Call `encode_memory` with:
|
|
50
|
+
- `type`: "semantic"
|
|
51
|
+
- `namespace`: provided by the hook or auto-resolved from project manifest
|
|
52
|
+
- Content: the plan title, key steps, and target files
|
|
53
|
+
|
|
54
|
+
**`[memoreal-encode-file]`** (or `[memoria-encode-file]`) — A file was written or edited. Call `encode_memory` with:
|
|
55
|
+
- `type`: "semantic"
|
|
56
|
+
- `namespace`: provided by the hook or auto-resolved from project manifest
|
|
57
|
+
- Content: file path, what was changed or created, key definitions/exports
|
|
58
|
+
|
|
59
|
+
**`[memoreal-update-task]`** (or `[memoria-update-task]`) — A task was completed. Call `encode_memory` with:
|
|
60
|
+
- `type`: "episodic"
|
|
61
|
+
- `namespace`: provided by the hook or auto-resolved from project manifest
|
|
62
|
+
- Content: what was accomplished and the outcome
|
|
63
|
+
|
|
64
|
+
**`[memoreal-session-end]`** (or `[memoria-session-end]`) — Session is ending. Encode a session summary. Apply the **write gate** — only encode items that:
|
|
65
|
+
- Would change future behavior (lessons, corrections, preferences)
|
|
66
|
+
- Represent commitments others depend on (deadlines, deliverables)
|
|
67
|
+
- Are reasoned decisions worth preserving (rationale for choices)
|
|
68
|
+
- Are stable facts that will recur across sessions
|
|
69
|
+
Skip transient details, routine operations, and exploratory dead ends. After encoding, run `consolidate` on the namespace.
|
|
70
|
+
|
|
71
|
+
## 401 Unauthorized & Authentication Recovery
|
|
72
|
+
|
|
73
|
+
When any Memoreal MCP tool call or API request returns HTTP `401 Unauthorized` or indicates an unconfigured, invalid, or expired key:
|
|
74
|
+
1. Never loop or retry failing queries with an unauthenticated key.
|
|
75
|
+
2. Never ask the user to paste raw API keys or tokens into the chat.
|
|
76
|
+
3. Immediately initiate the 3-Click Setup Wizard `/memoreal-connect` (or `/memoria-connect`) so the user can connect in one click via their browser.
|
|
77
|
+
|
|
78
|
+
## Proactive Memory Usage
|
|
79
|
+
|
|
80
|
+
Always prefer Memoreal MCP tools over raw file reads when exploring code or recalling past work:
|
|
81
|
+
|
|
82
|
+
- `recall_memories` -- search past conversations and knowledge
|
|
83
|
+
- `build_context` -- token-budgeted context retrieval for any topic
|
|
84
|
+
- `search_code` -- find functions, classes, patterns in indexed code (the entry point: land here, then navigate)
|
|
85
|
+
- `explain_code` -- explain a symbol: what it is, who uses it (live reference scan), its tests
|
|
86
|
+
- `find_references` -- every place a symbol is referenced; run this before changing a signature instead of `grep -rn`
|
|
87
|
+
- `find_file` -- locate a file or directory by name/path instead of `find -name` / `ls`
|
|
88
|
+
- `explain_diff` -- analyze code changes in context
|
|
89
|
+
- `explain_error` -- diagnose errors using code + conversation history
|
|
90
|
+
- `navigate` -- walk the hierarchical containment map of an indexed namespace (zoom in/out, siblings, peek)
|
|
91
|
+
- `get_hierarchy` -- one call: every layer connected to an item (all ancestors + full descendant subtree, each with its note)
|
|
92
|
+
- `encode_memory` -- store important information to remember (supports salience and context metadata)
|
|
93
|
+
- `health` -- memory engine status
|
|
94
|
+
- `stats` -- namespace statistics
|
|
95
|
+
|
|
96
|
+
Use `search_code` / `find_file` to locate, `explain_code` / `get_hierarchy` to understand, and `find_references` before editing a shared symbol -- all return indexed results with far less token overhead than reading whole files or shelling out to `grep`/`find`.
|
|
97
|
+
|
|
98
|
+
### Navigation Workflow
|
|
99
|
+
|
|
100
|
+
When exploring the structure of an indexed project (rather than hunting for one symbol), use `navigate`:
|
|
101
|
+
|
|
102
|
+
1. `navigate {namespace}` -- root view with children and legal moves
|
|
103
|
+
2. `navigate {namespace, cursor, move: {"ZoomIn": {"child": id}}}` -- descend one level
|
|
104
|
+
3. `navigate {namespace, cursor, move: "ZoomOut" | "Next" | "Prev"}` -- ascend or walk siblings
|
|
105
|
+
4. `navigate {namespace, cursor, move: {"Expand": {"levels": N}}}` -- reveal N levels of subtree at once
|
|
106
|
+
5. `navigate {namespace, cursor, move: {"Peek": {"node": id}}}` -- read content without moving
|
|
107
|
+
|
|
108
|
+
The response always carries `breadcrumb` (position) and `moves` (legal next steps) -- only issue moves the response offers.
|
|
109
|
+
|
|
110
|
+
To place a known item in its full context in one shot, use `get_hierarchy {namespace, node}`: it returns `ancestors` (every layer above), the `node`, and `descendants` (the whole subtree below) with `descendants_total`. Choose the layer by intent -- "what is this" reads the upper layers (project/dir/file notes), "how does it work" reads the lower (definition/chunk); the node's `kind` names the layer.
|
|
111
|
+
|
|
112
|
+
Search finds an entry point; `navigate`/`get_hierarchy` explore from it. A move costs a few graph reads; a fresh search re-pays full ranking. Prefer both over reading whole files when you only need structure or one definition.
|
|
113
|
+
|
|
114
|
+
## Write Gate
|
|
115
|
+
|
|
116
|
+
Before encoding any memory, apply this filter — only encode if at least one is true:
|
|
117
|
+
- It would change future behavior (a lesson, correction, preference, or rule)
|
|
118
|
+
- It represents a commitment or deadline others depend on
|
|
119
|
+
- It is a reasoned decision with rationale worth preserving
|
|
120
|
+
- It is a stable fact that will recur across sessions
|
|
121
|
+
- The user explicitly asked to remember it
|
|
122
|
+
|
|
123
|
+
Skip: routine tool operations, exploratory dead ends, transient debug output, file contents that are already in the codebase.
|
|
124
|
+
|
|
125
|
+
## Memory Hygiene
|
|
126
|
+
|
|
127
|
+
- Apply the write gate before every `encode_memory` call
|
|
128
|
+
- Search before encoding to avoid duplicates
|
|
129
|
+
- Use the automatic project namespace provided by hooks (or omit `namespace` to let Memoreal auto-resolve via `memoreal-ns`)
|
|
130
|
+
- Give `feedback` on recalled memories to train retrieval quality
|
|
131
|
+
- Run `consolidate` periodically to merge duplicates and detect contradictions
|
|
132
|
+
- Use `/memoreal-wrap-up` (or `/memoria-wrap-up`) at the end of long sessions to encode learnings
|
|
133
|
+
- Use `/memoreal-doctor` (or `/memoria-doctor`) if something seems broken
|
|
134
|
+
|
|
135
|
+
## Feature Toggle
|
|
136
|
+
|
|
137
|
+
Session auto-context is controlled by the `MEMOREAL_AUTO_CONTEXT` (or `MEMORIA_AUTO_CONTEXT`) environment variable:
|
|
138
|
+
- `1` (default): enabled -- load context on session start
|
|
139
|
+
- `0`: disabled -- skip automatic context loading
|