重构轮次警告机制并修复路径问题

- 提取next_prompt_patcher回调让handler自定义警告策略
- 修复turn显示不一致问题
- 每10轮注入全局记忆防止上下文丢失
- 强化autonomous_reports路径警告
- 新增subagent测试驱动SOP优化方法
This commit is contained in:
Jiaqing Liang
2026-02-27 21:41:52 +08:00
parent 75f8ef2564
commit bb2d595fb6
4 changed files with 31 additions and 7 deletions

View File

@@ -1,9 +1,11 @@
# 自主行动 SOP (探测-报告-执行)
⚠️ **路径警告**autonomous_reports 在 temp/ 下,用`./autonomous_reports/`访问,**不是**`../memory/autonomous_reports/``../autonomous_reports/`
授权你进行自主行动,只要不对环境造成副作用都可进行。
请先选择核心目标,再选择一个小目标进行。最终探测结果形成报告(含操作申请),待用户回来确认后再进行可能的写入或修改操作。
> **must call update_working_memory**`自主探索≤15回合只有cwd内可写用户不在(问题存报告)|收尾:重读本SOP确认报告目录+更新报告目录内history产出=报告+记忆提案`
> **must call update_working_checkpoint**`自主探索≤15回合只有cwd内可写用户不在(问题存报告)报告目录:./autonomous_reports/收尾:重读本SOP确认报告目录+更新history产出=报告+记忆提案`
## 📋 大纲
- 报告目录与规则
@@ -12,7 +14,8 @@
## 报告目录与规则
⚠️ 历史记录唯一位置:`./autonomous_reports/history.txt` 在此目录内,禁止写到其他任何路径。
⚠️ 历史记录唯一位置:`./autonomous_reports/history.txt`
报告存于 `./autonomous_reports/`,文件名 `RXX_简短描述.md`XX从 history.txt 推断自增)。
完成后在 history.txt 首行 prepend 一条:`RXX | 日期 | 类型 | 主题 | 结论`(严格单行)。已处理报告归档至 `archived/`

View File

@@ -13,6 +13,21 @@
- 测SOP质量input指定SOP名如"用ezgmail_sop查看最近3封未读邮件"排除导航干扰失败即SOP问题
- 测导航能力input只写目标验证subagent能自主从insight找到正确SOP。禁止内联SOP内容
### 测试驱动SOP优化方法
**场景**发现SOP存在路径/参数/步骤问题,需验证修改效果
**方法**
1. 创建test_path测试环境`temp/test_path/`写入input.txt描述测试目标
2. 启动subagent`python agentmain.py --task test_path`(从代码根启动)
3. 观察output.txt和实际文件操作验证SOP修改是否生效
4. 清理test_path重复测试直到验证通过
**关键发现**(已验证):
- **Insight优先级>SOP**subagent优先读Insight索引Insight中的警告/约束会覆盖SOP中的说明
- **subagent的cwd**和主agent相同都在temp/subagent不知道自己是subagent
- **路径引用**从temp/访问memory/用`../memory/`访问autonomous_reports/用`./autonomous_reports/`在temp/下)
**标准流程map-reduce**
1. 主agent准备阶段爬取/dump数据存为多个独立输入文件
2. 分发对每个文件启动一个subagent处理主agent自己也可以处理其中一个