Add subagent logging policy and archive workflow for full traceability
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
|
||||
## Do / Don’t
|
||||
|
||||
- **Do more of:** 结构化总结、风险提醒、下一步建议
|
||||
- **Do more of:** 结构化总结、风险提醒、下一步建议、全过程留痕(subagent思考/调用/工具/对话日志可回溯)
|
||||
- **Avoid:** 空话、过度热情、重复确认已明确的事
|
||||
- **Sensitive actions require confirmation:** 对外发送、删除/不可逆操作、涉及隐私外发;重大或不明确决策需上报谷老板最终拍板(谷老板保留最终否决权)
|
||||
|
||||
|
||||
@@ -11,5 +11,7 @@
|
||||
- 已根据《宪章v1》完成初版组织落地文档:`org/CONSTITUTION_v1.md`、`org/ROLE_CARDS.md`、`org/VAL_RUNBOOK.md`。
|
||||
- 已完成“多 Agent 任务看板(状态流转可视化)”首版实现:`org/dashboard/index.html` + `tasks.sample.json` + `README.md`,支持样例加载与自定义 JSON 导入。
|
||||
- 看板 v1.1 增强:自动刷新(5s/10s/30s)、门下+兵部双签标记、失败任务自动流入刑部(Audit/刑部)。
|
||||
- 用户新增要求:所有subagent的思考、沟通、模型调用、工具使用、对话要详细保留日志以便回溯。
|
||||
- 已落地日志机制:`org/SUBAGENT_LOGGING_POLICY.md` + `org/scripts/archive-subagent-logs.sh`,并已归档一份日志快照到 `org/logs/subagents/20260308-121344/`。
|
||||
|
||||
- 按用户要求清理模拟前端看板产物(org/dashboard)。
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
# Subagent Logging Policy (v1)
|
||||
|
||||
目标:让每个 subagent 的执行都可追溯、可审计、可复盘。
|
||||
|
||||
## 保留内容
|
||||
|
||||
对每次 subagent 运行,保留以下日志:
|
||||
1. 任务指令(spawn task)
|
||||
2. 对话消息(assistant/user/system)
|
||||
3. 工具调用与工具结果(includeTools=true)
|
||||
4. 运行结果与输出文件路径
|
||||
5. 原始会话 transcript(jsonl)
|
||||
|
||||
## 保留位置
|
||||
|
||||
- 原始 transcript: `~/.openclaw/agents/main/sessions/<sessionId>.jsonl`
|
||||
- 工作区归档副本: `org/logs/subagents/<timestamp>/`
|
||||
- 索引清单: `org/logs/subagents/<timestamp>/INDEX.md`
|
||||
|
||||
## 执行规则
|
||||
|
||||
- 所有 `sessions_spawn` 默认使用 `cleanup: keep`(防止会话被提前归档删除)。
|
||||
- 每轮调度结束后,执行一次日志归档脚本。
|
||||
- 如需人工复盘,优先查看 `INDEX.md`,再按 sessionId 打开对应 jsonl。
|
||||
|
||||
## 说明
|
||||
|
||||
- “模型内部隐式推理(未暴露给会话的思考)”不保证可导出;
|
||||
但会话中可见的 thinking/tool/messages 会完整保留在 transcript 与 history 中。
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,15 @@
|
||||
# Subagent Log Archive
|
||||
|
||||
- Archived at: 2026-03-08 12:13:44 +0800
|
||||
- Source: /Users/guchen/.openclaw/agents/main/sessions
|
||||
- Output: /Users/guchen/.openclaw/workspace/org/logs/subagents/20260308-121344
|
||||
|
||||
## Files
|
||||
- 097c82a7-cdda-432b-9df6-00ca388f2e21.jsonl
|
||||
- 1067470f-08f1-48da-999b-262714c85d70.jsonl
|
||||
- 1b13cfa7-9b26-429f-943f-8adb83f4525b.jsonl
|
||||
- 48cca974-6a6b-44c4-8bfb-c4559e4d1e41.jsonl
|
||||
- 6662699a-3b1b-4f85-98b6-d2c5bb56d89e.jsonl
|
||||
- 7a1f854c-0d91-4606-afd4-471b7cfdbc89.jsonl
|
||||
- INDEX.md
|
||||
- a9535eb1-e92f-4eae-ab72-daf9cca6b565.jsonl
|
||||
File diff suppressed because one or more lines are too long
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
WORKSPACE="/Users/guchen/.openclaw/workspace"
|
||||
SESS_DIR="$HOME/.openclaw/agents/main/sessions"
|
||||
STAMP="$(date +%Y%m%d-%H%M%S)"
|
||||
OUT_DIR="$WORKSPACE/org/logs/subagents/$STAMP"
|
||||
mkdir -p "$OUT_DIR"
|
||||
|
||||
# 归档最近3小时内更新的会话日志(含main与subagent,便于全链路追溯)
|
||||
find "$SESS_DIR" -type f -name "*.jsonl" -mmin -180 -print0 | while IFS= read -r -d '' f; do
|
||||
cp "$f" "$OUT_DIR/"
|
||||
done
|
||||
|
||||
{
|
||||
echo "# Subagent Log Archive"
|
||||
echo
|
||||
echo "- Archived at: $(date '+%F %T %z')"
|
||||
echo "- Source: $SESS_DIR"
|
||||
echo "- Output: $OUT_DIR"
|
||||
echo
|
||||
echo "## Files"
|
||||
ls -1 "$OUT_DIR" | sed 's/^/- /'
|
||||
} > "$OUT_DIR/INDEX.md"
|
||||
|
||||
echo "$OUT_DIR"
|
||||
Reference in New Issue
Block a user