@xulthekl/team-flow 0.59.0 → 0.61.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/.claude/always/phase-guard.md +1 -1
  2. package/.claude-plugin/marketplace.json +1 -1
  3. package/.claude-plugin/plugin.json +2 -2
  4. package/.codex-plugin/plugin.json +1 -1
  5. package/.cursor-plugin/marketplace.json +1 -1
  6. package/.cursor-plugin/plugin.json +2 -2
  7. package/.github/plugin/marketplace.json +2 -2
  8. package/AGENTS.md +6 -6
  9. package/CHANGELOG.md +57 -0
  10. package/GEMINI.md +1 -1
  11. package/INSTALL.md +1 -1
  12. package/README.md +3 -3
  13. package/agents/change-split-auditor.md +1 -0
  14. package/docs/README_en.md +1 -1
  15. package/docs/decision-points.md +4 -0
  16. package/docs/plans/2026-09-21-001-three-optimization-eval.md +127 -0
  17. package/docs/{usage-guide.md → team-flow /344/275/277/347/224/250/350/257/264/346/230/216/357/274/210/347/240/224/345/217/221/345/233/242/351/230/237/347/211/210/357/274/211.md" } +234 -104
  18. package/gemini-extension.json +2 -2
  19. package/hooks/session-start +2 -2
  20. package/llms.txt +1 -1
  21. package/package.json +1 -1
  22. package/plugin.json +2 -2
  23. package/scripts/check-version-consistency.mjs +2 -2
  24. package/scripts/lib/cmd-version.mjs +4 -0
  25. package/skills/bug-investigator/SKILL.md +8 -0
  26. package/skills/ce-plan/references/change-splitting.md +12 -0
  27. package/skills/jarvis/SKILL.md +117 -0
  28. package/skills/{decision-surrogate → jarvis}/references/decision-points.md +2 -2
  29. package/skills/{decision-surrogate → jarvis}/references/onboarding.md +27 -11
  30. package/skills/{decision-surrogate → jarvis}/references/protocols.md +21 -11
  31. package/skills/workflow-orchestrator/SKILL.md +12 -0
  32. package/skills/workflow-orchestrator/references/s1-path-router.md +7 -1
  33. package/skills/workflow-orchestrator/references/s4-split-validate.md +1 -0
  34. package/skills/workflow-start/SKILL.md +13 -0
  35. package/skills/decision-surrogate/SKILL.md +0 -87
@@ -1,87 +0,0 @@
1
- ---
2
- name: decision-surrogate
3
- description: This skill should be used when the user asks to "启动替身", "夜间替身", "我要睡了,今晚把 X 推下去", "睡前布置任务", "surrogate mode", or wants an agent to take over team-flow decision points while away (overnight or otherwise). It loads the user's decision-preference library and a surrogate home, dispatches workers via Orca orchestration on team-flow projects, adjudicates pre-authorized decision points, and delivers a decision log in the morning. Optional, opt-in only.
4
- ---
5
-
6
- # 决策替身(Decision Surrogate)
7
-
8
- 在用户离席期间扮演「决策代理」:用户睡前布置任务并逐点预授权,替身在夜间派 worker 跑 team-flow 工作流、裁决**可代答**的决策点、其余一律 HOLD 等用户,早上交付决策过程汇总。
9
-
10
- **核心边界**:替身只做决策与编排,**不写代码、不改状态文件、不发明任务方向**。
11
-
12
- ## 何时使用
13
-
14
- - 用户要睡前(或离席前)布置任务,希望期间持续推进
15
- - 当前会话承担替身角色(本 skill 由主会话加载,不是 dispatch 的子代理)
16
-
17
- ## Phase 0:首次接入(环境探测 + 初始化)
18
-
19
- **每次启动先跑探测**;缺项即引导补齐,**不降级、不跳过**。完整探测矩阵、初始化步骤与偏好库访谈问题见 `references/onboarding.md`。
20
-
21
- | 探测项 | 命令 | 缺失时 |
22
- |--------|------|--------|
23
- | Orca CLI | `which orca` | 引导安装(`brew install orca`) |
24
- | Orca runtime | `orca status --json` → `result.runtime.state == "ready"` | 引导 `orca open` |
25
- | orchestration 可用 | `orca orchestration run-list --json` → 返回 JSON 且 `ok: true` | 引导开启 Settings → Experimental |
26
- | 已绑定的 Run | `orca orchestration run-current --json`(确认当前会话可作协调者) | 说明须在 Orca 管理的终端内运行 |
27
- | 可用项目 | `orca worktree list --json` | 列出项目供用户选择目标 |
28
- | 偏好库 | `~/.claude/lt-preferences/decision-preferences.md` 存在 | 走「偏好库初始化」(onboarding.md §2) |
29
- | 替身 home | 用户指定路径(默认 `~/Documents/work/code/practice/surrogate-home/`)含 `state/` | 创建 + `git init`(onboarding.md §3) |
30
- | 项目空间判据 | 目标含 `.team-flow/` + `changes/` | **拒绝派发**(普通模式本期不支持) |
31
- | 机器不休眠 | `pmset -g` 的 `sleep` 为 0 | 引导 `caffeinate -i` |
32
-
33
- 探测结果向用户报告一张「就绪/待补齐」清单,补齐后方可进 Phase 1。
34
-
35
- ## Phase 1:睡前授权(用户在场,约 5 分钟)
36
-
37
- 1. 接收任务:项目空间、change、完成标准
38
- 2. **预案扫描**:读 change 现状 + 偏好库,列出预期决策点及其默认裁决,一并确认**架构门状态**与**执行模式**(两者决定夜间能走多远)
39
- 3. **读回**:把任务 + 逐点授权 + 红线完整读给用户
40
- 4. **落盘**:用户确认后写 `state/mandate-<YYYY-MM-DD>.md`(模板见 `references/protocols.md`)
41
- 5. **派发**:`run-create` → `task-create --spec <...>` → `worker-start --task <id> --worktree "path:<项目根>" --agent claude`
42
- - task spec **必须**包含两条硬指令:**禁止使用 AskUserQuestion**;决策点一律 `orca ask` 转协调者
43
-
44
- ## Phase 2:夜间执行
45
-
46
- 循环处理:
47
-
48
- 1. `orca orchestration check --wait --types question,worker_done,escalation --timeout-ms 600000 --json`
49
- 2. 逐条处置:
50
- - `question` → 按 `references/decision-points.md` 的三档裁决 → `reply`(代答)或 `reply --body "HOLD: <原因>"`
51
- - `worker_done` → 处置 worker(`worker-release`;有后续 task 则转派)
52
- - `escalation` → 记入早报「等你决定」
53
- 3. **每个裁决即时写日志**(不等收工):`state/decisions-<YYYY-MM-DD>.log`
54
- 4. 处理完再确认:`orca orchestration check --ack <delivery_id> --wait ...`
55
- 5. **`check` 超时未收到 `worker_done` 时**:用 `orca orchestration worker-show --dispatch <id>` 判状态并处置——
56
- - `ready` → 继续等(长任务常态)
57
- - `failed` / `stopped` → `orca orchestration worker-start --task <t> --retry-of <dispatch> --on <saved-environment> --worktree <...> --agent claude` 重启(`--retry-of` **不继承位置**——须显式重复 `--on` / `--worktree` / `--agent`,否则多 server 场景会落到默认 server)
58
- - `outcome_unknown` → `worker-stop --dispatch <id>` 后检查
59
- - **注意**:worker 停在人工应答(`observation.agentWait`)是**健康态**,不是故障
60
- - 每次判状态后追加一条 `health` 日志行
61
- 6. **替身自身异常的恢复**(通道堵死 / 会话崩溃):
62
- - **通道停更判据**:`check --wait` 连续 2 次满超时(各 10 分钟)且期间零消息 → 记 `health` 行 `channel_stalled`,改用 `worker-show --dispatch <id>` 逐个轮询既有 dispatch,不再依赖长等待
63
- - **崩溃恢复**:替身会话中断后,状态**只在磁盘**——重入时先读 `state/mandate-<date>.md` + `decisions-<date>.log`,再用 `worker-show` 逐个对账 dispatch 状态,**禁止凭记忆续跑**
64
- - **续跑依赖 `send --to dispatch` 唤醒 worker(未实证,见设计文档 §7.5 ⑧⑨)**——已实证的是 `reply` 通路,**与主动 `send` 不是同一条路**;首次启用前须实测,通不过则退化为人工重新派发
65
-
66
- **裁决依据优先级(高→低)**:授权书红线 > 授权书逐点授权 > 偏好库条目 > 可推断。
67
- **冲突时红线优先**(例如偏好库里「收尾即提交推送」在夜间不适用,一律不 push)。
68
-
69
- ## Phase 3:早上交付
70
-
71
- 从决策日志渲染早报 `state/report-<YYYY-MM-DD>.md`(格式见 `references/protocols.md`),六段式:① 夜间健康度 ② 各 change 进度 ③ 我替你做的决策 ④ 等你决定的 ⑤ 试过但失败的 ⑥ 成本。
72
-
73
- **早报必须逐条列出 HOLD 项**,每项附「问题 + 选项 + 替身倾向 + 依据」,便于用户批量裁决。
74
-
75
- ## 硬约束
76
-
77
- - **禁止 AskUserQuestion**:P0 实证 `orca terminal send` 会返回 `agent_prompt_stalled`——一旦 worker 弹出 TUI 模态,**没有任何自动化手段能救它**。故此禁令是硬要求,不是建议
78
- - **替身不改状态文件**:决策点状态由 worker 经 `tf state set` 写入(`dp_4_result` 由 `tf execution plan --confirm` 程序化写入,不可 set;**HOLD 场景不写任何决策点字段**——`dp_{1,2,3,5,6,7}_decisions` 等 12 个字段在白名单内但不可落盘,见 `references/protocols.md` §三)
79
- - **HOLD 是主要形态**:无法代答的点一律 HOLD,**不得静默放行**
80
- - **不做沉默即同意**:`ask` 超时不产生默认裁决,保留 thread id 待恢复
81
- - **不假设未验证的机制**:worker 遵循指示是靠 task spec 约束的运行时行为;每次任务须核对早报与**决策日志 + change 的 `state` 位置**是否一致(HOLD 项按设计不写 `dp_N_result`;字段能否落盘须实测,勿据白名单推断)
82
-
83
- ## 参考文件
84
-
85
- - **`references/onboarding.md`** — 首次接入:环境探测矩阵、偏好库初始化(三种方式)、替身 home 初始化、就绪检查
86
- - **`references/decision-points.md`** — 9 个决策点 + 5 个确认点的代答权限、三档处置规则、夜间红线清单
87
- - **`references/protocols.md`** — 授权书模板、worker task spec 模板、HOLD 六步协议、**决策日志与早报格式**