@pennixrv/trellis 0.7.1-beta.9 → 0.7.2-beta.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 (231) hide show
  1. package/dist/cli/index.js +4 -4
  2. package/dist/cli/index.js.map +1 -1
  3. package/dist/commands/init.d.ts.map +1 -1
  4. package/dist/commands/init.js +39 -26
  5. package/dist/commands/init.js.map +1 -1
  6. package/dist/commands/teamwork/adapters/acp.d.ts +20 -0
  7. package/dist/commands/teamwork/adapters/acp.d.ts.map +1 -0
  8. package/dist/commands/teamwork/adapters/acp.js +268 -0
  9. package/dist/commands/teamwork/adapters/acp.js.map +1 -0
  10. package/dist/commands/teamwork/adapters/claude.d.ts +1 -0
  11. package/dist/commands/teamwork/adapters/claude.d.ts.map +1 -1
  12. package/dist/commands/teamwork/adapters/claude.js +5 -0
  13. package/dist/commands/teamwork/adapters/claude.js.map +1 -1
  14. package/dist/commands/teamwork/adapters/codex.d.ts +3 -2
  15. package/dist/commands/teamwork/adapters/codex.d.ts.map +1 -1
  16. package/dist/commands/teamwork/adapters/codex.js +14 -15
  17. package/dist/commands/teamwork/adapters/codex.js.map +1 -1
  18. package/dist/commands/teamwork/adapters/index.d.ts +23 -1
  19. package/dist/commands/teamwork/adapters/index.d.ts.map +1 -1
  20. package/dist/commands/teamwork/adapters/index.js +163 -24
  21. package/dist/commands/teamwork/adapters/index.js.map +1 -1
  22. package/dist/commands/teamwork/agent-loader.d.ts +2 -1
  23. package/dist/commands/teamwork/agent-loader.d.ts.map +1 -1
  24. package/dist/commands/teamwork/agent-loader.js +2 -1
  25. package/dist/commands/teamwork/agent-loader.js.map +1 -1
  26. package/dist/commands/teamwork/artifact.d.ts +33 -10
  27. package/dist/commands/teamwork/artifact.d.ts.map +1 -1
  28. package/dist/commands/teamwork/artifact.js +182 -50
  29. package/dist/commands/teamwork/artifact.js.map +1 -1
  30. package/dist/commands/teamwork/batch-reservation.d.ts +16 -0
  31. package/dist/commands/teamwork/batch-reservation.d.ts.map +1 -0
  32. package/dist/commands/teamwork/batch-reservation.js +43 -0
  33. package/dist/commands/teamwork/batch-reservation.js.map +1 -0
  34. package/dist/commands/teamwork/batch.d.ts +22 -0
  35. package/dist/commands/teamwork/batch.d.ts.map +1 -0
  36. package/dist/commands/teamwork/batch.js +394 -0
  37. package/dist/commands/teamwork/batch.js.map +1 -0
  38. package/dist/commands/teamwork/context-loader.d.ts +1 -1
  39. package/dist/commands/teamwork/context-loader.d.ts.map +1 -1
  40. package/dist/commands/teamwork/context-loader.js +19 -6
  41. package/dist/commands/teamwork/context-loader.js.map +1 -1
  42. package/dist/commands/teamwork/coordination.d.ts +88 -0
  43. package/dist/commands/teamwork/coordination.d.ts.map +1 -0
  44. package/dist/commands/teamwork/coordination.js +153 -0
  45. package/dist/commands/teamwork/coordination.js.map +1 -0
  46. package/dist/commands/teamwork/coordinator.d.ts +17 -3
  47. package/dist/commands/teamwork/coordinator.d.ts.map +1 -1
  48. package/dist/commands/teamwork/coordinator.js +772 -289
  49. package/dist/commands/teamwork/coordinator.js.map +1 -1
  50. package/dist/commands/teamwork/create.d.ts +1 -0
  51. package/dist/commands/teamwork/create.d.ts.map +1 -1
  52. package/dist/commands/teamwork/create.js +2 -1
  53. package/dist/commands/teamwork/create.js.map +1 -1
  54. package/dist/commands/teamwork/dev-parse-trace.d.ts +2 -1
  55. package/dist/commands/teamwork/dev-parse-trace.d.ts.map +1 -1
  56. package/dist/commands/teamwork/dev-parse-trace.js +2 -0
  57. package/dist/commands/teamwork/dev-parse-trace.js.map +1 -1
  58. package/dist/commands/teamwork/foreground-wait.d.ts +6 -0
  59. package/dist/commands/teamwork/foreground-wait.d.ts.map +1 -0
  60. package/dist/commands/teamwork/foreground-wait.js +65 -0
  61. package/dist/commands/teamwork/foreground-wait.js.map +1 -0
  62. package/dist/commands/teamwork/guard.d.ts +2 -2
  63. package/dist/commands/teamwork/guard.d.ts.map +1 -1
  64. package/dist/commands/teamwork/guard.js +23 -5
  65. package/dist/commands/teamwork/guard.js.map +1 -1
  66. package/dist/commands/teamwork/index.d.ts.map +1 -1
  67. package/dist/commands/teamwork/index.js +139 -10
  68. package/dist/commands/teamwork/index.js.map +1 -1
  69. package/dist/commands/teamwork/kill.d.ts +2 -0
  70. package/dist/commands/teamwork/kill.d.ts.map +1 -1
  71. package/dist/commands/teamwork/kill.js +79 -38
  72. package/dist/commands/teamwork/kill.js.map +1 -1
  73. package/dist/commands/teamwork/messages.d.ts.map +1 -1
  74. package/dist/commands/teamwork/messages.js +3 -0
  75. package/dist/commands/teamwork/messages.js.map +1 -1
  76. package/dist/commands/teamwork/plan.d.ts +22 -0
  77. package/dist/commands/teamwork/plan.d.ts.map +1 -0
  78. package/dist/commands/teamwork/plan.js +288 -0
  79. package/dist/commands/teamwork/plan.js.map +1 -0
  80. package/dist/commands/teamwork/process-identity.d.ts +3 -0
  81. package/dist/commands/teamwork/process-identity.d.ts.map +1 -0
  82. package/dist/commands/teamwork/process-identity.js +24 -0
  83. package/dist/commands/teamwork/process-identity.js.map +1 -0
  84. package/dist/commands/teamwork/profiles.d.ts +43 -6
  85. package/dist/commands/teamwork/profiles.d.ts.map +1 -1
  86. package/dist/commands/teamwork/profiles.js +138 -110
  87. package/dist/commands/teamwork/profiles.js.map +1 -1
  88. package/dist/commands/teamwork/prompt.d.ts +4 -0
  89. package/dist/commands/teamwork/prompt.d.ts.map +1 -0
  90. package/dist/commands/teamwork/prompt.js +33 -0
  91. package/dist/commands/teamwork/prompt.js.map +1 -0
  92. package/dist/commands/teamwork/result.d.ts +54 -0
  93. package/dist/commands/teamwork/result.d.ts.map +1 -0
  94. package/dist/commands/teamwork/result.js +94 -0
  95. package/dist/commands/teamwork/result.js.map +1 -0
  96. package/dist/commands/teamwork/rm.d.ts.map +1 -1
  97. package/dist/commands/teamwork/rm.js +64 -64
  98. package/dist/commands/teamwork/rm.js.map +1 -1
  99. package/dist/commands/teamwork/run.d.ts +5 -0
  100. package/dist/commands/teamwork/run.d.ts.map +1 -1
  101. package/dist/commands/teamwork/run.js +120 -24
  102. package/dist/commands/teamwork/run.js.map +1 -1
  103. package/dist/commands/teamwork/runtime.d.ts +9 -0
  104. package/dist/commands/teamwork/runtime.d.ts.map +1 -0
  105. package/dist/commands/teamwork/runtime.js +372 -0
  106. package/dist/commands/teamwork/runtime.js.map +1 -0
  107. package/dist/commands/teamwork/send.d.ts +1 -0
  108. package/dist/commands/teamwork/send.d.ts.map +1 -1
  109. package/dist/commands/teamwork/send.js +2 -1
  110. package/dist/commands/teamwork/send.js.map +1 -1
  111. package/dist/commands/teamwork/spawn.d.ts +10 -3
  112. package/dist/commands/teamwork/spawn.d.ts.map +1 -1
  113. package/dist/commands/teamwork/spawn.js +41 -29
  114. package/dist/commands/teamwork/spawn.js.map +1 -1
  115. package/dist/commands/teamwork/store/lock.js +28 -4
  116. package/dist/commands/teamwork/store/lock.js.map +1 -1
  117. package/dist/commands/teamwork/supervisor/inbox.d.ts +1 -0
  118. package/dist/commands/teamwork/supervisor/inbox.d.ts.map +1 -1
  119. package/dist/commands/teamwork/supervisor/inbox.js +28 -9
  120. package/dist/commands/teamwork/supervisor/inbox.js.map +1 -1
  121. package/dist/commands/teamwork/supervisor/stdout.d.ts.map +1 -1
  122. package/dist/commands/teamwork/supervisor/stdout.js +2 -3
  123. package/dist/commands/teamwork/supervisor/stdout.js.map +1 -1
  124. package/dist/commands/teamwork/supervisor/warning.d.ts.map +1 -1
  125. package/dist/commands/teamwork/supervisor/warning.js +2 -3
  126. package/dist/commands/teamwork/supervisor/warning.js.map +1 -1
  127. package/dist/commands/teamwork/supervisor.d.ts +5 -0
  128. package/dist/commands/teamwork/supervisor.d.ts.map +1 -1
  129. package/dist/commands/teamwork/supervisor.js +21 -12
  130. package/dist/commands/teamwork/supervisor.js.map +1 -1
  131. package/dist/commands/teamwork/teammate-adapters.d.ts +0 -3
  132. package/dist/commands/teamwork/teammate-adapters.d.ts.map +1 -1
  133. package/dist/commands/teamwork/teammate-adapters.js +9 -54
  134. package/dist/commands/teamwork/teammate-adapters.js.map +1 -1
  135. package/dist/commands/teamwork/teammate-config.d.ts +5 -1
  136. package/dist/commands/teamwork/teammate-config.d.ts.map +1 -1
  137. package/dist/commands/teamwork/teammate-config.js +62 -19
  138. package/dist/commands/teamwork/teammate-config.js.map +1 -1
  139. package/dist/commands/teamwork/teammate-launch.d.ts +14 -4
  140. package/dist/commands/teamwork/teammate-launch.d.ts.map +1 -1
  141. package/dist/commands/teamwork/teammate-launch.js +129 -20
  142. package/dist/commands/teamwork/teammate-launch.js.map +1 -1
  143. package/dist/commands/teamwork/wait.d.ts +2 -0
  144. package/dist/commands/teamwork/wait.d.ts.map +1 -1
  145. package/dist/commands/teamwork/wait.js +44 -3
  146. package/dist/commands/teamwork/wait.js.map +1 -1
  147. package/dist/commands/update.d.ts.map +1 -1
  148. package/dist/commands/update.js +4 -3
  149. package/dist/commands/update.js.map +1 -1
  150. package/dist/configurators/workflow.d.ts.map +1 -1
  151. package/dist/configurators/workflow.js +14 -32
  152. package/dist/configurators/workflow.js.map +1 -1
  153. package/dist/migrations/manifests/0.7.1-beta.10.json +9 -0
  154. package/dist/migrations/manifests/0.7.1-beta.11.json +9 -0
  155. package/dist/migrations/manifests/0.7.1-beta.12.json +9 -0
  156. package/dist/migrations/manifests/0.7.1-beta.13.json +9 -0
  157. package/dist/migrations/manifests/0.7.1-beta.14.json +11 -0
  158. package/dist/migrations/manifests/0.7.1-beta.15.json +9 -0
  159. package/dist/migrations/manifests/0.7.1-beta.16.json +9 -0
  160. package/dist/migrations/manifests/0.7.1-beta.17.json +9 -0
  161. package/dist/migrations/manifests/0.7.1-beta.18.json +9 -0
  162. package/dist/migrations/manifests/0.7.1-beta.19.json +9 -0
  163. package/dist/migrations/manifests/0.7.1-beta.6.json +1 -1
  164. package/dist/migrations/manifests/0.7.2-beta.0.json +11 -0
  165. package/dist/templates/codex/hooks/session-start.py +14 -11
  166. package/dist/templates/codex/hooks.json +10 -0
  167. package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/multi-agent-teamwork.md +14 -2
  168. package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/task-system.md +1 -1
  169. package/dist/templates/common/bundled-skills/trellis-solution-design-and-convergence/workflow.md +4 -0
  170. package/dist/templates/common/bundled-skills/trellis-task-implementation/workflow.md +6 -0
  171. package/dist/templates/common/bundled-skills/trellis-teamwork/SKILL.md +14 -4
  172. package/dist/templates/common/bundled-skills/trellis-teamwork/references/coordination-modes.md +31 -2
  173. package/dist/templates/common/bundled-skills/trellis-teamwork/references/teammate-configuration-matrix.md +37 -31
  174. package/dist/templates/common/bundled-skills/trellis-teamwork/references/teammate-processes.md +94 -24
  175. package/dist/templates/common/bundled-skills/trellis-teamwork/references/teamwork-plan-construction.md +112 -20
  176. package/dist/templates/copilot/hooks/session-start.py +14 -11
  177. package/dist/templates/copilot/index.d.ts +1 -6
  178. package/dist/templates/copilot/index.d.ts.map +1 -1
  179. package/dist/templates/copilot/index.js +1 -14
  180. package/dist/templates/copilot/index.js.map +1 -1
  181. package/dist/templates/markdown/spec/backend/index.md.txt +4 -35
  182. package/dist/templates/markdown/spec/frontend/index.md.txt +4 -36
  183. package/dist/templates/omp/extensions/trellis/index.ts.txt +1 -1
  184. package/dist/templates/pi/extensions/trellis/index.ts.txt +17 -1
  185. package/dist/templates/shared-hooks/guard-teamwork-wait.py +53 -0
  186. package/dist/templates/shared-hooks/index.d.ts +1 -1
  187. package/dist/templates/shared-hooks/index.d.ts.map +1 -1
  188. package/dist/templates/shared-hooks/index.js +1 -0
  189. package/dist/templates/shared-hooks/index.js.map +1 -1
  190. package/dist/templates/shared-hooks/inject-workflow-state.py +8 -3
  191. package/dist/templates/shared-hooks/session-start.py +16 -12
  192. package/dist/templates/trellis/agents/delegated-worktree-primary-agent.md +9 -0
  193. package/dist/templates/trellis/agents/profiles/architecture.md +9 -0
  194. package/dist/templates/trellis/agents/profiles/diagnosis.md +9 -0
  195. package/dist/templates/trellis/agents/profiles/exploration.md +9 -0
  196. package/dist/templates/trellis/agents/profiles/research.md +9 -0
  197. package/dist/templates/trellis/agents/profiles/review.md +9 -0
  198. package/dist/templates/trellis/agents/profiles/verification.md +9 -0
  199. package/dist/templates/trellis/agents/teammate-profiles.json +56 -4
  200. package/dist/templates/trellis/agents/teammate.md +4 -63
  201. package/dist/templates/trellis/config.yaml +2 -5
  202. package/dist/templates/trellis/index.d.ts +1 -0
  203. package/dist/templates/trellis/index.d.ts.map +1 -1
  204. package/dist/templates/trellis/index.js +16 -4
  205. package/dist/templates/trellis/index.js.map +1 -1
  206. package/dist/templates/trellis/scripts/common/task_continuity.py +54 -28
  207. package/dist/templates/trellis/scripts/common/task_store.py +7 -2
  208. package/dist/templates/trellis/scripts/common/task_workflow.py +270 -18
  209. package/dist/templates/trellis/scripts/task.py +27 -3
  210. package/dist/templates/trellis/teamwork.json +10 -0
  211. package/dist/templates/trellis/workflow.md +7 -0
  212. package/dist/utils/asset-backup.d.ts.map +1 -1
  213. package/dist/utils/asset-backup.js +10 -4
  214. package/dist/utils/asset-backup.js.map +1 -1
  215. package/dist/utils/template-fetcher.d.ts +4 -19
  216. package/dist/utils/template-fetcher.d.ts.map +1 -1
  217. package/dist/utils/template-fetcher.js +9 -45
  218. package/dist/utils/template-fetcher.js.map +1 -1
  219. package/package.json +3 -2
  220. package/dist/templates/copilot/prompts/before-dev.prompt.md +0 -39
  221. package/dist/templates/copilot/prompts/brainstorm.prompt.md +0 -13
  222. package/dist/templates/copilot/prompts/break-loop.prompt.md +0 -129
  223. package/dist/templates/copilot/prompts/check-cross-layer.prompt.md +0 -170
  224. package/dist/templates/copilot/prompts/check.prompt.md +0 -110
  225. package/dist/templates/copilot/prompts/create-command.prompt.md +0 -116
  226. package/dist/templates/copilot/prompts/finish-work.prompt.md +0 -22
  227. package/dist/templates/copilot/prompts/integrate-skill.prompt.md +0 -223
  228. package/dist/templates/copilot/prompts/onboard.prompt.md +0 -362
  229. package/dist/templates/copilot/prompts/record-session.prompt.md +0 -58
  230. package/dist/templates/copilot/prompts/start.prompt.md +0 -65
  231. package/dist/templates/copilot/prompts/update-spec.prompt.md +0 -358
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": "0.7.1-beta.18",
3
+ "description": "统一 Teamwork 输入分层与结构化结果,修复单次调用终态与诊断",
4
+ "breaking": false,
5
+ "recommendMigrate": false,
6
+ "changelog": "Role initialization and mode-specific result contracts are separated from task/reference data. New content reports use schema 2; run, batch and wait provide a normalized machine result. Historical frozen reports remain readable. Tool permissions automatically allow; Codex defaults to no sandbox. Input preflight, supervisor failures, failed-attempt identity, report artifacts and diagnostics are verified.",
7
+ "migrations": [],
8
+ "notes": "Run trellis update to refresh Teamwork role cards and Skill references. Agents must request --json; default human/event views remain available. Content shape validation does not perform main-agent semantic acceptance. Existing frozen launches retain their report contract."
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": "0.7.1-beta.19",
3
+ "description": "Centralize Teamwork capacity policy and enable multi-advisor consultations",
4
+ "breaking": false,
5
+ "recommendMigrate": false,
6
+ "changelog": "Mode capacity defaults 8/3/3, member defaults 1/3/3, shared budget 8; schema-2 policy with diagnosed legacy/environment compatibility; advisor supports 1–3 assignments.",
7
+ "migrations": [],
8
+ "notes": "Run trellis update for generated schema-2 policy and Skills. Review customized schema-1 policy before migrating; historical plans remain unchanged."
9
+ }
@@ -5,6 +5,6 @@
5
5
  "recommendMigrate": true,
6
6
  "changelog": "任务保留 planning、in_progress、completed、cancelled 四个状态;目录随原生生命周期操作同步迁移。完成任务按月份保存,取消任务单独保存。任务发现、父子关系、上下文、状态栏、初始化和平台模板统一使用新布局;旧布局需要显式迁移。",
7
7
  "migrations": [],
8
- "migrationGuide": "## 任务目录迁移\n\n先运行 trellis update --migrate 更新脚本与工作流,并审查自定义文件冲突。更新模板不会自动移动任务。随后运行 python3 .trellis/scripts/task.py migrate-layout 预览,确认后运行 python3 .trellis/scripts/task.py migrate-layout --apply。planning、in_progress、cancelled 任务进入同名子目录;completed 任务进入 completed/YYYY-MM,旧 archive 的月份保持不变。task.json.status 是唯一状态事实,迁移不授予历史任务实施权限,也不重写历史正文或交接包。\n\n无效 JSON、重名、未关闭的委派资源、待交接所有权或不安全路径会阻止整个迁移。先处理明确的输入问题,再重新预览。发生中断时运行 python3 .trellis/scripts/task.py migrate-layout --recover,核验后重新预览;不要手工移动目录或删除事务记录。迁移会同步改写机器引用和当前会话指针;若连续性摘要变化,按原生 phase 接纳和 transfer reconcile 流程重新收敛当前所有权,保留历史交接摘要。",
8
+ "migrationGuide": "## 任务目录迁移\n\n先运行 trellis update --migrate 更新脚本与工作流,并审查自定义文件冲突。更新模板不会自动移动任务。随后运行 python3 .trellis/scripts/task.py migrate-layout 预览,确认后运行 python3 .trellis/scripts/task.py migrate-layout --apply。planning、in_progress、cancelled 任务进入同名子目录;completed 任务进入 completed/YYYY-MM,旧 archive 的月份保持不变。task.json.status 是唯一状态事实,迁移不授予历史任务实施权限,也不重写历史正文或交接包。\n\n无效 JSON、重名、未关闭的委派资源、待交接所有权或不安全路径会阻止整个迁移。先处理明确的输入问题,再重新预览。发生中断时运行 python3 .trellis/scripts/task.py migrate-layout --recover,核验后重新预览;不要手工移动目录或删除事务记录。迁移会同步改写机器引用和当前会话指针;若连续性摘要变化,按原生 phase 接纳和 capture 重新核对当前事实。handoff ownership 在 consume 后完成转移,后续普通任务修改不更新交接代次;需要查看现场时使用只读 transfer status --include-current,保留历史交接摘要。",
9
9
  "aiInstructions": "完整检查迁移预览、四种状态及月份分布、任务数量、父子关系和当前会话路径。只修复有证据的历史输入错误,不把 archive 中未完成任务伪造为 completed。使用原生生命周期入口完成或取消任务,不手写运行状态。保护项目配置、历史正文、二进制附件和不可变交接包。迁移后再次预览应为空,并运行 task.py list、current、phase show 和项目检查验证现场。"
10
10
  }
@@ -0,0 +1,11 @@
1
+ {
2
+ "version": "0.7.2-beta.0",
3
+ "description": "收敛 fork 全面审查:Teamwork 恢复、证据、容量、委派与多宿主资产",
4
+ "breaking": true,
5
+ "recommendMigrate": true,
6
+ "changelog": "保留全部尝试证据并提供显式清理;修复实际容量和冻结配置核验;增加证据驱动 reconcile 与失败子集 retry;增加 Codex 等待护栏;补齐委派合同绑定、退役和 ownership recover;修复多宿主阶段提示、受管文件备份及跨生命周期初始化;退休隐式 Marketplace spec 来源,保留显式 registry;修复 npm 异步重试。",
7
+ "migrationGuide": "使用 beta 渠道精确升级到 0.7.2-beta.0,并运行 trellis update。保持用户自定义 spec 和 config;schema-2 项目忽略退休 YAML 容量键,需按实际冲突合并。默认初始化仅提供规范索引、指南和基于源码的 bootstrap;预制规范必须明确指定 --registry。原计划和旧 schema 报告兼容读取;需要本轮冻结配置和重试合同的新批次请通过 plan 构造器生成。保留全部 attempt 报告和 worklog,清理须使用 cleanup-artifacts 的预览摘要。",
8
+ "aiInstructions": "不要覆盖自定义规范或重开旧终态批次。使用原生 reconcile/retry/cleanup-artifacts/delegate-bind/delegate-reconcile/transfer recover;未知进程保持围栏。CLI 控制 FIFO,主代理静默续接同一等待句柄;Hook 不保证阻止普通模型消息或宿主唤醒。",
9
+ "migrations": [],
10
+ "notes": "保持 beta 渠道,0.7.2-beta.0 高于 stable 0.7.1;latest 标签保持不变。"
11
+ }
@@ -232,8 +232,7 @@ def _get_task_status(trellis_dir: Path, hook_input: dict) -> str:
232
232
  if not active.task_path:
233
233
  return (
234
234
  "Status: NO ACTIVE TASK\n"
235
- "Next: Classify the current turn and ask for task-creation consent "
236
- "before creating any Trellis task."
235
+ "Next: Route through trellis-request-intake using the existing authorization and taskless contract."
237
236
  )
238
237
 
239
238
  task_ref = active.task_path
@@ -245,12 +244,10 @@ def _get_task_status(trellis_dir: Path, hook_input: dict) -> str:
245
244
  )
246
245
 
247
246
  task_json_path = task_dir / "task.json"
248
- task_data: dict = {}
249
- if task_json_path.is_file():
250
- try:
251
- task_data = json.loads(task_json_path.read_text(encoding="utf-8"))
252
- except (json.JSONDecodeError, PermissionError):
253
- pass # Optional task metadata; fall back to generic status.
247
+ from common.io import read_json_checked # type: ignore[import-not-found]
248
+ task_data, _reason = read_json_checked(task_json_path)
249
+ if task_data is None or task_data.get("status") not in ("planning", "in_progress", "completed", "cancelled"):
250
+ return f"Status: TASK_ERROR\nTask: {task_ref}\nNext: Repair the existing task record through its owner before continuing; do not create a replacement task."
254
251
 
255
252
  task_title = task_data.get("title", task_ref)
256
253
  task_status = task_data.get("status", "unknown")
@@ -380,13 +377,15 @@ def _build_compact_current_state(
380
377
  active = _resolve_active_task(trellis_dir, hook_input)
381
378
  if active.task_path:
382
379
  task_dir = _resolve_task_dir(trellis_dir, active.task_path)
383
- status = "unknown"
380
+ status = "task_error"
384
381
  task_json = task_dir / "task.json"
385
382
  if task_json.is_file():
386
383
  try:
387
384
  data = json.loads(task_json.read_text(encoding="utf-8"))
388
385
  if isinstance(data, dict):
389
- status = str(data.get("status") or "unknown")
386
+ value = data.get("status")
387
+ if value in ("planning", "in_progress", "completed", "cancelled"):
388
+ status = value
390
389
  except (json.JSONDecodeError, OSError):
391
390
  pass # Optional task metadata; fall back to generic status.
392
391
  lines.append(f"Current task: {_repo_relative(repo_root, task_dir)}; status={status}.")
@@ -504,11 +503,15 @@ def main() -> None:
504
503
  hook_input = json.loads(sys.stdin.read())
505
504
  if not isinstance(hook_input, dict):
506
505
  hook_input = {}
507
- project_dir = Path(_normalize_windows_shell_path(hook_input.get("cwd", "."))).resolve()
506
+ raw_cwd = hook_input.get("cwd")
507
+ project_dir = Path(_normalize_windows_shell_path(raw_cwd if isinstance(raw_cwd, str) and raw_cwd else ".")).resolve()
508
508
  except (json.JSONDecodeError, KeyError):
509
509
  hook_input = {}
510
510
  project_dir = Path(".").resolve()
511
511
 
512
+ project_dir = next((candidate for candidate in (project_dir, *project_dir.parents) if (candidate / ".trellis").is_dir()), None)
513
+ if project_dir is None or not (project_dir / ".trellis" / "scripts" / "common" / "active_task.py").is_file():
514
+ return
512
515
  configure_project_encoding(project_dir)
513
516
 
514
517
  trellis_dir = project_dir / ".trellis"
@@ -36,6 +36,16 @@
36
36
  }
37
37
  ],
38
38
  "PreToolUse": [
39
+ {
40
+ "matcher": ".*",
41
+ "hooks": [
42
+ {
43
+ "type": "command",
44
+ "command": "{{PYTHON_CMD}} -X utf8 .codex/hooks/guard-teamwork-wait.py",
45
+ "timeout": 15
46
+ }
47
+ ]
48
+ },
39
49
  {
40
50
  "matcher": "Edit|Write",
41
51
  "hooks": [
@@ -8,7 +8,9 @@
8
8
  | --- | --- |
9
9
  | `~/.trellis/teamwork/<project>/<session>/events.jsonl` | Durable Teamwork Session event log. |
10
10
  | `.trellis/agents/teammate.md` | Generic behavior card loaded for a teammate. |
11
- | `.trellis/agents/teammate-profiles.json` | Provider and execution profiles. |
11
+ | `.trellis/agents/teammate-profiles.json` | Schema-2 professional profiles and named execution candidates. |
12
+ | `.trellis/agents/profiles/*.md` | Six professional role cards combined with the common card. |
13
+ | `.trellis/teamwork.json` | Coordination mode and member-count defaults. |
12
14
  | `.trellis/config.yaml` (`teamwork.*`) | Teammate concurrency and process guard settings. |
13
15
  | `packages/core/src/teamwork/` | Reusable Teamwork Session event and storage APIs. |
14
16
  | `packages/cli/src/commands/teamwork/` | CLI commands, provider adapters, and process supervision. |
@@ -25,7 +27,17 @@ The storage root defaults to `~/.trellis/teamwork`; `TRELLIS_TEAMWORK_ROOT` over
25
27
 
26
28
  ## Configuration
27
29
 
28
- The project configuration supports `teamwork.teammate.max_concurrency` and `teamwork.teammate_guard.idle_timeout`, `max_live_teammates`, and `non_batch_reserved`. Defaults and CLI overrides are defined by the current Trellis CLI; read `packages/cli/src/commands/teamwork/teammate-config.ts` before changing them.
30
+ The schema-2 `.trellis/teamwork.json` owns mode member defaults, mode concurrency limits, and the shared live-process budget and reservation. Defaults are members 1/3/3, concurrency 8/3/3, live budget 8, and reservation 0. YAML retains `teamwork.teammate_guard.idle_timeout`; legacy YAML capacity applies only before schema-2 migration and is otherwise ignored with diagnostics. Runtime `maxConcurrency` is a resolved value, not an independent configuration. Read `coordination.ts` and `teammate-config.ts` before changing this policy.
31
+
32
+ `teamwork config` resolves project defaults. `teamwork plan` freezes profile,
33
+ configuration, instructions and evidence into schema-2 plan/brief artifacts;
34
+ `teamwork batch --task` connects the foreground coordinator to Codex app-server,
35
+ Claude CLI, Copilot ACP or DSH ACP. Claims and content reports are schema 2.
36
+ An unresolved batch keeps a durable project capacity reservation, including
37
+ after coordinator exit. The guard and session cleanup preserve that evidence.
38
+ Role read-only and history-use requirements are behavioral contracts; runtime
39
+ capabilities do not claim filesystem or memory isolation. Teamwork is independent
40
+ of Paseo workspaces, Git worktrees and source-writing delegated agents.
29
41
 
30
42
  ## Related entry points
31
43
 
@@ -33,7 +33,7 @@ The read-only trellis task progress command summarizes planning, in_progress, co
33
33
 
34
34
  旧平铺目录和 `archive/YYYY-MM` 只能作为显式迁移输入。先运行 `task.py migrate-layout` 预览,再使用 `--apply`;已完成 archive 任务保留原月份,非终态任务按真实状态归位,不伪造完成。`--recover` 恢复未完成事务。重复名称、无效 JSON、符号链接、未知执行资源或交接所有权冲突会阻止迁移;不跳过记录。
35
35
 
36
- 移动同步 JSON/JSONL 机器引用、会话指针及 runtime 哈希索引;终态操作在同一事务中清除本任务 runtime。历史正文和正式交接包保留。内容绑定的接受证据或 continuity digest 失效后,通过原生重新接受、capture、目标会话 reconcile 核对,不静默重授历史授权。文档中的 `<task-dir>` 指包含状态及必要月份的真实任务相对路径。
36
+ 移动同步 JSON/JSONL 机器引用、会话指针及 runtime 哈希索引;终态操作在同一事务中清除本任务 runtime。历史正文和正式交接包保留。内容绑定的接受证据或 continuity digest 失效后,通过原生重新接受和 capture 核对,不静默重授历史授权。handoff ownership 在 `consume` 后完成转移;后续普通任务修改不更新交接代次,需要查看现场时使用只读 `transfer status --include-current`。文档中的 `<task-dir>` 指包含状态及必要月份的真实任务相对路径。
37
37
 
38
38
  ## Context manifests
39
39
 
@@ -6,6 +6,10 @@
6
6
 
7
7
  判断当前结果:分析交付形成 `analysis_conclusion`;不继续形成 `no_go`;延期形成带责任方、触发条件和恢复位置的 `deferred`,留在解决方案设计与收敛阶段;实施路线形成 `implementation_contract`,明确目标、范围和接受条件,并按路线需要补足实施与核验信息。只有交付物具有独立实施或集成边界时才拆分工作包,并说明推进和协作所需的依赖、顺序、责任或集成信息;单一交付不人为拆分工作包。解决方案设计与收敛阶段的结果接受与实施授权分开记录;只有合同及明确批准均有效时,Trellis CLI 才允许进入任务实施与测试验证阶段。
8
8
 
9
+ 合同结果已接受、实施尚未授权时,发现需要返修,应通过 `task.py phase return` 回到本阶段或更早受影响阶段,记录理由和证据。受影响的接受与授权随之失效;修订后重新接受当前产物,再核验实施授权。
10
+
11
+ 接受 `implementation_contract` 前,在合同中建立 `## 验收覆盖` 表,表头为 `接受条件 | 工作包 | Owner | 验证入口 | 交付证据 | 停止条件`。逐条映射已接受条件,核对实际源码 owner、可运行验证、证据落点和停止条件;单一工作包可以覆盖多条条件。CLI 仅检查表结构及非空内容,不能代替语义审查。目标、合同、决策与执行记录分别使用明确的文件引用,执行细节追加到 execution 或 research,避免修改已接受的上游合同。
12
+
9
13
  逐项决定回答后,将已决目标、候选依据、接口与数据流、owner、依赖顺序、实施和验证,以及适用的迁移、发布、资源和失败恢复安排组织为一个完整方案。核对需求覆盖、跨产物一致性、可实施性和可验收性;有净收益时使用有界反例或压力测试,先修复可查缺口。向用户展示可识别的整体方案和实质剩余取舍后,再记录当前 revision 的接受及实施授权。逐项答复不自动等于整体批准;用户已充分明确批准整体方案时不重复索取。目标或候选问题回最早受影响阶段,局部方案问题在本阶段解决,不增设外部封口状态。
10
14
 
11
15
  研究、原型和协作证据写回现有阶段产物、research 或 execution 自然落点,注明来源与版本、事实和假设、适用性、限制及决定影响。证据足够即停止扩搜;工具、报告或模板不能替代用户决定和 Trellis 原生接受事实。
@@ -2,6 +2,10 @@
2
2
 
3
3
  开始前核验当前 `implementation_contract`、实施授权、路线 revision、必要依赖和执行基线。使用 `trellis-before-dev` 读取目标仓库实际适用的规范;按组件 owner 合同选择主工作树或已批准的独立写入路线。调用项目任务 `start` 只在实施授权有效时将任务置为 `in_progress`。
4
4
 
5
+ 实施阶段为 `blocked` 或 `waiting_user` 时,先解决阻塞并经原生 `phase resume` 恢复,再重新核验准入。`delegate-start` 核验父任务已有的 ownership 围栏和子任务状态;存在未消费交接、当前会话不符合已有 ownership 记录,或子任务已完成、取消时,不启动或复用委派执行。没有 ownership 记录的任务不具备默认会话独占保护。
6
+
7
+ 父授权有效后,用 `task.py delegate-bind <child>` 绑定子 PRD、角色、Git base、分支和结果路径,再用 `delegate-start` 启动。输入漂移须先核对是否仍在父授权范围内,再重新绑定。失联现场先用 `delegate-reconcile` 预览,证据充分时才显式 `--execute --reason ... --approval-ref ...` 核销,不能直接覆盖旧映射。
8
+
5
9
  按合同的依赖和优先级选取当前工作包,实施满足目标的最小变更,并运行与风险和影响相称的局部验证。主工作树主代理核对来源、revision、Git 基线、差异和结果后接受工作包。多包任务按合同集成;单一交付不人为拆分。Trellis Teamwork 仅用于冻结计划下的只读比较或评议,不能改写任务状态或接受实施结果。实际写入委派依父任务规定使用 Trellis 受控入口与 Paseo;各组件源码仍在 owner 仓库内修改。
6
10
 
7
11
  局部失败、暂时不可用或当前状态已满足接受条件时,先在任务实施与测试验证阶段中处理。依赖或资源暂不可用且现场安全时记录恢复条件;未授权不产生外部副作用;未知现场先停止并核验。合同允许未运行验证且风险可接受时,记录原因、影响和替代证据。替代路线若改变授权、成本、隐私或接受条件,回到解决方案设计与收敛阶段;目标、范围变化按影响回到目标探索与需求核对阶段或决策空间构造与归并阶段。只有合同范围内工作包均已接受、适用必需验证完成或有有效未运行处置、按范围和风险需要的集成验证通过,才将交付候选交由交付审查与现场收尾阶段;仅当路线实际创建或委派资源时,才核验其处置事实。
@@ -26,4 +30,6 @@ flowchart TD
26
30
 
27
31
  ### 委派、回退与收敛
28
32
 
33
+ 合同不变的局部修复在当前活动阶段处理;需要撤销实施或交付接受事实时,使用 `phase return --return-kind execution_rework` 并提供原因、证据及目标阶段。仅在需求、合同摘要、路线和依赖仍有效时保留实施授权;CLI 拒绝时核对真实失效原因,不重复索取已有效的用户决定。合同实质变化使用默认 `contract_change` 回到最早受影响阶段并重新接受、授权。终态任务先经独立的 `reopen` 恢复到 `planning`,再操作工作流阶段;重开不复用旧授权。
34
+
29
35
  回退使用当前 owner 的 Git 和资源合同,不覆盖无关改动,也不删除仍需核验的现场。只有当前合同无法安全覆盖目标、授权、依赖、基线、接受条件或停止条件的变化时,才回退到最早受影响阶段。结束任务实施与测试验证阶段前,记录适用验证结果、未运行处置、合同差异和未结发现;仅当路线实际创建或委派资源时,记录其处置状态。
@@ -22,6 +22,7 @@ trellis --version
22
22
  trellis teamwork --help
23
23
  trellis teamwork list --all
24
24
  trellis teamwork list --scope global --all
25
+ trellis teamwork config
25
26
  ```
26
27
 
27
28
  If the user names a Teamwork Session or thread, inspect it before asking for
@@ -38,8 +39,9 @@ trellis teamwork context list <session> --scope global --thread <thread>
38
39
  | User intent | Read |
39
40
  |---|---|
40
41
  | `general`: bounded research, review, or verification assignments | `references/teamwork-plan-construction.md`, then `references/coordination-modes.md` |
41
- | Advisor: one bounded consultation | `references/coordination-modes.md` |
42
- | `committee`: parallel assessment by two or three distinct lenses | `references/coordination-modes.md` |
42
+ | Advisor: one to three bounded consultations | `references/coordination-modes.md`, then `references/teamwork-plan-construction.md` |
43
+ | `committee`: parallel assessment by two or three distinct lenses | `references/coordination-modes.md`, then `references/teamwork-plan-construction.md` |
44
+ | Profile, model, provider, reasoning effort, or role-card configuration | `references/teammate-configuration-matrix.md` |
43
45
  | “和 codex/claude 讨论一下”, “brainstorm with another agent” | `references/teamwork-plan-construction.md`, then `references/coordination-modes.md` |
44
46
  | “派 teammate 做研究或验证”, “让 agent review”, “spawn a worker” | `references/teamwork-plan-construction.md`, then `references/teammate-processes.md` |
45
47
  | “开 issue 区 / topic 群 / changelog / board”, “make a forum” | `references/teamwork-plan-construction.md` |
@@ -50,7 +52,15 @@ trellis teamwork context list <session> --scope global --thread <thread>
50
52
  ## Core Rules
51
53
 
52
54
  - Teammates provide research, review, verification, evidence, and advice under a role contract; they do not implement product code. Coding tools or provider permission modes do not grant that role authority. Return results in the assigned format and let the coordinator review them.
53
- - `general`, `advisor`, and `committee` are coordination modes, independent from `run`, batch execution, and forum sessions. The current `batch` CLI is reserved and refuses dispatch; see the plan reference for the current boundary.
55
+ - `general`, `advisor`, and `committee` are coordination modes, independent from profiles, providers, `run`, batch execution, and forum sessions. Read project defaults with `teamwork config`; construct a frozen plan with `teamwork plan` and execute it with `teamwork batch --task <task-dir>`.
56
+ - For a managed batch, invoke one foreground `teamwork batch --json` command and wait for its receipt. The CLI owns FIFO admission, capacity, provider waits, retries, cancellation, report validation, and settlement; the main agent must not schedule per-assignment waits or retries.
57
+ - If the host yields that call, silently continue its original handle. Do not emit repetitive progress, query status, start unrelated work, or create another batch. Host continuation is not CLI scheduling. Codex ships a native wait projection and PreToolUse guard for supported tool events; neither prevents model wake-ups or ordinary model messages. After a lost coordinator, use native `teamwork reconcile` and retain reservations until process exit is proven.
58
+ - Agent/program callers must use `run --json`, `batch --json`, or `wait --json --from <worker>` for final results. Default run text and default wait events are compatibility/operator views. Read `execution`, every `reports[].validation` and content status, then perform semantic review; `done`, exit zero, `complete`, and `ALL_ACCEPTED` alone do not accept a task result. `semanticValidation: not_run` explicitly leaves that decision to the main agent.
59
+ - Tool permissions are automatically allowed; the default Codex launch has no sandbox. Source/Git, memory, and delegation boundaries are prompt obligations. Do not add tool/path permission gates or describe the role as technical isolation.
60
+ - Initialization carries common/professional rules and the mode-specific result contract. Task messages carry task data, acceptance and exact identity/path references. Context manifests may choose inline, required full reading, or on-demand references; reference text never becomes system instructions. ACP has user content only and cannot claim system priority.
61
+ - A batch runtime continuation waits on the same provider process under the same frozen deadline. It does not send another provider prompt or consume a full-attempt retry. A live `teamwork wait` host-tool continuation is a separate interactive-session workflow.
62
+ - Select one of the six professional profiles and one of its named configurations. For multiple teammates, consider the second and third candidates and record the selection reason; using the same configuration is allowed. See the configuration matrix reference before constructing a new plan.
63
+ - Teamwork does not create or operate Paseo workspaces, Git worktrees, or source-writing implementation agents. Those mechanisms remain independent.
54
64
  - New forum Teamwork Sessions use `--type forum`. A `thread` is one item inside a forum Teamwork Session.
55
65
  - Use `--context-file` / `--context-raw` and `trellis teamwork context add/delete/list`.
56
66
  - Use `--stdin` or `--text-file` for long messages. Do not put long mixed Chinese/English text in the positional shell argument.
@@ -58,7 +68,7 @@ trellis teamwork context list <session> --scope global --thread <thread>
58
68
  - `--as` is the speaker or worker handle, depending on the command. Use explicit, stable names when multiple agents or sessions are involved.
59
69
  - `--scope project` (default) operates on the current cwd's project bucket; `--scope global` operates on the shared `__global__` bucket. Pick scope deliberately — a global board is invisible from project listings unless `--scope global` is passed.
60
70
  - For exploratory discussion, choose distinct questions and pressure-test unresolved assumptions. Continue only while another exchange can change the decision or its evidence; do not require a fixed number of rounds or relabel a confirmation as new evidence.
61
- - **Dispatcher wait pattern**: use `--kind done` / `--kind turn_finished` (Trellis-emitted system events), not a user `--tag` as the completion signal. Tags are labels, not runtime completion events.
71
+ - **Dispatcher wait pattern**: use `wait --json --from <worker>` for a final content report. Operator event waits may use `--kind done` / `--kind turn_finished`; tags are labels, not runtime completion events. Resume an outstanding host continuation before any other host action.
62
72
  - Teamwork Sessions are event-sourced. Do not parse `events.jsonl` first; use `forum`, `thread`, `messages --thread`, and `context list`.
63
73
  - `@pennixrv/trellis-core` owns reusable Teamwork Session/thread state, event append, sequence allocation, context/title projection, reducers, and task helpers. The CLI owns flags, terminal rendering, prompts, teammate lifecycle, and process exits.
64
74
  - Teamwork plan construction belongs to the current phase coordinator. Teamwork validates and executes a frozen plan; it does not select the task phase, change task status, or create a second task state machine.
@@ -3,6 +3,29 @@
3
3
  The plan's `coordination_mode` selects the call shape. It is independent from
4
4
  the teammate role, execution profile, and Teamwork Session type.
5
5
 
6
+ All modes use the same schema-2 content report and common `--json` result
7
+ envelope. Mode selection does not waive result validation or main-agent
8
+ semantic review. It also does not transfer FIFO or process control to a model.
9
+
10
+ Project defaults live in `.trellis/teamwork.json`: general defaults to one
11
+ member, advisor to three, and committee to three. Schema 2 also owns the mode
12
+ concurrency limits (general 8, advisor 3, committee 3) and the shared live-process
13
+ budget (8, with 0 reserved for non-batch work). Read them with
14
+ `trellis teamwork config --mode <mode>`. The coordinator uses `defaultMembers`
15
+ when composing assignments; it must write each member explicitly. The runtime
16
+ does not invent assignments or silently duplicate one to reach the default.
17
+ Changing defaults affects only newly constructed plans. Advisor must have one to
18
+ three members, committee two or three, and general one or more within capacity.
19
+
20
+ Member count guides plan composition; concurrency limits simultaneous work.
21
+ Effective capacity is bounded by the selected mode, requested capacity, shared
22
+ live budget after reservations, and verified host capability. Existing live
23
+ workers and batch reservations share admission control. Environment overrides
24
+ are explicit and reported in `capacityPolicy.diagnostics`. Legacy schema 1 and
25
+ YAML capacity remain readable for compatibility. Schema 2 ignores legacy YAML
26
+ capacity keys with a diagnostic, so a stale YAML limit of 1 cannot silently
27
+ override the new policy. YAML retains idle-cleanup settings.
28
+
6
29
  ## `general`
7
30
 
8
31
  Use general coordination for one or more independent assignments. Each
@@ -12,8 +35,8 @@ each assignment independently.
12
35
 
13
36
  ## `advisor`
14
37
 
15
- Use advisor coordination for one bounded consultation. The plan contains
16
- exactly one assignment and its result is advice for the current coordinator.
38
+ Use advisor coordination for one to three bounded consultations. Each advisor
39
+ returns independent advice for the current coordinator; the default is three.
17
40
  The result still carries a source digest and acceptance evidence and does not
18
41
  change the task or phase by itself.
19
42
 
@@ -26,6 +49,12 @@ independently authored reports; the coordinator compares them after they finish.
26
49
  Members may cite the same authoritative sources. Distinct lenses do not
27
50
  guarantee independent evidence or require different providers, models, or profiles.
28
51
 
52
+ `lens` is the member's “本次关注点”, not another role directory. It is optional
53
+ in general and advisor mode. Committee members receive the same task, evidence
54
+ and acceptance contract; they must not read peer reports before submitting
55
+ their own. Profiles and configurations may differ, with a recorded selection
56
+ reason. Paseo workspace and Git worktree collaboration are independent.
57
+
29
58
  Committee members do not debate with one another, run a consensus loop, or use
30
59
  a directional counter relationship. If a question does not need independent
31
60
  lenses, use general coordination or advisor coordination instead.
@@ -1,36 +1,42 @@
1
- # Teammate configuration matrix
1
+ # Teammate 配置矩阵
2
2
 
3
- The candidate source for teammate execution settings is the teammate
4
- configuration matrix. It is a selection input, not a new role system. A
5
- profile may provide a default provider and model plus provider-specific
6
- options. The frozen plan stores the selected execution values in the
7
- `Teammate Execution Configuration` snapshot so a running batch is unaffected
8
- by later matrix changes.
3
+ 配置由项目文件持有,运行时读取;下表解释默认选择,不替代实际文件。
9
4
 
10
- The tuple is:
5
+ | 文件 | 职责 |
6
+ | --- | --- |
7
+ | `.trellis/agents/teammate-profiles.json`,schema 2 | `default_profile`;每个 profile 的 `role`、`default_configuration` 和 2–3 套命名 `configurations` |
8
+ | `.trellis/agents/teammate.md` | 通用角色、只读职责和结果合同 |
9
+ | `.trellis/agents/profiles/<profile>.md` | 精确专业角色卡;普通 Markdown,通过 Trellis 注入,不注册宿主原生角色 |
10
+ | `.trellis/teamwork.json`,schema 2 | `default_mode`;各模式的 `default_members`、`max_concurrency`;`resources` 中的共享进程预算与非 batch 预留 |
11
+ | `.trellis/config.yaml` 的 `teamwork.teammate_guard.idle_timeout` | 空闲清理;旧容量键仅在未迁移到 schema 2 时兼容读取 |
11
12
 
12
- ```text
13
- role + provider + optional profile + model + reasoning effort + options
13
+ 默认成员数为 general 1、advisor 3、committee 3;默认并发上限分别为 8、3、3,共享存活进程预算为 8,非 batch 预留为 0。成员数用于构造计划,不要求同时运行;有效并发还受显式请求、共享预算和宿主能力约束。schema 2 不再叠加旧 YAML 容量上限,兼容读取和环境覆盖均在 `capacityPolicy.diagnostics` 中说明。`capacityPolicy` 是解析结果,不是另一套配置。
14
+
15
+ 每套执行配置包含 `provider`、`model`,可选 `reasoning_effort` 和适配器支持的 `options`。上下文长度沿用 provider 默认,不配置 token 或预算机制。`teammate` 是内部执行者类型,公开计划不填写 `role_id`;`lens` 只表示成员的“本次关注点”。
16
+
17
+ | Profile | 工作职责 | 默认配置 | 第二候选 | 第三候选 |
18
+ | --- | --- | --- | --- | --- |
19
+ | `architecture` | 架构、接口、依赖与取舍 | codex / gpt-6.1-sol / xhigh | copilot / gpt-6.1-sol / xhigh | copilot / claude-opus-5.5 / xhigh |
20
+ | `review` | 基于当前差异的正确性审查 | codex / gpt-6.1-sol / high | copilot / gpt-6.1-sol / high | copilot / claude-opus-5.5 / high |
21
+ | `research` | 外部资料、先例与时效核验 | codex / gpt-6.1-sol / high | copilot / gpt-6.1-sol / high | copilot / claude-sonnet-5.5 / high |
22
+ | `verification` | 独立验收、验证和证据核对 | codex / gpt-6.1-sol / high | copilot / gpt-6.1-sol / high | copilot / claude-sonnet-5.5 / high |
23
+ | `exploration` | 围绕主题探索本地源码、调用和边界 | codex / gpt-6.1-sol / high | copilot / gpt-6.1-sol / high | copilot / claude-sonnet-5.5 / high |
24
+ | `diagnosis` | 针对已知故障验证根因假设 | codex / gpt-6.1-sol / high | copilot / gpt-6.1-sol / high | copilot / claude-opus-5.5 / high |
25
+
26
+ 候选名为 `codex-sol`、`copilot-sol`,以及 `copilot-opus` 或 `copilot-sonnet`。默认 profile 为 `exploration`。先查实际设置:
27
+
28
+ ```bash
29
+ trellis teamwork config --profile architecture --configuration copilot-opus --mode committee
14
30
  ```
15
31
 
16
- The role remains `teammate`. Coordination mode is separate from role and
17
- profile. Supported provider adapters are Codex app-server, DSH ACP, Copilot
18
- ACP, and Claude Code CLI when their host contracts are available. A provider
19
- name alone does not prove that its host is installed or verified.
20
-
21
- The coordinator's host capability proof covers foreground waiting, protected
22
- artifact writes, attempt artifact output, disabled native delegation, isolated
23
- context, supported transport, and a positive capacity. Source and Git write
24
- boundaries are role obligations recorded in `writePolicy`; they do not require
25
- filesystem or Git permission isolation. Available tools do not authorize a
26
- teammate to implement product code. The coordinator rejects an incomplete
27
- runtime proof without silently changing the frozen execution values.
28
-
29
- The public `trellis teamwork batch` entry currently refuses dispatch before
30
- coordination state is written. It does not discover or connect a host adapter;
31
- interactive `spawn` and `run` do not establish a verified batch adapter.
32
-
33
- The bundled role card is `.trellis/agents/teammate.md`. It is provider-neutral
34
- and limits a teammate to the frozen context and current attempt artifacts. A
35
- Teamwork teammate is not the native host-created `subagent`; the two have
36
- different creation paths and contracts.
32
+ 成员显式覆盖执行值只作用于该成员,不改项目默认。多成员应考虑同 provider 不同模型、跨 provider 同模型或不同专业的收益,填写 `selection_reason`;不强制异构、不自动轮换、不静默 fallback。`architecture + committee` 可以让 2–3 位架构成员分别使用不同配置。
33
+
34
+ 构造器冻结有效执行值、通用加专业角色指令、模式结果合同、上下文、模式配置摘要和能力摘要。能力的 `evidence: adapter-contract` 说明它来自静态适配器合同,不是已安装后端的成功探测。后续改配置只影响新计划,已有计划执行时不重新解析角色文件;新计划的参考文件在派发前后核对冻结摘要。模型不可用、推理强度未被后端声明或选项不支持时明确失败,并保留实际配置协商阶段及后端声明信息。
35
+
36
+ 四种 transport 为 Codex app-server、Claude Code stream-json、Copilot ACP 和 DSH ACP。Copilot 原生 CLI 支持非交互调用;这里选择 ACP 是为了统一会话、配置与取消回执。DSH 使用 `dsh --profile acp`,恢复使用其声明的 `session/resume`;Copilot 使用 `session/load`。安装、账号和真实调用结果须单独核验,fixture 通过不证明某个后端已可用。
37
+
38
+ Codex 使用 `developerInstructions`,Claude 使用独立的 append-system-prompt;ACP v1 只有用户内容块,Trellis 将角色与任务放在两个明确区分的纯文本块,但不宣称具有独立 system 优先级。完整角色在同一会话成功完成一轮后不重复发送,恢复或首次失败后重新建立。参考资料通过任务数据通道发送。不会动态改写 `AGENTS.md` 或注册 provider 原生 persona。
39
+
40
+ 源码、Git、递归委派和隐式历史使用限制是角色义务。宿主能力检查只声明实际运行能力:前台等待、受控产物、transport 和容量;不声称完成文件系统只读或记忆隔离。可用工具与宽权限模式不授予 teammate 编写产品代码的职责。
41
+
42
+ 工具权限自动允许,不设置默认沙箱或工具/路径准入限制。Codex 默认 `danger-full-access`、`approvalPolicy: never`;ACP 自动选择后端提供的允许选项。宿主仍可能附加 AGENTS、Skills 和环境记忆,角色摘要不代表整个有效上下文摘要。
@@ -7,29 +7,37 @@ evidence, path, secret, and symlink rules. The teammate writes only its
7
7
  current attempt artifacts. It does not modify product source, Git state, task
8
8
  status, or another teammate's artifacts.
9
9
 
10
- After a timeout, the same attempt may receive a continuation. A confirmed
11
- execution or acceptance failure may consume that assignment's explicit retry
12
- budget and create a new attempt identity. An uncertain command, changed host
13
- identity, or unconfirmed cancellation enters reconciliation and is not
14
- automatically duplicated. Reconciliation is a runtime outcome; the task
15
- coordinator decides whether a later task phase needs a return.
16
-
17
- When a live Teamwork wait returns a host continuation, resume only that
18
- continuation until it resolves, times out, or errors. Do not run another
19
- host action meanwhile, including another wait, shell command, or status/message
20
- query. An empty transport slice does not mean the wait has completed. Run
21
- diagnostics only after the continuation returns and diagnosis is needed.
10
+ When a managed batch runtime wait yields before the frozen deadline, the CLI
11
+ may continue waiting on the same provider process and attempt identity. This
12
+ continuation does not send another provider prompt, extend the deadline, or
13
+ consume the full-attempt retry budget. The CLI keeps other active slots moving
14
+ while that wait is pending. At the deadline it closes FIFO admission and
15
+ cancels active attempts. A confirmed execution or acceptance failure may
16
+ consume the assignment's explicit retry budget and create a new attempt
17
+ identity. A `blocked` report with evidence ends only that assignment and does
18
+ not stop later FIFO work. An uncertain command, changed host identity,
19
+ incomplete report write, or unconfirmed cancellation enters reconciliation and
20
+ is not automatically duplicated. Reconciliation is a runtime outcome; the
21
+ task coordinator decides whether a later task phase needs a return.
22
+
23
+ For an interactive Teamwork Session `wait` invoked as a host tool, resume only
24
+ that host continuation until it resolves, times out, or errors. Do not run
25
+ another host action meanwhile, including another wait, shell command, or
26
+ status/message query. An empty transport slice does not mean the wait has
27
+ completed. Run diagnostics only after the continuation returns and diagnosis
28
+ is needed. This host-tool rule does not control a managed `teamwork batch`:
29
+ that foreground CLI call owns the batch lifecycle and returns one receipt.
22
30
 
23
31
  Use the ordinary Teamwork Session commands for a deliberate one-shot or
24
32
  interactive discussion:
25
33
 
26
34
  ```bash
27
- trellis teamwork run [name]
28
- trellis teamwork spawn <name> --agent teammate --provider <provider> \
29
- --as reviewer --file .trellis/tasks/<task-dir>/prd.md \
30
- --jsonl .trellis/tasks/<task-dir>/research.jsonl
35
+ trellis teamwork run [name] --profile exploration --configuration codex-sol --stdin --json
36
+ trellis teamwork spawn <name> --profile review --configuration copilot-opus \
37
+ --as reviewer --file .trellis/tasks/in_progress/<task-dir>/prd.md \
38
+ --jsonl .trellis/tasks/in_progress/<task-dir>/research.jsonl
31
39
  trellis teamwork send <name> --as <agent> --stdin
32
- trellis teamwork wait <name> --as <agent> --kind done,turn_finished
40
+ trellis teamwork wait <name> --as <agent> --from reviewer --json
33
41
  trellis teamwork interrupt <name> --as <agent> --to <teammate> --stdin
34
42
  trellis teamwork kill <name> --as <teammate>
35
43
  ```
@@ -39,13 +47,39 @@ create a second scheduler. Do not use them to bypass a rejected batch or to
39
47
  steer an active managed assignment manually.
40
48
 
41
49
  `spawn` registers an idle teammate; the first targeted `send` starts its turn.
42
- The agent card can set provider defaults, while `--provider`, `--model`,
50
+ The project profile supplies the common and professional role cards plus
51
+ execution defaults. `--profile` and `--configuration` select them;
52
+ `--reasoning-effort`, `--provider`, `--model`,
43
53
  `--cwd`, `--resume`, `--sandbox`, `--timeout`, and `--warn-before` refine one
44
54
  launch. `--file` accepts repeatable paths or globs. `--jsonl` accepts a
45
- repeatable Trellis JSONL manifest whose entries have `{ "file", "reason" }`.
55
+ repeatable Trellis JSONL manifest whose entries have `{ "file", "reason", "delivery" }`.
46
56
  Both forms are resolved relative to the spawn cwd, reject paths outside the
47
57
  cwd or configured trusted roots, skip missing entries with a warning, and
48
- enforce per-file and total-context limits before building the system prompt.
58
+ enforce per-file and total-context limits before building reference data.
59
+ `delivery` defaults to `inline`; `required` supplies a path, digest and an
60
+ instruction to read the complete file before work; `on-demand` supplies a
61
+ path, digest and retrieval condition. Required/on-demand missing files fail
62
+ explicitly. New frozen batches recheck reference bytes before dispatch and
63
+ after completion; changed references require a new plan. This check binds
64
+ source versions, but does not prove the model actually read every byte.
65
+ Legacy generic `--agent <card>` remains available for deliberately custom
66
+ agent cards, but it cannot be combined with professional profile selection.
67
+ Interactive roles return a schema-2 JSON content report; they do not invent batch
68
+ claims, report paths or attempt identities.
69
+
70
+ Common/professional role rules and the mode-specific result contract are
71
+ initialization instructions. Codex uses `developerInstructions`; Claude uses
72
+ append-system-prompt. Reference material travels with the first task as data.
73
+ ACP has user blocks only: the role is sent once after a confirmed turn, retained
74
+ for follow-ups, and injected again after recovery or an unsuccessful first
75
+ turn. No JSON transport envelope is serialized into the role/task prose.
76
+ The host may add AGENTS, Skills and memory; `TRELLIS_HOOKS=0` disables Trellis
77
+ hooks, not all host context. No environment or memory isolation is claimed.
78
+
79
+ All providers automatically allow tool permissions. Codex defaults to
80
+ `danger-full-access` with `approvalPolicy: never`; an explicit user sandbox
81
+ override is still supported. ACP selects the offered allow option and reports
82
+ an error if none exists. Role boundaries remain prompt obligations.
49
83
 
50
84
  Use `--inbox-policy explicitOnly|broadcastAndExplicit` to control which
51
85
  messages are delivered to a teammate. `send --to` selects recipients and
@@ -53,8 +87,10 @@ messages are delivered to a teammate. `send --to` selects recipients and
53
87
  target validation. The runtime records the injected files, manifest paths,
54
88
  provider identity, and terminal event in the session log.
55
89
 
56
- The guard resolves CLI flags, then environment variables, then
57
- `teamwork.teammate_guard` in `.trellis/config.yaml`, then built-in defaults.
90
+ The live budget and mode capacity come from schema-2 `.trellis/teamwork.json`;
91
+ explicit CLI flags and environment overrides may tighten the frozen policy.
92
+ Legacy `.trellis/config.yaml` teammate keys are ignored with diagnostics;
93
+ the separate idle timeout remains a process-lifecycle setting.
58
94
  `--idle-timeout` cleans a continuously idle teammate; `--max-live-teammates`
59
95
  limits live processes. A value of `0` disables the corresponding guard. An
60
96
  idle teammate is not cleaned while it is in a turn. `interrupt` requests a
@@ -62,14 +98,48 @@ replacement instruction, `kill` attempts graceful shutdown, and `kill --force`
62
98
  uses the hard termination path. `--resume` supplies the provider session or
63
99
  thread identifier for a later attempt.
64
100
 
101
+ Codex interrupts use `turn/interrupt` and await the old terminal turn before
102
+ submitting the replacement. ACP sends `session/cancel` and awaits the terminal
103
+ prompt response; sending a notification alone is not cancellation proof.
104
+ Batch cancellation additionally confirms provider process exit. Unconfirmed
105
+ termination preserves reconciliation and its capacity reservation. Session
106
+ removal and prune preserve sessions with unresolved batch reservations.
107
+
65
108
  For short independent work, `teamwork run` creates an ephemeral session,
66
109
  injects the selected context, sends one prompt, waits for `done`, prints the
67
- answer, and removes the session. For a managed plan, the coordinator owns
110
+ answer, and removes the session only after a valid complete content report.
111
+ `run --json` returns the common machine envelope and keeps failure diagnostics;
112
+ early supervisor errors/kills terminate the wait without hiding the cause.
113
+ `wait --json --from <one-worker>` binds the final report to `inputSeq` and
114
+ `turnId`; it does not stop the persistent worker. Default event waits retain
115
+ their existing behavior. For a managed plan, the coordinator owns
68
116
  claim, dispatch, retry budget, terminal receipt, and reconciliation. An
69
117
  uncertain provider action is reconciled instead of being duplicated. Settled
70
- attempt artifacts may be cleaned according to the plan retention rule; the
118
+ attempt reports and worklogs, including rejected attempts, remain until explicit
119
+ native cleanup; the result includes every attempt index. The
71
120
  Teamwork Session event log follows its own lifecycle.
72
121
 
122
+ `teamwork cleanup-artifacts <plan> --task <task-dir>` previews the exact retained
123
+ report/worklog/stderr files of a durably settled batch. Only an explicit repeat
124
+ with `--confirm <preview-digest>` deletes those files; a changed preview or an
125
+ unresolved reservation is rejected. Read and accept needed evidence before
126
+ cleanup. Session removal alone does not delete task-owned attempt evidence.
127
+
128
+ Use `teamwork reconcile <original-plan> --task <task-dir>` to preview recovery
129
+ after coordinator loss. `--execute --reason <disposition>` only settles when
130
+ native process-exit facts or process birth identity prove termination. A missing
131
+ PID, absent report, or dead coordinator alone is insufficient. This command
132
+ preserves accepted assignments and releases only the original batch's leases.
133
+ It does not restart providers or accept task results.
134
+
135
+ After a durable failed settlement and explicit bounded retry approval, construct
136
+ `teamwork retry <original-plan> --task <task-dir> --output <new-plan> --batch <new-id>
137
+ --assignments <failed-id,...> --deadline <ISO-time> --approval-ref <approval>`.
138
+ Only failed assignments enter the new plan; frozen inputs and parent lineage
139
+ are retained. Repeating the same output is idempotent. Execute the new plan
140
+ normally; the original terminal result remains unchanged. A recovered subset
141
+ does not retroactively accept the original committee evaluation.
142
+
73
143
  For a stalled process, inspect `teamwork list`,
74
144
  `teamwork messages <session> --raw --no-progress`, the provider log, and the
75
145
  host process state in that order. Use `messages --follow` for live output and