Add preamble to branch summary for context

Prepends: 'The user explored a different conversation branch before
returning here. Summary of that exploration:'

This helps the LLM understand the summary is background context from
a different path, not the current thread being continued.
This commit is contained in:
Mario Zechner 2025-12-29 22:45:29 +01:00
parent 2ba69878ed
commit 8fe8fe9920

View file

@ -265,6 +265,11 @@ export function prepareBranchEntries(entries: SessionEntry[], tokenBudget: numbe
// Summary Generation
// ============================================================================
const BRANCH_SUMMARY_PREAMBLE = `The user explored a different conversation branch before returning here.
Summary of that exploration:
`;
const BRANCH_SUMMARY_PROMPT = `Create a structured summary of this conversation branch for context when returning later.
Use this EXACT format:
@ -348,6 +353,9 @@ export async function generateBranchSummary(
.map((c) => c.text)
.join("\n");
// Prepend preamble to provide context about the branch summary
summary = BRANCH_SUMMARY_PREAMBLE + summary;
// Compute file lists
const modified = new Set([...fileOps.edited, ...fileOps.written]);
const readOnly = [...fileOps.read].filter((f) => !modified.has(f)).sort();