@trlc/super-memory 1.0.1 β 1.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/1 +32 -0
- package/dist/commands/curate.js +220 -0
- package/dist/commands/indexUpdate.js +11 -1
- package/dist/index.js +11 -1
- package/package.json +1 -1
package/1
CHANGED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
npm warn publish npm auto-corrected some errors in your package.json when publishing. Please run "npm pkg fix" to address these errors.
|
|
2
|
+
npm warn publish errors corrected:
|
|
3
|
+
npm warn publish "repository.url" was normalized to "git+https://github.com/theredlobstercartel/super-memory-saas.git"
|
|
4
|
+
npm notice
|
|
5
|
+
npm notice π¦ @trlc/super-memory@1.0.1
|
|
6
|
+
npm notice Tarball Contents
|
|
7
|
+
npm notice 0B 1
|
|
8
|
+
npm notice 1.1kB LICENSE
|
|
9
|
+
npm notice 1.7kB README.md
|
|
10
|
+
npm notice 27.2kB dashboard/index.html
|
|
11
|
+
npm notice 41.3kB dashboard/package-lock.json
|
|
12
|
+
npm notice 305B dashboard/package.json
|
|
13
|
+
npm notice 9.3kB dashboard/server.js
|
|
14
|
+
npm notice 2.4kB dist/commands/categorize.js
|
|
15
|
+
npm notice 5.3kB dist/commands/dashboard.js
|
|
16
|
+
npm notice 2.5kB dist/commands/flush.js
|
|
17
|
+
npm notice 1.8kB dist/commands/indexUpdate.js
|
|
18
|
+
npm notice 2.9kB dist/commands/maintenance.js
|
|
19
|
+
npm notice 16.7kB dist/index.js
|
|
20
|
+
npm notice 1.2kB dist/utils/config.js
|
|
21
|
+
npm notice 1.0kB package.json
|
|
22
|
+
npm notice Tarball Details
|
|
23
|
+
npm notice name: @trlc/super-memory
|
|
24
|
+
npm notice version: 1.0.1
|
|
25
|
+
npm notice filename: trlc-super-memory-1.0.1.tgz
|
|
26
|
+
npm notice package size: 27.0 kB
|
|
27
|
+
npm notice unpacked size: 114.7 kB
|
|
28
|
+
npm notice shasum: f4fcdea5d8239ddefe2ec5dca49e0655031f574f
|
|
29
|
+
npm notice integrity: sha512-Ix/ajLJXk5bgz[...]0Qt4tw7JrAU/g==
|
|
30
|
+
npm notice total files: 15
|
|
31
|
+
npm notice
|
|
32
|
+
npm notice Publishing to https://registry.npmjs.org/ with tag latest and public access
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-Curate Command - Super Memory CLI
|
|
3
|
+
* The Red Lobster Cartel π¦
|
|
4
|
+
*
|
|
5
|
+
* Automatically curates recent memories into MEMORY.md
|
|
6
|
+
*/
|
|
7
|
+
import { existsSync, readFileSync, writeFileSync, appendFileSync } from 'fs';
|
|
8
|
+
import { homedir } from 'os';
|
|
9
|
+
import { join } from 'path';
|
|
10
|
+
const CONVEX_URL = 'https://clear-lemming-473.convex.cloud';
|
|
11
|
+
// Paths
|
|
12
|
+
const getBaseDir = () => join(homedir(), '.openclaw', 'workspace');
|
|
13
|
+
const getMemoryDir = () => join(getBaseDir(), 'memory');
|
|
14
|
+
const getConfigDir = () => join(getBaseDir(), '.super-memory');
|
|
15
|
+
const getConfigPath = () => join(getConfigDir(), 'config.json');
|
|
16
|
+
const getMemoryPath = () => join(getBaseDir(), 'MEMORY.md');
|
|
17
|
+
// Load config
|
|
18
|
+
function loadConfig() {
|
|
19
|
+
const configPath = getConfigPath();
|
|
20
|
+
if (!existsSync(configPath)) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
try {
|
|
24
|
+
return JSON.parse(readFileSync(configPath, 'utf-8'));
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
// Save config
|
|
31
|
+
function saveConfig(config) {
|
|
32
|
+
writeFileSync(getConfigPath(), JSON.stringify(config, null, 2));
|
|
33
|
+
}
|
|
34
|
+
// Convex API call
|
|
35
|
+
async function convexCall(functionName, args) {
|
|
36
|
+
const response = await fetch(`${CONVEX_URL}/api/mutation`, {
|
|
37
|
+
method: 'POST',
|
|
38
|
+
headers: { 'Content-Type': 'application/json' },
|
|
39
|
+
body: JSON.stringify({
|
|
40
|
+
path: functionName,
|
|
41
|
+
args: args,
|
|
42
|
+
}),
|
|
43
|
+
});
|
|
44
|
+
if (!response.ok) {
|
|
45
|
+
throw new Error(`API call failed: ${response.status}`);
|
|
46
|
+
}
|
|
47
|
+
const result = await response.json();
|
|
48
|
+
if (result.status === 'error') {
|
|
49
|
+
throw new Error(result.errorMessage || 'Unknown error');
|
|
50
|
+
}
|
|
51
|
+
return result.value;
|
|
52
|
+
}
|
|
53
|
+
// Update MEMORY.md with curated content
|
|
54
|
+
function updateMemoryFile(content) {
|
|
55
|
+
const memoryPath = getMemoryPath();
|
|
56
|
+
// If file doesn't exist, create it with structure
|
|
57
|
+
if (!existsSync(memoryPath)) {
|
|
58
|
+
const today = new Date().toISOString().split('T')[0];
|
|
59
|
+
const initialContent = `# π§ Long-Term Memory
|
|
60
|
+
|
|
61
|
+
**Γltima atualizaΓ§Γ£o:** ${today}
|
|
62
|
+
**Sistema:** Super Memory 5-Layer Architecture
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## π΄ Gotchas & Armadilhas
|
|
67
|
+
|
|
68
|
+
*Entradas curadas automaticamente.*
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## π‘ Problemas & SoluΓ§Γ΅es
|
|
73
|
+
|
|
74
|
+
*Problemas resolvidos e suas soluΓ§Γ΅es.*
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## π€ DecisΓ΅es Importantes
|
|
79
|
+
|
|
80
|
+
*DecisΓ΅es tΓ©cnicas e estratΓ©gicas.*
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## π£ Descobertas & Insights
|
|
85
|
+
|
|
86
|
+
*Aprendizados e descobertas importantes.*
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## π
Curadoria AutomΓ‘tica
|
|
91
|
+
|
|
92
|
+
${content}
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## π Status
|
|
97
|
+
|
|
98
|
+
**Γltima curadoria:** ${today}
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
*Powered by The Red Lobster Cartel π¦*
|
|
103
|
+
`;
|
|
104
|
+
writeFileSync(memoryPath, initialContent);
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
// File exists, append curated content
|
|
108
|
+
let existingContent = readFileSync(memoryPath, 'utf-8');
|
|
109
|
+
// Update timestamp
|
|
110
|
+
const today = new Date().toISOString().split('T')[0];
|
|
111
|
+
existingContent = existingContent.replace(/\*\*Γltima atualizaΓ§Γ£o:\*\*.*/, `**Γltima atualizaΓ§Γ£o:** ${today}`);
|
|
112
|
+
existingContent = existingContent.replace(/\*\*Γltima curadoria:\*\*.*/, `**Γltima curadoria:** ${today}`);
|
|
113
|
+
// Find insertion point (before ## π Status)
|
|
114
|
+
const statusIndex = existingContent.indexOf('## π Status');
|
|
115
|
+
if (statusIndex !== -1) {
|
|
116
|
+
// Insert before Status section
|
|
117
|
+
existingContent =
|
|
118
|
+
existingContent.slice(0, statusIndex) +
|
|
119
|
+
content + '\n\n' +
|
|
120
|
+
existingContent.slice(statusIndex);
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
// Append at the end (before closing footer)
|
|
124
|
+
const footerIndex = existingContent.indexOf('*Powered by The Red Lobster Cartel');
|
|
125
|
+
if (footerIndex !== -1) {
|
|
126
|
+
existingContent =
|
|
127
|
+
existingContent.slice(0, footerIndex) +
|
|
128
|
+
content + '\n\n---\n\n' +
|
|
129
|
+
existingContent.slice(footerIndex);
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
existingContent += '\n\n' + content;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
writeFileSync(memoryPath, existingContent);
|
|
136
|
+
return true;
|
|
137
|
+
}
|
|
138
|
+
// Main curate command
|
|
139
|
+
export async function cmdCurate(args = []) {
|
|
140
|
+
const config = loadConfig();
|
|
141
|
+
if (!config) {
|
|
142
|
+
console.error('β Not initialized. Run: super-memory init --license=YOUR_KEY');
|
|
143
|
+
process.exit(1);
|
|
144
|
+
}
|
|
145
|
+
// Parse args
|
|
146
|
+
const daysBack = parseInt(args.find(arg => arg.startsWith('--days='))?.split('=')[1] || '7', 10);
|
|
147
|
+
const dryRun = args.includes('--dry-run');
|
|
148
|
+
const silent = args.includes('--silent');
|
|
149
|
+
if (!silent) {
|
|
150
|
+
console.log(`
|
|
151
|
+
π¦ ============================================
|
|
152
|
+
AUTO-CURATE - Super Memory
|
|
153
|
+
The Red Lobster Cartel
|
|
154
|
+
============================================
|
|
155
|
+
`);
|
|
156
|
+
console.log(`π
Curating last ${daysBack} days...\n`);
|
|
157
|
+
}
|
|
158
|
+
try {
|
|
159
|
+
// Call Convex curate mutation
|
|
160
|
+
const result = await convexCall('sync:curate', {
|
|
161
|
+
licenseKey: config.licenseKey,
|
|
162
|
+
daysBack,
|
|
163
|
+
});
|
|
164
|
+
if (!result.success) {
|
|
165
|
+
console.error('β Curate failed. Check your license.');
|
|
166
|
+
process.exit(1);
|
|
167
|
+
}
|
|
168
|
+
if (result.stats.total === 0) {
|
|
169
|
+
if (!silent) {
|
|
170
|
+
console.log('β
No new entries to curate. MEMORY.md is up to date.\n');
|
|
171
|
+
}
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
if (!silent) {
|
|
175
|
+
console.log(`π Entries found:`);
|
|
176
|
+
console.log(` π΄ Gotchas: ${result.stats.gotchas}`);
|
|
177
|
+
console.log(` π‘ Problems: ${result.stats.problems}`);
|
|
178
|
+
console.log(` π€ Decisions: ${result.stats.decisions}`);
|
|
179
|
+
console.log(` π£ Discoveries: ${result.stats.discoveries}`);
|
|
180
|
+
console.log(` ββββββββββββββββ`);
|
|
181
|
+
console.log(` π¦ Total: ${result.stats.total}\n`);
|
|
182
|
+
}
|
|
183
|
+
if (dryRun) {
|
|
184
|
+
console.log('π Preview (dry run):\n');
|
|
185
|
+
console.log(result.content);
|
|
186
|
+
console.log('\n(No changes made - dry run)\n');
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
// Update local MEMORY.md
|
|
190
|
+
const updated = updateMemoryFile(result.content);
|
|
191
|
+
if (updated) {
|
|
192
|
+
// Update config with last curate time
|
|
193
|
+
config.lastCurateAt = result.lastCurateAt;
|
|
194
|
+
saveConfig(config);
|
|
195
|
+
if (!silent) {
|
|
196
|
+
console.log(`β
MEMORY.md updated!`);
|
|
197
|
+
console.log(`π Location: ${getMemoryPath()}\n`);
|
|
198
|
+
console.log(`
|
|
199
|
+
π ============================================
|
|
200
|
+
AUTO-CURATE COMPLETE!
|
|
201
|
+
============================================
|
|
202
|
+
|
|
203
|
+
${result.stats.total} entries curated
|
|
204
|
+
MEMORY.md has been updated
|
|
205
|
+
|
|
206
|
+
π¦ The Red Lobster Cartel
|
|
207
|
+
`);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
// Log to curate.log
|
|
211
|
+
const logPath = join(getMemoryDir(), 'curate.log');
|
|
212
|
+
const logEntry = `${new Date().toISOString()} - Curated ${result.stats.total} entries (G:${result.stats.gotchas} P:${result.stats.problems} D:${result.stats.decisions} Di:${result.stats.discoveries})\n`;
|
|
213
|
+
appendFileSync(logPath, logEntry);
|
|
214
|
+
}
|
|
215
|
+
catch (error) {
|
|
216
|
+
console.error(`β Curate error: ${error.message}`);
|
|
217
|
+
process.exit(1);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
export default cmdCurate;
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Index Update Command
|
|
3
3
|
* Creates progressive memory index (~70% token savings)
|
|
4
|
+
* Now includes AUTO-CURATE automatically!
|
|
4
5
|
*/
|
|
5
6
|
import { loadConfig, getConvexUrl } from '../utils/config.js';
|
|
6
|
-
|
|
7
|
+
import { cmdCurate } from './curate.js';
|
|
8
|
+
export async function cmdIndexUpdate(args = []) {
|
|
7
9
|
const config = loadConfig();
|
|
8
10
|
if (!config) {
|
|
9
11
|
console.error('β Not initialized. Run: super-memory init --license=YOUR_KEY');
|
|
10
12
|
process.exit(1);
|
|
11
13
|
}
|
|
14
|
+
const skipCurate = args.includes('--skip-curate');
|
|
12
15
|
console.log('\nπ Updating memory index...\n');
|
|
13
16
|
try {
|
|
14
17
|
const response = await fetch(`${getConvexUrl()}/api/mutation`, {
|
|
@@ -34,6 +37,13 @@ export async function cmdIndexUpdate() {
|
|
|
34
37
|
console.log(` Estimated savings: ${data.estimatedSavings}`);
|
|
35
38
|
console.log('\nπ‘ The progressive index provides ~70% token savings');
|
|
36
39
|
console.log(' when searching and reviewing your memories.\n');
|
|
40
|
+
// AUTO-CURATE: Run automatically after index update
|
|
41
|
+
if (!skipCurate) {
|
|
42
|
+
console.log('ββββββββββββββββββββββββββββββββββββββββ');
|
|
43
|
+
console.log('π§ Running AUTO-CURATE...\n');
|
|
44
|
+
await cmdCurate(['--silent']);
|
|
45
|
+
console.log('β
Auto-curate completed! MEMORY.md updated.\n');
|
|
46
|
+
}
|
|
37
47
|
}
|
|
38
48
|
else {
|
|
39
49
|
console.error('β Failed to update index');
|
package/dist/index.js
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* super-memory sync
|
|
11
11
|
* super-memory status
|
|
12
12
|
* super-memory dashboard [--port=8765] [--no-browser]
|
|
13
|
+
* super-memory curate [--days=7] [--dry-run] β NEW!
|
|
13
14
|
*/
|
|
14
15
|
import { execSync } from 'child_process';
|
|
15
16
|
import { startDashboard } from './commands/dashboard.js';
|
|
@@ -17,6 +18,7 @@ import { cmdIndexUpdate } from './commands/indexUpdate.js';
|
|
|
17
18
|
import { cmdFlush } from './commands/flush.js';
|
|
18
19
|
import { cmdMaintenance } from './commands/maintenance.js';
|
|
19
20
|
import { cmdCategorize } from './commands/categorize.js';
|
|
21
|
+
import { cmdCurate } from './commands/curate.js';
|
|
20
22
|
import { existsSync, mkdirSync, writeFileSync, readFileSync, appendFileSync } from 'fs';
|
|
21
23
|
import { homedir } from 'os';
|
|
22
24
|
import { join } from 'path';
|
|
@@ -436,6 +438,11 @@ COMMANDS:
|
|
|
436
438
|
status Show status and stats
|
|
437
439
|
|
|
438
440
|
index-update Update progressive MEMORY_INDEX.md (Layer 4)
|
|
441
|
+
Also auto-curates to MEMORY.md
|
|
442
|
+
|
|
443
|
+
curate Auto-curate important entries to MEMORY.md (Layer 3)
|
|
444
|
+
Extracts gotchas, problems, decisions, discoveries
|
|
445
|
+
from recent daily logs automatically
|
|
439
446
|
|
|
440
447
|
flush <context> Save critical context before compaction
|
|
441
448
|
|
|
@@ -496,7 +503,10 @@ async function main() {
|
|
|
496
503
|
await cmdDashboard(cmdArgs);
|
|
497
504
|
break;
|
|
498
505
|
case 'index-update':
|
|
499
|
-
await cmdIndexUpdate();
|
|
506
|
+
await cmdIndexUpdate(cmdArgs);
|
|
507
|
+
break;
|
|
508
|
+
case 'curate':
|
|
509
|
+
await cmdCurate(cmdArgs);
|
|
500
510
|
break;
|
|
501
511
|
case 'flush':
|
|
502
512
|
await cmdFlush(cmdArgs);
|