@ai-dev-methodologies/rlp-desk 0.5.0 → 0.5.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/README.md CHANGED
@@ -49,8 +49,12 @@ You'll be asked to confirm each item:
49
49
 
50
50
  ### 3. Run
51
51
 
52
- ```
53
- /rlp-desk run calculator
52
+ ```bash
53
+ # Recommended (cross-engine + final consensus):
54
+ /rlp-desk run <slug> --mode tmux --worker-model spark:high --consensus final-only --debug
55
+
56
+ # Claude-only:
57
+ /rlp-desk run <slug> --debug
54
58
  ```
55
59
 
56
60
  The leader loop runs autonomously — spawning workers, verifying results, and tracking progress until completion or a circuit breaker triggers.
@@ -232,28 +236,39 @@ When all US pass individually, the final ALL verify runs **sequentially per-US**
232
236
 
233
237
  ### Run Options
234
238
 
235
- | Flag | Default | Description |
236
- |------|---------|-------------|
237
- | `--max-iter N` | 100 | Maximum iterations before timeout |
238
- | `--mode agent\|tmux` | agent | Execution mode (see below) |
239
- | `--worker-model MODEL` | sonnet | Claude worker model (haiku/sonnet/opus) |
240
- | `--worker-engine claude\|codex` | claude | Worker engine |
241
- | `--verifier-model MODEL` | auto | Auto-selected: +1 tier (same-engine) or cross-engine |
242
- | `--verifier-engine claude\|codex` | auto | Opposite of worker engine if codex available |
243
- | `--codex-model MODEL` | gpt-5.4 | Codex model (spark requires GPT Pro) |
244
- | `--codex-reasoning LEVEL` | medium | low/medium/high/xhigh |
245
- | `--verify-mode per-us\|batch` | per-us | Verification strategy (see below) |
246
- | `--lock-worker-model` | off | Disable progressive model upgrade on failure |
247
- | `--debug` | off | Debug logging to `logs/<slug>/debug.log` |
248
- | `--with-self-verification` | off | Campaign-level post-loop analysis report |
239
+ | Option | Default | Description |
240
+ |--------|---------|-------------|
241
+ | `--mode agent\|tmux` | agent | agent=LLM Leader, tmux=shell Leader |
242
+ | `--worker-model MODEL` | haiku | Worker model. `name`=claude, `name:reasoning`=codex |
243
+ | `--lock-worker-model` | off | Disable auto model upgrade on failure |
244
+ | `--verifier-model MODEL` | sonnet | per-US verification model (lighter) |
245
+ | `--final-verifier-model MODEL` | opus | final ALL verification model (stricter) |
246
+ | `--consensus off\|all\|final-only` | off | Cross-engine consensus scope |
247
+ | `--consensus-model MODEL` | gpt-5.4:medium | per-US cross-verifier (lighter) |
248
+ | `--final-consensus-model MODEL` | gpt-5.4:high | final cross-verifier (stricter) |
249
+ | `--verify-mode per-us\|batch` | per-us | per-us: verify each US → final ALL |
250
+ | `--cb-threshold N` | 6 | Consecutive failures BLOCKED |
251
+ | `--max-iter N` | 100 | Max iterations TIMEOUT |
252
+ | `--iter-timeout N` | 600 | Per-iteration timeout seconds (tmux only) |
253
+ | `--debug` | off | Debug logging |
254
+ | `--with-self-verification` | off | Post-campaign SV report |
255
+
256
+ #### Per-US vs Final Verification
257
+
258
+ RLP Desk runs two distinct verification passes:
259
+
260
+ - **Per-US** (`--verifier-model`, default: sonnet) — runs after each user story completes. Lightweight and fast, catches issues early before later stories build on broken foundations.
261
+ - **Final ALL** (`--final-verifier-model`, default: opus) — runs once after all user stories pass individually. Stricter and more thorough, catches cross-US integration issues and anything per-US missed.
262
+
263
+ When `--consensus` is enabled, a second cross-engine verifier runs alongside each pass: `--consensus-model` for per-US and `--final-consensus-model` for the final ALL gate. Both engines must pass.
249
264
 
250
265
  ### Init Presets
251
266
 
252
267
  After `brainstorm`, `init` detects your environment and presents run command presets:
253
268
 
254
- - **Codex detected** → recommends cross-engine mode (`--worker-model gpt-5.4:high --verify-consensus`)
255
- - **GPT Pro (spark)** → offers spark preset (`--worker-model gpt-5.3-codex-spark:high`)
256
- - **Claude-only** → defaults to `--worker-model sonnet` with opus verifier
269
+ - **Codex detected (GPT Pro / spark)** → recommends cross-engine mode (`--worker-model spark:high --consensus final-only`)
270
+ - **Codex detected (large PRD, AC > 15)** → offers gpt-5.4 preset (`--worker-model gpt-5.4:high --consensus final-only`)
271
+ - **Claude-only** → defaults to `--debug` with haiku worker and opus final verifier
257
272
  - **Basic** → minimal flags for quick iteration
258
273
 
259
274
  The brainstorm phase evaluates complexity (US count, file scope, logic, dependencies, code impact) and recommends a starting model. You can override any recommendation.
@@ -332,9 +347,8 @@ RLP Desk supports two execution engines for Worker and Verifier. **Claude is the
332
347
 
333
348
  ### Claude (default)
334
349
 
335
- ```
350
+ ```bash
336
351
  /rlp-desk run calculator
337
- /rlp-desk run calculator --worker-engine claude --verifier-engine claude
338
352
  ```
339
353
 
340
354
  Uses Claude Code's `Agent()` tool (agent mode) or `claude -p` CLI (tmux mode). Supports dynamic model routing (haiku/sonnet/opus).
@@ -345,17 +359,17 @@ Uses Claude Code's `Agent()` tool (agent mode) or `claude -p` CLI (tmux mode). S
345
359
  # Install codex CLI first
346
360
  npm install -g @openai/codex
347
361
 
348
- # Run with codex worker
349
- /rlp-desk run calculator --worker-engine codex
362
+ # Run with codex worker (spark requires GPT Pro)
363
+ /rlp-desk run calculator --worker-model spark:high
350
364
 
351
365
  # Customize model and reasoning effort
352
- /rlp-desk run calculator --worker-engine codex --codex-model gpt-5.4 --codex-reasoning high
366
+ /rlp-desk run calculator --worker-model gpt-5.4:high
353
367
 
354
- # Mix engines: codex worker, claude verifier
355
- /rlp-desk run calculator --worker-engine codex --verifier-engine claude
368
+ # Cross-engine: codex worker, claude verifier (recommended)
369
+ /rlp-desk run calculator --worker-model spark:high --consensus final-only --debug
356
370
  ```
357
371
 
358
- Uses the `codex` CLI via `Bash()` (agent mode) or as an interactive TUI (tmux mode). The `codex` binary is only required when an engine is set to `codex`.
372
+ The engine is inferred automatically from the `--worker-model` value: a plain model name (e.g. `haiku`) routes to Claude, while `name:reasoning` format (e.g. `spark:high`) routes to Codex. The `codex` binary is only required when a codex model is specified.
359
373
 
360
374
  | Engine | Agent Mode | Tmux Mode | Dynamic Routing |
361
375
  |--------|-----------|-----------|-----------------|
@@ -0,0 +1,253 @@
1
+ # Plan: rlp-desk 옵션 인터페이스 정리 + brainstorm/init 추천 보강
2
+
3
+ ## Context
4
+
5
+ rlp-desk 옵션이 유기적으로 성장하면서 20개+로 늘어남. 중복, 충돌, 미구분 문제 발생:
6
+ - `--worker-engine`, `--worker-codex-model`, `--worker-codex-reasoning`은 `--worker-model`이 이미 통합 처리 (parse_model_flag)
7
+ - consensus 옵션 3중 충돌 (`--verify-consensus`, `--final-consensus`, `--consensus-scope`)
8
+ - per-US Verifier vs Final Verifier 구분 없음
9
+ - brainstorm 모델 추천이 2열(Worker/Verifier)만 있어 per-US/Final 구분 안 됨
10
+ - gpt-5.3-codex 경로가 유저 결정 없이 코드에 존재
11
+ - brainstorm/init에서 정책 기반 추천이 부족 (batch capacity, spark vs gpt-5.4 기준 등)
12
+
13
+ ## 근거 문서
14
+
15
+ | 근거 | 위치 | 핵심 내용 |
16
+ |------|------|----------|
17
+ | 검증 철학 | `memory/feedback_verification_philosophy.md` | 기본값: haiku/sonnet/opus, per-US 가볍게, final 엄격, cross-engine 추천 |
18
+ | CB threshold | `memory/feedback_cb_threshold_six.md` | CB=6 확정, claude 3단계 커버 |
19
+ | 모델 구분 | `memory/feedback_no_assumption.md` | spark=Pro 적극 추천, gpt-5.4=fallback, gpt-5.3-codex 미확정 |
20
+ | Task sizing | `memory/feedback_us_size_limit.md` | Worker comfortable zone 안에 분할 |
21
+ | 현행 옵션 | `src/commands/rlp-desk.md:186-207` | 현재 20개+ 옵션 목록 |
22
+ | parse_model_flag | `src/scripts/lib_ralph_desk.zsh:38-57` | `모델명`=claude, `모델명:추론`=codex 통합 파싱 |
23
+ | get_next_model | `src/scripts/lib_ralph_desk.zsh:81-110` | 엔진별 업그레이드 경로 |
24
+ | check_model_upgrade | `src/scripts/lib_ralph_desk.zsh:116-168` | Worker만 상향, Verifier 고정 |
25
+
26
+ ---
27
+
28
+ ## 최종 옵션 (14개)
29
+
30
+ ### 1. 실행
31
+
32
+ | # | 옵션 | 고정 기본값 | 설명 |
33
+ |---|------|------------|------|
34
+ | 1 | `--mode agent\|tmux` | `agent` | agent=LLM Leader, tmux=shell Leader |
35
+
36
+ ### 2. Worker
37
+
38
+ | # | 옵션 | 고정 기본값 | 포맷 | 설명 |
39
+ |---|------|------------|------|------|
40
+ | 2 | `--worker-model` | `haiku` | `haiku` 또는 `spark:high` | `모델명`=claude, `모델명:추론`=codex. parse_model_flag()가 engine/model/reasoning 자동 분리 |
41
+ | 3 | `--lock-worker-model` | off | flag | 실패 시 자동 모델 업그레이드(check_model_upgrade) 비활성화 |
42
+
43
+ ### 3. Verifier (per-US)
44
+
45
+ | # | 옵션 | 고정 기본값 | 포맷 | 설명 |
46
+ |---|------|------------|------|------|
47
+ | 4 | `--verifier-model` | `sonnet` | `sonnet` 또는 `gpt-5.4:high` | per-US 검증 모델. 캠페인 내내 고정 (progressive upgrade 없음) |
48
+
49
+ ### 4. Verifier (final ALL)
50
+
51
+ | # | 옵션 | 고정 기본값 | 포맷 | 설명 |
52
+ |---|------|------------|------|------|
53
+ | 5 | `--final-verifier-model` | `opus` | `opus` 또는 `gpt-5.4:high` | final ALL 검증 모델. 미지정 시 opus 고정 (per-US와 독립) |
54
+
55
+ ### 5. Consensus
56
+
57
+ | # | 옵션 | 고정 기본값 | 설명 |
58
+ |---|------|------------|------|
59
+ | 6 | `--consensus` | `off` | `off`: 단일 엔진 / `all`: 매 verify 교차 / `final-only`: final ALL에서만 교차 |
60
+ | 7 | `--consensus-model` | `gpt-5.4:medium` | per-US 교차 verifier. 가볍게 |
61
+ | 8 | `--final-consensus-model` | `gpt-5.4:high` | final 교차 verifier. 엄격하게. spark 불가(100k limit) |
62
+
63
+ consensus 동작:
64
+
65
+ | 상황 | 주 verifier | 교차 verifier |
66
+ |------|------------|--------------|
67
+ | per-US, 주=claude | `--verifier-model` (sonnet) | `--consensus-model` (gpt-5.4:medium) |
68
+ | per-US, 주=codex | `--verifier-model` (gpt-5.4:high 등) | claude `opus` 고정 |
69
+ | final, 주=claude | `--final-verifier-model` (opus) | `--final-consensus-model` (gpt-5.4:high) |
70
+ | final, 주=codex | `--final-verifier-model` (gpt-5.4:high 등) | claude `opus` 고정 |
71
+
72
+ - 양쪽 모두 pass해야 통과. 엔진 우선권 없음.
73
+ - spark는 consensus 교차에 사용 불가 (100k output limit).
74
+
75
+ ### 6. 검증 전략
76
+
77
+ | # | 옵션 | 고정 기본값 | 설명 |
78
+ |---|------|------------|------|
79
+ | 9 | `--verify-mode` | `per-us` | `per-us`: US마다 검증→final ALL / `batch`: 전부 후 한번에 |
80
+
81
+ ### 7. 안전장치
82
+
83
+ | # | 옵션 | 고정 기본값 | 설명 |
84
+ |---|------|------------|------|
85
+ | 10 | `--cb-threshold` | `6` | 연속 fail N회 → BLOCKED. consensus 시 자동 ×2 (=12) |
86
+ | 11 | `--max-iter` | `100` | 최대 iteration → TIMEOUT |
87
+ | 12 | `--iter-timeout` | `600` | iteration당 timeout 초 (tmux만 적용) |
88
+
89
+ ### 8. 로깅/분석
90
+
91
+ | # | 옵션 | 고정 기본값 | 설명 |
92
+ |---|------|------------|------|
93
+ | 13 | `--debug` | off | `~/.claude/ralph-desk/analytics/<slug>/debug.log` |
94
+ | 14 | `--with-self-verification` | off | campaign 후 SV 리포트 → 다음 brainstorm 피드백(§8½) |
95
+
96
+ ---
97
+
98
+ ## 제거 옵션 (내부 구현으로 숨김)
99
+
100
+ | 제거 옵션 | 대체 방법 |
101
+ |-----------|----------|
102
+ | `--worker-engine` | `--worker-model` 포맷에서 자동 추론 |
103
+ | `--worker-codex-model` | `--worker-model spark:high`에 포함 |
104
+ | `--worker-codex-reasoning` | `--worker-model spark:high`에 포함 |
105
+ | `--verifier-engine` | `--verifier-model` 포맷에서 자동 추론 |
106
+ | `--verifier-codex-model` | `--verifier-model`에 포함 |
107
+ | `--verifier-codex-reasoning` | `--verifier-model`에 포함 |
108
+ | `--verify-consensus` | `--consensus all` |
109
+ | `--final-consensus` | `--consensus final-only` |
110
+ | `--consensus-scope` | `--consensus`에 통합 |
111
+ | `--consensus-fail-fast` | 제거 (복잡도 대비 가치 낮음) |
112
+
113
+ 내부적으로 env var (`WORKER_ENGINE`, `WORKER_CODEX_MODEL` 등)는 유지 — `parse_model_flag()`가 `--worker-model`에서 분리하여 설정.
114
+
115
+ ---
116
+
117
+ ## Brainstorm 모델 추천 구조 (신규)
118
+
119
+ ### Claude-only (codex 미설치)
120
+
121
+ | 복잡도 | Worker | per-US Verifier | Final Verifier | Consensus |
122
+ |--------|--------|----------------|----------------|-----------|
123
+ | LOW | haiku | sonnet | opus | off |
124
+ | MEDIUM | sonnet | opus | opus | off |
125
+ | HIGH | opus | opus | opus | off |
126
+ | CRITICAL | opus | opus | opus + human | off |
127
+
128
+ ### Cross-engine (codex 설치, ★ 추천)
129
+
130
+ | 복잡도 | Worker | per-US Verifier | Final Verifier | Consensus |
131
+ |--------|--------|----------------|----------------|-----------|
132
+ | LOW | spark:high | sonnet | opus | final-only |
133
+ | MEDIUM | spark:high | opus | opus | final-only |
134
+ | HIGH | gpt-5.4:high | opus | opus | all |
135
+ | CRITICAL | gpt-5.4:high | opus | opus + human | all |
136
+
137
+ Worker 모델 선택 기준:
138
+ - **spark:high** — 기본 추천. Pro 토큰풀 분리 = 비용 절감. PRD AC ≤ 15개
139
+ - **gpt-5.4:high** — spark 100k output limit 초과 시 fallback. PRD AC > 15개
140
+
141
+ ### Brainstorm 추천 예시 (codex 있을 때)
142
+
143
+ ```
144
+ ★ 추천: cross-engine + final-consensus
145
+ /rlp-desk run <slug> --mode tmux --worker-model spark:high --consensus final-only --debug
146
+
147
+ 대규모 PRD (spark 100k 초과):
148
+ /rlp-desk run <slug> --mode tmux --worker-model gpt-5.4:high --consensus final-only --debug
149
+
150
+ 극도로 중요 (전체 consensus):
151
+ /rlp-desk run <slug> --mode tmux --worker-model gpt-5.4:high --consensus all --debug
152
+
153
+ claude-only:
154
+ /rlp-desk run <slug> --debug
155
+ ```
156
+
157
+ ---
158
+
159
+ ## Batch Capacity Check (신규)
160
+
161
+ brainstorm에서 batch 모드 + 대규모 PRD 감지 시 자동 경고:
162
+
163
+ | 조건 | 경고 | 제안 |
164
+ |------|------|------|
165
+ | batch + spark + AC > 10 | "spark 100k output limit 주의" | wave split 또는 gpt-5.4 전환 |
166
+ | batch + gpt-5.4 + AC > 15 | "단일 batch에 AC 과다" | wave split (US 3-4개씩 묶음) |
167
+ | per-us + 어떤 모델이든 | 경고 없음 | US별 처리라 limit 문제 없음 |
168
+
169
+ ---
170
+
171
+ ## 확정 사항
172
+
173
+ 1. **교차 verifier claude 기본값**: `opus` 확정 (주 verifier가 codex일 때)
174
+ 2. **gpt-5.3-codex 경로**: get_next_model()에서 **제거** 확정 (spark + gpt-5.4만 유지)
175
+ 3. **`--verifier-model` 기본값**: `sonnet` (per-US 가볍게, feedback_verification_philosophy.md)
176
+ 4. **`--consensus-model` 기본값**: `gpt-5.4:medium` (per-US 교차, 가볍게)
177
+ 5. **`--final-consensus-model` 기본값**: `gpt-5.4:high` (final 교차, 엄격하게)
178
+ 6. **교차 claude** (주 verifier가 codex일 때): `opus` 고정
179
+
180
+ ---
181
+
182
+ ## Brainstorm/Init 추천 흐름 (보강)
183
+
184
+ brainstorm 단계 7~8번을 아래로 교체:
185
+
186
+ ### brainstorm step 7: 모델 추천
187
+
188
+ 1. 복잡도 평가 (5-factor table, 현행 유지)
189
+ 2. codex 설치 여부 확인 (`command -v codex`)
190
+ 3. **4열 추천 테이블 제시** (Worker / per-US Verifier / Final Verifier / Consensus)
191
+ 4. spark vs gpt-5.4 판단: AC 총 개수 세어서
192
+ - AC ≤ 15 → spark:high 추천 ("Pro 토큰풀 분리, 비용 절감")
193
+ - AC > 15 → gpt-5.4:high 추천 ("spark 100k output limit 초과")
194
+ 5. verify-mode가 batch이면 batch capacity check 실행 (아래 참조)
195
+
196
+ ### brainstorm step 8 (init 후 명령어 제시): 추천 순서
197
+
198
+ codex 있을 때:
199
+ ```
200
+ ★ 추천: cross-engine + final-consensus (비용 절감 + blind-spot 커버)
201
+ /rlp-desk run <slug> --mode tmux --worker-model spark:high --consensus final-only --debug
202
+
203
+ 대규모 PRD (AC > 15, spark limit 초과):
204
+ /rlp-desk run <slug> --mode tmux --worker-model gpt-5.4:high --consensus final-only --debug
205
+
206
+ 극도로 중요 (매 US 교차검증):
207
+ /rlp-desk run <slug> --mode tmux --worker-model gpt-5.4:high --consensus all --debug
208
+
209
+ claude-only (교차검증 없음):
210
+ /rlp-desk run <slug> --debug
211
+ ```
212
+
213
+ codex 없을 때:
214
+ ```
215
+ ★ 추천:
216
+ /rlp-desk run <slug> --mode tmux --debug
217
+
218
+ ⚠️ codex 미설치 — 같은 엔진은 같은 blind spot을 공유합니다.
219
+ cross-engine 교차검증: npm install -g @openai/codex
220
+ ```
221
+
222
+ ### init 후 옵션 설명
223
+
224
+ init 완료 후 명령어 제시 시 아래 설명 포함:
225
+
226
+ ```
227
+ 옵션 설명:
228
+ --worker-model Worker 모델 (haiku|sonnet|opus 또는 spark:high|gpt-5.4:high)
229
+ --verifier-model per-US 검증 모델 (기본: sonnet, 가볍게)
230
+ --final-verifier-model final ALL 검증 모델 (기본: opus, 엄격하게)
231
+ --consensus 교차검증 (off|all|final-only)
232
+ --consensus-model per-US 교차 모델 (기본: gpt-5.4:medium)
233
+ --final-consensus-model final 교차 모델 (기본: gpt-5.4:high)
234
+ ```
235
+
236
+ ---
237
+
238
+ ## 변경 대상 파일
239
+
240
+ | 파일 | 변경 내용 |
241
+ |------|----------|
242
+ | `src/commands/rlp-desk.md` | 옵션 14개로 정리, brainstorm 추천 4열 테이블, batch capacity check, init 추천 예시 보강 |
243
+ | `src/governance.md` | consensus 섹션 정리, `--final-verifier-model` + `--final-consensus-model` 문서화, §7b 교차검증 테이블 |
244
+ | `src/scripts/run_ralph_desk.zsh` | `--consensus` 통합 플래그, `--final-verifier-model`, `--final-consensus-model` 파싱, deprecated 옵션 경고 |
245
+ | `src/scripts/lib_ralph_desk.zsh` | gpt-5.3-codex 경로 제거 (spark + gpt-5.4만 유지) |
246
+ | `README.md` | 옵션 레퍼런스 테이블 14개로 갱신, 추천 예시, per-US/final 구분 설명 |
247
+
248
+ ## 검증
249
+
250
+ 1. 기존 테스트 regression: `bash tests/test_cb_and_analytics.sh && bash tests/test_us004_progressive_upgrade.sh && bash tests/test_v052_improvements.sh`
251
+ 2. 신규 테스트: `tests/test_option_cleanup.sh` — 옵션 파싱, 기본값, deprecated 경고
252
+ 3. `zsh -n` syntax check
253
+ 4. Self-verification 3 scenarios (CLAUDE.md gate)
@@ -0,0 +1,245 @@
1
+ # CB 정합성 수정 + 분석 로그 항상 생성
2
+
3
+ ## Context
4
+
5
+ 1. CB_THRESHOLD=3에서 모델 업그레이드 경로(3~4단계) 작동 불가 — 설계 결함
6
+ 2. campaign.jsonl, metadata.json이 `--debug` 전용 — 기본 실행에서 분석 데이터 없음
7
+ 3. campaign.jsonl에 분석에 필요한 필드 부족 (consecutive_failures, model_upgraded 등)
8
+
9
+ ---
10
+
11
+ ## 변경 1: CB_THRESHOLD 기본값 3 → 6
12
+
13
+ **파일**: `src/scripts/run_ralph_desk.zsh:75`
14
+
15
+ ```diff
16
+ - CB_THRESHOLD="${CB_THRESHOLD:-3}"
17
+ + CB_THRESHOLD="${CB_THRESHOLD:-6}"
18
+ ```
19
+
20
+ **파일**: `src/governance.md` §8 — CB 기본값 6 반영
21
+
22
+ ---
23
+
24
+ ## 변경 2: campaign.jsonl, metadata.json 항상 생성 (debug 게이팅 제거)
25
+
26
+ ### 2a. analytics 디렉토리 항상 생성
27
+
28
+ **파일**: `src/scripts/run_ralph_desk.zsh` (~L1890)
29
+
30
+ ```diff
31
+ - # --- Analytics directory: create only when --debug or --with-self-verification ---
32
+ - if (( DEBUG )) || (( WITH_SELF_VERIFICATION )); then
33
+ - mkdir -p "$ANALYTICS_DIR" 2>/dev/null
34
+ - fi
35
+ + # --- Analytics directory: always create (campaign.jsonl + metadata.json are always-on) ---
36
+ + mkdir -p "$ANALYTICS_DIR" 2>/dev/null
37
+ ```
38
+
39
+ ### 2b. metadata.json 항상 작성
40
+
41
+ **파일**: `src/scripts/run_ralph_desk.zsh` (~L1915-1940)
42
+
43
+ ```diff
44
+ - # --- metadata.json: write at campaign start ---
45
+ - if (( DEBUG )) || (( WITH_SELF_VERIFICATION )); then
46
+ - jq -n \
47
+ - ...
48
+ - fi
49
+ + # --- metadata.json: always write at campaign start (cross-project identification) ---
50
+ + jq -n \
51
+ + ...
52
+ + --arg project_name "$(basename "$ROOT")" \
53
+ + ...
54
+ ```
55
+
56
+ metadata.json에 `project_name` 필드 추가 (basename of ROOT).
57
+
58
+ ### 2c. write_campaign_jsonl() debug 게이팅 제거
59
+
60
+ **파일**: `src/scripts/lib_ralph_desk.zsh:356`
61
+
62
+ ```diff
63
+ - write_campaign_jsonl() {
64
+ - if (( ! DEBUG )) && (( ! WITH_SELF_VERIFICATION )); then return 0; fi
65
+ + write_campaign_jsonl() {
66
+ ```
67
+
68
+ ### 2d. campaign.jsonl 레코드에 분석 필드 추가
69
+
70
+ **파일**: `src/scripts/lib_ralph_desk.zsh` write_campaign_jsonl()
71
+
72
+ 추가 필드:
73
+ - `consecutive_failures`: 현재 연속 실패 카운트
74
+ - `model_upgraded`: 이 iteration에서 모델 업그레이드 발생 여부 (0/1)
75
+ - `fix_contract`: 이전 iteration의 fix contract 존재 여부 (0/1)
76
+
77
+ ```diff
78
+ '{iter: $iter, us_id: $us_id, worker_model: $worker_model, ...}'
79
+ + 에 --argjson consecutive_failures "$CONSECUTIVE_FAILURES"
80
+ + --argjson model_upgraded "$_MODEL_UPGRADED"
81
+ ```
82
+
83
+ ### 2e. campaign.jsonl 버전 관리도 항상 적용
84
+
85
+ **파일**: `src/scripts/run_ralph_desk.zsh` (~L1904-1913)
86
+
87
+ ```diff
88
+ - # --- campaign.jsonl versioning (in analytics dir, after mkdir) ---
89
+ - if (( DEBUG )) || (( WITH_SELF_VERIFICATION )); then
90
+ - if [[ -f "$CAMPAIGN_JSONL" ]]; then
91
+ + # --- campaign.jsonl versioning (always-on) ---
92
+ + if [[ -f "$CAMPAIGN_JSONL" ]]; then
93
+ ```
94
+
95
+ debug.log 버전 관리는 `--debug` 게이팅 유지 (debug.log 자체가 debug 전용이므로).
96
+
97
+ ---
98
+
99
+ ## 변경 3: `--with-self-verification` SV report 경로 버그 수정
100
+
101
+ **현재 버그:** SV report 경로 불일치
102
+ - **쓰기** (`lib_ralph_desk.zsh:553-556`): `$LOGS_DIR/self-verification-report-NNN.md` (프로젝트 로컬)
103
+ - **읽기** (`lib_ralph_desk.zsh:434`): `$ANALYTICS_DIR/self-verification-report-*.md` (홈)
104
+ - 쓰는 곳과 읽는 곳이 다르므로 campaign-report.md에서 SV report 참조 실패
105
+
106
+ **수정:** 읽기 경로를 `$LOGS_DIR`로 통일 (프로젝트 로컬이 맞음 — iteration 아티팩트를 분석한 결과물)
107
+
108
+ **파일**: `src/scripts/lib_ralph_desk.zsh:434`
109
+
110
+ ```diff
111
+ - sv_report=$(ls -t "$ANALYTICS_DIR"/self-verification-report-*.md 2>/dev/null | head -1)
112
+ + sv_report=$(ls -t "$LOGS_DIR"/self-verification-report-*.md 2>/dev/null | head -1)
113
+ ```
114
+
115
+ **governance §6 문서에서도 정리:**
116
+ - `self-verification-report-NNN.md` → 프로젝트 로컬 `logs/<slug>/` 에 명시
117
+ - `self-verification-data.json` → 코드에서 생성 안 함 (governance §6에만 명시, agent-mode 전용). 문서에서 "(agent-mode only)" 주석 추가
118
+
119
+ ### `--with-self-verification` 파일 위치 정리
120
+
121
+ | 파일 | 위치 | 생성 조건 | 용도 |
122
+ |------|------|-----------|------|
123
+ | `self-verification-report-NNN.md` | 프로젝트 로컬 `logs/<slug>/` | `--with-self-verification` | claude CLI로 iteration 아티팩트 분석한 서술형 리포트 |
124
+ | `self-verification-data.json` | 홈 `analytics/<slug>--<hash>/` | agent-mode + `--with-self-verification` | 구조화된 SV 데이터 (tmux 모드에서는 생성 안 됨) |
125
+
126
+ ---
127
+
128
+ ## 변경하지 않는 것
129
+
130
+ | 항목 | 위치 | 이유 |
131
+ |------|------|------|
132
+ | `iter-NNN.*` 전체 | 프로젝트 로컬 | 프로젝트 코드/git과 직접 연결 |
133
+ | `campaign-report.md` | 프로젝트 로컬 | git diff stat 참조 |
134
+ | `cost-log.jsonl` | 프로젝트 로컬 | campaign-report가 참조 |
135
+ | `runtime/` | 프로젝트 로컬 | 실시간 운영 데이터 |
136
+ | `baseline.log` | 프로젝트 로컬 | 프로젝트 기준점 |
137
+ | `SV report` | 프로젝트 로컬 | iteration 아티팩트 분석 결과물 |
138
+ | `debug.log` | 홈, `--debug` 전용 | verbose, 필요할 때만 |
139
+
140
+ ---
141
+
142
+ ## 수정 대상 파일
143
+
144
+ | 파일 | 변경 |
145
+ |------|------|
146
+ | `src/scripts/run_ralph_desk.zsh` | CB default 6, analytics dir 항상 생성, metadata.json 항상 쓰기 + project_name, campaign.jsonl 버전 관리 항상 적용 |
147
+ | `src/scripts/lib_ralph_desk.zsh` | write_campaign_jsonl() debug 게이팅 제거 + 필드 추가, SV report 읽기 경로 수정 |
148
+ | `src/governance.md` | §8 CB 기본값 6, §6 파일 구조 + SV 위치 정리 |
149
+
150
+ ---
151
+
152
+ ## Verification (TDD)
153
+
154
+ 모든 변경은 **테스트 먼저 작성 → RED 확인 → 구현 → GREEN 확인** 순서로 진행.
155
+
156
+ 테스트 파일: `tests/test_cb_and_analytics.sh`
157
+
158
+ ### 테스트 목록 (RED → GREEN 순서대로)
159
+
160
+ **변경 1: CB_THRESHOLD**
161
+ ```bash
162
+ # T1: CB 기본값이 6인지 확인
163
+ test_cb_default_is_6() {
164
+ source src/scripts/run_ralph_desk.zsh --dry-run 2>/dev/null # 또는 grep
165
+ assert CB_THRESHOLD == 6
166
+ }
167
+
168
+ # T2: consensus 모드에서 effective CB가 12(6*2)인지 확인
169
+ test_cb_consensus_doubles_to_12() {
170
+ VERIFY_CONSENSUS=1 source ...
171
+ assert EFFECTIVE_CB_THRESHOLD == 12
172
+ }
173
+ ```
174
+
175
+ **변경 2: campaign.jsonl 항상 생성**
176
+ ```bash
177
+ # T3: --debug 없이 analytics 디렉토리 생성 확인
178
+ test_analytics_dir_created_without_debug() {
179
+ DEBUG=0 WITH_SELF_VERIFICATION=0
180
+ # run init section → assert mkdir -p "$ANALYTICS_DIR" called
181
+ assert -d "$ANALYTICS_DIR"
182
+ }
183
+
184
+ # T4: --debug 없이 metadata.json 생성 확인
185
+ test_metadata_written_without_debug() {
186
+ DEBUG=0 WITH_SELF_VERIFICATION=0
187
+ # run metadata write section
188
+ assert -f "$METADATA_FILE"
189
+ }
190
+
191
+ # T5: metadata.json에 project_name 필드 존재
192
+ test_metadata_has_project_name() {
193
+ assert jq -r '.project_name' "$METADATA_FILE" != "null"
194
+ }
195
+
196
+ # T6: write_campaign_jsonl()이 --debug 없이 쓰는지 확인
197
+ test_campaign_jsonl_written_without_debug() {
198
+ DEBUG=0 WITH_SELF_VERIFICATION=0
199
+ write_campaign_jsonl 1 "US-001" "pass"
200
+ assert -f "$CAMPAIGN_JSONL"
201
+ }
202
+
203
+ # T7: campaign.jsonl 레코드에 consecutive_failures 필드 존재
204
+ test_campaign_jsonl_has_consecutive_failures() {
205
+ CONSECUTIVE_FAILURES=2
206
+ write_campaign_jsonl 1 "US-001" "fail"
207
+ assert jq -r '.consecutive_failures' last_line == 2
208
+ }
209
+
210
+ # T8: campaign.jsonl 레코드에 model_upgraded 필드 존재
211
+ test_campaign_jsonl_has_model_upgraded() {
212
+ _MODEL_UPGRADED=1
213
+ write_campaign_jsonl 1 "US-001" "fail"
214
+ assert jq -r '.model_upgraded' last_line == 1
215
+ }
216
+
217
+ # T9: campaign.jsonl 재실행 시 버전 관리 (--debug 없이)
218
+ test_campaign_jsonl_versioned_without_debug() {
219
+ echo '{}' > "$CAMPAIGN_JSONL"
220
+ # run versioning section
221
+ assert -f "${CAMPAIGN_JSONL%.jsonl}-v1.jsonl"
222
+ }
223
+ ```
224
+
225
+ **변경 3: SV report 경로 수정**
226
+ ```bash
227
+ # T10: generate_campaign_report()가 $LOGS_DIR에서 SV report 찾는지 확인
228
+ test_sv_report_read_from_logs_dir() {
229
+ WITH_SELF_VERIFICATION=1
230
+ touch "$LOGS_DIR/self-verification-report-001.md"
231
+ # generate_campaign_report 호출
232
+ # campaign-report.md 안에 $LOGS_DIR 경로의 SV report 참조 확인
233
+ assert grep "self-verification-report" "$LOGS_DIR/campaign-report.md"
234
+ }
235
+ ```
236
+
237
+ ### 실행 순서
238
+
239
+ 1. 테스트 파일 작성 (`tests/test_cb_and_analytics.sh`)
240
+ 2. 전체 RED 확인 (모든 테스트 fail)
241
+ 3. 변경 1 구현 → T1, T2 GREEN
242
+ 4. 변경 2 구현 → T3~T9 GREEN
243
+ 5. 변경 3 구현 → T10 GREEN
244
+ 6. governance 문서 업데이트
245
+ 7. 기존 테스트 회귀 확인: `bash tests/test_us005_tmux_docs.sh`
@@ -1,4 +1,4 @@
1
- # Remaining Work Plan rlp-desk Post v0.5
1
+ # Hotfix: Revert keybinding changes from init_ralph_desk.zsh
2
2
 
3
3
  **Created**: 2026-03-30
4
4
  **Updated**: 2026-03-30 (Phase 1-4 구현 완료, 커밋 대기)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-dev-methodologies/rlp-desk",
3
- "version": "0.5.0",
3
+ "version": "0.5.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",