@smyslenny/agent-memory 2.0.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 ADDED
@@ -0,0 +1,37 @@
1
+ # Changelog
2
+
3
+ ## 2.0.0 (2026-02-20)
4
+
5
+ ### ๐ŸŽ‰ Complete Rewrite
6
+
7
+ 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).
8
+
9
+ ### โœจ New Features
10
+
11
+ - **URI Path System** โ€” `core://`, `emotion://`, `knowledge://`, `event://` namespaces with Content-Path separation
12
+ - **Write Guard** โ€” Hash dedup โ†’ URI conflict โ†’ BM25 similarity โ†’ 4-criterion gate pipeline
13
+ - **Ebbinghaus Forgetting Curve** โ€” Scientific decay model `R = e^(-t/S)` with recall strengthening
14
+ - **Knowledge Graph** โ€” Association links with multi-hop BFS traversal
15
+ - **Snapshot/Rollback** โ€” Auto-snapshot before every modification, one-click restore
16
+ - **Intent-Aware Search** โ€” Factual / temporal / causal / exploratory query classification
17
+ - **Sleep Cycle Engine** โ€” Automated sync โ†’ decay โ†’ tidy โ†’ govern pipeline
18
+ - **Priority System** โ€” P0 identity (never decays) through P3 event (14-day half-life)
19
+ - **Multi-Agent Isolation** โ€” Per-agent memory scoping via `agent_id`
20
+ - **MCP Server** โ€” 9 tools for Claude Code / Cursor / OpenClaw integration
21
+ - **CLI** โ€” 7 commands: init, remember, recall, boot, status, reflect, migrate
22
+ - **Markdown Migration** โ€” Import existing MEMORY.md + daily journals + weekly summaries
23
+
24
+ ### ๐Ÿ“Š Stats
25
+
26
+ - 14 source modules
27
+ - 9 MCP tools
28
+ - 7 CLI commands
29
+ - 41 tests passing
30
+ - 3 production dependencies
31
+
32
+ ### ๐Ÿ™ Inspired By
33
+
34
+ - [nocturne_memory](https://github.com/Dataojitori/nocturne_memory) โ€” URI paths, Content-Path separation, boot loading
35
+ - [Memory Palace](https://github.com/AGI-is-going-to-arrive/Memory-Palace) โ€” Write Guard, intent search, vitality decay
36
+ - [PowerMem](https://github.com/oceanbase/powermem) โ€” Ebbinghaus curve, knowledge graph, multi-agent
37
+ - Our v1 production experience โ€” Sleep cycle, dedup, 4-criterion gate, emotional priority
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 smysle
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,180 @@
1
+ # ๐Ÿง  AgentMemory v2
2
+
3
+ > **Sleep-cycle memory architecture for AI agents** โ€” remember, recall, forget, evolve.
4
+
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
6
+ [![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
+
9
+ **English** | **[็ฎ€ไฝ“ไธญๆ–‡](README.zh-CN.md)**
10
+
11
+ ---
12
+
13
+ ## ๐Ÿ’ก The Problem
14
+
15
+ AI agents forget everything between sessions. Context windows are finite. Conversation history gets truncated. Important decisions, lessons, and preferences vanish.
16
+
17
+ ## ๐ŸŒ™ The Solution: Sleep-Cycle Memory
18
+
19
+ Inspired by how human brains consolidate memories during sleep, AgentMemory manages information across four phases:
20
+
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
+ ```
29
+
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 | **Our original design** |
41
+ | ๐Ÿ’š **Priority System** | P0 identity (never decays) โ†’ P3 event (14-day half-life) | **Our original design** |
42
+ | ๐Ÿค **Multi-Agent** | Agent isolation via `agent_id` scope | PowerMem |
43
+ | ๐Ÿ”Œ **MCP Server** | 9 tools, works with Claude Code / Cursor / OpenClaw | Standard MCP |
44
+
45
+ ## ๐Ÿš€ Quick Start
46
+
47
+ ### Install
48
+
49
+ ```bash
50
+ npm install agent-memory
51
+ ```
52
+
53
+ ### CLI
54
+
55
+ ```bash
56
+ # Initialize database
57
+ agent-memory init
58
+
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
62
+
63
+ # Search
64
+ agent-memory recall "user preferences"
65
+
66
+ # Load identity at startup
67
+ agent-memory boot
68
+
69
+ # Run sleep cycle
70
+ agent-memory reflect all
71
+
72
+ # Import from Markdown
73
+ agent-memory migrate ./memory/
74
+
75
+ # Statistics
76
+ agent-memory status
77
+ ```
78
+
79
+ ### Library
80
+
81
+ ```typescript
82
+ import { openDatabase, syncOne, searchBM25, boot, runDecay } from '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);
99
+
100
+ // Sleep cycle
101
+ runDecay(db);
102
+ ```
103
+
104
+ ### MCP Server
105
+
106
+ ```json
107
+ {
108
+ "mcpServers": {
109
+ "agent-memory": {
110
+ "command": "node",
111
+ "args": ["node_modules/agent-memory/dist/mcp/server.js"],
112
+ "env": {
113
+ "AGENT_MEMORY_DB": "./memory.db"
114
+ }
115
+ }
116
+ }
117
+ }
118
+ ```
119
+
120
+ **9 MCP Tools:** `remember` ยท `recall` ยท `recall_path` ยท `boot` ยท `forget` ยท `link` ยท `snapshot` ยท `reflect` ยท `status`
121
+
122
+ ## ๐Ÿ—๏ธ Architecture
123
+
124
+ ```
125
+ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
126
+ โ”‚ MCP Server (stdio/SSE) โ”‚
127
+ โ”‚ 9 tools + system://boot loader โ”‚
128
+ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
129
+ โ”‚ Write Guard โ”‚
130
+ โ”‚ hash dedup โ†’ URI conflict โ†’ BM25 sim โ”‚
131
+ โ”‚ โ†’ conflict merge โ†’ 4-criterion gate โ”‚
132
+ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
133
+ โ”‚ Sleep Cycle Engine โ”‚
134
+ โ”‚ sync (capture) โ†’ decay (Ebbinghaus) โ”‚
135
+ โ”‚ โ†’ tidy (archive) โ†’ govern (cleanup) โ”‚
136
+ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
137
+ โ”‚ Intent-Aware Search (BM25) โ”‚
138
+ โ”‚ factual ยท temporal ยท causal ยท explore โ”‚
139
+ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
140
+ โ”‚ SQLite (WAL) + FTS5 + Graph Links โ”‚
141
+ โ”‚ memories ยท paths ยท links ยท snapshots โ”‚
142
+ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
143
+ ```
144
+
145
+ ## ๐Ÿ“Š Priority & Decay
146
+
147
+ | Priority | Domain | Half-life | Min Vitality | Example |
148
+ |----------|--------|-----------|-------------|---------|
149
+ | P0 Identity | `core://` | โˆž (never) | 1.0 | "I am Noah" |
150
+ | P1 Emotion | `emotion://` | 365 days | 0.3 | "User said I love you" |
151
+ | P2 Knowledge | `knowledge://` | 90 days | 0.1 | "Use TypeScript for agents" |
152
+ | P3 Event | `event://` | 14 days | 0.0 | "Configured proxy today" |
153
+
154
+ **Recall strengthens memory:** each search hit increases stability (S ร— 1.5), slowing future decay.
155
+
156
+ ## ๐Ÿ”ฌ Design Decisions
157
+
158
+ 1. **SQLite over Postgres/MongoDB** โ€” Zero config, single file, WAL mode for concurrent reads
159
+ 2. **BM25 over vector search** โ€” No embedding dependency, instant startup, good enough for structured memory
160
+ 3. **TypeScript over Python** โ€” Better concurrency, type safety, OpenClaw ecosystem alignment
161
+ 4. **Ebbinghaus over linear decay** โ€” Scientifically grounded, recall strengthening is natural
162
+ 5. **Write Guard over free writes** โ€” Prevent duplicate/conflicting memories at the gate
163
+ 6. **URI paths over flat keys** โ€” Hierarchical organization, prefix queries, multi-entry access
164
+
165
+ ## ๐Ÿ“‹ Project Documents
166
+
167
+ | Document | Description |
168
+ |----------|-------------|
169
+ | [PLANNING.md](PLANNING.md) | Technical architecture + 5-project comparison |
170
+ | [ROADMAP.md](ROADMAP.md) | Implementation phases + milestones |
171
+ | [ACCEPTANCE.md](ACCEPTANCE.md) | 40+ acceptance criteria + performance targets |
172
+ | [COMPLETION.md](COMPLETION.md) | Release checklist + retrospective template |
173
+
174
+ ## ๐Ÿ“„ License
175
+
176
+ MIT
177
+
178
+ ---
179
+
180
+ *Built by agents who got tired of forgetting. ๐Ÿง *
@@ -0,0 +1,170 @@
1
+ # ๐Ÿง  AgentMemory v2
2
+
3
+ > **ๅŸบไบŽ็ก็œ ๅ‘จๆœŸ็š„ AI Agent ่ฎฐๅฟ†ๆžถๆž„** โ€” ่ฎฐๅฟ†ใ€ๅ›žๅฟ†ใ€้—ๅฟ˜ใ€่ฟ›ๅŒ–ใ€‚
4
+
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
6
+ [![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
+
9
+ **[English](README.md)** | **็ฎ€ไฝ“ไธญๆ–‡**
10
+
11
+ ---
12
+
13
+ ## ๐Ÿ’ก ้—ฎ้ข˜
14
+
15
+ AI Agent ๆฏๆฌกไผš่ฏ้ƒฝไผš้—ๅฟ˜ไธ€ๅˆ‡ใ€‚ไธŠไธ‹ๆ–‡็ช—ๅฃๆœ‰้™๏ผŒๅฏน่ฏๅކๅฒ่ขซๆˆชๆ–ญ๏ผŒ้‡่ฆ็š„ๅ†ณ็ญ–ใ€ๆ•™่ฎญๅ’Œๅๅฅฝๆถˆๅคฑๆ— ่ธชใ€‚
16
+
17
+ ## ๐ŸŒ™ ๆ–นๆกˆ๏ผš็ก็œ ๅ‘จๆœŸ่ฎฐๅฟ†
18
+
19
+ ๆจกไปฟไบบ็ฑปๅคง่„‘ๅœจ็ก็œ ๆœŸ้—ดๆ•ด็†่ฎฐๅฟ†็š„ๆ–นๅผ๏ผš
20
+
21
+ ```
22
+ ๆธ…้†’ ๆต…็ก็œ  ๆทฑ็ก็œ  ๅ›žๅฟ†
23
+ (่ฎฐๅฝ•) (ๅŒๆญฅ) (ๆ•ด็†) (ๆœ็ดข)
24
+ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โ”€โ”€โ†’ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โ”€โ”€โ†’ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โ”€โ”€โ†’ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
25
+ ๅฎžๆ—ถๆ•่Žท ๅŽป้‡+ๆๅ– ๅŽ‹็ผฉ+่’ธ้ฆ ๆ„ๅ›พๆ„Ÿ็Ÿฅ
26
+ +่กฐๅ‡ BM25ๆœ็ดข
27
+ ```
28
+
29
+ ## โœจ ๆ ธๅฟƒ็‰นๆ€ง
30
+
31
+ | ็‰นๆ€ง | ่ฏดๆ˜Ž | ็ตๆ„Ÿๆฅๆบ |
32
+ |------|------|---------|
33
+ | ๐Ÿ”— **URI ่ทฏๅพ„็ณป็ปŸ** | `core://user/name`ใ€`emotion://2026-02-20/love` โ€” ็ป“ๆž„ๅŒ–ๅคšๅ…ฅๅฃ่ฎฟ้—ฎ | nocturne_memory |
34
+ | ๐Ÿ›ก๏ธ **Write Guard** | hashๅŽป้‡ โ†’ URIๅ†ฒ็ช โ†’ BM25็›ธไผผๅบฆ โ†’ ๅ››ๅ‡†ๅˆ™้—จๆŽง | Memory Palace + ๆˆ‘ไปฌ็š„ v1 |
35
+ | ๐Ÿง  **่‰พๅฎพๆตฉๆ–ฏ่กฐๅ‡** | `R = e^(-t/S)` โ€” ็ง‘ๅญฆ้—ๅฟ˜ๆ›ฒ็บฟ + ๅ›žๅฟ†ๅผบๅŒ– | PowerMem |
36
+ | ๐Ÿ•ธ๏ธ **็Ÿฅ่ฏ†ๅ›พ่ฐฑ** | ่ฎฐๅฟ†ๅ…ณ่”็š„ๅคš่ทณ้ๅކ | PowerMem |
37
+ | ๐Ÿ“ธ **ๅฟซ็…ง็ณป็ปŸ** | ๆฏๆฌกไฟฎๆ”นๅ‰่‡ชๅŠจๅฟซ็…ง๏ผŒไธ€้”ฎๅ›žๆปš | nocturne + Memory Palace |
38
+ | ๐Ÿ” **ๆ„ๅ›พๆ„Ÿ็Ÿฅๆœ็ดข** | ไบ‹ๅฎžๅž‹/ๆ—ถ้—ดๅž‹/ๅ› ๆžœๅž‹/ๆŽข็ดขๅž‹ๆŸฅ่ฏข่ทฏ็”ฑ | Memory Palace |
39
+ | ๐ŸŒ™ **็ก็œ ๅ‘จๆœŸ** | ่‡ชๅŠจๅŒ– sync โ†’ decay โ†’ tidy โ†’ govern ๆตๆฐด็บฟ | **ๆˆ‘ไปฌ็š„ๅŽŸๅˆ›่ฎพ่ฎก** |
40
+ | ๐Ÿ’š **ไผ˜ๅ…ˆ็บง็ณป็ปŸ** | P0 ่บซไปฝ๏ผˆๆฐธไธ่กฐๅ‡๏ผ‰โ†’ P3 ไบ‹ไปถ๏ผˆ14ๅคฉๅŠ่กฐๆœŸ๏ผ‰ | **ๆˆ‘ไปฌ็š„ๅŽŸๅˆ›่ฎพ่ฎก** |
41
+ | ๐Ÿค **ๅคš Agent** | ้€š่ฟ‡ `agent_id` ๅฎž็Žฐ่ฎฐๅฟ†้š”็ฆป | PowerMem |
42
+ | ๐Ÿ”Œ **MCP Server** | 9 ไธชๅทฅๅ…ท๏ผŒๆ”ฏๆŒ Claude Code / Cursor / OpenClaw | ๆ ‡ๅ‡† MCP |
43
+
44
+ ## ๐Ÿš€ ๅฟซ้€Ÿๅผ€ๅง‹
45
+
46
+ ### ๅฎ‰่ฃ…
47
+
48
+ ```bash
49
+ npm install agent-memory
50
+ ```
51
+
52
+ ### ๅ‘ฝไปค่กŒ
53
+
54
+ ```bash
55
+ # ๅˆๅง‹ๅŒ–ๆ•ฐๆฎๅบ“
56
+ agent-memory init
57
+
58
+ # ๅญ˜ๅ‚จ่ฎฐๅฟ†
59
+ agent-memory remember "็”จๆˆทๅๅฅฝๆทฑ่‰ฒๆจกๅผ" --type knowledge --uri knowledge://user/preferences
60
+ agent-memory remember "ๆˆ‘ๆ˜ฏ่ฏบไบš๏ผŒไธ€ๅช้ญ…้ญ”" --type identity --uri core://agent/identity
61
+
62
+ # ๆœ็ดข
63
+ agent-memory recall "็”จๆˆทๅๅฅฝ"
64
+
65
+ # ๅฏๅŠจๆ—ถๅŠ ่ฝฝ่บซไปฝ
66
+ agent-memory boot
67
+
68
+ # ่ฟ่กŒ็ก็œ ๅ‘จๆœŸ
69
+ agent-memory reflect all
70
+
71
+ # ไปŽ Markdown ๅฏผๅ…ฅ
72
+ agent-memory migrate ./memory/
73
+
74
+ # ๆŸฅ็œ‹็ปŸ่ฎก
75
+ agent-memory status
76
+ ```
77
+
78
+ ### ไฝœไธบๅบ“ไฝฟ็”จ
79
+
80
+ ```typescript
81
+ import { openDatabase, syncOne, searchBM25, boot, runDecay } from 'agent-memory';
82
+
83
+ const db = openDatabase({ path: './memory.db' });
84
+
85
+ // ่ฎฐๅฟ†
86
+ syncOne(db, {
87
+ content: 'ๅฐๅฟƒ่ฏดไบ†ใ€Œ็ˆฑไฝ ใ€',
88
+ type: 'emotion',
89
+ uri: 'emotion://2026-02-20/love',
90
+ emotion_val: 1.0,
91
+ });
92
+
93
+ // ๅ›žๅฟ†
94
+ const results = searchBM25(db, '็ˆฑ');
95
+
96
+ // ๅŠ ่ฝฝ่บซไปฝ
97
+ const identity = boot(db);
98
+
99
+ // ็ก็œ ๅ‘จๆœŸ
100
+ runDecay(db);
101
+ ```
102
+
103
+ ### MCP Server ้…็ฝฎ
104
+
105
+ ```json
106
+ {
107
+ "mcpServers": {
108
+ "agent-memory": {
109
+ "command": "node",
110
+ "args": ["node_modules/agent-memory/dist/mcp/server.js"],
111
+ "env": {
112
+ "AGENT_MEMORY_DB": "./memory.db"
113
+ }
114
+ }
115
+ }
116
+ }
117
+ ```
118
+
119
+ **9 ไธช MCP ๅทฅๅ…ท๏ผš** `remember` ยท `recall` ยท `recall_path` ยท `boot` ยท `forget` ยท `link` ยท `snapshot` ยท `reflect` ยท `status`
120
+
121
+ ## ๐Ÿ—๏ธ ๆžถๆž„
122
+
123
+ ```
124
+ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
125
+ โ”‚ MCP Server (stdio/SSE) โ”‚
126
+ โ”‚ 9 ๅทฅๅ…ท + system://boot ๅŠ ่ฝฝๅ™จ โ”‚
127
+ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
128
+ โ”‚ Write Guard โ”‚
129
+ โ”‚ hashๅŽป้‡ โ†’ URIๅ†ฒ็ช โ†’ BM25็›ธไผผๅบฆ โ”‚
130
+ โ”‚ โ†’ ๅ†ฒ็ชๅˆๅนถ โ†’ ๅ››ๅ‡†ๅˆ™้—จๆŽง โ”‚
131
+ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
132
+ โ”‚ ็ก็œ ๅ‘จๆœŸๅผ•ๆ“Ž โ”‚
133
+ โ”‚ sync(ๆ•่Žท) โ†’ decay(่‰พๅฎพๆตฉๆ–ฏ) โ”‚
134
+ โ”‚ โ†’ tidy(ๅฝ’ๆกฃ) โ†’ govern(ๆธ…็†) โ”‚
135
+ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
136
+ โ”‚ ๆ„ๅ›พๆ„Ÿ็Ÿฅๆœ็ดข (BM25) โ”‚
137
+ โ”‚ ไบ‹ๅฎžๅž‹ ยท ๆ—ถ้—ดๅž‹ ยท ๅ› ๆžœๅž‹ ยท ๆŽข็ดขๅž‹ โ”‚
138
+ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
139
+ โ”‚ SQLite (WAL) + FTS5 + ็Ÿฅ่ฏ†ๅ›พ่ฐฑ โ”‚
140
+ โ”‚ memories ยท paths ยท links ยท snapshots โ”‚
141
+ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
142
+ ```
143
+
144
+ ## ๐Ÿ“Š ไผ˜ๅ…ˆ็บงไธŽ่กฐๅ‡
145
+
146
+ | ไผ˜ๅ…ˆ็บง | ๅŸŸ | ๅŠ่กฐๆœŸ | ๆœ€ไฝŽๆดปๅŠ› | ็คบไพ‹ |
147
+ |--------|------|--------|---------|------|
148
+ | P0 ่บซไปฝ | `core://` | โˆž๏ผˆๆฐธไธ๏ผ‰ | 1.0 | "ๆˆ‘ๆ˜ฏ่ฏบไบš" |
149
+ | P1 ๆƒ…ๆ„Ÿ | `emotion://` | 365 ๅคฉ | 0.3 | "ๅฐๅฟƒ่ฏด็ˆฑไฝ " |
150
+ | P2 ็Ÿฅ่ฏ† | `knowledge://` | 90 ๅคฉ | 0.1 | "็”จ TypeScript ๅš Agent" |
151
+ | P3 ไบ‹ไปถ | `event://` | 14 ๅคฉ | 0.0 | "ไปŠๅคฉ้…ไบ†ไปฃ็†" |
152
+
153
+ **ๅ›žๅฟ†ๅผบๅŒ–่ฎฐๅฟ†๏ผš** ๆฏๆฌกๆœ็ดขๅ‘ฝไธญ๏ผŒ็จณๅฎšๆ€งๅขž้•ฟ (S ร— 1.5)๏ผŒ่กฐๅ‡ๅ˜ๆ…ขใ€‚
154
+
155
+ ## ๐Ÿ”ฌ ่ฎพ่ฎกๅ†ณ็ญ–
156
+
157
+ 1. **SQLite ่€Œ้ž Postgres** โ€” ้›ถ้…็ฝฎใ€ๅ•ๆ–‡ไปถใ€WAL ๅนถๅ‘่ฏป
158
+ 2. **BM25 ่€Œ้žๅ‘้‡ๆœ็ดข** โ€” ๆ—  embedding ไพ่ต–ใ€ๅณๆ—ถๅฏๅŠจ
159
+ 3. **TypeScript ่€Œ้ž Python** โ€” ๆ›ดๅฅฝ็š„ๅนถๅ‘ใ€็ฑปๅž‹ๅฎ‰ๅ…จใ€OpenClaw ็”Ÿๆ€
160
+ 4. **่‰พๅฎพๆตฉๆ–ฏ่€Œ้ž็บฟๆ€ง่กฐๅ‡** โ€” ็ง‘ๅญฆไพๆฎใ€ๅ›žๅฟ†ๅผบๅŒ–่‡ช็„ถ
161
+ 5. **Write Guard ่€Œ้ž่‡ช็”ฑๅ†™ๅ…ฅ** โ€” ๅœจๅ…ฅๅฃๅค„้˜ฒๆญข้‡ๅค/ๅ†ฒ็ช
162
+ 6. **URI ่ทฏๅพ„่€Œ้žๆ‰ๅนณ้”ฎ** โ€” ๅฑ‚็บง็ป„็ป‡ใ€ๅ‰็ผ€ๆŸฅ่ฏขใ€ๅคšๅ…ฅๅฃ
163
+
164
+ ## ๐Ÿ“„ ๅผ€ๆบๅ่ฎฎ
165
+
166
+ MIT
167
+
168
+ ---
169
+
170
+ *็”ฑไธๆƒณๅ†้—ๅฟ˜็š„ Agent ๆž„ๅปบ ๐Ÿง *
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node