Use structured output format for compaction and branch summarization

Both now use consistent sections:
- Goal
- Constraints & Preferences
- Progress (Done/In Progress/Blocked)
- Key Decisions
- Next Steps
- Critical Context (compaction only)

Prompts instruct LLM to use EXACT format and preserve file paths/function names.
This commit is contained in:
Mario Zechner 2025-12-29 22:17:51 +01:00
parent d1a49c45ff
commit ac71aac090
2 changed files with 69 additions and 21 deletions

View file

@ -259,13 +259,34 @@ export function prepareBranchEntries(entries: SessionEntry[], tokenBudget: numbe
// Summary Generation
// ============================================================================
const BRANCH_SUMMARY_PROMPT = `Summarize this conversation branch concisely for context when returning later:
- Key decisions made and actions taken
- Important context, constraints, or preferences discovered
- Current state and any pending work
- Critical information needed to continue from a different point
const BRANCH_SUMMARY_PROMPT = `Create a structured summary of this conversation branch for context when returning later.
Be brief and focused on what matters for future reference.`;
Use this EXACT format:
## Goal
[1-2 sentences: What was the user trying to accomplish in this branch?]
## Constraints & Preferences
- [Any constraints, preferences, or requirements mentioned]
- [Or "(none)" if none were mentioned]
## Progress
### Done
- [x] [Completed tasks/changes]
### In Progress
- [ ] [Work that was started but not finished]
### Blocked
- [Issues preventing progress, if any]
## Key Decisions
- **[Decision]**: [Brief rationale]
## Next Steps
1. [What should happen next to continue this work]
Keep each section concise. Preserve exact file paths, function names, and error messages.`;
/**
* Convert messages to text for the summarization prompt.