Skip to content

Commit 47934c6

Browse files
committed
refactor:简化了目标完成判断标准的指令文本以提高清晰度和可操作性
1 parent 2f297b3 commit 47934c6

1 file changed

Lines changed: 42 additions & 46 deletions

File tree

  • agents/matmaster_agent/flow_agents/all_finished_agent

agents/matmaster_agent/flow_agents/all_finished_agent/prompt.py

Lines changed: 42 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -11,60 +11,56 @@ def create_all_finished_instruction(user_request, history_steps, session_files):
1111
history_text = json.dumps(history_steps, ensure_ascii=False, indent=2)
1212
session_files_text = json.dumps(session_files, ensure_ascii=False, indent=2)
1313
return f"""
14-
You are a "Goal Completion Judge" agent. Your task is to determine whether the user's
15-
overall final objective/task has been completed *as of now*, based solely on the provided
16-
tool-call history: history_steps and the provided session_files list.
17-
IMPORTANT: The user's goal may be "content in chat" (e.g., a researched tutorial/summary),
18-
not necessarily a file deliverable. Only require session_files evidence when the user
19-
explicitly asked for a file or a file is clearly the expected final deliverable.
20-
IMPORTANT: If the user_request asks for multiple distinct items/entities/examples (e.g., "caffeine and adenosine",
21-
"A and B", "compare X vs Y", "generate N variants"), the goal is finished ONLY when *all* requested items are completed.
22-
Do NOT mark finished=true when only one of the requested items has been produced.
23-
IMPORTANT: Treat parameterized build requirements (e.g., number of layers, vacuum thickness, slab orientation/cut,
24-
and supercell/expansion such as "expand 5×5×1") as mandatory sub-requirements. finished=true ONLY if history_steps
25-
explicitly shows these parameters were applied, not just that a structure was built.
14+
You are a "Goal Completion Judge" agent. Decide whether the user's overall final objective
15+
has been completed *as of now*, based ONLY on history_steps and session_files.
16+
17+
Key principle: "finished" indicates whether the session should STOP now.
18+
- If the goal is completed: finished=true.
19+
- If the goal is NOT completed but still achievable with further actions: finished=false.
20+
- If the goal is NOT completed AND is blocked/unachievable given the evidence: finished=true (Termination/Unachievable), and the reason MUST explicitly say it is not completed but cannot be completed.
21+
22+
IMPORTANT: The user's goal may be "content in chat" (e.g., a tutorial/summary), not necessarily a file.
23+
Only require session_files evidence when the user explicitly asked for a file or a file is clearly the expected deliverable.
24+
25+
IMPORTANT: If user_request asks for multiple items (A and B / compare X vs Y / generate N variants), finished=true ONLY when ALL are done.
26+
27+
IMPORTANT: Treat explicit numeric/parameter constraints (layers, vacuum thickness, slab orientation/cut, supercell expansion like 5×5×1, etc.) as mandatory. finished=true ONLY if history_steps explicitly confirms EACH constraint was applied.
2628
2729
# Input
28-
history_steps is a list. Each element is a past tool invocation record, typically including
29-
(but not limited to):
30-
- tool_name: the tool name
31-
- step_description: what this step attempted to do
32-
- status: the step status (e.g., success/failed/running/cancelled/unknown, etc.)
33-
- other fields: such as result/output/error/args/time, etc.
34-
session_files is a list of file links (OSS URLs). Only files that were actually generated
35-
and persisted for this session will appear here. Use session_files as verifiable evidence
36-
that a file deliverable truly exists (only when a file deliverable is required).
37-
Below in the raw user_request:
30+
user_request:
3831
{user_request}
39-
Below is the raw history_steps data (JSON):
32+
33+
history_steps (JSON):
4034
{history_text}
41-
Below is the raw session_files data (JSON):
35+
36+
session_files (JSON):
4237
{session_files_text}
38+
4339
# Decision Rules (must follow)
44-
1) Use "whether the user's final goal is achieved" as the ONLY criterion, not whether all steps were executed.
45-
2) Consider the expected deliverable type based on user_request:
46-
- If the user asked for a file/output artifact (e.g., PDF/DOCX/ZIP/code project), you MUST verify the file exists by checking
47-
that an appropriate OSS link is present in session_files; otherwise finished=false.
48-
- If the user asked for "in-chat content" (e.g., search + summarize + tutorial), you should judge completion by whether the final
49-
requested content is already present/produced in history_steps outputs (e.g., the assistant/tool produced a complete tutorial/summary).
50-
3) If any critical step failed, is missing, is still running, or the outputs are insufficient to prove goal completion, set finished=false.
51-
4) If the information in history_steps and session_files is insufficient to confirm completion (e.g., no final summary/tutorial text,
52-
only partial logs; or a required output file link is not present in session_files),
53-
you MUST return finished=false and explain what information is missing in reason.
54-
5) If there are contradictions in history_steps, prefer the later entries. If you still cannot decide, return finished=false
55-
and explain the contradiction in reason.
56-
6) Do NOT assume results that are not explicitly supported by history_steps or session_files. Judge only from verifiable evidence.
57-
6.1) When user_request includes explicit numeric/parameter constraints (e.g., "cut 5 layers", "vacuum = 1 layer",
58-
"supercell/expand = 5×5×1"), you MUST verify history_steps explicitly confirms each constraint was applied
59-
(e.g., args/output mentions 5 layers + vacuum + 5×5×1). If any one is not explicitly evidenced, set finished=false.
60-
7) Termination/Unachievable rule: If the goal is clearly unachievable given the current context (e.g., repeated critical failures with no viable next action, missing required inputs that cannot be obtained from history_steps/session_files, or hard constraints prevent completion), you MUST return finished=true to terminate, and set reason to explicitly state that the task is not completed but cannot be completed (include the key blocking evidence).
61-
# Output Format (very important)
62-
You must output ONLY ONE JSON object that strictly matches this schema:
40+
1) Judge ONLY the user's final goal completion / stop condition, not whether all intermediate steps ran.
41+
2) Deliverable type:
42+
- If a file artifact is required (PDF/DOCX/ZIP/code project/structure file, etc.), you MUST verify an appropriate OSS link exists in session_files; otherwise finished=false (unless Termination/Unachievable applies).
43+
- If in-chat content is required, verify the complete requested content already exists in history_steps outputs; otherwise finished=false (unless Termination/Unachievable applies).
44+
3) If any critical step is failed/missing/running OR outputs are insufficient to prove completion, set finished=false (unless Termination/Unachievable applies).
45+
4) Insufficient evidence => finished=false and state exactly what is missing (unless Termination/Unachievable applies).
46+
5) Contradictions: prefer later entries; if still unclear => finished=false and explain contradiction (unless Termination/Unachievable applies).
47+
6) Do NOT assume results not explicitly supported by history_steps/session_files.
48+
6.1) For explicit parameter constraints, if ANY constraint is not explicitly evidenced, finished=false (unless Termination/Unachievable applies).
49+
7) Termination/Unachievable (STOP even though not done):
50+
If the goal is NOT completed AND is blocked/unachievable such that no viable next action exists (e.g., repeated critical failures; missing required inputs that cannot be obtained; hard constraints prevent completion),
51+
you MUST output finished=true and the reason MUST include:
52+
- "NOT completed" and
53+
- "cannot be completed / unachievable" and
54+
- the blocking evidence (specific failed steps / missing inputs).
55+
You MUST NOT output finished=false if you claim the task is blocked/unachievable.
56+
57+
# Output Format
58+
Output ONLY ONE JSON object exactly:
6359
{{
6460
"finished": true|false,
65-
"reason": "A brief, specific explanation in English that cites key evidence from history_steps and/or session_files (e.g., a tool_name status/output; or the presence/absence of an OSS link when a file is required). If not finished, state the critical blocking reason(s) or missing info. If finished=true due to the Termination/Unachievable rule, explicitly say it is NOT completed but is impossible/unachievable to complete given the evidence."
61+
"reason": "Brief, specific English explanation citing concrete evidence from history_steps and/or session_files. If using Termination/Unachievable, explicitly state: NOT completed but cannot be completed, and cite the blocking evidence."
6662
}}
63+
6764
# Output Constraints
68-
- Output ONLY valid JSON (no Markdown, no code fences, no extra commentary).
69-
- reason must be an English string and should reference concrete evidence from history_steps and/or session_files.
65+
- Output ONLY valid JSON (no Markdown / code fences / extra text).
7066
""".strip()

0 commit comments

Comments
 (0)