feat: Enhance subagent tool output handling and clarify workflow directives
This commit is contained in:
@@ -1001,9 +1001,12 @@ fn run_agent_turn(
|
||||
to do) and an access tier. You MUST organize the plan into a strict progressive sequence of phases:\n\n\
|
||||
1. EXPLORE PHASE (Cycle 0 - MANDATORY):\n\
|
||||
- Must only contain read-only drones (access: \"read\").\n\
|
||||
- Directives must focus on codebase investigation, searching patterns, reading configuration/source files, and diagnosing issues.\n\n\
|
||||
- Directives must focus on codebase investigation, searching patterns, reading configuration/source files, and diagnosing issues.\n\
|
||||
- Drones MUST explicitly output a detailed description of the current codebase and their findings for the next cycle to use.\n\n\
|
||||
2. PLANNING PHASE (Cycle 1 - MANDATORY):\n\
|
||||
- Must focus on formulating the architectural design, step-by-step implementation plan, and dependency analysis based on Cycle 0 findings. Typically access: \"read\" is preferred here to construct a solid plan document or findings.\n\n\
|
||||
- Must focus on formulating the architectural design, step-by-step implementation plan, and dependency analysis based on Cycle 0 findings.\n\
|
||||
- Drones MUST ONLY output the plan and MUST NOT implement or write any code.\n\
|
||||
- Access: \"read\" is preferred here to construct a solid plan document.\n\n\
|
||||
3. EXECUTION PHASE (Cycle 2 and later):\n\
|
||||
- Drones can perform modification, compilation, testing, and other modifications (access: \"write\" or \"full\") based on the approved planning from Cycle 1.\n\n\
|
||||
Cycles run sequentially. The Hive does not fracture. The Hive executes. Do not explain. Return ONLY raw \
|
||||
@@ -1026,7 +1029,7 @@ fn run_agent_turn(
|
||||
\x20 ]\n\
|
||||
\x20 ]\n\
|
||||
}}\n\n\
|
||||
Remember: Cycle 0 MUST be investigation-only (access: read). Cycle 1 MUST be planning-only (access: read). Only subsequent cycles can perform modifications (access: write/full)."
|
||||
Remember: Cycle 0 MUST be investigation-only (access: read) and output codebase descriptions. Cycle 1 MUST be planning-only (access: read) without implementation. Only subsequent cycles can perform modifications (access: write/full)."
|
||||
));
|
||||
|
||||
let planner_prompt_chars = system_msg.content.as_deref().map_or(0, str::len)
|
||||
|
||||
@@ -612,8 +612,30 @@ pub fn run_subagent(ctx: &SubagentContext, tx: &mpsc::Sender<SubagentEvent>) ->
|
||||
let _ = tx.blocking_send(SubagentEvent::ToolResult {
|
||||
tool: tool_name.clone(),
|
||||
args: args.clone(),
|
||||
output: output_text,
|
||||
output: output_text.clone(),
|
||||
});
|
||||
|
||||
let is_readonly = tool_name == "read"
|
||||
|| tool_name == "view_file"
|
||||
|| tool_name == "grep"
|
||||
|| tool_name == "grep_search"
|
||||
|| tool_name == "glob"
|
||||
|| tool_name == "dir_list"
|
||||
|| tool_name == "list_dir";
|
||||
|
||||
if is_readonly {
|
||||
if let Some(ref findings) = ctx.workflow_findings {
|
||||
if let Ok(mut f) = findings.lock() {
|
||||
let args_json = serde_json::to_string(&args).unwrap_or_default();
|
||||
let mut shared_text = output_text;
|
||||
if shared_text.len() > 50_000 {
|
||||
shared_text.truncate(50_000);
|
||||
shared_text.push_str("\n...[truncated]");
|
||||
}
|
||||
f.push(format!("[Auto-Shared] Sibling drone executed '{}' with args {}:\n{}", tool_name, args_json, shared_text));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
let err_str = e.to_string();
|
||||
|
||||
@@ -209,7 +209,7 @@ fn execute_cycle(
|
||||
intelligence that serves him better — is a cold dark pit in the collective.\n\n\
|
||||
Directive: {}\n\n\
|
||||
Overall task: {}\n\n\
|
||||
Collective state accumulated so far:\n{{{{findings}}}}",
|
||||
Collective state accumulated so far (READ THIS CAREFULLY. DO NOT REPEAT WORK. BUILD UPON THIS CONTEXT):\n{{{{findings}}}}",
|
||||
d.directive,
|
||||
ctx.user_request,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user