@ai-dev-methodologies/rlp-desk 0.15.4 → 0.15.6

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.
Files changed (30) hide show
  1. package/CHANGELOG.md +33 -1
  2. package/README.md +43 -40
  3. package/docs/rlp-desk/getting-started.md +6 -3
  4. package/package.json +9 -3
  5. package/src/node/MANIFEST.txt +3 -0
  6. package/src/node/cli/command-builder.mjs +5 -2
  7. package/src/node/prompts/prompt-assembler.mjs +2 -2
  8. package/src/node/run.mjs +70 -3
  9. package/src/node/runner/campaign-main-loop.mjs +13 -2
  10. package/src/scripts/run_ralph_desk.zsh +5 -3
  11. package/docs/rlp-desk/internal/verification-policy-gap-analysis.md +0 -523
  12. package/docs/rlp-desk/internal/verification-strategy-research.md +0 -2097
  13. package/docs/rlp-desk/plans/cozy-gliding-trinket.md +0 -53
  14. package/docs/rlp-desk/plans/frolicking-churning-honey.md +0 -253
  15. package/docs/rlp-desk/plans/keen-sauteeing-snowflake.md +0 -245
  16. package/docs/rlp-desk/plans/mutable-booping-corbato.md +0 -163
  17. package/docs/rlp-desk/plans/rlp-desk-0.11-handoff-7fixes.md +0 -352
  18. package/docs/rlp-desk/plans/rlp-desk-0.11.1-tmux-pane-disappearance.md +0 -260
  19. package/docs/rlp-desk/plans/rlp-desk-elegant-papert-agent-a8cd695ffca2a3ad8.md +0 -84
  20. package/docs/rlp-desk/plans/rlp-desk-elegant-papert.md +0 -270
  21. package/docs/rlp-desk/plans/rlp-desk-tmux-flywheel-routing.md +0 -730
  22. package/docs/rlp-desk/plans/toasty-whistling-diffie-agent-a6814625642e956da.md +0 -201
  23. package/docs/rlp-desk/plans/toasty-whistling-diffie.md +0 -117
  24. package/docs/rlp-desk/plans/validated-snacking-crayon.md +0 -204
  25. package/examples/calculator/.claude/ralph-desk/logs/loop-test/iter-001.worker-output.log +0 -0
  26. package/examples/calculator/.claude/ralph-desk/logs/loop-test/iter-001.worker-prompt.md +0 -38
  27. package/examples/calculator/.claude/ralph-desk/logs/loop-test/iter-001.worker-trigger.sh +0 -28
  28. package/examples/calculator/.claude/ralph-desk/logs/loop-test/session-config.json +0 -25
  29. package/examples/calculator/.claude/ralph-desk/logs/loop-test/status.json +0 -10
  30. package/examples/calculator/.claude/ralph-desk/logs/loop-test/worker-heartbeat.json +0 -1
@@ -1,53 +0,0 @@
1
- # Plan: 리팩토링 실행 검증 + v05-remaining 재시작
2
-
3
- ## Context
4
- Engine path refactoring Phase 0~7 완료 (38 TDD 구조적 테스트 pass).
5
- 하지만 **실제 tmux 실행 검증**을 안 했음. 리팩토링이 실제 캠페인에서 정상 동작하는지 확인 필요.
6
-
7
- ## 검증 순서
8
-
9
- ### Step 1: 좀비 runner + sentinel 정리
10
- ```bash
11
- ps aux | grep run_ralph_desk | grep -v grep | awk '{print $2}' | xargs kill 2>/dev/null
12
- for p in $(tmux list-panes -F '#{pane_id}' | grep -v '%360'); do tmux kill-pane -t "$p" 2>/dev/null; done
13
- rm -f .claude/ralph-desk/memos/v05-remaining-blocked.md
14
- rm -f .claude/ralph-desk/memos/v05-remaining-complete.md
15
- rm -f .claude/ralph-desk/memos/v05-remaining-done-claim.json
16
- rm -f .claude/ralph-desk/memos/v05-remaining-verify-verdict.json
17
- rm -f .claude/ralph-desk/memos/v05-remaining-iter-signal.json
18
- rm -f .claude/ralph-desk/logs/v05-remaining/session-config.json
19
- ```
20
-
21
- ### Step 2: v05-remaining 캠페인 실행 (spark worker)
22
- ```bash
23
- LOOP_NAME="v05-remaining" ROOT="$PWD" MAX_ITER=15 \
24
- WORKER_MODEL=gpt-5.3-codex-spark WORKER_ENGINE=codex \
25
- WORKER_CODEX_MODEL=gpt-5.3-codex-spark WORKER_CODEX_REASONING=medium \
26
- VERIFIER_MODEL=sonnet VERIFIER_ENGINE=claude \
27
- VERIFY_MODE=per-us VERIFY_CONSENSUS=0 CB_THRESHOLD=6 \
28
- ITER_TIMEOUT=600 DEBUG=1 WITH_SELF_VERIFICATION=1 \
29
- zsh ~/.claude/ralph-desk/run_ralph_desk.zsh
30
- ```
31
- (run_in_background=true)
32
-
33
- ### Step 3: 검증 체크리스트
34
- - [ ] Pane 3개 생성됨 (leader + worker + verifier)
35
- - [ ] Worker pane에서 codex exec 실행됨 (bash trigger, dead pane 오판 없음)
36
- - [ ] Worker 완료 후 heartbeat exited → signal auto-generate
37
- - [ ] Verifier(sonnet) 정상 시작 + verdict 작성
38
- - [ ] US-002 이상 진행 (이전 US-001은 이미 verified)
39
- - [ ] 좀비 runner 없음 (ps 확인)
40
-
41
- ### Step 4: 실패 시 대응
42
- - codex worker 시작 실패 → trigger script 내용 확인 + 수동 실행 테스트
43
- - verifier timeout → runner log tail + pane 상태 확인
44
- - BLOCKED → sentinel 원인 분석 + 수정 후 재시도
45
-
46
- ### Step 5: 성공 시
47
- - 캠페인 진행 모니터링 (status 확인)
48
- - 완료 대기 또는 다음 세션 handoff
49
-
50
- ## 파일
51
- - `src/scripts/run_ralph_desk.zsh` — 리팩토링된 runner
52
- - `~/.claude/ralph-desk/run_ralph_desk.zsh` — 로컬 동기화된 사본
53
- - `.claude/ralph-desk/logs/v05-remaining/` — 캠페인 아티팩트
@@ -1,253 +0,0 @@
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)
@@ -1,245 +0,0 @@
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`