@ai-dev-methodologies/rlp-desk 0.3.1 → 0.3.2

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.2",
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",
@@ -165,7 +165,8 @@ DEBUG=<1 if --debug, else 0> \
165
165
  1. Validate scaffold: `.claude/ralph-desk/prompts/<slug>.worker.prompt.md` etc.
166
166
  2. Check sentinels (complete/blocked). Found → tell user `/rlp-desk clean <slug>`.
167
167
  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")`.
168
+ 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).
169
+ 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
170
 
170
171
  ### Leader Loop
171
172
 
@@ -198,11 +199,14 @@ rm -f .claude/ralph-desk/memos/<slug>-verify-verdict.json
198
199
  - User specified → use that
199
200
  - If `--debug`: debug_log `[EXEC] iter=N phase=model_select worker_model=<model> reason=<reason>`
200
201
 
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)
202
+ **④ Build worker prompt (Prompt Assembly Protocol)**
203
+ 1. Capture `WORKING_DIR` once: use `$PWD` from when `/rlp-desk run` was invoked. Store for all prompt construction.
204
+ 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.
205
+ 3. Prepend meta comment: `## WORKING_DIR: {absolute path}` Worker must use this as its working directory.
206
+ 4. Append iteration number + memory contract.
207
+ 5. Write to `.claude/ralph-desk/logs/<slug>/iter-NNN.worker-prompt.md` (audit trail).
205
208
  - Note: Worker ALWAYS records execution_steps in done-claim.json per governance §1f. No flag needed.
209
+ - **Rewriting paths from absolute to relative WILL break worktree campaigns. Only additions (WORKING_DIR header, iteration context) are allowed.**
206
210
 
207
211
  **④½ Contract review** (agent mode only)
208
212
  - Before dispatching Worker, spawn a lightweight review: "Is this iteration contract sufficient to achieve the US's AC? Any missing steps?"
@@ -241,6 +245,8 @@ Bash("codex exec --model <worker_codex_model> --reasoning-effort <worker_codex_r
241
245
  - Also read `iter-signal.json` for `us_id` field (which US was just completed)
242
246
  - If `--debug`: debug_log `[EXEC] iter=N phase=worker_signal status=<stop_status> us_id=<us_id>`
243
247
 
248
+ **CRITICAL: Immediately proceed to ⑦. Do NOT pause, do NOT ask the user, do NOT wait for confirmation. The loop is autonomous.**
249
+
244
250
  **⑦ Execute Verifier**
245
251
 
246
252
  **Per-US mode** (default, `--verify-mode per-us`):
@@ -262,6 +268,7 @@ Bash("codex exec --model <worker_codex_model> --reasoning-effort <worker_codex_r
262
268
 
263
269
  **⑦a Dispatch Verifier**
264
270
  - Note: Verifier ALWAYS records reasoning in verify-verdict.json per governance §1f. No flag needed.
271
+ - **Prompt Assembly Protocol (same as ④)**: Read verifier prompt file verbatim. Prepend `## WORKING_DIR: {absolute path}`. Do NOT rewrite paths.
265
272
  - If `--debug`: debug_log `[EXEC] iter=N phase=verifier engine=<engine> model=<model> scope=<us_id> dispatched=true`
266
273
 
267
274
  If `--verifier-engine claude` (default):
@@ -309,6 +316,8 @@ After the primary verifier runs, run a second verifier with the OTHER engine:
309
316
  - If `--debug`: debug_log `[EXEC] iter=N phase=checkpoint level=<1|2> evidence=<summary>`
310
317
  - If `--debug` and consensus: debug_log `[EXEC] iter=N phase=consensus claude=<verdict> codex=<verdict> round=<N>`
311
318
 
319
+ **CRITICAL: Immediately proceed to ⑧. Do NOT pause, do NOT ask the user. Continue the loop.**
320
+
312
321
  **⑧ Write result log and report to user, continue loop**
313
322
  - Write `logs/<slug>/iter-NNN.result.md`:
314
323
  - Result status `[leader-measured]`
@@ -316,6 +325,7 @@ After the primary verifier runs, run a second verifier with the OTHER engine:
316
325
  - Verifier verdict `[leader-measured]`
317
326
  - Write `status.json`
318
327
  - Report: iteration N, phase, model used, result
328
+ - **Always**: append to baseline.log: `[timestamp] iter=N verdict=<pass|fail|continue> us=<us_id> model=<worker_model>`
319
329
  - If `--debug`: debug_log `[EXEC] iter=N phase=result status=<result> consecutive_failures=<N> verified_us=<list>`
320
330
 
321
331
  At loop end (COMPLETE, BLOCKED, or TIMEOUT):
@@ -346,7 +356,7 @@ Per failure: Worker steps → Verifier reasoning → Root cause → Resolution
346
356
  ## 3. Worker Process Quality (§1f audit)
347
357
  Table: Iter | US | Steps | verify_red? | RED exit≠0? | verify_green? | Test-First? | E2E? | AC linked?
348
358
  Aggregate: TDD compliance %, RED confirmation %, E2E evidence %, step completeness %
349
- Audit: each step must have type from §1f vocabulary + ac_id + command + exit_code
359
+ 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
360
 
351
361
  ## 4. Verifier Judgment Quality (§1f audit)
352
362
  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"