MCPcopy Create free account
hub / github.com/aurora-develop/aurora / FinalNudge

Function FinalNudge

internal/toolcall/prompt.go:182–214  ·  view source on GitHub ↗

FinalNudge 是给模型末尾追加的"先做这个,别分析 sandbox"系统指令。 用 lastRole 决定上下文: - tool : 提醒把 tool 输出当 ground truth,继续调用或总结 - user : 强制模型立刻发 (不思考、不描述环境) - 其他 : 返回空

(tools []official.Tool, messages []official.APIMessage)

Source from the content-addressed store, hash-verified

180// - user : 强制模型立刻发 <tool_call>(不思考、不描述环境)
181// - 其他 : 返回空
182func FinalNudge(tools []official.Tool, messages []official.APIMessage) string {
183 if len(tools) == 0 || len(messages) == 0 {
184 return ""
185 }
186 last := messages[len(messages)-1]
187 switch last.Role {
188 case "tool", "function":
189 // 拿不到具体的 tool 名(API 没有 tool_call_id 映射),用一个通用表达
190 return "\n[SYSTEM INSTRUCTION: The 'Tool (...)' block above is the REAL output produced by running your tool call on the user's actual machine. Treat it as ground truth and as the current state of the workspace. Continue the task based strictly on it: call another tool using the exact <tool_call>{...}</tool_call> format if you need more information, or give your final answer. NEVER claim a directory or file does not exist, or that you are in a different/isolated environment, when it appears in the output above.]"
191 case "user":
192 wd := ExtractWorkingDir(messages)
193 example := FirstToolCallExample(tools, wd)
194 wdPart := ""
195 if wd != "" {
196 wdPart = fmt.Sprintf(" (working directory: %s)", wd)
197 }
198 var sb strings.Builder
199 sb.WriteString("\n[SYSTEM INSTRUCTION — READ CAREFULLY:\n")
200 sb.WriteString("You are an autonomous coding agent. In THIS session you have NO Python sandbox, NO Code Interpreter, and NO filesystem of your own. There is no environment for you to 'look around' — attempting it finds nothing and is always WRONG. The ONLY way to see or touch the user's files is to emit a <tool_call>. The tool runs on the user's REAL machine")
201 sb.WriteString(wdPart)
202 sb.WriteString(" and its result comes back to you on the next turn.\n")
203 sb.WriteString("Your reply to this message MUST be EXACTLY one or more <tool_call> blocks and NOTHING ELSE — no prose, no explanation, no description of any filesystem, no conclusions. Begin your reply immediately with the characters '<tool_call>'. Do NOT claim that anything exists or does not exist until you have called a tool and seen its result.\n")
204 if example != "" {
205 sb.WriteString("Make your first call now, for example:\n")
206 sb.WriteString(example)
207 } else {
208 sb.WriteString("Make your first tool call now.")
209 }
210 sb.WriteString("]\n")
211 return sb.String()
212 }
213 return ""
214}

Callers 4

ConvertAPIRequestFunction · 0.92

Calls 3

ExtractWorkingDirFunction · 0.85
FirstToolCallExampleFunction · 0.85
StringMethod · 0.80

Tested by 3