non-verbose output: exhaust stream silently, yield content only; add plan_sop; subagent_sop cleanup
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -55,6 +55,9 @@ memory/*
|
|||||||
# Subagent SOP
|
# Subagent SOP
|
||||||
!memory/subagent_sop.md
|
!memory/subagent_sop.md
|
||||||
|
|
||||||
|
# Plan SOP
|
||||||
|
!memory/plan_sop.md
|
||||||
|
|
||||||
# ADB UI tool
|
# ADB UI tool
|
||||||
!memory/adb_ui.py
|
!memory/adb_ui.py
|
||||||
|
|
||||||
|
|||||||
@@ -54,8 +54,12 @@ def agent_runner_loop(client, system_prompt, user_input, handler, tools_schema,
|
|||||||
yield f"**LLM Running (Turn {turn+1}) ...**\n\n"
|
yield f"**LLM Running (Turn {turn+1}) ...**\n\n"
|
||||||
if (turn+1) % 10 == 0: client.last_tools = '' # 每10轮重置一次工具描述,避免上下文过大导致的模型性能下降
|
if (turn+1) % 10 == 0: client.last_tools = '' # 每10轮重置一次工具描述,避免上下文过大导致的模型性能下降
|
||||||
response_gen = client.chat(messages=messages, tools=tools_schema)
|
response_gen = client.chat(messages=messages, tools=tools_schema)
|
||||||
response = yield from response_gen
|
if verbose:
|
||||||
if verbose: yield '\n\n'
|
response = yield from response_gen
|
||||||
|
yield '\n\n'
|
||||||
|
else:
|
||||||
|
response = exhaust(response_gen)
|
||||||
|
yield response.content
|
||||||
|
|
||||||
if not response.tool_calls:
|
if not response.tool_calls:
|
||||||
tool_name, args = 'no_tool', {}
|
tool_name, args = 'no_tool', {}
|
||||||
|
|||||||
17
memory/plan_sop.md
Normal file
17
memory/plan_sop.md
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# Plan Mode SOP
|
||||||
|
|
||||||
|
## 拆分
|
||||||
|
1. 分析任务,必要时先读相关SOP确定子步骤
|
||||||
|
2. 拆成可验证的原子步骤,风险步前置
|
||||||
|
|
||||||
|
## 写入 checkpoint
|
||||||
|
将以下写入 working checkpoint(忽略长度限制):
|
||||||
|
|
||||||
|
=== PLAN ===
|
||||||
|
[ ] 步骤1
|
||||||
|
[ ] 步骤2
|
||||||
|
...
|
||||||
|
=== PLAN RULES ===
|
||||||
|
- 每完成/跳过一步,重新 update working checkpoint
|
||||||
|
- 任何 checkpoint update 必须保留 PLAN
|
||||||
|
================
|
||||||
@@ -22,8 +22,9 @@ proc = subprocess.Popen(
|
|||||||
|
|
||||||
- 必须 Popen,禁止 subprocess.run(会阻塞)
|
- 必须 Popen,禁止 subprocess.run(会阻塞)
|
||||||
- stdout.log/stderr.log 用于调试subagent卡死、LLM调用失败等问题
|
- stdout.log/stderr.log 用于调试subagent卡死、LLM调用失败等问题
|
||||||
- `--llm_no` 默认=sonnet 4.5,`--llm_no 1`=opus 4.6
|
|
||||||
- 文件统一 UTF-8,subagent 无 reply 5min 自动退出无需清理
|
- 文件统一 UTF-8,subagent 无 reply 5min 自动退出无需清理
|
||||||
|
- **禁止合并启动+轮询到同一个code_run**——会阻塞自己。启动Popen立即返回,下一轮再poll output.txt。这是并行的前提
|
||||||
|
- 新建/复用任务目录时,先删除旧 output*.txt(否则会读到上次结果误判完成)
|
||||||
|
|
||||||
## 场景1:测试模式 - 行为验证
|
## 场景1:测试模式 - 行为验证
|
||||||
**用途**:观察agent真实行为,修正RULES/L2/L3/SOP
|
**用途**:观察agent真实行为,修正RULES/L2/L3/SOP
|
||||||
|
|||||||
Reference in New Issue
Block a user