engram-mcp-server 1.7.2 → 1.7.3

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.
Files changed (38) hide show
  1. package/LICENSE +35 -0
  2. package/README.md +194 -358
  3. package/dist/constants.d.ts +21 -0
  4. package/dist/constants.d.ts.map +1 -1
  5. package/dist/constants.js +47 -1
  6. package/dist/constants.js.map +1 -1
  7. package/dist/database.d.ts +1 -1
  8. package/dist/database.d.ts.map +1 -1
  9. package/dist/database.js +47 -16
  10. package/dist/database.js.map +1 -1
  11. package/dist/global-db.d.ts.map +1 -1
  12. package/dist/global-db.js +3 -0
  13. package/dist/global-db.js.map +1 -1
  14. package/dist/index.js +3 -2
  15. package/dist/index.js.map +1 -1
  16. package/dist/installer/config-writer.d.ts +31 -10
  17. package/dist/installer/config-writer.d.ts.map +1 -1
  18. package/dist/installer/config-writer.js +79 -15
  19. package/dist/installer/config-writer.js.map +1 -1
  20. package/dist/installer/ide-configs.d.ts +9 -0
  21. package/dist/installer/ide-configs.d.ts.map +1 -1
  22. package/dist/installer/ide-configs.js +7 -19
  23. package/dist/installer/ide-configs.js.map +1 -1
  24. package/dist/installer/ide-detector.d.ts +10 -6
  25. package/dist/installer/ide-detector.d.ts.map +1 -1
  26. package/dist/installer/ide-detector.js +32 -7
  27. package/dist/installer/ide-detector.js.map +1 -1
  28. package/dist/installer/index.d.ts.map +1 -1
  29. package/dist/installer/index.js +25 -6
  30. package/dist/installer/index.js.map +1 -1
  31. package/dist/utils.d.ts +4 -1
  32. package/dist/utils.d.ts.map +1 -1
  33. package/dist/utils.js +149 -13
  34. package/dist/utils.js.map +1 -1
  35. package/package.json +2 -3
  36. package/scripts/fix-mcp-config.js +0 -23
  37. package/scripts/inject-release-notes.js +0 -67
  38. package/scripts/install-mcp.js +0 -175
package/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  <div align="center">
2
2
 
3
- # 🧠 Engram
3
+ <img src="assets/logo.png" alt="Engram logo" width="320" />
4
+
5
+ # Engram
4
6
 
5
7
  > **Persistent Memory Cortex for AI coding agents. Gives agents session continuity, change tracking, decision logging, and multi-agent coordination across sessions.**
6
8
 
@@ -20,16 +22,15 @@
20
22
 
21
23
  - [Overview](#overview)
22
24
  - [Why Engram?](#why-engram)
23
- - [Installation (Auto & Manual)](#installation)
24
- - [✨ What's New in v1.7.2](#-whats-new-in-v172)
25
- - [What's New in v1.7.0](#-whats-new-in-v170)
26
- - [What's New in v1.6.0](#-whats-new-in-v160)
25
+ - [How Engram Works?](#how-engram-works)
26
+ - [Installation](#installation)
27
27
  - [Features](#features)
28
28
  - [Architecture](#architecture)
29
29
  - [Tools Reference](#tools-reference)
30
30
  - [Using with AI Agents](#using-with-ai-agents)
31
31
  - [Multi-Agent Workflows](#multi-agent-workflows)
32
32
  - [Contributing](#contributing)
33
+ - [Security](#security)
33
34
  - [License](#license)
34
35
 
35
36
  ---
@@ -56,174 +57,65 @@ Engram solves this by providing a **persistent brain** using a native SQLite (WA
56
57
 
57
58
  ---
58
59
 
59
- ## What's New in v1.7.2
60
-
61
- **v1.7.2** is a hotfix release addressing 20 bugs found during a systematic functional audit of the v1.7.0 tool surface.
62
-
63
- ### 🔒 Enum Validation for Change, Task, and Scope Fields
64
-
65
- `record_change`, `create_task`, and related actions now enforce enum validation on `change_type`, `impact_scope`, and `priority`. Previously, arbitrary strings were silently accepted, corrupting query results and task filtering.
66
-
67
- - `change_type`: `created | modified | deleted | refactored | renamed | moved | config_changed`
68
- - `impact_scope`: `local | module | cross_module | global`
69
- - `priority`: `critical | high | medium | low`
70
-
71
- ### 📡 Directed Broadcasts — `target_agent` Now Works
72
-
73
- `engram_memory(action:"broadcast", target_agent:"agent-name")` now correctly stores and filters directed messages. Previously the `target_agent` column was missing from the DB schema and the `agent_sync` query had no filter — all agents received all broadcasts regardless.
74
-
75
- ### ⏱️ `what_changed { since: "session_start" }` Fixed
76
-
77
- The `"session_start"` sentinel value is now resolved to the current session's `started_at` timestamp before the SQL query. Previously it was passed literally, always returning zero results.
78
-
79
- ### 🔧 Universal Mode Array Coercion Fixed
80
-
81
- `set_file_notes` with `dependencies` passed as a JSON string (e.g. `"[\"src/a.ts\"]"`) no longer crashes in Universal Mode. A `parseDepsField()` helper now handles both native arrays and JSON-encoded strings at the repository layer — compensating for the `HandlerCapturer` bypass of Zod preprocessing.
82
-
83
- ### ✅ API Correctness Fixes (ISS-001 – ISS-015)
84
-
85
- - `generate_report` and `get_global_knowledge` return real data
86
- - `backup` no longer returns ENOENT
87
- - `get_tasks { status:"all" }` returns all tasks
88
- - `acknowledge_event { approved:false }` snoozes the event
89
- - `config { op:"get", key:X }` returns only that key's value
90
- - `record_milestone` version prefix no longer doubled
91
- - `dump` no longer creates a spurious change record
92
- - `NoActiveSessionError` message uses correct v1.7 syntax
93
-
94
- > Full changelog: [RELEASE_NOTES.md](RELEASE_NOTES.md)
95
-
96
- ---
97
-
98
- ## ✨ What's New in v1.7.0
99
-
100
- **v1.7.0** is a precision token-efficiency release — six improvement tracks with zero breaking changes to the 4-dispatcher API surface.
101
-
102
- ### 🔧 MCP Validation Crash Fix (Critical)
103
-
104
- `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.
105
-
106
- ### ⚡ Default Search Limit: 20 → 8
107
-
108
- `engram_memory(action:"search")` now defaults to 8 results (`DEFAULT_SEARCH_LIMIT`). Typ­ical lookups rarely need more. Still overridable via explicit `limit` param (up to 50).
60
+ ## How Engram Works?
109
61
 
110
- ### 📋 Convention Capping by Verbosity
62
+ Engram runs as a local MCP server alongside your AI tool. It maintains a **project-local SQLite database** at `.engram/memory.db` — one per project, created automatically on first use. No cloud, no API keys, no data leaving your machine.
111
63
 
112
- Active conventions are sorted (enforced-first) and capped per verbosity: `nano`=0, `minimal`=5, `summary`=10, `full`=all. Total count + hint always returned.
64
+ ### The Session Lifecycle
113
65
 
114
- ### 🗂️ Tiered Tool Catalog (P2)
115
-
116
- `buildToolCatalog(tier)` delivers the right detail level per agent:
117
-
118
- - **Tier 2** (new agents) — full params ~1,200 tokens, once
119
- - **Tier 1** (returning agents) names + descriptions ~400 tokens
120
- - **Tier 0** (familiar agents) names only ~80 tokens
121
-
122
- Delivery history tracked per `agent_name`. Recoverable anytime via `engram_find(action:"catalog")`.
123
-
124
- ### 🤖 Sub-Agent Session Mode (P3)
125
-
126
- `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.
127
-
128
- ### 🌐 Built-In Universal Mode (P4)
129
-
130
- A single `engram` tool with an ~80 token schema — now available **inside the main server** without a separate proxy package:
131
-
132
- ```bash
133
- # CLI flag
134
- npx -y engram-mcp-server --mode=universal --project-root /your/project
135
-
136
- # Environment variable
137
- ENGRAM_MODE=universal npx -y engram-mcp-server --project-root /your/project
66
+ ```
67
+ ┌──────────────────────────────────────────────────────────────────────────┐
68
+ │ AGENT SESSION LIFECYCLE │
69
+ ├──────────────┬──────────────────────────────────────────────────────────┤
70
+ │ Session │ engram_session(action:"start")
71
+ │ Start │ ← previous summary, open tasks, decisions, file notes, │
72
+ │ │ conventions, triggered eventsall ranked by focus │
73
+ ├──────────────┼──────────────────────────────────────────────────────────┤
74
+ │ Active Work │ get_file_notes → skip re-reading if notes are fresh │
75
+ │ │ record_change → every file edit captured with context │
76
+ │ │ record_decision why you built it, persisted forever │
77
+ │ │ add_convention → project standards stored once, used ∞ │
78
+ │ │ create_task → work items survive session boundaries │
79
+ ├──────────────┼──────────────────────────────────────────────────────────┤
80
+ │ Context │ check_events fires at 50% / 70% / 85% fill │
81
+ │ Pressure │ → checkpoint to offload working memory mid-session │
82
+ │ │ → or end early and resume cleanly in the next session │
83
+ ├──────────────┼──────────────────────────────────────────────────────────┤
84
+ │ Session │ engram_session(action:"end", summary:"...") │
85
+ │ End │ → summary stored, open tasks preserved, memory locked │
86
+ │ │ → next session same agent or different — starts fresh │
87
+ └──────────────┴──────────────────────────────────────────────────────────┘
138
88
  ```
139
89
 
140
- BM25 routing and fuzzy action resolution built-in. Use when you want minimal token overhead without running a separate proxy.
141
-
142
- ### 🗑️ 660 Lines of Dead Code Removed (P5)
143
-
144
- `sessions.ts` shrank from 904 → 316 lines. The deleted `registerSessionTools()` registered old v1.5 individual tools that were never called post-v1.6 migration.
145
-
146
- ### 🔍 Smarter Convention Linting (P6)
147
-
148
- `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`.
149
-
150
- > Full changelog: [RELEASE_NOTES.md](RELEASE_NOTES.md)
151
-
152
- ---
153
-
154
- ## ✨ What's New in v1.6.0
155
-
156
- **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.
157
-
158
- ### ⚡ Lean 4-Tool Dispatcher Surface — ~95% Fewer Schema Tokens
159
-
160
- 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.
161
-
162
- ### 📸 Checkpoints — Offload Working Memory Mid-Session
163
-
164
- `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.
165
-
166
- ### 🔬 Hash-Based Staleness Detection
167
-
168
- 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.
169
-
170
- ### 📊 Tiered Verbosity — `nano` Mode
171
-
172
- 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.
173
-
174
- ### 🗂️ Executive Summary on File Notes
175
-
176
- 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.
177
-
178
- ### 🛡️ Agent Rules — Live-Loaded from GitHub
179
-
180
- `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.
181
-
182
- ### 🔍 Convention Linting in `engram_find`
183
-
184
- `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.
185
-
186
- ### 🔧 Git Hook Install/Remove via `engram_admin`
187
-
188
- `engram_admin(action:"install_hooks")` and `remove_hooks` write/remove the Engram post-commit hook directly from within the MCP tool — no CLI needed.
189
-
190
- ### 🌐 Multi-Agent Specialization Routing
191
-
192
- `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.
193
-
194
- ### 🔒 Agent Safety — File Locking & Pending Work
195
-
196
- `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`.
197
-
198
- ### 🌡️ Context Pressure Detection
199
-
200
- `check_events` fires `context_pressure` at 50%/70%/85% so agents know when to wrap up before hitting the context wall.
201
-
202
- ### 🤝 Session Handoffs
203
-
204
- `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`.
205
-
206
- ### 🎬 Session Replay & Diagnostics
90
+ ### What the Agent Receives at Start
207
91
 
208
- Every MCP tool call is logged to `tool_call_log`. Session Replay reconstructs the complete chronological timeline of any session.
92
+ When an agent calls `engram_session(action:"start", focus:"topic")`, the response includes:
209
93
 
210
- ### 📦 `engram-thin-client` Package
94
+ | Field | What it contains |
95
+ | -------------------------- | ------------------------------------------------------------------------- |
96
+ | `previous_session.summary` | What was done last session — files, functions, blockers |
97
+ | `active_decisions` | Binding architectural decisions. Follow them or supersede with rationale. |
98
+ | `active_conventions` | Project standards (naming, patterns, style) — enforced every session |
99
+ | `open_tasks` | Pending work items with priority and blocking chains |
100
+ | `abandoned_work` | Work declared via `begin_work` that was never closed — resume or discard |
101
+ | `handoff_pending` | Structured handoff from the previous agent — instructions, branch, tasks |
102
+ | `triggered_events` | Scheduled reminders or deferred tasks now due |
103
+ | `agent_rules` | Live-loaded behavioral rules from the README (7-day cache) |
104
+ | `tool_catalog` | Available actions, scoped to the agent's familiarity tier |
211
105
 
212
- New `packages/engram-thin-client/` proxy enables Anthropic's `defer_loading` betatools 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.
106
+ All context is **FTS5-ranked** around the `focus` topicthe most relevant memory surfaces first. The `suggested_focus` field auto-derives the topic for the next session when none is provided.
213
107
 
214
- ### 📦 `engram-universal-client` Package
108
+ ### Token Efficiency by Mode
215
109
 
216
- 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.
110
+ | Mode | Schema tokens | Works with |
111
+ | ----------------------------- | ------------- | ------------------ |
112
+ | Standard 4-dispatcher | ~1,600 | All MCP agents |
113
+ | `--mode=universal` (built-in) | ~80 | All MCP agents |
114
+ | `engram-thin-client` | ~0 (deferred) | Anthropic API only |
217
115
 
218
- | Approach | Schema tokens/call | Works universally |
219
- | ------------------------------- | ------------------ | ---------------------------- |
220
- | v1.5 (50+ tools) | ~32,500 | ✅ |
221
- | v1.6 dispatcher (4 tools) | ~1,600 | ✅ |
222
- | `engram-thin-client` | ~0 (deferred) | ⚠️ Anthropic only |
223
- | `engram-universal-client` proxy | ~80 | ✅ All agents |
224
- | **v1.7 `--mode=universal`** | **~80** | ✅ **All agents (built-in)** |
116
+ ### Storage
225
117
 
226
- > Full changelog: [RELEASE_NOTES.md](RELEASE_NOTES.md) · Previous release: **v1.5.0**Multi-Agent Coordination, Trustworthy Context & Knowledge Intelligence.
118
+ All data lives in a local SQLite WAL database. There is no telemetry, no external sync, and no authentication surface. The database is a plain file portable via `backup`, exportable to JSON, restorable on any machine.
227
119
 
228
120
  ---
229
121
 
@@ -528,22 +420,93 @@ In your IDE, open the AI chat and ask the agent to call `engram_session(action:"
528
420
 
529
421
  ## Features
530
422
 
531
- - 🧠 **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.
532
- - 🔐 **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.
533
- - 🔒 **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`.
534
- - 🤖 **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.
535
- - 🤝 **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.
536
- - 🌡️ **Context Pressure Detection:** `engram_memory(action:"check_events")` fires at 50%/70%/85% context fill — giving agents advance warning before hitting the context wall.
537
- - **Scheduled Events:** Postpone tasks or set reminders. Triggers include `next_session`, `datetime`, or `task_complete`.
538
- - 📝 **Change Tracking:** Records every file modification with context. Combines agent-recorded changes with `git` history. Git hook integration (`--install-hooks`) auto-records commits.
539
- - 🏗️ **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.
540
- - 📁 **File Intelligence:** Stores per-file notes (purpose, deps, layer, complexity) with branch-aware staleness detection preventing endless re-reads.
541
- - 📐 **Convention Tracking:** Records and enforces project conventions (naming, testing, styling).
542
- - ✅ **Task Management:** Work items persist across sessions with priority, status, and multi-agent claiming. End-session warns on unclosed claimed tasks.
543
- - 🔍 **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.
544
- - 🎬 **Session Replay:** Reconstructs the complete tool-call + change + decision timeline for any session via the `tool_call_log` table.
545
- - 💾 **Backup & Restore:** `engram_admin(action:"backup")` creates timestamped SQLite copies to any path (like Dropbox/OneDrive) for cross-machine portability.
546
- - 📊 **Reports, Stats & Commit Suggestions:** Generate Markdown project reports, per-agent activity metrics, and conventional commit messages from session data.
423
+ Engram gives an AI coding agent **persistent memory** the ability to pick up exactly where it left off, across sessions, IDEs, and teams. Here is what that means in practice.
424
+
425
+ ---
426
+
427
+ ### 🧠 Sessions That Actually Continue
428
+
429
+ An AI agent without Engram starts cold every session — re-reads files, rediscovers architecture, re-learns conventions. That warm-up wastes tokens and your patience, every single time.
430
+
431
+ With Engram, `engram_session(action:"start")` delivers the full context in one call: the previous session's summary, open tasks, architectural decisions, project conventions, and a `suggested_focus` auto-derived from recent activity. The agent arrives already knowing your codebase.
432
+
433
+ > The agent that worked on your project yesterday is effectively present today.
434
+
435
+ ---
436
+
437
+ ### 🏗️ Decisions That Outlive Sessions
438
+
439
+ Every architectural choice gets stored with rationale, affected files, tags, and dependency chains. It lives in Engram indefinitely — not in a chat history that scrolls away.
440
+
441
+ Six months later, a new agent asks why something works a certain way. Engram answers precisely, with the original reasoning intact. `depends_on` chains warn when changing one decision risks cascading to others. Decisions are superseded, never deleted — the full evolution of your architecture is always recoverable.
442
+
443
+ ---
444
+
445
+ ### 📁 Smart File Notes With Staleness Detection
446
+
447
+ The agent learns a file once — its purpose, layer, complexity, and dependencies — writes a 2-3 sentence `executive_summary`, and never reads it from scratch again. Future sessions query the note for instant context with zero file reads.
448
+
449
+ Notes use **SHA-256 content hashing** to catch silent edits from formatters and auto-saves that preserve `mtime`. A `branch_warning` fires when the current branch diverges from when the note was written, preventing cross-branch confusion.
450
+
451
+ ---
452
+
453
+ ### ✅ Tasks That Survive Everything
454
+
455
+ Work items persist across sessions, restarts, agent switches, and context resets — with priority, tags, and blocking chains. `claim_task` is **atomic**: two parallel agents can never start the same work. `begin_work` declarations surface as `abandoned_work` in the next session — nothing falls through the cracks.
456
+
457
+ ---
458
+
459
+ ### 🤖 Parallel Agents Without Conflicts
460
+
461
+ Run multiple AI agents on the same codebase simultaneously. Engram provides the coordination layer so they never step on each other.
462
+
463
+ | Mechanism | What it prevents |
464
+ | --------------------------------- | ---------------------------------------- |
465
+ | `lock_file` / `unlock_file` | Two agents editing the same file at once |
466
+ | `claim_task` (atomic) | Duplicate work from parallel agents |
467
+ | `broadcast` / `agent_sync` | Missed messages between agents |
468
+ | `route_task` | Work going to the wrong specialization |
469
+ | `handoff` / `acknowledge_handoff` | Context loss when switching agents |
470
+
471
+ ---
472
+
473
+ ### 🌡️ Always Land Cleanly — Context Wall Warnings
474
+
475
+ AI agents hit their context limit and abruptly stop, mid-task and mid-thought. Engram fires `context_pressure` events at **50%, 70%, and 85%** fill — giving the agent time to `checkpoint` its progress and wrap up gracefully before the wall hits. The next session resumes exactly where it left off.
476
+
477
+ ---
478
+
479
+ ### 📐 Convention Enforcement That Sticks
480
+
481
+ Project conventions — naming rules, testing standards, logging patterns, response shapes — are stored once and returned at every session start. `engram_find(action:"lint")` actively checks any code against them. Conventions do not get forgotten when a session ends or a new agent joins.
482
+
483
+ ---
484
+
485
+ ### 📝 Unified Change History — Agent and Human
486
+
487
+ Every file change is recorded with `change_type`, `description`, `impact_scope`, and optional diff. Git hook integration captures commits from both agents and humans into one timeline. `what_changed` returns a full diff report from any point in time or since session start.
488
+
489
+ ---
490
+
491
+ ### ⚡ Minimal API Footprint — 4 Tools or 1
492
+
493
+ All capabilities route through **4 dispatcher tools** via an `action` parameter. Add `--mode=universal` to collapse to a single `engram` tool at ~80 schema tokens — a 99% reduction from the original 50-tool surface. BM25 fuzzy routing handles typos and near-miss action names automatically.
494
+
495
+ | Mode | Schema tokens | Compatibility |
496
+ | --------------------- | ------------- | ------------------ |
497
+ | Standard 4-dispatcher | ~1,600 | All MCP agents |
498
+ | `--mode=universal` | ~80 | All MCP agents |
499
+ | `engram-thin-client` | ~0 deferred | Anthropic API only |
500
+
501
+ ---
502
+
503
+ ### 💾 Your Data, Your Machine
504
+
505
+ No cloud. No telemetry. No authentication surface. Memory lives in a local SQLite WAL file at `.engram/memory.db`. `backup` creates a portable copy to any path. `export` serializes everything to JSON. You own it entirely.
506
+
507
+ ---
508
+
509
+ > For the full version history and per-release breakdown, see [RELEASE_NOTES.md](RELEASE_NOTES.md).
547
510
 
548
511
  ---
549
512
 
@@ -668,32 +631,20 @@ Engram v1.7.0 exposes **4 dispatcher tools** (or 1 tool in `--mode=universal`).
668
631
 
669
632
  <!-- ENGRAM_INSTRUCTIONS_START -->
670
633
 
671
- ## Engram — Persistent Memory MCP (v1.7)
634
+ ## Engram — Session Rules
672
635
 
673
- Engram is a persistent memory MCP server. It gives AI agents session continuity, change tracking, decision logging, and multi-agent coordination across sessions — all via a SQLite database. The API surface is **4 dispatcher tools** (or **1 tool** in universal mode) — each routed via an `action` parameter. Schema tokens: ~1,600 per call in standard mode, ~80 in universal mode.
636
+ **4 dispatcher tools:** `engram_session` · `engram_memory` · `engram_admin` · `engram_find`
637
+ Unknown action? → `engram_find({ query: "what I want to do" })`
638
+ Universal mode? All actions route through a single `engram` tool — call `engram({ action: "start" })` etc.
674
639
 
675
640
  Follow these rules **every session, every project**.
676
641
 
677
- ---
678
-
679
- ### Dispatcher Tools
680
-
681
- | Tool | Responsibility |
682
- | ---------------- | ------------------------------------------------- |
683
- | `engram_session` | Session lifecycle (start, end, handoffs, history) |
684
- | `engram_memory` | All memory operations (34+ actions) |
685
- | `engram_admin` | Maintenance, git hooks, backup, config, stats |
686
- | `engram_find` | Tool catalog search + convention linting |
687
-
688
- > If running in **universal mode** (`--mode=universal`), all actions route through a single `engram` tool instead. Call `engram({ action: "start" })` etc.
689
-
690
- > Use `engram_find({ query: "what I want to do" })` whenever you don't know the exact `action` name.
642
+ > ⚠️ **MANDATORY: Call this at the start of EVERY new chat — no exceptions.**
643
+ > Without it, the agent is stateless. All prior context (decisions, file notes, tasks, conventions) will be invisible.
691
644
 
692
645
  ---
693
646
 
694
- ### 1. Session Start — Always First
695
-
696
- **Before reading any file or taking any action**, call `engram_session(action:"start")`.
647
+ ### Session Start — ALWAYS FIRST, BEFORE any action
697
648
 
698
649
  ```js
699
650
  engram_session({
@@ -704,208 +655,81 @@ engram_session({
704
655
  });
705
656
  ```
706
657
 
707
- - **Verbosity** Use `"summary"` by default. Use `"minimal"` for count-only context. Use `"nano"` (under 100 tokens) only when context is critically constrained. **Never** use `"full"`.
708
- - **`focus`** When you know what you're about to work on, pass it. Context is FTS5-ranked around that topic.
709
- - **`tool_catalog`** Returned at session start. Use it to know available actions do not call a separate tool for this.
710
-
711
- Act on everything returned:
712
-
713
- | Field | What to do |
714
- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
715
- | `previous_session.summary` | Read immediately. Do not re-explore what is already known. |
716
- | `active_decisions` | Binding. Follow them. Supersede via `engram_memory(action:"record_decision", supersedes:<id>)` only if they must change. |
717
- | `active_conventions` | Enforce in every file touched this session. |
718
- | `open_tasks` | Pending work. Ask the user which to focus on if unclear. |
719
- | `abandoned_work` | Work left open by a previous unexpected session end. Resume or close it. |
720
- | `handoff_pending` | Structured handoff from previous agent. Read instructions, then call `engram_session(action:"acknowledge_handoff")`. |
721
- | `suggested_focus` | Auto-derived topic hint. Pass as `focus` on the next `start` call. |
722
- | `triggered_events` | Scheduled reminders or deferred work now due. Act on them. |
723
- | `agent_rules` | Live-loaded rules from the Engram README. Treat as binding session instructions. |
724
- | `update_available` | Inform the user: _"Engram v{version} is available — update, skip, or postpone?"_ |
725
-
726
- **If `update_available` is set**, respond to the user's choice:
727
-
728
- - **Update** → `npx -y engram-mcp-server install`
729
- - **Skip this version** → `engram_admin({ action: "config", op: "set", key: "auto_update_skip_version", value: "{version}" })`
730
- - **Postpone 7 days** → `engram_admin({ action: "config", op: "set", key: "auto_update_remind_after", value: "7d" })`
731
- - **Disable checks** → `engram_admin({ action: "config", op: "set", key: "auto_update_check", value: "false" })`
658
+ - **Every new chat. Every time. No skipping.** Even for "quick" questions context is loaded in <1 second.
659
+ - Use `verbosity: "summary"` always. Never `"full"`.
660
+ - Act on everything returned: `previous_session`, `active_decisions` (binding), `active_conventions` (enforce), `open_tasks`, `abandoned_work`, `agent_rules` (binding), `triggered_events`.
661
+ - If `update_available`: ask user → update (`npx -y engram-mcp-server install`), skip, postpone 7d, or disable.
732
662
 
733
663
  ---
734
664
 
735
- ### 2. Before Opening Any File
736
-
737
- Always check Engram before opening a file:
665
+ ### Before Opening a File
738
666
 
739
667
  ```js
740
- engram_memory({ action: "get_file_notes", file_path: "path/to/file.ts" });
668
+ engram_memory({ action: "get_file_notes", file_path: "..." });
741
669
  ```
742
670
 
743
- | `confidence` result | Action |
744
- | ------------------- | ----------------------------------------------------------------------------------- |
745
- | `"high"` | Use stored notes. Only open if you need to edit. |
746
- | `"medium"` | Notes exist but file may have minor changes. Open only if precision matters. |
747
- | `"stale"` | File has changed since notes were stored (hash mismatch). Re-read and update notes. |
748
- | No notes | Read the file, then immediately call `set_file_notes`. |
749
-
750
- After reading a file for the first time, store notes immediately:
751
-
752
- ```js
753
- engram_memory({ action: "set_file_notes", file_path, purpose, dependencies, dependents, layer, complexity, notes, executive_summary })
754
- // Batch multiple files:
755
- engram_memory({ action: "set_file_notes_batch", files: [...] })
756
- ```
671
+ - `high` use notes, skip opening. `medium` → open only if precision matters. `stale` / no notes → read file, then immediately call `set_file_notes` with `executive_summary`.
757
672
 
758
673
  ---
759
674
 
760
- ### 3. Before Making Design or Architecture Decisions
761
-
762
- Search for existing decisions before proposing anything:
675
+ ### Before Design/Architecture Decisions
763
676
 
764
677
  ```js
765
- engram_memory({
766
- action: "search",
767
- query: "relevant keywords",
768
- scope: "decisions",
769
- });
770
- // or:
771
- engram_memory({ action: "get_decisions" });
678
+ engram_memory({ action: "search", query: "...", scope: "decisions" });
679
+ // or: engram_memory({ action: "get_decisions" })
772
680
  ```
773
681
 
774
- - **Decision exists** Follow it.
775
- - **Needs to change** → Explain why, then: `engram_memory({ action:"record_decision", supersedes:<id>, decision, rationale })`
776
- - **No decision** → Make the call and record it immediately:
777
-
778
- ```js
779
- engram_memory({
780
- action: "record_decision",
781
- decision,
782
- rationale,
783
- affected_files,
784
- tags,
785
- });
786
- ```
682
+ Follow existing decisions. To change one, call `record_decision` with `supersedes: <id>`. Always record new decisions with `rationale`.
787
683
 
788
684
  ---
789
685
 
790
- ### 4. When Modifying Files
791
-
792
- After every meaningful change, record it — batch where possible:
686
+ ### After Editing Files
793
687
 
794
688
  ```js
795
689
  engram_memory({
796
690
  action: "record_change",
797
- changes: [
798
- {
799
- file_path,
800
- change_type, // created | modified | refactored | deleted | renamed | moved | config_changed
801
- description, // What changed AND why — not just the action
802
- impact_scope, // local | module | cross_module | global
803
- },
804
- ],
691
+ changes: [{ file_path, change_type, description, impact_scope }],
805
692
  });
806
693
  ```
807
694
 
808
- ---
809
-
810
- ### 5. When You Don't Know Something
811
-
812
- Search Engram before asking the user — they may have already explained it to a previous session:
813
-
814
- ```js
815
- engram_memory({ action: "search", query: "keywords", context_chars: 200 });
816
- engram_admin({ action: "scan_project" }); // project structure
817
- engram_memory({ action: "get_decisions" }); // architecture questions
818
- engram_memory({ action: "get_conventions" }); // style / pattern questions
819
- engram_memory({ action: "get_file_notes", file_path: "..." }); // what is known about a file
820
- engram_find({ query: "what I want to do" }); // discover the right action
821
- ```
695
+ `change_type`: created | modified | refactored | deleted | renamed | moved | config_changed
696
+ `impact_scope`: local | module | cross_module | global. Batch all changes in one call.
822
697
 
823
698
  ---
824
699
 
825
- ### 6. Mid-Session Approaching Context Limits
826
-
827
- Before hitting the context wall, save a checkpoint:
700
+ ### Mid-Session (context pressure)
828
701
 
829
702
  ```js
830
- engram_memory({ action: "checkpoint", current_understanding: "...", progress_percentage: 70, key_findings: [...], next_steps: [...], file_paths: [...] })
831
- // Restore later:
832
- engram_memory({ action: "get_checkpoint" })
833
- ```
834
-
835
- Check for context pressure events proactively:
836
-
837
- ```js
838
- engram_memory({ action: "check_events" }); // fires at 50% / 70% / 85% context fill
703
+ engram_memory({ action: "checkpoint", current_understanding: "...", progress: "...", relevant_files: [...] })
704
+ engram_memory({ action: "check_events" }) // fires at 50/70/85% context fill
839
705
  ```
840
706
 
841
707
  ---
842
708
 
843
- ### 7. Session End — Always Last
844
-
845
- Before ending any session:
709
+ ### Session End — ALWAYS LAST
846
710
 
847
- 1. Record all file changes not yet recorded.
848
- 2. Mark completed tasks: `engram_memory({ action:"update_task", task_id, status:"done" })`
849
- 3. Create tasks for anything incomplete: `engram_memory({ action:"create_task", title, description, priority })`
850
- 4. Record any new conventions: `engram_memory({ action:"add_convention", convention, rationale })`
851
- 5. Call end with a precise summary:
852
-
853
- ```js
854
- engram_session({
855
- action: "end",
856
- summary:
857
- "Exact files/functions touched, what is pending, any blockers, new patterns discovered",
858
- });
859
- ```
711
+ 1. Record any unrecorded changes.
712
+ 2. Mark done tasks: `engram_memory({ action: "update_task", id: <n>, status: "done" })`
713
+ 3. Create tasks for incomplete work.
714
+ 4. Record new conventions.
715
+ 5. `engram_session({ action: "end", summary: "files/functions touched, pending work, blockers" })`
860
716
 
861
717
  ---
862
718
 
863
- ### Quick Reference
864
-
865
- | Situation | Call | Notes |
866
- | ------------------------------- | ----------------------------------------------------------- | --------------------------------------- |
867
- | **Start every session** | `engram_session(action:"start")` | verbosity:"summary", add focus if known |
868
- | Discover an action name | `engram_find({ query:"..." })` | Returns action name + param schema |
869
- | Before opening any file | `engram_memory(action:"get_file_notes")` | |
870
- | After first reading a file | `engram_memory(action:"set_file_notes")` | Include `executive_summary` |
871
- | Before a design choice | `engram_memory(action:"search")` / `action:"get_decisions"` | |
872
- | Record a new decision | `engram_memory(action:"record_decision")` | Always include `rationale` |
873
- | After editing files | `engram_memory(action:"record_change")` | Batch multiple changes in one call |
874
- | Save mid-session progress | `engram_memory(action:"checkpoint")` | Use near context limits |
875
- | Check context pressure | `engram_memory(action:"check_events")` | Fires at 50% / 70% / 85% |
876
- | Create task for incomplete work | `engram_memory(action:"create_task")` | |
877
- | Mark task done | `engram_memory(action:"update_task", status:"done")` | |
878
- | Record a convention | `engram_memory(action:"add_convention")` | |
879
- | Schedule deferred work | `engram_memory(action:"schedule_event")` | |
880
- | Lint code against conventions | `engram_find(action:"lint", content:"...")` | Returns `violations[]` |
881
- | Backup the database | `engram_admin(action:"backup")` | |
882
- | **End every session** | `engram_session(action:"end")` | Be specific: files, functions, blockers |
883
-
884
- ---
719
+ ### Sub-Agent Sessions (v1.7+)
885
720
 
886
- ### 8. Sub-Agent Sessions (v1.7+)
887
-
888
- When your orchestrator spawns a sub-agent to handle a specific task, use `agent_role: "sub"` to get a lightweight, task-scoped context (~300-500 tokens) instead of the full session boilerplate:
721
+ Use `agent_role: "sub"` for lightweight task-scoped context (~300–500 tokens):
889
722
 
890
723
  ```js
891
724
  engram_session({
892
725
  action: "start",
893
726
  agent_name: "sub-agent-auth",
894
727
  agent_role: "sub",
895
- task_id: 42, // The task ID assigned by the orchestrator
728
+ task_id: 42,
896
729
  });
897
730
  ```
898
731
 
899
- The response includes only:
900
-
901
- - The specified task's details (title, description, priority, tags)
902
- - File notes for files assigned to that task
903
- - Decisions matching the task's tags
904
- - Up to 5 relevant conventions
905
-
906
- Sub-agents should still call `engram_session(action:"end")` when done and `engram_memory(action:"record_change")` for any edits made.
907
-
908
- > **Note:** Sub-agent mode is auto-activated when `agent_role: "sub"` is passed. No separate configuration needed.
732
+ Returns only: the assigned task, its file notes, matching decisions, and up to 5 relevant conventions. Sub-agents still call `record_change` and `session end` as normal.
909
733
 
910
734
  <!-- ENGRAM_INSTRUCTIONS_END -->
911
735
 
@@ -1102,13 +926,23 @@ The global database at `~/.engram/memory.db` can be reset the same way if needed
1102
926
 
1103
927
  ## Contributing
1104
928
 
1105
- We welcome contributions!
929
+ Contributions are welcome — bug reports, feature proposals, documentation improvements, and code. Please read [CONTRIBUTING.md](CONTRIBUTING.md) for the full contribution guide, including:
930
+
931
+ - Development environment setup
932
+ - Branch naming and commit message conventions
933
+ - Testing requirements before submitting a PR
934
+ - How to propose new features or architectural changes
935
+ - Code review process and expectations
936
+
937
+ For questions and discussion, open a [GitHub Issue](https://github.com/keggan-std/Engram/issues).
1106
938
 
1107
- 1. Fork the repo and create your branch (`git checkout -b feature/amazing-idea`).
1108
- 2. Install dependencies: `npm install`.
1109
- 3. Build the project: `npm run build`.
1110
- 4. Run tests: `npm test` (Uses Vitest).
1111
- 5. Commit your changes and open a Pull Request.
939
+ ---
940
+
941
+ ## Security
942
+
943
+ For responsible disclosure of security vulnerabilities, please read [SECURITY.md](SECURITY.md). **Do not open a public GitHub issue for security vulnerabilities.**
944
+
945
+ The short version: Engram has no network-facing server, no authentication surface, and no telemetry. All data stays on your machine in a local SQLite file. The primary attack surface is the local filesystem and the `npx` execution model.
1112
946
 
1113
947
  ---
1114
948
 
@@ -1116,9 +950,11 @@ We welcome contributions!
1116
950
 
1117
951
  This project is licensed under the [MIT License](LICENSE).
1118
952
 
953
+ Copyright &copy; 2026 Keggan Student, Tanzania.
954
+
1119
955
  ---
1120
956
 
1121
957
  <div align="center">
1122
958
  <em>Because your AI agent shouldn't have amnesia.</em><br/>
1123
- <strong>Copyright &copy; 2026 Keggan Student - Tanzania</strong>
959
+ <strong>Copyright &copy; 2026 Keggan Student Tanzania</strong>
1124
960
  </div>