@smyslenny/agent-memory 2.0.0 โ†’ 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,22 @@
1
+ name: test
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ jobs:
8
+ vitest:
9
+ runs-on: ubuntu-latest
10
+ strategy:
11
+ fail-fast: false
12
+ matrix:
13
+ node: [18, 20, 22]
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - uses: actions/setup-node@v4
17
+ with:
18
+ node-version: ${{ matrix.node }}
19
+ cache: npm
20
+ - run: npm ci
21
+ - run: npm test
22
+
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.1.2 (2026-02-22)
4
+
5
+ ### ๐Ÿ”— OpenClaw Integration V1 (Cron Synchronization)
6
+
7
+ - **Capture โ†’ Consolidate โ†’ Surface closed loop** โ€” agent-memory now integrates seamlessly with OpenClaw's built-in memory cron jobs (`memory-sync`, `memory-tidy`, `memory-surface`) with zero code changes ([DD-0004](docs/design/0004-agent-memory-integration.md))
8
+ - **memory-sync** (14:00 & 22:00): Each new journal bullet is auto-synced to agent-memory via `mcporter call agent-memory.remember` with keyword-based type classification and URI dedup
9
+ - **memory-tidy** (03:00): Triggers `agent-memory.reflect phase=all` (Ebbinghaus decay + tidy + govern) after Markdown consolidation, with consistency spot-check
10
+ - **memory-surface** (14:05 & 22:05): Generates structured `RECENT.md` (โ‰ค80 lines) from high-vitality agent-memory entries, with fallback to raw journal reading
11
+ - **Design principle**: Markdown remains source of truth; agent-memory is a derived index layer with best-effort sync
12
+ - **README updated** with full OpenClaw Integration guide
13
+
14
+ ## 2.1.1 (2026-02-21)
15
+
16
+ ### ๐Ÿ“ Documentation
17
+
18
+ - **Memory-janitor integration guide** โ€” New `examples/openclaw-setup.md` section explaining what a memory janitor is and how to wire it to agent-memory (decay trigger + consistency check) ([PR #2](https://github.com/smysle/agent-memory/pull/2))
19
+ - **Phase 5 prompt template** โ€” New `examples/memory-janitor-phase5.md` with full prompt template for appending decay + consistency phases to an existing janitor cron job
20
+ - Covers Gap 1 (Ebbinghaus decay never fires without external trigger) and Gap 2 (two-store divergence between agent-memory and canonical memory files)
21
+ - Includes configurable conflict resolution strategies (canonical wins / agent-memory wins / manual review)
22
+
3
23
  ## 2.0.0 (2026-02-20)
4
24
 
5
25
  ### ๐ŸŽ‰ Complete Rewrite
package/README.md CHANGED
@@ -37,8 +37,8 @@ Inspired by how human brains consolidate memories during sleep, AgentMemory mana
37
37
  | ๐Ÿ•ธ๏ธ **Knowledge Graph** | Multi-hop traversal across memory associations | PowerMem |
38
38
  | ๐Ÿ“ธ **Snapshots** | Auto-snapshot before every change, one-click rollback | nocturne + Memory Palace |
39
39
  | ๐Ÿ” **Intent-Aware Search** | Factual / temporal / causal / exploratory query routing | Memory Palace |
40
- | ๐ŸŒ™ **Sleep Cycle** | Automated sync โ†’ decay โ†’ tidy โ†’ govern pipeline | **Our original design** |
41
- | ๐Ÿ’š **Priority System** | P0 identity (never decays) โ†’ P3 event (14-day half-life) | **Our original design** |
40
+ | ๐ŸŒ™ **Sleep Cycle** | Automated sync โ†’ decay โ†’ tidy โ†’ govern pipeline | - |
41
+ | ๐Ÿ’š **Priority System** | P0 identity (never decays) โ†’ P3 event (14-day half-life) | - |
42
42
  | ๐Ÿค **Multi-Agent** | Agent isolation via `agent_id` scope | PowerMem |
43
43
  | ๐Ÿ”Œ **MCP Server** | 9 tools, works with Claude Code / Cursor / OpenClaw | Standard MCP |
44
44
 
@@ -47,7 +47,7 @@ Inspired by how human brains consolidate memories during sleep, AgentMemory mana
47
47
  ### Install
48
48
 
49
49
  ```bash
50
- npm install agent-memory
50
+ npm install @smyslenny/agent-memory
51
51
  ```
52
52
 
53
53
  ### CLI
@@ -79,7 +79,7 @@ agent-memory status
79
79
  ### Library
80
80
 
81
81
  ```typescript
82
- import { openDatabase, syncOne, searchBM25, boot, runDecay } from 'agent-memory';
82
+ import { openDatabase, syncOne, searchBM25, boot, runDecay } from '@smyslenny/agent-memory';
83
83
 
84
84
  const db = openDatabase({ path: './memory.db' });
85
85
 
@@ -106,9 +106,9 @@ runDecay(db);
106
106
  ```json
107
107
  {
108
108
  "mcpServers": {
109
- "agent-memory": {
109
+ "@smyslenny/agent-memory": {
110
110
  "command": "node",
111
- "args": ["node_modules/agent-memory/dist/mcp/server.js"],
111
+ "args": ["node_modules/@smyslenny/agent-memory/dist/mcp/server.js"],
112
112
  "env": {
113
113
  "AGENT_MEMORY_DB": "./memory.db"
114
114
  }
@@ -119,6 +119,46 @@ runDecay(db);
119
119
 
120
120
  **9 MCP Tools:** `remember` ยท `recall` ยท `recall_path` ยท `boot` ยท `forget` ยท `link` ยท `snapshot` ยท `reflect` ยท `status`
121
121
 
122
+ ## ๐Ÿ”— OpenClaw Integration
123
+
124
+ AgentMemory works **out of the box** with [OpenClaw](https://github.com/smysle/openclaw)'s built-in memory cron jobs โ€” no code changes required. The integration implements a **Capture โ†’ Consolidate โ†’ Surface** closed loop that keeps Markdown journals and the structured memory DB in sync automatically.
125
+
126
+ ### How It Works
127
+
128
+ ```
129
+ Capture (memory-sync) Consolidate (memory-tidy) Surface (memory-surface)
130
+ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
131
+ 14:00 & 22:00 03:00 14:05 & 22:05
132
+ Session โ†’ daily journal Compress old dailies Recall top memories
133
+ + remember each bullet Distill โ†’ MEMORY.md โ†’ generate RECENT.md
134
+ into agent-memory DB + reflect phase=all (โ‰ค80 lines, 3 sections)
135
+ ```
136
+
137
+ | Phase | Cron Job | What Happens | agent-memory Integration |
138
+ |-------|----------|-------------|--------------------------|
139
+ | **Capture** | `memory-sync` | Scans sessions, appends bullets to `memory/YYYY-MM-DD.md` | Each new bullet is also written via `mcporter call agent-memory.remember` with auto-classified type and URI-based dedup |
140
+ | **Consolidate** | `memory-tidy` | Compresses old dailies โ†’ weekly summaries, distills `MEMORY.md` | Triggers `agent-memory.reflect phase=all` (decay + tidy + govern) + consistency spot-check |
141
+ | **Surface** | `memory-surface` | Generates short-term context for new sessions | Reads high-vitality memories from agent-memory, outputs structured `RECENT.md` with emotion/knowledge/event sections |
142
+
143
+ ### Key Design Principles
144
+
145
+ - **Markdown is source of truth** โ€” agent-memory is a derived index layer; all data flows Markdown โ†’ DB, never the reverse.
146
+ - **Best-effort sync** โ€” If `mcporter` or agent-memory is unavailable, Markdown operations proceed normally. Failures only log warnings.
147
+ - **URI-based idempotency** โ€” Each journal bullet maps to a unique URI (`event://journal/2026-02-21#2200-1`), so re-runs are safe.
148
+ - **Keyword-based classification** โ€” Bullets are auto-classified as `knowledge`, `emotion`, or `event` using simple keyword rules (no extra model calls).
149
+
150
+ ### Setup
151
+
152
+ If you're running OpenClaw with the standard memory cron suite (`memory-sync`, `memory-tidy`, `memory-surface`), the integration is **already active** โ€” the cron prompts include agent-memory sync steps. Just make sure:
153
+
154
+ 1. **agent-memory is installed and initialized** โ€” `agent-memory init`
155
+ 2. **mcporter bridge is configured** โ€” agent-memory MCP server registered in your mcporter config
156
+ 3. **Cron jobs are enabled** โ€” check with `openclaw cron list`
157
+
158
+ For detailed setup and prompt templates, see:
159
+ - [`examples/openclaw-setup.md`](examples/openclaw-setup.md) โ€” Full setup walkthrough
160
+ - [`docs/design/0004-agent-memory-integration.md`](docs/design/0004-agent-memory-integration.md) โ€” Design document (DD-0004)
161
+
122
162
  ## ๐Ÿ—๏ธ Architecture
123
163
 
124
164
  ```
package/README.zh-CN.md CHANGED
@@ -36,8 +36,8 @@ AI Agent ๆฏๆฌกไผš่ฏ้ƒฝไผš้—ๅฟ˜ไธ€ๅˆ‡ใ€‚ไธŠไธ‹ๆ–‡็ช—ๅฃๆœ‰้™๏ผŒๅฏน่ฏๅކๅฒ
36
36
  | ๐Ÿ•ธ๏ธ **็Ÿฅ่ฏ†ๅ›พ่ฐฑ** | ่ฎฐๅฟ†ๅ…ณ่”็š„ๅคš่ทณ้ๅކ | PowerMem |
37
37
  | ๐Ÿ“ธ **ๅฟซ็…ง็ณป็ปŸ** | ๆฏๆฌกไฟฎๆ”นๅ‰่‡ชๅŠจๅฟซ็…ง๏ผŒไธ€้”ฎๅ›žๆปš | nocturne + Memory Palace |
38
38
  | ๐Ÿ” **ๆ„ๅ›พๆ„Ÿ็Ÿฅๆœ็ดข** | ไบ‹ๅฎžๅž‹/ๆ—ถ้—ดๅž‹/ๅ› ๆžœๅž‹/ๆŽข็ดขๅž‹ๆŸฅ่ฏข่ทฏ็”ฑ | Memory Palace |
39
- | ๐ŸŒ™ **็ก็œ ๅ‘จๆœŸ** | ่‡ชๅŠจๅŒ– sync โ†’ decay โ†’ tidy โ†’ govern ๆตๆฐด็บฟ | **ๆˆ‘ไปฌ็š„ๅŽŸๅˆ›่ฎพ่ฎก** |
40
- | ๐Ÿ’š **ไผ˜ๅ…ˆ็บง็ณป็ปŸ** | P0 ่บซไปฝ๏ผˆๆฐธไธ่กฐๅ‡๏ผ‰โ†’ P3 ไบ‹ไปถ๏ผˆ14ๅคฉๅŠ่กฐๆœŸ๏ผ‰ | **ๆˆ‘ไปฌ็š„ๅŽŸๅˆ›่ฎพ่ฎก** |
39
+ | ๐ŸŒ™ **็ก็œ ๅ‘จๆœŸ** | ่‡ชๅŠจๅŒ– sync โ†’ decay โ†’ tidy โ†’ govern ๆตๆฐด็บฟ | - |
40
+ | ๐Ÿ’š **ไผ˜ๅ…ˆ็บง็ณป็ปŸ** | P0 ่บซไปฝ๏ผˆๆฐธไธ่กฐๅ‡๏ผ‰โ†’ P3 ไบ‹ไปถ๏ผˆ14ๅคฉๅŠ่กฐๆœŸ๏ผ‰ | - |
41
41
  | ๐Ÿค **ๅคš Agent** | ้€š่ฟ‡ `agent_id` ๅฎž็Žฐ่ฎฐๅฟ†้š”็ฆป | PowerMem |
42
42
  | ๐Ÿ”Œ **MCP Server** | 9 ไธชๅทฅๅ…ท๏ผŒๆ”ฏๆŒ Claude Code / Cursor / OpenClaw | ๆ ‡ๅ‡† MCP |
43
43
 
@@ -46,7 +46,7 @@ AI Agent ๆฏๆฌกไผš่ฏ้ƒฝไผš้—ๅฟ˜ไธ€ๅˆ‡ใ€‚ไธŠไธ‹ๆ–‡็ช—ๅฃๆœ‰้™๏ผŒๅฏน่ฏๅކๅฒ
46
46
  ### ๅฎ‰่ฃ…
47
47
 
48
48
  ```bash
49
- npm install agent-memory
49
+ npm install @smyslenny/agent-memory
50
50
  ```
51
51
 
52
52
  ### ๅ‘ฝไปค่กŒ
@@ -78,7 +78,7 @@ agent-memory status
78
78
  ### ไฝœไธบๅบ“ไฝฟ็”จ
79
79
 
80
80
  ```typescript
81
- import { openDatabase, syncOne, searchBM25, boot, runDecay } from 'agent-memory';
81
+ import { openDatabase, syncOne, searchBM25, boot, runDecay } from '@smyslenny/agent-memory';
82
82
 
83
83
  const db = openDatabase({ path: './memory.db' });
84
84
 
@@ -105,9 +105,9 @@ runDecay(db);
105
105
  ```json
106
106
  {
107
107
  "mcpServers": {
108
- "agent-memory": {
108
+ "@smyslenny/agent-memory": {
109
109
  "command": "node",
110
- "args": ["node_modules/agent-memory/dist/mcp/server.js"],
110
+ "args": ["node_modules/@smyslenny/agent-memory/dist/mcp/server.js"],
111
111
  "env": {
112
112
  "AGENT_MEMORY_DB": "./memory.db"
113
113
  }