jasper-recall 0.5.5 → 0.5.6

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.
@@ -11,6 +11,7 @@
11
11
  */
12
12
 
13
13
  import { execSync } from 'child_process';
14
+ import { readFileSync, existsSync } from 'fs';
14
15
  import * as path from 'path';
15
16
  import * as os from 'os';
16
17
 
@@ -131,18 +132,33 @@ export default function register(api: PluginApi) {
131
132
  try {
132
133
  let prependParts: string[] = [];
133
134
 
134
- // If fresh session, remind agent to read identity files
135
+ // If fresh session, inject identity files directly into context
135
136
  if (isFreshSession) {
136
- api.logger.info('[jasper-recall] Fresh session detected - adding identity reminder');
137
- prependParts.push(`<session-init>
138
- 🔄 **Fresh session detected.** Before responding, read your identity files:
139
- \`\`\`bash
140
- cat ~/.openclaw/workspace/IDENTITY.md
141
- cat ~/.openclaw/workspace/SOUL.md
142
- cat ~/.openclaw/workspace/USER.md
143
- \`\`\`
144
- This ensures you maintain your persona and context after session reset.
145
- </session-init>`);
137
+ api.logger.info('[jasper-recall] Fresh session detected - injecting identity context');
138
+
139
+ const workspace = path.join(os.homedir(), '.openclaw', 'workspace');
140
+ const identityFiles = ['IDENTITY.md', 'SOUL.md', 'USER.md'];
141
+ const identityParts: string[] = [];
142
+
143
+ for (const file of identityFiles) {
144
+ const filePath = path.join(workspace, file);
145
+ if (existsSync(filePath)) {
146
+ try {
147
+ const content = readFileSync(filePath, 'utf8');
148
+ identityParts.push(`### ${file}\n${content}`);
149
+ } catch (err: any) {
150
+ api.logger.warn(`[jasper-recall] Failed to read ${file}: ${err.message}`);
151
+ }
152
+ }
153
+ }
154
+
155
+ if (identityParts.length > 0) {
156
+ prependParts.push(`<session-identity>
157
+ 🔄 **Fresh session.** Your identity files:
158
+
159
+ ${identityParts.join('\n\n---\n\n')}
160
+ </session-identity>`);
161
+ }
146
162
  }
147
163
 
148
164
  const results = runRecall(event.prompt, {
@@ -180,18 +196,33 @@ ${memoryContext}
180
196
  } catch (err: any) {
181
197
  api.logger.warn(`[jasper-recall] Auto-recall failed: ${err.message}`);
182
198
 
183
- // Still inject identity reminder on fresh session even if recall fails
199
+ // Still inject identity context on fresh session even if recall fails
184
200
  if (isFreshSession) {
185
- return {
186
- prependContext: `<session-init>
187
- 🔄 **Fresh session detected.** Before responding, read your identity files:
188
- \`\`\`bash
189
- cat ~/.openclaw/workspace/IDENTITY.md
190
- cat ~/.openclaw/workspace/SOUL.md
191
- cat ~/.openclaw/workspace/USER.md
192
- \`\`\`
193
- </session-init>`,
194
- };
201
+ const workspace = path.join(os.homedir(), '.openclaw', 'workspace');
202
+ const identityFiles = ['IDENTITY.md', 'SOUL.md', 'USER.md'];
203
+ const identityParts: string[] = [];
204
+
205
+ for (const file of identityFiles) {
206
+ const filePath = path.join(workspace, file);
207
+ if (existsSync(filePath)) {
208
+ try {
209
+ const content = readFileSync(filePath, 'utf8');
210
+ identityParts.push(`### ${file}\n${content}`);
211
+ } catch {
212
+ // Skip unreadable files
213
+ }
214
+ }
215
+ }
216
+
217
+ if (identityParts.length > 0) {
218
+ return {
219
+ prependContext: `<session-identity>
220
+ 🔄 **Fresh session.** Your identity files:
221
+
222
+ ${identityParts.join('\n\n---\n\n')}
223
+ </session-identity>`,
224
+ };
225
+ }
195
226
  }
196
227
  }
197
228
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jasper-recall",
3
- "version": "0.5.5",
3
+ "version": "0.5.6",
4
4
  "description": "Local RAG system for AI agent memory using ChromaDB and sentence-transformers",
5
5
  "main": "src/index.js",
6
6
  "bin": {