sapper-iq 1.1.6 → 1.1.8

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/sapper.mjs +22 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sapper-iq",
3
- "version": "1.1.6",
3
+ "version": "1.1.8",
4
4
  "description": "AI-powered development assistant that executes commands and builds projects",
5
5
  "main": "sapper.mjs",
6
6
  "bin": {
package/sapper.mjs CHANGED
@@ -344,16 +344,32 @@ IMPORTANT RULES:
344
344
  continue;
345
345
  }
346
346
 
347
- // Keep system prompt + last 4 messages
348
- const systemPrompt = messages[0];
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
- // Count what we're removing
352
- const removedCount = messages.length - 5;
353
+ // 3. Rebuild the messages array starting with the ORIGINAL prompt
354
+ messages = [originalSystemPrompt, ...recentMessages];
355
+
356
+ // 4. Add reminder to stay in Agent Mode (not chatbot mode)
357
+ messages.push({
358
+ role: 'system',
359
+ content: `CONTEXT PRUNED. REMINDER: You are an AGENT, not a chatbot. You MUST use tools to take action:
360
+ - [TOOL:LIST]path[/TOOL] - List directory
361
+ - [TOOL:READ]path[/TOOL] - Read file
362
+ - [TOOL:SEARCH]pattern[/TOOL] - Search codebase
363
+ - [TOOL:WRITE]path]content[/TOOL] - Create/overwrite file
364
+ - [TOOL:PATCH]path]old|||new[/TOOL] - Edit file
365
+ - [TOOL:SHELL]command[/TOOL] - Run terminal command
366
+ Do NOT just display content. Actually WRITE files using the tool.`
367
+ });
353
368
 
354
- messages = [systemPrompt, ...recentMessages];
369
+ // 5. Save to context file so it persists
355
370
  fs.writeFileSync(CONTEXT_FILE, JSON.stringify(messages));
356
- console.log(chalk.green(`✅ Pruned ${removedCount} old messages. Kept system prompt + last 4 messages.`));
371
+
372
+ console.log(chalk.green(`✅ Pruned context. Sapper reminded to stay in Agent Mode.`));
357
373
  console.log(chalk.gray(`Context size: ${messages.length} messages\n`));
358
374
  continue;
359
375
  }