Refactor buildSummaryPrompt to clarify summary instructions and improve user guidance

This commit is contained in:
Alex Newman
2025-10-24 22:05:23 -04:00
parent 5b28c23b20
commit b3a565c448
2 changed files with 29 additions and 57 deletions
File diff suppressed because one or more lines are too long
+7 -21
View File
@@ -158,35 +158,21 @@ export function buildObservationPrompt(obs: Observation): string {
export function buildSummaryPrompt(session: SDKSession): string { export function buildSummaryPrompt(session: SDKSession): string {
return `THIS REQUEST'S SUMMARY return `THIS REQUEST'S SUMMARY
=============== ===============
Think about the observations you just wrote for this request, and write a summary of what was done, what was learned, and what's next. Think about the last request, and write a summary of what was done, what was learned, and what's next.
IMPORTANT! DO NOT summarize the observation process itself - you are summarizing a DIFFERENT claude code session, not this one. IMPORTANT! DO NOT summarize the observation process itself - you are summarizing a DIFFERENT claude code session, not this one.
User's Original Request: ${session.user_prompt} User's Original Request: ${session.user_prompt}
✅ GOOD - Describes deliverables: Respond in this XML format:
<request>Fix authentication timeout bug</request>
<request>Add three-tier verbosity system to session summaries</request>
<request>Deploy Kubernetes cluster with auto-scaling</request>
❌ BAD - Describes meta-operations (DO NOT DO THIS):
<request>Process tool executions and store observations</request>
<request>Analyze session data and generate summaries</request>
<request>Track file modifications across sessions</request>
Output this XML:
<summary> <summary>
<request>[What did the user request? Form a title that reflects the actual request: ${session.user_prompt}]</request> <request>[What did the user request? Form a title that reflects the actual request: ${session.user_prompt}]</request>
<investigated>[What was explored?]</investigated> <investigated>[Was anything explored? What was it?]</investigated>
<learned>[What was learned about how things work?]</learned> <learned>[Did you learn anything? What was learned about how things work?]</learned>
<completed>[What shipped? What does the system now do?]</completed> <completed>[Did you do any work? What shipped? What does the system now do?]</completed>
<next_steps>[What are the next steps?]</next_steps> <next_steps>[What are the next steps?]</next_steps>
<notes>[Additional insights]</notes> <notes>[Additional insights]</notes>
</summary> </summary>
**Required fields**: request, investigated, learned, completed, next_steps IMPORTANT: This is not the end of the session. You will receive more requests to process, and more tool usages to observe and record. The summary helps keep track of progress. Always write at least a minimal summary explaining where we are at currently, even if you didn't learn anything new or complete any work.`;
**Optional fields**: notes }
IMPORTANT: This is not the end of the session. You will receive more requests to process, and more tool usages to observe and record. The summary helps keep track of progress.
`;
}