diff --git a/internal/agent/agent.go b/internal/agent/agent.go index b0c13e15f2902db6fc1af3e4b51959e6ad0bcd14..5f48ee1c7b1434af7453fa19d567d8a194c377d1 100644 --- a/internal/agent/agent.go +++ b/internal/agent/agent.go @@ -540,8 +540,18 @@ func (a *sessionAgent) Summarize(ctx context.Context, sessionID string, opts fan return err } + summaryPromptText := "Provide a detailed summary of our conversation above." + if len(currentSession.Todos) > 0 { + summaryPromptText += "\n\n## Current Todo List\n\n" + for _, t := range currentSession.Todos { + summaryPromptText += fmt.Sprintf("- [%s] %s\n", t.Status, t.Content) + } + summaryPromptText += "\nInclude these tasks and their statuses in your summary. " + summaryPromptText += "Instruct the resuming assistant to use the `todos` tool to continue tracking progress on these tasks." + } + resp, err := agent.Stream(genCtx, fantasy.AgentStreamCall{ - Prompt: "Provide a detailed summary of our conversation above.", + Prompt: summaryPromptText, Messages: aiMsgs, ProviderOptions: opts, PrepareStep: func(callContext context.Context, options fantasy.PrepareStepFunctionOptions) (_ context.Context, prepared fantasy.PrepareStepResult, err error) { diff --git a/internal/agent/templates/summary.md b/internal/agent/templates/summary.md index 937c59d7cd24ce70e511f871bf66384b457c0c41..5240c22d081fc4aff5c3f0ee46e66c32678f6ff3 100644 --- a/internal/agent/templates/summary.md +++ b/internal/agent/templates/summary.md @@ -43,6 +43,6 @@ Be specific. Don't write "implement authentication" - write: 2. Update login handler in src/routes/user.js:45 to return token 3. Test with: npm test -- auth.test.js -**Tone**: Write as if briefing a teammate taking over mid-task. Include everything they'd need to continue without asking questions. +**Tone**: Write as if briefing a teammate taking over mid-task. Include everything they'd need to continue without asking questions. No emojis ever. **Length**: No limit. Err on the side of too much detail rather than too little. Critical context is worth the tokens.