@tacuchi/agent-workflow-cli 20.13.0 → 20.14.1

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.
package/README.md CHANGED
@@ -15,8 +15,8 @@ npm install -g @tacuchi/agent-workflow-cli
15
15
  Workline has three layers plus a permanent `docs/` zone:
16
16
 
17
17
  - **Layer 1 · Commands** (`/w:*`) — the only thing the user invokes:
18
- - **SPEC** — `/w:spec-new` (single-pass draft) → `/w:spec-refine` (gap-driven loop) → `docs/specs/`.
19
- - **PLAN** — `/w:plan-new` → (`/w:plan-refine` — aux, optional) → `/w:plan-exec` → `docs/plans/`.
18
+ - **SPEC** — `/w:spec-new` (single-pass draft; may split into sibling specs) → `/w:spec-refine` (gap-driven loop) → `docs/specs/`.
19
+ - **PLAN** — `/w:plan-new` → (`/w:plan-refine` — aux, optional) → `/w:plan-exec` → `docs/plans/` (the plan loops may split into sibling plans).
20
20
  - **QUICK** — `/w:quick` — lightweight shortcut; escalates live to SPEC when the goal outgrows a quick.
21
21
  - **EXPORTS** — `/w:export-scripts` · `export-manuals` · `export-diagrams` · `export-reports` (the only path that promotes artifacts to `docs/`).
22
22
  - **Bootstrap** — `/w:workspace-init` turns any folder into a workspace (1+ sources; no project/hub distinction).
@@ -3,7 +3,7 @@ import { closeSync, openSync, readFileSync, unlinkSync, writeFileSync } from "no
3
3
  import { tmpdir } from "node:os";
4
4
  import { join } from "node:path";
5
5
  import { buildOpenCommand } from "../application/open-external.js";
6
- import { LINUX_TERMINALS, buildNixWrapper, buildTerminalCommand, } from "../application/terminal-launch.js";
6
+ import { LINUX_TERMINALS, abortFileFor, buildNixWrapper, buildTerminalCommand, buildWinCommandBody, } from "../application/terminal-launch.js";
7
7
  const WIN_SHELL_CMDS = new Set(["npm", "npx", "yarn", "pnpm", "node-gyp", "gradle", "mvn"]);
8
8
  /**
9
9
  * How long `openPath` watches a freshly-spawned opener for an early failure.
@@ -114,105 +114,120 @@ export class NodeProcess {
114
114
  }
115
115
  }
116
116
  async spawnInTerminal(cmd, args, opts) {
117
- if (this.platform === "win32") {
118
- const plan = buildTerminalCommand("win32", {
119
- wrapperPath: "",
120
- cwd: opts.cwd,
121
- build: opts.build,
122
- command: cmd,
123
- args,
124
- title: opts.title,
125
- linuxTerminals: [],
126
- hasDisplay: true,
127
- });
128
- if (plan.kind === "terminal") {
129
- // `detached` gives the child its own console window; `windowsHide:false`
130
- // (unlike spawnDetached) keeps it visible; secrets ride in via `env`
131
- // (inherited), never the command line.
132
- const child = spawn(plan.cmd, plan.args, {
133
- cwd: opts.cwd,
134
- env: opts.env,
135
- detached: true,
136
- windowsHide: false,
137
- stdio: "ignore",
138
- });
139
- child.on("error", () => { });
140
- if (child.pid !== undefined) {
141
- child.unref();
142
- return { pid: child.pid, mode: "terminal" };
143
- }
144
- }
145
- return this.backgroundFallback(cmd, args, opts);
146
- }
147
- // *nix — Terminal.app (macOS) or an emulator (Linux) runs an ephemeral
148
- // wrapper that captures the real app pid into a pidfile we read back.
149
- const hasDisplay = this.platform === "darwin" || Boolean(this.env.DISPLAY || this.env.WAYLAND_DISPLAY);
117
+ // A terminal window needs a launcher — Terminal.app (macOS), an emulator
118
+ // (Linux) or a hidden Start-Process hop (Windows: a `detached` spawn alone
119
+ // gets DETACHED_PROCESS — no console, no window). The launcher runs an
120
+ // ephemeral wrapper (*nix: a bash file; Windows: an inline -Command body —
121
+ // no file, so GPO ExecutionPolicy and unlink races don't apply) that
122
+ // captures the real app pid into a pidfile we read back (on Windows, the
123
+ // visible console's own $PID).
124
+ const isWin = this.platform === "win32";
125
+ const hasDisplay = isWin || this.platform === "darwin" || Boolean(this.env.DISPLAY || this.env.WAYLAND_DISPLAY);
150
126
  const linuxTerminals = this.platform === "linux" && hasDisplay ? await this.resolveLinuxTerminals() : [];
151
127
  const seq = terminalSeq++;
152
128
  const wrapperPath = join(tmpdir(), `aw-launch-${process.pid}-${seq}.sh`);
153
129
  const pidFile = `${wrapperPath}.pid`;
154
- const plan = buildTerminalCommand(this.platform, {
155
- wrapperPath,
130
+ const spec = {
156
131
  cwd: opts.cwd,
132
+ mode: opts.mode,
157
133
  build: opts.build,
158
134
  command: cmd,
159
135
  args,
136
+ envDelta: opts.envDelta,
137
+ pidFile,
138
+ logPath: opts.logPath,
160
139
  title: opts.title,
140
+ };
141
+ const plan = buildTerminalCommand(this.platform, {
142
+ wrapperPath,
143
+ cwd: opts.cwd,
144
+ ...(isWin ? { winBody: buildWinCommandBody(spec) } : {}),
161
145
  linuxTerminals,
162
146
  hasDisplay,
163
147
  });
164
148
  if (plan.kind === "terminal") {
165
- try {
166
- writeFileSync(wrapperPath, buildNixWrapper({
167
- cwd: opts.cwd,
168
- mode: opts.mode,
169
- build: opts.build,
170
- command: cmd,
171
- args,
172
- envDelta: opts.envDelta,
173
- pidFile,
174
- logPath: opts.logPath,
175
- title: opts.title,
176
- }), { mode: 0o700 });
177
- // Track launcher failure so we can fall back fast (e.g. osascript with no
178
- // GUI, or an emulator that can't open a display, exit non-zero), WITHOUT
179
- // mistaking a slow-but-succeeding cold start for "no terminal".
180
- let launcherFailed = false;
181
- const child = spawn(plan.cmd, plan.args, {
182
- cwd: opts.cwd,
183
- env: opts.env,
184
- detached: true,
185
- stdio: "ignore",
186
- });
187
- child.on("error", () => {
188
- launcherFailed = true;
189
- });
190
- // Launchers like osascript / the gnome-terminal client exit right after
191
- // handoff; a NON-zero exit means the window never opened.
192
- child.on("exit", (code) => {
193
- if (code !== 0 && code !== null)
194
- launcherFailed = true;
195
- });
196
- child.unref();
197
- // Wait for the wrapper to report the real app pid. The window may cold-start
198
- // slowly (Terminal.app / a fresh emulator), so poll generously — but bail
199
- // early the moment the launcher itself failed. If no pid ever appears AND the
200
- // launcher didn't fail, the wrapper never got to run the app, so falling back
201
- // cannot double-launch it. (bash keeps the unlinked script fd open → safe.)
202
- const pid = await this.readPidFile(pidFile, 10000, () => launcherFailed);
203
- safeUnlink(wrapperPath);
204
- safeUnlink(pidFile);
205
- if (pid !== null)
206
- return { pid, mode: "terminal" };
207
- }
208
- catch {
209
- safeUnlink(wrapperPath);
210
- safeUnlink(pidFile);
149
+ const pid = await this.openTerminalAndAwaitPid(plan, spec, {
150
+ isWin,
151
+ wrapperPath,
152
+ pidFile,
153
+ env: opts.env,
154
+ });
155
+ if (pid !== null) {
156
+ if (isWin)
157
+ this.markTerminalLog(opts.logPath);
158
+ return { pid, mode: "terminal" };
211
159
  }
212
160
  }
213
161
  // No terminal opened (headless/CI, or it failed): the app MUST still run.
214
162
  return this.backgroundFallback(cmd, args, opts);
215
163
  }
164
+ /** Spawn the terminal launcher and wait for the wrapper-reported pid; null → caller falls back. */
165
+ async openTerminalAndAwaitPid(plan, spec, ctx) {
166
+ const { isWin, wrapperPath, pidFile } = ctx;
167
+ try {
168
+ if (!isWin)
169
+ writeFileSync(wrapperPath, buildNixWrapper(spec), { mode: 0o700 });
170
+ // Track launcher failure so we can fall back fast (e.g. osascript with no
171
+ // GUI, or an emulator that can't open a display, exit non-zero), WITHOUT
172
+ // mistaking a slow-but-succeeding cold start for "no terminal".
173
+ let launcherFailed = false;
174
+ // The full launch env (params + PROFILE + secrets) rides the launcher spawn:
175
+ // on Windows the whole chain (hop → Start-Process → console) inherits it.
176
+ const child = spawn(plan.cmd, plan.args, {
177
+ cwd: spec.cwd,
178
+ env: ctx.env,
179
+ detached: true,
180
+ stdio: "ignore",
181
+ });
182
+ child.on("error", () => {
183
+ launcherFailed = true;
184
+ });
185
+ // Launchers (osascript, the gnome-terminal client, the hidden
186
+ // Start-Process hop) exit right after handoff; a NON-zero exit means
187
+ // the window never opened.
188
+ child.on("exit", (code) => {
189
+ if (code !== 0 && code !== null)
190
+ launcherFailed = true;
191
+ });
192
+ child.unref();
193
+ // Wait for the wrapper to report the real app pid. The window may cold-start
194
+ // slowly (Terminal.app / a fresh emulator), so poll generously — but bail
195
+ // early the moment the launcher itself failed. On *nix a timed-out fallback
196
+ // cannot double-launch (unlinking the wrapper stops a not-yet-started bash;
197
+ // an already-started one keeps the unlinked script fd open). On Windows
198
+ // there is no file to unlink: the abort marker below makes a very late
199
+ // console self-abort right before it would launch the app.
200
+ const pid = await this.readPidFile(pidFile, 10000, () => launcherFailed);
201
+ if (pid === null && isWin && !launcherFailed) {
202
+ try {
203
+ writeFileSync(abortFileFor(pidFile), "1");
204
+ }
205
+ catch {
206
+ // best-effort — worst case the late console still opens and runs the app
207
+ }
208
+ }
209
+ if (!isWin)
210
+ safeUnlink(wrapperPath);
211
+ safeUnlink(pidFile);
212
+ return pid;
213
+ }
214
+ catch {
215
+ if (!isWin)
216
+ safeUnlink(wrapperPath);
217
+ safeUnlink(pidFile);
218
+ return null;
219
+ }
220
+ }
221
+ /** Terminal mode doesn't tee on Windows (see buildWinCommandBody): leave a
222
+ * marker so "Ver log" never presents a previous run's output as current. */
223
+ markTerminalLog(logPath) {
224
+ try {
225
+ writeFileSync(logPath, "[lanzado en consola — la salida vive en la ventana]\n");
226
+ }
227
+ catch {
228
+ // best-effort
229
+ }
230
+ }
216
231
  /** Fall back to a detached background process (spawnDetached semantics + log). */
217
232
  async backgroundFallback(cmd, args, opts) {
218
233
  // Build first (best-effort) so the headless run executes fresh output.
@@ -1 +1 @@
1
- {"version":3,"file":"node-process.js","sourceRoot":"","sources":["../../src/adapters/node-process.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACvF,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EACL,eAAe,EACf,eAAe,EACf,oBAAoB,GACrB,MAAM,mCAAmC,CAAC;AAW3C,MAAM,cAAc,GAAG,IAAI,GAAG,CA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YACH,6EAA6E;YAC7E,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;YACrB,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,yEAAyE;YACzE,OAAQ,GAA6B,CAAC,IAAI,KAAK,OAAO,CAAC;QACzD,CAAC;IACH,CAAC;CACF"}
@@ -6,7 +6,9 @@
6
6
  * The window must stay open (to monitor the app live) and closing it must stop
7
7
  * the app. To also keep the TUI process registry
8
8
  * working, the wrapper captures the *real* app PID into a pidfile the adapter
9
- * reads back (on Windows we track the console PID instead see the adapter).
9
+ * reads back (on Windows the inline -Command body writes its own $PID — the
10
+ * visible console's PowerShell, which parents the app; no wrapper file exists
11
+ * there — see buildWinCommandBody).
10
12
  *
11
13
  * This module is impurity-free so the Windows/Linux/macOS shapes are unit-tested
12
14
  * deterministically; the adapter (`NodeProcess.spawnInTerminal`) does the I/O
@@ -123,20 +125,71 @@ function psInvoke(command, args) {
123
125
  const quoted = args.map(psSingleQuote).join(" ");
124
126
  return `& ${psSingleQuote(command)}${quoted ? ` ${quoted}` : ""}`;
125
127
  }
128
+ /** The adapter drops this marker next to the pidfile when it gives up waiting
129
+ * and falls back to a background launch; a late console must NOT double-launch. */
130
+ export function abortFileFor(pidFile) {
131
+ return `${pidFile}.abort`;
132
+ }
133
+ /**
134
+ * Assemble the one-line `-Command` body the visible Windows console runs. It
135
+ * travels INLINE (never as a .ps1 file) on purpose: GPO-enforced ExecutionPolicy
136
+ * (AllSigned/Restricted) refuses unsigned script files but does not govern
137
+ * `-Command`, and no file also means no unlink races. Two invariants keep the
138
+ * body intact across the child powershell.exe re-join of its command line
139
+ * (double quotes are eaten, spaces re-joined singly): NO double quotes, NO runs
140
+ * of consecutive spaces — everything is single-quoted via psSingleQuote.
141
+ *
142
+ * Ignores `envDelta` on purpose: unlike Terminal.app / gnome-terminal-server,
143
+ * the whole Windows chain (hidden launcher → Start-Process) inherits our env,
144
+ * so secrets never touch disk. `mode` is also moot here: both modes run the app
145
+ * in the foreground of its own console (a real TTY), kept open by `-NoExit`;
146
+ * the server-mode log tee is not implemented (PS 5.1 Tee-Object writes UTF-16,
147
+ * which would garble the TUI's log viewer).
148
+ */
149
+ export function buildWinCommandBody(spec) {
150
+ const title = psSingleQuote(spec.title);
151
+ const statements = [
152
+ // First statement: hand this console's PID to the adapter (it polls the pidfile).
153
+ `Set-Content -LiteralPath ${psSingleQuote(spec.pidFile)} -Value $PID`,
154
+ `$Host.UI.RawUI.WindowTitle = ${title}`,
155
+ `Set-Location -LiteralPath ${psSingleQuote(spec.cwd)}`,
156
+ ];
157
+ if (spec.build) {
158
+ statements.push(psInvoke(spec.build.command, spec.build.args));
159
+ // `return` (never `exit`, which would defeat -NoExit) keeps the window open on failure.
160
+ statements.push(`if ($LASTEXITCODE -ne 0) { Write-Host ('[build fallido — {0} · cerrá esta ventana]' -f ${title}); return }`);
161
+ }
162
+ // As late as possible before the launch: if the adapter already fell back to a
163
+ // background process (pidfile poll timed out), abort instead of double-launching.
164
+ statements.push(`if (Test-Path -LiteralPath ${psSingleQuote(abortFileFor(spec.pidFile))}) { Remove-Item -LiteralPath ${psSingleQuote(abortFileFor(spec.pidFile))},${psSingleQuote(spec.pidFile)} -ErrorAction SilentlyContinue; Write-Host ('[{0} — reemplazado por proceso en segundo plano · cerrá esta ventana]' -f ${title}); return }`);
165
+ statements.push(psInvoke(spec.command, spec.args));
166
+ statements.push(`Write-Host ('[{0} — código {1} · cerrá esta ventana]' -f ${title}, $LASTEXITCODE)`);
167
+ return statements.join("; ");
168
+ }
126
169
  /**
127
- * Windows: a persistent PowerShell console (`-NoExit` keeps it open after the
128
- * command finishes crash visibility; the adapter spawns it `detached` with its
129
- * own console). Builds first when a build step is present, aborting on failure.
170
+ * Windows: Node cannot ask CreateProcess for a new console a `detached` spawn
171
+ * maps to DETACHED_PROCESS, which starts the child with NO console at all (the
172
+ * "own console window" in the Node docs is a myth), so spawning `powershell
173
+ * -NoExit …` directly runs it invisibly. Instead, a short-lived hidden
174
+ * PowerShell calls `Start-Process` (ShellExecute), which DOES create a visible
175
+ * console for the persistent inner PowerShell (`-NoProfile` for a fast,
176
+ * deterministic start; `-NoExit` keeps it open after the app exits → crash
177
+ * visibility). The body rides -ArgumentList as its last element: PS 5.1 joins
178
+ * the list with bare spaces and powershell.exe -Command re-joins the tail, so
179
+ * it round-trips under the buildWinCommandBody invariants.
130
180
  */
131
181
  function buildWin32Command(opts) {
132
- const buildPart = opts.build
133
- ? `${psInvoke(opts.build.command, opts.build.args)}; if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }; `
134
- : "";
135
- const command = `Set-Location ${psSingleQuote(opts.cwd)}; ${buildPart}${psInvoke(opts.command, opts.args)}`;
182
+ if (!opts.winBody)
183
+ return { kind: "none" };
184
+ // 'Stop' turns a Start-Process failure into a non-zero launcher exit → fast fallback.
185
+ const argList = ["-NoProfile", "-NoExit", "-ExecutionPolicy", "Bypass", "-Command", opts.winBody]
186
+ .map(psSingleQuote)
187
+ .join(",");
188
+ const command = `$ErrorActionPreference='Stop'; Start-Process -FilePath 'powershell' -ArgumentList ${argList} -WorkingDirectory ${psSingleQuote(opts.cwd)}`;
136
189
  return {
137
190
  kind: "terminal",
138
191
  cmd: "powershell",
139
- args: ["-NoExit", "-ExecutionPolicy", "Bypass", "-Command", command],
192
+ args: ["-NoProfile", "-ExecutionPolicy", "Bypass", "-Command", command],
140
193
  };
141
194
  }
142
195
  // --- quoting helpers -------------------------------------------------------
@@ -1 +1 @@
1
- {"version":3,"file":"terminal-launch.js","sourceRoot":"","sources":["../../src/application/terminal-launch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAoDH;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAA6D;IACvF,EAAE,GAAG,EAAE,qBAAqB,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,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AAE,CAAC,YAAY,EAAE,kBAAkB,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,CAAC;KACxE,CAAC;AACJ,CAAC;AAED,8EAA8E;AAE9E,gFAAgF;AAChF,SAAS,OAAO,CAAC,CAAS;IACxB,OAAO,qBAAqB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;AAC9D,CAAC;AAED,oFAAoF;AACpF,SAAS,aAAa,CAAC,CAAS;IAC9B,OAAO,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC;AACzC,CAAC;AAED,uEAAuE;AACvE,SAAS,aAAa,CAAC,CAAS;IAC9B,OAAO,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC;AACtC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tacuchi/agent-workflow-cli",
3
- "version": "20.13.0",
3
+ "version": "20.14.1",
4
4
  "description": "Runtime CLI for Workline — the stages + loops + artifacts system for agent work. Bundles the universal `w` skill set under `skills/w/` (slash commands `/w:*`: spec-new/spec-refine, plan-new/plan-exec, quick, persist, workspace-init, export-*); `self install --target <host>` copies SKILL + commands + hooks into the host. Pluggable capability skills via `.workflow/skills.toml`. Multi-empresa parametrization via `profile.json` cascade. Namespace auto-detected from any `.<ns>/sessions/` dir in CWD; default `workflow`.",
5
5
  "type": "module",
6
6
  "bin": {
package/skills/w/SKILL.md CHANGED
@@ -67,6 +67,8 @@ Typical chain: prompt → `spec-new` generates `docs/specs/NNN-spec-<slug>.md`
67
67
 
68
68
  QUICK can **escalate live to SPEC** when the objective exceeds a quick (entry size gate) or the task grows mid-loop: with consent via structured-choice, the work line moves to the SPEC flow (draft via the `spec-new` procedure + `spec-refine-loop` directly); escalation to PLAN stays **deferred** (seed + pointer). See `loops/quick-loop/LOOP.md` § *QUICK delta*.
69
69
 
70
+ Both authoring entry points can **split** with consent: `spec-new` may split a multi-part prompt into **sibling specs** (its split gate — one structured-choice before writing anything), and the plan loops may split a plan into independently deliverable **sibling plans** (`plan-new-loop` § *Split gate (multi-plan)*; plan-refine adds the in-place semantics). Siblings cross-reference **by path**; a split stays inside the same work line — it is not an escalation.
71
+
70
72
  ### Operating context — where everything lands
71
73
 
72
74
  Before any loop, the AI resolves its **operating context** on **every prompt** with two detections: **workspace?** (`.<ns>/sessions/` exists) + **session to continue?** (an active one, or a recent one this prompt continues). That decides the behavior and **where artifacts land** (SQL, scripts, decisions, …):
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: Use when a spec is ready to become an executable plan — not to refine an existing plan (plan-refine) nor execute one (plan-exec). Starts or resumes the planning loop (plan-new-loop) from a spec. Turns the "what" (spec) into the "how" (plan). Ideal input: an already refined docs/specs/NNN-spec-<slug>.md. Also adopts an externally-built plan (host plan mode, hand-written, another agent) as the plan-doc — mode 4 of its input resolution.
2
+ description: Use when a spec is ready to become an executable plan — not to refine an existing plan (plan-refine) nor execute one (plan-exec). Starts or resumes the planning loop (plan-new-loop) from a spec. Turns the "what" (spec) into the "how" (plan). Ideal input: an already refined docs/specs/NNN-spec-<slug>.md. Also adopts an externally-built plan (host plan mode, hand-written, another agent) as the plan-doc — mode 4 of its input resolution. May split into sibling plans (split gate).
3
3
  argument-hint: <docs/specs/NNN-spec-<slug>.md | prompt>
4
4
  allowed-tools:
5
5
  [
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: Use when an existing plan needs changes before executing — new requirements, scope tweaks — not to generate one (plan-new) nor execute it (plan-exec). Starts or resumes the plan refinement loop (plan-refine-loop). An auxiliary, NOT mandatory step of the PLAN flow — refines an existing plan in place. Input: a docs/plans/PPP-plan-<slug>.md — generated by plan-new, hand-written, or adopted from a host planner (plan-new mode 4 / persist).
2
+ description: Use when an existing plan needs changes before executing — new requirements, scope tweaks — not to generate one (plan-new) nor execute it (plan-exec). Starts or resumes the plan refinement loop (plan-refine-loop). An auxiliary, NOT mandatory step of the PLAN flow — refines an existing plan in place. Input: a docs/plans/PPP-plan-<slug>.md — generated by plan-new, hand-written, or adopted from a host planner (plan-new mode 4 / persist). May extract tranches into sibling plans.
3
3
  argument-hint: <docs/plans/PPP-plan-<slug>.md>
4
4
  allowed-tools:
5
5
  [
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: Use when the user wants to capture a NEW requirement, idea or wish as a spec — not to refine an existing draft (that's spec-refine). Generates a specification draft (docs/specs/NNN-spec-<slug>.md) from a prompt, in a single pass. Step 1 of the SPEC flow; starts no loop.
2
+ description: Use when the user wants to capture a NEW requirement, idea or wish as a spec — not to refine an existing draft (that's spec-refine). Generates a specification draft (docs/specs/NNN-spec-<slug>.md) from a prompt, in a single pass. Can split a multi-part prompt into several sibling specs (split gate). Step 1 of the SPEC flow; starts no loop.
3
3
  argument-hint: <prompt with the requirement or idea>
4
4
  allowed-tools:
5
5
  [
@@ -15,7 +15,7 @@ Generates `docs/specs/NNN-spec-<slug>.md` in a single pass from the prompt in `$
15
15
 
16
16
  > ## ⛔ Single-pass — NO RESEARCH (hard rule)
17
17
  >
18
- > This command **only paraphrases** the user's input into the draft schema. It is **one sequential pass**: read `$ARGUMENTS` → fill the sections → write the file. Nothing else. It must take **seconds, not minutes**.
18
+ > This command **only paraphrases** the user's input into the draft schema. It is **one sequential pass**: read `$ARGUMENTS` → (split gate: at most ONE structured-choice — see § *Split gate (multi-spec)*) → fill the sections → write the file(s). Nothing else. It must take **seconds, not minutes**.
19
19
  >
20
20
  > **FORBIDDEN**, no exceptions: launching sub-agents/workflows (`Task`/`Agent`/`Workflow`), research sessions, web searches, or deep code investigation — **even if the harness is in a maximum-effort/depth mode** (e.g. ultracode/max-effort in Claude Code).
21
21
  >
@@ -23,10 +23,21 @@ Generates `docs/specs/NNN-spec-<slug>.md` in a single pass from the prompt in `$
23
23
  >
24
24
  > Deep investigation (closing gaps, mapping code, querying DB, autonomous research) is **`spec-refine`** work, not this command's.
25
25
 
26
+ With a raw user prompt, first run the **§ Split gate (multi-spec)** assessment (below): the split offer, if any, happens **before writing anything**. Then:
27
+
26
28
  1. Run `aw next-number docs/specs` (the only shell tool needed): it returns JSON — use the `next` field as `NNN`. This command builds the slug.
27
29
  2. Derive the `<slug>`: short kebab-case from the Requirement — only `[a-z0-9-]`, ≤ ~5 words / ≤ 40 chars.
28
- 3. Create `docs/specs/NNN-spec-<slug>.md` paraphrasing `$ARGUMENTS` into the draft schema (below). Repo reading: optional and minimal (e.g. one file the user cited) — never a sweep or research.
29
- 4. Show the generated file and the suggested next step (`/w:spec-refine docs/specs/NNN-spec-<slug>.md`).
30
+ 3. Create `docs/specs/NNN-spec-<slug>.md` paraphrasing `$ARGUMENTS` into the draft schema (below). Repo reading: optional and minimal (e.g. one file the user cited) — never a sweep or research. On an accepted split: repeat steps 1-3 per part, minting immediately before each write.
31
+ 4. Show the generated file(s) and the suggested next step (`/w:spec-refine docs/specs/NNN-spec-<slug>.md`).
32
+
33
+ ## Split gate (multi-spec)
34
+
35
+ Right after reading `$ARGUMENTS` and **before writing anything**, assess whether the prompt bundles **several independent requirements**. The gate fires **only on clear signals** (≥2 of: independent deliverables/goals · explicit enumeration of distinct features · different requested moments or order · unrelated subsystems); borderline → **one spec, no question**. It applies only to a **raw user prompt** (direct invocation, or the `plan-new` mode-3 handoff); it **never fires** on the reuse entries below — the quick escalation and the `persist` adoption arrive already scoped to one objective.
36
+
37
+ - **The offer** — the command's **only** interaction: **one** structured-choice (1 content question + the `flow` control; `Cerrar` = abort, nothing is written yet). The question body shows the proposed cut in the **user's language**: per part, a name + slug, a 1-line scope and the suggested order. Labels: `Dividir en varias specs` (recommended when the signals hold) | `Una sola spec`. A free-form answer adjusts the cut (merge/rename/drop parts); if one part remains, proceed as a single spec.
38
+ - **On acceptance** — still single-pass, still **NO RESEARCH** (the cut is paraphrase of the prompt, never investigation): per part, mint with `aw next-number docs/specs` **immediately before each write**, then write that draft. Numbers come out consecutive, so every sibling path is known after the first mint.
39
+ - **Sibling contract**: each `## Origin` records the shared prompt + `split (part i/N)` + the **siblings by path** + the suggested order; each `## Scope` Out points to the sibling that owns the excluded part. Cross-reference by path, never by bare number.
40
+ - **Report**: list the N files and suggest the next step per spec (`/w:spec-refine` on the first — each sibling refines and plans at its own moment).
30
41
 
31
42
  ## Draft schema (`NNN-spec-<slug>.md`)
32
43
 
@@ -35,7 +46,8 @@ Generates `docs/specs/NNN-spec-<slug>.md` in a single pass from the prompt in `$
35
46
 
36
47
  ## Origin (opt.)
37
48
  Original prompt / prior doc / reference that originated the spec
38
- (e.g. "adopted from host conversation" when it captures an analysis already established there).
49
+ (e.g. "adopted from host conversation" when it captures an analysis already established there;
50
+ or "split (part i/N)" + sibling spec paths + suggested order — § Split gate (multi-spec)).
39
51
 
40
52
  ## Requirement
41
53
  The what + why (brief). In the user's language.
@@ -87,7 +99,7 @@ Pending doubts. ← the spec-refine-loop closes them.
87
99
 
88
100
  ## Plan mode
89
101
 
90
- Resolves `NNN` by reading `docs/specs/`, describes the draft it would generate without writing the file.
102
+ Resolves `NNN` by reading `docs/specs/`, describes the draft(s) it would generate — split gate included: it reports the proposed cut — without writing any file.
91
103
 
92
104
  ## Resources
93
105
 
@@ -27,7 +27,7 @@ PLAN
27
27
  `docs/specs/NNN-spec-*.md` (glob — locates the spec by number; or the exact path from the command argument). **Refined vs draft** is distinguished by the **presence** of `## Refinement decisions` / `## Q&A traceability` in the spec: if missing → **soft-suggest** running `/w:spec-refine` first (planning over a solid spec produces better plans), but the user may proceed.
28
28
 
29
29
  ## Writes
30
- `docs/plans/PPP-plan-<slug>.md` (`generate`; **overwrites with confirmation** if it exists). It writes only `docs/plans` — never other `docs/` folders, no auto-export. If the plan **includes UI**, it also produces **design SPECs** (`NNN-SPEC-<SLUG>.md`) as artifacts **of its session** (see *Delta 4* — they are not `docs/`, no auto-export).
30
+ `docs/plans/PPP-plan-<slug>.md` (`generate`; **overwrites with confirmation** if it exists) — or **several sibling plans** when an accepted split applies (§ *Split gate (multi-plan)*). It writes only `docs/plans` — never other `docs/` folders, no auto-export. If the plan **includes UI**, it also produces **design SPECs** (`NNN-SPEC-<SLUG>.md`) as artifacts **of its session** (see *Delta 4* — they are not `docs/`, no auto-export).
31
31
 
32
32
  > **slug**: short kebab-case derived from the spec's Requirement — only `[a-z0-9-]`, ≤ ~5 words / ≤ 40 chars. `aw next-number docs/plans` returns JSON (field `next` = `PPP`); the loop builds the full name. To locate plans, glob `docs/plans/PPP-plan-*.md`.
33
33
 
@@ -85,6 +85,7 @@ Replaces the spec gap taxonomy with a planning-oriented one:
85
85
  | Components unidentified | FE/BE/DB impact unknown | **research** (maps the code) |
86
86
  | AS-IS wiring unknown | current state unknown | **research** |
87
87
  | Phase too large | complexity > S | human (re-split) |
88
+ | Plan splittable | independently deliverable tranches — different moments/priorities, no shared deps/risk | **human consents** → split (see *Split gate (multi-plan)*) |
88
89
  | Task not atomic | complexity > XS | the AI re-splits |
89
90
  | Over-engineered solution | approach heavier than the criteria need — needless abstraction/layer/dependency, or a phase/task not required to meet the spec (chassis § *Minimality*) | AI proposes the lighter path + **human** confirms (**probe** if "lighter works" is a runnable doubt) |
90
91
  | Missing deps | order unclear | research / human |
@@ -114,6 +115,17 @@ Chassis § *Proof of concept (probe)*, instantiated for planning. Two placements
114
115
  - **Plan-shaping unknown** (the `Solution` itself depends on the answer) → run the probe **inline now**; the verdict (`CONCLUSIONS`) feeds `Solution` / `Risks / impact`.
115
116
  - **Execution-time risk** (a task will build on a risky, runnable assumption) → encode an explicit **probe task**, placed **early** — before the tasks that depend on its verdict; the matching `Risks / impact` entry references it.
116
117
 
118
+ ## Split gate (multi-plan)
119
+
120
+ Resolves the **Plan splittable** gap (Delta 2) — the canonical definition for **both** plan loops (`plan-refine-loop` references it, never redefines it). It fires **only on clear signals** (≥2 of: tranches independently executable/deliverable · no shared deps/risk between tranches · different requested moments/priorities · the plan far exceeds S-complexity phases · the user asked for staging); borderline → **one plan, no question**. It can be assessed during decomposition or at the coherence gate, always **before** `Guardar`.
121
+
122
+ - **The offer** enters the batch as a **content question** (counts in the ≤3): the body shows the proposed cut in the **user's language** — per sibling, a name + slug, a 1-line scope, the phase mapping and the order. Labels: `Dividir en varios planes` (recommended when the signals hold) | `Un solo plan`. Declining marks the gap **exhausted** (no re-offer this run); a free-form answer adjusts the cut. The accepted cut is seeded into `CHECKPOINT` — a resume does **not** re-ask.
123
+ - **Anti-duplicate** (the `create_or_resume` spirit): if sibling plans whose `## Origin` references this same spec/split already exist, the recommended option becomes resuming them (`/w:plan-refine` / `/w:plan-exec` semantics) — never a second set.
124
+ - **On acceptance** — same run, same session (one session per run, one HISTORY row): **all N siblings are elaborated complete** in this run — each gets the full Delta 1 schema and is immediately executable (`plan-exec` runs any plan; a seed without `## Tasks` would break that contract). Context pressure is absorbed by self-regulation (chassis § *Compact / resume*). Numbering: `aw next-number docs/plans` **immediately before each write** — numbers come out consecutive, so every sibling path is known after the first mint.
125
+ - **Sibling contract**: each `## Origin` records the shared source spec + `split (part i/N)` + the **siblings by path** + the order; `## Dependencies` (the existing optional section) carries the inter-plan order — **acyclic and advisory** (`plan-exec` does not enforce it; it only orients what to attack first).
126
+ - **Coherence gate, re-framed**: every spec acceptance criterion traces to **exactly one** sibling — a **complete, disjoint partition**; each sibling's `Final behavior` covers its subset; the union covers the spec. Spec-less plans anchor the partition to their own `Final behavior` / `Validations`.
127
+ - **Closing action** on the split branch: `Guardar planes` (the single-plan branch keeps `Guardar plan`).
128
+
117
129
  ## Sequence
118
130
 
119
131
  ```
@@ -132,13 +144,18 @@ plan-new-loop(spec):
132
144
  integrate + update CHECKPOINT # artifact-first cycle
133
145
  coherence gate (read-only) = Success criteria green:
134
146
  - every spec acceptance criterion traces to a phase/task
147
+ (split: each criterion → exactly one sibling — complete, disjoint partition)
135
148
  - Final behavior covers the criteria
136
149
  - phases XS–S · tasks XS · deps without cycles · Impacted consistent with Solution
137
150
  - minimality (chassis § *Minimality*): the Solution is the lightest that meets Final behavior; no phase/task/abstraction the criteria don't require
138
151
  - (UI) every screen/UI task traces to its design SPEC and does not contradict ## UI spec
139
152
  whatever fails → comes back as a gap
140
- structured_choice(content: [Guardar plan, Preguntar algo más], flow: [Compactar, Cerrar])
141
- Guardar write docs/plans/PPP-plan-<slug>.md (confirmation if it exists)
153
+ if split accepted (§ Split gate (multi-plan)): work = the N sibling plans (same session; cut in CHECKPOINT)
154
+ structured_choice(content: [Guardar planes, Preguntar algo más], flow: [Compactar, Cerrar])
155
+ Guardar planes → per sibling: aw next-number docs/plans → write (confirmation if it exists)
156
+ else:
157
+ structured_choice(content: [Guardar plan, Preguntar algo más], flow: [Compactar, Cerrar])
158
+ Guardar → write docs/plans/PPP-plan-<slug>.md (confirmation if it exists)
142
159
  finalize: CHECKPOINT persisted (+ BACKLOG only if something is deferred) + close session + report
143
160
  ```
144
161
 
@@ -146,6 +163,7 @@ finalize: CHECKPOINT persisted (+ BACKLOG only if something is deferred) + close
146
163
 
147
164
  - **No material gaps** → **coherence gate** (the *Sequence* checklist; the PLAN-new instance of the chassis convergence gate). Criterion→task traceability is a **checked invariant**, never a separate section.
148
165
  - Passes → `Guardar plan` (writes with confirmation if it exists) → `finalize`.
166
+ - **Split branch**: `Guardar planes` writes the N siblings sequentially (mint before each write) → `finalize` — one session, one HISTORY row.
149
167
  - `Cerrar` at any time → `finalize` (persists `CHECKPOINT`; `BACKLOG` only if something is deferred; closes the session, reports).
150
168
 
151
169
  > **After generating:** the plan can go straight to `plan-exec`, or — if changes arise before executing (new requirements, scope adjustments) — pass through [`plan-refine-loop`](../plan-refine-loop/LOOP.md) (`/w:plan-refine`, auxiliary and **not mandatory**), which refines it in place.
@@ -32,7 +32,7 @@ PLAN
32
32
  `docs/plans/PPP-plan-*.md` (glob — locates the plan by number; or the exact path from the command argument). **Always the plan itself**: this loop edits it in place; there is no separate "refined" file. Provenance is irrelevant — generated by `plan-new`, **hand-written, or adopted** from a host planner (`plan-new` mode 4 / `persist`); existence is the only requirement.
33
33
 
34
34
  ## Writes
35
- Updates `docs/plans/PPP-plan-<slug>.md` **in place** (when the user picks `Guardar plan refinado`): completes/adjusts sections and **adds** `## Refinement decisions` + `## Q&A traceability`. Since it overwrites an existing doc, it asks the user's **confirmation**. It writes only `docs/plans` — never other `docs/` folders, no auto-export. If the refine **touches UI**, it also produces/updates **design SPECs** (`NNN-SPEC-<SLUG>.md`) as artifacts **of its own session** (see *Delta 4* — they are not `docs/`, no auto-export).
35
+ Updates `docs/plans/PPP-plan-<slug>.md` **in place** (when the user picks `Guardar plan refinado`): completes/adjusts sections and **adds** `## Refinement decisions` + `## Q&A traceability`. Since it overwrites an existing doc, it asks the user's **confirmation**. On an accepted split (§ *Split gate — refine semantics*) it also **creates** the extracted sibling plans (newly minted `docs/plans` files). It writes only `docs/plans` — never other `docs/` folders, no auto-export. If the refine **touches UI**, it also produces/updates **design SPECs** (`NNN-SPEC-<SLUG>.md`) as artifacts **of its own session** (see *Delta 4* — they are not `docs/`, no auto-export).
36
36
 
37
37
  ## Inherits
38
38
 
@@ -66,7 +66,7 @@ Every doubt asked to the human + the chosen answer.
66
66
 
67
67
  ## Delta 2 — Gap taxonomy (of "plan")
68
68
 
69
- Reuses plan-new-loop's gap taxonomy **in full** ([`plan-new-loop`](../plan-new-loop/LOOP.md) § *Delta 2*): vague Approach/Solution, components unidentified, AS-IS wiring unknown, phase too large, task not atomic, missing deps, spec criteria uncovered, unaddressed risks, UI without design SPEC. **Focus difference:** plan-new **builds** the plan from scratch; plan-refine **detects what changed** against the written plan (or against the spec, if the spec was re-refined) and closes **those** gaps — typically fewer and more localized. One extra re-refine gap:
69
+ Reuses plan-new-loop's gap taxonomy **in full** ([`plan-new-loop`](../plan-new-loop/LOOP.md) § *Delta 2*): vague Approach/Solution, components unidentified, AS-IS wiring unknown, phase too large, task not atomic, missing deps, spec criteria uncovered, unaddressed risks, plan splittable, UI without design SPEC. **Focus difference:** plan-new **builds** the plan from scratch; plan-refine **detects what changed** against the written plan (or against the spec, if the spec was re-refined) and closes **those** gaps — typically fewer and more localized. One extra re-refine gap:
70
70
 
71
71
  | Gap | Signal | Resolved by |
72
72
  |---|---|---|
@@ -84,6 +84,15 @@ Same as plan-new (maps code/impact: FE/BE/DB components, AS-IS wiring, deps), bu
84
84
 
85
85
  Same mechanism as [`plan-new-loop`](../plan-new-loop/LOOP.md) (§ *Delta 4*: the **`ui-design`** capability → per-screen `NNN-SPEC-<SLUG>.md`, see [`SPEC.md`](../../artifacts/artifacts-design/SPEC.md)), **scoped to the delta**: only the screens **new or changed** by the refine get a design SPEC. The updated SPEC is written in **plan-refine's own session** (each loop manages ITS session's artifacts — it never edits plan-new's) and the plan **re-points** the UI Task reference to the current SPEC. Untouched screens keep their original SPEC.
86
86
 
87
+ ## Split gate — refine semantics
88
+
89
+ The gate itself — signals, offer, anti-duplicate, sibling contract, partition — is defined **once** in [`plan-new-loop`](../plan-new-loop/LOOP.md) § *Split gate (multi-plan)* (this flow's guaranteed load already includes that file); this loop only adds the **in-place semantics** of splitting an existing plan:
90
+
91
+ - The original plan **keeps its number/path**: it is rewritten **reduced** to its remaining tranche (in place, with confirmation). The extracted tranches become newly minted sibling plans (`aw next-number docs/plans` immediately before each write); their `## Origin` records "split from `docs/plans/PPP-plan-<slug>.md`" + the source spec + the siblings by path.
92
+ - The gate also fires on **partially executed** plans. **Completed tasks (`- [x]`) never move to a sibling** — execution history stays anchored to the original path (plan-exec sessions' `## Origin` keep resolving); only pending work is extracted.
93
+ - The split is recorded in `## Refinement decisions` (what moved where + why); original + siblings together keep the **complete, disjoint partition** of the spec criteria (spec-less: the Delta 2 degradation applies).
94
+ - **Closing action** on the split branch: `Guardar planes` (edit the original reduced + write the extracted siblings); the normal branch keeps `Guardar plan refinado`.
95
+
87
96
  ## Compact / resume — PLAN-refine keys
88
97
 
89
98
  Full mechanism (3 cases, `Compactar`, re-run with `--reopen`) in the chassis (§ *Compact / resume*). PLAN-refine keys: prior-work mark = `## Refinement decisions` + `## Q&A traceability` **in the plan**; re-refine on demand is **first-class** as many times as needed while the flow stays in PLAN.
@@ -110,8 +119,12 @@ plan-refine-loop(plan):
110
119
  # spec-less plan (adopted/hand-written): criteria anchor to the plan's own Final behavior/Validations (see Delta 2)
111
120
  - re-refine's own check: the plan is REALIGNED with what changed
112
121
  whatever fails → comes back as a gap
113
- structured_choice(content: [Guardar plan refinado, Preguntar algo más], flow: [Compactar, Cerrar])
114
- Guardar → edit in place (with confirmation) + insert/update Refinement decisions + Q&A traceability
122
+ if split accepted (plan-new-loop § Split gate (multi-plan)): work = original reduced + extracted siblings
123
+ structured_choice(content: [Guardar planes, Preguntar algo más], flow: [Compactar, Cerrar])
124
+ Guardar planes → edit original reduced (confirmation) + write extracted siblings + record in Refinement decisions
125
+ else:
126
+ structured_choice(content: [Guardar plan refinado, Preguntar algo más], flow: [Compactar, Cerrar])
127
+ Guardar → edit in place (with confirmation) + insert/update Refinement decisions + Q&A traceability
115
128
  finalize: CHECKPOINT persisted (+ BACKLOG only if something is deferred) + close session + report
116
129
  ```
117
130
 
@@ -119,4 +132,5 @@ finalize: CHECKPOINT persisted (+ BACKLOG only if something is deferred) + close
119
132
 
120
133
  - **No material gaps** → **coherence gate** (the *Sequence* checklist; plan-new's gate + the re-refine's own realignment check).
121
134
  - Passes → `Guardar plan refinado` (edits in place with confirmation) → `finalize`.
135
+ - **Split branch**: `Guardar planes` edits the original reduced and writes the extracted siblings → `finalize`.
122
136
  - `Cerrar` at any time → `finalize` (persists `CHECKPOINT`; `BACKLOG` only if something is deferred; closes the session, reports).