@@ -561,15 +561,7 @@ func (a *sessionAgent) Summarize(ctx context.Context, sessionID string, opts fan
561 return err
561 return err
564− summaryPromptText := "Provide a detailed summary of our conversation above."
565− if len(currentSession.Todos) > 0 {
564+ summaryPromptText := buildSummaryPrompt(currentSession.Todos)
566− summaryPromptText += "\n\n## Current Todo List\n\n"
567− for _, t := range currentSession.Todos {
568− summaryPromptText += fmt.Sprintf("- [%s] %s\n", t.Status, t.Content)
570− summaryPromptText += "\nInclude these tasks and their statuses in your summary. "
571− summaryPromptText += "Instruct the resuming assistant to use the `todos` tool to continue tracking progress on these tasks."
574 resp, err := agent.Stream(genCtx, fantasy.AgentStreamCall{
566 resp, err := agent.Stream(genCtx, fantasy.AgentStreamCall{
575 Prompt: summaryPromptText,
567 Prompt: summaryPromptText,
@@ -1101,3 +1093,18 @@ func (a *sessionAgent) workaroundProviderMediaLimitations(messages []fantasy.Mes
1102 return convertedMessages
1094 return convertedMessages
1097+// buildSummaryPrompt constructs the prompt text for session summarization.
1098+func buildSummaryPrompt(todos []session.Todo) string {
1099+ var sb strings.Builder
1100+ sb.WriteString("Provide a detailed summary of our conversation above.")
1101+ if len(todos) > 0 {
1102+ sb.WriteString("\n\n## Current Todo List\n\n")
1103+ for _, t := range todos {
1104+ fmt.Fprintf(&sb, "- [%s] %s\n", t.Status, t.Content)
1106+ sb.WriteString("\nInclude these tasks and their statuses in your summary. ")
1107+ sb.WriteString("Instruct the resuming assistant to use the `todos` tool to continue tracking progress on these tasks.")