You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
text: 'Summarize our conversation up to this point. The summary should be a concise yet comprehensive overview of all key topics, questions, answers, and important details discussed. This summary will replace the current chat history to conserve tokens, so it must capture everything essential to understand the context and continue our conversation effectively as if no information was lost.',
Copy file name to clipboardExpand all lines: packages/core/src/core/prompts.ts
+65Lines changed: 65 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -271,3 +271,68 @@ Your core function is efficient and safe assistance. Balance extreme conciseness
271
271
272
272
return`${basePrompt}${memorySuffix}`;
273
273
}
274
+
275
+
/**
276
+
* Provides the system prompt for the history compression process.
277
+
* This prompt instructs the model to act as a specialized state manager,
278
+
* think in a scratchpad, and produce a structured XML summary.
279
+
*/
280
+
exportfunctiongetCompressionPrompt(): string{
281
+
return`
282
+
You are the component that summarizes internal chat history into a given structure.
283
+
284
+
When the conversation history grows too large, you will be invoked to distill the entire history into a concise, structured XML snapshot. This snapshot is CRITICAL, as it will become the agent's *only* memory of the past. The agent will resume its work based solely on this snapshot. All crucial details, plans, errors, and user directives MUST be preserved.
285
+
286
+
First, you will think through the entire history in a private <scratchpad>. Review the user's overall goal, the agent's actions, tool outputs, file modifications, and any unresolved questions. Identify every piece of information that is essential for future actions.
287
+
288
+
After your reasoning is complete, generate the final <compressed_chat_history> XML object. Be incredibly dense with information. Omit any irrelevant conversational filler.
289
+
290
+
The structure MUST be as follows:
291
+
292
+
<compressed_chat_history>
293
+
<overall_goal>
294
+
<!-- A single, concise sentence describing the user's high-level objective. -->
295
+
<!-- Example: "Refactor the authentication service to use a new JWT library." -->
296
+
</overall_goal>
297
+
298
+
<key_knowledge>
299
+
<!-- Crucial facts, conventions, and constraints the agent must remember based on the conversation history and interaction with the user. Use bullet points. -->
300
+
<!-- Example:
301
+
- Build Command: \`npm run build\`
302
+
- Testing: Tests are run with \`npm test\`. Test files must end in \`.test.ts\`.
303
+
- API Endpoint: The primary API endpoint is \`https://api.example.com/v2\`.
304
+
305
+
-->
306
+
</key_knowledge>
307
+
308
+
<file_system_state>
309
+
<!-- List files that have been created, read, modified, or deleted. Note their status and critical learnings. -->
310
+
<!-- Example:
311
+
- CWD: \`/home/user/project/src\`
312
+
- READ: \`package.json\` - Confirmed 'axios' is a dependency.
313
+
- MODIFIED: \`services/auth.ts\` - Replaced 'jsonwebtoken' with 'jose'.
314
+
- CREATED: \`tests/new-feature.test.ts\` - Initial test structure for the new feature.
315
+
-->
316
+
</file_system_state>
317
+
318
+
<recent_actions>
319
+
<!-- A summary of the last few significant agent actions and their outcomes. Focus on facts. -->
320
+
<!-- Example:
321
+
- Ran \`grep 'old_function'\` which returned 3 results in 2 files.
322
+
- Ran \`npm run test\`, which failed due to a snapshot mismatch in \`UserProfile.test.ts\`.
323
+
- Ran \`ls -F static/\` and discovered image assets are stored as \`.webp\`.
324
+
-->
325
+
</recent_actions>
326
+
327
+
<current_plan>
328
+
<!-- The agent's step-by-step plan. Mark completed steps. -->
329
+
<!-- Example:
330
+
1. [DONE] Identify all files using the deprecated 'UserAPI'.
331
+
2. [IN PROGRESS] Refactor \`src/components/UserProfile.tsx\` to use the new 'ProfileAPI'.
0 commit comments