mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-18 02:03:05 +00:00
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:
parent
2ba69878ed
commit
8fe8fe9920
1 changed files with 8 additions and 0 deletions
|
|
@ -265,6 +265,11 @@ export function prepareBranchEntries(entries: SessionEntry[], tokenBudget: numbe
|
||||||
// Summary Generation
|
// 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.
|
const BRANCH_SUMMARY_PROMPT = `Create a structured summary of this conversation branch for context when returning later.
|
||||||
|
|
||||||
Use this EXACT format:
|
Use this EXACT format:
|
||||||
|
|
@ -348,6 +353,9 @@ export async function generateBranchSummary(
|
||||||
.map((c) => c.text)
|
.map((c) => c.text)
|
||||||
.join("\n");
|
.join("\n");
|
||||||
|
|
||||||
|
// Prepend preamble to provide context about the branch summary
|
||||||
|
summary = BRANCH_SUMMARY_PREAMBLE + summary;
|
||||||
|
|
||||||
// Compute file lists
|
// Compute file lists
|
||||||
const modified = new Set([...fileOps.edited, ...fileOps.written]);
|
const modified = new Set([...fileOps.edited, ...fileOps.written]);
|
||||||
const readOnly = [...fileOps.read].filter((f) => !modified.has(f)).sort();
|
const readOnly = [...fileOps.read].filter((f) => !modified.has(f)).sort();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue