@adaptivemcp/memory 0.2.0 → 0.2.2

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 (2) hide show
  1. package/README.md +71 -0
  2. package/package.json +4 -2
package/README.md ADDED
@@ -0,0 +1,71 @@
1
+ # @adaptivemcp/memory
2
+
3
+ Persistent operational knowledge for Adaptive MCP, backed by SQLite
4
+ (`node:sqlite`).
5
+
6
+ `memory` is the **single source of truth (SSOT)**. Every other package reads
7
+ from or writes to it: telemetry folds execution events in, evaluation writes
8
+ derived insights back, and the extension derives its YAML view from it. The
9
+ YAML is a *projection*, never the source.
10
+
11
+ ## Install
12
+
13
+ ```bash
14
+ npm i @adaptivemcp/memory
15
+ ```
16
+
17
+ Requires **Node 26** (the `node:sqlite` module is available without the
18
+ `--experimental-sqlite` flag).
19
+
20
+ ## Usage
21
+
22
+ ```ts
23
+ import { MemoryStore } from "@adaptivemcp/memory";
24
+
25
+ // :memory: for ephemeral; pass a file path to persist.
26
+ const store = new MemoryStore({ path: ":memory:" });
27
+
28
+ store.ensureTool("deploy_service", "ci");
29
+
30
+ // Record an observation (typically done by @adaptivemcp/telemetry).
31
+ store.recordExecution("deploy_service", {
32
+ status: "completed",
33
+ durationMs: 1200,
34
+ model: "gpt-5-mini",
35
+ cost: { amount: 0.0021, currency: "USD" },
36
+ });
37
+
38
+ // Static, human-authored metadata.
39
+ store.setAnnotation("deploy_service", { risk: "high", note: "Needs approval." });
40
+
41
+ // Derived, learned metadata (typically written by @adaptivemcp/evaluation).
42
+ store.addInsight("deploy_service", {
43
+ key: "observed_failure_rate",
44
+ value: 0.12,
45
+ confidence: 0.9,
46
+ source: "evaluation",
47
+ });
48
+
49
+ store.close();
50
+ ```
51
+
52
+ ## API
53
+
54
+ | Method | Purpose |
55
+ | --- | --- |
56
+ | `ensureTool(toolName, serverName?)` | Create a tool record if absent. |
57
+ | `getTool(toolName)` | Read a single `ToolRecord`. |
58
+ | `allTools()` | Read every `ToolRecord`. |
59
+ | `setAnnotation(toolName, annotation)` | Write a static `Annotation` (risk: low\|medium\|high). |
60
+ | `addInsight(toolName, insight)` | Append a learned `Insight`. |
61
+ | `addRecommendation(toolName, recommendation)` | Append an advised `Recommendation`. |
62
+ | `clearRecommendations(toolName)` | Drop stale recommendations before re-planning. |
63
+ | `recordExecution(toolName, partial)` | Fold a completed/failed execution into `ToolStats`. |
64
+ | `close()` | Close the underlying SQLite database. |
65
+
66
+ The store schema is a single `tools` table (`tool_name` PK) holding the
67
+ annotation, insights, recommendations, and stats as JSON columns.
68
+
69
+ ## License
70
+
71
+ Released under the [MIT License](../../LICENSE). Copyright (c) 2026 Kemal Elmizan.
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@adaptivemcp/memory",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Persistent operational knowledge for Adaptive MCP, backed by SQLite (node:sqlite).",
5
+ "license": "MIT",
5
6
  "type": "module",
6
7
  "main": "./dist/index.js",
7
8
  "module": "./dist/index.js",
@@ -13,7 +14,8 @@
13
14
  }
14
15
  },
15
16
  "files": [
16
- "dist"
17
+ "dist",
18
+ "README.md"
17
19
  ],
18
20
  "scripts": {
19
21
  "build": "tsc -p tsconfig.json",