engram-mcp-server 1.7.3 → 1.9.1
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 +110 -86
- package/dist/constants.d.ts +23 -2
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +35 -3
- package/dist/constants.js.map +1 -1
- package/dist/database.d.ts +23 -2
- package/dist/database.d.ts.map +1 -1
- package/dist/database.js +112 -11
- package/dist/database.js.map +1 -1
- package/dist/http-auth.d.ts +11 -0
- package/dist/http-auth.d.ts.map +1 -0
- package/dist/http-auth.js +50 -0
- package/dist/http-auth.js.map +1 -0
- package/dist/http-pagination.d.ts +26 -0
- package/dist/http-pagination.d.ts.map +1 -0
- package/dist/http-pagination.js +43 -0
- package/dist/http-pagination.js.map +1 -0
- package/dist/http-routes/analytics.routes.d.ts +2 -0
- package/dist/http-routes/analytics.routes.d.ts.map +1 -0
- package/dist/http-routes/analytics.routes.js +64 -0
- package/dist/http-routes/analytics.routes.js.map +1 -0
- package/dist/http-routes/annotations.routes.d.ts +2 -0
- package/dist/http-routes/annotations.routes.d.ts.map +1 -0
- package/dist/http-routes/annotations.routes.js +74 -0
- package/dist/http-routes/annotations.routes.js.map +1 -0
- package/dist/http-routes/api-helpers.d.ts +19 -0
- package/dist/http-routes/api-helpers.d.ts.map +1 -0
- package/dist/http-routes/api-helpers.js +24 -0
- package/dist/http-routes/api-helpers.js.map +1 -0
- package/dist/http-routes/audit.routes.d.ts +2 -0
- package/dist/http-routes/audit.routes.d.ts.map +1 -0
- package/dist/http-routes/audit.routes.js +31 -0
- package/dist/http-routes/audit.routes.js.map +1 -0
- package/dist/http-routes/changes.routes.d.ts +2 -0
- package/dist/http-routes/changes.routes.d.ts.map +1 -0
- package/dist/http-routes/changes.routes.js +27 -0
- package/dist/http-routes/changes.routes.js.map +1 -0
- package/dist/http-routes/conventions.routes.d.ts +2 -0
- package/dist/http-routes/conventions.routes.d.ts.map +1 -0
- package/dist/http-routes/conventions.routes.js +68 -0
- package/dist/http-routes/conventions.routes.js.map +1 -0
- package/dist/http-routes/decisions.routes.d.ts +2 -0
- package/dist/http-routes/decisions.routes.d.ts.map +1 -0
- package/dist/http-routes/decisions.routes.js +86 -0
- package/dist/http-routes/decisions.routes.js.map +1 -0
- package/dist/http-routes/events.routes.d.ts +2 -0
- package/dist/http-routes/events.routes.d.ts.map +1 -0
- package/dist/http-routes/events.routes.js +20 -0
- package/dist/http-routes/events.routes.js.map +1 -0
- package/dist/http-routes/export-import.routes.d.ts +2 -0
- package/dist/http-routes/export-import.routes.d.ts.map +1 -0
- package/dist/http-routes/export-import.routes.js +46 -0
- package/dist/http-routes/export-import.routes.js.map +1 -0
- package/dist/http-routes/file-notes.routes.d.ts +2 -0
- package/dist/http-routes/file-notes.routes.d.ts.map +1 -0
- package/dist/http-routes/file-notes.routes.js +62 -0
- package/dist/http-routes/file-notes.routes.js.map +1 -0
- package/dist/http-routes/instances.routes.d.ts +2 -0
- package/dist/http-routes/instances.routes.d.ts.map +1 -0
- package/dist/http-routes/instances.routes.js +16 -0
- package/dist/http-routes/instances.routes.js.map +1 -0
- package/dist/http-routes/milestones.routes.d.ts +2 -0
- package/dist/http-routes/milestones.routes.d.ts.map +1 -0
- package/dist/http-routes/milestones.routes.js +54 -0
- package/dist/http-routes/milestones.routes.js.map +1 -0
- package/dist/http-routes/search.routes.d.ts +2 -0
- package/dist/http-routes/search.routes.d.ts.map +1 -0
- package/dist/http-routes/search.routes.js +41 -0
- package/dist/http-routes/search.routes.js.map +1 -0
- package/dist/http-routes/sensitive.routes.d.ts +2 -0
- package/dist/http-routes/sensitive.routes.d.ts.map +1 -0
- package/dist/http-routes/sensitive.routes.js +20 -0
- package/dist/http-routes/sensitive.routes.js.map +1 -0
- package/dist/http-routes/sessions.routes.d.ts +2 -0
- package/dist/http-routes/sessions.routes.d.ts.map +1 -0
- package/dist/http-routes/sessions.routes.js +51 -0
- package/dist/http-routes/sessions.routes.js.map +1 -0
- package/dist/http-routes/settings.routes.d.ts +2 -0
- package/dist/http-routes/settings.routes.d.ts.map +1 -0
- package/dist/http-routes/settings.routes.js +51 -0
- package/dist/http-routes/settings.routes.js.map +1 -0
- package/dist/http-routes/tasks.routes.d.ts +2 -0
- package/dist/http-routes/tasks.routes.d.ts.map +1 -0
- package/dist/http-routes/tasks.routes.js +90 -0
- package/dist/http-routes/tasks.routes.js.map +1 -0
- package/dist/http-server.d.ts +14 -0
- package/dist/http-server.d.ts.map +1 -0
- package/dist/http-server.js +129 -0
- package/dist/http-server.js.map +1 -0
- package/dist/index.js +133 -4
- package/dist/index.js.map +1 -1
- package/dist/installer/config-writer.d.ts +7 -2
- package/dist/installer/config-writer.d.ts.map +1 -1
- package/dist/installer/config-writer.js +21 -3
- package/dist/installer/config-writer.js.map +1 -1
- package/dist/installer/ide-configs.d.ts +9 -0
- package/dist/installer/ide-configs.d.ts.map +1 -1
- package/dist/installer/ide-configs.js +6 -0
- package/dist/installer/ide-configs.js.map +1 -1
- package/dist/installer/index.d.ts.map +1 -1
- package/dist/installer/index.js +30 -22
- package/dist/installer/index.js.map +1 -1
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +119 -0
- package/dist/migrations.js.map +1 -1
- package/dist/services/cross-instance.service.d.ts +119 -0
- package/dist/services/cross-instance.service.d.ts.map +1 -0
- package/dist/services/cross-instance.service.js +399 -0
- package/dist/services/cross-instance.service.js.map +1 -0
- package/dist/services/index.d.ts +3 -0
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +3 -0
- package/dist/services/index.js.map +1 -1
- package/dist/services/instance-registry.service.d.ts +73 -0
- package/dist/services/instance-registry.service.d.ts.map +1 -0
- package/dist/services/instance-registry.service.js +365 -0
- package/dist/services/instance-registry.service.js.map +1 -0
- package/dist/services/sensitive-data.service.d.ts +87 -0
- package/dist/services/sensitive-data.service.d.ts.map +1 -0
- package/dist/services/sensitive-data.service.js +215 -0
- package/dist/services/sensitive-data.service.js.map +1 -0
- package/dist/tools/dispatcher-admin.d.ts.map +1 -1
- package/dist/tools/dispatcher-admin.js +290 -1
- package/dist/tools/dispatcher-admin.js.map +1 -1
- package/dist/tools/find.d.ts.map +1 -1
- package/dist/tools/find.js +16 -0
- package/dist/tools/find.js.map +1 -1
- package/dist/tools/sessions.d.ts.map +1 -1
- package/dist/tools/sessions.js +52 -5
- package/dist/tools/sessions.js.map +1 -1
- package/dist/types.d.ts +51 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.d.ts +16 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +83 -6
- package/dist/utils.js.map +1 -1
- package/dist/ws-broadcaster.d.ts +18 -0
- package/dist/ws-broadcaster.d.ts.map +1 -0
- package/dist/ws-broadcaster.js +39 -0
- package/dist/ws-broadcaster.js.map +1 -0
- package/package.json +38 -5
package/README.md
CHANGED
|
@@ -18,6 +18,10 @@
|
|
|
18
18
|
|
|
19
19
|
---
|
|
20
20
|
|
|
21
|
+
> ⭐ **If Engram saves you tokens and context, give it a star — it helps other developers find it.**
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
21
25
|
## 📋 Table of Contents
|
|
22
26
|
|
|
23
27
|
- [Overview](#overview)
|
|
@@ -25,12 +29,14 @@
|
|
|
25
29
|
- [How Engram Works?](#how-engram-works)
|
|
26
30
|
- [Installation](#installation)
|
|
27
31
|
- [Features](#features)
|
|
32
|
+
- [Dashboard](#dashboard)
|
|
28
33
|
- [Architecture](#architecture)
|
|
29
34
|
- [Tools Reference](#tools-reference)
|
|
30
|
-
- [
|
|
35
|
+
- [AI Agent Instructions](#ai-agent-instructions)
|
|
31
36
|
- [Multi-Agent Workflows](#multi-agent-workflows)
|
|
32
37
|
- [Contributing](#contributing)
|
|
33
38
|
- [Security](#security)
|
|
39
|
+
- [Author](#author)
|
|
34
40
|
- [License](#license)
|
|
35
41
|
|
|
36
42
|
---
|
|
@@ -39,7 +45,7 @@
|
|
|
39
45
|
|
|
40
46
|
**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.
|
|
41
47
|
|
|
42
|
-
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).
|
|
48
|
+
It operates seamlessly as a background brain for popular AI tools like **Claude Code**, **Claude Desktop**, **Cursor**, **Windsurf**, **Cline**, **Trae IDE**, **Antigravity IDE**, and **GitHub Copilot** (VS Code & Visual Studio).
|
|
43
49
|
|
|
44
50
|
---
|
|
45
51
|
|
|
@@ -55,6 +61,17 @@ Every AI coding agent is **stateless by default**. Each new session starts from
|
|
|
55
61
|
|
|
56
62
|
Engram solves this by providing a **persistent brain** using a native SQLite (WAL mode) database. An AI agent should only need to deeply review a file once. When you ask it to change something, it should already know where to go.
|
|
57
63
|
|
|
64
|
+
### How Engram Compares
|
|
65
|
+
|
|
66
|
+
| Tool | Approach | Local / No cloud | MCP native | Multi-agent | Works today |
|
|
67
|
+
|------|----------|:---:|:---:|:---:|:---:|
|
|
68
|
+
| **Engram** | Structured SQLite memory | ✅ | ✅ | ✅ | ✅ |
|
|
69
|
+
| mem0 | Cloud vector DB | ❌ | ⚠️ wrapper | ⚠️ | ✅ |
|
|
70
|
+
| MemGPT / Letta | In-context manipulation | ✅ | ❌ | ❌ | ✅ |
|
|
71
|
+
| Plain `CLAUDE.md` | Static text file | ✅ | ✅ | ❌ | ✅ |
|
|
72
|
+
|
|
73
|
+
Engram is the only solution that is **local-first, MCP-native, multi-agent-ready, and structured** (queryable, rankable, exportable) — not just a text file appended to every prompt.
|
|
74
|
+
|
|
58
75
|
---
|
|
59
76
|
|
|
60
77
|
## How Engram Works?
|
|
@@ -177,6 +194,8 @@ npm install -g engram-mcp-server
|
|
|
177
194
|
engram install --ide <your-ide>
|
|
178
195
|
```
|
|
179
196
|
|
|
197
|
+
Available `--ide` values: `claudecode`, `claudedesktop`, `vscode`, `cursor`, `windsurf`, `antigravity`, `visualstudio`, `cline`, `trae`, `jetbrains`
|
|
198
|
+
|
|
180
199
|
> **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.
|
|
181
200
|
|
|
182
201
|
### Option 3: Universal Mode — Built-In Single-Tool Mode (v1.7+)
|
|
@@ -510,6 +529,60 @@ No cloud. No telemetry. No authentication surface. Memory lives in a local SQLit
|
|
|
510
529
|
|
|
511
530
|
---
|
|
512
531
|
|
|
532
|
+
## Dashboard
|
|
533
|
+
|
|
534
|
+
Engram ships with a built-in **visual dashboard** — a React SPA that gives you a live window into your agent's memory without touching the CLI.
|
|
535
|
+
|
|
536
|
+
### Starting the Dashboard
|
|
537
|
+
|
|
538
|
+
```bash
|
|
539
|
+
npm run dashboard
|
|
540
|
+
```
|
|
541
|
+
|
|
542
|
+
This builds the server, installs dashboard dependencies, and starts both the API and the Vite dev server concurrently. The terminal prints the full URL including the auth token:
|
|
543
|
+
|
|
544
|
+
```
|
|
545
|
+
[api] Engram HTTP server running on port 7432
|
|
546
|
+
[ui] VITE ready in 320ms
|
|
547
|
+
|
|
548
|
+
➜ Local: http://localhost:5173?token=<token>
|
|
549
|
+
```
|
|
550
|
+
|
|
551
|
+
Open the printed URL directly — the token is embedded in the link and required for access.
|
|
552
|
+
|
|
553
|
+
> **Security note:** The dashboard is intended for local development. The token prevents other local processes from reading your memory data. Do not expose ports `5173` or `7432` to a network.
|
|
554
|
+
|
|
555
|
+
### Pages
|
|
556
|
+
|
|
557
|
+
| Page | Description |
|
|
558
|
+
|------|-------------|
|
|
559
|
+
| **Dashboard** | Overview — session count, task totals, decisions, and change volume at a glance. Clickable stat cards navigate to the relevant page. Instance cards show per-database stats with expand/collapse. Activity chart displays recent change volume. |
|
|
560
|
+
| **Tasks** | All persistent work items with status, priority, and tags. |
|
|
561
|
+
| **Decisions** | Architectural decisions with rationale, affected files, and dependency chains. |
|
|
562
|
+
| **Changes** | Full change history — every file edit recorded by agents and git hooks. |
|
|
563
|
+
| **Conventions** | Project standards enforced every session. |
|
|
564
|
+
| **File Notes** | Agent-generated file intelligence — purpose, layer, complexity, and executive summary. |
|
|
565
|
+
| **Sessions** | Past session summaries with agent names and timestamps. |
|
|
566
|
+
| **Events** | Scheduled and triggered events, including context-pressure warnings. |
|
|
567
|
+
| **Milestones** | Named project milestones. |
|
|
568
|
+
| **Audit** | Raw event log for debugging and auditing. |
|
|
569
|
+
| **Settings** | Runtime config management — view and update config keys live. |
|
|
570
|
+
|
|
571
|
+
### Dashboard Features
|
|
572
|
+
|
|
573
|
+
- **Live updates** — WebSocket connection delivers real-time pushes when any memory record changes. A live badge in the header shows connection status.
|
|
574
|
+
- **Cmd+K palette** — keyboard-driven quick navigation to any page.
|
|
575
|
+
- **Theme toggle** — dark/light mode, persisted to `localStorage`.
|
|
576
|
+
- **Toast notifications** — non-blocking feedback for actions and live events.
|
|
577
|
+
- **Detail panel** — click any table row to expand full content in a side panel.
|
|
578
|
+
- **Token auth** — every HTTP request and WebSocket connection is validated against the `?token=<value>` query parameter.
|
|
579
|
+
|
|
580
|
+
### Requirements
|
|
581
|
+
|
|
582
|
+
The dashboard is included in the package but its frontend dependencies are installed on first run. Node.js v18+ and an internet connection for the initial `npm install` are required. Subsequent runs use the cached install.
|
|
583
|
+
|
|
584
|
+
---
|
|
585
|
+
|
|
513
586
|
## Architecture
|
|
514
587
|
|
|
515
588
|
```mermaid
|
|
@@ -625,111 +698,56 @@ Engram v1.7.0 exposes **4 dispatcher tools** (or 1 tool in `--mode=universal`).
|
|
|
625
698
|
|
|
626
699
|
---
|
|
627
700
|
|
|
628
|
-
##
|
|
629
|
-
|
|
630
|
-
> **Copy-paste ready.** Copy everything between the `<!-- ENGRAM_INSTRUCTIONS_START -->` and `<!-- ENGRAM_INSTRUCTIONS_END -->` markers below directly into your agent's instruction file — `CLAUDE.md`, `.github/copilot-instructions.md`, Cursor Rules, or equivalent. No reformatting needed. Works as-is.
|
|
631
|
-
|
|
632
|
-
<!-- ENGRAM_INSTRUCTIONS_START -->
|
|
633
|
-
|
|
634
|
-
## Engram — Session Rules
|
|
635
|
-
|
|
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.
|
|
639
|
-
|
|
640
|
-
Follow these rules **every session, every project**.
|
|
641
|
-
|
|
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.
|
|
644
|
-
|
|
645
|
-
---
|
|
646
|
-
|
|
647
|
-
### Session Start — ALWAYS FIRST, BEFORE any action
|
|
701
|
+
## AI Agent Instructions
|
|
648
702
|
|
|
649
|
-
|
|
650
|
-
engram_session({
|
|
651
|
-
action: "start",
|
|
652
|
-
agent_name: "claude",
|
|
653
|
-
verbosity: "summary",
|
|
654
|
-
focus: "topic if known",
|
|
655
|
-
});
|
|
656
|
-
```
|
|
657
|
-
|
|
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.
|
|
703
|
+
> **Important:** AI agents have a strong tendency to skip Engram tool calls — particularly `engram_session(action:"start")` at the beginning of a chat and `engram_memory(action:"get_file_notes")` before opening files — and proceed directly to reading and reviewing. This defeats the purpose of the memory system entirely. **For any session that involves file exploration or codebase work, explicitly instruct the agent in your prompt to use Engram before acting.** A simple addition like *"Before doing anything, start an Engram session. Before opening any file, check its Engram notes first."* is sufficient to enforce compliance.
|
|
662
704
|
|
|
663
|
-
|
|
705
|
+
> **Copy-paste ready.** The block below can be dropped directly into `CLAUDE.md`, `.github/copilot-instructions.md`, Cursor Rules, or any equivalent agent instruction file — no reformatting needed.
|
|
664
706
|
|
|
665
|
-
|
|
707
|
+
<!-- ENGRAM_INSTRUCTIONS_START -->
|
|
666
708
|
|
|
709
|
+
### Session Start — ALWAYS FIRST
|
|
667
710
|
```js
|
|
668
|
-
|
|
711
|
+
engram_session({ action: "start", agent_name: "claude", verbosity: "summary", focus: "topic if known", project_root: "/absolute/path/to/project" })
|
|
669
712
|
```
|
|
713
|
+
- `project_root` (optional): Pass the absolute path to the workspace when the IDE may not set cwd to the project directory (e.g. Antigravity, Windsurf, Claude Desktop). Engram will re-initialize its database at the correct location. Omit if the IDE already provides `${workspaceFolder}` (VS Code, Cursor).
|
|
670
714
|
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
---
|
|
674
|
-
|
|
675
|
-
### Before Design/Architecture Decisions
|
|
715
|
+
Act on everything returned: `active_decisions` (binding), `active_conventions` (enforce), `open_tasks`, `agent_rules`, `triggered_events`.
|
|
716
|
+
Unknown action? → `engram_find({ query: "what I want to do" })`
|
|
676
717
|
|
|
718
|
+
### Before Opening Any File
|
|
677
719
|
```js
|
|
678
|
-
engram_memory({ action: "
|
|
679
|
-
// or: engram_memory({ action: "get_decisions" })
|
|
720
|
+
engram_memory({ action: "get_file_notes", file_path: "..." })
|
|
680
721
|
```
|
|
722
|
+
`high` confidence → use notes, skip opening. `stale`/absent → read file, then immediately call `set_file_notes` with `executive_summary`.
|
|
681
723
|
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
---
|
|
685
|
-
|
|
686
|
-
### After Editing Files
|
|
687
|
-
|
|
724
|
+
### Before Architecture/Design Decisions
|
|
688
725
|
```js
|
|
689
|
-
engram_memory({
|
|
690
|
-
action: "record_change",
|
|
691
|
-
changes: [{ file_path, change_type, description, impact_scope }],
|
|
692
|
-
});
|
|
726
|
+
engram_memory({ action: "search", query: "...", scope: "decisions" })
|
|
693
727
|
```
|
|
728
|
+
Follow existing decisions. Supersede with `record_decision({ ..., supersedes: <id> })`. Always include `rationale`.
|
|
694
729
|
|
|
695
|
-
|
|
696
|
-
`impact_scope`: local | module | cross_module | global. Batch all changes in one call.
|
|
697
|
-
|
|
698
|
-
---
|
|
699
|
-
|
|
700
|
-
### Mid-Session (context pressure)
|
|
701
|
-
|
|
730
|
+
### After Every File Edit
|
|
702
731
|
```js
|
|
703
|
-
engram_memory({ action: "
|
|
704
|
-
engram_memory({ action: "check_events" }) // fires at 50/70/85% context fill
|
|
732
|
+
engram_memory({ action: "record_change", changes: [{ file_path, change_type, description, impact_scope }] })
|
|
705
733
|
```
|
|
734
|
+
`change_type`: `created|modified|refactored|deleted|renamed|moved|config_changed`
|
|
735
|
+
`impact_scope`: `local|module|cross_module|global` — batch all edits in one call.
|
|
706
736
|
|
|
707
|
-
|
|
737
|
+
### Documentation Rule
|
|
738
|
+
Multi-step plans, analyses, proposals → write to `docs/<name>.md`. Chat gets summary only.
|
|
708
739
|
|
|
709
740
|
### Session End — ALWAYS LAST
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
4. Record new conventions.
|
|
715
|
-
5. `engram_session({ action: "end", summary: "files/functions touched, pending work, blockers" })`
|
|
716
|
-
|
|
717
|
-
---
|
|
741
|
+
1. Record unrecorded changes
|
|
742
|
+
2. Mark done tasks: `engram_memory({ action: "update_task", id: N, status: "done" })`
|
|
743
|
+
3. Create tasks for incomplete work
|
|
744
|
+
4. `engram_session({ action: "end", summary: "files touched, pending work, blockers" })`
|
|
718
745
|
|
|
719
746
|
### Sub-Agent Sessions (v1.7+)
|
|
720
|
-
|
|
721
|
-
Use `agent_role: "sub"` for lightweight task-scoped context (~300–500 tokens):
|
|
722
|
-
|
|
723
747
|
```js
|
|
724
|
-
engram_session({
|
|
725
|
-
action: "start",
|
|
726
|
-
agent_name: "sub-agent-auth",
|
|
727
|
-
agent_role: "sub",
|
|
728
|
-
task_id: 42,
|
|
729
|
-
});
|
|
748
|
+
engram_session({ action: "start", agent_name: "sub-agent-X", agent_role: "sub", task_id: 42 })
|
|
730
749
|
```
|
|
731
|
-
|
|
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.
|
|
750
|
+
Returns only the assigned task, its file notes, matching decisions, and up to 5 conventions (~300–500 tokens). Sub-agents still call `record_change` and `session end` as normal.
|
|
733
751
|
|
|
734
752
|
<!-- ENGRAM_INSTRUCTIONS_END -->
|
|
735
753
|
|
|
@@ -946,15 +964,21 @@ The short version: Engram has no network-facing server, no authentication surfac
|
|
|
946
964
|
|
|
947
965
|
---
|
|
948
966
|
|
|
967
|
+
## Author
|
|
968
|
+
|
|
969
|
+
Built by **Renald Shao** (aka **Keggan Student**) — [GitHub](https://github.com/keggan-std) · [Behance](https://www.behance.net/renaldshao)
|
|
970
|
+
|
|
971
|
+
---
|
|
972
|
+
|
|
949
973
|
## License
|
|
950
974
|
|
|
951
975
|
This project is licensed under the [MIT License](LICENSE).
|
|
952
976
|
|
|
953
|
-
Copyright © 2026 Keggan Student, Tanzania.
|
|
977
|
+
Copyright © 2026 Renald Shao (aka Keggan Student), Tanzania.
|
|
954
978
|
|
|
955
979
|
---
|
|
956
980
|
|
|
957
981
|
<div align="center">
|
|
958
982
|
<em>Because your AI agent shouldn't have amnesia.</em><br/>
|
|
959
|
-
<strong>Copyright © 2026 Keggan Student — Tanzania</strong>
|
|
983
|
+
<strong>Copyright © 2026 Renald Shao (aka Keggan Student) — Tanzania</strong>
|
|
960
984
|
</div>
|
package/dist/constants.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export declare const SERVER_VERSION: string;
|
|
|
3
3
|
export declare const TOOL_PREFIX = "engram";
|
|
4
4
|
export declare const DB_DIR_NAME = ".engram";
|
|
5
5
|
export declare const DB_FILE_NAME = "memory.db";
|
|
6
|
-
export declare const DB_VERSION =
|
|
6
|
+
export declare const DB_VERSION = 22;
|
|
7
7
|
export declare const MAX_FILE_TREE_DEPTH = 5;
|
|
8
8
|
export declare const MAX_FILE_TREE_ENTRIES = 500;
|
|
9
9
|
export declare const MAX_SEARCH_RESULTS = 50;
|
|
@@ -24,7 +24,7 @@ export declare const EXCLUDED_DIRS: Set<string>;
|
|
|
24
24
|
* STRONG markers: unambiguous project boundaries. Found → return immediately.
|
|
25
25
|
* These never appear in IDE install directories or npm global dirs.
|
|
26
26
|
*/
|
|
27
|
-
export declare const STRONG_PROJECT_MARKERS: readonly [".git"
|
|
27
|
+
export declare const STRONG_PROJECT_MARKERS: readonly [".git"];
|
|
28
28
|
/**
|
|
29
29
|
* SOFT markers: typically present in real projects but also in Electron/Node
|
|
30
30
|
* app install dirs. Only used after strong markers are exhausted, AND only if
|
|
@@ -42,6 +42,12 @@ export declare const PROJECT_MARKERS: string[];
|
|
|
42
42
|
* is rejected so we don't mistake an IDE's own install dir for a project root.
|
|
43
43
|
*/
|
|
44
44
|
export declare const BLOCKED_PATH_PATTERNS: RegExp[];
|
|
45
|
+
/**
|
|
46
|
+
* Returns true if the given directory is the user's home directory.
|
|
47
|
+
* The home dir is never a valid project root — no one's "project" is ~/.
|
|
48
|
+
* This prevents the bootstrap trap where ~/.engram/ makes HOME look like a project.
|
|
49
|
+
*/
|
|
50
|
+
export declare function isHomeDirectory(dirPath: string): boolean;
|
|
45
51
|
export declare const NPM_REGISTRY_URL = "https://registry.npmjs.org/engram-mcp-server/latest";
|
|
46
52
|
export declare const GITHUB_REPO = "keggan-std/Engram";
|
|
47
53
|
export declare const GITHUB_RELEASES_URL = "https://github.com/keggan-std/Engram/releases";
|
|
@@ -53,5 +59,20 @@ export declare const CFG_AUTO_UPDATE_CHANGELOG = "auto_update_changelog";
|
|
|
53
59
|
export declare const CFG_AUTO_UPDATE_SKIP_VERSION = "auto_update_skip_version";
|
|
54
60
|
export declare const CFG_AUTO_UPDATE_REMIND_AFTER = "auto_update_remind_after";
|
|
55
61
|
export declare const CFG_AUTO_UPDATE_NOTIFY_LEVEL = "auto_update_notify_level";
|
|
62
|
+
export declare const CFG_INSTANCE_ID = "instance_id";
|
|
63
|
+
export declare const CFG_INSTANCE_LABEL = "instance_label";
|
|
64
|
+
export declare const CFG_INSTANCE_CREATED_AT = "instance_created_at";
|
|
65
|
+
export declare const CFG_MACHINE_ID = "machine_id";
|
|
66
|
+
export declare const CFG_SHARING_MODE = "sharing_mode";
|
|
67
|
+
export declare const CFG_SHARING_TYPES = "sharing_types";
|
|
68
|
+
export declare const CFG_SENSITIVE_KEYS = "sensitive_keys";
|
|
69
|
+
export declare const CFG_HTTP_TOKEN = "http_token";
|
|
70
|
+
export declare const INSTANCE_REGISTRY_DIR = ".engram";
|
|
71
|
+
export declare const INSTANCE_REGISTRY_FILE = "instances.json";
|
|
72
|
+
export declare const HEARTBEAT_INTERVAL_MS = 60000;
|
|
73
|
+
export declare const STALE_THRESHOLD_MS: number;
|
|
74
|
+
export declare const PRUNE_THRESHOLD_MS: number;
|
|
75
|
+
export declare const DEFAULT_SHARING_MODE = "none";
|
|
76
|
+
export declare const DEFAULT_SHARING_TYPES: string[];
|
|
56
77
|
export declare const LAYER_PATTERNS: Record<string, RegExp[]>;
|
|
57
78
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,WAAW,sBAAsB,CAAC;AAC/C,eAAO,MAAM,cAAc,EAAE,MAAqB,CAAC;AACnD,eAAO,MAAM,WAAW,WAAW,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BAAsB,CAAC;AACzD,eAAO,MAAM,0BAA0B,2BAA2B,CAAC;AACnE,eAAO,MAAM,yBAAyB,0BAA0B,CAAC;AACjE,eAAO,MAAM,yBAAyB,0BAA0B,CAAC;AACjE,eAAO,MAAM,4BAA4B,6BAA6B,CAAC;AACvE,eAAO,MAAM,4BAA4B,6BAA6B,CAAC;AACvE,eAAO,MAAM,4BAA4B,6BAA6B,CAAC;AAGvE,eAAO,MAAM,eAAe,gBAAgB,CAAC;AAC7C,eAAO,MAAM,kBAAkB,mBAAmB,CAAC;AACnD,eAAO,MAAM,uBAAuB,wBAAwB,CAAC;AAC7D,eAAO,MAAM,cAAc,eAAe,CAAC;AAC3C,eAAO,MAAM,gBAAgB,iBAAiB,CAAC;AAC/C,eAAO,MAAM,iBAAiB,kBAAkB,CAAC;AACjD,eAAO,MAAM,kBAAkB,mBAAmB,CAAC;AACnD,eAAO,MAAM,cAAc,eAAe,CAAC;AAG3C,eAAO,MAAM,qBAAqB,YAAY,CAAC;AAC/C,eAAO,MAAM,sBAAsB,mBAAmB,CAAC;AACvD,eAAO,MAAM,qBAAqB,QAAS,CAAC;AAC5C,eAAO,MAAM,kBAAkB,QAAa,CAAC;AAC7C,eAAO,MAAM,kBAAkB,QAAuB,CAAC;AAGvD,eAAO,MAAM,oBAAoB,SAAS,CAAC;AAC3C,eAAO,MAAM,qBAAqB,UAA+B,CAAC;AAGlE,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAYnD,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// Engram MCP Server — Constants
|
|
3
3
|
// ============================================================================
|
|
4
4
|
import { readFileSync } from "fs";
|
|
5
|
+
import os from "os";
|
|
5
6
|
import { fileURLToPath } from "url";
|
|
6
7
|
import path from "path";
|
|
7
8
|
const _pkgPath = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../package.json");
|
|
@@ -12,8 +13,7 @@ export const TOOL_PREFIX = "engram";
|
|
|
12
13
|
// Database
|
|
13
14
|
export const DB_DIR_NAME = ".engram";
|
|
14
15
|
export const DB_FILE_NAME = "memory.db";
|
|
15
|
-
export const DB_VERSION =
|
|
16
|
-
// V12 checkpoints, V13 content_hash, V14 executive_summary, V15 agent specializations
|
|
16
|
+
export const DB_VERSION = 22; // V18 http-token, V19 soft-delete, V20 audit-log, V21 import-jobs, V22 annotations
|
|
17
17
|
// Limits
|
|
18
18
|
export const MAX_FILE_TREE_DEPTH = 5;
|
|
19
19
|
export const MAX_FILE_TREE_ENTRIES = 500;
|
|
@@ -61,7 +61,12 @@ export const EXCLUDED_DIRS = new Set([
|
|
|
61
61
|
*/
|
|
62
62
|
export const STRONG_PROJECT_MARKERS = [
|
|
63
63
|
".git",
|
|
64
|
-
|
|
64
|
+
// NOTE: .engram was removed from STRONG markers in v1.9.1 hotfix.
|
|
65
|
+
// It is self-referential — Engram creates .engram/, so its presence
|
|
66
|
+
// cannot prove a *project* boundary. When cwd = HOME, any stale
|
|
67
|
+
// ~/.engram/ made the home directory look like a project root,
|
|
68
|
+
// causing all global-only IDEs to share one database. Real projects
|
|
69
|
+
// always have .git or a soft marker (package.json, etc.).
|
|
65
70
|
];
|
|
66
71
|
/**
|
|
67
72
|
* SOFT markers: typically present in real projects but also in Electron/Node
|
|
@@ -120,6 +125,15 @@ export const BLOCKED_PATH_PATTERNS = [
|
|
|
120
125
|
/[/\\]lib[/\\]node_modules[/\\]/i,
|
|
121
126
|
/[/\\]node_modules\.bin[/\\]/i,
|
|
122
127
|
];
|
|
128
|
+
/**
|
|
129
|
+
* Returns true if the given directory is the user's home directory.
|
|
130
|
+
* The home dir is never a valid project root — no one's "project" is ~/.
|
|
131
|
+
* This prevents the bootstrap trap where ~/.engram/ makes HOME look like a project.
|
|
132
|
+
*/
|
|
133
|
+
export function isHomeDirectory(dirPath) {
|
|
134
|
+
const norm = (p) => p.replace(/\\/g, "/").replace(/\/$/, "").toLowerCase();
|
|
135
|
+
return norm(dirPath) === norm(os.homedir());
|
|
136
|
+
}
|
|
123
137
|
// Update check
|
|
124
138
|
export const NPM_REGISTRY_URL = "https://registry.npmjs.org/engram-mcp-server/latest";
|
|
125
139
|
export const GITHUB_REPO = "keggan-std/Engram";
|
|
@@ -133,6 +147,24 @@ export const CFG_AUTO_UPDATE_CHANGELOG = "auto_update_changelog";
|
|
|
133
147
|
export const CFG_AUTO_UPDATE_SKIP_VERSION = "auto_update_skip_version";
|
|
134
148
|
export const CFG_AUTO_UPDATE_REMIND_AFTER = "auto_update_remind_after";
|
|
135
149
|
export const CFG_AUTO_UPDATE_NOTIFY_LEVEL = "auto_update_notify_level"; // "major" | "minor" | "patch"
|
|
150
|
+
// Config keys — instance identity & cross-instance
|
|
151
|
+
export const CFG_INSTANCE_ID = "instance_id";
|
|
152
|
+
export const CFG_INSTANCE_LABEL = "instance_label";
|
|
153
|
+
export const CFG_INSTANCE_CREATED_AT = "instance_created_at";
|
|
154
|
+
export const CFG_MACHINE_ID = "machine_id";
|
|
155
|
+
export const CFG_SHARING_MODE = "sharing_mode"; // "none" | "read" | "full"
|
|
156
|
+
export const CFG_SHARING_TYPES = "sharing_types"; // JSON array of table names
|
|
157
|
+
export const CFG_SENSITIVE_KEYS = "sensitive_keys"; // JSON array of decision/convention IDs marked sensitive
|
|
158
|
+
export const CFG_HTTP_TOKEN = "http_token"; // Bearer token for dashboard API (file fallback: .engram/token)
|
|
159
|
+
// Instance registry
|
|
160
|
+
export const INSTANCE_REGISTRY_DIR = ".engram";
|
|
161
|
+
export const INSTANCE_REGISTRY_FILE = "instances.json";
|
|
162
|
+
export const HEARTBEAT_INTERVAL_MS = 60_000; // 60 seconds
|
|
163
|
+
export const STALE_THRESHOLD_MS = 5 * 60_000; // 5 minutes
|
|
164
|
+
export const PRUNE_THRESHOLD_MS = 7 * 24 * 60 * 60_000; // 7 days
|
|
165
|
+
// Sharing defaults
|
|
166
|
+
export const DEFAULT_SHARING_MODE = "none";
|
|
167
|
+
export const DEFAULT_SHARING_TYPES = ["decisions", "conventions"];
|
|
136
168
|
// Architecture layer detection patterns
|
|
137
169
|
export const LAYER_PATTERNS = {
|
|
138
170
|
ui: [/\/(ui|views?|screens?|pages?|components?|widgets?)\//i, /\.(jsx|tsx|vue|svelte)$/],
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,gCAAgC;AAChC,+EAA+E;AAE/E,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAC;AAC/F,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;AAEzD,MAAM,CAAC,MAAM,WAAW,GAAG,mBAAmB,CAAC;AAC/C,MAAM,CAAC,MAAM,cAAc,GAAW,IAAI,CAAC,OAAO,CAAC;AACnD,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC;AAEpC,WAAW;AACX,MAAM,CAAC,MAAM,WAAW,GAAG,SAAS,CAAC;AACrC,MAAM,CAAC,MAAM,YAAY,GAAG,WAAW,CAAC;AACxC,MAAM,CAAC,MAAM,UAAU,GAAG,EAAE,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,gCAAgC;AAChC,+EAA+E;AAE/E,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAA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AC;IACzD,EAAE,EAAE,CAAC,0CAA0C,CAAC;IAChD,IAAI,EAAE,CAAC,2CAA2C,CAAC;IACnD,IAAI,EAAE,CAAC,wCAAwC,EAAE,kBAAkB,CAAC;IACpE,MAAM,EAAE,CAAC,sCAAsC,CAAC;IAChD,KAAK,EAAE,CAAC,oCAAoC,EAAE,oBAAoB,CAAC;CACpE,CAAC"}
|
package/dist/database.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Database as DatabaseType } from "better-sqlite3";
|
|
2
2
|
import { type Repositories } from "./repositories/index.js";
|
|
3
|
-
import { CompactionService, ProjectScanService, GitService, EventTriggerService, UpdateService, AgentRulesService } from "./services/index.js";
|
|
3
|
+
import { CompactionService, ProjectScanService, GitService, EventTriggerService, UpdateService, AgentRulesService, InstanceRegistryService, CrossInstanceService, SensitiveDataService } from "./services/index.js";
|
|
4
4
|
export interface Services {
|
|
5
5
|
compaction: CompactionService;
|
|
6
6
|
scan: ProjectScanService;
|
|
@@ -8,13 +8,34 @@ export interface Services {
|
|
|
8
8
|
events: EventTriggerService;
|
|
9
9
|
update: UpdateService;
|
|
10
10
|
agentRules: AgentRulesService;
|
|
11
|
+
registry: InstanceRegistryService;
|
|
12
|
+
crossInstance: CrossInstanceService;
|
|
13
|
+
sensitiveData: SensitiveDataService;
|
|
11
14
|
}
|
|
12
|
-
export declare function initDatabase(projectRoot: string): DatabaseType;
|
|
15
|
+
export declare function initDatabase(projectRoot: string, ideKey?: string): DatabaseType;
|
|
13
16
|
export declare function getDb(): DatabaseType;
|
|
14
17
|
export declare function getRepos(): Repositories;
|
|
15
18
|
export declare function getServices(): Services;
|
|
16
19
|
export declare function getProjectRoot(): string;
|
|
17
20
|
export declare function getDbPath(): string;
|
|
21
|
+
/**
|
|
22
|
+
* Re-initialize the database at a new project root.
|
|
23
|
+
*
|
|
24
|
+
* Used when the agent provides the correct project_root at session start
|
|
25
|
+
* and the server originally resolved to the wrong location (e.g. the
|
|
26
|
+
* global fallback because the IDE spawned from $HOME).
|
|
27
|
+
*
|
|
28
|
+
* If the old DB at the incorrect location contains data, this function
|
|
29
|
+
* copies it to the new location so previous sessions/decisions/etc. survive.
|
|
30
|
+
*
|
|
31
|
+
* @returns {{ migrated: boolean; oldPath: string; newPath: string; message: string }}
|
|
32
|
+
*/
|
|
33
|
+
export declare function reinitDatabase(newProjectRoot: string, ideKey?: string): {
|
|
34
|
+
migrated: boolean;
|
|
35
|
+
oldPath: string;
|
|
36
|
+
newPath: string;
|
|
37
|
+
message: string;
|
|
38
|
+
};
|
|
18
39
|
/**
|
|
19
40
|
* Create a backup copy of the database file.
|
|
20
41
|
* Uses SQLite's backup API for a safe, consistent copy.
|
package/dist/database.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../src/database.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAK/D,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,UAAU,EAAE,mBAAmB,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../src/database.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAK/D,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,UAAU,EAAE,mBAAmB,EAAE,aAAa,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAKpN,MAAM,WAAW,QAAQ;IACvB,UAAU,EAAE,iBAAiB,CAAC;IAC9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