memory-lucia 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/LICENSE +21 -0
- package/NPM-PUBLISH-GUIDE.md +169 -0
- package/PUBLISH-STEPS.md +102 -0
- package/README.md +64 -0
- package/SKILL.md +120 -0
- package/api/index.js +255 -0
- package/database/init.js +137 -0
- package/modules/decision.js +267 -0
- package/modules/evolution.js +286 -0
- package/modules/learning.js +267 -0
- package/modules/priority.js +174 -0
- package/modules/version.js +286 -0
- package/package.json +35 -0
- package/publish-with-otp.bat +13 -0
- package/publish.bat +17 -0
- package/publish.sh +20 -0
- package/scripts/init-memory.js +30 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Chief of Staff
|
|
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.
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# Memory V2 Skill - NPM 发布指南
|
|
2
|
+
|
|
3
|
+
> 将 Memory V2 发布为 npm 包,供 ClawHub Skill 使用
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 📋 发现:ClawHub Skill 格式
|
|
8
|
+
|
|
9
|
+
**ClawHub 上的 Skill 只有 SKILL.md**,代码通过 npm 安装。
|
|
10
|
+
|
|
11
|
+
### 标准结构
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
clawhub-skill/
|
|
15
|
+
└── SKILL.md # 只有描述文件
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### npm 包结构
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
memory-v2/ # npm 包
|
|
22
|
+
├── package.json
|
|
23
|
+
├── README.md
|
|
24
|
+
├── LICENSE
|
|
25
|
+
├── api/
|
|
26
|
+
│ └── index.js # 主入口
|
|
27
|
+
├── modules/ # 核心模块
|
|
28
|
+
└── ...
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## 🚀 发布流程
|
|
34
|
+
|
|
35
|
+
### 步骤 1: 准备 npm 包
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
cd memory-v2-skill
|
|
39
|
+
|
|
40
|
+
# 1. 确保 package.json 正确
|
|
41
|
+
# 2. 更新版本号
|
|
42
|
+
npm version 2.0.0
|
|
43
|
+
|
|
44
|
+
# 3. 创建 .npmignore
|
|
45
|
+
echo "tests/" > .npmignore
|
|
46
|
+
echo "backups/" >> .npmignore
|
|
47
|
+
echo "*.db" >> .npmignore
|
|
48
|
+
|
|
49
|
+
# 4. 发布到 npm
|
|
50
|
+
npm publish
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### 步骤 2: 创建 ClawHub Skill
|
|
54
|
+
|
|
55
|
+
创建 `clawhub-memory-v2/` 目录,只包含 SKILL.md:
|
|
56
|
+
|
|
57
|
+
```yaml
|
|
58
|
+
---
|
|
59
|
+
name: memory-v2
|
|
60
|
+
description: |
|
|
61
|
+
Advanced memory system for OpenClaw agents with priority analysis,
|
|
62
|
+
learning tracking, decision recording, and skill evolution.
|
|
63
|
+
Use when: (1) Tracking learning progress and milestones, (2) Recording decisions with outcomes,
|
|
64
|
+
(3) Analyzing message priorities, (4) Monitoring skill usage and growth.
|
|
65
|
+
Requires: npm install memory-v2-skill
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
# Memory V2
|
|
69
|
+
|
|
70
|
+
## Installation
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
npm install memory-v2-skill
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Usage
|
|
77
|
+
|
|
78
|
+
```javascript
|
|
79
|
+
const MemoryAPI = require('memory-v2-skill');
|
|
80
|
+
|
|
81
|
+
const api = new MemoryAPI('./memory-v2.db');
|
|
82
|
+
await api.init();
|
|
83
|
+
|
|
84
|
+
// Track learning
|
|
85
|
+
await api.startLearning(msgId, convId, message);
|
|
86
|
+
|
|
87
|
+
// Record decision
|
|
88
|
+
await api.recordDecision(msgId, convId, decisionData);
|
|
89
|
+
|
|
90
|
+
// Get dashboard
|
|
91
|
+
const dashboard = await api.getDashboard();
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## API
|
|
95
|
+
|
|
96
|
+
See: https://github.com/YOUR_USERNAME/memory-v2-skill#api
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### 步骤 3: 打包并提交
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
# 打包 ClawHub Skill
|
|
103
|
+
cd clawhub-memory-v2
|
|
104
|
+
zip ../memory-v2.skill SKILL.md
|
|
105
|
+
|
|
106
|
+
# 提交到 ClawHub
|
|
107
|
+
# 上传 memory-v2.skill 文件
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## 📦 两种发布方式对比
|
|
113
|
+
|
|
114
|
+
| 方式 | 适用场景 | 复杂度 |
|
|
115
|
+
|------|---------|--------|
|
|
116
|
+
| **npm + ClawHub** | 正式发布,用户易安装 | 高 |
|
|
117
|
+
| **GitHub 直接安装** | 快速分享,开发者使用 | 低 |
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## 🎯 推荐方案:GitHub 直接安装
|
|
122
|
+
|
|
123
|
+
对于 Memory V2,推荐直接 GitHub 安装:
|
|
124
|
+
|
|
125
|
+
### 用户使用
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
# 克隆到 skills 目录
|
|
129
|
+
cd ~/.openclaw/skills
|
|
130
|
+
git clone https://github.com/YOUR_USERNAME/memory-v2-skill.git memory-v2
|
|
131
|
+
|
|
132
|
+
# 安装依赖
|
|
133
|
+
cd memory-v2
|
|
134
|
+
npm install
|
|
135
|
+
|
|
136
|
+
# 使用
|
|
137
|
+
const MemoryAPI = require('memory-v2');
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### 优点
|
|
141
|
+
- 无需 npm 账号
|
|
142
|
+
- 无需打包
|
|
143
|
+
- 用户可直接修改
|
|
144
|
+
- 适合自用和分享
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## ✅ 当前状态
|
|
149
|
+
|
|
150
|
+
您的 `memory-v2-skill/` 已经可以直接使用:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
# 本地测试
|
|
154
|
+
cd memory-v2-skill
|
|
155
|
+
npm install
|
|
156
|
+
node -e "const M = require('./api'); console.log('OK')"
|
|
157
|
+
|
|
158
|
+
# 打包 (zip 格式)
|
|
159
|
+
zip -r memory-v2.skill . -x "*.db" "node_modules/*"
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
**用户安装后可以直接使用!**
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## 📚 参考
|
|
167
|
+
|
|
168
|
+
- npm 发布: https://docs.npmjs.com/packages-and-modules/contributing-packages-to-the-registry
|
|
169
|
+
- ClawHub: https://clawhub.com
|
package/PUBLISH-STEPS.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Memory Lucia 发布步骤
|
|
2
|
+
|
|
3
|
+
## 🚀 一键发布
|
|
4
|
+
|
|
5
|
+
在 `memory-v2-skill` 目录下执行:
|
|
6
|
+
|
|
7
|
+
### Windows
|
|
8
|
+
```bash
|
|
9
|
+
publish.bat
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
### Linux/Mac
|
|
13
|
+
```bash
|
|
14
|
+
bash publish.sh
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 📋 手动发布步骤
|
|
20
|
+
|
|
21
|
+
### 步骤 1: 进入目录
|
|
22
|
+
```bash
|
|
23
|
+
cd C:\Users\snowya\.openclaw\workspace-chief_of_staff\memory-v2-skill
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### 步骤 2: 登录 npm
|
|
27
|
+
```bash
|
|
28
|
+
npm login --auth-type=legacy
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**输入信息:**
|
|
32
|
+
- Username: `712724810@qq.com`
|
|
33
|
+
- Password: `Q6Ymk#x_4dqM#T@`
|
|
34
|
+
- Email: `712724810@qq.com`
|
|
35
|
+
- Enter one-time password: (如果开启 2FA,输入验证码)
|
|
36
|
+
|
|
37
|
+
### 步骤 3: 发布
|
|
38
|
+
```bash
|
|
39
|
+
npm publish --access=public
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## ✅ 验证发布
|
|
45
|
+
|
|
46
|
+
发布成功后,访问:
|
|
47
|
+
https://www.npmjs.com/package/memory-lucia
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 📦 用户使用
|
|
52
|
+
|
|
53
|
+
发布后,用户可以直接安装:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
npm install memory-lucia
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
```javascript
|
|
60
|
+
const MemoryAPI = require('memory-lucia');
|
|
61
|
+
const api = new MemoryAPI('./memory.db');
|
|
62
|
+
await api.init();
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## 🔧 如果发布失败
|
|
68
|
+
|
|
69
|
+
### 错误 1: 包名已存在
|
|
70
|
+
```bash
|
|
71
|
+
# 修改 package.json 中的 name
|
|
72
|
+
# 或者使用 scoped name: @yourname/memory-lucia
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### 错误 2: 未登录
|
|
76
|
+
```bash
|
|
77
|
+
npm login --auth-type=legacy
|
|
78
|
+
# 重新登录
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### 错误 3: 版本已存在
|
|
82
|
+
```bash
|
|
83
|
+
# 更新版本号
|
|
84
|
+
npm version patch # 2.0.0 -> 2.0.1
|
|
85
|
+
npm publish
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## 📊 发布信息
|
|
91
|
+
|
|
92
|
+
| 属性 | 值 |
|
|
93
|
+
|------|-----|
|
|
94
|
+
| 包名 | `memory-lucia` |
|
|
95
|
+
| 版本 | `2.0.0` |
|
|
96
|
+
| 大小 | 14.4 KB |
|
|
97
|
+
| 主入口 | `api/index.js` |
|
|
98
|
+
| 依赖 | `sqlite3` |
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
**执行 `publish.bat` 或 `publish.sh` 即可发布!**
|
package/README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Memory Lucia
|
|
2
|
+
|
|
3
|
+
[](https://github.com/YOUR_USERNAME/memory-lucia/releases)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
|
|
6
|
+
Advanced memory system for OpenClaw agents with priority analysis, learning tracking, decision recording, and skill evolution.
|
|
7
|
+
|
|
8
|
+
## Features
|
|
9
|
+
|
|
10
|
+
- 🎯 **Priority Analysis** - Analyze and store message priorities
|
|
11
|
+
- 📚 **Learning Tracking** - Track learning progress and milestones
|
|
12
|
+
- 🎯 **Decision Recording** - Record decisions with outcomes and reviews
|
|
13
|
+
- 📈 **Skill Evolution** - Monitor skill usage and growth
|
|
14
|
+
- 💾 **Version Management** - Automatic backups with rollback
|
|
15
|
+
- 📊 **Dashboard** - Unified view of all memory data
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# Install
|
|
21
|
+
npm install memory-lucia
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
```javascript
|
|
25
|
+
const MemoryAPI = require('memory-lucia');
|
|
26
|
+
|
|
27
|
+
const api = new MemoryAPI('./memory-v2.db');
|
|
28
|
+
await api.init();
|
|
29
|
+
|
|
30
|
+
// Track learning
|
|
31
|
+
await api.startLearning(msgId, convId, message);
|
|
32
|
+
|
|
33
|
+
// Get dashboard
|
|
34
|
+
const dashboard = await api.getDashboard();
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Core Modules
|
|
38
|
+
|
|
39
|
+
- **Priority** - Message priority analysis
|
|
40
|
+
- **Learning** - Learning progress tracking
|
|
41
|
+
- **Decision** - Decision recording and review
|
|
42
|
+
- **Evolution** - Skill usage monitoring
|
|
43
|
+
- **Version** - Backup and rollback
|
|
44
|
+
|
|
45
|
+
## Documentation
|
|
46
|
+
|
|
47
|
+
- [SKILL.md](SKILL.md) - Skill description and usage
|
|
48
|
+
- [API Reference](references/API.md) - Complete API documentation
|
|
49
|
+
|
|
50
|
+
## Database
|
|
51
|
+
|
|
52
|
+
SQLite backend with tables:
|
|
53
|
+
- `memory_priorities`
|
|
54
|
+
- `memory_learning`
|
|
55
|
+
- `memory_decisions`
|
|
56
|
+
- `memory_evolution`
|
|
57
|
+
|
|
58
|
+
## Version
|
|
59
|
+
|
|
60
|
+
Current: 2.0.0
|
|
61
|
+
|
|
62
|
+
## License
|
|
63
|
+
|
|
64
|
+
MIT
|
package/SKILL.md
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: memory-v2
|
|
3
|
+
description: |
|
|
4
|
+
Advanced memory system for OpenClaw agents with priority analysis,
|
|
5
|
+
learning tracking, decision recording, and skill evolution.
|
|
6
|
+
Use when: (1) Tracking learning progress and milestones, (2) Recording decisions with outcomes,
|
|
7
|
+
(3) Analyzing message priorities, (4) Monitoring skill usage and growth.
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Memory V2 Skill
|
|
11
|
+
|
|
12
|
+
## Overview
|
|
13
|
+
|
|
14
|
+
Memory V2 is a comprehensive memory management system for OpenClaw agents, providing persistent storage and intelligent analysis capabilities.
|
|
15
|
+
|
|
16
|
+
## Features
|
|
17
|
+
|
|
18
|
+
- **Priority Analysis**: Analyze and store message priorities with reasoning
|
|
19
|
+
- **Learning Tracking**: Track learning progress, milestones, and completion
|
|
20
|
+
- **Decision Recording**: Record decisions with context, outcomes, and scheduled reviews
|
|
21
|
+
- **Skill Evolution**: Monitor skill usage patterns and growth over time
|
|
22
|
+
- **Version Management**: Backup and rollback capabilities
|
|
23
|
+
- **Dashboard**: Unified view of all memory data
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# Install dependencies
|
|
29
|
+
npm install sqlite3
|
|
30
|
+
|
|
31
|
+
# Initialize database
|
|
32
|
+
node scripts/init-memory.js
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Quick Start
|
|
36
|
+
|
|
37
|
+
```javascript
|
|
38
|
+
const MemoryAPI = require('./api');
|
|
39
|
+
|
|
40
|
+
const api = new MemoryAPI('./memory-v2.db');
|
|
41
|
+
await api.init();
|
|
42
|
+
|
|
43
|
+
// Track learning progress
|
|
44
|
+
await api.startLearning(msgId, convId, message);
|
|
45
|
+
await api.updateLearningProgress(learningId, { progress: 50 });
|
|
46
|
+
|
|
47
|
+
// Record a decision
|
|
48
|
+
await api.recordDecision(msgId, convId, {
|
|
49
|
+
summary: 'Choose SQLite over PostgreSQL',
|
|
50
|
+
context: 'For local deployment',
|
|
51
|
+
expectedOutcome: 'Simpler setup'
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// Get dashboard
|
|
55
|
+
const dashboard = await api.getDashboard();
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Core Modules
|
|
59
|
+
|
|
60
|
+
### 1. Priority Module
|
|
61
|
+
Analyze and store message priorities.
|
|
62
|
+
|
|
63
|
+
```javascript
|
|
64
|
+
const analysis = await api.analyzePriority(message);
|
|
65
|
+
await api.storePriority(msgId, convId, analysis);
|
|
66
|
+
const highPriority = await api.getHighPriority(10);
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### 2. Learning Module
|
|
70
|
+
Track learning topics and progress.
|
|
71
|
+
|
|
72
|
+
```javascript
|
|
73
|
+
const learning = await api.startLearning(msgId, convId, message);
|
|
74
|
+
await api.addMilestone(learning.id, { title: 'Completed Chapter 1' });
|
|
75
|
+
const active = await api.getActiveLearning(5);
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 3. Decision Module
|
|
79
|
+
Record and review decisions.
|
|
80
|
+
|
|
81
|
+
```javascript
|
|
82
|
+
await api.recordDecision(msgId, convId, decisionData);
|
|
83
|
+
await api.updateDecisionOutcome(decisionId, { actualOutcome: 'Success' });
|
|
84
|
+
const pending = await api.getPendingDecisions();
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 4. Evolution Module
|
|
88
|
+
Monitor skill usage.
|
|
89
|
+
|
|
90
|
+
```javascript
|
|
91
|
+
await api.recordSkillUsage('skill-name', 'category', 'success');
|
|
92
|
+
const topSkills = await api.getTopSkills(10);
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## API Reference
|
|
96
|
+
|
|
97
|
+
See `references/API.md` for complete API documentation.
|
|
98
|
+
|
|
99
|
+
## Database Schema
|
|
100
|
+
|
|
101
|
+
SQLite database with tables:
|
|
102
|
+
- `memory_priorities` - Priority analysis
|
|
103
|
+
- `memory_learning` - Learning tracking
|
|
104
|
+
- `memory_decisions` - Decision records
|
|
105
|
+
- `memory_evolution` - Skill usage
|
|
106
|
+
|
|
107
|
+
## Migration
|
|
108
|
+
|
|
109
|
+
From V1 to V2:
|
|
110
|
+
```bash
|
|
111
|
+
node migrations/v1-to-v2.js old-memory.db
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Version
|
|
115
|
+
|
|
116
|
+
Current: 2.0.0
|
|
117
|
+
|
|
118
|
+
## License
|
|
119
|
+
|
|
120
|
+
MIT
|