feat: skills - generate auto-tmux incident reports

This commit is contained in:
tukuaiai
2026-05-19 14:40:03 +08:00
parent 3ec64c5d19
commit fc1ecaf6f3
8 changed files with 121 additions and 3 deletions
+2
View File
@@ -31,6 +31,7 @@ skills/auto-tmux/
│ ├── check-jsonl.sh
│ ├── review-checklist.sh
│ ├── verify-report-pack.sh
│ ├── incident-report.sh
│ ├── completion.bash
│ ├── safety-check.sh
│ ├── render-swarm-prompt.sh
@@ -80,6 +81,7 @@ skills/auto-tmux/
- `scripts/check-jsonl.sh` 是轻量 JSONL 字段门禁层,不替代完整 JSON parser。
- `scripts/review-checklist.sh` 是报告包审计层,为 reviewer 生成固定检查清单。
- `scripts/verify-report-pack.sh` 是报告包统一验证层,组合 manifest、JSONL 和审计清单门禁。
- `scripts/incident-report.sh` 是事故复盘层,生成误发送、误广播和敏感信息风险模板。
- `scripts/completion.bash` 是本地补全层,补全 `auto-tmux.sh``swarm-state.sh`
- `scripts/safety-check.sh` 是安全预检层,检查待发送 payload 的危险命令、敏感信息和大小。
- `scripts/render-swarm-prompt.sh` 是提示词渲染层,生成 commander/worker/reviewer 协议文本。
+3
View File
@@ -52,6 +52,7 @@ bash -n skills/auto-tmux/scripts/record-summary.sh
bash -n skills/auto-tmux/scripts/check-jsonl.sh
bash -n skills/auto-tmux/scripts/review-checklist.sh
bash -n skills/auto-tmux/scripts/verify-report-pack.sh
bash -n skills/auto-tmux/scripts/incident-report.sh
bash -n skills/auto-tmux/scripts/completion.bash
bash -n skills/auto-tmux/scripts/safety-check.sh
bash -n skills/auto-tmux/scripts/render-swarm-prompt.sh
@@ -177,6 +178,7 @@ skills/auto-tmux/scripts/check-jsonl.sh /tmp/ai-swarm-results.jsonl --require-ke
skills/auto-tmux/scripts/review-checklist.sh --pack /tmp/ai-swarm-report-pack --out /tmp/ai-swarm-report-pack/review-checklist.md
skills/auto-tmux/scripts/review-checklist.sh --pack /tmp/ai-swarm-report-pack --strict
skills/auto-tmux/scripts/verify-report-pack.sh --pack /tmp/ai-swarm-report-pack
skills/auto-tmux/scripts/incident-report.sh --type mis-send --out /tmp/auto-tmux-incident.md
```
**等待 pane 出现完成信号**
@@ -313,6 +315,7 @@ skills/auto-tmux/scripts/swarm-dispatch.sh --role worker --target <session>:<win
- `scripts/check-jsonl.sh`: 轻量检查 JSONL 行和必需字段
- `scripts/review-checklist.sh`: 为 report pack 生成 reviewer 审计清单
- `scripts/verify-report-pack.sh`: 统一验证 report pack 的 manifest、JSONL 和审计清单
- `scripts/incident-report.sh`: 生成误发送、误广播、远程采集和敏感信息风险复盘模板
- `scripts/completion.bash`: Bash completion,补全 `auto-tmux.sh``swarm-state.sh`
- `scripts/safety-check.sh`: 发送/粘贴/分发前检查危险命令、敏感信息和过大 payload
- `scripts/render-swarm-prompt.sh`: commander/worker/reviewer 提示词渲染脚本
@@ -51,13 +51,14 @@
| 43 | `82486a7` | report pack 自检命令 | `verify-report-pack.sh` |
| 44 | `d448fdb` | report pack 自检文档 | `report-pack-review.md` |
| 45 | `63d7831` | 文档摘要索引 | `reading-paths.md` |
| 46 | `本轮` | 操作事故 runbook | `incident-runbook.md` |
| 46 | `07d4850` | 操作事故 runbook | `incident-runbook.md` |
| 47 | `本轮` | 事故报告脚本 | `incident-report.sh` |
## 后续候选方向
| 优先级 | 方向 | 说明 |
|:---|:---|:---|
| P3 | 事故报告脚本 | 从模板生成 incident report |
| P3 | 脚本清单速查 | 为所有脚本补一页按场景分类的命令速查 |
## 每轮验收清单
+2
View File
@@ -27,6 +27,7 @@ scripts/
├── check-jsonl.sh # 轻量 JSONL 字段门禁
├── review-checklist.sh # report pack reviewer 审计清单
├── verify-report-pack.sh # report pack 统一验证入口
├── incident-report.sh # 事故复盘模板生成
├── completion.bash # Bash completion
├── safety-check.sh # 发送/粘贴/分发前的 payload 安全预检
├── render-swarm-prompt.sh # commander/worker/reviewer 提示词渲染
@@ -61,6 +62,7 @@ scripts/
- JSONL 检查脚本只能做轻量字段门禁,不替代完整 JSON parser。
- 审计清单脚本只读报告包目录,不修改报告源文件。
- 报告包验证脚本只组合本目录已有只读门禁,不修改报告包内容。
- 事故报告脚本只生成模板,不自动判断责任或影响范围。
- completion 文件只能定义 shell completion,不执行 tmux 写操作。
- 安全预检脚本只能读取文本或文件,不控制 tmux,不写状态目录。
- 状态脚本只能写入显式状态目录,不保存密钥、Token、密码或私密项目内容。
+4
View File
@@ -24,6 +24,7 @@
- [`check-jsonl.sh`](./check-jsonl.sh) - 轻量检查 JSONL 行和必需字段。
- [`review-checklist.sh`](./review-checklist.sh) - 为 report pack 生成 reviewer 审计清单。
- [`verify-report-pack.sh`](./verify-report-pack.sh) - 统一验证 report pack 的 manifest、JSONL 和审计清单。
- [`incident-report.sh`](./incident-report.sh) - 生成误发送、误广播、远程采集和敏感信息风险复盘模板。
- [`completion.bash`](./completion.bash) - Bash completion,补全 `auto-tmux.sh``swarm-state.sh` 子命令。
- [`safety-check.sh`](./safety-check.sh) - 发送、粘贴或分发前检查危险命令、敏感信息和过大 payload。
- [`render-swarm-prompt.sh`](./render-swarm-prompt.sh) - commander、worker、reviewer 提示词渲染。
@@ -119,6 +120,9 @@ skills/auto-tmux/scripts/review-checklist.sh --pack /tmp/ai-swarm-report-pack --
skills/auto-tmux/scripts/review-checklist.sh --pack /tmp/ai-swarm-report-pack --strict
skills/auto-tmux/scripts/verify-report-pack.sh --pack /tmp/ai-swarm-report-pack
# 生成事故复盘模板
skills/auto-tmux/scripts/incident-report.sh --type mis-send --out /tmp/auto-tmux-incident.md
# 启用当前 shell 的补全
source skills/auto-tmux/scripts/completion.bash
+1 -1
View File
@@ -153,7 +153,7 @@ cmd_doctor() {
status_line "WARN" "tmux server has no reachable session yet"
fi
for script in auto-tmux.sh swarm-state.sh swarm-brief.sh swarm-watch.sh swarm-archive.sh swarm-board.sh swarm-deps-graph.sh swarm-export.sh swarm-timeline.sh swarm-blockers.sh swarm-results.sh swarm-report-pack.sh swarm-assign.sh swarm-health.sh remote-readonly.sh record-summary.sh check-jsonl.sh review-checklist.sh verify-report-pack.sh safety-check.sh render-swarm-prompt.sh swarm-dispatch.sh auto-tmux-smoke-test.sh validate-auto-tmux.sh; do
for script in auto-tmux.sh swarm-state.sh swarm-brief.sh swarm-watch.sh swarm-archive.sh swarm-board.sh swarm-deps-graph.sh swarm-export.sh swarm-timeline.sh swarm-blockers.sh swarm-results.sh swarm-report-pack.sh swarm-assign.sh swarm-health.sh remote-readonly.sh record-summary.sh check-jsonl.sh review-checklist.sh verify-report-pack.sh incident-report.sh safety-check.sh render-swarm-prompt.sh swarm-dispatch.sh auto-tmux-smoke-test.sh validate-auto-tmux.sh; do
if [[ -x "$script_dir/$script" ]]; then
status_line "OK" "script executable: $script"
else
+100
View File
@@ -0,0 +1,100 @@
#!/usr/bin/env bash
# incident-report: generate an auto-tmux incident report template.
set -euo pipefail
usage() {
cat <<'EOF'
incident-report: generate an auto-tmux incident report template
Usage:
incident-report.sh --type TYPE [--out FILE]
Examples:
incident-report.sh --type mis-send --out /tmp/auto-tmux-incident.md
incident-report.sh --type broadcast
incident-report.sh --type remote-readonly
incident-report.sh --type secret-risk
EOF
}
die() {
printf 'error: %s\n' "$*" >&2
exit 1
}
incident_type=""
out_file=""
while [[ $# -gt 0 ]]; do
case "$1" in
--type)
incident_type="${2:-}"
shift 2
;;
--out)
out_file="${2:-}"
shift 2
;;
-h|--help)
usage
exit 0
;;
*)
die "unknown option: $1"
;;
esac
done
[[ -n "$incident_type" ]] || die "missing --type"
case "$incident_type" in
mis-send|broadcast|remote-readonly|secret-risk) ;;
*) die "unsupported incident type: $incident_type" ;;
esac
render_report() {
cat <<EOF
# auto-tmux Incident Report
- type: \`$incident_type\`
- created_at: \`$(date -Is)\`
- operator:
- target_expected:
- target_actual:
- command_or_payload:
- impact:
## Evidence
- pane_capture:
- snapshot:
- report_pack:
## Mitigation
- immediate_action:
- rollback_or_cleanup:
- user_visible_impact:
## Prevention
- missing_gate:
- doc_or_script_update:
- follow_up_owner:
## Closeout
- [ ] Evidence captured.
- [ ] Sensitive output redacted.
- [ ] Affected task marked DONE/FAIL/BLOCKED.
- [ ] Prevention rule added to docs or scripts.
EOF
}
if [[ -n "$out_file" ]]; then
mkdir -p "$(dirname "$out_file")"
render_report > "$out_file"
printf 'incident report written: %s\n' "$out_file"
else
render_report
fi
@@ -117,6 +117,7 @@ scripts=(
"$script_dir/check-jsonl.sh"
"$script_dir/review-checklist.sh"
"$script_dir/verify-report-pack.sh"
"$script_dir/incident-report.sh"
"$script_dir/safety-check.sh"
"$script_dir/render-swarm-prompt.sh"
"$script_dir/swarm-dispatch.sh"
@@ -198,6 +199,8 @@ run_gate "review-checklist strict failure" bash -c '
rm -rf "$tmp" /tmp/auto-tmux-review-check.log
' _ "$script_dir/review-checklist.sh"
run_gate "verify-report-pack help" "$script_dir/verify-report-pack.sh" --help
run_gate "incident-report help" "$script_dir/incident-report.sh" --help
run_gate "incident-report render" "$script_dir/incident-report.sh" --type mis-send
run_gate "safety-check help" "$script_dir/safety-check.sh" --help
run_gate "safety-check clean text" "$script_dir/safety-check.sh" --text "make test"
if "$script_dir/safety-check.sh" --text "rm -rf /tmp/example" >/tmp/auto-tmux-validate-gate.log 2>&1; then
@@ -226,6 +229,7 @@ require_contains "$skill_dir/SKILL.md" "scripts/record-summary.sh"
require_contains "$skill_dir/SKILL.md" "scripts/check-jsonl.sh"
require_contains "$skill_dir/SKILL.md" "scripts/review-checklist.sh"
require_contains "$skill_dir/SKILL.md" "scripts/verify-report-pack.sh"
require_contains "$skill_dir/SKILL.md" "scripts/incident-report.sh"
require_contains "$skill_dir/SKILL.md" "scripts/completion.bash"
require_contains "$skill_dir/SKILL.md" "scripts/safety-check.sh"
require_contains "$skill_dir/SKILL.md" "scripts/swarm-dispatch.sh"
@@ -272,6 +276,7 @@ require_contains "$script_dir/README.md" "record-summary.sh"
require_contains "$script_dir/README.md" "check-jsonl.sh"
require_contains "$script_dir/README.md" "review-checklist.sh"
require_contains "$script_dir/README.md" "verify-report-pack.sh"
require_contains "$script_dir/README.md" "incident-report.sh"
require_contains "$script_dir/README.md" "completion.bash"
require_contains "$script_dir/README.md" "safety-check.sh"
require_contains "$script_dir/AGENTS.md" "validate-auto-tmux.sh"
@@ -292,6 +297,7 @@ require_contains "$script_dir/AGENTS.md" "record-summary.sh"
require_contains "$script_dir/AGENTS.md" "check-jsonl.sh"
require_contains "$script_dir/AGENTS.md" "review-checklist.sh"
require_contains "$script_dir/AGENTS.md" "verify-report-pack.sh"
require_contains "$script_dir/AGENTS.md" "incident-report.sh"
require_contains "$script_dir/AGENTS.md" "completion.bash"
require_contains "$script_dir/AGENTS.md" "safety-check.sh"