aiwcli 0.15.5 → 0.15.7

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 (299) hide show
  1. package/README.md +6 -3
  2. package/dist/capabilities/branch/adapters.d.ts +2 -0
  3. package/dist/capabilities/branch/adapters.js +21 -0
  4. package/dist/capabilities/branch/contracts.d.ts +57 -0
  5. package/dist/capabilities/branch/contracts.js +1 -0
  6. package/dist/capabilities/branch/control-plane.d.ts +2 -0
  7. package/dist/capabilities/branch/control-plane.js +343 -0
  8. package/dist/capabilities/branch/runtime-core.d.ts +5 -0
  9. package/dist/capabilities/branch/runtime-core.js +36 -0
  10. package/dist/capabilities/installation/control-plane/clean-command.d.ts +41 -0
  11. package/dist/capabilities/installation/control-plane/clean-command.js +196 -0
  12. package/dist/capabilities/installation/control-plane/clear-command.d.ts +160 -0
  13. package/dist/capabilities/installation/control-plane/clear-command.js +1220 -0
  14. package/dist/capabilities/installation/control-plane/init-command.d.ts +81 -0
  15. package/dist/capabilities/installation/control-plane/init-command.js +449 -0
  16. package/dist/capabilities/launch/contracts.d.ts +51 -0
  17. package/dist/capabilities/launch/contracts.js +1 -0
  18. package/dist/capabilities/launch/control-plane/execute-launch.d.ts +2 -0
  19. package/dist/capabilities/launch/control-plane/execute-launch.js +222 -0
  20. package/dist/capabilities/launch/runtime-core/launch-options.d.ts +14 -0
  21. package/dist/capabilities/launch/runtime-core/launch-options.js +69 -0
  22. package/dist/cli/base-command.d.ts +18 -0
  23. package/dist/cli/base-command.js +55 -0
  24. package/dist/commands/branch.d.ts +0 -20
  25. package/dist/commands/branch.js +24 -416
  26. package/dist/commands/clean.d.ts +1 -41
  27. package/dist/commands/clean.js +1 -196
  28. package/dist/commands/clear.d.ts +1 -161
  29. package/dist/commands/clear.js +1 -1121
  30. package/dist/commands/init/index.d.ts +1 -98
  31. package/dist/commands/init/index.js +4 -478
  32. package/dist/commands/launch.d.ts +36 -11
  33. package/dist/commands/launch.js +135 -159
  34. package/dist/lib/base-command.d.ts +1 -114
  35. package/dist/lib/base-command.js +1 -153
  36. package/dist/lib/claude-settings-types.d.ts +31 -19
  37. package/dist/lib/context/context-formatter.d.ts +74 -0
  38. package/dist/lib/context/context-formatter.js +493 -0
  39. package/dist/lib/context/context-selector.d.ts +42 -0
  40. package/dist/lib/context/context-selector.js +451 -0
  41. package/dist/lib/context/context-store.d.ts +100 -0
  42. package/dist/lib/context/context-store.js +618 -0
  43. package/dist/lib/context/plan-manager.d.ts +54 -0
  44. package/dist/lib/context/plan-manager.js +282 -0
  45. package/dist/lib/context/task-tracker.d.ts +44 -0
  46. package/dist/lib/context/task-tracker.js +146 -0
  47. package/dist/lib/core-ide-base.d.ts +4 -0
  48. package/dist/lib/core-ide-base.js +77 -0
  49. package/dist/lib/core-installer.d.ts +5 -0
  50. package/dist/lib/core-installer.js +54 -0
  51. package/dist/lib/git-exclude-manager.d.ts +2 -2
  52. package/dist/lib/git-exclude-manager.js +3 -3
  53. package/dist/lib/hooks/hook-utils.d.ts +143 -0
  54. package/dist/lib/hooks/hook-utils.js +609 -0
  55. package/dist/lib/hooks/session-end-logic.d.ts +5 -0
  56. package/dist/lib/hooks/session-end-logic.js +63 -0
  57. package/dist/lib/hooks-merger.js +25 -19
  58. package/dist/lib/ide-path-resolver.d.ts +19 -7
  59. package/dist/lib/ide-path-resolver.js +25 -9
  60. package/dist/lib/install-state.d.ts +34 -0
  61. package/dist/lib/install-state.js +161 -0
  62. package/dist/lib/launch-options.d.ts +1 -0
  63. package/dist/lib/launch-options.js +1 -0
  64. package/dist/lib/lsp-patch.d.ts +12 -0
  65. package/dist/lib/lsp-patch.js +156 -0
  66. package/dist/lib/multiplexer.d.ts +57 -0
  67. package/dist/lib/multiplexer.js +19 -0
  68. package/dist/lib/multiplexers/psmux.d.ts +75 -0
  69. package/dist/lib/multiplexers/psmux.js +384 -0
  70. package/dist/lib/multiplexers/tmux.d.ts +44 -0
  71. package/dist/lib/multiplexers/tmux.js +262 -0
  72. package/dist/lib/mux-utils.d.ts +5 -0
  73. package/dist/lib/mux-utils.js +42 -0
  74. package/dist/lib/paths.d.ts +2 -2
  75. package/dist/lib/paths.js +2 -2
  76. package/dist/lib/platform-commands.d.ts +27 -0
  77. package/dist/lib/platform-commands.js +49 -0
  78. package/dist/lib/runtime/aiw-cli.d.ts +37 -0
  79. package/dist/lib/runtime/aiw-cli.js +74 -0
  80. package/dist/lib/runtime/atomic-write.d.ts +19 -0
  81. package/dist/lib/runtime/atomic-write.js +121 -0
  82. package/dist/lib/runtime/cli-args.d.ts +55 -0
  83. package/dist/lib/runtime/cli-args.js +185 -0
  84. package/dist/lib/runtime/constants.d.ts +56 -0
  85. package/dist/lib/runtime/constants.js +230 -0
  86. package/dist/lib/runtime/executable-policy.d.ts +16 -0
  87. package/dist/lib/runtime/executable-policy.js +57 -0
  88. package/dist/lib/runtime/git-state.d.ts +9 -0
  89. package/dist/lib/runtime/git-state.js +59 -0
  90. package/dist/lib/runtime/inference.d.ts +37 -0
  91. package/dist/lib/runtime/inference.js +262 -0
  92. package/dist/lib/runtime/lint-dispatch.d.ts +40 -0
  93. package/dist/lib/runtime/lint-dispatch.js +285 -0
  94. package/dist/lib/runtime/logger.d.ts +66 -0
  95. package/dist/lib/runtime/logger.js +201 -0
  96. package/dist/lib/runtime/models.d.ts +14 -0
  97. package/dist/lib/runtime/models.js +14 -0
  98. package/dist/lib/runtime/platform-adapter.d.ts +7 -0
  99. package/dist/lib/runtime/platform-adapter.js +21 -0
  100. package/dist/lib/runtime/preflight.d.ts +24 -0
  101. package/dist/lib/runtime/preflight.js +65 -0
  102. package/dist/lib/runtime/sentinel-ipc.d.ts +14 -0
  103. package/dist/lib/runtime/sentinel-ipc.js +67 -0
  104. package/dist/lib/runtime/state-io.d.ts +30 -0
  105. package/dist/lib/runtime/state-io.js +174 -0
  106. package/dist/lib/runtime/stop-words.d.ts +20 -0
  107. package/dist/lib/runtime/stop-words.js +150 -0
  108. package/dist/lib/runtime/subprocess-utils.d.ts +29 -0
  109. package/dist/lib/runtime/subprocess-utils.js +96 -0
  110. package/dist/lib/runtime/tmux-preflight.d.ts +13 -0
  111. package/dist/lib/runtime/tmux-preflight.js +78 -0
  112. package/dist/lib/runtime/utils.d.ts +54 -0
  113. package/dist/lib/runtime/utils.js +162 -0
  114. package/dist/lib/sentinel-wrapper.d.ts +9 -0
  115. package/dist/lib/sentinel-wrapper.js +20 -0
  116. package/dist/lib/shell-quoting.d.ts +5 -0
  117. package/dist/lib/shell-quoting.js +17 -0
  118. package/dist/lib/spawn-errors.d.ts +6 -0
  119. package/dist/lib/spawn-errors.js +15 -0
  120. package/dist/lib/spawn.js +5 -11
  121. package/dist/lib/template-installer.d.ts +4 -5
  122. package/dist/lib/template-installer.js +36 -34
  123. package/dist/lib/template-resolver.d.ts +6 -7
  124. package/dist/lib/template-resolver.js +26 -21
  125. package/dist/lib/template-settings-reconstructor.d.ts +7 -2
  126. package/dist/lib/template-settings-reconstructor.js +76 -45
  127. package/dist/lib/terminal-strategy.d.ts +11 -0
  128. package/dist/lib/terminal-strategy.js +49 -0
  129. package/dist/lib/terminal.d.ts +28 -0
  130. package/dist/lib/terminal.js +162 -112
  131. package/dist/lib/tmux-pane-placement.d.ts +17 -0
  132. package/dist/lib/tmux-pane-placement.js +58 -0
  133. package/dist/lib/tmux-primitives.d.ts +5 -0
  134. package/dist/lib/tmux-primitives.js +15 -0
  135. package/dist/lib/tmux-session.d.ts +32 -0
  136. package/dist/lib/tmux-session.js +86 -0
  137. package/dist/lib/tty-detection.js +1 -1
  138. package/dist/lib/types.d.ts +168 -0
  139. package/dist/lib/types.js +6 -0
  140. package/dist/lib/version.d.ts +1 -1
  141. package/dist/lib/version.js +1 -1
  142. package/dist/platform/launch.d.ts +10 -0
  143. package/dist/platform/launch.js +10 -0
  144. package/dist/templates/CLAUDE.md +31 -40
  145. package/dist/templates/cc-native/.claude/settings.json +27 -27
  146. package/dist/templates/cc-native/CC-NATIVE-README.md +1 -1
  147. package/dist/templates/cc-native/TEMPLATE-SCHEMA.md +10 -9
  148. package/dist/templates/cc-native/_cc-native/CLAUDE.md +18 -18
  149. package/dist/templates/cc-native/_cc-native/artifacts/CLAUDE.md +3 -3
  150. package/dist/templates/cc-native/_cc-native/artifacts/lib/format.ts +14 -14
  151. package/dist/templates/cc-native/_cc-native/artifacts/lib/tracker.ts +1 -1
  152. package/dist/templates/cc-native/_cc-native/artifacts/lib/write.ts +3 -3
  153. package/dist/templates/cc-native/_cc-native/cc-native.config.json +3 -3
  154. package/dist/templates/cc-native/_cc-native/hooks/CLAUDE.md +16 -15
  155. package/dist/templates/cc-native/_cc-native/hooks/cc-native-plan-review.ts +3 -3
  156. package/dist/templates/cc-native/_cc-native/hooks/enhance_plan_post_subagent.ts +2 -2
  157. package/dist/templates/cc-native/_cc-native/hooks/enhance_plan_post_write.ts +2 -2
  158. package/dist/templates/cc-native/_cc-native/hooks/mark_questions_asked.ts +3 -3
  159. package/dist/templates/cc-native/_cc-native/hooks/plan_questions_early.ts +2 -2
  160. package/dist/templates/cc-native/_cc-native/hooks/validate_task_prompt.ts +3 -3
  161. package/dist/templates/cc-native/_cc-native/lib-ts/CLAUDE.md +8 -8
  162. package/dist/templates/cc-native/_cc-native/lib-ts/aggregate-agents.ts +1 -1
  163. package/dist/templates/cc-native/_cc-native/lib-ts/cc-native-state.ts +4 -4
  164. package/dist/templates/cc-native/_cc-native/lib-ts/cli-output-parser.ts +1 -1
  165. package/dist/templates/cc-native/_cc-native/lib-ts/config.ts +1 -1
  166. package/dist/templates/cc-native/_cc-native/lib-ts/debug.ts +1 -1
  167. package/dist/templates/cc-native/_cc-native/lib-ts/json-parser.ts +1 -1
  168. package/dist/templates/cc-native/_cc-native/lib-ts/plan-discovery.ts +2 -2
  169. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/logger.ts +1 -1
  170. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/retrieval-pipeline.ts +2 -2
  171. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/types.ts +1 -1
  172. package/dist/templates/cc-native/_cc-native/lib-ts/settings.ts +8 -8
  173. package/dist/templates/cc-native/_cc-native/lib-ts/state.ts +3 -3
  174. package/dist/templates/cc-native/_cc-native/lib-ts/tsconfig.json +2 -2
  175. package/dist/templates/cc-native/_cc-native/lib-ts/types.ts +3 -3
  176. package/dist/templates/cc-native/_cc-native/plan-review/CLAUDE.md +3 -1
  177. package/dist/templates/cc-native/_cc-native/plan-review/lib/__tests__/agent-selection.test.ts +345 -0
  178. package/dist/templates/cc-native/_cc-native/plan-review/lib/__tests__/preflight.test.ts +344 -0
  179. package/dist/templates/cc-native/_cc-native/plan-review/lib/agent-selection.ts +37 -15
  180. package/dist/templates/cc-native/_cc-native/plan-review/lib/corroboration.ts +16 -69
  181. package/dist/templates/cc-native/_cc-native/plan-review/lib/orchestrator.ts +1 -1
  182. package/dist/templates/cc-native/_cc-native/plan-review/lib/output-builder.ts +1 -1
  183. package/dist/templates/cc-native/_cc-native/plan-review/lib/plan-questions.ts +2 -2
  184. package/dist/templates/cc-native/_cc-native/plan-review/lib/preflight.ts +56 -26
  185. package/dist/templates/cc-native/_cc-native/plan-review/lib/review-pipeline.ts +7 -7
  186. package/dist/templates/cc-native/_cc-native/plan-review/lib/reviewers/agent.ts +4 -4
  187. package/dist/templates/cc-native/_cc-native/plan-review/lib/reviewers/base/base-agent.ts +3 -3
  188. package/dist/templates/cc-native/_cc-native/plan-review/lib/reviewers/index.ts +1 -1
  189. package/dist/templates/cc-native/_cc-native/plan-review/lib/reviewers/providers/claude-agent.ts +2 -2
  190. package/dist/templates/cc-native/_cc-native/plan-review/lib/reviewers/providers/codex-agent.ts +4 -4
  191. package/dist/templates/cc-native/_cc-native/plan-review/lib/reviewers/providers/gemini-agent.ts +1 -1
  192. package/dist/templates/cc-native/_cc-native/plan-review/lib/reviewers/providers/orchestrator-claude-agent.ts +5 -6
  193. package/dist/templates/core/.codex/workflows/codex.md +17 -0
  194. package/dist/templates/core/.codex/workflows/handoff.md +5 -0
  195. package/dist/templates/core/.codex/workflows/meta-plan.md +7 -0
  196. package/dist/templates/core/.cognition/AGENTS.md +5 -0
  197. package/dist/templates/core/.cognition/config.json +12 -0
  198. package/dist/templates/{_shared → core}/.windsurf/workflows/handoff.md +1 -1
  199. package/dist/templates/{_shared → core}/.windsurf/workflows/meta-plan.md +1 -1
  200. package/dist/templates/core/hooks-ts/_utils/git-state.ts +2 -0
  201. package/dist/templates/{_shared → core}/hooks-ts/archive_plan.ts +14 -23
  202. package/dist/templates/core/hooks-ts/codex_explorer.ts +160 -0
  203. package/dist/templates/{_shared → core}/hooks-ts/context_monitor.ts +23 -55
  204. package/dist/templates/{_shared → core}/hooks-ts/file-suggestion.ts +4 -3
  205. package/dist/templates/{_shared → core}/hooks-ts/lint_after_edit.ts +7 -9
  206. package/dist/templates/{_shared → core}/hooks-ts/pre_compact.ts +5 -5
  207. package/dist/templates/{_shared → core}/hooks-ts/session_end.ts +38 -78
  208. package/dist/templates/{_shared → core}/hooks-ts/session_start.ts +5 -5
  209. package/dist/templates/core/hooks-ts/task_create_capture.ts +32 -0
  210. package/dist/templates/{_shared → core}/hooks-ts/task_update_capture.ts +9 -24
  211. package/dist/templates/core/hooks-ts/user_prompt_submit.ts +46 -0
  212. package/dist/templates/{_shared → core}/lib-ts/CLAUDE.md +27 -16
  213. package/dist/templates/{_shared → core}/lib-ts/agent-exec/backends/headless.ts +3 -2
  214. package/dist/templates/{_shared → core}/lib-ts/agent-exec/backends/tmux.ts +44 -15
  215. package/dist/templates/{_shared → core}/lib-ts/agent-exec/base-agent.ts +6 -4
  216. package/dist/templates/{_shared → core}/lib-ts/agent-exec/execution-backend.ts +1 -1
  217. package/dist/templates/{_shared → core}/lib-ts/agent-exec/index.ts +2 -2
  218. package/dist/templates/{_shared → core}/lib-ts/agent-exec/structured-output.ts +4 -5
  219. package/dist/templates/{_shared → core}/lib-ts/context/CLAUDE.md +9 -6
  220. package/dist/templates/{_shared → core}/lib-ts/context/context-formatter.ts +16 -21
  221. package/dist/templates/{_shared → core}/lib-ts/context/context-selector.ts +8 -6
  222. package/dist/templates/{_shared → core}/lib-ts/context/context-store.ts +32 -20
  223. package/dist/templates/{_shared → core}/lib-ts/context/plan-manager.ts +19 -15
  224. package/dist/templates/{_shared → core}/lib-ts/context/task-tracker.ts +3 -3
  225. package/dist/templates/core/lib-ts/hooks/context-monitor-logic.ts +32 -0
  226. package/dist/templates/{_shared/lib-ts/base → core/lib-ts/hooks}/hook-utils.ts +168 -41
  227. package/dist/templates/core/lib-ts/hooks/prompt-binding-logic.ts +80 -0
  228. package/dist/templates/core/lib-ts/hooks/session-end-logic.ts +93 -0
  229. package/dist/templates/core/lib-ts/package.json +19 -0
  230. package/dist/templates/core/lib-ts/runtime/agent-launcher.ts +295 -0
  231. package/dist/templates/core/lib-ts/runtime/aiw-cli.ts +106 -0
  232. package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/atomic-write.ts +12 -7
  233. package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/cli-args.ts +8 -6
  234. package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/constants.ts +326 -324
  235. package/dist/templates/core/lib-ts/runtime/executable-policy.ts +89 -0
  236. package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/git-state.ts +6 -4
  237. package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/inference.ts +59 -10
  238. package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/lint-dispatch.ts +25 -23
  239. package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/logger.ts +32 -29
  240. package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/models.ts +2 -2
  241. package/dist/templates/core/lib-ts/runtime/platform-adapter.ts +33 -0
  242. package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/preflight.ts +4 -3
  243. package/dist/templates/core/lib-ts/runtime/sentinel-ipc.ts +91 -0
  244. package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/state-io.ts +11 -7
  245. package/dist/templates/core/lib-ts/runtime/stop-words.ts +185 -0
  246. package/dist/templates/core/lib-ts/runtime/subprocess-utils.ts +147 -0
  247. package/dist/templates/core/lib-ts/runtime/tmux-preflight.ts +93 -0
  248. package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/utils.ts +4 -3
  249. package/dist/templates/{_shared → core}/lib-ts/templates/formatters.ts +7 -5
  250. package/dist/templates/{_shared → core}/lib-ts/templates/plan-context.ts +2 -1
  251. package/dist/templates/{_shared → core}/lib-ts/tsconfig.json +3 -1
  252. package/dist/templates/{_shared → core}/lib-ts/types.ts +78 -77
  253. package/dist/templates/core/scripts/resolve-run.ts +61 -0
  254. package/dist/templates/{_shared → core}/scripts/resolve_context.ts +3 -3
  255. package/dist/templates/{_shared → core}/scripts/status_line.ts +25 -20
  256. package/dist/templates/core/skills/codex/CLAUDE.md +78 -0
  257. package/dist/templates/{_shared → core}/skills/codex/SKILL.md +21 -18
  258. package/dist/templates/{_shared → core}/skills/codex/lib/codex-watcher.ts +76 -103
  259. package/dist/templates/{_shared → core}/skills/codex/scripts/launch-codex.ts +119 -133
  260. package/dist/templates/{_shared → core}/skills/codex/scripts/watch-codex.ts +6 -4
  261. package/dist/templates/core/skills/devin/CLAUDE.md +65 -0
  262. package/dist/templates/core/skills/devin/SKILL.md +73 -0
  263. package/dist/templates/core/skills/devin/lib/devin-watcher.ts +280 -0
  264. package/dist/templates/core/skills/devin/scripts/launch-devin.ts +257 -0
  265. package/dist/templates/{_shared → core}/skills/handoff-system/CLAUDE.md +436 -433
  266. package/dist/templates/{_shared → core}/skills/handoff-system/lib/document-generator.ts +9 -7
  267. package/dist/templates/{_shared → core}/skills/handoff-system/lib/handoff-reader.ts +6 -4
  268. package/dist/templates/{_shared → core}/skills/handoff-system/scripts/resume_handoff.ts +10 -8
  269. package/dist/templates/{_shared → core}/skills/handoff-system/scripts/save_handoff.ts +12 -10
  270. package/dist/templates/{_shared → core}/skills/handoff-system/workflows/handoff-resume.md +2 -2
  271. package/dist/templates/{_shared → core}/skills/handoff-system/workflows/handoff.md +6 -5
  272. package/dist/templates/{_shared → core}/skills/meta-plan/CLAUDE.md +2 -1
  273. package/dist/templates/{_shared → core}/skills/meta-plan/workflows/meta-plan.md +8 -7
  274. package/oclif.manifest.json +89 -13
  275. package/package.json +13 -12
  276. package/dist/templates/_shared/.claude/settings.json +0 -120
  277. package/dist/templates/_shared/.claude/skills/codex/SKILL.md +0 -35
  278. package/dist/templates/_shared/.claude/skills/handoff/SKILL.md +0 -13
  279. package/dist/templates/_shared/.claude/skills/handoff-resume/SKILL.md +0 -13
  280. package/dist/templates/_shared/.claude/skills/meta-plan/SKILL.md +0 -43
  281. package/dist/templates/_shared/.codex/workflows/codex.md +0 -11
  282. package/dist/templates/_shared/.codex/workflows/handoff.md +0 -226
  283. package/dist/templates/_shared/.codex/workflows/meta-plan.md +0 -347
  284. package/dist/templates/_shared/hooks-ts/_utils/git-state.ts +0 -2
  285. package/dist/templates/_shared/hooks-ts/task_create_capture.ts +0 -48
  286. package/dist/templates/_shared/hooks-ts/user_prompt_submit.ts +0 -93
  287. package/dist/templates/_shared/lib-ts/base/launchers/tmux-launcher.ts +0 -173
  288. package/dist/templates/_shared/lib-ts/base/launchers/window-launcher.ts +0 -93
  289. package/dist/templates/_shared/lib-ts/base/launchers/wt-launcher.ts +0 -64
  290. package/dist/templates/_shared/lib-ts/base/pane-launcher.ts +0 -55
  291. package/dist/templates/_shared/lib-ts/base/sentinel-ipc.ts +0 -87
  292. package/dist/templates/_shared/lib-ts/base/stop-words.ts +0 -184
  293. package/dist/templates/_shared/lib-ts/base/subprocess-utils.ts +0 -249
  294. package/dist/templates/_shared/lib-ts/base/tmux-driver.ts +0 -341
  295. package/dist/templates/_shared/lib-ts/base/tmux-pane-placement.ts +0 -78
  296. package/dist/templates/_shared/lib-ts/package.json +0 -20
  297. package/dist/templates/_shared/scripts/resolve-run.ts +0 -62
  298. package/dist/templates/_shared/skills/codex/CLAUDE.md +0 -70
  299. /package/dist/templates/{_shared → core}/lib-ts/agent-exec/backends/index.ts +0 -0
@@ -5,128 +5,128 @@
5
5
  */
6
6
 
7
7
  // §1.1
8
- export type Mode = "idle" | "has_staged_work" | "active";
8
+ export type Mode = "active" | "has_staged_work" | "idle";
9
9
 
10
10
  export interface ContextState {
11
- id: string;
12
- status: "active" | "completed";
13
- summary: string;
14
- method: string;
15
- tags: string[];
16
11
  created_at: string;
12
+ /** @deprecated Use work_consumed instead */
13
+ handoff_consumed?: boolean;
14
+ handoff_path: null | string;
15
+ id: string;
17
16
  last_active: string;
17
+ last_session: LastSession | null;
18
+ method: string;
18
19
  mode: Mode;
19
- plan_path: string | null;
20
- plan_hash: string | null;
21
- plan_signature: string | null;
22
- plan_id: string | null;
20
+ next_artifact_type: "handoff" | "plan" | null; // Explicit artifact type for has_staged_work mode
23
21
  plan_anchors: string[];
24
- plan_hash_consumed: string | null;
25
- handoff_path: string | null;
26
- // Unified lifecycle fields (v0.13.0+)
27
- work_consumed: boolean; // Replaces plan_consumed + handoff_consumed
28
- next_artifact_type: "plan" | "handoff" | null; // Explicit artifact type for has_staged_work mode
29
22
  // Deprecated fields (kept for migration)
30
23
  /** @deprecated Use work_consumed instead */
31
24
  plan_consumed?: boolean;
32
- /** @deprecated Use work_consumed instead */
33
- handoff_consumed?: boolean;
25
+ plan_hash: null | string;
26
+ plan_hash_consumed: null | string;
27
+ plan_id: null | string;
28
+ plan_path: null | string;
29
+ plan_signature: null | string;
34
30
  session_ids: string[];
35
- last_session: LastSession | null;
31
+ status: "active" | "completed";
32
+ summary: string;
33
+ tags: string[];
36
34
  tasks: Task[];
35
+ // Unified lifecycle fields (v0.13.0+)
36
+ work_consumed: boolean; // Replaces plan_consumed + handoff_consumed
37
37
  }
38
38
 
39
39
  // §1.2
40
40
  export interface GitState {
41
41
  branch?: string;
42
- uncommitted_files?: string[];
43
42
  last_commit_short?: string;
43
+ uncommitted_files?: string[];
44
44
  }
45
45
 
46
46
  export interface LastSession {
47
- session_id?: string;
48
- saved_at?: string;
49
- save_reason?: string;
50
- transcript_path?: string;
51
47
  context_remaining_pct?: number;
52
48
  context_warnings_fired?: number[];
53
49
  git_state?: GitState;
50
+ save_reason?: string;
51
+ saved_at?: string;
52
+ session_id?: string;
53
+ transcript_path?: string;
54
54
  }
55
55
 
56
56
  // §1.3
57
57
  export interface Task {
58
- id: string;
59
- subject: string;
60
- description: string;
61
58
  active_form: string;
62
- status: "pending" | "in_progress" | "completed" | "blocked";
59
+ completed_at: null | string;
63
60
  created_at: string;
64
- completed_at: string | null;
61
+ description: string;
65
62
  evidence: string;
66
- work_summary: string;
67
63
  files_changed: string[];
64
+ id: string;
68
65
  session_id?: string;
66
+ status: "blocked" | "completed" | "in_progress" | "pending";
67
+ subject: string;
68
+ work_summary: string;
69
69
  }
70
70
 
71
71
  // §1.4
72
72
  export interface IndexEntry {
73
- summary: string;
74
- mode: string;
75
73
  last_active: string;
74
+ mode: string;
75
+ summary: string;
76
76
  }
77
77
 
78
78
  export interface IndexFile {
79
- version: "3.0";
80
- updated_at: string;
81
- sessions: Record<string, string>;
82
79
  contexts: Record<string, IndexEntry>;
80
+ sessions: Record<string, string>;
81
+ updated_at: string;
82
+ version: "3.0";
83
83
  }
84
84
 
85
85
  // §1.5
86
86
  export interface LogEntry {
87
- ts: string;
88
- level: "debug" | "info" | "warn" | "error";
87
+ component?: string;
88
+ data?: unknown;
89
89
  hook: string;
90
+ level: "debug" | "error" | "info" | "warn";
90
91
  msg: string;
91
- component?: string;
92
- data?: any;
93
92
  tb?: string;
93
+ ts: string;
94
94
  }
95
95
 
96
96
  // §1.6
97
97
  export interface HookInput {
98
- hook_event_name: string;
99
- tool_name?: string;
100
- tool_input?: Record<string, any>;
101
- tool_result?: string;
102
- session_id?: string;
103
- cwd?: string;
104
- transcript_path?: string;
105
98
  context_window?: {
99
+ context_window_size?: number;
106
100
  current_usage?: {
101
+ cache_creation_input_tokens?: number;
107
102
  cache_read_input_tokens?: number;
108
103
  input_tokens?: number;
109
- cache_creation_input_tokens?: number;
110
104
  output_tokens?: number;
111
105
  };
112
- context_window_size?: number;
113
106
  };
107
+ cwd?: string;
108
+ hook_event_name: string;
114
109
  permission_mode?: string;
110
+ session_id?: string;
115
111
  source?: string;
112
+ tool_input?: Record<string, unknown>;
113
+ tool_name?: string;
114
+ tool_result?: string;
115
+ transcript_path?: string;
116
116
  }
117
117
 
118
118
  // §1.7 — Three hook output patterns (see hook-utils.ts for emit functions)
119
119
  export interface HookOutput {
120
+ // Pattern 2: Top-level decision (UserPromptSubmit, Stop, SubagentStop)
121
+ decision?: "block";
120
122
  // Pattern 1: hookSpecificOutput (PreToolUse, PostToolUse, UserPromptSubmit, etc.)
121
123
  hookSpecificOutput?: {
122
- hookEventName?: string;
123
124
  additionalContext?: string;
124
- permissionDecision?: "allow" | "deny" | "ask";
125
+ hookEventName?: string;
126
+ permissionDecision?: "allow" | "ask" | "deny";
125
127
  permissionDecisionReason?: string;
126
128
  updatedInput?: Record<string, unknown>;
127
129
  };
128
- // Pattern 2: Top-level decision (UserPromptSubmit, Stop, SubagentStop)
129
- decision?: "block";
130
130
  reason?: string;
131
131
  }
132
132
 
@@ -142,62 +142,63 @@ export interface PermissionRequestOutput {
142
142
 
143
143
  // §1.8
144
144
  export interface InferenceResult {
145
- success: boolean;
146
- output: string;
147
145
  error?: string;
148
146
  latency_ms: number;
147
+ output: string;
148
+ success: boolean;
149
149
  }
150
150
 
151
151
  // §1.9
152
152
  export interface HandoffDocument {
153
+ active_tasks: Task[];
154
+ completed_tasks_this_session: Array<{ subject: string }>;
155
+ context_folder: string;
153
156
  context_id: string;
154
157
  context_summary: string;
155
- session_id: string;
156
- reason: string;
157
158
  created_at: string;
158
- plan_path: string | null;
159
- context_folder: string;
160
159
  events_log_path: string;
161
- active_tasks: Task[];
162
- completed_tasks_this_session: Array<{ subject: string }>;
163
- work_summary: string;
164
- next_steps: string[];
160
+ file_path: null | string;
165
161
  important_notes: string[];
166
- file_path: string | null;
162
+ next_steps: string[];
163
+ plan_path: null | string;
164
+ reason: string;
165
+ session_id: string;
166
+ work_summary: string;
167
167
  }
168
168
 
169
169
  // §1.10
170
170
  export interface HandoffSections {
171
- index: string | null;
172
- deadEnds: string | null;
173
- pending: string | null;
174
- plan: string | null;
175
- decisions: string | null;
176
- completedWork: string | null;
177
- context: string | null;
171
+ completedWork: null | string;
172
+ context: null | string;
173
+ deadEnds: null | string;
174
+ decisions: null | string;
175
+ index: null | string;
176
+ pending: null | string;
177
+ plan: null | string;
178
178
  }
179
179
 
180
180
  // §1.11
181
181
  export interface CaretCommand {
182
182
  ends: string[];
183
- select: string | null;
184
- new_context_desc: string | null;
183
+ new_context_desc: null | string;
185
184
  remaining_prompt: string;
185
+ select: null | string;
186
186
  }
187
187
 
188
188
  // §1.12 — Preflight types (shared across hooks)
189
- // Re-exported from base/preflight.ts for convenience
190
- export type { PreflightCommandConfig, PreflightCheckResult } from "./base/preflight.js";
189
+ // Re-exported from runtime/preflight.ts for convenience
190
+ export type { PreflightCheckResult, PreflightCommandConfig } from "./runtime/preflight.js";
191
191
 
192
192
  // §1.13 — Agent configuration (shared across templates)
193
193
 
194
194
  /** Configuration for a CLI review agent */
195
195
  export interface AgentConfig {
196
- name: string;
197
- model: string;
198
- provider: string; // e.g. "claude" | "codex" — assigned at runtime by assignModelsToAgents()
199
- focus: string;
200
196
  categories: string[];
201
197
  description: string;
198
+ focus: string;
199
+ model: string;
200
+ name: string;
201
+ provider: string; // e.g. "claude" | "codex" — assigned at runtime by assignModelsToAgents()
202
202
  system_prompt: string; // Markdown body content for --system-prompt
203
203
  }
204
+
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/env bun
2
+ /**
3
+ * Cross-platform project root resolver for hook and status line commands.
4
+ *
5
+ * Finds the project root, sets cwd, then dynamically imports the target script
6
+ * in-process (no second bun spawn). stdin/stdout/stderr pass through naturally.
7
+ *
8
+ * Root detection strategy (fastest first):
9
+ * 1. Derive from this script's own location (O(1) — no I/O)
10
+ * 2. Walk up from cwd to find .aiwcli/ anchor (O(depth) — a few stat calls)
11
+ *
12
+ * Usage: bun .aiwcli/_core/scripts/resolve-run.ts .aiwcli/_core/hooks-ts/hook.ts
13
+ */
14
+ import * as fs from "node:fs";
15
+ import path from "node:path";
16
+
17
+ function findProjectRoot(): string {
18
+ // 1. Derive from script location: .aiwcli/_core/scripts/resolve-run.ts → 3 levels up
19
+ const derived = path.resolve(import.meta.dir, "..", "..", "..");
20
+ if (fs.existsSync(path.join(derived, ".aiwcli"))) return derived;
21
+
22
+ // 2. Walk up from cwd to find .aiwcli/ anchor
23
+ let dir = process.cwd();
24
+ while (true) {
25
+ if (fs.existsSync(path.join(dir, ".aiwcli"))) return dir;
26
+ const parent = path.dirname(dir);
27
+ if (parent === dir) break;
28
+ dir = parent;
29
+ }
30
+
31
+ return process.cwd(); // last resort
32
+ }
33
+
34
+ const target = process.argv[2];
35
+ if (!target) {
36
+ process.stderr.write("resolve-run: missing script path argument\n");
37
+ process.exit(1);
38
+ }
39
+
40
+ const root = findProjectRoot();
41
+ const fullPath = path.resolve(root, target);
42
+
43
+ if (!fs.existsSync(fullPath)) {
44
+ process.stderr.write(`resolve-run: script not found: ${fullPath}\n`);
45
+ process.exit(1);
46
+ }
47
+
48
+ // Set up environment before importing the hook
49
+ process.env.AIW_CALLER_CWD = process.cwd();
50
+
51
+ // Scope FORCE_COLOR to status line only — other hooks may emit structured
52
+ // output that should not contain ANSI escape codes.
53
+ if (fullPath.endsWith("status_line.ts")) {
54
+ process.env.FORCE_COLOR ??= "2";
55
+ }
56
+
57
+ process.chdir(root);
58
+ await import(fullPath);
59
+
60
+
61
+
@@ -3,7 +3,7 @@
3
3
  * Resolve and print the active context ID.
4
4
  *
5
5
  * Usage:
6
- * bun .aiwcli/_shared/scripts/resolve_context.ts
6
+ * bun .aiwcli/_core/scripts/resolve_context.ts
7
7
  *
8
8
  * Prints the context ID to stdout. Exits 1 if no active context found.
9
9
  * Used by command templates (/handoff, /handoff-resume) to programmatically
@@ -11,9 +11,9 @@
11
11
  *
12
12
  * Requires CLAUDE_SESSION_ID environment variable (set by Claude Code).
13
13
  */
14
- import { getProjectRoot } from "../lib-ts/base/constants.js";
15
- import { eprint } from "../lib-ts/base/utils.js";
16
14
  import { getContextBySessionId } from "../lib-ts/context/context-store.js";
15
+ import { getProjectRoot } from "../lib-ts/runtime/constants.js";
16
+ import { eprint } from "../lib-ts/runtime/utils.js";
17
17
 
18
18
  const projectRoot = getProjectRoot(process.cwd());
19
19
  const sessionId = process.env.CLAUDE_SESSION_ID;
@@ -12,7 +12,8 @@
12
12
  import { execFileSync } from "node:child_process";
13
13
  import * as fs from "node:fs";
14
14
  import { homedir } from "node:os";
15
- import * as path from "node:path";
15
+ import path from "node:path";
16
+
16
17
  import type { ContextState } from "../lib-ts/types.js";
17
18
 
18
19
  // PAI infrastructure imports — graceful fallback when libs aren't available
@@ -25,7 +26,7 @@ let saveState: (id: string, state: ContextState) => void = () => {};
25
26
  let findLatestPlan: (contextId: string) => string | null = () => null;
26
27
 
27
28
  try {
28
- const hookUtils = await import("../lib-ts/base/hook-utils.js");
29
+ const hookUtils = await import("../lib-ts/hooks/hook-utils.js");
29
30
  CONTEXT_BASELINE_TOKENS = hookUtils.CONTEXT_BASELINE_TOKENS;
30
31
  } catch {
31
32
  /* PAI hook-utils not available */
@@ -52,7 +53,7 @@ try {
52
53
  // Path setup
53
54
  // ---------------------------------------------------------------------------
54
55
  const SCRIPT_DIR = path.dirname(new URL(import.meta.url).pathname);
55
- // Resolve project root from script location (.aiwcli/_shared/scripts/) so paths
56
+ // Resolve project root from script location (.aiwcli/_core/scripts/) so paths
56
57
  // work even when cwd has drifted via `cd` in a Bash tool call.
57
58
  const PROJECT_ROOT = path.resolve(SCRIPT_DIR, "..", "..", "..");
58
59
  const OUTPUT_DIR = path.join(PROJECT_ROOT, "_output");
@@ -213,19 +214,18 @@ function renderContextBar(width: number, pct: number): [string, string] {
213
214
  // Display width helper — accounts for wide Unicode and ANSI escapes
214
215
  // ---------------------------------------------------------------------------
215
216
 
216
- // biome-ignore lint/suspicious/noControlCharactersInRegex: ANSI escape stripping requires \x1b
217
- const ANSI_RE = /\x1b\[[0-9;]*m/g;
217
+ const ANSI_RE = new RegExp(`${String.raw`\u001B`}\\[[0-9;]*m`, "g");
218
218
 
219
219
  function isWideChar(cp: number): boolean {
220
220
  return (
221
- cp === 0x26c1 || // ⛁ draughts man
222
- cp === 0x23f1 || // ⏱ stopwatch
223
- (cp >= 0x2600 && cp <= 0x26ff) || // misc symbols
224
- (cp >= 0x2700 && cp <= 0x27bf) || // dingbats
225
- (cp >= 0x1f300 && cp <= 0x1faff) || // emoji
226
- (cp >= 0xfe00 && cp <= 0xfe0f) || // variation selectors
227
- (cp >= 0x4e00 && cp <= 0x9fff) || // CJK
228
- (cp >= 0x3000 && cp <= 0x303f) // CJK symbols
221
+ cp === 0x26_c1 || // ⛁ draughts man
222
+ cp === 0x23_f1 || // ⏱ stopwatch
223
+ (cp >= 0x26_00 && cp <= 0x26_ff) || // misc symbols
224
+ (cp >= 0x27_00 && cp <= 0x27_bf) || // dingbats
225
+ (cp >= 0x1_f3_00 && cp <= 0x1_fa_ff) || // emoji
226
+ (cp >= 0xfe_00 && cp <= 0xfe_0f) || // variation selectors
227
+ (cp >= 0x4e_00 && cp <= 0x9f_ff) || // CJK
228
+ (cp >= 0x30_00 && cp <= 0x30_3f) // CJK symbols
229
229
  );
230
230
  }
231
231
 
@@ -404,7 +404,7 @@ function runGit(args: string[], cwd: string, timeout = 2000): string | null {
404
404
  const result = execFileSync("git", args, {
405
405
  cwd,
406
406
  timeout,
407
- encoding: "utf-8",
407
+ encoding: "utf8",
408
408
  stdio: ["pipe", "pipe", "pipe"],
409
409
  windowsHide: true,
410
410
  });
@@ -687,12 +687,15 @@ function renderContextManager(
687
687
  // Note: termWidth not available here — caller truncates via main()
688
688
  switch (mode) {
689
689
  case "micro":
690
- case "nano":
690
+ case "nano": {
691
691
  return `${CTX_ACCENT}\u25C6${RESET} ${SLATE_400}${truncatedId}${RESET}${modeBadge}`;
692
- case "mini":
692
+ }
693
+ case "mini": {
693
694
  return `${CTX_ACCENT}\u25C6${RESET} ${SLATE_400}${truncatedId}${RESET}${modeBadge}${planPart}`;
694
- default:
695
+ }
696
+ default: {
695
697
  return `${CTX_ACCENT}\u25C6${RESET} ${CTX_SECONDARY}Context:${RESET} ${SLATE_300}${truncatedId}${RESET}${modeBadge}${planPart}`;
698
+ }
696
699
  }
697
700
  }
698
701
 
@@ -715,7 +718,7 @@ interface StatuslineCache {
715
718
  function loadCache(): StatuslineCache {
716
719
  try {
717
720
  if (fs.existsSync(STATUSLINE_CACHE)) {
718
- return JSON.parse(fs.readFileSync(STATUSLINE_CACHE, "utf-8"));
721
+ return JSON.parse(fs.readFileSync(STATUSLINE_CACHE, "utf8"));
719
722
  }
720
723
  } catch {
721
724
  /* ignore */
@@ -726,7 +729,7 @@ function loadCache(): StatuslineCache {
726
729
  function saveCache(cache: StatuslineCache): void {
727
730
  try {
728
731
  fs.mkdirSync(path.dirname(STATUSLINE_CACHE), { recursive: true });
729
- fs.writeFileSync(STATUSLINE_CACHE, JSON.stringify(cache, null, 2), "utf-8");
732
+ fs.writeFileSync(STATUSLINE_CACHE, JSON.stringify(cache, null, 2), "utf8");
730
733
  } catch {
731
734
  /* ignore */
732
735
  }
@@ -810,7 +813,7 @@ function main(): void {
810
813
  // Read JSON from stdin
811
814
  let inputData: StatusLineInput;
812
815
  try {
813
- inputData = JSON.parse(fs.readFileSync(0, "utf-8")) as StatusLineInput;
816
+ inputData = JSON.parse(fs.readFileSync(0, "utf8")) as StatusLineInput;
814
817
  } catch {
815
818
  inputData = {};
816
819
  }
@@ -898,3 +901,5 @@ function main(): void {
898
901
  }
899
902
 
900
903
  main();
904
+
905
+
@@ -0,0 +1,78 @@
1
+ # Codex Skill
2
+
3
+ Launch Codex CLI in a visible pane (tmux on Unix, Windows Terminal/window fallback on native Windows) and pass the prompt at process start.
4
+
5
+ ## Directory Structure
6
+
7
+ ```
8
+ codex/
9
+ ├── CLAUDE.md ← This file
10
+ ├── SKILL.md ← Skill metadata (user-invocable)
11
+ ├── lib/
12
+ │ └── codex-watcher.ts ← Reusable watch/summarize library
13
+ └── scripts/
14
+ ├── launch-codex.ts ← Single entry point (launch + optional watch)
15
+ └── watch-codex.ts ← Standalone watch mode
16
+ ```
17
+
18
+ ## Script: launch-codex.ts
19
+
20
+ > Note: This file documents template source paths (`.aiwcli/_core/...`). During installation, settings command paths are normalized to runtime `.aiwcli/_core/...`.
21
+
22
+ **Usage:**
23
+ ```bash
24
+ bun ~/.aiwcli/bin/resolve-run.ts .aiwcli/_core/skills/codex/scripts/launch-codex.ts [--model <tier|id>] [--sandbox <sandbox-mode>] [--prompt <text>] [--no-yolo] [--no-watch] [--context <id>] plan
25
+ bun ~/.aiwcli/bin/resolve-run.ts .aiwcli/_core/skills/codex/scripts/launch-codex.ts [--model <tier|id>] [--sandbox <sandbox-mode>] [--prompt <text>] [--no-yolo] [--no-watch] [--context <id>] --file <path>
26
+ bun ~/.aiwcli/bin/resolve-run.ts .aiwcli/_core/skills/codex/scripts/launch-codex.ts [--model <tier|id>] [--sandbox <sandbox-mode>] [--prompt <text>] [--no-yolo] [--no-watch] [--context <id>] <inline text...>
27
+ ```
28
+
29
+ **Args:**
30
+ - `plan` — discover active plan via context system, build a bootstrap startup prompt that includes the plan filepath (Codex reads that file directly)
31
+ - `--file <path>` — build a bootstrap startup prompt that includes the file path (Codex reads that file directly)
32
+ - `<text...>` — join remaining args as inline prompt
33
+ - `--model <alias|tier|id>` — Aliases: `spark` → `gpt-5.3-codex-spark`, `codex` → `gpt-5.4`, `gpt` → `gpt-5.4`. Tiers: `fast`/`standard`/`smart` (resolved via `resolveModelForProvider()`). Or a full model ID.
34
+ - `--sandbox <mode>` — `read-only`, `workspace-write`, or `danger-full-access`. Default is `danger-full-access`.
35
+ - `--prompt <text>` — append extra instructions. In `plan` and `--file` modes, these are embedded into a bootstrap temp file alongside the target path.
36
+ - `--no-yolo` — Disable YOLO mode (`--dangerously-bypass-approvals-and-sandbox`).
37
+ - `--no-watch` — Disable watch/summarize mode.
38
+
39
+ **Plan discovery order:**
40
+ 1. `CLAUDE_SESSION_ID` env → `getContextBySessionId()` → `findLatestPlan(contextId)`
41
+ 2. Fallback: scan `_output/contexts/*/plans/*.md` by mtime
42
+
43
+ **Dependencies:**
44
+ - `runtime/aiw-cli.ts` — shells out to `aiw launch` for pane management (no direct tmux imports)
45
+ - `runtime/cli-args.ts` — model/sandbox/yolo CLI arg generation
46
+ - `context/*` — context lookup, formatting, plan discovery
47
+
48
+ **Watch behavior (single entry point):**
49
+ - Watch is enabled by default.
50
+ - `launch-codex.ts` launches Codex, waits for completion (pane close or sentinel), and prints a summary.
51
+ - Summary cascade:
52
+ 1. Session-file summary (`summarizeViaSessionFile`): Codex CLI Spark primary, `fast` tier (Haiku) fallback
53
+ 2. `codex exec resume <session_id>` summary (output file, then stdout/stderr parse fallback)
54
+ 3. Transcript-line fallback
55
+ 4. Static `Summary unavailable` message
56
+ - Summary persistence:
57
+ - `persistSummary()` in `codex-watcher.ts` writes to `os.tmpdir()/codex-summary-<ts>-<id>.md`
58
+ - Called before stdout output — temp file survives even if background task capture fails
59
+ - Best-effort: logs warning on failure, returns null, stdout output still proceeds
60
+ - File path printed as `[summary_file:<path>]` marker for automated retrieval
61
+
62
+ **Design decisions:**
63
+ - Prompt is delivered at launch time (no tmux buffer paste/capture workflow)
64
+ - Pane backend detection delegated to `aiw launch` (tmux in-session only → inline exec fallback)
65
+ - `core` source only — runtime execution resolves to `.aiwcli/_core`
66
+ - Watch path is best-effort and does not change launch success semantics
67
+
68
+ ## Library: lib/codex-watcher.ts
69
+
70
+ Reusable side-effect-free watch/summarize functions used by launch flow:
71
+ - `waitForPaneClose(target, timeoutMs?)` where `target` can be tmux pane id or `{ backend, paneId, sentinelPath }`
72
+ - `summarizeViaSessionFile(sessionFile)`
73
+ - `summarizeViaResume(sessionId)`
74
+ - `summarizeFromSessionFileFallback(sessionFile)`
75
+ - `collectTranscriptLines(sessionFile)`
76
+
77
+ Constants and helper utilities are exported for reuse and testing (`POLL_INTERVAL_MS`, `SUMMARY_UNAVAILABLE_MESSAGE`, `normalizeText`, `looksLikeBadSummary`, etc.).
78
+
@@ -9,19 +9,31 @@ The script blocks until Codex exits and prints a session summary. Run with Bash
9
9
  ## Command
10
10
 
11
11
  ```
12
- bun ~/.aiwcli/bin/resolve-run.ts .aiwcli/_shared/skills/codex/scripts/launch-codex.ts [flags] <mode>
12
+ bun ~/.aiwcli/bin/resolve-run.ts .aiwcli/_core/skills/codex/scripts/launch-codex.ts [flags] <mode>
13
13
  ```
14
14
 
15
15
  **Modes:** `plan` | `--file <path>` | `<inline text...>`
16
16
 
17
+ `plan` and `--file` modes pass a filepath-first bootstrap prompt so Codex reads the file from disk instead of relying on a pasted full document.
18
+
17
19
  **Flags:**
18
20
  - `--context <id>` — Project orientation for the sub-agent. Pass when implementing a plan so Codex understands the project structure.
19
- - `--prompt <text>` — Scope the agent's work. Direct each instance to a specific plan section or task.
20
- - `--model <name>` — Aliases: `spark`, `codex`, `gpt`. Tiers: `fast`, `standard`, `smart`. Or any full model ID.
21
+ - `--prompt <text>` — Add extra instructions. In `plan`/`--file` mode, this is embedded into the bootstrap temp file with the target path.
22
+ - `--model <name>` — Aliases: `spark`, `codex`, `gpt`. Tiers: `fast`, `standard`, `smart`. Or unknown full model ID.
21
23
  - `--sandbox <mode>` — `read-only`, `workspace-write`, `danger-full-access`.
22
24
  - `--no-yolo` — Disable YOLO mode (on by default).
23
25
  - `--no-watch` — Fire-and-forget: exit immediately after launch, skip waiting for summary.
24
26
 
27
+ ## Retrieving Results
28
+
29
+ The script prints a summary to stdout and writes it to a temp file.
30
+
31
+ **Primary:** Check TaskOutput for the background task — the summary and file path are inline.
32
+
33
+ **Fallback (if TaskOutput is empty):** Look for the `[summary_file:<path>]` line in the output. If found, read that file path directly. The temp file persists independently of Claude Code's background task capture.
34
+
35
+ If neither is available, check `_output/hook-log.jsonl` for `codex-capture` or `codex-skill` entries for diagnostics.
36
+
25
37
  ## Delegation Patterns
26
38
 
27
39
  ### One-shot
@@ -29,24 +41,14 @@ bun ~/.aiwcli/bin/resolve-run.ts .aiwcli/_shared/skills/codex/scripts/launch-cod
29
41
  For small or tightly coupled plans. One sub-agent implements the whole plan.
30
42
 
31
43
  ```bash
32
- bun ~/.aiwcli/bin/resolve-run.ts .aiwcli/_shared/skills/codex/scripts/launch-codex.ts --context <ctx-id> plan
44
+ bun ~/.aiwcli/bin/resolve-run.ts .aiwcli/_core/skills/codex/scripts/launch-codex.ts --context <ctx-id> plan
33
45
  ```
34
46
 
35
47
  Run with `run_in_background: true`. Wait for the summary. Review the changes.
36
48
 
37
49
  ### Parallel
38
50
 
39
- For plans with independent sections. Each sub-agent owns one section, scoped by `--prompt`.
40
-
41
- ```bash
42
- # Sub-agent A — section 1
43
- bun ~/.aiwcli/bin/resolve-run.ts .aiwcli/_shared/skills/codex/scripts/launch-codex.ts \
44
- --context <ctx-id> --prompt "Implement section 1: Extract watch logic into lib/codex-watcher.ts" plan
45
-
46
- # Sub-agent B — section 3
47
- bun ~/.aiwcli/bin/resolve-run.ts .aiwcli/_shared/skills/codex/scripts/launch-codex.ts \
48
- --context <ctx-id> --prompt "Implement section 3: Update launch-codex.ts arg parsing" plan
49
- ```
51
+ For plans with independent sections, create small section-brief files and launch one sub-agent per brief with `--file`.
50
52
 
51
53
  Run each with `run_in_background: true`. Summaries arrive as separate background task notifications. When all complete, review for conflicts between agents, then verify with tests or import checks.
52
54
 
@@ -55,10 +57,10 @@ Run each with `run_in_background: true`. Summaries arrive as separate background
55
57
  For tasks outside a plan. Pass inline text or a file path.
56
58
 
57
59
  ```bash
58
- bun ~/.aiwcli/bin/resolve-run.ts .aiwcli/_shared/skills/codex/scripts/launch-codex.ts \
60
+ bun ~/.aiwcli/bin/resolve-run.ts .aiwcli/_core/skills/codex/scripts/launch-codex.ts \
59
61
  "Fix the failing test in auth.ts"
60
62
 
61
- bun ~/.aiwcli/bin/resolve-run.ts .aiwcli/_shared/skills/codex/scripts/launch-codex.ts \
63
+ bun ~/.aiwcli/bin/resolve-run.ts .aiwcli/_core/skills/codex/scripts/launch-codex.ts \
62
64
  --file path/to/task-description.md
63
65
  ```
64
66
 
@@ -67,5 +69,6 @@ bun ~/.aiwcli/bin/resolve-run.ts .aiwcli/_shared/skills/codex/scripts/launch-cod
67
69
  - **Delegate implementation.** If the work involves writing code and Codex can handle it, send it to Codex.
68
70
  - **Split independent sections** into parallel sub-agents for faster execution.
69
71
  - **Pass `--context`** when implementing a plan — Codex needs project orientation to make good decisions.
70
- - **Scope with `--prompt`** when running parallel agents each sub-agent performs better when it knows exactly which section it owns.
72
+ - **Scope parallel agents with separate `--file` briefs** so each sub-agent has an explicit task boundary.
71
73
  - **Review results** when summaries arrive. Check for merge conflicts between parallel agents, then verify with `tsc --noEmit`, tests, or manual inspection.
74
+