@devo-bmad-custom/agent-orchestration 1.0.10 → 1.0.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devo-bmad-custom/agent-orchestration",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "description": "BMAD Method — AI-native agile workflow system for Claude Code and compatible AI assistants",
5
5
  "keywords": [
6
6
  "bmad",
@@ -133,18 +133,39 @@ fi
133
133
 
134
134
  ### 3. `tmux_kill_agent` — Gracefully close an agent pane
135
135
 
136
+ **Trigger:** Coordinator sees a pane with status `ready-to-close` in the session file Pane Lifecycle table.
137
+
138
+ **Pre-conditions (verify all before killing):**
139
+ - [ ] Agent's report-back received (STEP COMPLETE message seen in this pane or session file updated)
140
+ - [ ] Task marked `done` in session file Tasks section
141
+ - [ ] Claude session ID saved to session file
142
+
136
143
  ```bash
137
- # Inputs: TARGET_PANE_ID, MASTER_PANE, SESSION_NAME, WINDOW_ID
144
+ # Inputs: TARGET_PANE_ID, MASTER_PANE, SESSION_FILE
138
145
  TARGET_PANE_ID="%31"
139
146
  MASTER_PANE="%0"
140
147
 
141
- # 1. Verify pane exists in expected context
148
+ # 0. SELF-KILL GUARD never kill your own pane
149
+ OWN_PANE=$(tmux display-message -p "#{pane_id}")
150
+ if [ "$TARGET_PANE_ID" = "$OWN_PANE" ]; then
151
+ echo "ERROR: refusing to kill own pane $OWN_PANE — coordinator cannot kill itself"
152
+ echo "If you need to exit, use /exit manually."
153
+ exit 1
154
+ fi
155
+
156
+ # Also guard against killing the master pane (unless caller explicitly overrides)
157
+ if [ "$TARGET_PANE_ID" = "$MASTER_PANE" ]; then
158
+ echo "ERROR: refusing to kill master pane $MASTER_PANE"
159
+ exit 1
160
+ fi
161
+
162
+ # 1. Verify pane exists
142
163
  sleep 10
143
- VERIFIED=$(tmux list-panes -a -F "#{pane_id} #{session_name} #{window_id}" \
144
- | grep "^$TARGET_PANE_ID ")
164
+ VERIFIED=$(tmux list-panes -a -F "#{pane_id}" | grep -Fx "$TARGET_PANE_ID")
145
165
  if [ -z "$VERIFIED" ]; then
146
- echo "ERROR: pane $TARGET_PANE_ID not foundaborting kill"
147
- exit 1
166
+ echo "WARN: pane $TARGET_PANE_ID already gonemarking closed in session file"
167
+ # Update session file Pane Lifecycle row: status → closed
168
+ exit 0
148
169
  fi
149
170
 
150
171
  # 2. Send /exit (lets Claude flush writes and exit cleanly)
@@ -152,17 +173,24 @@ sleep 10
152
173
  tmux send-keys -t "$TARGET_PANE_ID" "/exit" Enter
153
174
  sleep 10
154
175
 
155
- # 3. Kill the pane
156
- tmux kill-pane -t "$TARGET_PANE_ID"
157
- sleep 10
176
+ # 3. Verify pane closed on its own (Claude exits after /exit)
177
+ STILL_ALIVE=$(tmux list-panes -a -F "#{pane_id}" | grep -Fx "$TARGET_PANE_ID")
178
+ if [ -n "$STILL_ALIVE" ]; then
179
+ # Force kill if still up after /exit
180
+ tmux kill-pane -t "$TARGET_PANE_ID"
181
+ sleep 10
182
+ fi
183
+
184
+ # 4. Update session file — mark pane as closed in Pane Lifecycle table
185
+ # Edit row: status → closed, check coord ✓ boxes
158
186
 
159
- # 4. Rebalance remaining panes
187
+ # 5. Rebalance remaining panes
160
188
  tmux select-pane -t "$MASTER_PANE"
161
189
  sleep 10
162
190
  tmux select-layout main-vertical
163
191
  sleep 10
164
192
 
165
- echo "Killed pane $TARGET_PANE_ID and rebalanced"
193
+ echo "Closed pane $TARGET_PANE_ID session file updated, layout rebalanced"
166
194
  ```
167
195
 
168
196
  ### 4. `tmux_rebalance` — Equalize pane sizes with master awareness
@@ -265,8 +293,13 @@ tmux send-keys -t "$SPAWNER_PANE" Enter
265
293
  sleep 10
266
294
 
267
295
  # 4. Check for more pending tasks for this role
268
- # 5. If found: claim next task
269
- # 6. If none: set status to idle in Active Agents table
296
+ # 5. If found: claim next task and continue
297
+ # 6. If none:
298
+ # a. Set status to `ready-to-close` in Pane Lifecycle table (NOT Active Agents)
299
+ # b. Check all close-down boxes in Pane Lifecycle row:
300
+ # ☑ report-back sent · ☑ session ID saved · ☑ task marked done · ☑ ready-to-close set
301
+ # c. The COORDINATOR is responsible for executing /exit + kill-pane.
302
+ # Do NOT self-exit unless you are the coordinator or explicitly told to.
270
303
  ```
271
304
 
272
305
  ---
@@ -440,7 +473,8 @@ fi
440
473
 
441
474
  ## Common Mistakes (Avoid These)
442
475
 
443
- 1. **No `Enter` on send-keys** — message typed but never submitted
476
+ 1. **Killing own pane** — always check `TARGET_PANE_ID != $(tmux display-message -p "#{pane_id}")` AND `TARGET_PANE_ID != MASTER_PANE` before `kill-pane`
477
+ 2. **No `Enter` on send-keys** — message typed but never submitted
444
478
  2. **No sleep between tmux commands** — race conditions, stale pane lists
445
479
  3. **Combining `/color` and `/rename` in one send-keys call** — only the first command runs; send each as a separate call with `sleep 10` between
446
480
  4. **Using OSC 2 / `select-pane -T` for naming** — Claude Code overwrites these