claude-cook 1.11.2 → 1.11.3

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 CHANGED
@@ -109,7 +109,7 @@ 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. Always launch it in background with `nohup ... &`.
112
+ When spawned by `/cook:pm-start`, you MUST launch `pm-loop.sh --background` 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. Do NOT wrap in `nohup` or append `&` — the `--background` flag handles detaching internally via `setsid`/`disown`. The script prints the PID and exits immediately.
113
113
 
114
114
  </philosophy>
115
115
 
@@ -145,16 +145,17 @@ Follow the action for the detected state as defined in `pm-cycle.md`:
145
145
  **If `--manual` is NOT set**, run this command via Bash tool immediately after the first cycle completes:
146
146
 
147
147
  ```bash
148
- nohup ~/.claude/scripts/pm-loop.sh \
148
+ ~/.claude/scripts/pm-loop.sh \
149
149
  --phase={X} \
150
150
  --interval={poll_interval} \
151
151
  --max-iterations={max_iterations} \
152
152
  --background \
153
153
  ${init_flag} \
154
- ${prd_flag} \
155
- > /dev/null 2>&1 &
154
+ ${prd_flag}
156
155
  ```
157
156
 
157
+ **IMPORTANT:** Do NOT wrap this in `nohup` or append `&`. The `--background` flag makes `pm-loop.sh` handle its own detaching internally (via `setsid` or `nohup+disown`). The script prints the PID, writes the pid file, and exits immediately — the loop continues in a fully detached process.
158
+
158
159
  Where:
159
160
  - `${init_flag}` is `--init` if the `--init` flag was provided
160
161
  - `${prd_flag}` is `--prd=<file>` if provided
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-cook",
3
- "version": "1.11.2",
3
+ "version": "1.11.3",
4
4
  "description": "A meta-prompting, context engineering and spec-driven development system for Claude Code, OpenCode and Gemini by TÂCHES.",
5
5
  "bin": {
6
6
  "claude-cook": "bin/install.js"
@@ -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 with nohup
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
- nohup "$0" "${ARGS[@]}" > .planning/pm-loop.log 2>&1 &
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)"