@ai-dev-methodologies/rlp-desk 0.3.1 → 0.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-dev-methodologies/rlp-desk",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "Fresh-context iterative loops for Claude Code — autonomous task completion with independent verification",
5
5
  "scripts": {
6
6
  "postinstall": "node scripts/postinstall.js",
@@ -79,19 +79,35 @@ If brainstorm was done, auto-fill PRD and test-spec with the results.
79
79
  Tell the user:
80
80
  1. The scaffold has been created — list the generated files
81
81
  2. Ask them to review/edit the PRD and test-spec if needed
82
- 3. Show the run command with available options:
82
+ 3. Present run options with explanations and ONE recommendation. The user MUST copy and paste the command themselves:
83
+
83
84
  ```
84
- /rlp-desk run <slug> [options]
85
-
86
- Options:
87
- --mode agent|tmux
88
- --worker-engine claude|codex
89
- --verifier-engine claude|codex
90
- --verify-mode per-us|batch
91
- --verify-consensus
92
- --consensus-scope all|final-only
85
+ Available run commands (copy the one you want):
86
+
87
+ # Recommended for most cases — agent mode, per-US verification, debug logging:
88
+ /rlp-desk run <slug> --debug
89
+
90
+ # With self-verification campaign report (recommended for MEDIUM+ risk):
91
+ /rlp-desk run <slug> --debug --with-self-verification
92
+
93
+ # Tmux mode for long campaigns with real-time visibility:
94
+ /rlp-desk run <slug> --mode tmux --debug
95
+
96
+ # Cross-engine consensus (requires codex CLI installed):
97
+ /rlp-desk run <slug> --debug --verify-consensus
98
+
99
+ # Full options reference:
100
+ # --mode agent|tmux Agent mode (default) or tmux shell leader
101
+ # --debug Always-on detailed logging (recommended)
102
+ # --with-self-verification Post-campaign analysis report
103
+ # --verify-mode per-us|batch Per-US (default) or batch verification
104
+ # --verify-consensus Both claude+codex must pass
105
+ # --worker-model MODEL haiku/sonnet/opus (default: sonnet)
106
+ # --verifier-model MODEL haiku/sonnet/opus (default: opus)
107
+ # --max-iter N Max iterations (default: 100)
93
108
  ```
94
- 4. Wait for the user to explicitly invoke `/rlp-desk run`
109
+
110
+ **CRITICAL: Do NOT offer to run for the user. Do NOT ask "실행할까요?" or "shall I run?". The user MUST type the run command themselves. Just present the options, recommend one, and STOP.**
95
111
 
96
112
  ---
97
113
 
@@ -165,11 +181,18 @@ DEBUG=<1 if --debug, else 0> \
165
181
  1. Validate scaffold: `.claude/ralph-desk/prompts/<slug>.worker.prompt.md` etc.
166
182
  2. Check sentinels (complete/blocked). Found → tell user `/rlp-desk clean <slug>`.
167
183
  3. Clean previous `done-claim.json`, `verify-verdict.json`.
168
- 4. If `--debug`: create/clear `logs/<slug>/debug.log`. Define a helper: to "debug_log" means append a timestamped line to this file via `Bash("echo \"[$(date '+%Y-%m-%d %H:%M:%S')] $msg\" >> .claude/ralph-desk/logs/<slug>/debug.log")`.
184
+ 4. **Always**: write baseline log entry to `.claude/ralph-desk/logs/<slug>/baseline.log`: `[timestamp] iter=0 phase=start slug=<slug> worker_model=<model> verifier_model=<model>`. Baseline.log captures 1 line per iteration for lightweight post-mortem (always-on, no flag needed).
185
+ 5. If `--debug`: also create/clear `logs/<slug>/debug.log`. Define a helper: to "debug_log" means append a timestamped line to this file via `Bash("echo \"[$(date '+%Y-%m-%d %H:%M:%S')] $msg\" >> .claude/ralph-desk/logs/<slug>/debug.log")`. When `--debug` is active, debug.log contains all baseline.log fields plus detailed phase logs.
169
186
 
170
187
  ### Leader Loop
171
188
 
172
- **CRITICAL: DO NOT STOP between iterations.** You MUST continue the loop automatically until a sentinel is written (COMPLETE or BLOCKED) or max_iter is reached. Do NOT pause to ask the user. Do NOT wait for confirmation. The loop is fully autonomous — just report each iteration result briefly and immediately proceed to the next iteration.
189
+ **CRITICAL: DO NOT STOP between iterations.** You MUST continue the loop automatically until a sentinel is written (COMPLETE or BLOCKED) or max_iter is reached. Do NOT pause to ask the user. Do NOT wait for confirmation. The loop is fully autonomous.
190
+
191
+ **PLATFORM CONSTRAINT (Agent mode):** In Agent mode, the Leader is an LLM in Claude Code's turn-based model. A turn ENDS when the response contains no tool calls. This means:
192
+ - **NEVER output plain text without an accompanying tool call.** Text-only output = turn ends = loop stops.
193
+ - **Use `Bash("echo '...'")` for all status reports** instead of plain text. This keeps the tool-call chain alive.
194
+ - **After every step result, IMMEDIATELY start the next step's tool call in the SAME response.** For example, after reading the verdict (⑦c), report via Bash("echo") AND start ⑧'s tool calls in one response.
195
+ - If you output "Iter 1 complete, moving to iter 2" as plain text without a tool call, the turn terminates and the loop breaks. This is a platform constraint, not a compliance issue — no amount of "DO NOT STOP" text can override it.
173
196
 
174
197
  If `--debug`, at loop start debug_log: `[PLAN] slug=<slug> max_iter=<N> worker_engine=<engine> worker_model=<model> verifier_engine=<engine> verifier_model=<model> verify_mode=<mode> consensus=<0|1> consensus_scope=<scope>`
175
198
 
@@ -198,11 +221,14 @@ rm -f .claude/ralph-desk/memos/<slug>-verify-verdict.json
198
221
  - User specified → use that
199
222
  - If `--debug`: debug_log `[EXEC] iter=N phase=model_select worker_model=<model> reason=<reason>`
200
223
 
201
- **④ Build worker prompt**
202
- - Read `.claude/ralph-desk/prompts/<slug>.worker.prompt.md`
203
- - Combine with iteration number + memory contract
204
- - Write to `.claude/ralph-desk/logs/<slug>/iter-NNN.worker-prompt.md` (audit trail)
224
+ **④ Build worker prompt (Prompt Assembly Protocol)**
225
+ 1. Capture `WORKING_DIR` once: use `$PWD` from when `/rlp-desk run` was invoked. Store for all prompt construction.
226
+ 2. Read `.claude/ralph-desk/prompts/<slug>.worker.prompt.md` use its content **verbatim**. Do NOT rewrite, paraphrase, or regenerate paths. The prompt file contains correct absolute paths from init.
227
+ 3. Prepend meta comment: `## WORKING_DIR: {absolute path}` Worker must use this as its working directory.
228
+ 4. Append iteration number + memory contract.
229
+ 5. Write to `.claude/ralph-desk/logs/<slug>/iter-NNN.worker-prompt.md` (audit trail).
205
230
  - Note: Worker ALWAYS records execution_steps in done-claim.json per governance §1f. No flag needed.
231
+ - **Rewriting paths from absolute to relative WILL break worktree campaigns. Only additions (WORKING_DIR header, iteration context) are allowed.**
206
232
 
207
233
  **④½ Contract review** (agent mode only)
208
234
  - Before dispatching Worker, spawn a lightweight review: "Is this iteration contract sufficient to achieve the US's AC? Any missing steps?"
@@ -241,6 +267,8 @@ Bash("codex exec --model <worker_codex_model> --reasoning-effort <worker_codex_r
241
267
  - Also read `iter-signal.json` for `us_id` field (which US was just completed)
242
268
  - If `--debug`: debug_log `[EXEC] iter=N phase=worker_signal status=<stop_status> us_id=<us_id>`
243
269
 
270
+ **CRITICAL: Immediately proceed to ⑦. Do NOT pause, do NOT ask the user, do NOT wait for confirmation. The loop is autonomous.**
271
+
244
272
  **⑦ Execute Verifier**
245
273
 
246
274
  **Per-US mode** (default, `--verify-mode per-us`):
@@ -262,6 +290,7 @@ Bash("codex exec --model <worker_codex_model> --reasoning-effort <worker_codex_r
262
290
 
263
291
  **⑦a Dispatch Verifier**
264
292
  - Note: Verifier ALWAYS records reasoning in verify-verdict.json per governance §1f. No flag needed.
293
+ - **Prompt Assembly Protocol (same as ④)**: Read verifier prompt file verbatim. Prepend `## WORKING_DIR: {absolute path}`. Do NOT rewrite paths.
265
294
  - If `--debug`: debug_log `[EXEC] iter=N phase=verifier engine=<engine> model=<model> scope=<us_id> dispatched=true`
266
295
 
267
296
  If `--verifier-engine claude` (default):
@@ -309,13 +338,16 @@ After the primary verifier runs, run a second verifier with the OTHER engine:
309
338
  - If `--debug`: debug_log `[EXEC] iter=N phase=checkpoint level=<1|2> evidence=<summary>`
310
339
  - If `--debug` and consensus: debug_log `[EXEC] iter=N phase=consensus claude=<verdict> codex=<verdict> round=<N>`
311
340
 
341
+ **CRITICAL: Immediately proceed to ⑧. Do NOT pause, do NOT ask the user. Continue the loop.**
342
+
312
343
  **⑧ Write result log and report to user, continue loop**
313
344
  - Write `logs/<slug>/iter-NNN.result.md`:
314
345
  - Result status `[leader-measured]`
315
346
  - Files changed via `git diff --stat HEAD~1 HEAD` `[git-measured]`
316
347
  - Verifier verdict `[leader-measured]`
317
348
  - Write `status.json`
318
- - Report: iteration N, phase, model used, result
349
+ - Report via tool call: `Bash("echo 'Iter N | US-NNN | verdict | model | next_action'")` — NEVER plain text. This keeps the turn alive for the next iteration.
350
+ - **Always**: append to baseline.log: `[timestamp] iter=N verdict=<pass|fail|continue> us=<us_id> model=<worker_model>`
319
351
  - If `--debug`: debug_log `[EXEC] iter=N phase=result status=<result> consecutive_failures=<N> verified_us=<list>`
320
352
 
321
353
  At loop end (COMPLETE, BLOCKED, or TIMEOUT):
@@ -346,7 +378,7 @@ Per failure: Worker steps → Verifier reasoning → Root cause → Resolution
346
378
  ## 3. Worker Process Quality (§1f audit)
347
379
  Table: Iter | US | Steps | verify_red? | RED exit≠0? | verify_green? | Test-First? | E2E? | AC linked?
348
380
  Aggregate: TDD compliance %, RED confirmation %, E2E evidence %, step completeness %
349
- Audit: each step must have type from §1f vocabulary + ac_id + command + exit_code
381
+ Audit: each step object must have "step" field with value from §1f vocabulary (write_test, verify_red, implement, verify_green, refactor, verify_e2e, commit, verify) + ac_id + command + exit_code
350
382
 
351
383
  ## 4. Verifier Judgment Quality (§1f audit)
352
384
  Table: Iter | US | Checks | All Basis? | Independent? | IL-1? | Layer? | Sufficiency? | Anti-Gaming? | Worker Audit?
@@ -472,6 +472,27 @@ GIEOF
472
472
  echo " + .gitignore (created with rlp-desk rules)"
473
473
  fi
474
474
 
475
+ # --- Post-init validation gate ---
476
+ INIT_FAIL=0
477
+ for REQUIRED_FILE in \
478
+ "$DESK/prompts/$SLUG.worker.prompt.md" \
479
+ "$DESK/prompts/$SLUG.verifier.prompt.md" \
480
+ "$DESK/context/$SLUG-latest.md" \
481
+ "$DESK/memos/$SLUG-memory.md" \
482
+ "$DESK/plans/prd-$SLUG.md" \
483
+ "$DESK/plans/test-spec-$SLUG.md"; do
484
+ if [[ ! -f "$REQUIRED_FILE" ]]; then
485
+ echo " ✗ MISSING: $REQUIRED_FILE"
486
+ INIT_FAIL=1
487
+ fi
488
+ done
489
+ if [[ $INIT_FAIL -eq 1 ]]; then
490
+ echo ""
491
+ echo "ERROR: Scaffold incomplete. Some required files were not created."
492
+ echo "Re-run init or check filesystem permissions."
493
+ exit 1
494
+ fi
495
+
475
496
  echo ""
476
497
  echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
477
498
  echo "Scaffold ready: $SLUG"