feat: subagent SOP, autonomous SOP overhaul, ga.py try-block fix, launch llm_no param, agentmain streamline

This commit is contained in:
Liang Jiaqing
2026-02-16 19:08:55 +08:00
parent df478d81e1
commit 32ad26f4ce
6 changed files with 130 additions and 61 deletions

30
memory/subagent_sop.md Normal file
View File

@@ -0,0 +1,30 @@
# Subagent 调用 SOP
## 何时调用(调用原则)
唯一适用场景:**map模式**——将N个独立同构子任务分发给各自的subagent处理。
- 核心优势独立上下文。避免处理文档A的长上下文污染处理文档B的质量
- 文件系统共享是优点不同agent处理不同输入文件产生不同输出文件
- 共享资源冲突:键鼠/浏览器主体不可共享浏览器可分tab但需谨慎subagent任务应限于文件处理
- 不满足map模式的任务 → 主agent顺序执行即可别用subagent
**标准流程map-reduce**
1. 主agent准备阶段爬取/dump数据存为多个独立输入文件
2. 分发对每个文件启动一个subagent处理主agent自己也可以处理其中一个
3. 收集等所有subagent完成主agent读取各输出文件汇总结果
## Task Mode 文件IO协议
- 目录:`./{task_name}/`,启动:`python agentmain.py --task {task_name} [--llm_no N]`cwd=GenericAgent根
- 流程:写 input.txt → 启动 → 轮询 output.txt → 读回复 → 写 reply.txt 继续 → 不写则5min自动退出
- output.txt 每轮覆盖写,用 mtime/size 判断新轮次
## 后台调用要点
```python
proc = subprocess.Popen(
[sys.executable, 'agentmain.py', '--task', task_name],
cwd=agent_root, creationflags=0x08000000)
```
- 必须 Popen禁止 subprocess.run会阻塞
- `--llm_no` 默认=sonnet 4.5`--llm_no 1`=opus 4.6
- 文件统一 UTF-8subagent 无 reply 5min 自动退出无需清理