@smyslenny/agent-memory 2.2.0 โ†’ 3.1.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.
package/CHANGELOG.md CHANGED
@@ -1,57 +1,61 @@
1
1
  # Changelog
2
2
 
3
- ## 2.1.2 (2026-02-22)
3
+ ## 3.0.1 (2026-02-24)
4
4
 
5
- ### ๐Ÿ”— OpenClaw Integration V1 (Cron Synchronization)
5
+ ### ๐Ÿ› ๏ธ OpenClaw P0 fixes
6
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
7
+ - **Fixed memory-sync session path mismatch** in cron prompt:
8
+ - removed hardcoded `~/.openclaw/agents/main/sessions/*.jsonl`
9
+ - switched to dynamic discovery with `noah` + env-derived agent path + `main` fallback
10
+ - **Aligned memory-tidy prompt** with the same session path health check strategy
11
+ - **Added memory-sync health output contract**:
12
+ - `session_scan_glob`
13
+ - `session_file_count`
14
+ - `latest_session_file`
15
+ - `extracted_message_count`
16
+ - `appended_bullet_count`
17
+ - `synced_memory_count`
18
+ - `sync_error_count`
13
19
 
14
- ## 2.1.1 (2026-02-21)
20
+ ### โœจ Auto-ingest watcher implemented
15
21
 
16
- ### ๐Ÿ“ Documentation
22
+ - Added `fs.watch`-based auto-ingest watcher for:
23
+ - `~/.openclaw/workspace/memory/*.md`
24
+ - `~/.openclaw/workspace/MEMORY.md`
25
+ - New module: `src/ingest/watcher.ts`
26
+ - MCP server now starts watcher by default (configurable):
27
+ - `AGENT_MEMORY_AUTO_INGEST=0` to disable
28
+ - `AGENT_MEMORY_WORKSPACE` to override workspace path
17
29
 
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)
30
+ ### ๐Ÿงฑ Ingest refactor + tests
22
31
 
23
- ## 2.0.0 (2026-02-20)
32
+ - Extracted ingest core logic from MCP server into reusable module:
33
+ - `src/ingest/ingest.ts`
34
+ - MCP `ingest` tool now delegates to shared `ingestText()`
35
+ - Added ingest tests:
36
+ - dry-run extraction does not write DB
37
+ - source marker stored as `auto:{source}`
24
38
 
25
- ### ๐ŸŽ‰ Complete Rewrite
39
+ ### ๐Ÿ“š Documentation realigned to v3 reality
26
40
 
27
- AgentMemory v2 is a ground-up rewrite incorporating the best ideas from 4 open-source memory projects (nocturne_memory, Memory Palace, PowerMem, our v1) while keeping the codebase minimal (3 dependencies).
41
+ - Rewrote `README.md` and `README.en.md` to match actual v3 capabilities
42
+ - Removed stale v2-era claims (embedding/reranker/link/snapshot/hybrid stack narrative)
43
+ - Added explicit auto-ingest watcher behavior and env vars
28
44
 
29
- ### โœจ New Features
45
+ ---
30
46
 
31
- - **URI Path System** โ€” `core://`, `emotion://`, `knowledge://`, `event://` namespaces with Content-Path separation
32
- - **Write Guard** โ€” Hash dedup โ†’ URI conflict โ†’ BM25 similarity โ†’ 4-criterion gate pipeline
33
- - **Ebbinghaus Forgetting Curve** โ€” Scientific decay model `R = e^(-t/S)` with recall strengthening
34
- - **Knowledge Graph** โ€” Association links with multi-hop BFS traversal
35
- - **Snapshot/Rollback** โ€” Auto-snapshot before every modification, one-click restore
36
- - **Intent-Aware Search** โ€” Factual / temporal / causal / exploratory query classification
37
- - **Sleep Cycle Engine** โ€” Automated sync โ†’ decay โ†’ tidy โ†’ govern pipeline
38
- - **Priority System** โ€” P0 identity (never decays) through P3 event (14-day half-life)
39
- - **Multi-Agent Isolation** โ€” Per-agent memory scoping via `agent_id`
40
- - **MCP Server** โ€” 9 tools for Claude Code / Cursor / OpenClaw integration
41
- - **CLI** โ€” 7 commands: init, remember, recall, boot, status, reflect, migrate
42
- - **Markdown Migration** โ€” Import existing MEMORY.md + daily journals + weekly summaries
47
+ ## 3.0.0 (2026-02-23)
43
48
 
44
- ### ๐Ÿ“Š Stats
49
+ ### ๐ŸŽ‰ v3 Simplification
45
50
 
46
- - 14 source modules
47
- - 9 MCP tools
48
- - 7 CLI commands
49
- - 41 tests passing
50
- - 3 production dependencies
51
+ - Repositioned agent-memory as a structured companion to memory-core
52
+ - Removed redundant v2 capabilities at API/tooling level
53
+ - MCP toolset finalized at 9 tools:
54
+ - `remember`, `recall`, `recall_path`, `boot`, `forget`, `reflect`, `status`, `ingest`, `surface`
55
+ - Added narrative warm-boot and human-readable reflect report
51
56
 
52
- ### ๐Ÿ™ Inspired By
57
+ ---
53
58
 
54
- - [nocturne_memory](https://github.com/Dataojitori/nocturne_memory) โ€” URI paths, Content-Path separation, boot loading
55
- - [Memory Palace](https://github.com/AGI-is-going-to-arrive/Memory-Palace) โ€” Write Guard, intent search, vitality decay
56
- - [PowerMem](https://github.com/oceanbase/powermem) โ€” Ebbinghaus curve, knowledge graph, multi-agent
57
- - Our v1 production experience โ€” Sleep cycle, dedup, 4-criterion gate, emotional priority
59
+ ## 2.x (legacy)
60
+
61
+ v2.x included embedding/reranker/link/snapshot-era behavior. See git history and design docs for full details.
package/README.en.md ADDED
@@ -0,0 +1,153 @@
1
+ # ๐Ÿง  AgentMemory v3
2
+
3
+ > Structured long-term memory layer for AI agents: write, recall, decay, and auto-ingest.
4
+
5
+ [![npm](https://img.shields.io/npm/v/@smyslenny/agent-memory)](https://www.npmjs.com/package/@smyslenny/agent-memory)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
7
+ [![Node.js](https://img.shields.io/badge/Node.js-โ‰ฅ18-green.svg)](https://nodejs.org/)
8
+ [![MCP](https://img.shields.io/badge/MCP-9_tools-orange.svg)](https://modelcontextprotocol.io/)
9
+
10
+ **[็ฎ€ไฝ“ไธญๆ–‡](README.md)** | **English**
11
+
12
+ ---
13
+
14
+ ## Positioning in v3
15
+
16
+ AgentMemory v3 is explicitly a **structured memory companion** to OpenClaw memory-core, not a second full-stack retrieval system.
17
+
18
+ - Markdown (`memory/*.md` + `MEMORY.md`) remains the human-readable source of truth
19
+ - agent-memory is a derived, structured lifecycle layer
20
+
21
+ Core capabilities:
22
+
23
+ - **Typed memory model**: `identity / emotion / knowledge / event`
24
+ - **URI path addressing**: `core://`, `emotion://`, `knowledge://`, `event://`
25
+ - **Write Guard** for dedup/conflict gating
26
+ - **BM25 recall** with priority ร— vitality weighting
27
+ - **Sleep-cycle maintenance** via `reflect` (decay / tidy / govern)
28
+ - **Ingest** for markdown-to-memory extraction
29
+ - **Surface** for readonly context surfacing (no access side effects)
30
+ - **Warm boot / reflect narrative output**
31
+ - **Multi-agent isolation** by `agent_id`
32
+
33
+ ---
34
+
35
+ ## Quick Start
36
+
37
+ ### Install
38
+
39
+ ```bash
40
+ npm install -g @smyslenny/agent-memory
41
+ ```
42
+
43
+ ### CLI examples
44
+
45
+ ```bash
46
+ # Initialize DB
47
+ agent-memory init
48
+
49
+ # Store memory
50
+ agent-memory remember "User prefers dark mode" --type knowledge --uri knowledge://preferences/theme
51
+
52
+ # Search
53
+ agent-memory recall "user preferences" --limit 5
54
+
55
+ # Startup boot (narrative output)
56
+ agent-memory boot
57
+
58
+ # Run sleep cycle
59
+ agent-memory reflect all
60
+ ```
61
+
62
+ ---
63
+
64
+ ## MCP Server
65
+
66
+ ### Example config
67
+
68
+ ```json
69
+ {
70
+ "mcpServers": {
71
+ "agent-memory": {
72
+ "command": "node",
73
+ "args": ["node_modules/@smyslenny/agent-memory/dist/mcp/server.js"],
74
+ "env": {
75
+ "AGENT_MEMORY_DB": "./agent-memory.db",
76
+ "AGENT_MEMORY_AGENT_ID": "noah",
77
+ "AGENT_MEMORY_AUTO_INGEST": "1",
78
+ "AGENT_MEMORY_WORKSPACE": "/home/user/.openclaw/workspace"
79
+ }
80
+ }
81
+ }
82
+ }
83
+ ```
84
+
85
+ ### MCP tools (9)
86
+
87
+ - `remember`
88
+ - `recall`
89
+ - `recall_path`
90
+ - `boot`
91
+ - `forget`
92
+ - `reflect`
93
+ - `status`
94
+ - `ingest`
95
+ - `surface`
96
+
97
+ > `link` and `snapshot` were removed in v3.
98
+
99
+ ---
100
+
101
+ ## Auto-Ingest (file change watcher)
102
+
103
+ When MCP server starts, watcher is enabled by default (`fs.watch`) for:
104
+
105
+ - `~/.openclaw/workspace/memory/*.md`
106
+ - `~/.openclaw/workspace/MEMORY.md`
107
+
108
+ On file changes, ingest runs automatically (still guarded by Write Guard and dedup).
109
+
110
+ Environment variables:
111
+
112
+ - `AGENT_MEMORY_AUTO_INGEST`
113
+ - `1` (default): enabled
114
+ - `0`: disabled
115
+ - `AGENT_MEMORY_WORKSPACE`
116
+ - default: `$HOME/.openclaw/workspace`
117
+
118
+ ---
119
+
120
+ ## Recommended OpenClaw integration
121
+
122
+ Use a 3-stage cron pipeline:
123
+
124
+ 1. `memory-sync` (14:00 / 22:00)
125
+ - dynamic session JSONL discovery
126
+ - append incremental entries to `memory/YYYY-MM-DD.md`
127
+ - best-effort `agent-memory.remember`
128
+ - emit health metrics (scan path / file count / extracted / synced)
129
+
130
+ 2. `memory-tidy` (03:00)
131
+ - markdown consolidation/distillation
132
+ - call `agent-memory.reflect phase=all`
133
+
134
+ 3. `memory-surface` (14:05 / 22:05)
135
+ - generate `RECENT.md`
136
+
137
+ Design principle: **Markdown is source of truth; agent-memory is a derived index layer.**
138
+
139
+ ---
140
+
141
+ ## Development
142
+
143
+ ```bash
144
+ npm install
145
+ npm test
146
+ npm run build
147
+ ```
148
+
149
+ ---
150
+
151
+ ## License
152
+
153
+ MIT
package/README.md CHANGED
@@ -1,220 +1,153 @@
1
- # ๐Ÿง  AgentMemory v2
1
+ # ๐Ÿง  AgentMemory v3
2
2
 
3
- > **Sleep-cycle memory architecture for AI agents** โ€” remember, recall, forget, evolve.
3
+ > ้ขๅ‘ AI Agent ็š„็ป“ๆž„ๅŒ–้•ฟๆœŸ่ฎฐๅฟ†ๅฑ‚๏ผšๅฏๅ†™ๅ…ฅใ€ๅฏๆฃ€็ดขใ€ๅฏ่กฐๅ‡ใ€ๅฏ่‡ชๅŠจๆ‘„ๅ–ใ€‚
4
4
 
5
- [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
5
+ [![npm](https://img.shields.io/npm/v/@smyslenny/agent-memory)](https://www.npmjs.com/package/@smyslenny/agent-memory)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
6
7
  [![Node.js](https://img.shields.io/badge/Node.js-โ‰ฅ18-green.svg)](https://nodejs.org/)
7
- [![MCP](https://img.shields.io/badge/protocol-MCP-orange.svg)](https://modelcontextprotocol.io/)
8
+ [![MCP](https://img.shields.io/badge/MCP-9_tools-orange.svg)](https://modelcontextprotocol.io/)
8
9
 
9
- **English** | **[็ฎ€ไฝ“ไธญๆ–‡](README.zh-CN.md)**
10
+ **็ฎ€ไฝ“ไธญๆ–‡** | **[English](README.en.md)**
10
11
 
11
12
  ---
12
13
 
13
- ## ๐Ÿ’ก The Problem
14
+ ## ้กน็›ฎๅฎšไฝ๏ผˆv3๏ผ‰
14
15
 
15
- AI agents forget everything between sessions. Context windows are finite. Conversation history gets truncated. Important decisions, lessons, and preferences vanish.
16
+ AgentMemory ๅœจ v3 ไธญๆ˜Ž็กฎๅฎšไฝไธบ **OpenClaw memory-core ็š„็ป“ๆž„ๅŒ–่กฅๅ……ๅฑ‚**๏ผŒ่€Œไธๆ˜ฏ็ฌฌไบŒๅฅ—ๅ…จๆ ˆๆฃ€็ดข็ณป็ปŸ๏ผš
16
17
 
17
- ## ๐ŸŒ™ The Solution: Sleep-Cycle Memory
18
+ - Markdown๏ผˆ`memory/*.md` + `MEMORY.md`๏ผ‰ๆ˜ฏๅฏ่ฏปๅฏ็ผ–่พ‘็š„ไบ‹ๅฎžๆบ
19
+ - agent-memory ๆ˜ฏๆดพ็”Ÿ็ดขๅผ•ๅฑ‚๏ผŒ่ดŸ่ดฃ็ป“ๆž„ๅŒ–่ฎฐๅฟ†็”Ÿๅ‘ฝๅ‘จๆœŸ
18
20
 
19
- Inspired by how human brains consolidate memories during sleep, AgentMemory manages information across four phases:
21
+ ๆ ธๅฟƒ่ƒฝๅŠ›๏ผš
20
22
 
21
- ```
22
- Awake Light Sleep Deep Sleep Recall
23
- (Journal) (Sync) (Tidy) (Search)
24
- โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โ”€โ”€โ†’ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โ”€โ”€โ†’ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โ”€โ”€โ†’ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
25
- Real-time Deduplicate Compress Intent-aware
26
- capture + extract + distill BM25 search
27
- + decay + priority
28
- ```
23
+ - **็ฑปๅž‹ๅŒ–่ฎฐๅฟ†**๏ผš`identity / emotion / knowledge / event`
24
+ - **URI ่ทฏๅพ„ๅฏปๅ€**๏ผš`core://`ใ€`emotion://`ใ€`knowledge://`ใ€`event://`
25
+ - **Write Guard**๏ผšๅ†™ๅ…ฅๅ‰ๅšๅŽป้‡ไธŽๅ†ฒ็ช้—จๆŽง
26
+ - **BM25 ๆฃ€็ดข**๏ผšๅธฆ priority ร— vitality ๅŠ ๆƒ
27
+ - **็ก็œ ๅ‘จๆœŸ**๏ผš`reflect` ่งฆๅ‘ decay / tidy / govern
28
+ - **ingest ่‡ชๅŠจๆ‘„ๅ–**๏ผšไปŽ markdown ๆๅ–ๅนถๅ…ฅๅบ“
29
+ - **surface ๅช่ฏปๆตฎ็Žฐ**๏ผšๆ— ๅ‰ฏไฝœ็”จๅœฐ่กฅๅ……ไธŠไธ‹ๆ–‡
30
+ - **warm boot / reflect ๆŠฅๅ‘Š**๏ผšไบบ็ฑปๅฏ่ฏป่พ“ๅ‡บ
31
+ - **ๅคš Agent ้š”็ฆป**๏ผšๅŒๅบ“ไธๅŒ agent_id ไบ’ไธๆฑกๆŸ“
29
32
 
30
- ## โœจ Key Features
31
-
32
- | Feature | Description | Inspired By |
33
- |---------|-------------|-------------|
34
- | ๐Ÿ”— **URI Path System** | `core://user/name`, `emotion://2026-02-20/love` โ€” structured, multi-entry access | nocturne_memory |
35
- | ๐Ÿ›ก๏ธ **Write Guard** | Hash dedup โ†’ URI conflict โ†’ BM25 similarity โ†’ 4-criterion gate | Memory Palace + our v1 |
36
- | ๐Ÿง  **Ebbinghaus Decay** | `R = e^(-t/S)` โ€” scientific forgetting curve with recall strengthening | PowerMem |
37
- | ๐Ÿ•ธ๏ธ **Knowledge Graph** | Multi-hop traversal across memory associations | PowerMem |
38
- | ๐Ÿ“ธ **Snapshots** | Auto-snapshot before every change, one-click rollback | nocturne + Memory Palace |
39
- | ๐Ÿ” **Intent-Aware Search** | Factual / temporal / causal / exploratory query routing | Memory Palace |
40
- | ๐ŸŒ™ **Sleep Cycle** | Automated sync โ†’ decay โ†’ tidy โ†’ govern pipeline | - |
41
- | ๐Ÿ’š **Priority System** | P0 identity (never decays) โ†’ P3 event (14-day half-life) | - |
42
- | ๐Ÿค **Multi-Agent** | Agent isolation via `agent_id` scope | PowerMem |
43
- | ๐Ÿ”Œ **MCP Server** | 9 tools, works with Claude Code / Cursor / OpenClaw | Standard MCP |
33
+ ---
44
34
 
45
- ## ๐Ÿš€ Quick Start
35
+ ## ๅฟซ้€Ÿๅผ€ๅง‹
46
36
 
47
- ### Install
37
+ ### ๅฎ‰่ฃ…
48
38
 
49
39
  ```bash
50
- npm install @smyslenny/agent-memory
40
+ npm install -g @smyslenny/agent-memory
51
41
  ```
52
42
 
53
- ### CLI
43
+ ### CLI ็คบไพ‹
54
44
 
55
45
  ```bash
56
- # Initialize database
46
+ # ๅˆๅง‹ๅŒ–ๆ•ฐๆฎๅบ“
57
47
  agent-memory init
58
48
 
59
- # Store memories
60
- agent-memory remember "User prefers dark mode" --type knowledge --uri knowledge://user/preferences
61
- agent-memory remember "I am Noah, a succubus" --type identity --uri core://agent/identity
49
+ # ๅ†™ๅ…ฅ่ฎฐๅฟ†
50
+ agent-memory remember "็”จๆˆทๅๅฅฝๆทฑ่‰ฒๆจกๅผ" --type knowledge --uri knowledge://preferences/theme
62
51
 
63
- # Search
64
- agent-memory recall "user preferences"
52
+ # ๆฃ€็ดข
53
+ agent-memory recall "็”จๆˆทๅๅฅฝ" --limit 5
65
54
 
66
- # Load identity at startup
55
+ # ๅฏๅŠจๆ—ถๅŠ ่ฝฝ๏ผˆๅ™ไบ‹ๆ ผๅผ๏ผ‰
67
56
  agent-memory boot
68
57
 
69
- # Run sleep cycle
58
+ # ่งฆๅ‘็ก็œ ๅ‘จๆœŸ
70
59
  agent-memory reflect all
71
-
72
- # Import from Markdown
73
- agent-memory migrate ./memory/
74
-
75
- # Statistics
76
- agent-memory status
77
60
  ```
78
61
 
79
- ### Library
80
-
81
- ```typescript
82
- import { openDatabase, syncOne, searchBM25, boot, runDecay } from '@smyslenny/agent-memory';
83
-
84
- const db = openDatabase({ path: './memory.db' });
85
-
86
- // Remember
87
- syncOne(db, {
88
- content: 'User said "I love you"',
89
- type: 'emotion',
90
- uri: 'emotion://2026-02-20/love',
91
- emotion_val: 1.0,
92
- });
93
-
94
- // Recall
95
- const results = searchBM25(db, 'love');
96
-
97
- // Boot identity
98
- const identity = boot(db);
62
+ ---
99
63
 
100
- // Sleep cycle
101
- runDecay(db);
102
- ```
64
+ ## MCP Server
103
65
 
104
- ### MCP Server
66
+ ### ้…็ฝฎ็คบไพ‹
105
67
 
106
68
  ```json
107
69
  {
108
70
  "mcpServers": {
109
- "@smyslenny/agent-memory": {
71
+ "agent-memory": {
110
72
  "command": "node",
111
73
  "args": ["node_modules/@smyslenny/agent-memory/dist/mcp/server.js"],
112
74
  "env": {
113
- "AGENT_MEMORY_DB": "./memory.db"
75
+ "AGENT_MEMORY_DB": "./agent-memory.db",
76
+ "AGENT_MEMORY_AGENT_ID": "noah",
77
+ "AGENT_MEMORY_AUTO_INGEST": "1",
78
+ "AGENT_MEMORY_WORKSPACE": "/home/user/.openclaw/workspace"
114
79
  }
115
80
  }
116
81
  }
117
82
  }
118
83
  ```
119
84
 
120
- **9 MCP Tools:** `remember` ยท `recall` ยท `recall_path` ยท `boot` ยท `forget` ยท `link` ยท `snapshot` ยท `reflect` ยท `status`
85
+ ### MCP ๅทฅๅ…ท๏ผˆ9ไธช๏ผ‰
121
86
 
122
- ## ๐Ÿ”— OpenClaw Integration
87
+ - `remember`
88
+ - `recall`
89
+ - `recall_path`
90
+ - `boot`
91
+ - `forget`
92
+ - `reflect`
93
+ - `status`
94
+ - `ingest`
95
+ - `surface`
123
96
 
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.
97
+ > v3 ๅทฒ็งป้™ค `link` / `snapshot` ๅทฅๅ…ทใ€‚
125
98
 
126
- ### How It Works
99
+ ---
127
100
 
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
- ```
101
+ ## Auto-Ingest๏ผˆๆ–‡ไปถๅ˜ๆ›ด่‡ชๅŠจๅ…ฅๅบ“๏ผ‰
136
102
 
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 |
103
+ MCP server ๅฏๅŠจๅŽไผš้ป˜่ฎคๅผ€ๅฏ watcher๏ผˆ`fs.watch`๏ผ‰๏ผš
142
104
 
143
- ### Key Design Principles
105
+ - `~/.openclaw/workspace/memory/*.md`
106
+ - `~/.openclaw/workspace/MEMORY.md`
144
107
 
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).
108
+ ๅฝ“ๆ–‡ไปถๅ˜ๅŒ–ๆ—ถ่‡ชๅŠจๆ‰ง่กŒ ingest๏ผˆๅค็”จ Write Guard๏ผŒๅน‚็ญ‰/ๅŽป้‡๏ผ‰ใ€‚
149
109
 
150
- ### Setup
110
+ ็Žฏๅขƒๅ˜้‡๏ผš
151
111
 
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:
112
+ - `AGENT_MEMORY_AUTO_INGEST`
113
+ - `1`๏ผˆ้ป˜่ฎค๏ผ‰๏ผšๅผ€ๅฏ
114
+ - `0`๏ผšๅ…ณ้—ญ
115
+ - `AGENT_MEMORY_WORKSPACE`
116
+ - ้ป˜่ฎค๏ผš`$HOME/.openclaw/workspace`
153
117
 
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`
118
+ ---
157
119
 
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)
120
+ ## OpenClaw ้›†ๆˆๅปบ่ฎฎ๏ผˆๆ–นๆกˆA๏ผ‰
161
121
 
162
- ## ๐Ÿ—๏ธ Architecture
122
+ ๆŽจ่ไธ‰ๆฎต cron๏ผš
163
123
 
164
- ```
165
- โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
166
- โ”‚ MCP Server (stdio/SSE) โ”‚
167
- โ”‚ 9 tools + system://boot loader โ”‚
168
- โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
169
- โ”‚ Write Guard โ”‚
170
- โ”‚ hash dedup โ†’ URI conflict โ†’ BM25 sim โ”‚
171
- โ”‚ โ†’ conflict merge โ†’ 4-criterion gate โ”‚
172
- โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
173
- โ”‚ Sleep Cycle Engine โ”‚
174
- โ”‚ sync (capture) โ†’ decay (Ebbinghaus) โ”‚
175
- โ”‚ โ†’ tidy (archive) โ†’ govern (cleanup) โ”‚
176
- โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
177
- โ”‚ Intent-Aware Search (BM25) โ”‚
178
- โ”‚ factual ยท temporal ยท causal ยท explore โ”‚
179
- โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
180
- โ”‚ SQLite (WAL) + FTS5 + Graph Links โ”‚
181
- โ”‚ memories ยท paths ยท links ยท snapshots โ”‚
182
- โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
183
- ```
124
+ 1. `memory-sync`๏ผˆ14:00 / 22:00๏ผ‰
125
+ - ๅŠจๆ€ๅ‘็Žฐ session JSONL
126
+ - ๅขž้‡ๅ†™ๅ…ฅ `memory/YYYY-MM-DD.md`
127
+ - best-effort ๅŒๆญฅๅˆฐ `agent-memory.remember`
128
+ - ่พ“ๅ‡บๅฅๅบทๆŒ‡ๆ ‡๏ผˆๆ‰ซๆ่ทฏๅพ„ใ€ไผš่ฏๆ–‡ไปถๆ•ฐใ€ๆๅ–ๆ•ฐใ€ๅ†™ๅบ“ๆ•ฐ๏ผ‰
184
129
 
185
- ## ๐Ÿ“Š Priority & Decay
130
+ 2. `memory-tidy`๏ผˆ03:00๏ผ‰
131
+ - ๅŽ‹็ผฉ/่’ธ้ฆ markdown
132
+ - ่ฐƒ็”จ `agent-memory.reflect phase=all`
186
133
 
187
- | Priority | Domain | Half-life | Min Vitality | Example |
188
- |----------|--------|-----------|-------------|---------|
189
- | P0 Identity | `core://` | โˆž (never) | 1.0 | "I am Noah" |
190
- | P1 Emotion | `emotion://` | 365 days | 0.3 | "User said I love you" |
191
- | P2 Knowledge | `knowledge://` | 90 days | 0.1 | "Use TypeScript for agents" |
192
- | P3 Event | `event://` | 14 days | 0.0 | "Configured proxy today" |
134
+ 3. `memory-surface`๏ผˆ14:05 / 22:05๏ผ‰
135
+ - ็”Ÿๆˆ `RECENT.md`
193
136
 
194
- **Recall strengthens memory:** each search hit increases stability (S ร— 1.5), slowing future decay.
137
+ ่ฎพ่ฎกๅŽŸๅˆ™๏ผš**Markdown ๆ˜ฏ็œŸ็›ธๆบ๏ผŒagent-memory ๆ˜ฏๆดพ็”Ÿ็ดขๅผ•ๅฑ‚ใ€‚**
195
138
 
196
- ## ๐Ÿ”ฌ Design Decisions
139
+ ---
197
140
 
198
- 1. **SQLite over Postgres/MongoDB** โ€” Zero config, single file, WAL mode for concurrent reads
199
- 2. **BM25 over vector search** โ€” No embedding dependency, instant startup, good enough for structured memory
200
- 3. **TypeScript over Python** โ€” Better concurrency, type safety, OpenClaw ecosystem alignment
201
- 4. **Ebbinghaus over linear decay** โ€” Scientifically grounded, recall strengthening is natural
202
- 5. **Write Guard over free writes** โ€” Prevent duplicate/conflicting memories at the gate
203
- 6. **URI paths over flat keys** โ€” Hierarchical organization, prefix queries, multi-entry access
141
+ ## ๅผ€ๅ‘
204
142
 
205
- ## ๐Ÿ“‹ Project Documents
143
+ ```bash
144
+ npm install
145
+ npm test
146
+ npm run build
147
+ ```
206
148
 
207
- | Document | Description |
208
- |----------|-------------|
209
- | [PLANNING.md](PLANNING.md) | Technical architecture + 5-project comparison |
210
- | [ROADMAP.md](ROADMAP.md) | Implementation phases + milestones |
211
- | [ACCEPTANCE.md](ACCEPTANCE.md) | 40+ acceptance criteria + performance targets |
212
- | [COMPLETION.md](COMPLETION.md) | Release checklist + retrospective template |
149
+ ---
213
150
 
214
- ## ๐Ÿ“„ License
151
+ ## License
215
152
 
216
153
  MIT
217
-
218
- ---
219
-
220
- *Built by agents who got tired of forgetting. ๐Ÿง *