Open source AI coding agent. Designed for large projects and real world tasks.
Go aiai-agentsai-developer-toolsai-toolsclicommand-linedeveloper-toolsgitgolanggpt-4llmopenaipolyglot-programmingterminalterminal-basedterminal-ui
include latest summary or previous assistant message in exec status model call for better results
Dane Schneider85a246bd2b41
diff --git a/app/server/model/plan/exec_status.go b/app/server/model/plan/exec_status.goindex 3d73e8c3..1d72e30b 100644--- a/app/server/model/plan/exec_status.go+++ b/app/server/model/plan/exec_status.go@@ -43,10 +43,27 @@ func (state *activeTellStreamState) execStatusShouldContinue(prompt, message str}}+ var latestSummary string++ if len(state.summaries) > 0 {+ latestSummary = state.summaries[len(state.summaries)-1].Summary+ }++ var prevAssistantMsg string+ if len(state.convo) > 1 {+ // iterate backwards from len(state.convo) - 2 to 0+ for i := len(state.convo) - 2; i >= 0; i-- {+ if state.convo[i].Role == "assistant" {+ prevAssistantMsg = state.convo[i].Message+ break+ }+ }+ }+messages := []openai.ChatCompletionMessage{{Role: openai.ChatMessageRoleSystem,- Content: prompts.GetExecStatusShouldContinue(prompt, message),+ Content: prompts.GetExecStatusShouldContinue(latestSummary, prevAssistantMsg, prompt, message),},}diff --git a/app/server/model/prompts/exec_status.go b/app/server/model/prompts/exec_status.goindex cff9b3fc..a351e4bc 100644--- a/app/server/model/prompts/exec_status.go+++ b/app/server/model/prompts/exec_status.go@@ -17,6 +17,10 @@ Assess whether AI 1 has concluded with a statement that indicates either the useIf AI 1 has outlined a clear next step necessary to finish the plan but has not executed it, the plan should continue.+You might also be supplied with a summary of the plan if one is available. If the summary is available, it will include a list of tasks to be done in the plan and whether each one has been implemented in code yet or not. If the summary is available and all tasks have been completed, the plan should not continue. If the summary is available and there are still tasks to be done, the plan should continue.++If a summary is not available, the message from AI 1 that came prior to the user's prompt might also be provided. If it is provided, consider it when determining whether the plan should continue or is complete.+You *must* call the shouldAutoContinue function with a JSON object containing the keys 'reasoning' and 'shouldContinue'.Set 'reasoning' to a string briefly and succinctly explaining your reasoning for why the plan should or should not continue, based on your instructions above.@@ -25,8 +29,15 @@ Set 'shouldContinue' to true if the plan should automatically continue based onYou must always call 'shouldAutoContinue'. Don't call any other function.`-func GetExecStatusShouldContinue(userPrompt, message string) string {+func GetExecStatusShouldContinue(summary, prevAssistantMsg, userPrompt, message string) string {s := SysExecStatusShouldContinue++ if summary != "" {+ s += "\n\n**Here is the latest summary of the plan:**\n" + summary+ } else if prevAssistantMsg != "" {+ s += "\n\n**Here is the previous message AI 1:**\n" + prevAssistantMsg+ }+if userPrompt != "" {s += "\n\n**Here is the user's prompt:**\n" + userPrompt}