memory-lucia 2.0.1 → 2.0.3

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/README.md CHANGED
@@ -1,111 +1,111 @@
1
- # Memory Lucia
2
-
3
- [![npm version](https://img.shields.io/npm/v/memory-lucia.svg)](https://www.npmjs.com/package/memory-lucia)
4
- [![GitHub](https://img.shields.io/badge/github-memory--lucia-blue.svg)](https://github.com/wen521/memory-lucia-)
5
- [![License](https://img.shields.io/npm/l/memory-lucia.svg)](LICENSE)
6
-
7
- Advanced memory system for OpenClaw agents with priority analysis, learning tracking, decision recording, and skill evolution.
8
-
9
- ## 📦 Installation
10
-
11
- ```bash
12
- npm install memory-lucia
13
- ```
14
-
15
- ## 🚀 Quick Start
16
-
17
- ```javascript
18
- const MemoryAPI = require('memory-lucia');
19
-
20
- const api = new MemoryAPI('./memory.db');
21
- await api.init();
22
-
23
- // Track learning progress
24
- await api.startLearning(msgId, convId, message);
25
- await api.updateLearningProgress(learningId, { progress: 50 });
26
-
27
- // Record a decision
28
- await api.recordDecision(msgId, convId, {
29
- summary: 'Choose SQLite over PostgreSQL',
30
- context: 'For local deployment',
31
- expectedOutcome: 'Simpler setup'
32
- });
33
-
34
- // Get dashboard
35
- const dashboard = await api.getDashboard();
36
- console.log(dashboard);
37
- ```
38
-
39
- ## ✨ Features
40
-
41
- - 🎯 **Priority Analysis** - Analyze and store message priorities
42
- - 📚 **Learning Tracking** - Track learning progress and milestones
43
- - 🎯 **Decision Recording** - Record decisions with outcomes and reviews
44
- - 📈 **Skill Evolution** - Monitor skill usage and growth
45
- - 💾 **Version Management** - Automatic backups with rollback
46
- - 📊 **Dashboard** - Unified view of all memory data
47
-
48
- ## 📖 Core Modules
49
-
50
- ### 1. Priority Module
51
- Analyze and store message priorities.
52
-
53
- ```javascript
54
- const analysis = await api.analyzePriority(message);
55
- await api.storePriority(msgId, convId, analysis);
56
- const highPriority = await api.getHighPriority(10);
57
- ```
58
-
59
- ### 2. Learning Module
60
- Track learning topics and progress.
61
-
62
- ```javascript
63
- const learning = await api.startLearning(msgId, convId, message);
64
- await api.addMilestone(learning.id, { title: 'Completed Chapter 1' });
65
- const active = await api.getActiveLearning(5);
66
- ```
67
-
68
- ### 3. Decision Module
69
- Record and review decisions.
70
-
71
- ```javascript
72
- await api.recordDecision(msgId, convId, decisionData);
73
- await api.updateDecisionOutcome(decisionId, { actualOutcome: 'Success' });
74
- const pending = await api.getPendingDecisions();
75
- ```
76
-
77
- ### 4. Evolution Module
78
- Monitor skill usage.
79
-
80
- ```javascript
81
- await api.recordSkillUsage('skill-name', 'category', 'success');
82
- const topSkills = await api.getTopSkills(10);
83
- ```
84
-
85
- ## 📚 Documentation
86
-
87
- - [SKILL.md](SKILL.md) - Skill description and usage
88
- - [API Reference](references/API.md) - Complete API documentation
89
- - [Architecture](references/ARCHITECTURE.md) - System design
90
-
91
- ## 🗄️ Database
92
-
93
- SQLite backend with tables:
94
- - `memory_priorities` - Priority analysis
95
- - `memory_learning` - Learning tracking
96
- - `memory_decisions` - Decision records
97
- - `memory_evolution` - Skill usage
98
-
99
- ## 🔗 Links
100
-
101
- - **npm**: https://www.npmjs.com/package/memory-lucia
102
- - **GitHub**: https://github.com/wen521/memory-lucia-
103
- - **Issues**: https://github.com/wen521/memory-lucia-/issues
104
-
105
- ## 📋 Version
106
-
107
- Current: 2.0.0
108
-
109
- ## 📄 License
110
-
111
- MIT © Chief of Staff
1
+ # Memory Lucia
2
+
3
+ [![npm version](https://img.shields.io/npm/v/memory-lucia.svg)](https://www.npmjs.com/package/memory-lucia)
4
+ [![GitHub](https://img.shields.io/badge/github-memory--lucia-blue.svg)](https://github.com/wen521/memory-lucia-)
5
+ [![License](https://img.shields.io/npm/l/memory-lucia.svg)](LICENSE)
6
+
7
+ Advanced memory system for OpenClaw agents with priority analysis, learning tracking, decision recording, and skill evolution.
8
+
9
+ ## 📦 Installation
10
+
11
+ ```bash
12
+ npm install memory-lucia
13
+ ```
14
+
15
+ ## 🚀 Quick Start
16
+
17
+ ```javascript
18
+ const MemoryAPI = require('memory-lucia');
19
+
20
+ const api = new MemoryAPI('./memory.db');
21
+ await api.init();
22
+
23
+ // Track learning progress
24
+ await api.startLearning(msgId, convId, message);
25
+ await api.updateLearningProgress(learningId, { progress: 50 });
26
+
27
+ // Record a decision
28
+ await api.recordDecision(msgId, convId, {
29
+ summary: 'Choose SQLite over PostgreSQL',
30
+ context: 'For local deployment',
31
+ expectedOutcome: 'Simpler setup'
32
+ });
33
+
34
+ // Get dashboard
35
+ const dashboard = await api.getDashboard();
36
+ console.log(dashboard);
37
+ ```
38
+
39
+ ## ✨ Features
40
+
41
+ - 🎯 **Priority Analysis** - Analyze and store message priorities
42
+ - 📚 **Learning Tracking** - Track learning progress and milestones
43
+ - 🎯 **Decision Recording** - Record decisions with outcomes and reviews
44
+ - 📈 **Skill Evolution** - Monitor skill usage and growth
45
+ - 💾 **Version Management** - Automatic backups with rollback
46
+ - 📊 **Dashboard** - Unified view of all memory data
47
+
48
+ ## 📖 Core Modules
49
+
50
+ ### 1. Priority Module
51
+ Analyze and store message priorities.
52
+
53
+ ```javascript
54
+ const analysis = await api.analyzePriority(message);
55
+ await api.storePriority(msgId, convId, analysis);
56
+ const highPriority = await api.getHighPriority(10);
57
+ ```
58
+
59
+ ### 2. Learning Module
60
+ Track learning topics and progress.
61
+
62
+ ```javascript
63
+ const learning = await api.startLearning(msgId, convId, message);
64
+ await api.addMilestone(learning.id, { title: 'Completed Chapter 1' });
65
+ const active = await api.getActiveLearning(5);
66
+ ```
67
+
68
+ ### 3. Decision Module
69
+ Record and review decisions.
70
+
71
+ ```javascript
72
+ await api.recordDecision(msgId, convId, decisionData);
73
+ await api.updateDecisionOutcome(decisionId, { actualOutcome: 'Success' });
74
+ const pending = await api.getPendingDecisions();
75
+ ```
76
+
77
+ ### 4. Evolution Module
78
+ Monitor skill usage.
79
+
80
+ ```javascript
81
+ await api.recordSkillUsage('skill-name', 'category', 'success');
82
+ const topSkills = await api.getTopSkills(10);
83
+ ```
84
+
85
+ ## 📚 Documentation
86
+
87
+ - [SKILL.md](SKILL.md) - Skill description and usage
88
+ - [API Reference](references/API.md) - Complete API documentation
89
+ - [Architecture](references/ARCHITECTURE.md) - System design
90
+
91
+ ## 🗄️ Database
92
+
93
+ SQLite backend with tables:
94
+ - `memory_priorities` - Priority analysis
95
+ - `memory_learning` - Learning tracking
96
+ - `memory_decisions` - Decision records
97
+ - `memory_evolution` - Skill usage
98
+
99
+ ## 🔗 Links
100
+
101
+ - **npm**: https://www.npmjs.com/package/memory-lucia
102
+ - **GitHub**: https://github.com/wen521/memory-lucia-
103
+ - **Issues**: https://github.com/wen521/memory-lucia-/issues
104
+
105
+ ## 📋 Version
106
+
107
+ Current: 2.0.3
108
+
109
+ ## 📄 License
110
+
111
+ MIT © Chief of Staff
package/SKILL.md CHANGED
@@ -1,120 +1,121 @@
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
1
+ ---
2
+ name: memory-v2
3
+ version: 2.0.3
4
+ description: |
5
+ Advanced memory system for OpenClaw agents with priority analysis,
6
+ learning tracking, decision recording, and skill evolution.
7
+ Use when: (1) Tracking learning progress and milestones, (2) Recording decisions with outcomes,
8
+ (3) Analyzing message priorities, (4) Monitoring skill usage and growth.
9
+ ---
10
+
11
+ # Memory V2 Skill
12
+
13
+ ## Overview
14
+
15
+ Memory V2 is a comprehensive memory management system for OpenClaw agents, providing persistent storage and intelligent analysis capabilities.
16
+
17
+ ## Features
18
+
19
+ - **Priority Analysis**: Analyze and store message priorities with reasoning
20
+ - **Learning Tracking**: Track learning progress, milestones, and completion
21
+ - **Decision Recording**: Record decisions with context, outcomes, and scheduled reviews
22
+ - **Skill Evolution**: Monitor skill usage patterns and growth over time
23
+ - **Version Management**: Backup and rollback capabilities
24
+ - **Dashboard**: Unified view of all memory data
25
+
26
+ ## Installation
27
+
28
+ ```bash
29
+ # Install dependencies
30
+ npm install sqlite3
31
+
32
+ # Initialize database
33
+ node scripts/init-memory.js
34
+ ```
35
+
36
+ ## Quick Start
37
+
38
+ ```javascript
39
+ const MemoryAPI = require('./api');
40
+
41
+ const api = new MemoryAPI('./memory-v2.db');
42
+ await api.init();
43
+
44
+ // Track learning progress
45
+ await api.startLearning(msgId, convId, message);
46
+ await api.updateLearningProgress(learningId, { progress: 50 });
47
+
48
+ // Record a decision
49
+ await api.recordDecision(msgId, convId, {
50
+ summary: 'Choose SQLite over PostgreSQL',
51
+ context: 'For local deployment',
52
+ expectedOutcome: 'Simpler setup'
53
+ });
54
+
55
+ // Get dashboard
56
+ const dashboard = await api.getDashboard();
57
+ ```
58
+
59
+ ## Core Modules
60
+
61
+ ### 1. Priority Module
62
+ Analyze and store message priorities.
63
+
64
+ ```javascript
65
+ const analysis = await api.analyzePriority(message);
66
+ await api.storePriority(msgId, convId, analysis);
67
+ const highPriority = await api.getHighPriority(10);
68
+ ```
69
+
70
+ ### 2. Learning Module
71
+ Track learning topics and progress.
72
+
73
+ ```javascript
74
+ const learning = await api.startLearning(msgId, convId, message);
75
+ await api.addMilestone(learning.id, { title: 'Completed Chapter 1' });
76
+ const active = await api.getActiveLearning(5);
77
+ ```
78
+
79
+ ### 3. Decision Module
80
+ Record and review decisions.
81
+
82
+ ```javascript
83
+ await api.recordDecision(msgId, convId, decisionData);
84
+ await api.updateDecisionOutcome(decisionId, { actualOutcome: 'Success' });
85
+ const pending = await api.getPendingDecisions();
86
+ ```
87
+
88
+ ### 4. Evolution Module
89
+ Monitor skill usage.
90
+
91
+ ```javascript
92
+ await api.recordSkillUsage('skill-name', 'category', 'success');
93
+ const topSkills = await api.getTopSkills(10);
94
+ ```
95
+
96
+ ## API Reference
97
+
98
+ See `references/API.md` for complete API documentation.
99
+
100
+ ## Database Schema
101
+
102
+ SQLite database with tables:
103
+ - `memory_priorities` - Priority analysis
104
+ - `memory_learning` - Learning tracking
105
+ - `memory_decisions` - Decision records
106
+ - `memory_evolution` - Skill usage
107
+
108
+ ## Migration
109
+
110
+ From V1 to V2:
111
+ ```bash
112
+ node migrations/v1-to-v2.js old-memory.db
113
+ ```
114
+
115
+ ## Version
116
+
117
+ Current: 2.0.2
118
+
119
+ ## License
120
+
121
+ MIT
@@ -0,0 +1,152 @@
1
+ -- Memory V2.0 Database Schema
2
+ -- SQLite database schema for OpenClaw Memory System
3
+
4
+ -- Priority Analysis Table
5
+ CREATE TABLE IF NOT EXISTS memory_priorities (
6
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
7
+ msg_id TEXT NOT NULL,
8
+ conv_id TEXT,
9
+ priority_level TEXT CHECK(priority_level IN ('critical', 'high', 'medium', 'low')),
10
+ reasoning TEXT,
11
+ category TEXT,
12
+ created_at DATETIME DEFAULT CURRENT_TIMESTAMP
13
+ );
14
+
15
+ -- Learning Tracking Table
16
+ CREATE TABLE IF NOT EXISTS memory_learning (
17
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
18
+ msg_id TEXT NOT NULL,
19
+ conv_id TEXT,
20
+ topic TEXT,
21
+ description TEXT,
22
+ status TEXT CHECK(status IN ('active', 'paused', 'completed', 'abandoned')) DEFAULT 'active',
23
+ progress INTEGER DEFAULT 0 CHECK(progress >= 0 AND progress <= 100),
24
+ started_at DATETIME DEFAULT CURRENT_TIMESTAMP,
25
+ updated_at DATETIME DEFAULT CURRENT_TIMESTAMP,
26
+ completed_at DATETIME
27
+ );
28
+
29
+ -- Learning Milestones Table
30
+ CREATE TABLE IF NOT EXISTS memory_learning_milestones (
31
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
32
+ learning_id INTEGER NOT NULL,
33
+ title TEXT NOT NULL,
34
+ description TEXT,
35
+ achieved_at DATETIME DEFAULT CURRENT_TIMESTAMP,
36
+ FOREIGN KEY (learning_id) REFERENCES memory_learning(id) ON DELETE CASCADE
37
+ );
38
+
39
+ -- Decision Records Table
40
+ CREATE TABLE IF NOT EXISTS memory_decisions (
41
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
42
+ msg_id TEXT NOT NULL,
43
+ conv_id TEXT,
44
+ summary TEXT NOT NULL,
45
+ context TEXT,
46
+ expected_outcome TEXT,
47
+ actual_outcome TEXT,
48
+ status TEXT CHECK(status IN ('pending', 'implemented', 'validated', 'rejected')) DEFAULT 'pending',
49
+ review_scheduled_at DATETIME,
50
+ reviewed_at DATETIME,
51
+ created_at DATETIME DEFAULT CURRENT_TIMESTAMP
52
+ );
53
+
54
+ -- Skill Evolution Table
55
+ CREATE TABLE IF NOT EXISTS memory_evolution (
56
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
57
+ skill_name TEXT NOT NULL,
58
+ category TEXT,
59
+ usage_count INTEGER DEFAULT 0,
60
+ success_count INTEGER DEFAULT 0,
61
+ last_used_at DATETIME,
62
+ first_used_at DATETIME DEFAULT CURRENT_TIMESTAMP
63
+ );
64
+
65
+ -- Database Version Tracking
66
+ CREATE TABLE IF NOT EXISTS memory_schema_version (
67
+ version TEXT PRIMARY KEY,
68
+ applied_at DATETIME DEFAULT CURRENT_TIMESTAMP
69
+ );
70
+
71
+ -- Insert initial version
72
+ INSERT OR IGNORE INTO memory_schema_version (version) VALUES ('2.0.0');
73
+
74
+ -- Create indexes for performance
75
+ CREATE INDEX IF NOT EXISTS idx_priorities_level ON memory_priorities(priority_level);
76
+ CREATE INDEX IF NOT EXISTS idx_priorities_created ON memory_priorities(created_at);
77
+ CREATE INDEX IF NOT EXISTS idx_learning_status ON memory_learning(status);
78
+ CREATE INDEX IF NOT EXISTS idx_learning_topic ON memory_learning(topic);
79
+ CREATE INDEX IF NOT EXISTS idx_decisions_status ON memory_decisions(status);
80
+ CREATE INDEX IF NOT EXISTS idx_decisions_review ON memory_decisions(review_scheduled_at);
81
+ CREATE INDEX IF NOT EXISTS idx_evolution_skill ON memory_evolution(skill_name);
82
+ CREATE INDEX IF NOT EXISTS idx_evolution_category ON memory_evolution(category);
83
+
84
+ -- Views for common queries
85
+
86
+ -- View: Pending Decisions
87
+ CREATE VIEW IF NOT EXISTS v_pending_decisions AS
88
+ SELECT
89
+ d.*,
90
+ CASE
91
+ WHEN review_scheduled_at < CURRENT_TIMESTAMP THEN 'overdue'
92
+ WHEN review_scheduled_at <= datetime('now', '+7 days') THEN 'due_soon'
93
+ ELSE 'scheduled'
94
+ END as review_status
95
+ FROM memory_decisions d
96
+ WHERE status IN ('pending', 'implemented')
97
+ AND (review_scheduled_at IS NULL OR review_scheduled_at <= datetime('now', '+7 days'))
98
+ ORDER BY review_scheduled_at ASC;
99
+
100
+ -- View: Skill Summary
101
+ CREATE VIEW IF NOT EXISTS v_skill_summary AS
102
+ SELECT
103
+ skill_name,
104
+ category,
105
+ usage_count,
106
+ success_count,
107
+ CASE
108
+ WHEN usage_count > 0 THEN ROUND(100.0 * success_count / usage_count, 2)
109
+ ELSE 0
110
+ END as success_rate,
111
+ last_used_at,
112
+ first_used_at
113
+ FROM memory_evolution
114
+ ORDER BY usage_count DESC;
115
+
116
+ -- View: Weekly Learning Report
117
+ CREATE VIEW IF NOT EXISTS v_weekly_learning_report AS
118
+ SELECT
119
+ topic,
120
+ COUNT(*) as session_count,
121
+ AVG(progress) as avg_progress,
122
+ MAX(updated_at) as last_activity,
123
+ SUM(CASE WHEN status = 'completed' THEN 1 ELSE 0 END) as completed_count
124
+ FROM memory_learning
125
+ WHERE updated_at >= datetime('now', '-7 days')
126
+ GROUP BY topic
127
+ ORDER BY last_activity DESC;
128
+
129
+ -- View: High Priority Items
130
+ CREATE VIEW IF NOT EXISTS v_high_priority AS
131
+ SELECT
132
+ 'priority' as type,
133
+ id,
134
+ msg_id,
135
+ priority_level as level,
136
+ category,
137
+ reasoning as details,
138
+ created_at
139
+ FROM memory_priorities
140
+ WHERE priority_level IN ('critical', 'high')
141
+ UNION ALL
142
+ SELECT
143
+ 'decision' as type,
144
+ id,
145
+ msg_id,
146
+ status as level,
147
+ 'decision' as category,
148
+ summary as details,
149
+ created_at
150
+ FROM memory_decisions
151
+ WHERE status = 'pending' AND review_scheduled_at <= CURRENT_TIMESTAMP
152
+ ORDER BY created_at DESC;