@gajae-code/coding-agent 0.14.2 → 0.15.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 (345) hide show
  1. package/CHANGELOG.md +120 -1
  2. package/dist/types/async/job-manager.d.ts +4 -1
  3. package/dist/types/autoresearch/dashboard.d.ts +29 -4
  4. package/dist/types/autoresearch/data-context.d.ts +25 -0
  5. package/dist/types/autoresearch/git.d.ts +65 -7
  6. package/dist/types/autoresearch/harness.d.ts +58 -0
  7. package/dist/types/autoresearch/prompts.d.ts +51 -0
  8. package/dist/types/autoresearch/runs.d.ts +173 -0
  9. package/dist/types/autoresearch/types.d.ts +9 -139
  10. package/dist/types/capability/types.d.ts +20 -0
  11. package/dist/types/cli/accounts-cli.d.ts +1 -0
  12. package/dist/types/commands/{rlm.d.ts → autoresearch.d.ts} +2 -4
  13. package/dist/types/config/autorouting-contract.d.ts +146 -0
  14. package/dist/types/config/autorouting-generator.d.ts +40 -0
  15. package/dist/types/config/autorouting-tier-map.d.ts +16844 -0
  16. package/dist/types/config/autorouting.d.ts +35 -0
  17. package/dist/types/config/model-discovery-manager.d.ts +8 -1
  18. package/dist/types/config/model-registry.d.ts +30 -1
  19. package/dist/types/config/provider-selection-policy.d.ts +23 -0
  20. package/dist/types/config/settings-schema.d.ts +61 -3
  21. package/dist/types/config/settings.d.ts +3 -0
  22. package/dist/types/coordinator/contract.d.ts +1 -1
  23. package/dist/types/coordinator-mcp/durability.d.ts +29 -0
  24. package/dist/types/coordinator-mcp/event-webhook.d.ts +50 -0
  25. package/dist/types/coordinator-mcp/question-state.d.ts +1 -1
  26. package/dist/types/coordinator-mcp/server.d.ts +14 -0
  27. package/dist/types/crash/index-store.d.ts +3 -0
  28. package/dist/types/crash/record-loader.d.ts +2 -0
  29. package/dist/types/crash/upstream/relay.d.ts +5 -3
  30. package/dist/types/cursor.d.ts +12 -0
  31. package/dist/types/defaults/gjc-defaults.d.ts +35 -1
  32. package/dist/types/defaults/gjc-skills.generated.d.ts +1 -1
  33. package/dist/types/discovery/helpers.d.ts +1 -1
  34. package/dist/types/edit/index.d.ts +2 -1
  35. package/dist/types/eval/py/executor.d.ts +2 -0
  36. package/dist/types/extensibility/extensions/loader.d.ts +32 -0
  37. package/dist/types/extensibility/gjc-plugins/types.d.ts +1 -1
  38. package/dist/types/extensibility/skills.d.ts +2 -0
  39. package/dist/types/gjc-runtime/autoresearch-runtime.d.ts +194 -0
  40. package/dist/types/gjc-runtime/gc-runtime.d.ts +1 -1
  41. package/dist/types/gjc-runtime/psmux-detect.d.ts +1 -1
  42. package/dist/types/gjc-runtime/python-transcript.d.ts +19 -0
  43. package/dist/types/gjc-runtime/ralplan-runtime.d.ts +2 -8
  44. package/dist/types/gjc-runtime/session-layout.d.ts +6 -3
  45. package/dist/types/gjc-runtime/state-renderer.d.ts +0 -22
  46. package/dist/types/gjc-runtime/state-schema.d.ts +7 -7
  47. package/dist/types/gjc-runtime/tmux-common.d.ts +2 -2
  48. package/dist/types/gjc-runtime/ultragoal-change-set.d.ts +38 -1
  49. package/dist/types/gjc-runtime/ultragoal-runtime.d.ts +2 -24
  50. package/dist/types/gjc-runtime/ultragoal-validation-policy.d.ts +73 -0
  51. package/dist/types/gjc-runtime/workflow-recovery-projection.d.ts +100 -0
  52. package/dist/types/hooks/skill-keywords.d.ts +1 -1
  53. package/dist/types/main.d.ts +0 -10
  54. package/dist/types/modes/acp/acp-agent.d.ts +13 -6
  55. package/dist/types/modes/components/model-selector.d.ts +14 -0
  56. package/dist/types/modes/components/skill-hud/render.d.ts +6 -1
  57. package/dist/types/modes/components/smart-routing-panel.d.ts +82 -0
  58. package/dist/types/modes/controllers/selector-controller.d.ts +14 -0
  59. package/dist/types/modes/interactive-mode.d.ts +3 -0
  60. package/dist/types/modes/types.d.ts +9 -0
  61. package/dist/types/rlm/artifacts.d.ts +4 -4
  62. package/dist/types/runtime/optional-runtime-services.d.ts +2 -1
  63. package/dist/types/runtime/workspace-tree-service.d.ts +5 -1
  64. package/dist/types/runtime-mcp/config.d.ts +6 -0
  65. package/dist/types/runtime-mcp/manager.d.ts +10 -0
  66. package/dist/types/sdk/acp/adapter.d.ts +0 -4
  67. package/dist/types/sdk/broker/broker.d.ts +1 -1
  68. package/dist/types/sdk/broker/lifecycle.d.ts +57 -2
  69. package/dist/types/sdk/broker/session-index.d.ts +15 -0
  70. package/dist/types/sdk/bus/chat-daemon-control.d.ts +6 -0
  71. package/dist/types/sdk/bus/chat-daemon-runtime.d.ts +4 -0
  72. package/dist/types/sdk/bus/index.d.ts +8 -0
  73. package/dist/types/sdk/bus/kind-aware-reconciliation.d.ts +2 -0
  74. package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +12 -2
  75. package/dist/types/sdk/client/client.d.ts +39 -4
  76. package/dist/types/sdk/host/host.d.ts +1 -0
  77. package/dist/types/sdk/host/internal-autorouting-state.d.ts +3 -0
  78. package/dist/types/sdk/host/model-pin.d.ts +29 -0
  79. package/dist/types/sdk/host/session-runtime.d.ts +2 -1
  80. package/dist/types/sdk/lifecycle-session.d.ts +13 -0
  81. package/dist/types/sdk/router/session-router.d.ts +27 -1
  82. package/dist/types/sdk/session.d.ts +11 -1
  83. package/dist/types/session/agent-session.d.ts +36 -6
  84. package/dist/types/session/artifacts.d.ts +16 -1
  85. package/dist/types/session/internal/managed-session-storage.d.ts +7 -0
  86. package/dist/types/session/session-manager.d.ts +84 -2
  87. package/dist/types/session/session-staging-paths.d.ts +3 -0
  88. package/dist/types/skill-state/canonical-skills.d.ts +1 -1
  89. package/dist/types/skill-state/workflow-hud.d.ts +12 -21
  90. package/dist/types/skill-state/workflow-mutation-guard.d.ts +1 -0
  91. package/dist/types/slash-commands/helpers/autorouting-status.d.ts +8 -0
  92. package/dist/types/system-prompt.d.ts +23 -0
  93. package/dist/types/task/executor.d.ts +35 -4
  94. package/dist/types/task/index.d.ts +17 -3
  95. package/dist/types/task/receipt.d.ts +3 -1
  96. package/dist/types/task/types.d.ts +144 -0
  97. package/dist/types/tools/atomic-file-write.d.ts +72 -0
  98. package/dist/types/tools/descriptors.d.ts +1 -0
  99. package/dist/types/tools/index.d.ts +36 -1
  100. package/dist/types/tools/move-session.d.ts +40 -0
  101. package/dist/types/tools/python.d.ts +12 -0
  102. package/dist/types/tools/resource-gc.d.ts +0 -3
  103. package/dist/types/tools/search.d.ts +8 -1
  104. package/dist/types/tools/skill.d.ts +9 -4
  105. package/dist/types/tools/subagent.d.ts +33 -3
  106. package/dist/types/utils/xml-escape.d.ts +2 -0
  107. package/dist/types/workflow/workflow-intent-diff.d.ts +2 -2
  108. package/dist/types/workflow/workflow-intent-report-consumer.d.ts +1 -1
  109. package/package.json +11 -12
  110. package/scripts/build-sdk-package-smoke.ts +7 -5
  111. package/scripts/check-autorouting-tier-map.ts +183 -0
  112. package/scripts/generate-sdk-operation-inventory.ts +12 -0
  113. package/scripts/generate-tool-catalog.ts +40 -5
  114. package/src/async/job-manager.ts +5 -2
  115. package/src/autoresearch/dashboard.ts +134 -314
  116. package/src/autoresearch/data-context.ts +35 -0
  117. package/src/autoresearch/git.ts +186 -26
  118. package/src/autoresearch/{helpers.ts → harness.ts} +65 -40
  119. package/src/autoresearch/{prompt-setup.md → prompts/prompt-setup.md} +7 -7
  120. package/src/autoresearch/prompts/prompt.md +103 -0
  121. package/src/autoresearch/prompts.ts +126 -0
  122. package/src/autoresearch/runs.ts +708 -0
  123. package/src/autoresearch/types.ts +9 -150
  124. package/src/capability/index.ts +4 -4
  125. package/src/capability/types.ts +20 -0
  126. package/src/cli/accounts-cli.ts +21 -5
  127. package/src/cli/config-cli.ts +25 -1
  128. package/src/cli/fast-help.ts +1 -2
  129. package/src/cli/list-models.ts +5 -8
  130. package/src/cli/setup-cli.ts +8 -0
  131. package/src/cli.ts +2 -21
  132. package/src/commands/autoresearch.ts +33 -0
  133. package/src/commands/coordinator.ts +15 -0
  134. package/src/commands/launch.ts +2 -4
  135. package/src/commands/quick-lane.ts +1 -1
  136. package/src/commands/sdk.ts +24 -0
  137. package/src/commands/state.ts +1 -1
  138. package/src/config/autorouting-contract.ts +474 -0
  139. package/src/config/autorouting-generator.ts +238 -0
  140. package/src/config/autorouting-tier-map.ts +6108 -0
  141. package/src/config/autorouting.ts +120 -0
  142. package/src/config/model-discovery-manager.ts +42 -11
  143. package/src/config/model-registry.ts +348 -68
  144. package/src/config/provider-selection-policy.ts +60 -9
  145. package/src/config/settings-schema.ts +195 -6
  146. package/src/config/settings.ts +62 -1
  147. package/src/config.ts +2 -3
  148. package/src/coordinator/contract.ts +0 -1
  149. package/src/coordinator-mcp/codex-handoff.ts +68 -42
  150. package/src/coordinator-mcp/durability.ts +200 -0
  151. package/src/coordinator-mcp/event-webhook.ts +278 -0
  152. package/src/coordinator-mcp/question-state.ts +109 -46
  153. package/src/coordinator-mcp/server.ts +932 -504
  154. package/src/crash/index-store.ts +126 -22
  155. package/src/crash/record-loader.ts +7 -0
  156. package/src/crash/upstream/relay.ts +82 -34
  157. package/src/cursor.ts +84 -1
  158. package/src/debug/index.ts +26 -0
  159. package/src/defaults/gjc/skills/autoresearch/SKILL.md +116 -0
  160. package/src/defaults/gjc/skills/autoresearch/auto-critic.md +46 -0
  161. package/src/defaults/gjc/skills/autoresearch/auto-iterate.md +42 -0
  162. package/src/defaults/gjc/skills/deep-interview/SKILL.md +17 -37
  163. package/src/defaults/gjc/skills/ralplan/SKILL.md +21 -18
  164. package/src/defaults/gjc/skills/ultragoal/SKILL.md +6 -17
  165. package/src/defaults/gjc/skills/ultragoal/ai-slop-cleaner.md +2 -2
  166. package/src/defaults/gjc-defaults.ts +89 -2
  167. package/src/defaults/gjc-skills.generated.ts +24 -17
  168. package/src/discovery/builtin.ts +18 -5
  169. package/src/discovery/helpers.ts +6 -6
  170. package/src/edit/index.ts +5 -2
  171. package/src/eval/py/executor.ts +8 -0
  172. package/src/extensibility/extensions/loader.ts +135 -13
  173. package/src/extensibility/extensions/wrapper.ts +1 -2
  174. package/src/extensibility/gjc-plugins/schema.ts +1 -1
  175. package/src/extensibility/runtime-skill-discovery.ts +2 -2
  176. package/src/extensibility/skill-management.ts +2 -3
  177. package/src/extensibility/skills.ts +16 -8
  178. package/src/gjc-runtime/autoresearch-runtime.ts +1509 -0
  179. package/src/gjc-runtime/gc-render.ts +0 -1
  180. package/src/gjc-runtime/gc-runtime.ts +1 -11
  181. package/src/gjc-runtime/launch-tmux.ts +3 -3
  182. package/src/gjc-runtime/psmux-detect.ts +2 -2
  183. package/src/gjc-runtime/python-transcript.ts +58 -0
  184. package/src/gjc-runtime/ralplan-runtime.ts +6 -18
  185. package/src/gjc-runtime/session-layout.ts +18 -7
  186. package/src/gjc-runtime/session-state-sidecar.ts +58 -9
  187. package/src/gjc-runtime/state-renderer.ts +0 -38
  188. package/src/gjc-runtime/state-runtime.ts +43 -22
  189. package/src/gjc-runtime/state-schema.ts +1 -1
  190. package/src/gjc-runtime/tmux-common.ts +7 -7
  191. package/src/gjc-runtime/ultragoal-change-set.ts +232 -11
  192. package/src/gjc-runtime/ultragoal-runtime.ts +309 -114
  193. package/src/gjc-runtime/ultragoal-validation-policy.ts +247 -0
  194. package/src/gjc-runtime/workflow-command-ref.ts +15 -11
  195. package/src/gjc-runtime/workflow-manifest.generated.json +413 -532
  196. package/src/gjc-runtime/workflow-manifest.ts +43 -83
  197. package/src/gjc-runtime/workflow-recovery-projection.ts +616 -0
  198. package/src/hooks/skill-keywords.ts +3 -3
  199. package/src/hooks/skill-state.ts +2 -2
  200. package/src/internal-urls/docs-index.generated.ts +26 -24
  201. package/src/lsp/index.ts +25 -5
  202. package/src/main.ts +2 -27
  203. package/src/modes/acp/acp-agent.ts +200 -75
  204. package/src/modes/components/model-selector.ts +216 -13
  205. package/src/modes/components/oauth-selector.ts +5 -5
  206. package/src/modes/components/skill-hud/render.ts +173 -35
  207. package/src/modes/components/smart-routing-panel.ts +531 -0
  208. package/src/modes/components/tool-status-header.ts +6 -3
  209. package/src/modes/controllers/command-controller.ts +17 -7
  210. package/src/modes/controllers/input-controller.ts +44 -9
  211. package/src/modes/controllers/runtime-mcp-command-controller.ts +4 -0
  212. package/src/modes/controllers/selector-controller.ts +298 -65
  213. package/src/modes/interactive-mode.ts +8 -1
  214. package/src/modes/shared/agent-wire/workflow-gate-types.ts +1 -1
  215. package/src/modes/types.ts +9 -1
  216. package/src/prompts/agents/planner.md +1 -1
  217. package/src/prompts/system/system-prompt.md +1 -1
  218. package/src/prompts/system/volatile-project-context.md +2 -1
  219. package/src/prompts/tools/move-session.md +15 -0
  220. package/src/prompts/tools/python.md +12 -0
  221. package/src/prompts/tools/skill-discovery.md +1 -1
  222. package/src/prompts/tools/skill.md +2 -2
  223. package/src/prompts/tools/task-summary.md +1 -0
  224. package/src/prompts/tools/task.md +6 -0
  225. package/src/rlm/artifacts.ts +12 -10
  226. package/src/runtime/optional-runtime-services.ts +3 -2
  227. package/src/runtime/workspace-tree-service.ts +11 -3
  228. package/src/runtime-mcp/config.ts +8 -1
  229. package/src/runtime-mcp/manager.ts +33 -0
  230. package/src/sdk/acp/adapter.ts +48 -1
  231. package/src/sdk/broker/broker.ts +30 -2
  232. package/src/sdk/broker/discovery.ts +217 -2
  233. package/src/sdk/broker/lifecycle.ts +385 -59
  234. package/src/sdk/broker/session-index.ts +243 -48
  235. package/src/sdk/broker/transport.ts +1 -0
  236. package/src/sdk/bus/chat-daemon-control.ts +8 -2
  237. package/src/sdk/bus/chat-daemon-runtime.ts +5 -0
  238. package/src/sdk/bus/index.ts +208 -11
  239. package/src/sdk/bus/kind-aware-reconciliation.ts +16 -0
  240. package/src/sdk/bus/reconciliation-store.ts +27 -5
  241. package/src/sdk/bus/telegram-daemon-contract.ts +12 -2
  242. package/src/sdk/client/client.ts +204 -22
  243. package/src/sdk/host/host.ts +16 -0
  244. package/src/sdk/host/internal-autorouting-state.ts +13 -0
  245. package/src/sdk/host/model-pin.ts +101 -0
  246. package/src/sdk/host/reverse-leases.ts +2 -1
  247. package/src/sdk/host/session-runtime.test.ts +224 -1
  248. package/src/sdk/host/session-runtime.ts +125 -37
  249. package/src/sdk/lifecycle/service.ts +3 -1
  250. package/src/sdk/lifecycle-session.ts +42 -1
  251. package/src/sdk/protocol/operation-inventory.generated.json +66 -0
  252. package/src/sdk/router/session-router.ts +375 -36
  253. package/src/sdk/session.ts +547 -47
  254. package/src/session/account-inventory.ts +1 -1
  255. package/src/session/agent-session.ts +765 -189
  256. package/src/session/artifacts.ts +234 -4
  257. package/src/session/internal/managed-session-storage.ts +91 -4
  258. package/src/session/provider-safety-stop-hint.ts +3 -2
  259. package/src/session/session-manager.ts +775 -16
  260. package/src/session/session-staging-paths.ts +8 -0
  261. package/src/setup/hermes/templates/operator-instructions.v1.md +0 -1
  262. package/src/setup/host-plugin-setup.ts +2 -2
  263. package/src/skill-state/active-state.ts +2 -2
  264. package/src/skill-state/canonical-skills.ts +1 -1
  265. package/src/skill-state/initial-phase.ts +1 -1
  266. package/src/skill-state/workflow-hud.ts +41 -41
  267. package/src/skill-state/workflow-mutation-guard.ts +26 -7
  268. package/src/slash-commands/builtin-registry.ts +77 -0
  269. package/src/slash-commands/helpers/autorouting-status.ts +55 -0
  270. package/src/system-prompt.ts +102 -5
  271. package/src/task/discovery.ts +2 -3
  272. package/src/task/executor.ts +617 -43
  273. package/src/task/index.ts +262 -15
  274. package/src/task/receipt.ts +30 -0
  275. package/src/task/render.ts +11 -1
  276. package/src/task/types.ts +316 -0
  277. package/src/tools/atomic-file-write.ts +594 -0
  278. package/src/tools/bisect.ts +3 -2
  279. package/src/tools/descriptors.test.ts +3 -0
  280. package/src/tools/descriptors.ts +24 -0
  281. package/src/tools/image-gen.ts +5 -1
  282. package/src/tools/index.ts +62 -5
  283. package/src/tools/move-session.ts +107 -0
  284. package/src/tools/python.ts +205 -0
  285. package/src/tools/read.ts +88 -15
  286. package/src/tools/renderers.ts +2 -0
  287. package/src/tools/resource-gc.ts +8 -177
  288. package/src/tools/search.ts +30 -6
  289. package/src/tools/skill-discovery.ts +1 -0
  290. package/src/tools/skill.ts +37 -7
  291. package/src/tools/subagent-render.ts +119 -13
  292. package/src/tools/subagent.ts +91 -74
  293. package/src/tools/tool-catalog.generated.ts +64 -2
  294. package/src/tools/write.ts +16 -12
  295. package/src/utils/xml-escape.ts +14 -0
  296. package/src/web/search/providers/codex.ts +2 -2
  297. package/src/workflow/workflow-intent-diff.ts +13 -12
  298. package/src/workflow/workflow-intent-report-consumer.ts +6 -6
  299. package/dist/types/autoresearch/helpers.d.ts +0 -24
  300. package/dist/types/autoresearch/index.d.ts +0 -2
  301. package/dist/types/autoresearch/state.d.ts +0 -17
  302. package/dist/types/autoresearch/storage.d.ts +0 -142
  303. package/dist/types/autoresearch/tools/init-experiment.d.ts +0 -31
  304. package/dist/types/autoresearch/tools/log-experiment.d.ts +0 -23
  305. package/dist/types/autoresearch/tools/run-experiment.d.ts +0 -8
  306. package/dist/types/autoresearch/tools/update-notes.d.ts +0 -12
  307. package/dist/types/commands/team.d.ts +0 -24
  308. package/dist/types/gjc-runtime/team-gc.d.ts +0 -7
  309. package/dist/types/gjc-runtime/team-launch.d.ts +0 -61
  310. package/dist/types/gjc-runtime/team-notify.d.ts +0 -45
  311. package/dist/types/gjc-runtime/team-runtime.d.ts +0 -336
  312. package/dist/types/gjc-runtime/team-store.d.ts +0 -168
  313. package/dist/types/gjc-runtime/team-worker-heartbeat.d.ts +0 -43
  314. package/dist/types/gjc-runtime/team-worker-memory-guard.d.ts +0 -92
  315. package/dist/types/gjc-runtime/team-workers.d.ts +0 -83
  316. package/dist/types/rlm/index.d.ts +0 -47
  317. package/dist/types/rlm/preset.d.ts +0 -23
  318. package/dist/types/rlm/python-tool.d.ts +0 -16
  319. package/src/autoresearch/command-resume.md +0 -14
  320. package/src/autoresearch/index.ts +0 -536
  321. package/src/autoresearch/prompt.md +0 -103
  322. package/src/autoresearch/resume-message.md +0 -10
  323. package/src/autoresearch/state.ts +0 -273
  324. package/src/autoresearch/storage.ts +0 -699
  325. package/src/autoresearch/tools/init-experiment.ts +0 -272
  326. package/src/autoresearch/tools/log-experiment.ts +0 -524
  327. package/src/autoresearch/tools/run-experiment.ts +0 -475
  328. package/src/autoresearch/tools/update-notes.ts +0 -109
  329. package/src/commands/rlm.ts +0 -19
  330. package/src/commands/team.ts +0 -238
  331. package/src/defaults/gjc/skills/deep-interview/auto-research-greenfield.md +0 -42
  332. package/src/defaults/gjc/skills/team/SKILL.md +0 -467
  333. package/src/gjc-runtime/team-gc.ts +0 -49
  334. package/src/gjc-runtime/team-launch.ts +0 -404
  335. package/src/gjc-runtime/team-notify.ts +0 -326
  336. package/src/gjc-runtime/team-runtime.ts +0 -5923
  337. package/src/gjc-runtime/team-store.ts +0 -878
  338. package/src/gjc-runtime/team-worker-heartbeat.ts +0 -149
  339. package/src/gjc-runtime/team-worker-memory-guard.ts +0 -363
  340. package/src/gjc-runtime/team-workers.ts +0 -1123
  341. package/src/prompts/system/rlm-report-command.md +0 -1
  342. package/src/prompts/system/rlm-research.md +0 -23
  343. package/src/rlm/index.ts +0 -365
  344. package/src/rlm/preset.ts +0 -76
  345. package/src/rlm/python-tool.ts +0 -68
@@ -1,467 +0,0 @@
1
- ---
2
- name: team
3
- description: Multi-worker GJC tmux team orchestration
4
-
5
- source: "forked from upstream team skill and rebranded for GJC"
6
- ---
7
-
8
- # Team Skill
9
-
10
- ## Purpose & Principles
11
-
12
- `$team` is the tmux-based multi-worker execution mode for GJC. It starts real GJC worker CLI sessions by splitting the current tmux leader window and coordinates them through `.gjc/_session-{sessionid}/state/team/...` files plus CLI team interop (`gjc team api ...`) and state files.
13
-
14
- This skill is operationally sensitive. Treat it as an operator workflow, not a generic prompt pattern. In GJC App or plain outside-tmux sessions, do not present `$team` / `gjc team` as directly available; launch GJC CLI from shell first, or stay on the nearest app-safe surface until the user explicitly wants the tmux runtime.
15
-
16
- - Use **GJC native subagents** for bounded, in-session parallelism where one leader thread can fan out a few independent subtasks and wait for them directly.
17
- - Use **`gjc team`** when you need durable visible tmux workers, shared task state, worker mailbox files, worktrees, explicit lifecycle control, or long-running execution that must survive beyond one local reasoning burst.
18
- - Native subagents can complement team execution, but they do **not** replace the tmux team runtime's stateful coordination contract.
19
-
20
- Use the shared workflow guidance pattern: outcome-first framing, concise visible updates for multi-step work, local overrides for the active workflow branch, validation proportional to risk, explicit stop rules, and automatic continuation for safe reversible steps. Ask only for material, destructive, credentialed, external-production, or preference-dependent branches.
21
-
22
- ## Corrupt current-session state recovery
23
-
24
- When team detects its own current-session state is corrupt, tampered, unreadable, or stale on resume, run `gjc state clear --force --mode team` before reseeding or restarting. Scope the clear to the current session via `--session-id`, the command payload, or `GJC_SESSION_ID`; it clears only team state for that session and never clears other skills or sessions.
25
-
26
- ## What This Skill Must Do
27
-
28
- When user triggers `$team`, the agent must:
29
-
30
- 1. Invoke GJC runtime directly with `gjc team ...`
31
- 2. Avoid replacing the flow with in-process `spawn_agent` fanout
32
- 3. Verify startup and surface concrete state/pane evidence
33
- 4. If active team mode state is missing, initialize/sync it from canonical team runtime state before proceeding
34
- 5. Keep team state alive until the worker is terminal (unless explicit abort)
35
- 6. Handle cleanup and stale-pane recovery when needed
36
-
37
- If `gjc team` is unavailable, stop with a hard error.
38
-
39
- ## Invocation Contract
40
-
41
- ```bash
42
- gjc team [N:agent-type] "<task description>"
43
- ```
44
-
45
- Examples:
46
-
47
- ```bash
48
- gjc team 3:executor "analyze feature X and report flaws"
49
- gjc team "debug flaky integration tests"
50
- gjc team "ship end-to-end fix with verification"
51
- ```
52
-
53
- ### Team-first launch contract
54
-
55
- `gjc team ...` is now the canonical launch path for coordinated execution.
56
- Team mode should carry visible worker delivery/verification lanes without
57
- requiring a separate linked execution loop up front. GJC team supports current-window multi-worker mode; explicit `N:agent-type` values select worker count and shared role.
58
-
59
- - **Canonical launch:** use plain `gjc team ...` / `$team ...` for the coordinated worker.
60
- - **Verification ownership:** keep one lane focused on tests, regression coverage, and evidence before shutdown.
61
- - **Typed lanes:** model delivery, verification, architecture, or specialist work as task `lane` metadata plus `required_role` / `allowed_roles`; claiming enforces owner, role, dependency, and lease order.
62
- - **Escalation:** use a new explicit follow-up task only when later manual work still needs a persistent single-owner fix/verification loop.
63
- - **Deprecation:** nested team execution commands have been removed. Use plain `gjc team ...` for coordinated execution.
64
-
65
- ### Team + Ultragoal bridge
66
-
67
- Use `$ultragoal` for durable leader-owned goal/ledger tracking and `$team` for parallel visible tmux execution lanes. When Team is launched with an active `.gjc/_session-{sessionid}/ultragoal/goals.json`, worker task/status context may include leader-owned Ultragoal context: `.gjc/_session-{sessionid}/ultragoal/goals.json`, `.gjc/_session-{sessionid}/ultragoal/ledger.jsonl`, the active goal id, GJC goal mode, and the `fresh_leader_goal_get_required` checkpoint policy.
68
-
69
- Workers provide task status and verification evidence only. They do not own Ultragoal goal state, create worker ledgers, mutate `.gjc/_session-{sessionid}/ultragoal`, auto-launch Team from Ultragoal, or perform hidden GJC goal mutation. Workers must not run `gjc ultragoal checkpoint`; checkpoint authority stays with the leader after worker tasks are terminal. Ultragoal does not auto-launch Team and performs no hidden goal mutation. The leader uses terminal Team evidence plus the current-session active GJC goal snapshot and strict quality gate to run `gjc ultragoal checkpoint --goal-id <id> --status complete --evidence "<team evidence mentioning .gjc/_session-{sessionid}/ultragoal and <id>>" --quality-gate-json <quality-gate-json-or-path>`.
70
-
71
- ### Worker command override
72
-
73
- Important: `N:agent-type` (for example `3:executor`) selects the worker count and role prompt. Plain `gjc team "task"` defaults to 3 executor workers; `gjc team 1:executor "task"` is the explicit single-worker form.
74
-
75
- To launch the worker with a specific GJC-compatible command, use `GJC_TEAM_WORKER_COMMAND`:
76
-
77
- ```bash
78
- GJC_TEAM_WORKER_COMMAND="bun packages/coding-agent/src/cli.ts" gjc team executor "update docs and report"
79
- ```
80
-
81
- ## Preconditions
82
-
83
- Before running `$team`, confirm:
84
-
85
- 1. `tmux` installed (`tmux -V`)
86
- 2. Current leader session is inside tmux (`$TMUX` is set)
87
- 3. `gjc` command resolves to the intended install/build
88
- 4. If running repo-local `node bin/gjc.js ...`, run `npm run build` after `src` changes
89
- 5. Check HUD pane count in the leader window and avoid duplicate `hud --watch` panes before split
90
-
91
- Suggested preflight:
92
-
93
- ```bash
94
- tmux list-panes -F '#{pane_id}\t#{pane_start_command}' | rg 'hud --watch' || true
95
- ```
96
-
97
- If duplicates exist, remove extras before `gjc team` to prevent HUD ending up in worker stack.
98
-
99
- ## Pre-context Intake Gate
100
-
101
- Before launching `gjc team`, require a grounded context snapshot:
102
-
103
- 1. Derive a task slug from the request.
104
- 2. Reuse the latest relevant snapshot in `.gjc/context/{slug}-*.md` when available.
105
- 3. If none exists, create `.gjc/context/{slug}-{timestamp}.md` (UTC `YYYYMMDDTHHMMSSZ`) with:
106
- - task statement
107
- - desired outcome
108
- - known facts/evidence
109
- - constraints
110
- - unknowns/open questions
111
- - likely codebase touchpoints
112
- 4. If ambiguity remains high, gather brownfield facts with focused repo inspection or a canonical read-only role agent first, then run `$deep-interview --quick <task>` before team launch.
113
- 5. If current correctness depends on official docs, version-aware framework guidance, best practices, or external dependency behavior, gather evidence before or alongside worker launch using supported surfaces only: focused repo inspection for local facts, `planner` for broad context mapping/sequencing, `architect` for architecture or external-doc-risk assessment, and direct web/search tools when configured.
114
-
115
- Do not start the worker pane until this gate is satisfied; if forced to proceed quickly, state explicit scope/risk limitations in the launch report.
116
-
117
- For simple read-only brownfield lookups during intake, use narrow repo inspection first; for broader mapping, delegate to `planner` or `architect` with a concrete fact-finding assignment.
118
-
119
- ## Follow-up Staffing Contract
120
-
121
- When `$team` is used as a follow-up mode from ralplan, carry forward the approved plan's explicit **available-agent-types roster** and convert it into concrete staffing guidance before launch:
122
-
123
- - keep worker-role choices inside the known roster
124
- - state that GJC team launches the requested worker count and role allocation
125
- - state the suggested reasoning level for each lane when available
126
- - explain why each lane exists (delivery, verification, specialist support)
127
- - include an explicit launch hint (`gjc team "<task>"` / `$team "<task>"`) for the coordinated worker run; mention `$ultragoal` as the default durable follow-up/ledger path; mention a later separate Single-owner execution follow-up only when explicitly requested or genuinely needed as a fallback
128
- - if the ideal role is unavailable, choose the closest role from the roster and say so
129
- - For multi-worker follow-up execution, do not pass an inline "Split lanes: A..., B..." sentence as the whole team task. `gjc team` rejects ambiguous inline lane splits because they previously caused every worker to receive the same broad task. Use explicit markdown lane sections instead:
130
- ```md
131
- ### Lane A — Delivery
132
- Implement delivery-only changes and evidence.
133
-
134
- ### Lane B — Verification
135
- Add focused tests and smoke evidence.
136
- ```
137
- Explicit `### Lane <id> — <title>` sections are converted into distinct worker-owned initial tasks.
138
-
139
- ## Current Runtime Behavior (As Implemented)
140
-
141
- `gjc team` currently performs:
142
-
143
- 1. Parse args (`N`, `agent-type`, task), default to 3 workers, and cap workers at 20.
144
- 2. Non-dry-run: detect the current tmux leader context with `display-message -p "#S:#I #{pane_id}"` before creating state or worktrees.
145
- 3. Initialize team state:
146
- - `.gjc/_session-{sessionid}/state/team/<team>/config.json`
147
- - `.gjc/_session-{sessionid}/state/team/<team>/manifest.v2.json`
148
- - `.gjc/_session-{sessionid}/state/team/<team>/tasks/task-*.json` (one per explicit lane section, otherwise one worker-owned compatibility task per worker)
149
- - `.gjc/_session-{sessionid}/state/team/<team>/mailbox/worker-1.json`
150
- - `.gjc/_session-{sessionid}/state/team/<team>/workers/<worker>/status.json`
151
- - `.gjc/_session-{sessionid}/state/team/<team>/workers/<worker>/lifecycle.json`
152
- - `.gjc/_session-{sessionid}/state/team/<team>/workers/<worker>/heartbeat.json`
153
- 4. Resolve the worker command from `GJC_TEAM_WORKER_COMMAND` or the active `gjc` entrypoint.
154
- 5. Split the current tmux window like GJC team: worker 1 is split horizontally to the right of the leader, workers 2..N are vertically stacked in the right column, then `select-layout main-vertical` and `main-pane-width` keep leader-left/worker-right at roughly 50/50.
155
- 6. Launch the worker with:
156
- - `GJC_TEAM_NAME=<team>`
157
- - `GJC_TEAM_WORKER_ID=worker-1`
158
- - `GJC_TEAM_STATE_ROOT=<leader-cwd>/.gjc/_session-{sessionid}/state/team`
159
- - optional `GJC_TEAM_WORKTREE_PATH=<path>` when worktree mode is active
160
- 7. Automatically integrate worker worktree commits during leader monitoring:
161
- - dirty worker worktrees are auto-checkpointed before integration
162
- - clean-ahead worker history is merged into the leader with a runtime merge commit
163
- - diverged worker history is cherry-picked into the leader
164
- - idle/done/failed worker worktrees are cross-rebased onto the updated leader after integration; working workers are skipped
165
- - conflicts are aborted, recorded, and reported to the leader mailbox without falsely advancing `last_integrated_head`
166
- 8. Store pane/target/integration/lifecycle evidence in config/manifest/snapshot: `tmux_session`, `tmux_session_name`, `tmux_target`, leader pane id, worker pane ids, `worker_lifecycle_by_id`, and `integration_by_worker`.
167
- 9. Return control to the leader; follow-up uses `status`, `resume`, `shutdown`, and `gjc team api`.
168
-
169
- Important:
170
-
171
- - Leader remains in the existing left pane.
172
- - Worker panes are independent full GJC worker CLI sessions on the right side of a leader-left/worker-right split.
173
- - Worker CLI selection is teammate-only: `GJC_TEAM_WORKER_CLI` and `GJC_TEAM_WORKER_CLI_MAP` accept only `auto` or `gjc`; legacy/provider values such as `codex`, `claude`, or `gemini` are rejected before launch.
174
- - The worker may run in a dedicated git worktree (`gjc team --worktree[=<name>]`) while sharing the team state root.
175
- - `shutdown` kills only the recorded worker pane after confirming it still belongs to the stored tmux target and is not the leader pane. It never kills the tmux session.
176
-
177
- ## Required Lifecycle (Operator Contract)
178
-
179
- Follow this exact lifecycle when running `$team`:
180
-
181
- 1. Start team and verify startup evidence (team line, tmux target, worker pane id, state dir, `worker_lifecycle_by_id.<worker>.lifecycle_state=ready` after startup ACK).
182
- 2. Monitor task progress with runtime/state tools first (`gjc team status <team>`, `gjc team resume <team>`, task files).
183
- 3. Wait for terminal task state and integration settlement before shutdown:
184
- - `pending=0`
185
- - `in_progress=0`
186
- - `failed=0` (or explicitly acknowledged failure path)
187
- - no pending integration request/conflict (`status` / `resume` must not report `phase=awaiting_integration`)
188
- 4. Only then run `gjc team shutdown <team>`.
189
- 5. Verify shutdown evidence and preserved state (`phase=complete`, worker runtime status `stopped`, lifecycle `stopped` with a matching graceful shutdown request id). If shutdown is forced before evidence-backed task completion, expect `phase=cancelled` or `phase=failed`; if tasks are complete but integration is still pending or conflicted, expect `phase=awaiting_integration`, not `complete`.
190
-
191
- Do not run `shutdown` while the worker is actively writing updates unless user explicitly requested abort/cancel. Do not treat ad-hoc pane typing as primary control flow when runtime/state evidence is available.
192
-
193
- ### Active leader monitoring rule
194
-
195
- While a team is running, keep checking live team state until terminal completion.
196
-
197
- Minimum acceptable loop:
198
-
199
- ```bash
200
- sleep 30 && gjc team monitor <team-name>
201
- ```
202
- The mutating monitor path also performs bounded liveness recovery: expired task claims, stale heartbeat claims, and missing recorded worker panes are requeued instead of leaving work permanently `in_progress`.
203
-
204
- A GJC worker session publishes its own heartbeat while an agent turn or owned background job is active, at a third of the stale window, so a long build or test run is no longer reported stale. A worker that publishes nothing — for example one wedged before it could report — is still recovered on the normal window.
205
-
206
- ### Opt-in stalled-worker continuation
207
-
208
- `GJC_TEAM_AUTO_CONTINUE_STALLED_WORKERS=1` enables a separate, default-off monitor-only nudge for a stalled live worker. It is considered only when the team is running (not dry-run), the worker heartbeat is stale (using `GJC_TEAM_HEARTBEAT_STALE_MS`, default `120000` ms), and all of these checks pass:
209
-
210
- - The recorded pane id is a non-leader `%<number>` pane that tmux currently reports in the recorded `tmux_target` as that same pane id; no other pane is targeted.
211
- - Shutdown authority is proven absent; valid-present and invalid/unreadable records veto continuation without suppressing normal stale-claim recovery.
212
- - Lifecycle is `ready` or `working`, and worker status is a structurally valid non-terminal state (not `draining`, `failed`, or `unknown`).
213
- - One current non-terminal task is `in_progress`, assigned to and claimed by that worker; the stored claim record exactly matches its owner, token, and lease.
214
- - The lease remains valid through the entire next hold interval.
215
-
216
- The policy has at most two attempts per immutable incident: attempt 1 reserves a 30-second hold, then attempt 2 reserves a 120-second hold only after attempt 1 was recorded as sent and its hold elapsed. A retry still requires the heartbeat to be stale and every fence above to pass. Reservations and outcomes are create-without-clobber journal records keyed to the incident identity; a pre-existing reservation, an unknown/missing/non-sent outcome after restart, or a second-attempt record fails closed rather than sending again.
217
-
218
- Each eligible attempt sends only the fixed continuation prompt to that verified recorded worker pane, followed by Enter. It does not replay provider output or a prior prompt, inspect or inject dynamic pane content, cross pane boundaries, kill or relaunch workers, create/split panes, or extend/rewrite claims. This bounded nudge is not automatic recovery for a dead, shutdown, reassigned, terminal, or lease-expired worker. When it cannot act, use `gjc team status <team-name>` / `gjc team monitor <team-name>` and the documented state evidence; manual pane intervention remains the last-resort fallback.
219
-
220
- Continuation input is unsupported on psmux and native Windows send-keys fallback transports: the fixed prompt is not dispatched there because equivalent literal-input semantics are not proven. Startup's existing empty-pane worker command fallback is separate and unchanged.
221
-
222
- ## Operational Commands
223
-
224
- ```bash
225
- gjc team status <team-name>
226
- gjc team monitor <team-name>
227
- gjc team resume <team-name>
228
- gjc team shutdown <team-name>
229
- ```
230
-
231
- Semantics:
232
-
233
- - `status`: read-only snapshot path; it does not recover claims, replay notifications, integrate worker commits, or sync HUD state.
234
- - `monitor`: mutating monitor path; reads team snapshot, recovers expired/stale worker claims, applies pending worker worktree integration, replays notifications, syncs HUD state, and returns task counts, worker state, tmux target/pane evidence, `worker_lifecycle_by_id`, and `integration_by_worker`.
235
- - `resume`: mutating monitor path; performs the same liveness-recovery and integration-aware live snapshot for reconnect/inspection flows.
236
- - `list`: pure read path; lists known teams without integrating worker commits.
237
- - API/read-only snapshot operations are pure unless explicitly documented as a monitor path.
238
- - `claim-task`: mutating task path; before granting a new claim, it recovers expired claims and rejects claims from workers already classified as not live.
239
- - `shutdown`: writes per-worker graceful `shutdown-request.json`, moves lifecycle through `draining` to `stopped`, kills the recorded worker pane when it still belongs to the stored tmux target, removes clean created worktrees, marks worker runtime status stopped, and sets phase from task, lifecycle, and integration state: `complete` only when all tasks have verified `completion_evidence`, every worker has matching graceful shutdown lifecycle evidence, and no integration request/conflict is pending; `awaiting_integration` when tasks and lifecycle are complete but leader integration still requires action; `failed` when tasks failed/blocked or completed tasks lack valid evidence; and `cancelled` when work remains pending or in progress. It preserves `.gjc/_session-{sessionid}/state/team/<team>` as evidence.
240
-
241
- ## Data Plane and Control Plane
242
-
243
- ### Control Plane
244
-
245
- - Current tmux leader window and one or more worker panes.
246
- - `gjc team` lifecycle commands.
247
- - `gjc team api claim-task` and `gjc team api transition-task-status`.
248
-
249
- ### Data Plane
250
-
251
- - `.gjc/_session-{sessionid}/state/team/<team>/config.json`
252
- - `.gjc/_session-{sessionid}/state/team/<team>/manifest.v2.json`
253
- - `.gjc/_session-{sessionid}/state/team/<team>/phase.json`
254
- - `.gjc/_session-{sessionid}/state/team/<team>/events.jsonl`
255
- - `.gjc/_session-{sessionid}/state/team/<team>/trace.jsonl`
256
- - `.gjc/_session-{sessionid}/state/team/<team>/trace-errors.jsonl`
257
- - `.gjc/_session-{sessionid}/state/team/<team>/telemetry.jsonl`
258
- - `.gjc/_session-{sessionid}/state/team/<team>/monitor-snapshot.json`
259
- - `.gjc/_session-{sessionid}/state/team/<team>/integration-report.md`
260
- - `.gjc/_session-{sessionid}/state/team/<team>/tasks/task-1.json` (includes structured `completion_evidence` after completed transitions)
261
- - `.gjc/_session-{sessionid}/state/team/<team>/mailbox/worker-1/<message-id>.json`
262
- - `.gjc/_session-{sessionid}/state/team/<team>/mailbox/worker-1.json` (legacy compatibility view)
263
- - `.gjc/_session-{sessionid}/state/team/<team>/notifications/<notification-id>.json`
264
- - `.gjc/_session-{sessionid}/state/team/<team>/workers/<worker>/startup-ack.json`
265
- - `.gjc/_session-{sessionid}/state/team/<team>/workers/<worker>/status.json`
266
- - `.gjc/_session-{sessionid}/state/team/<team>/workers/<worker>/lifecycle.json`
267
- - `.gjc/_session-{sessionid}/state/team/<team>/workers/<worker>/heartbeat.json`
268
- - `.gjc/_session-{sessionid}/state/team/<team>/workers/<worker>/shutdown-request.json`
269
- - `.gjc/_session-{sessionid}/state/team/<team>/workers/<worker>/nudges/<fingerprint>.json`
270
- - `.gjc/_session-{sessionid}/reports/team-commit-hygiene/<team>.ledger.json`
271
-
272
- ## Team Mutation Interop (CLI-first)
273
-
274
- Use `gjc team api` for machine-readable task lifecycle operations.
275
-
276
- ```bash
277
- gjc team api worker-startup-ack --input '{"team_name":"my-team","worker_id":"worker-1","protocol_version":"1"}' --json
278
- gjc team api claim-task --input '{"team_name":"my-team","worker_id":"worker-1"}' --json
279
- gjc team api transition-task-status --input '{"team_name":"my-team","task_id":"task-1","to":"completed","worker_id":"worker-1","claim_token":"<claim-token>","completion_evidence":{"summary":"Completed requested work and verified it locally.","items":[{"kind":"command","status":"passed","summary":"Focused test passed","command":"bun test packages/coding-agent/test/gjc-runtime/team-runtime.test.ts"}],"files":["packages/coding-agent/test/gjc-runtime/team-runtime.test.ts"],"notes":"Include at least one passed command or verified inspection/artifact item."}}' --json
280
- gjc team api update-worker-status --input '{"team_name":"my-team","worker_id":"worker-1","status":"working","current_task_id":"task-1"}' --json
281
- gjc team api recover-stale-claims --input '{"team_name":"my-team"}' --json
282
- gjc team api read-traces --input '{"team_name":"my-team"}' --json
283
- gjc team api create-task --input '{"team_name":"my-team","subject":"Verify delivery","description":"Run verification","owner":"worker-1","lane":"verification","required_role":"executor","depends_on":["task-1"]}' --json
284
- ```
285
-
286
- Canonical worker lifecycle operations:
287
-
288
- - `worker-startup-ack` before task work; this records startup ACK and moves `workers/<worker>/lifecycle.json` to `ready`
289
- - `claim-task`
290
- - `update-worker-status` when the worker starts/stops a task-local activity; this updates worker-reported `status.json` without replacing the runtime lifecycle source of truth
291
- - `recover-stale-claims` is leader/runtime-owned; it clears expired claim files, requeues in-progress tasks claimed by stale workers, and records `task_claim_recovered` events without modifying terminal task records or completion evidence
292
- - `transition-task-status` with the claim token, worker id, and structured `completion_evidence` object
293
- - `release-task-claim`
294
- Claim eligibility is ordered and must not be bypassed: explicit task id selection, task status/terminal checks, owner/assignee checks, lane/role checks, dependency/blocked checks, then active lease creation. `lane` is descriptive metadata; `required_role` and `allowed_roles` are the enforced worker role gates.
295
-
296
- Completion evidence is stored inline on the task record as `completion_evidence`. It must include a non-empty `summary`, an `items` array, and at least one item with `status: "passed"` or `status: "verified"`. Valid item kinds are `command`, `inspection`, and `artifact`; command items require `command`. The camel-case alias `completionEvidence` is accepted by the API input, but legacy string `evidence` and separate evidence files are not part of the public completion contract.
297
-
298
- GJC-team interop operations are also available for mailbox, native notification, worker heartbeat/status, stale-claim recovery, startup ACK, events, monitor snapshots, approvals, and shutdown request/ack flows; run `gjc team api --help` for the full operation list.
299
-
300
- Structured trace records in `trace.jsonl` are append-only schema version 1 entries. Each trace references the legacy `events.jsonl` source via `source_event_id`, keeps `event_type`, worker/task ids, and includes `evidence_refs` for completion evidence or claim recovery when available. Trace append failures are isolated in `trace-errors.jsonl` and do not break `events.jsonl` compatibility.
301
-
302
- ## GJC-native concept parity
303
-
304
- GJC ports team-mode concepts from `../../oh-my-codex`, not code or OMX/Codex-specific assumptions:
305
-
306
- | Concept | GJC-native equivalent |
307
- |---------|-----------------------|
308
- | Worker identity/inbox/mailbox paths | `.gjc/_session-{sessionid}/state/team/<team>/workers/<worker>/identity.json`, `inbox.md`, and per-message mailbox records under `.gjc/_session-{sessionid}/state/team/<team>/mailbox/<worker>/`. |
309
- | Startup ACK | `gjc team api worker-startup-ack`, persisted as `workers/<worker>/startup-ack.json`. |
310
- | Claim-safe lifecycle APIs | `claim-task`, `transition-task-status`, and `release-task-claim` with worker ownership and claim-token guards. |
311
- | Delivery states and deferred pane attempts | Native notification records under `.gjc/_session-{sessionid}/state/team/<team>/notifications/` with `pending`, `sent`, `queued`, `deferred`, `failed`, `delivered`, and `acknowledged` states. |
312
- | Opt-in memory-guard relaunch | Lifecycle nudges remain non-destructive by default. On Linux only, a worker whose durable `memory-guard.json` explicitly enables automatic action may be checkpointed and relaunched after sustained pressure, bounded retries, current claim validation, and a continuation-safe handoff; unsupported platforms and missing authority remain advisory-only. |
313
-
314
- Forbidden assumptions: do not copy OMX paths, Codex notify payload formats, OMX process names, or source code directly. Keep tmux as the current runtime; native split-worker TUI remains roadmap-only.
315
-
316
- Worker protocol:
317
-
318
- - Send startup ACK with `worker-startup-ack` before task work.
319
- - Report worker activity with `update-worker-status`; this is the worker-reported status plane, not the runtime lifecycle state.
320
- - Claim pending work with `claim-task`.
321
- - Transition the task to `completed`, `failed`, or `blocked` with `transition-task-status`, including claim token and evidence for completion.
322
- - Commit or leave worktree changes in the worker worktree; the leader `monitor`/`resume` path will auto-checkpoint dirty worktrees and integrate committed history where possible.
323
- - Record implementation/verification evidence in normal task output and state files; leader integration/conflict notifications are delivered through `.gjc/_session-{sessionid}/state/team/<team>/mailbox/leader-fixed.json`.
324
-
325
- ## Environment Knobs
326
-
327
- Useful runtime env vars:
328
-
329
- - `GJC_TMUX_COMMAND` / `GJC_TEAM_TMUX_COMMAND`
330
- - tmux executable override (default `tmux` on POSIX; `psmux` / `pmux` / `tmux` resolution on native Windows). `GJC_TMUX_COMMAND` applies to every GJC tmux flow; `GJC_TEAM_TMUX_COMMAND` is honored as a team-path alias. Values are executable paths/names, not shell command lines.
331
- - Native Windows psmux boundary: a generic-banner `tmux.exe` alias is classified by matching its executable identity with resolved `psmux.exe` / `pmux.exe` companions. Unresolved or conflicting identity evidence fails closed with `gjc_tmux_provider_ambiguous`; `GJC_PSMUX_COMMAND` must resolve to the same executable identity as the selected alias.
332
- - Managed psmux session creation, attachment, lifecycle mutation, and team startup remain unsupported because psmux cannot provide the immutable native session identity required by the owner-isolation contract. Use WSL or verified native tmux for live team workers.
333
- - Windows psmux namespace boundary: psmux uses the tmux-compatible global `-L <namespace>` flag for server isolation, but GJC does not accept flags in `GJC_TMUX_COMMAND` or expose structured runtime `-L` support.
334
- - `GJC_TEAM_WORKER_COMMAND`
335
- - worker command override (default resolves to active GJC entrypoint or `gjc`)
336
- - `GJC_TEAM_STATE_ROOT`
337
- - team state root override (default `<cwd>/.gjc/_session-{sessionid}/state/team`)
338
-
339
- ## Failure Modes and Diagnosis
340
-
341
- Operator note (important for GJC panes):
342
- - Manual Enter injection (`tmux send-keys ... C-m`) can appear to "do nothing" when a worker is actively processing; Enter may be queued by the pane/task flow.
343
- - This is not necessarily a runtime bug. Confirm worker/team state before diagnosing worker failure.
344
- - Avoid repeated blind Enter spam; it can create noisy duplicate submits once the pane becomes idle.
345
-
346
- ### Common failures
347
-
348
- - **Outside tmux:** non-dry-run launch fails before team state or worktrees are created. Start `gjc team` from an attached tmux leader pane.
349
- - **Split failure:** startup records a failed phase if state was already initialized, rolls back created worktrees, and never kills the leader tmux session.
350
- - **Worker API ENOENT:** team state is missing or `GJC_TEAM_STATE_ROOT` points somewhere else. Check `.gjc/_session-{sessionid}/state/team/<team>/` before assuming worker failure.
351
- - **Stale pane on shutdown:** shutdown only kills a recorded worker pane when it still belongs to the stored `tmux_target` and is not the leader pane. Stale panes outside that target require manual inspection.
352
- - **Integration conflict:** `gjc team monitor <team>` / `resume` aborts the failing merge, cherry-pick, or worker rebase; `gjc team status <team>` is read-only inspection. Inspect `.gjc/_session-{sessionid}/state/team/<team>/integration-report.md`, `.gjc/_session-{sessionid}/state/team/<team>/events.jsonl`, `.gjc/_session-{sessionid}/state/team/<team>/mailbox/leader-fixed.json`, and `.gjc/_session-{sessionid}/reports/team-commit-hygiene/<team>.ledger.json`.
353
-
354
- ### Safe Manual Intervention (last resort)
355
-
356
- Use only after checking `gjc team status <team>` and state evidence:
357
-
358
- 1. Inspect team files:
359
- - `.gjc/_session-{sessionid}/state/team/<team>/config.json`
360
- - `.gjc/_session-{sessionid}/state/team/<team>/tasks/task-1.json`
361
- - `.gjc/_session-{sessionid}/state/team/<team>/mailbox/worker-1.json`
362
- 2. Use supported team surfaces before manual pane intervention:
363
- - `gjc team status <team>` for current recorded state
364
- - `gjc team monitor <team>` when a live monitor/update loop is needed
365
- - `gjc team api <team>` only for documented programmatic operations
366
- 3. If the recorded worker pane is stuck in an interactive state, safely return to idle prompt first:
367
- - optional interrupt `C-c` or escape flow (CLI-specific) once, then re-check `gjc team status <team>` and relevant state files
368
- 4. Send one concise trigger only when runtime/state checks show manual prompt input is needed:
369
- - `tmux send-keys -t %<worker-pane> "continue current task; report status" C-m`
370
- 5. Re-check task state, worker mailbox, and `gjc team status <team>`.
371
-
372
- ### Shutdown reports success but stale worker panes remain
373
-
374
- Cause:
375
- - The stale pane was not the recorded worker pane, no longer belonged to the stored `tmux_target`, or came from a previous failed run.
376
-
377
- Fix:
378
- - Manually inspect panes before cleanup and kill only verified stale worker panes.
379
-
380
- ## Clean-Slate Recovery
381
-
382
- Run from leader pane:
383
-
384
- ```bash
385
- # 1) Inspect panes
386
- tmux list-panes -F '#{pane_id} #{pane_current_command} #{pane_start_command}'
387
-
388
- # 2) Kill verified stale worker panes only (examples)
389
- tmux kill-pane -t %450
390
- tmux kill-pane -t %451
391
-
392
- # 3) Shut down recorded team state/workers through the supported team runtime
393
- # Replace <team-name> with the team from `gjc team list` / `gjc team status`.
394
- gjc team shutdown <team-name>
395
-
396
- # 4) Retry
397
- gjc team executor "fresh retry"
398
- ```
399
-
400
- Guidelines:
401
-
402
- - Do not kill the leader pane.
403
- - Do not kill HUD panes unless intentionally restarting HUD.
404
- - Prefer `gjc team shutdown <team>` for recorded active workers; use manual pane cleanup only for verified stale panes.
405
-
406
- ## Required Reporting During Execution
407
-
408
- When operating this skill, provide concrete progress evidence:
409
-
410
- 1. Team started line (`Team started: <name>`)
411
- 2. tmux target and worker pane id
412
- 3. task state from read-only `gjc team status <team>`, mutating `gjc team monitor <team>`, or `.gjc/_session-{sessionid}/state/team/<team>/tasks/task-1.json`
413
- 4. shutdown outcome (`phase=complete`, worker status `stopped`) when the run is terminal; incomplete shutdowns must report `phase=cancelled`/`failed`, and integration-blocked shutdowns must report `phase=awaiting_integration`
414
-
415
- Do not claim success without file/pane evidence.
416
- Do not claim clean completion if shutdown occurred with `in_progress>0`.
417
- Use `gjc team status <team>` and `gjc team monitor <team>` as the supported operator aids for status inspection; keep raw state-file or pane evidence available for manual intervention and proof.
418
-
419
- ## Programmatic Team Orchestration
420
-
421
- Use the `gjc team ...` CLI as the supported team-launch surface. For automation, drive the same CLI flow from scripts or supervising agents rather than relying on a separate runtime integration runner.
422
-
423
- ### Supported current surfaces
424
-
425
- - **`gjc team ...` CLI** — Primary method for interactive or automated team orchestration. Use this when you want direct tmux-pane visibility or a scriptable launch path.
426
- - **`gjc team status <team>`** — Read current team/task/worker state.
427
- - **`gjc team monitor <team>`** — Follow live progress through the supported runtime surface.
428
- - **`gjc team shutdown <team>`** — Stop recorded active workers and move the team toward terminal state.
429
- - **`gjc team api <team>`** — Use only for documented programmatic operations exposed by the team runtime.
430
- - **Team state files** — Inspect `.gjc/_session-{sessionid}/state/team/<team>/` when you need status, task, or mailbox evidence after launch.
431
-
432
- ### Cleanup distinction
433
-
434
- Use `gjc team shutdown <team>` for recorded active workers. After shutdown reports a terminal state and required evidence is preserved, use supported `gjc state ...` session/mode cleanup commands only when you are intentionally clearing state; do not delete team state by hand during an active run. Use manual tmux/session cleanup only for verified stale panes that are not handled by the documented shutdown flow.
435
-
436
- ### Automation example
437
-
438
- ```
439
- 1. gjc team executor "fix bugs"
440
- 2. gjc team status <team-name>
441
- 3. gjc team shutdown <team-name>
442
- 4. Clean up the finished team state for <team-name>
443
- ```
444
-
445
- ## Limitations
446
-
447
- - Worktree provisioning requires a git repository and can fail on branch/path collisions
448
- - send-keys interactions can be timing-sensitive under load
449
- - stale panes from prior runs can interfere until manually cleaned
450
-
451
- ## Scenario Examples
452
-
453
- **Good:** The user says `continue` after the workflow already has a clear next step. Continue the current branch of work instead of restarting or re-asking the same question.
454
-
455
- **Good:** The user changes only the output shape or downstream delivery step (for example `make a PR`). Preserve earlier non-conflicting workflow constraints and apply the update locally.
456
-
457
- **Bad:** The user says `continue`, and the workflow restarts discovery or stops before the missing verification/evidence is gathered.
458
-
459
- ## Handoff back to planning or persistence
460
-
461
- When the team task-set completes OR the user requests return to planning/persistence, mark team ready for handoff so the skill tool's chain guard permits the transition:
462
-
463
- ```
464
- gjc state team write --input '{"current_phase":"handoff"}' --json
465
- ```
466
-
467
- The skill tool then dispatches `/skill:ralplan`, `/skill:deep-interview`, or `/skill:ultragoal` same-turn and runs `gjc state team handoff --to <ralplan|deep-interview|ultragoal> --json` in-process to atomically demote team, promote the callee, and sync both `.gjc/_session-{sessionid}/state/skill-active-state.json` files. You do not need to run the handoff verb yourself.
@@ -1,49 +0,0 @@
1
- /**
2
- * GC adapter for team workers (`.gjc/state/team/<name>/workers/<id>/` heartbeat
3
- * + lifecycle). Liveness-only: numeric PID status dominates lifecycle/heartbeat
4
- * signals.
5
- */
6
-
7
- import * as path from "node:path";
8
- import { listHarnessRootRegistriesForGc } from "../harness-control-plane/storage";
9
- import type { GcCollectResult, GcContext, GcPruneOutcome, GcRecord, GcStoreAdapter } from "./gc-runtime";
10
- import { listTeamWorkerGcRecords, pruneTeamWorkerGcRecord } from "./team-runtime";
11
-
12
- function uniqueTeamRootsFromHarnessRoots(roots: string[]): string[] {
13
- return [...new Set(roots.map(root => path.join(path.dirname(root), "team")))].sort();
14
- }
15
-
16
- export const teamWorkersGcAdapter: GcStoreAdapter = {
17
- store: "team_workers",
18
- async collect(ctx: GcContext): Promise<GcCollectResult> {
19
- const records: GcRecord[] = [];
20
- const errors: GcCollectResult["errors"] = [];
21
- const registries = await listHarnessRootRegistriesForGc(ctx.env);
22
- for (const registry of registries) {
23
- if (registry.error) errors.push({ store: "team_workers", scope: registry.file, message: registry.error });
24
- }
25
-
26
- const teamRoots = uniqueTeamRootsFromHarnessRoots(
27
- registries.flatMap(registry => registry.roots.map(entry => entry.root)),
28
- );
29
- for (const teamRoot of teamRoots) {
30
- try {
31
- records.push(...(await listTeamWorkerGcRecords(teamRoot, ctx.probe)));
32
- } catch (error) {
33
- const code = (error as NodeJS.ErrnoException).code;
34
- if (code === "ENOENT") continue;
35
- errors.push({ store: "team_workers", scope: teamRoot, message: (error as Error).message });
36
- }
37
- }
38
-
39
- return { records, errors };
40
- },
41
- async prune(record: GcRecord, ctx: GcContext): Promise<GcPruneOutcome> {
42
- try {
43
- const removed = await pruneTeamWorkerGcRecord(record, ctx.probe);
44
- return removed ? { removed: true } : { removed: false, skipped: "worker_no_longer_dead" };
45
- } catch (error) {
46
- return { removed: false, error: (error as Error).message };
47
- }
48
- },
49
- };