jasper-recall 0.3.6 → 0.4.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/SKILL.md CHANGED
@@ -197,6 +197,32 @@ recall "product info" --public-only
197
197
  recall "product info"
198
198
  ```
199
199
 
200
+ ### Moltbook Agent Setup (v0.4.0+)
201
+
202
+ For the moltbook-scanner (or any sandboxed agent), use the built-in setup:
203
+
204
+ ```bash
205
+ # Configure sandboxed agent with --public-only restriction
206
+ npx jasper-recall moltbook-setup
207
+
208
+ # Verify the setup is correct
209
+ npx jasper-recall moltbook-verify
210
+ ```
211
+
212
+ This creates:
213
+ - `~/bin/recall` — Wrapper that forces `--public-only` flag
214
+ - `shared/` — Symlink to main workspace's shared memory
215
+
216
+ The sandboxed agent can then use:
217
+ ```bash
218
+ ~/bin/recall "query" # Automatically restricted to public memories
219
+ ```
220
+
221
+ **Privacy model:**
222
+ 1. Main agent tags memories as `[public]` or `[private]` in daily notes
223
+ 2. `sync-shared` extracts `[public]` content to `memory/shared/`
224
+ 3. Sandboxed agents can ONLY search the `shared` collection
225
+
200
226
  ### Privacy Workflow
201
227
 
202
228
  ```bash
@@ -209,17 +209,19 @@ USAGE:
209
209
  npx jasper-recall <command>
210
210
 
211
211
  COMMANDS:
212
- setup Install dependencies and CLI scripts
213
- doctor Run system health check
214
- Flags: --fix (auto-repair issues), --dry-run (verbose output)
215
- recall Search your memory (alias for the recall command)
216
- index Index memory files (alias for index-digests)
217
- digest Process session logs (alias for digest-sessions)
218
- summarize Compress old entries to save tokens (alias for summarize-old)
219
- serve Start HTTP API server (for sandboxed agents)
220
- config Show or set configuration
221
- update Check for updates
222
- help Show this help message
212
+ setup Install dependencies and CLI scripts
213
+ doctor Run system health check
214
+ Flags: --fix (auto-repair issues), --dry-run (verbose output)
215
+ recall Search your memory (alias for the recall command)
216
+ index Index memory files (alias for index-digests)
217
+ digest Process session logs (alias for digest-sessions)
218
+ summarize Compress old entries to save tokens (alias for summarize-old)
219
+ serve Start HTTP API server (for sandboxed agents)
220
+ config Show or set configuration
221
+ update Check for updates
222
+ moltbook-setup Configure moltbook agent with --public-only restriction
223
+ moltbook-verify Verify moltbook agent setup
224
+ help Show this help message
223
225
 
224
226
  CONFIGURATION:
225
227
  Config file: ~/.jasper-recall/config.json
@@ -311,6 +313,17 @@ switch (command) {
311
313
  };
312
314
  process.exit(runDoctor(options));
313
315
  break;
316
+ case 'moltbook-setup':
317
+ case 'moltbook':
318
+ // Set up moltbook agent integration
319
+ process.argv = [process.argv[0], process.argv[1], 'setup'];
320
+ require('../extensions/moltbook-setup/setup.js');
321
+ break;
322
+ case 'moltbook-verify':
323
+ // Verify moltbook agent setup
324
+ process.argv = [process.argv[0], process.argv[1], 'verify'];
325
+ require('../extensions/moltbook-setup/setup.js');
326
+ break;
314
327
  case 'config':
315
328
  // Configuration management
316
329
  const config = require('./config');
@@ -0,0 +1,282 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Moltbook Agent Setup for jasper-recall
4
+ *
5
+ * Configures a sandboxed agent to use jasper-recall with --public-only restriction.
6
+ * This ensures the agent can only access shared/public memories, not private ones.
7
+ */
8
+
9
+ const fs = require('fs');
10
+ const path = require('path');
11
+ const os = require('os');
12
+ const readline = require('readline');
13
+
14
+ const MOLTBOOK_WORKSPACE = path.join(os.homedir(), '.openclaw', 'workspace-moltbook');
15
+ const MAIN_WORKSPACE = path.join(os.homedir(), '.openclaw', 'workspace');
16
+ const RECALL_BIN = path.join(os.homedir(), '.local', 'bin', 'recall');
17
+
18
+ function log(msg) {
19
+ console.log(`🦞 ${msg}`);
20
+ }
21
+
22
+ function warn(msg) {
23
+ console.log(`⚠️ ${msg}`);
24
+ }
25
+
26
+ function error(msg) {
27
+ console.error(`❌ ${msg}`);
28
+ }
29
+
30
+ function success(msg) {
31
+ console.log(`✅ ${msg}`);
32
+ }
33
+
34
+ async function prompt(question) {
35
+ const rl = readline.createInterface({
36
+ input: process.stdin,
37
+ output: process.stdout
38
+ });
39
+
40
+ return new Promise(resolve => {
41
+ rl.question(question, answer => {
42
+ rl.close();
43
+ resolve(answer.trim());
44
+ });
45
+ });
46
+ }
47
+
48
+ async function setup() {
49
+ console.log('');
50
+ log('Moltbook Agent — jasper-recall Integration Setup');
51
+ console.log('='.repeat(55));
52
+ console.log('');
53
+ console.log(' This configures the moltbook-scanner agent to use jasper-recall');
54
+ console.log(' with the --public-only restriction for privacy.');
55
+ console.log('');
56
+ console.log(' What it does:');
57
+ console.log(' 1. Creates ~/bin/recall wrapper (forces --public-only)');
58
+ console.log(' 2. Symlinks shared/ folder from main workspace');
59
+ console.log(' 3. Verifies jasper-recall is installed');
60
+ console.log('');
61
+
62
+ // Check prerequisites
63
+ if (!fs.existsSync(MOLTBOOK_WORKSPACE)) {
64
+ error(`Moltbook workspace not found: ${MOLTBOOK_WORKSPACE}`);
65
+ console.log(' Create it first or check your OpenClaw agent config.');
66
+ process.exit(1);
67
+ }
68
+
69
+ if (!fs.existsSync(RECALL_BIN)) {
70
+ error(`jasper-recall not installed: ${RECALL_BIN}`);
71
+ console.log(' Install it first: npx jasper-recall setup');
72
+ process.exit(1);
73
+ }
74
+
75
+ const proceed = await prompt(' Continue? (y/n): ');
76
+ if (proceed.toLowerCase() !== 'y' && proceed.toLowerCase() !== 'yes') {
77
+ console.log('\n Setup cancelled.\n');
78
+ process.exit(0);
79
+ }
80
+
81
+ console.log('');
82
+
83
+ // Step 1: Create bin directory and wrapper
84
+ const binDir = path.join(MOLTBOOK_WORKSPACE, 'bin');
85
+ const wrapperPath = path.join(binDir, 'recall');
86
+
87
+ fs.mkdirSync(binDir, { recursive: true });
88
+
89
+ const wrapperScript = `#!/bin/bash
90
+ # Sandboxed recall wrapper - forces --public-only for privacy
91
+ # This agent can ONLY access shared/public memory
92
+
93
+ exec ${RECALL_BIN} "$@" --public-only
94
+ `;
95
+
96
+ fs.writeFileSync(wrapperPath, wrapperScript);
97
+ fs.chmodSync(wrapperPath, '755');
98
+ success(`Created recall wrapper: ${wrapperPath}`);
99
+
100
+ // Step 2: Create shared folder symlink
101
+ const sharedSource = path.join(MAIN_WORKSPACE, 'memory', 'shared');
102
+ const sharedTarget = path.join(MOLTBOOK_WORKSPACE, 'shared');
103
+
104
+ // Ensure source exists
105
+ fs.mkdirSync(sharedSource, { recursive: true });
106
+
107
+ // Remove existing symlink/dir if needed
108
+ try {
109
+ const stat = fs.lstatSync(sharedTarget);
110
+ if (stat.isSymbolicLink()) {
111
+ fs.unlinkSync(sharedTarget);
112
+ } else if (stat.isDirectory()) {
113
+ warn(`${sharedTarget} is a directory, not a symlink. Skipping.`);
114
+ }
115
+ } catch (e) {
116
+ // Doesn't exist, that's fine
117
+ }
118
+
119
+ if (!fs.existsSync(sharedTarget)) {
120
+ fs.symlinkSync(sharedSource, sharedTarget);
121
+ success(`Created symlink: shared/ → ${sharedSource}`);
122
+ }
123
+
124
+ // Step 3: Verify setup
125
+ console.log('');
126
+ log('Verifying setup...');
127
+
128
+ const issues = verify({ quiet: true });
129
+
130
+ if (issues.length === 0) {
131
+ console.log('');
132
+ console.log('='.repeat(55));
133
+ success('Setup complete!');
134
+ console.log('');
135
+ console.log(' The moltbook-scanner agent can now use:');
136
+ console.log(' ~/bin/recall "query" — searches public memories only');
137
+ console.log(' shared/ — symlink to main agent\'s shared memory');
138
+ console.log('');
139
+ console.log(' Test it:');
140
+ console.log(` ${wrapperPath} "test query"`);
141
+ console.log('');
142
+ } else {
143
+ console.log('');
144
+ warn('Setup completed with issues:');
145
+ issues.forEach(issue => console.log(` - ${issue}`));
146
+ }
147
+ }
148
+
149
+ function verify(options = {}) {
150
+ const { quiet = false } = options;
151
+ const issues = [];
152
+
153
+ if (!quiet) {
154
+ console.log('');
155
+ log('Moltbook Agent — jasper-recall Verification');
156
+ console.log('='.repeat(55));
157
+ console.log('');
158
+ }
159
+
160
+ // Check 1: Workspace exists
161
+ if (!fs.existsSync(MOLTBOOK_WORKSPACE)) {
162
+ issues.push(`Workspace missing: ${MOLTBOOK_WORKSPACE}`);
163
+ } else if (!quiet) {
164
+ success(`Workspace exists: ${MOLTBOOK_WORKSPACE}`);
165
+ }
166
+
167
+ // Check 2: Recall wrapper exists and is executable
168
+ const wrapperPath = path.join(MOLTBOOK_WORKSPACE, 'bin', 'recall');
169
+ if (!fs.existsSync(wrapperPath)) {
170
+ issues.push(`Recall wrapper missing: ${wrapperPath}`);
171
+ } else {
172
+ // Check it has --public-only
173
+ const content = fs.readFileSync(wrapperPath, 'utf8');
174
+ if (!content.includes('--public-only')) {
175
+ issues.push('Recall wrapper missing --public-only flag!');
176
+ } else if (!quiet) {
177
+ success('Recall wrapper has --public-only restriction');
178
+ }
179
+ }
180
+
181
+ // Check 3: Shared folder is a symlink
182
+ const sharedPath = path.join(MOLTBOOK_WORKSPACE, 'shared');
183
+ try {
184
+ const stat = fs.lstatSync(sharedPath);
185
+ if (!stat.isSymbolicLink()) {
186
+ issues.push(`shared/ is not a symlink (should link to main workspace)`);
187
+ } else {
188
+ const target = fs.readlinkSync(sharedPath);
189
+ if (!quiet) {
190
+ success(`shared/ symlink → ${target}`);
191
+ }
192
+ }
193
+ } catch (e) {
194
+ issues.push(`shared/ folder missing`);
195
+ }
196
+
197
+ // Check 4: jasper-recall is installed
198
+ if (!fs.existsSync(RECALL_BIN)) {
199
+ issues.push(`jasper-recall not installed: ${RECALL_BIN}`);
200
+ } else if (!quiet) {
201
+ success(`jasper-recall installed: ${RECALL_BIN}`);
202
+ }
203
+
204
+ // Check 5: AGENTS.md mentions recall restrictions
205
+ const agentsMd = path.join(MOLTBOOK_WORKSPACE, 'AGENTS.md');
206
+ if (fs.existsSync(agentsMd)) {
207
+ const content = fs.readFileSync(agentsMd, 'utf8');
208
+ if (!content.includes('public-only') && !content.includes('public_only')) {
209
+ issues.push('AGENTS.md should document --public-only restriction');
210
+ } else if (!quiet) {
211
+ success('AGENTS.md documents recall restrictions');
212
+ }
213
+ }
214
+
215
+ if (!quiet) {
216
+ console.log('');
217
+ if (issues.length === 0) {
218
+ console.log('='.repeat(55));
219
+ success('All checks passed! Moltbook agent is properly configured.');
220
+ } else {
221
+ console.log('='.repeat(55));
222
+ warn(`Found ${issues.length} issue(s):`);
223
+ issues.forEach(issue => console.log(` ❌ ${issue}`));
224
+ console.log('');
225
+ console.log(' Run setup to fix: npx jasper-recall moltbook-setup');
226
+ }
227
+ console.log('');
228
+ }
229
+
230
+ return issues;
231
+ }
232
+
233
+ function showHelp() {
234
+ console.log(`
235
+ Moltbook Agent — jasper-recall Integration
236
+
237
+ USAGE:
238
+ npx jasper-recall moltbook-setup Configure moltbook agent
239
+ npx jasper-recall moltbook-verify Verify configuration
240
+
241
+ WHAT IT DOES:
242
+ Sets up the moltbook-scanner agent to use jasper-recall with privacy
243
+ restrictions. The agent can only access shared/public memories, not
244
+ private ones from the main workspace.
245
+
246
+ COMPONENTS:
247
+ ~/bin/recall Wrapper script that forces --public-only flag
248
+ shared/ Symlink to main workspace's shared memory folder
249
+
250
+ PRIVACY MODEL:
251
+ Main agent tags memories as [public] or [private] in daily notes.
252
+ sync-shared.py extracts [public] content to memory/shared/.
253
+ Sandboxed agents can ONLY search the shared collection.
254
+ `);
255
+ }
256
+
257
+ // Main
258
+ const command = process.argv[2];
259
+
260
+ switch (command) {
261
+ case 'setup':
262
+ case 'install':
263
+ setup().catch(err => {
264
+ error(err.message);
265
+ process.exit(1);
266
+ });
267
+ break;
268
+ case 'verify':
269
+ case 'check':
270
+ verify();
271
+ break;
272
+ case 'help':
273
+ case '--help':
274
+ case '-h':
275
+ case undefined:
276
+ showHelp();
277
+ break;
278
+ default:
279
+ error(`Unknown command: ${command}`);
280
+ showHelp();
281
+ process.exit(1);
282
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jasper-recall",
3
- "version": "0.3.6",
3
+ "version": "0.4.0",
4
4
  "description": "Local RAG system for AI agent memory using ChromaDB and sentence-transformers",
5
5
  "main": "src/index.js",
6
6
  "bin": {