engram-mcp-server 1.4.1 → 1.7.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/README.md +613 -167
- package/dist/constants.d.ts +5 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +6 -1
- package/dist/constants.js.map +1 -1
- package/dist/database.d.ts +7 -1
- package/dist/database.d.ts.map +1 -1
- package/dist/database.js +66 -2
- package/dist/database.js.map +1 -1
- package/dist/global-db.d.ts +29 -0
- package/dist/global-db.d.ts.map +1 -0
- package/dist/global-db.js +130 -0
- package/dist/global-db.js.map +1 -0
- package/dist/index.js +81 -30
- package/dist/index.js.map +1 -1
- package/dist/installer/index.d.ts.map +1 -1
- package/dist/installer/index.js +46 -7
- package/dist/installer/index.js.map +1 -1
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +211 -0
- package/dist/migrations.js.map +1 -1
- package/dist/modes/universal.d.ts +3 -0
- package/dist/modes/universal.d.ts.map +1 -0
- package/dist/modes/universal.js +191 -0
- package/dist/modes/universal.js.map +1 -0
- package/dist/repositories/agents.repo.d.ts +13 -0
- package/dist/repositories/agents.repo.d.ts.map +1 -0
- package/dist/repositories/agents.repo.js +32 -0
- package/dist/repositories/agents.repo.js.map +1 -0
- package/dist/repositories/broadcasts.repo.d.ts +13 -0
- package/dist/repositories/broadcasts.repo.d.ts.map +1 -0
- package/dist/repositories/broadcasts.repo.js +49 -0
- package/dist/repositories/broadcasts.repo.js.map +1 -0
- package/dist/repositories/decisions.repo.d.ts +8 -1
- package/dist/repositories/decisions.repo.d.ts.map +1 -1
- package/dist/repositories/decisions.repo.js +55 -6
- package/dist/repositories/decisions.repo.js.map +1 -1
- package/dist/repositories/file-notes.repo.d.ts +8 -0
- package/dist/repositories/file-notes.repo.d.ts.map +1 -1
- package/dist/repositories/file-notes.repo.js +17 -5
- package/dist/repositories/file-notes.repo.js.map +1 -1
- package/dist/repositories/index.d.ts +6 -0
- package/dist/repositories/index.d.ts.map +1 -1
- package/dist/repositories/index.js +6 -0
- package/dist/repositories/index.js.map +1 -1
- package/dist/repositories/sessions.repo.d.ts +6 -0
- package/dist/repositories/sessions.repo.d.ts.map +1 -1
- package/dist/repositories/sessions.repo.js +15 -0
- package/dist/repositories/sessions.repo.js.map +1 -1
- package/dist/repositories/tasks.repo.d.ts +5 -0
- package/dist/repositories/tasks.repo.d.ts.map +1 -1
- package/dist/repositories/tasks.repo.js +21 -0
- package/dist/repositories/tasks.repo.js.map +1 -1
- package/dist/response.d.ts +2 -2
- package/dist/response.d.ts.map +1 -1
- package/dist/response.js +10 -4
- package/dist/response.js.map +1 -1
- package/dist/services/agent-rules.service.d.ts +31 -0
- package/dist/services/agent-rules.service.d.ts.map +1 -0
- package/dist/services/agent-rules.service.js +114 -0
- package/dist/services/agent-rules.service.js.map +1 -0
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +1 -0
- package/dist/services/index.js.map +1 -1
- package/dist/tools/changes.d.ts.map +1 -1
- package/dist/tools/changes.js +56 -2
- package/dist/tools/changes.js.map +1 -1
- package/dist/tools/conventions.d.ts.map +1 -1
- package/dist/tools/conventions.js +15 -5
- package/dist/tools/conventions.js.map +1 -1
- package/dist/tools/coordination.d.ts +3 -0
- package/dist/tools/coordination.d.ts.map +1 -0
- package/dist/tools/coordination.js +420 -0
- package/dist/tools/coordination.js.map +1 -0
- package/dist/tools/decisions.d.ts.map +1 -1
- package/dist/tools/decisions.js +31 -10
- package/dist/tools/decisions.js.map +1 -1
- package/dist/tools/dispatcher-admin.d.ts +3 -0
- package/dist/tools/dispatcher-admin.d.ts.map +1 -0
- package/dist/tools/dispatcher-admin.js +330 -0
- package/dist/tools/dispatcher-admin.js.map +1 -0
- package/dist/tools/dispatcher-memory.d.ts +3 -0
- package/dist/tools/dispatcher-memory.d.ts.map +1 -0
- package/dist/tools/dispatcher-memory.js +1146 -0
- package/dist/tools/dispatcher-memory.js.map +1 -0
- package/dist/tools/file-notes.d.ts.map +1 -1
- package/dist/tools/file-notes.js +248 -13
- package/dist/tools/file-notes.js.map +1 -1
- package/dist/tools/find.d.ts +24 -0
- package/dist/tools/find.d.ts.map +1 -0
- package/dist/tools/find.js +246 -0
- package/dist/tools/find.js.map +1 -0
- package/dist/tools/intelligence.d.ts.map +1 -1
- package/dist/tools/intelligence.js +180 -3
- package/dist/tools/intelligence.js.map +1 -1
- package/dist/tools/knowledge.d.ts +3 -0
- package/dist/tools/knowledge.d.ts.map +1 -0
- package/dist/tools/knowledge.js +165 -0
- package/dist/tools/knowledge.js.map +1 -0
- package/dist/tools/milestones.d.ts.map +1 -1
- package/dist/tools/milestones.js +2 -1
- package/dist/tools/milestones.js.map +1 -1
- package/dist/tools/report.d.ts +3 -0
- package/dist/tools/report.d.ts.map +1 -0
- package/dist/tools/report.js +159 -0
- package/dist/tools/report.js.map +1 -0
- package/dist/tools/scheduler.d.ts.map +1 -1
- package/dist/tools/scheduler.js +142 -10
- package/dist/tools/scheduler.js.map +1 -1
- package/dist/tools/sessions.d.ts +1 -1
- package/dist/tools/sessions.d.ts.map +1 -1
- package/dist/tools/sessions.js +310 -244
- package/dist/tools/sessions.js.map +1 -1
- package/dist/tools/stats.d.ts.map +1 -1
- package/dist/tools/stats.js +19 -0
- package/dist/tools/stats.js.map +1 -1
- package/dist/tools/tasks.d.ts.map +1 -1
- package/dist/tools/tasks.js +5 -4
- package/dist/tools/tasks.js.map +1 -1
- package/dist/types.d.ts +37 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.d.ts +31 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +70 -0
- package/dist/utils.js.map +1 -1
- package/package.json +2 -2
- package/scripts/fix-mcp-config.js +23 -0
package/README.md
CHANGED
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
# 🧠 Engram
|
|
4
4
|
|
|
5
|
-
> **Persistent Memory Cortex for AI coding agents. Gives agents session continuity, change tracking,
|
|
5
|
+
> **Persistent Memory Cortex for AI coding agents. Gives agents session continuity, change tracking, decision logging, and multi-agent coordination across sessions.**
|
|
6
6
|
|
|
7
7
|

|
|
8
8
|

|
|
9
9
|

|
|
10
|
+

|
|
10
11
|

|
|
11
12
|

|
|
12
13
|

|
|
@@ -16,14 +17,17 @@
|
|
|
16
17
|
---
|
|
17
18
|
|
|
18
19
|
## 📋 Table of Contents
|
|
20
|
+
|
|
19
21
|
- [Overview](#overview)
|
|
20
22
|
- [Why Engram?](#why-engram)
|
|
21
23
|
- [Installation (Auto & Manual)](#installation)
|
|
22
|
-
- [✨ What's New in v1.
|
|
24
|
+
- [✨ What's New in v1.7.0](#-whats-new-in-v170)
|
|
25
|
+
- [What's New in v1.6.0](#-whats-new-in-v160)
|
|
23
26
|
- [Features](#features)
|
|
24
27
|
- [Architecture](#architecture)
|
|
25
28
|
- [Tools Reference](#tools-reference)
|
|
26
29
|
- [Using with AI Agents](#using-with-ai-agents)
|
|
30
|
+
- [Multi-Agent Workflows](#multi-agent-workflows)
|
|
27
31
|
- [Contributing](#contributing)
|
|
28
32
|
- [License](#license)
|
|
29
33
|
|
|
@@ -31,7 +35,7 @@
|
|
|
31
35
|
|
|
32
36
|
## Overview
|
|
33
37
|
|
|
34
|
-
**Engram** is an [MCP (Model Context Protocol)](https://modelcontextprotocol.io) server that gives AI coding agents persistent memory across sessions. Instead of re-reading files, re-discovering architecture, and re-learning conventions every time a session starts, the agent calls `
|
|
38
|
+
**Engram** is an [MCP (Model Context Protocol)](https://modelcontextprotocol.io) server that gives AI coding agents persistent memory across sessions. Instead of re-reading files, re-discovering architecture, and re-learning conventions every time a session starts, the agent calls `engram_session(action:"start")` and instantly receives everything it needs.
|
|
35
39
|
|
|
36
40
|
It operates seamlessly as a background brain for popular AI tools like **Claude Code**, **Claude Desktop**, **Cursor**, **Windsurf**, **Cline**, **Trae IDE**, and **GitHub Copilot** (VS Code & Visual Studio).
|
|
37
41
|
|
|
@@ -40,6 +44,7 @@ It operates seamlessly as a background brain for popular AI tools like **Claude
|
|
|
40
44
|
## Why Engram?
|
|
41
45
|
|
|
42
46
|
Every AI coding agent is **stateless by default**. Each new session starts from scratch:
|
|
47
|
+
|
|
43
48
|
- The agent re-reads file structures and re-discovers architecture.
|
|
44
49
|
- Architectural decisions made in previous sessions are forgotten.
|
|
45
50
|
- Conventions agreed upon are lost.
|
|
@@ -50,21 +55,135 @@ Engram solves this by providing a **persistent brain** using a native SQLite (WA
|
|
|
50
55
|
|
|
51
56
|
---
|
|
52
57
|
|
|
53
|
-
## ✨ What's New in v1.
|
|
58
|
+
## ✨ What's New in v1.7.0
|
|
59
|
+
|
|
60
|
+
**v1.7.0** is a precision token-efficiency release — six improvement tracks with zero breaking changes to the 4-dispatcher API surface.
|
|
61
|
+
|
|
62
|
+
### 🔧 MCP Validation Crash Fix (Critical)
|
|
63
|
+
|
|
64
|
+
`z.array(z.unknown())` produced invalid JSON Schema (missing `items`) on `files`, `changes`, and `decisions` input arrays — causing silent validation crashes on VS Code Copilot and Cursor. **Fixed** with fully typed Zod schemas in all three affected inputs.
|
|
65
|
+
|
|
66
|
+
### ⚡ Default Search Limit: 20 → 8
|
|
67
|
+
|
|
68
|
+
`engram_memory(action:"search")` now defaults to 8 results (`DEFAULT_SEARCH_LIMIT`). Typical lookups rarely need more. Still overridable via explicit `limit` param (up to 50).
|
|
69
|
+
|
|
70
|
+
### 📋 Convention Capping by Verbosity
|
|
71
|
+
|
|
72
|
+
Active conventions are sorted (enforced-first) and capped per verbosity: `nano`=0, `minimal`=5, `summary`=10, `full`=all. Total count + hint always returned.
|
|
73
|
+
|
|
74
|
+
### 🗂️ Tiered Tool Catalog (P2)
|
|
75
|
+
|
|
76
|
+
`buildToolCatalog(tier)` delivers the right detail level per agent:
|
|
77
|
+
|
|
78
|
+
- **Tier 2** (new agents) — full params ~1,200 tokens, once
|
|
79
|
+
- **Tier 1** (returning agents) — names + descriptions ~400 tokens
|
|
80
|
+
- **Tier 0** (familiar agents) — names only ~80 tokens
|
|
81
|
+
|
|
82
|
+
Delivery history tracked per `agent_name`. Recoverable anytime via `engram_find(action:"catalog")`.
|
|
83
|
+
|
|
84
|
+
### 🤖 Sub-Agent Session Mode (P3)
|
|
85
|
+
|
|
86
|
+
`engram_session(action:"start", agent_role:"sub", task_id:"T-42")` returns a focused context slice (~300-500 tokens) scoped to that task — instead of the full session boilerplate. Ideal for sub-agents spawned within an orchestrated multi-agent workflow.
|
|
87
|
+
|
|
88
|
+
### 🌐 Built-In Universal Mode (P4)
|
|
89
|
+
|
|
90
|
+
A single `engram` tool with an ~80 token schema — now available **inside the main server** without a separate proxy package:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
# CLI flag
|
|
94
|
+
npx -y engram-mcp-server --mode=universal --project-root /your/project
|
|
95
|
+
|
|
96
|
+
# Environment variable
|
|
97
|
+
ENGRAM_MODE=universal npx -y engram-mcp-server --project-root /your/project
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
BM25 routing and fuzzy action resolution built-in. Use when you want minimal token overhead without running a separate proxy.
|
|
101
|
+
|
|
102
|
+
### 🗑️ 660 Lines of Dead Code Removed (P5)
|
|
103
|
+
|
|
104
|
+
`sessions.ts` shrank from 904 → 316 lines. The deleted `registerSessionTools()` registered old v1.5 individual tools that were never called post-v1.6 migration.
|
|
105
|
+
|
|
106
|
+
### 🔍 Smarter Convention Linting (P6)
|
|
107
|
+
|
|
108
|
+
`engram_find(action:"lint")` now extracts backtick-quoted identifiers for high-priority matching, uses whole-word regex (no false positives on shared stems), and has an expanded STOP_WORDS list. AR-06 agent rule updated to require `executive_summary` on `set_file_notes`.
|
|
109
|
+
|
|
110
|
+
> Full changelog: [RELEASE_NOTES.md](RELEASE_NOTES.md)
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## ✨ What's New in v1.6.0
|
|
115
|
+
|
|
116
|
+
**v1.6.0** is the largest Engram release to date — fourteen feature tracks covering a complete lean-surface rearchitecture, deeper memory intelligence, smarter multi-agent coordination, and a new thin-client proxy.
|
|
117
|
+
|
|
118
|
+
### ⚡ Lean 4-Tool Dispatcher Surface — ~95% Fewer Schema Tokens
|
|
119
|
+
|
|
120
|
+
The MCP surface collapsed from 50+ individual tools to **4 dispatcher tools**: `engram_session`, `engram_memory`, `engram_admin`, `engram_find`. Every previous operation is still available — routed via `action` parameter. Token overhead drops from ~32,500 to ~1,600 per API call. Every AI agent benefits automatically with no configuration change.
|
|
121
|
+
|
|
122
|
+
### 📸 Checkpoints — Offload Working Memory Mid-Session
|
|
123
|
+
|
|
124
|
+
`engram_memory(action:"checkpoint")` saves current understanding, progress, and relevant files to a persistent `checkpoints` table. `get_checkpoint` restores it. Use when approaching context limits without ending the session.
|
|
125
|
+
|
|
126
|
+
### 🔬 Hash-Based Staleness Detection
|
|
127
|
+
|
|
128
|
+
File notes now store a **SHA-256 content hash** alongside `file_mtime`. When mtime matches but the hash differs, confidence is downgraded to `stale` — catching silent edits from formatters, git merges, and auto-saves that preserve timestamps.
|
|
129
|
+
|
|
130
|
+
### 📊 Tiered Verbosity — `nano` Mode
|
|
131
|
+
|
|
132
|
+
Four verbosity levels: `full`, `summary`, `minimal`, and the new **`nano`** — returns only session ID, counts, agent rules, and tool catalog. Under 100 tokens total. For ultra-lean session starts in constrained contexts.
|
|
54
133
|
|
|
55
|
-
|
|
134
|
+
### 🗂️ Executive Summary on File Notes
|
|
56
135
|
|
|
57
|
-
|
|
58
|
-
- **Visual Studio Config Key Fixed (Critical):** Visual Studio reads the `"servers"` JSON key, not `"mcpServers"`. Every install wrote to a key VS never reads — Engram was permanently invisible in Visual Studio. Fixed and confirmed against official Microsoft docs.
|
|
59
|
-
- **Wrong Secondary Paths Removed (High):** VS Code's `~/.vscode/mcp.json` (the extensions dir), Cursor's `APPDATA/Cursor/mcp.json`, and Windsurf's `APPDATA/Windsurf/mcp.json` were all wrong paths that don't exist on any real machine. Removed in favour of the single correct path for each IDE.
|
|
60
|
-
- **Multi-IDE Awareness:** Most developers have multiple IDEs installed simultaneously. The installer now scans all installed IDEs via filesystem and installs to all of them in one pass — without the user needing to run it multiple times with different `--ide` flags.
|
|
61
|
-
- **Better IDE Detection:** Cursor detection now checks `CURSOR_TRACE_ID` and `process.execPath` before falling back to fragile PATH matching. Visual Studio is now detected via `VSINSTALLDIR`/`VisualStudioVersion` env vars.
|
|
62
|
-
- **`--check` Reference Fixed (High):** `--check` was comparing IDE config versions against the running binary, not npm latest — producing backwards results when running from local source. npm latest is now fetched first and used as the sole reference.
|
|
63
|
-
- **CWD Source Conflict Warning:** When `npx` resolves to the local Engram source directory, a clear warning is printed before any output so users understand why the version reported may not match npm.
|
|
64
|
-
- **JetBrains Install Warning:** JetBrains MCP config is managed via the IDE Settings UI, not a config file. A warning is now shown during install directing users to `Settings › Tools › AI Assistant › Model Context Protocol`.
|
|
65
|
-
- **Claude Code CLI Hint Fixed:** The `claude mcp add-json` hint displayed arguments in the wrong order. Fixed to `claude mcp add-json engram '{...}' --scope user`.
|
|
136
|
+
File notes now support an `executive_summary` field — a 2-3 sentence micro summary for Tier-1 reads. Agents can write it once; future sessions get instant context without opening the file.
|
|
66
137
|
|
|
67
|
-
|
|
138
|
+
### 🛡️ Agent Rules — Live-Loaded from GitHub
|
|
139
|
+
|
|
140
|
+
`start_session` now returns `agent_rules` fetched dynamically from the Engram README (7-day local cache at `.engram/agent_rules_cache.json`). Rules update automatically when the README changes — no agent reinstall required.
|
|
141
|
+
|
|
142
|
+
### 🔍 Convention Linting in `engram_find`
|
|
143
|
+
|
|
144
|
+
`engram_find(action:"lint", content:"...")` checks any code snippet against all active conventions and returns a `violations[]` array — useful before committing or during code review.
|
|
145
|
+
|
|
146
|
+
### 🔧 Git Hook Install/Remove via `engram_admin`
|
|
147
|
+
|
|
148
|
+
`engram_admin(action:"install_hooks")` and `remove_hooks` write/remove the Engram post-commit hook directly from within the MCP tool — no CLI needed.
|
|
149
|
+
|
|
150
|
+
### 🌐 Multi-Agent Specialization Routing
|
|
151
|
+
|
|
152
|
+
`engram_memory(action:"agent_sync", specializations:["typescript","database"])` stores agent skill tags. `claim_task` returns an advisory `match_score` comparing agent specializations vs task tags. New `route_task` action finds the best-matched agent for any task.
|
|
153
|
+
|
|
154
|
+
### 🔒 Agent Safety — File Locking & Pending Work
|
|
155
|
+
|
|
156
|
+
`engram_memory(action:"lock_file")` / `unlock_file` prevent concurrent write conflicts. `engram_memory(action:"begin_work")` / `end_work` declare intent before touching files. Abandoned work surfaces in `start_session` as `abandoned_work`.
|
|
157
|
+
|
|
158
|
+
### 🌡️ Context Pressure Detection
|
|
159
|
+
|
|
160
|
+
`check_events` fires `context_pressure` at 50%/70%/85% so agents know when to wrap up before hitting the context wall.
|
|
161
|
+
|
|
162
|
+
### 🤝 Session Handoffs
|
|
163
|
+
|
|
164
|
+
`engram_session(action:"handoff")` packages open tasks, last file touched, git branch, and instructions for the next agent. Auto-surfaced in `start_session` as `handoff_pending`.
|
|
165
|
+
|
|
166
|
+
### 🎬 Session Replay & Diagnostics
|
|
167
|
+
|
|
168
|
+
Every MCP tool call is logged to `tool_call_log`. Session Replay reconstructs the complete chronological timeline of any session.
|
|
169
|
+
|
|
170
|
+
### 📦 `engram-thin-client` Package
|
|
171
|
+
|
|
172
|
+
New `packages/engram-thin-client/` proxy enables Anthropic's `defer_loading` beta — tools are defined with `defer_loading: true` so **zero** schema tokens are consumed upfront. Claude discovers tools on demand via BM25 search. For agents using the Anthropic API directly.
|
|
173
|
+
|
|
174
|
+
### 📦 `engram-universal-client` Package
|
|
175
|
+
|
|
176
|
+
New `packages/engram-universal-thin-client/` proxy exposes Engram as a **single MCP tool** with an ~80-token schema — works with **every** MCP-compatible agent (Cursor, VS Code Copilot, Windsurf, Gemini CLI, GPT-based IDEs, Claude). BM25 routing maps free-text or near-miss action strings to the correct dispatcher. No Anthropic API required.
|
|
177
|
+
|
|
178
|
+
| Approach | Schema tokens/call | Works universally |
|
|
179
|
+
| ------------------------------- | ------------------ | ---------------------------- |
|
|
180
|
+
| v1.5 (50+ tools) | ~32,500 | ✅ |
|
|
181
|
+
| v1.6 dispatcher (4 tools) | ~1,600 | ✅ |
|
|
182
|
+
| `engram-thin-client` | ~0 (deferred) | ⚠️ Anthropic only |
|
|
183
|
+
| `engram-universal-client` proxy | ~80 | ✅ All agents |
|
|
184
|
+
| **v1.7 `--mode=universal`** | **~80** | ✅ **All agents (built-in)** |
|
|
185
|
+
|
|
186
|
+
> Full changelog: [RELEASE_NOTES.md](RELEASE_NOTES.md) · Previous release: **v1.5.0** — Multi-Agent Coordination, Trustworthy Context & Knowledge Intelligence.
|
|
68
187
|
|
|
69
188
|
---
|
|
70
189
|
|
|
@@ -77,14 +196,15 @@ Engram is published to the npm registry. **You do not need to download or compil
|
|
|
77
196
|
Engram uses **SQLite** for persistent storage via the `better-sqlite3` library, which includes a native C++ addon. On most systems this is handled automatically via prebuilt binaries. However, if no prebuilt binary matches your platform, npm will attempt to compile from source — which requires:
|
|
78
197
|
|
|
79
198
|
- **Windows:** [Node.js](https://nodejs.org) (v18+) and [Windows Build Tools](https://github.com/nodejs/node-gyp#on-windows) (Visual C++ Build Tools + Python). Install them with:
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
199
|
+
```bash
|
|
200
|
+
npm install -g windows-build-tools
|
|
201
|
+
```
|
|
202
|
+
Or install **"Desktop development with C++"** via the [Visual Studio Installer](https://visualstudio.microsoft.com/downloads/).
|
|
84
203
|
- **Mac:** Xcode Command Line Tools (`xcode-select --install`)
|
|
85
204
|
- **Linux:** `build-essential` and `python3` (`sudo apt install build-essential python3`)
|
|
86
205
|
|
|
87
206
|
### Option 1: The Magic Installer (Interactive)
|
|
207
|
+
|
|
88
208
|
Run this single command in your terminal. It will automatically detect your IDE and safely inject the configuration:
|
|
89
209
|
|
|
90
210
|
```bash
|
|
@@ -92,18 +212,21 @@ npx -y engram-mcp-server --install
|
|
|
92
212
|
```
|
|
93
213
|
|
|
94
214
|
**Non-interactive mode (CI/CD / Scripting):**
|
|
215
|
+
|
|
95
216
|
```bash
|
|
96
217
|
npx -y engram-mcp-server install --ide vscode --yes
|
|
97
218
|
```
|
|
98
219
|
|
|
99
220
|
**Clean removal:**
|
|
221
|
+
|
|
100
222
|
```bash
|
|
101
223
|
npx -y engram-mcp-server install --remove --ide claudecode
|
|
102
224
|
```
|
|
103
225
|
|
|
104
226
|
**Check installed version vs npm latest:**
|
|
227
|
+
|
|
105
228
|
```bash
|
|
106
|
-
npx -y engram-mcp-server
|
|
229
|
+
npx -y engram-mcp-server --check
|
|
107
230
|
```
|
|
108
231
|
|
|
109
232
|
### Option 2: Global Install (Windows Fallback)
|
|
@@ -117,7 +240,80 @@ engram install --ide <your-ide>
|
|
|
117
240
|
|
|
118
241
|
> **Note:** During install you may see `npm warn deprecated prebuild-install@7.1.3`. This is a cosmetic warning from a transitive dependency used to download SQLite prebuilt binaries. It does not affect functionality and is safe to ignore.
|
|
119
242
|
|
|
120
|
-
### Option 3:
|
|
243
|
+
### Option 3: Universal Mode — Built-In Single-Tool Mode (v1.7+)
|
|
244
|
+
|
|
245
|
+
Starting with v1.7.0, the main server itself can expose a **single `engram` tool** (~80 token schema) via the `--mode=universal` flag — no separate proxy package needed. BM25 fuzzy routing and `discover` action built in.
|
|
246
|
+
|
|
247
|
+
**VS Code Copilot** (`.vscode/mcp.json`):
|
|
248
|
+
|
|
249
|
+
```json
|
|
250
|
+
{
|
|
251
|
+
"servers": {
|
|
252
|
+
"engram": {
|
|
253
|
+
"type": "stdio",
|
|
254
|
+
"command": "npx",
|
|
255
|
+
"args": [
|
|
256
|
+
"-y",
|
|
257
|
+
"engram-mcp-server",
|
|
258
|
+
"--mode=universal",
|
|
259
|
+
"--project-root",
|
|
260
|
+
"${workspaceFolder}"
|
|
261
|
+
]
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
**Cursor** (`~/.cursor/mcp.json`), **Claude Desktop**, **Windsurf** — same pattern with `--mode=universal` added to `args`.
|
|
268
|
+
|
|
269
|
+
Or set `ENGRAM_MODE=universal` as an environment variable instead of using the flag.
|
|
270
|
+
|
|
271
|
+
### Option 4: Universal Thin Client Package (Legacy — v1.6.x)
|
|
272
|
+
|
|
273
|
+
The original separate proxy package for maximum token efficiency. Still works; prefer Option 3 for v1.7+ installs.
|
|
274
|
+
|
|
275
|
+
**Cursor** (`~/.cursor/mcp.json`):
|
|
276
|
+
|
|
277
|
+
```json
|
|
278
|
+
{
|
|
279
|
+
"mcpServers": {
|
|
280
|
+
"engram": {
|
|
281
|
+
"command": "npx",
|
|
282
|
+
"args": [
|
|
283
|
+
"-y",
|
|
284
|
+
"engram-universal-client",
|
|
285
|
+
"--project-root",
|
|
286
|
+
"/absolute/path/to/project"
|
|
287
|
+
]
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
**VS Code Copilot** (`.vscode/mcp.json`):
|
|
294
|
+
|
|
295
|
+
```json
|
|
296
|
+
{
|
|
297
|
+
"servers": {
|
|
298
|
+
"engram": {
|
|
299
|
+
"type": "stdio",
|
|
300
|
+
"command": "npx",
|
|
301
|
+
"args": [
|
|
302
|
+
"-y",
|
|
303
|
+
"engram-universal-client",
|
|
304
|
+
"--project-root",
|
|
305
|
+
"${workspaceFolder}"
|
|
306
|
+
]
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
**Windsurf / Gemini CLI / any MCP agent** — same pattern, replace `--project-root` with your project path.
|
|
313
|
+
|
|
314
|
+
> The agent should call `engram({"action":"start"})` first. The response includes `tool_catalog` with all available actions.
|
|
315
|
+
|
|
316
|
+
### Option 5: Manual Configuration
|
|
121
317
|
|
|
122
318
|
If you prefer to configure manually, find your IDE below:
|
|
123
319
|
|
|
@@ -125,142 +321,166 @@ If you prefer to configure manually, find your IDE below:
|
|
|
125
321
|
<summary><strong>Claude Code (CLI)</strong></summary>
|
|
126
322
|
|
|
127
323
|
Run this in your terminal:
|
|
324
|
+
|
|
128
325
|
```bash
|
|
129
326
|
claude mcp add-json --scope=user engram '{"type":"stdio","command":"cmd","args":["/c","npx","-y","engram-mcp-server"]}'
|
|
130
327
|
```
|
|
131
|
-
|
|
328
|
+
|
|
329
|
+
_(Omit `"command":"cmd"` and `"args":["/c", ...]` on Mac/Linux, use just `"command":"npx"`)._
|
|
330
|
+
|
|
132
331
|
</details>
|
|
133
332
|
|
|
134
333
|
<details>
|
|
135
334
|
<summary><strong>Claude Desktop</strong></summary>
|
|
136
335
|
|
|
137
336
|
Add to your `claude_desktop_config.json`:
|
|
337
|
+
|
|
138
338
|
- **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
|
|
139
339
|
- **Mac:** `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
140
340
|
|
|
141
341
|
```json
|
|
142
342
|
{
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
343
|
+
"mcpServers": {
|
|
344
|
+
"engram": {
|
|
345
|
+
"command": "npx",
|
|
346
|
+
"args": ["-y", "engram-mcp-server"]
|
|
347
|
+
}
|
|
147
348
|
}
|
|
148
|
-
}
|
|
149
349
|
}
|
|
150
350
|
```
|
|
351
|
+
|
|
151
352
|
</details>
|
|
152
353
|
|
|
153
354
|
<details>
|
|
154
355
|
<summary><strong>VS Code (GitHub Copilot)</strong></summary>
|
|
155
356
|
|
|
156
357
|
Create `.vscode/mcp.json` in your project root, or add to your global user `settings.json`:
|
|
358
|
+
|
|
157
359
|
```json
|
|
158
360
|
{
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
361
|
+
"servers": {
|
|
362
|
+
"engram": {
|
|
363
|
+
"type": "stdio",
|
|
364
|
+
"command": "npx",
|
|
365
|
+
"args": ["-y", "engram-mcp-server"]
|
|
366
|
+
}
|
|
164
367
|
}
|
|
165
|
-
}
|
|
166
368
|
}
|
|
167
369
|
```
|
|
370
|
+
|
|
168
371
|
</details>
|
|
169
372
|
|
|
170
373
|
<details>
|
|
171
374
|
<summary><strong>Cursor & Windsurf</strong></summary>
|
|
172
375
|
|
|
173
376
|
For Cursor, edit `~/.cursor/mcp.json`. For Windsurf, edit `~/.codeium/windsurf/mcp_config.json`:
|
|
377
|
+
|
|
174
378
|
```json
|
|
175
379
|
{
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
380
|
+
"mcpServers": {
|
|
381
|
+
"engram": {
|
|
382
|
+
"command": "npx",
|
|
383
|
+
"args": ["-y", "engram-mcp-server"]
|
|
384
|
+
}
|
|
180
385
|
}
|
|
181
|
-
}
|
|
182
386
|
}
|
|
183
387
|
```
|
|
388
|
+
|
|
184
389
|
</details>
|
|
185
390
|
|
|
186
391
|
<details>
|
|
187
392
|
<summary><strong>Visual Studio 2022/2026</strong></summary>
|
|
188
393
|
|
|
189
394
|
Create `.vs/mcp.json` in your solution root:
|
|
395
|
+
|
|
190
396
|
```json
|
|
191
397
|
{
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
398
|
+
"mcpServers": {
|
|
399
|
+
"engram": {
|
|
400
|
+
"command": "npx",
|
|
401
|
+
"args": ["-y", "engram-mcp-server"]
|
|
402
|
+
}
|
|
196
403
|
}
|
|
197
|
-
}
|
|
198
404
|
}
|
|
199
405
|
```
|
|
406
|
+
|
|
200
407
|
</details>
|
|
201
408
|
|
|
202
409
|
<details>
|
|
203
410
|
<summary><strong>Trae IDE</strong></summary>
|
|
204
411
|
|
|
205
412
|
For Trae IDE, edit `.trae/mcp.json` in your project root:
|
|
413
|
+
|
|
206
414
|
```json
|
|
207
415
|
{
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
416
|
+
"mcpServers": {
|
|
417
|
+
"engram": {
|
|
418
|
+
"type": "stdio",
|
|
419
|
+
"command": "npx",
|
|
420
|
+
"args": ["-y", "engram-mcp-server"]
|
|
421
|
+
}
|
|
213
422
|
}
|
|
214
|
-
}
|
|
215
423
|
}
|
|
216
424
|
```
|
|
425
|
+
|
|
217
426
|
</details>
|
|
218
427
|
|
|
219
428
|
<details>
|
|
220
429
|
<summary><strong>JetBrains (Copilot Plugin)</strong></summary>
|
|
221
430
|
|
|
222
431
|
Edit `~/.config/github-copilot/intellij/mcp.json` or use the built-in Settings → MCP Server:
|
|
432
|
+
|
|
223
433
|
```json
|
|
224
434
|
{
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
435
|
+
"mcpServers": {
|
|
436
|
+
"engram": {
|
|
437
|
+
"command": "npx",
|
|
438
|
+
"args": ["-y", "engram-mcp-server"]
|
|
439
|
+
}
|
|
229
440
|
}
|
|
230
|
-
}
|
|
231
441
|
}
|
|
232
442
|
```
|
|
443
|
+
|
|
233
444
|
</details>
|
|
234
445
|
|
|
235
446
|
<details>
|
|
236
447
|
<summary><strong>Cline / Roo Code</strong></summary>
|
|
237
448
|
|
|
238
449
|
In the extension settings → MCP Servers:
|
|
450
|
+
|
|
239
451
|
```json
|
|
240
452
|
{
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
453
|
+
"mcpServers": {
|
|
454
|
+
"engram": {
|
|
455
|
+
"command": "npx",
|
|
456
|
+
"args": ["-y", "engram-mcp-server"]
|
|
457
|
+
}
|
|
245
458
|
}
|
|
246
|
-
}
|
|
247
459
|
}
|
|
248
460
|
```
|
|
461
|
+
|
|
249
462
|
</details>
|
|
250
463
|
|
|
251
464
|
---
|
|
252
465
|
|
|
253
466
|
## Features
|
|
254
467
|
|
|
255
|
-
- 🧠 **Session Continuity:** Each session automatically receives the previous session's summary, changes,
|
|
256
|
-
-
|
|
257
|
-
-
|
|
258
|
-
-
|
|
259
|
-
-
|
|
468
|
+
- 🧠 **Session Continuity:** Each session automatically receives the previous session's summary, changes, decisions, and full project context. Use the `focus` parameter to FTS5-rank all context around the topic you're about to work on. `suggested_focus` is returned automatically when no focus is provided.
|
|
469
|
+
- 🔐 **Trustworthy Context:** File notes track `file_mtime` and `git_branch` at write time. Returns `confidence` (`high`, `medium`, `stale`, `unknown`) and a `branch_warning` when the current branch differs from when notes were stored.
|
|
470
|
+
- 🔒 **Agent Safety:** `engram_memory(action:"lock_file")` / `unlock_file` prevent concurrent write conflicts. `begin_work` / `end_work` declare intent before touching files. Abandoned work from prior sessions surfaces in `start_session`.
|
|
471
|
+
- 🤖 **Multi-Agent Coordination:** Multiple agents collaborate simultaneously. Atomic task claiming prevents duplicates. `route_task` finds the best-matched agent. `agent_sync` tracks who is alive and their specializations.
|
|
472
|
+
- 🤝 **Session Handoffs:** `engram_session(action:"handoff")` packages context (tasks, files, git branch, instructions) for graceful agent-to-agent transfers. `acknowledge_handoff` clears the pending handoff.
|
|
473
|
+
- 🌡️ **Context Pressure Detection:** `engram_memory(action:"check_events")` fires at 50%/70%/85% context fill — giving agents advance warning before hitting the context wall.
|
|
474
|
+
- ⏰ **Scheduled Events:** Postpone tasks or set reminders. Triggers include `next_session`, `datetime`, or `task_complete`.
|
|
475
|
+
- 📝 **Change Tracking:** Records every file modification with context. Combines agent-recorded changes with `git` history. Git hook integration (`--install-hooks`) auto-records commits.
|
|
476
|
+
- 🏗️ **Architectural Decision Records:** Logs design decisions with rationale, affected files, and tags forever. `depends_on` field models prerequisite decision chains. FTS5 deduplication warns on similar existing decisions.
|
|
477
|
+
- 📁 **File Intelligence:** Stores per-file notes (purpose, deps, layer, complexity) with branch-aware staleness detection preventing endless re-reads.
|
|
260
478
|
- 📐 **Convention Tracking:** Records and enforces project conventions (naming, testing, styling).
|
|
261
|
-
- ✅ **Task Management:** Work items persist across sessions
|
|
262
|
-
- 🔍 **Precise Full-Text Search (FTS5):** High-performance ranked search across all memory, with
|
|
263
|
-
-
|
|
479
|
+
- ✅ **Task Management:** Work items persist across sessions with priority, status, and multi-agent claiming. End-session warns on unclosed claimed tasks.
|
|
480
|
+
- 🔍 **Precise Full-Text Search (FTS5):** High-performance ranked search across all memory, with `context_chars` enrichment and per-result `confidence` levels for file note results.
|
|
481
|
+
- 🎬 **Session Replay:** Reconstructs the complete tool-call + change + decision timeline for any session via the `tool_call_log` table.
|
|
482
|
+
- 💾 **Backup & Restore:** `engram_admin(action:"backup")` creates timestamped SQLite copies to any path (like Dropbox/OneDrive) for cross-machine portability.
|
|
483
|
+
- 📊 **Reports, Stats & Commit Suggestions:** Generate Markdown project reports, per-agent activity metrics, and conventional commit messages from session data.
|
|
264
484
|
|
|
265
485
|
---
|
|
266
486
|
|
|
@@ -268,7 +488,9 @@ In the extension settings → MCP Servers:
|
|
|
268
488
|
|
|
269
489
|
```mermaid
|
|
270
490
|
graph TB
|
|
271
|
-
|
|
491
|
+
A1([Agent 1])
|
|
492
|
+
A2([Agent 2])
|
|
493
|
+
A3([Agent N])
|
|
272
494
|
MCP([MCP Protocol Server])
|
|
273
495
|
NPM([npm Registry / GitHub])
|
|
274
496
|
|
|
@@ -278,165 +500,389 @@ graph TB
|
|
|
278
500
|
GS[Git Tracking Service]
|
|
279
501
|
ES[Event Trigger Service]
|
|
280
502
|
US[Update Service]
|
|
503
|
+
CO[Coordination Service]
|
|
281
504
|
end
|
|
282
505
|
|
|
283
506
|
subgraph Data Layer
|
|
284
|
-
DB[(SQLite WAL)]
|
|
507
|
+
DB[(SQLite WAL\nProject DB)]
|
|
285
508
|
FTS[FTS5 Search Index]
|
|
509
|
+
GDB[(Global KB\n~/.engram/global.db)]
|
|
286
510
|
end
|
|
287
511
|
|
|
288
|
-
|
|
289
|
-
MCP --> TS & CS & GS & ES & US
|
|
290
|
-
TS & CS & GS & ES --> DB
|
|
512
|
+
A1 & A2 & A3 <-->|JSON-RPC| MCP
|
|
513
|
+
MCP --> TS & CS & GS & ES & US & CO
|
|
514
|
+
TS & CS & GS & ES & CO --> DB
|
|
291
515
|
US -->|async, fire-and-forget| NPM
|
|
292
516
|
US --> DB
|
|
293
517
|
DB --> FTS
|
|
518
|
+
MCP -->|export_global| GDB
|
|
519
|
+
MCP -->|get_global_knowledge| GDB
|
|
294
520
|
```
|
|
295
521
|
|
|
296
522
|
---
|
|
297
523
|
|
|
298
524
|
## Tools Reference
|
|
299
525
|
|
|
300
|
-
Engram exposes
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
|
307
|
-
|
|
|
308
|
-
| `
|
|
309
|
-
| `
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
|
320
|
-
|
|
321
|
-
| `
|
|
322
|
-
| `
|
|
323
|
-
| `
|
|
324
|
-
| `
|
|
325
|
-
| `
|
|
326
|
-
|
|
327
|
-
|
|
526
|
+
Engram v1.7.0 exposes **4 dispatcher tools** (or 1 tool in `--mode=universal`). Every operation routes through one of them via an `action` parameter. Token overhead is ~1,600 tokens for the standard surface, or ~80 tokens in universal mode — a ~95-99% reduction from the previous 50-tool surface.
|
|
527
|
+
|
|
528
|
+
> **Use `engram_find`** when you don't know the exact `action` name. It returns parameter schemas and descriptions for any operation.
|
|
529
|
+
|
|
530
|
+
### `engram_session` — Session Lifecycle
|
|
531
|
+
|
|
532
|
+
| Action | Purpose |
|
|
533
|
+
| ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
534
|
+
| `start` | Begin a session. Returns context, agent rules, tool catalog, handoff_pending, abandoned_work, suggested_focus. Pass `verbosity` to control response depth. |
|
|
535
|
+
| `start` + `agent_role:"sub"` | **v1.7** Sub-agent mode. Pass `task_id` to receive focused context (~300-500t): task details, relevant files, matching decisions, and capped conventions only. |
|
|
536
|
+
| `end` | End session with a summary. Warns on unclosed claimed tasks. |
|
|
537
|
+
| `get_history` | Retrieve past session summaries. |
|
|
538
|
+
| `handoff` | Package open tasks, git branch, and instructions for the next agent. |
|
|
539
|
+
| `acknowledge_handoff` | Clear a pending handoff from future start responses. |
|
|
540
|
+
|
|
541
|
+
### `engram_memory` — All Memory Operations
|
|
542
|
+
|
|
543
|
+
| Action | Purpose |
|
|
544
|
+
| ------------------------ | ------------------------------------------------------------------------------------------------------------------- |
|
|
545
|
+
| `get_file_notes` | Retrieve file notes with `confidence` (hash-based staleness), `branch_warning`, `lock_status`, `executive_summary`. |
|
|
546
|
+
| `set_file_notes` | Store file intelligence (purpose, layer, complexity, dependencies, `executive_summary`, `content_hash`). |
|
|
547
|
+
| `set_file_notes_batch` | Store notes for multiple files atomically. |
|
|
548
|
+
| `record_change` | Log file changes with `change_type`, `description`, `impact_scope`, `diff_summary`. |
|
|
549
|
+
| `get_file_history` | Change history for a file. |
|
|
550
|
+
| `record_decision` | Log architectural decisions with `rationale`, `tags`, `affected_files`, `depends_on`, `supersedes`. |
|
|
551
|
+
| `record_decisions_batch` | Record multiple decisions atomically. |
|
|
552
|
+
| `get_decisions` | Retrieve decisions by status, tag, file, or dependency chain. |
|
|
553
|
+
| `update_decision` | Change decision status. Returns `cascade_warning` if dependents exist. |
|
|
554
|
+
| `add_convention` | Record a project convention. |
|
|
555
|
+
| `get_conventions` | Retrieve active conventions. |
|
|
556
|
+
| `create_task` | Create a persistent work item with priority, tags, and blocking chains. |
|
|
557
|
+
| `update_task` | Update task status, priority, description, or blocking. |
|
|
558
|
+
| `get_tasks` | Retrieve tasks by status, priority, or tag. |
|
|
559
|
+
| `checkpoint` | Save current understanding + progress to a persistent checkpoint. |
|
|
560
|
+
| `get_checkpoint` | Restore the last saved checkpoint. |
|
|
561
|
+
| `search` | FTS5-ranked full-text search across all memory. Results include `confidence`. |
|
|
562
|
+
| `what_changed` | Diff report of all changes since a given time or session. |
|
|
563
|
+
| `get_dependency_map` | File dependency graph for a module. |
|
|
564
|
+
| `record_milestone` | Log a project milestone. |
|
|
565
|
+
| `schedule_event` | Schedule deferred work with a trigger type. |
|
|
566
|
+
| `check_events` | Check triggered events including `context_pressure` at 50%/70%/85%. |
|
|
567
|
+
| `agent_sync` | Heartbeat — registers agent with optional `specializations[]`. Returns unread broadcasts. |
|
|
568
|
+
| `claim_task` | Atomically claim a task. Returns advisory `match_score` vs agent specializations. |
|
|
569
|
+
| `release_task` | Release a claimed task back to the pool. |
|
|
570
|
+
| `get_agents` | List all registered agents with status, last-seen, and specializations. |
|
|
571
|
+
| `route_task` | Find the best-matched agent for a task based on specialization scoring. |
|
|
572
|
+
| `broadcast` | Send a message to all agents. |
|
|
573
|
+
| `dump` | Auto-classify unstructured text into decisions, tasks, conventions, findings. |
|
|
574
|
+
|
|
575
|
+
### `engram_admin` — Maintenance & Git Hooks
|
|
576
|
+
|
|
577
|
+
| Action | Purpose |
|
|
578
|
+
| --------------- | ---------------------------------------------------------- |
|
|
579
|
+
| `backup` | Create a database backup. |
|
|
580
|
+
| `restore` | Restore from a backup. |
|
|
581
|
+
| `list_backups` | List available backup files. |
|
|
582
|
+
| `export` | Export all memory to JSON. |
|
|
583
|
+
| `import` | Import from exported JSON. |
|
|
584
|
+
| `compact` | Compress old session data. |
|
|
585
|
+
| `clear` | Clear memory tables (destructive — requires confirmation). |
|
|
586
|
+
| `stats` | Project stats with per-agent contribution metrics. |
|
|
587
|
+
| `health` | Database health check and diagnostics. |
|
|
588
|
+
| `config` | Read or update runtime config values. |
|
|
589
|
+
| `scan_project` | Scan and cache project filesystem structure. |
|
|
590
|
+
| `install_hooks` | Write Engram post-commit git hook to `.git/hooks/`. |
|
|
591
|
+
| `remove_hooks` | Remove Engram hook from `.git/hooks/post-commit`. |
|
|
592
|
+
|
|
593
|
+
### `engram_find` — Discovery & Linting
|
|
594
|
+
|
|
595
|
+
| Action | Purpose |
|
|
596
|
+
| -------------------- | --------------------------------------------------------------------------------------- |
|
|
597
|
+
| `search` _(default)_ | Search the tool catalog by keyword. Returns action name, description, and param schema. |
|
|
598
|
+
| `lint` | Check a code/text snippet against all active conventions. Returns `violations[]`. |
|
|
328
599
|
|
|
329
600
|
---
|
|
330
601
|
|
|
331
602
|
## Using with AI Agents
|
|
332
603
|
|
|
333
|
-
Add the following to your agent's system prompt or custom instructions
|
|
604
|
+
Add the following to your agent's system prompt or custom instructions — Cursor Rules, `.github/copilot-instructions.md`, `CLAUDE.md`, or whichever file your IDE reads. The goal is to make the agent consult Engram **before** doing work, not just after. That's where most of the token and time savings come from.
|
|
334
605
|
|
|
335
|
-
|
|
336
|
-
You have access to Engram, a persistent memory MCP server. It stores everything learned about this project across all sessions: file notes, architectural decisions, conventions, tasks, and change history. Use it to avoid re-reading files you have already analysed, re-debating settled decisions, and re-discovering known context.
|
|
606
|
+
> You have access to **Engram**, a persistent memory MCP server. It stores everything learned about this project across all sessions: file notes, architectural decisions, conventions, tasks, and change history. Use it to avoid re-reading files already analysed, re-debating settled decisions, and re-discovering known context.
|
|
337
607
|
|
|
338
|
-
|
|
608
|
+
---
|
|
339
609
|
|
|
340
|
-
|
|
610
|
+
### 🟢 Session Start
|
|
341
611
|
|
|
342
|
-
|
|
343
|
-
* **`active_decisions`**: These are binding. Follow them; do not re-debate them. To change one, supersede it with a new `engram_record_decision` call.
|
|
344
|
-
* **`active_conventions`**: Enforce these in every file you touch this session.
|
|
345
|
-
* **`open_tasks`**: These are pending work items. Ask the user which to focus on if unclear.
|
|
346
|
-
* **`update_available` (if set)**: Immediately tell the user:
|
|
347
|
-
> "Engram v{available_version} is available (you have {installed_version}). Changes: {changelog}. Would you like to update, skip this version, or postpone?"
|
|
348
|
-
|
|
349
|
-
Then act on their choice:
|
|
350
|
-
* **Update**: instruct them to run: `npx -y engram-mcp-server install`
|
|
351
|
-
* **Skip**: `engram_config action=set key=auto_update_skip_version value={version}`
|
|
352
|
-
* **Postpone 7d**: `engram_config action=set key=auto_update_remind_after value=7d`
|
|
353
|
-
* **Disable**: `engram_config action=set key=auto_update_check value=false`
|
|
612
|
+
**Always call `engram_session(action:"start")` first** — before reading any file or taking any action. Pass `focus` when you know what you're about to work on — it FTS5-ranks returned context around that topic.
|
|
354
613
|
|
|
355
|
-
|
|
614
|
+
```js
|
|
615
|
+
engram_session({
|
|
616
|
+
action: "start",
|
|
617
|
+
agent_name: "claude",
|
|
618
|
+
verbosity: "summary",
|
|
619
|
+
focus: "authentication refactor",
|
|
620
|
+
});
|
|
621
|
+
```
|
|
356
622
|
|
|
357
|
-
|
|
623
|
+
Act on everything it returns:
|
|
624
|
+
|
|
625
|
+
| Field | What to do |
|
|
626
|
+
| -------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
|
|
627
|
+
| `previous_session.summary` | Read immediately. Do not re-explore what is already known. |
|
|
628
|
+
| `active_decisions` | Binding. Follow them; do not re-debate. Supersede with `engram_memory(action:"record_decision")` if they must change. |
|
|
629
|
+
| `active_conventions` | Enforce in every file you touch this session. |
|
|
630
|
+
| `open_tasks` | Pending work items. Ask the user which to focus on if unclear. |
|
|
631
|
+
| `abandoned_work` | Work items left open by a previous session that ended unexpectedly. Review and resume or close. |
|
|
632
|
+
| `handoff_pending` | A structured handoff from the previous agent. Read instructions, then call `engram_session(action:"acknowledge_handoff")`. |
|
|
633
|
+
| `suggested_focus` | Auto-derived topic hint. Pass as `focus` on the next `start` call for filtered context. |
|
|
634
|
+
| `triggered_events` | Scheduled reminders or deferred work now triggered. Act on them. |
|
|
635
|
+
| `agent_rules` | Live-loaded rules from the Engram README. Treat as binding session instructions. |
|
|
636
|
+
| `tool_catalog` | Full list of available `engram_memory` and `engram_admin` actions with schemas. |
|
|
637
|
+
| `update_available` | Tell the user: _"Engram v{available_version} is available. Update, skip, or postpone?"_ |
|
|
638
|
+
|
|
639
|
+
If `update_available` is set, respond to the user's choice:
|
|
640
|
+
|
|
641
|
+
- **Update** → `npx -y engram-mcp-server install`
|
|
642
|
+
- **Skip** → `engram_admin({ action: "config", op: "set", key: "auto_update_skip_version", value: "{version}" })`
|
|
643
|
+
- **Postpone** → `engram_admin({ action: "config", op: "set", key: "auto_update_remind_after", value: "7d" })`
|
|
644
|
+
- **Disable** → `engram_admin({ action: "config", op: "set", key: "auto_update_check", value: "false" })`
|
|
358
645
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
646
|
+
---
|
|
647
|
+
|
|
648
|
+
### 📂 Before Reading Any File
|
|
649
|
+
|
|
650
|
+
Always check Engram before opening a file:
|
|
362
651
|
|
|
363
|
-
|
|
364
|
-
|
|
652
|
+
```js
|
|
653
|
+
engram_memory({ action: "get_file_notes", file_path: "path/to/file.ts" });
|
|
654
|
+
```
|
|
365
655
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
656
|
+
- **`confidence: "high"`** → Use stored notes. Only open the file if you need to edit it.
|
|
657
|
+
- **`confidence: "medium"`** → Notes exist but the file may have minor changes. Use as a guide; open if precision matters.
|
|
658
|
+
- **`confidence: "stale"`** → The file has changed significantly since notes were stored. Re-read and update notes.
|
|
659
|
+
- **No notes** → Read the file, then immediately call `engram_memory(action:"set_file_notes")` with `file_path`, `purpose`, `dependencies`, `dependents`, `layer`, `complexity`, `notes`. Batch multiple files with `set_file_notes_batch`.
|
|
370
660
|
|
|
371
|
-
|
|
372
|
-
Re-read the file and update the notes.
|
|
661
|
+
> **Rule:** Never read a file already analysed in a previous session without checking Engram first.
|
|
373
662
|
|
|
374
|
-
|
|
663
|
+
---
|
|
375
664
|
|
|
376
|
-
|
|
665
|
+
### 🏛️ Before Making Any Design Decision
|
|
377
666
|
|
|
378
667
|
Before choosing an implementation approach, search for an existing decision:
|
|
379
668
|
|
|
380
|
-
```
|
|
381
|
-
|
|
669
|
+
```js
|
|
670
|
+
engram_memory({
|
|
671
|
+
action: "search",
|
|
672
|
+
query: "relevant keywords",
|
|
673
|
+
scope: "decisions",
|
|
674
|
+
});
|
|
382
675
|
```
|
|
383
676
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
```
|
|
387
|
-
|
|
677
|
+
- **Decision exists** → Follow it.
|
|
678
|
+
- **Should change** → Explain why, then supersede:
|
|
679
|
+
```js
|
|
680
|
+
engram_memory({ action: "record_decision", decision: "...", supersedes: <id> })
|
|
388
681
|
```
|
|
389
|
-
|
|
390
|
-
```
|
|
391
|
-
|
|
682
|
+
- **No decision exists** → Make the call and record it:
|
|
683
|
+
```js
|
|
684
|
+
engram_memory({
|
|
685
|
+
action: "record_decision",
|
|
686
|
+
decision,
|
|
687
|
+
rationale,
|
|
688
|
+
affected_files,
|
|
689
|
+
tags,
|
|
690
|
+
});
|
|
392
691
|
```
|
|
393
692
|
|
|
394
|
-
|
|
693
|
+
---
|
|
694
|
+
|
|
695
|
+
### ✏️ When Modifying Files
|
|
395
696
|
|
|
396
697
|
After every meaningful change, record it. Batch where possible:
|
|
397
698
|
|
|
398
|
-
```
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
699
|
+
```js
|
|
700
|
+
engram_memory({
|
|
701
|
+
action: "record_change",
|
|
702
|
+
changes: [
|
|
703
|
+
{
|
|
704
|
+
file_path,
|
|
705
|
+
change_type, // created | modified | refactored | deleted | renamed | moved | config_changed
|
|
706
|
+
description, // What changed AND why — not just the action. Future sessions read this.
|
|
707
|
+
impact_scope, // local | module | cross_module | global
|
|
708
|
+
},
|
|
709
|
+
],
|
|
710
|
+
});
|
|
405
711
|
```
|
|
406
712
|
|
|
407
|
-
|
|
713
|
+
---
|
|
714
|
+
|
|
715
|
+
### 🔍 When You Don't Know Something
|
|
408
716
|
|
|
409
|
-
|
|
717
|
+
Search Engram before asking the user — they may have already explained it to a previous session:
|
|
410
718
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
719
|
+
```js
|
|
720
|
+
engram_memory({ action: "search", query: "keywords", context_chars: 200 });
|
|
721
|
+
engram_admin({ action: "scan_project" }); // project structure
|
|
722
|
+
engram_memory({ action: "get_decisions" }); // architecture questions
|
|
723
|
+
engram_memory({ action: "get_conventions" }); // style / pattern questions
|
|
724
|
+
engram_memory({ action: "get_file_notes", file_path: "..." }); // what is known about a file
|
|
725
|
+
engram_find({ query: "what I want to do" }); // discover the right action
|
|
726
|
+
```
|
|
416
727
|
|
|
417
|
-
|
|
728
|
+
---
|
|
729
|
+
|
|
730
|
+
### 🔴 Session End
|
|
418
731
|
|
|
419
732
|
Before ending every session:
|
|
420
733
|
|
|
421
|
-
1.
|
|
422
|
-
2.
|
|
423
|
-
```
|
|
424
|
-
|
|
734
|
+
1. Record all file changes not yet recorded.
|
|
735
|
+
2. Create tasks for anything incomplete or blocked:
|
|
736
|
+
```js
|
|
737
|
+
engram_memory({ action: "create_task", title, description, priority });
|
|
425
738
|
```
|
|
426
|
-
3.
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
739
|
+
3. Call `engram_session({ action: "end", summary: "..." })` with a summary that includes:
|
|
740
|
+
- Exactly what was done — file names, function names, specific changes
|
|
741
|
+
- What is pending or blocked, and why
|
|
742
|
+
- Any new patterns, gotchas, or constraints discovered
|
|
743
|
+
- Which tasks were completed or partially done
|
|
431
744
|
|
|
432
745
|
A precise summary is what allows the next session to start immediately without re-reading files or re-asking the user for context.
|
|
746
|
+
|
|
747
|
+
---
|
|
748
|
+
|
|
749
|
+
## Multi-Agent Workflows
|
|
750
|
+
|
|
751
|
+
When running multiple agents simultaneously on the same project, use the coordination tools to keep them in sync:
|
|
752
|
+
|
|
753
|
+
### Agent Registration & Heartbeat
|
|
754
|
+
|
|
755
|
+
Each agent should call `agent_sync` periodically to stay visible and receive broadcasts:
|
|
756
|
+
|
|
757
|
+
```js
|
|
758
|
+
// On startup and every ~2 minutes
|
|
759
|
+
engram_memory({
|
|
760
|
+
action: "agent_sync",
|
|
761
|
+
agent_id: "agent-frontend",
|
|
762
|
+
agent_name: "Frontend Specialist",
|
|
763
|
+
status: "working",
|
|
764
|
+
current_task_id: 42,
|
|
765
|
+
specializations: ["typescript", "react", "ui"], // ← new in v1.6.0
|
|
766
|
+
});
|
|
767
|
+
// Returns: { agent, unread_broadcasts: [...] }
|
|
768
|
+
```
|
|
769
|
+
|
|
770
|
+
### Atomic Task Claiming
|
|
771
|
+
|
|
772
|
+
Use `claim_task` to safely grab a task without duplicating work. Returns advisory `match_score`:
|
|
773
|
+
|
|
774
|
+
```js
|
|
775
|
+
engram_memory({
|
|
776
|
+
action: "claim_task",
|
|
777
|
+
task_id: 42,
|
|
778
|
+
agent_id: "agent-frontend",
|
|
779
|
+
});
|
|
780
|
+
// Returns: { task, match_score: 85, match_warning? }
|
|
433
781
|
```
|
|
434
782
|
|
|
783
|
+
### Find the Best Agent for a Task
|
|
784
|
+
|
|
785
|
+
```js
|
|
786
|
+
engram_memory({ action: "route_task", task_id: 42 });
|
|
787
|
+
// Returns: { best_match: { agent_id, agent_name, match_score }, all_candidates: [...] }
|
|
788
|
+
```
|
|
789
|
+
|
|
790
|
+
### Broadcasting Between Agents
|
|
791
|
+
|
|
792
|
+
```js
|
|
793
|
+
engram_memory({
|
|
794
|
+
action: "broadcast",
|
|
795
|
+
from_agent: "agent-backend",
|
|
796
|
+
message:
|
|
797
|
+
"⚠️ auth.ts API changed — agents touching auth endpoints need to update",
|
|
798
|
+
expires_in_minutes: 60,
|
|
799
|
+
});
|
|
800
|
+
```
|
|
801
|
+
|
|
802
|
+
### The `dump` Power Tool
|
|
803
|
+
|
|
804
|
+
```js
|
|
805
|
+
engram_memory({
|
|
806
|
+
action: "dump",
|
|
807
|
+
raw_text: `
|
|
808
|
+
We decided to use JWT with 15-minute expiry.
|
|
809
|
+
TODO: add refresh token endpoint
|
|
810
|
+
Always use bcrypt cost factor 12.
|
|
811
|
+
`,
|
|
812
|
+
agent_id: "agent-research",
|
|
813
|
+
});
|
|
814
|
+
// Auto-classifies into decisions, tasks, conventions, findings
|
|
815
|
+
```
|
|
816
|
+
|
|
817
|
+
### Coordination Quick Reference
|
|
818
|
+
|
|
819
|
+
| Situation | Call |
|
|
820
|
+
| -------------------------- | --------------------------------------------------------- |
|
|
821
|
+
| Register / heartbeat | `engram_memory(action:"agent_sync")` |
|
|
822
|
+
| Find best agent for task | `engram_memory(action:"route_task", task_id)` |
|
|
823
|
+
| Claim a task atomically | `engram_memory(action:"claim_task", task_id, agent_id)` |
|
|
824
|
+
| Release a task | `engram_memory(action:"release_task", task_id, agent_id)` |
|
|
825
|
+
| List active agents | `engram_memory(action:"get_agents")` |
|
|
826
|
+
| Send a team message | `engram_memory(action:"broadcast", message, from_agent)` |
|
|
827
|
+
| Dump unstructured findings | `engram_memory(action:"dump", raw_text, agent_id)` |
|
|
828
|
+
|
|
829
|
+
---
|
|
830
|
+
|
|
831
|
+
<!-- AGENT_RULES_START -->
|
|
832
|
+
|
|
833
|
+
```json
|
|
834
|
+
[
|
|
835
|
+
{
|
|
836
|
+
"priority": "CRITICAL",
|
|
837
|
+
"rule": "Call engram_session(action:'start', verbosity:'summary') FIRST — before reading any file or taking any action."
|
|
838
|
+
},
|
|
839
|
+
{
|
|
840
|
+
"priority": "CRITICAL",
|
|
841
|
+
"rule": "Call engram_memory(action:'get_file_notes', file_path) before opening any file. Use notes to skip re-reading already-analysed files."
|
|
842
|
+
},
|
|
843
|
+
{
|
|
844
|
+
"priority": "CRITICAL",
|
|
845
|
+
"rule": "Call engram_memory(action:'record_change') after every file edit — changes, file_path, change_type, description, impact_scope."
|
|
846
|
+
},
|
|
847
|
+
{
|
|
848
|
+
"priority": "CRITICAL",
|
|
849
|
+
"rule": "Call engram_session(action:'end', summary) before terminating — be specific about what was done, what is pending, and any blockers."
|
|
850
|
+
},
|
|
851
|
+
{
|
|
852
|
+
"priority": "HIGH",
|
|
853
|
+
"rule": "Call engram_memory(action:'record_decision') for every architectural or design choice — even small ones."
|
|
854
|
+
},
|
|
855
|
+
{
|
|
856
|
+
"priority": "HIGH",
|
|
857
|
+
"rule": "Check engram_memory(action:'get_decisions') before starting any implementation to avoid contradicting existing decisions."
|
|
858
|
+
},
|
|
859
|
+
{
|
|
860
|
+
"priority": "HIGH",
|
|
861
|
+
"rule": "Use engram_find(query) when unsure which action to call — never guess parameter names."
|
|
862
|
+
},
|
|
863
|
+
{
|
|
864
|
+
"priority": "MEDIUM",
|
|
865
|
+
"rule": "Use engram_memory(action:'checkpoint') when approaching context limits — save current_understanding and progress before losing context."
|
|
866
|
+
},
|
|
867
|
+
{
|
|
868
|
+
"priority": "MEDIUM",
|
|
869
|
+
"rule": "Respect active_conventions returned by start_session — enforce them in every file touched this session."
|
|
870
|
+
},
|
|
871
|
+
{
|
|
872
|
+
"priority": "MEDIUM",
|
|
873
|
+
"rule": "Use verbosity:'nano' or 'minimal' for start_session when context is tight; use 'summary' (default) for normal sessions."
|
|
874
|
+
}
|
|
875
|
+
]
|
|
876
|
+
```
|
|
877
|
+
|
|
878
|
+
<!-- AGENT_RULES_END -->
|
|
879
|
+
|
|
435
880
|
---
|
|
436
881
|
|
|
437
882
|
## Contributing
|
|
438
883
|
|
|
439
884
|
We welcome contributions!
|
|
885
|
+
|
|
440
886
|
1. Fork the repo and create your branch (`git checkout -b feature/amazing-idea`).
|
|
441
887
|
2. Install dependencies: `npm install`.
|
|
442
888
|
3. Build the project: `npm run build`.
|
|
@@ -453,5 +899,5 @@ This project is licensed under the [MIT License](LICENSE).
|
|
|
453
899
|
|
|
454
900
|
<div align="center">
|
|
455
901
|
<em>Because your AI agent shouldn't have amnesia.</em><br/>
|
|
456
|
-
<strong>Copyright © 2026 Keggan
|
|
902
|
+
<strong>Copyright © 2026 Keggan Student - Tanzania</strong>
|
|
457
903
|
</div>
|