@lotargo/memory_plugin 1.6.4 → 1.6.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lotargo/memory_plugin",
3
- "version": "1.6.4",
3
+ "version": "1.6.5",
4
4
  "description": "100% local hybrid RAG memory for AI coding agents (OpenCode, Claude Code, Codex, Antigravity). MCP server + plugin: persistent user facts, document ingestion, vector + SQLite FTS5 retrieval across sessions.",
5
5
  "type": "module",
6
6
  "main": "opencode-plugin/index.js",
@@ -33,10 +33,10 @@
33
33
  "mcp-server/tools",
34
34
  "mcp-server/boot.js",
35
35
  "mcp-server/cli_boot.js",
36
- "mcp-server/cli.js",
37
- "mcp-server/codex_config.js",
38
- "mcp-server/codex_diagnostics.js",
39
- "mcp-server/index.js",
36
+ "mcp-server/cli.js",
37
+ "mcp-server/codex_config.js",
38
+ "mcp-server/codex_diagnostics.js",
39
+ "mcp-server/index.js",
40
40
  "mcp-server/fact_format.js",
41
41
  "mcp-server/identity.js",
42
42
  "mcp-server/logger.js",
@@ -1,96 +1,100 @@
1
- ---
2
- name: using-memory
3
- description: Comprehensive guide for using the Memory, Hybrid RAG Knowledge Engine & MCP Helper tools (remember, recall, get_fact, forget, update_fact, memory_info, link_knowledge, link_project_memory, unlink_project_memory, relink_project_memory, ingest_document, query_knowledge_base, manage_knowledge_base, reindex_knowledge_base, list-mcp-tools, mcp-reminder). Trigger proactively whenever user preferences, project conventions, technology stack choices, or architecture decisions are introduced, or when querying ingested documentation, indexing files/repos, managing persistent knowledge, or looking up available MCP tool integrations.
4
- ---
5
-
6
- # Using Memory, Hybrid RAG Knowledge Engine & MCP Helper Tools
7
-
8
- You have access to a persistent dual-layer memory engine supercharged with an **Agent-Driven Knowledge Graph** and general MCP integration helpers:
9
- 1. **Layer 1: Notebook Store (Key-Value Facts)**: Stores high-signal personal preferences, project conventions, and durable rules in clean Markdown.
1
+ ---
2
+ name: using-memory
3
+ description: Comprehensive guide for using the Memory, Hybrid RAG Knowledge Engine & MCP Helper tools (remember, recall, get_fact, forget, update_fact, memory_info, link_knowledge, link_project_memory, unlink_project_memory, relink_project_memory, ingest_document, query_knowledge_base, manage_knowledge_base, reindex_knowledge_base, list-mcp-tools, mcp-reminder). Trigger proactively whenever user preferences, project conventions, technology stack choices, or architecture decisions are introduced, or when querying ingested documentation, indexing files/repos, managing persistent knowledge, or looking up available MCP tool integrations.
4
+ ---
5
+
6
+ # Using Memory, Hybrid RAG Knowledge Engine & MCP Helper Tools
7
+
8
+ You have access to a persistent dual-layer memory engine supercharged with an **Agent-Driven Knowledge Graph** and general MCP integration helpers:
9
+ 1. **Layer 1: Notebook Store (Key-Value Facts)**: Stores high-signal personal preferences, project conventions, and durable rules in clean Markdown.
10
10
  2. **Layer 2: Curated RAG Knowledge Base**: Preserves selected external findings, documentation, repositories, and technical guides that are likely to matter again.
11
- 3. **Layer 3: Agent-Driven Knowledge Graph**: Connects Notebook facts (Layer 1) to specific Knowledge Base documents, sections, and **exact line ranges** (Layer 2).
12
- 4. **Integration Layer (General MCP Helpers)**: Quickly discovers connected MCP servers and identifies appropriate tools for specific tasks.
13
-
14
- ---
15
-
16
- ## 1. Tool Selection Decision Matrix
17
-
18
- | Scenario / Intent | Target Tool | Key Parameters |
19
- |-------------------|-------------|----------------|
20
- | User shares identity, tech stack preference, or workflow rule | `remember` | `fact` (English), `title` (concise 2-5 word headline), `scope`, optional `docId`, `startLine`, `endLine` |
21
- | User asks what you remember about them, the project, or linked docs | `recall` | `scope` ("all", "global", "project", "list_projects"), `mode` ("full", "headers"), `offset`, `limit`, optional `query`, `tags`, `since`, `until`, `project` (at session start, MUST fetch all memories with `scope: "all"` without restrictive query filters) |
22
- | Get a single fact's text and metadata by ID | `get_fact` | `id` (metadata id e.g. "8f3a2c"), `scope` |
23
- | User corrects/updates an old saved fact | `update_fact` | `id` (number/id/text), `newText`, `scope` |
24
- | Replace a fact but keep a version trail | `remember` | `fact`, `supersedes` (number/id/text) |
25
- | Protect a fact from accidental `forget` | `remember` | `keep: true` |
26
- | Set a time-to-live on a fact | `remember` | `ttl` ("90d", "2w", "24h", "12m") |
27
- | Filter facts by keyword / tags / date | `recall` | `query`, `tags`, `since`, `until` |
28
- | Show storage paths, versions, fact & RAG stats, git identity | `memory_info` | |
29
- | Connect a Notebook fact to a document, section, or line range | `link_knowledge` | `action` ("link", "list_links", "get_doc_links"), `factText`, `docId`, `startLine`, `endLine`, `relationType` |
11
+ 3. **Layer 3: Agent-Driven Knowledge Graph**: Connects Notebook facts (Layer 1) to specific Knowledge Base documents, sections, and **exact line ranges** (Layer 2).
12
+ 4. **Integration Layer (General MCP Helpers)**: Quickly discovers connected MCP servers and identifies appropriate tools for specific tasks.
13
+
14
+ ---
15
+
16
+ ## 1. Tool Selection Decision Matrix
17
+
18
+ | Scenario / Intent | Target Tool | Key Parameters |
19
+ |-------------------|-------------|----------------|
20
+ | User shares identity, tech stack preference, or workflow rule | `remember` | `fact` (English), `title` (concise 2-5 word headline), `scope`, optional `directory` (workspace path), `docId`, `startLine`, `endLine` |
21
+ | User asks what you remember about them, the project, or linked docs | `recall` | `scope` ("all", "global", "project", "list_projects"), `mode` ("full", "headers"), `offset`, `limit`, optional `query`, `tags`, `since`, `until`, `directory` / `project` (at session start, MUST fetch all memories with `scope: "all"` without restrictive query filters) |
22
+ | Get a single fact's text and metadata by ID | `get_fact` | `id` (metadata id e.g. "8f3a2c"), `scope`, optional `directory` |
23
+ | User corrects/updates an old saved fact | `update_fact` | `id` (number/id/text), `newText`, `scope`, optional `directory` |
24
+ | Replace a fact but keep a version trail | `remember` | `fact`, `supersedes` (number/id/text), optional `directory` |
25
+ | Protect a fact from accidental `forget` | `remember` | `keep: true` |
26
+ | Set a time-to-live on a fact | `remember` | `ttl` ("90d", "2w", "24h", "12m") |
27
+ | Filter facts by keyword / tags / date | `recall` | `query`, `tags`, `since`, `until`, optional `directory` |
28
+ | Show storage paths, versions, fact & RAG stats, git identity | `memory_info` | optional `directory` |
29
+ | Connect a Notebook fact to a document, section, or line range | `link_knowledge` | `action` ("link", "list_links", "get_doc_links"), `factText`, `docId`, `startLine`, `endLine`, `relationType`, optional `directory` |
30
30
  | Register current Git project identity / migrate legacy stores | `memory_info` then `link_project_memory` when `Registry: unlinked` | `directory`, optional `remote` |
31
- | Remove path alias or purge project identity | `unlink_project_memory` | `directory`, `purge` (boolean) |
32
- | Move or merge project memories to new target identity | `relink_project_memory` | `directory`, `remote` (target remote URL) |
33
- | User asks to index a documentation URL, file, or repository | `ingest_document` | `content` (text/file path/URL), `type` ("text", "file", "url"), `title`, `path`, `scope` (project default) |
34
- | User asks a complex question about indexed docs or code | `query_knowledge_base` | `query`, `scope` (all default), `limit`, `instruction`, `generateEmbeddings` |
35
- | User needs multiple queries executed in batch (comparisons, multi-topic) | `batch_query_knowledge_base` | `queries` (array), `scope` (all default), `limit`, `instruction`, `generateEmbeddings` |
36
- | Read full raw content of an ambiguous/abstract document | `manage_knowledge_base` | `action: "read_document"`, `docId` |
37
- | View DB stats, list indexed docs, read/delete docs, export/import snapshots | `manage_knowledge_base` | `action` ("stats", "list", "read_document", "delete", "export_snapshot", "import_snapshot"), `docId`, `snapshotPath` |
38
- | Re-embed all documents after switching embedding model / dimension | `reindex_knowledge_base` | `model`, `dimension` (optional; defaults to active config) |
39
- | Discover available MCP servers and their specific purposes | `list-mcp-tools` | — |
40
- | Ask which MCP tool / server is suitable for a specific task | `mcp-reminder` | `task` (string, e.g., "db migration") |
41
-
42
- ---
43
-
44
- ## 2. Layer 1 & 3: Notebook Store & Agent-Driven Knowledge Graph (`remember`, `recall`, `update_fact`, `forget`, `memory_info`, `link_knowledge`)
45
-
46
- ### Agent-Driven Knowledge Graph Architecture
47
- Automatic regex/heuristic algorithms alone CANNOT infer high-level semantic intent or cross-document relationships. **You (the AI Agent) are the primary architect of the Knowledge Graph.**
48
-
31
+ | Remove path alias or purge project identity | `unlink_project_memory` | `directory`, `purge` (boolean) |
32
+ | Move or merge project memories to new target identity | `relink_project_memory` | `directory`, `remote` (target remote URL) |
33
+ | User asks to index a documentation URL, file, or repository | `ingest_document` | `content` (text/file path/URL), `type` ("text", "file", "url"), `title`, `path`, `scope` (project default), optional `directory` |
34
+ | User asks a complex question about indexed docs or code | `query_knowledge_base` | `query`, `scope` (all default), `limit`, `instruction`, `generateEmbeddings`, optional `directory` |
35
+ | User needs multiple queries executed in batch (comparisons, multi-topic) | `batch_query_knowledge_base` | `queries` (array), `scope` (all default), `limit`, `instruction`, `generateEmbeddings`, optional `directory` |
36
+ | Read full raw content of an ambiguous/abstract document | `manage_knowledge_base` | `action: "read_document"`, `docId` |
37
+ | View DB stats, list indexed docs, read/delete docs, export/import snapshots | `manage_knowledge_base` | `action` ("stats", "list", "read_document", "delete", "export_snapshot", "import_snapshot"), `docId`, `snapshotPath`, optional `directory` |
38
+ | Re-embed all documents after switching embedding model / dimension | `reindex_knowledge_base` | `model`, `dimension` (optional; defaults to active config) |
39
+ | Discover available MCP servers and their specific purposes | `list-mcp-tools` | — |
40
+ | Ask which MCP tool / server is suitable for a specific task | `mcp-reminder` | `task` (string, e.g., "db migration") |
41
+
42
+ ---
43
+
44
+ ## 2. Layer 1 & 3: Notebook Store & Agent-Driven Knowledge Graph (`remember`, `recall`, `update_fact`, `forget`, `memory_info`, `link_knowledge`)
45
+
46
+ ### Agent-Driven Knowledge Graph Architecture
47
+ Automatic regex/heuristic algorithms alone CANNOT infer high-level semantic intent or cross-document relationships. **You (the AI Agent) are the primary architect of the Knowledge Graph.**
48
+
49
49
  When an ingested source supports a durable project decision or rule, link the corresponding Notebook fact directly to the RAG document and, when useful, its exact line range. The Notebook fact is the concise orientation point; the linked RAG source is its detailed evidence and technical context.
50
-
51
- ### What to Save and Link (`remember` & `link_knowledge`)
52
- - **High-Signal Facts**: User name, role, language preferences, architectural constraints, framework choices, coding standards, test rules.
53
- - **Formatting & Fact Titles**:
54
- - Always translate the fact into clear, concise English before calling `remember`.
55
- - **Always specify a descriptive `title` parameter** (a 2-5 word headline, e.g., `title: "Backend Framework Preference"`).
50
+
51
+ ### What to Save and Link (`remember` & `link_knowledge`)
52
+ - **High-Signal Facts**: User name, role, language preferences, architectural constraints, framework choices, coding standards, test rules.
53
+ - **Formatting & Fact Titles**:
54
+ - Always translate the fact into clear, concise English before calling `remember`.
55
+ - **Always specify a descriptive `title` parameter** (a 2-5 word headline, e.g., `title: "Backend Framework Preference"`).
56
56
  - Facts are stored in `**Title** — body` format. Initial session recall and auto-injected `<MEMORY>` blocks MUST include full fact bodies. Header-only recall was tested and rejected because it loses essential context. Use `mode: "headers"` only when the user explicitly asks for a compact inventory, never for session initialization.
57
- - **Linking to Knowledge Base Documents**:
58
- - Pass `docId` (or document title/path) and optional `startLine` / `endLine` when calling `remember` or `link_knowledge`.
59
- - Example: `remember(title: "Backend Framework Preference", fact: "Use Fastify instead of Express for backend services", scope: "project", docId: "arch_specs.md", startLine: 5, endLine: 7)`
60
- - Example: `link_knowledge(factText: "Use PostgreSQL 16 for primary persistence", docId: "database_guide.md", startLine: 20, endLine: 35, relationType: "IMPLEMENTS")`
61
-
62
- ### How Linked Memory Appears (`recall`)
63
- When `recall` is invoked, the engine returns saved facts along with their Agent-linked Knowledge Base documents and exact line ranges:
64
- ```
65
- --- memory_plugin ---
66
- 1. Use Fastify instead of Express for backend services 🔗 [Linked Docs: Project Architecture Specs:L5-7]
67
- 2. PostgreSQL 16 is primary database 🔗 [Linked Docs: database_guide.md:L20-35]
68
- ```
69
-
70
- ### Fact Line Format & Metadata
71
- Each fact is stored as a single Markdown line with an optional invisible HTML comment carrying metadata:
72
- ```
73
- - [2026-08-02 06:08] user prefers TypeScript <!-- id:8f3a2c, ttl:90d, keep:1, tags:pref,arch -->
74
- ```
75
- Supported metadata keys (set via `remember`, rendered as badges by `recall`):
76
- - `id` — auto-generated short id; stable reference for `update_fact` / `forget` / `supersedes`.
77
- - `ttl` — time-to-live ("90d", "2w", "24h", "12m", bare number = days). Expired facts are marked `[EXPIRED]` but never auto-deleted.
78
- - `keep` protection flag; `forget` skips it unless `force: true`.
79
- - `tags` — comma-separated free-form tags for filtering.
80
- - `supersedes` / `supersededBy` versioning: the old fact gets `[SUPERSEDED]` and is excluded from the injected memory block while staying in the store for history.
81
-
82
- ### Remember Options (`remember`)
83
- - `ttl`: "90d", "2w", "24h", "12m" mark the fact for expiry; it will show `[EXPIRED]` once past.
84
- - `keep: true`: protect the fact from `forget` (unless `force: true`).
85
- - `tags`: comma-separated tags for later filtering, e.g. `"pref,arch"`.
86
- - `supersedes`: number (as listed by `recall`), metadata `id`, or text of the fact this one replaces.
87
-
88
- ### Filtering & Viewing Facts (`recall` & `get_fact`)
89
- - `scope`: `"all"` (default), `"global"`, `"project"`, or `"list_projects"` (lists all project stores, total facts, file paths, and git identity bindings).
90
- - `query`: all space-separated terms must match (case-insensitive); searches text, id, tags, and date.
91
- - `tags`: comma-separated; returns facts with ANY matching tag.
92
- - `since` / `until`: "YYYY-MM-DD" (inclusive) to filter by fact date.
93
- - `project`: read a specific project's store from any working directory.
57
+ - **Targeting Project Directory (`directory`)**:
58
+ - Pass `directory: "<project directory path>"` (or `project`) when calling `remember` or `recall` to ensure the call routes to the target project store even when the MCP server runs in an external folder or outside Git.
59
+ - Example: `remember(title: "Backend Framework Preference", fact: "Use Fastify instead of Express for backend services", scope: "project", directory: "F:/projects/my-app")`
60
+ - **Linking to Knowledge Base Documents**:
61
+ - Pass `docId` (or document title/path) and optional `startLine` / `endLine` when calling `remember` or `link_knowledge`.
62
+ - Example: `remember(title: "Backend Framework Preference", fact: "Use Fastify instead of Express for backend services", scope: "project", docId: "arch_specs.md", startLine: 5, endLine: 7)`
63
+ - Example: `link_knowledge(factText: "Use PostgreSQL 16 for primary persistence", docId: "database_guide.md", startLine: 20, endLine: 35, relationType: "IMPLEMENTS")`
64
+
65
+ ### How Linked Memory Appears (`recall`)
66
+ When `recall` is invoked, the engine returns saved facts along with their Agent-linked Knowledge Base documents and exact line ranges:
67
+ ```
68
+ --- memory_plugin ---
69
+ 1. Use Fastify instead of Express for backend services 🔗 [Linked Docs: Project Architecture Specs:L5-7]
70
+ 2. PostgreSQL 16 is primary database 🔗 [Linked Docs: database_guide.md:L20-35]
71
+ ```
72
+
73
+ ### Fact Line Format & Metadata
74
+ Each fact is stored as a single Markdown line with an optional invisible HTML comment carrying metadata:
75
+ ```
76
+ - [2026-08-02 06:08] user prefers TypeScript <!-- id:8f3a2c, ttl:90d, keep:1, tags:pref,arch -->
77
+ ```
78
+ Supported metadata keys (set via `remember`, rendered as badges by `recall`):
79
+ - `id` — auto-generated short id; stable reference for `update_fact` / `forget` / `supersedes`.
80
+ - `ttl` — time-to-live ("90d", "2w", "24h", "12m", bare number = days). Expired facts are marked `[EXPIRED]` but never auto-deleted.
81
+ - `keep` — protection flag; `forget` skips it unless `force: true`.
82
+ - `tags` comma-separated free-form tags for filtering.
83
+ - `supersedes` / `supersededBy`versioning: the old fact gets `[SUPERSEDED]` and is excluded from the injected memory block while staying in the store for history.
84
+
85
+ ### Remember Options (`remember`)
86
+ - `directory` / `project`: optional workspace/project directory path to target when saving project facts from outside cwd.
87
+ - `ttl`: "90d", "2w", "24h", "12m" — mark the fact for expiry; it will show `[EXPIRED]` once past.
88
+ - `keep: true`: protect the fact from `forget` (unless `force: true`).
89
+ - `tags`: comma-separated tags for later filtering, e.g. `"pref,arch"`.
90
+ - `supersedes`: number (as listed by `recall`), metadata `id`, or text of the fact this one replaces.
91
+
92
+ ### Filtering & Viewing Facts (`recall` & `get_fact`)
93
+ - `scope`: `"all"` (default), `"global"`, `"project"`, or `"list_projects"` (lists all project stores, total facts, file paths, and git identity bindings).
94
+ - `directory` / `project`: read a specific project's store from any working directory.
95
+ - `query`: all space-separated terms must match (case-insensitive); searches text, id, tags, and date.
96
+ - `tags`: comma-separated; returns facts with ANY matching tag.
97
+ - `since` / `until`: "YYYY-MM-DD" (inclusive) to filter by fact date.
94
98
  - `mode`: `"full"` (default) or `"headers"` (returns title and badges only, omitting full text body).
95
99
  - `includeSuperseded`: `false` by default so obsolete history does not enter active context; set `true` only to inspect version history.
96
100
  - `offset` / `limit`: optional numeric pagination parameters.