claude-cook 1.11.2 → 1.11.4
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/agents/cook-pm.md +3 -1
- package/commands/cook/pm-start.md +12 -8
- package/package.json +1 -1
- package/scripts/pm-loop.sh +9 -2
package/agents/cook-pm.md
CHANGED
|
@@ -109,7 +109,9 @@ When running under `/cook:pm-start` and `pm-loop.sh`, you MUST avoid asking the
|
|
|
109
109
|
|
|
110
110
|
## PM Loop Launch is MANDATORY
|
|
111
111
|
|
|
112
|
-
When spawned by `/cook:pm-start`, you MUST launch `pm-loop.sh` via Bash after executing the first cycle. The only exception is when `--manual` flag is explicitly set. Without the loop, the PM does one cycle and stops — defeating the purpose of autonomous operation.
|
|
112
|
+
When spawned by `/cook:pm-start`, you MUST launch `pm-loop.sh` via the Bash tool with `run_in_background=true` after executing the first cycle. The only exception is when `--manual` flag is explicitly set. Without the loop, the PM does one cycle and stops — defeating the purpose of autonomous operation.
|
|
113
|
+
|
|
114
|
+
**IMPORTANT:** Use the Bash tool with `run_in_background=true` — this runs in Claude Code's background compute so the user sees live progress in the UI. Do NOT use `--background` flag, `nohup`, `setsid`, `disown`, or `&`. Do NOT set `timeout` on the Bash tool — the loop runs indefinitely until milestone complete or `.pm-stop`. The loop runs in foreground mode within the background task, showing live progress bars and status updates.
|
|
113
115
|
|
|
114
116
|
</philosophy>
|
|
115
117
|
|
|
@@ -142,19 +142,23 @@ Follow the action for the detected state as defined in `pm-cycle.md`:
|
|
|
142
142
|
|
|
143
143
|
**You MUST launch pm-loop.sh unless `--manual` flag is explicitly set.** This is not optional. The loop is what makes the PM autonomous — without it, the PM does one cycle and stops.
|
|
144
144
|
|
|
145
|
-
**If `--manual` is NOT set**,
|
|
145
|
+
**If `--manual` is NOT set**, launch pm-loop.sh using the Bash tool with `run_in_background=true` immediately after the first cycle completes:
|
|
146
146
|
|
|
147
147
|
```bash
|
|
148
|
-
|
|
148
|
+
~/.claude/scripts/pm-loop.sh \
|
|
149
149
|
--phase={X} \
|
|
150
150
|
--interval={poll_interval} \
|
|
151
151
|
--max-iterations={max_iterations} \
|
|
152
|
-
--background \
|
|
153
152
|
${init_flag} \
|
|
154
|
-
${prd_flag}
|
|
155
|
-
> /dev/null 2>&1 &
|
|
153
|
+
${prd_flag}
|
|
156
154
|
```
|
|
157
155
|
|
|
156
|
+
**IMPORTANT:**
|
|
157
|
+
- Use the Bash tool with `run_in_background=true` — this runs in Claude Code's background compute so the user sees live progress in the UI.
|
|
158
|
+
- Do NOT use `--background` flag, `nohup`, or `&`. Let Claude Code manage the background process.
|
|
159
|
+
- Do NOT use `timeout` on the Bash tool — the loop runs indefinitely until milestone complete or `.pm-stop`.
|
|
160
|
+
- The loop runs in foreground mode within the background task, showing live progress bars and status updates.
|
|
161
|
+
|
|
158
162
|
Where:
|
|
159
163
|
- `${init_flag}` is `--init` if the `--init` flag was provided
|
|
160
164
|
- `${prd_flag}` is `--prd=<file>` if provided
|
|
@@ -163,11 +167,11 @@ Where:
|
|
|
163
167
|
After launching, confirm to user:
|
|
164
168
|
```
|
|
165
169
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
166
|
-
PM ► LOOP STARTED
|
|
170
|
+
PM ► LOOP STARTED (background compute)
|
|
167
171
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
168
172
|
|
|
169
|
-
PM loop running in background
|
|
170
|
-
Polling every {interval}s
|
|
173
|
+
PM loop running in background compute.
|
|
174
|
+
Polling every {interval}s. Progress visible in Claude Code UI.
|
|
171
175
|
|
|
172
176
|
Stop with: /cook:pm-stop
|
|
173
177
|
Status: /cook:pm-status
|
package/package.json
CHANGED
package/scripts/pm-loop.sh
CHANGED
|
@@ -138,12 +138,19 @@ fi
|
|
|
138
138
|
# ─── Background mode: re-exec detached ───────────────────────────
|
|
139
139
|
|
|
140
140
|
if [ "$BACKGROUND" = true ]; then
|
|
141
|
-
# Strip --background from args, re-exec
|
|
141
|
+
# Strip --background from args, re-exec fully detached
|
|
142
142
|
ARGS=()
|
|
143
143
|
for arg in "$@"; do
|
|
144
144
|
[ "$arg" != "--background" ] && ARGS+=("$arg")
|
|
145
145
|
done
|
|
146
|
-
|
|
146
|
+
# Use setsid to create a new session — survives parent shell death
|
|
147
|
+
# Falls back to nohup+disown if setsid not available
|
|
148
|
+
if command -v setsid >/dev/null 2>&1; then
|
|
149
|
+
setsid "$0" "${ARGS[@]}" > .planning/pm-loop.log 2>&1 &
|
|
150
|
+
else
|
|
151
|
+
nohup "$0" "${ARGS[@]}" > .planning/pm-loop.log 2>&1 &
|
|
152
|
+
disown $! 2>/dev/null || true
|
|
153
|
+
fi
|
|
147
154
|
BG_PID=$!
|
|
148
155
|
echo "$BG_PID" > .planning/.pm-loop-pid
|
|
149
156
|
echo "PM loop launched in background (PID: $BG_PID)"
|