sapper-iq 1.1.6 → 1.1.7
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/package.json +1 -1
- package/sapper.mjs +9 -6
package/package.json
CHANGED
package/sapper.mjs
CHANGED
|
@@ -344,16 +344,19 @@ IMPORTANT RULES:
|
|
|
344
344
|
continue;
|
|
345
345
|
}
|
|
346
346
|
|
|
347
|
-
//
|
|
348
|
-
const
|
|
347
|
+
// 1. Capture the ORIGINAL detailed system prompt from the very first message
|
|
348
|
+
const originalSystemPrompt = messages[0];
|
|
349
|
+
|
|
350
|
+
// 2. Capture the last 4 messages (the most recent conversation)
|
|
349
351
|
const recentMessages = messages.slice(-4);
|
|
350
352
|
|
|
351
|
-
//
|
|
352
|
-
|
|
353
|
+
// 3. Rebuild the messages array starting with the ORIGINAL prompt
|
|
354
|
+
messages = [originalSystemPrompt, ...recentMessages];
|
|
353
355
|
|
|
354
|
-
|
|
356
|
+
// 4. Save to context file so it persists
|
|
355
357
|
fs.writeFileSync(CONTEXT_FILE, JSON.stringify(messages));
|
|
356
|
-
|
|
358
|
+
|
|
359
|
+
console.log(chalk.green(`✅ Pruned context. Original "Senior Engineer" instructions restored.`));
|
|
357
360
|
console.log(chalk.gray(`Context size: ${messages.length} messages\n`));
|
|
358
361
|
continue;
|
|
359
362
|
}
|