@ai-dev-methodologies/rlp-desk 0.15.0 → 0.15.1

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.
@@ -0,0 +1,184 @@
1
+ # Native Agent() Revert Plan (P0+P1)
2
+
3
+ 6-round ralplan consensus 결과. Goal: slash command(`src/commands/rlp-desk.md`)가 진짜 leader가 되어 Claude Code Agent() 호출 + Bash codex exec로 worker/verifier를 spawn하는 v0.13.x 이전 방식으로 회귀. `--mode tmux`(zsh runner) 경로 미변경.
4
+
5
+ ## Scope
6
+
7
+ - **P0**: Bug #7 fix 단독 commit + 명시적 invariant ADR
8
+ - **P1**: slash command native prose 회복 + `--mode native` 도입 + Node CLI `--mode agent` deprecation banner
9
+ - **Out-of-scope**: P2 (Node CLI default flip, `--mode agent` hard-error), P3 (Node leader 삭제 ~4.5k LOC + repo-wide ghost-removal gate). 19th launch 종료 후 별도 PR.
10
+
11
+ ## Principles
12
+
13
+ 1. Naming truth: `--mode agent`라는 flag 하나가 두 곳에서 다른 의미를 가지는 상태 해소.
14
+ 2. Single leader per mode.
15
+ 3. Surgical revert: tmux 경로 + 19th launch 영향 0.
16
+ 4. Bug #7 fix preservation: zsh side에 invariant 보존됨을 ADR로 명시.
17
+ 5. Reversibility: silent reclaim 없음. `--mode agent` (Node CLI)는 호환 유지하면서 deprecation warning만.
18
+
19
+ ## P0 — Bug #7 fix commit + Invariant ADR
20
+
21
+ ### a. Bug #7 fix commit
22
+ - 현재 working tree (5 src + 4 untracked tests + 1 plan markdown) 단독 commit
23
+ - Local sync는 이미 완료(`~/.claude/ralph-desk/` chmod 0o444 + banner)
24
+
25
+ ### b. ADR `docs/adr/0001-bug7-invariant-zsh-only-by-structural-necessity.md`
26
+
27
+ 명시적 scope:
28
+ - Bug #7 invariant는 **slash-command Native Agent() / Bash codex exec path**에 한정해 **zsh runner side에 enforce**된다.
29
+ - Native Agent() path는 short-lived per-call subagent — long-lived TUI process가 없어 동일 race를 가지지 않는다.
30
+ - Node CLI `--mode agent`(Node leader, deprecated alpha)는 long-lived tmux pane을 사용 → 동일 race 보유. P3에서 삭제될 때까지 별도 reaper/lock 코드(`src/node/runner/campaign-main-loop.mjs:1091`, `:1577`, `src/node/tmux/pane-manager.mjs`, `src/node/shared/fs.mjs`) 유지.
31
+ - zsh side invariant 인용 (codex critic verified file:line):
32
+ - `src/scripts/lib_ralph_desk.zsh:248` — helpers (`_kill_pane_process`, `_lock_sentinel`, `_unlock_sentinel`)
33
+ - `src/scripts/run_ralph_desk.zsh:2179` — partial-write `jq -e .` validity gate
34
+ - `src/scripts/run_ralph_desk.zsh:2484` — verifier reap+lock (per-US main path)
35
+ - `src/scripts/run_ralph_desk.zsh:2551` — final-verify per-US reap+lock
36
+ - `src/scripts/run_ralph_desk.zsh:2969` — prep cleanup unlock
37
+ - `src/scripts/run_ralph_desk.zsh:3036` — worker reap+lock
38
+ - `src/scripts/run_ralph_desk.zsh:3247` — verifier reap+lock (consensus)
39
+
40
+ ### c. re-sync
41
+ - `node scripts/postinstall.js`
42
+ - banner-aware diff: src ⇆ `~/.claude/ralph-desk/`
43
+
44
+ ### Acceptance
45
+ - AC0.1 `git log -1`이 Bug #7 fix
46
+ - AC0.2 ADR file 존재 + 위 7 file:line 인용 + scope 명문
47
+ - AC0.3 `bash tests/test-bug7-post-sentinel-race.sh` + `bash tests/test-bug7-poll-partial-write.sh` 통과
48
+ - AC0.4 Node 315/315 통과
49
+ - AC0.5 banner-aware diff src ⇆ install 일치
50
+
51
+ ## P1 — Slash native prose + `--mode native` + Node CLI deprecation
52
+
53
+ ### a. `src/commands/rlp-desk.md` audit list (전체)
54
+
55
+ | Line | 현재 | 변경 후 |
56
+ |---|---|---|
57
+ | 192 | init이 emit하는 첫 "/rlp-desk run" Full options reference 블록의 `--mode agent\|tmux` | `--mode native\|tmux (default: native)` (recommended example는 `--mode tmux` 유지) |
58
+ | 227 | 두 번째 init emission | 동일 처리 |
59
+ | 255 | Options block: `- \`--mode agent\|tmux\` (default: \`agent\`)` | `- \`--mode native\|tmux\` (default: \`native\`)` (정확 라인 형태) |
60
+ | 287 | Mode Selection: "If absent or `agent`, use the Agent() path below" | 두 축 명문화: `--mode native` (default, slash native Agent() leader) / `--mode tmux` (zsh runner). Legacy `--mode agent` deprecation+redirect prose. Direct Node CLI `node run.mjs --mode agent`는 deprecated alpha — 별도 paragraph |
61
+ | 334 | tmux fallback "suggest `--mode agent`" | "suggest `--mode native`" |
62
+ | 342 | "SV/flywheel은 `--mode agent`에서 지원" | "SV/flywheel은 현재 Node-leader `--mode agent` (deprecated alpha, direct Node CLI)에서만 구현. Native Agent() path(`--mode native`)는 SV/flywheel 미구현 — post-P3 작업" |
63
+ | 343 | Tmux IMPORTANT RULES "always invokes node ..." | `--mode tmux` 한정으로 scope |
64
+ | 360-410 | "Why Agent mode is structurally immune" + "PLATFORM CONSTRAINT" 분산 | 단일 박스 `### Native Agent() Safety Contract`로 verbatim 흡수. 4 sentinel: turn-keepalive, no `subagent_type`, `mode="bypassPermissions"` mandatory, long-running→tmux |
65
+ | 448, 460 | claude/codex worker dispatch code | 변경 없음 (이미 native wired) |
66
+ | 778 | "agent=LLM leader, tmux=shell leader" help | "native=Native Agent() leader (slash), tmux=zsh leader (production). Legacy `agent` redirects to `native`. Direct Node CLI `--mode agent`는 deprecated alpha — Direct Node CLI invocation 섹션 참조" |
67
+ | 784 | run 예시 fallback에 `--mode agent` | `--mode native` |
68
+ | 802 | "Agent Mode (default: --mode agent)" 헤딩 | "Native Agent() Mode (default: --mode native)" |
69
+
70
+ ### b. `src/node/run.mjs`
71
+
72
+ - 신규 `--mode native` 핸들러:
73
+ - stderr: `ERROR: --mode native is slash-command-only. The Node CLI does not implement it. Use \`/rlp-desk run --mode native\` from a Claude Code session, or use \`--mode {tmux,agent}\` for direct CLI invocation.`
74
+ - exit 2
75
+ - `--mode agent` (Node CLI, line 366-374) deprecation banner 강화:
76
+ ```
77
+ WARNING: --mode agent (Node-leader alpha) is deprecated.
78
+ This is the direct Node-CLI alpha path — UNRELATED to the slash command's
79
+ Native Agent() path (`/rlp-desk run --mode native`).
80
+ For production tmux orchestration use `--mode tmux`.
81
+ For Claude Code Native Agent() campaigns use `/rlp-desk run --mode native`
82
+ from a Claude Code session.
83
+ This mode will hard-error in the next major release.
84
+ ```
85
+ - default 동작 unchanged (silent reclaim NO; backward compat)
86
+ - `--allow-deprecated` flag 도입 X (P3에서 삭제할 ghost flag 회피)
87
+ - wrapper가 silence 원하면 `2>/dev/null`
88
+
89
+ ### c. Tests
90
+
91
+ #### us008 신규 3 cases
92
+ 1. `node run.mjs run demo --mode native` → exit 2 + stderr ERROR 메시지
93
+ 2. `node run.mjs run demo --mode agent` → stderr deprecation banner + exit 0 (default 동작 유지)
94
+ 3. `node run.mjs run demo --mode tmux` 회귀 unchanged
95
+
96
+ #### SV grep/awk guards (`tests/sv-gate-bug7-mode-prose.sh` 신규 또는 sv-gate-fast.sh 병합)
97
+
98
+ ```bash
99
+ # 1. count-aware: --mode native 최소 5회 등장
100
+ [ "$(grep -c '\-\-mode native' src/commands/rlp-desk.md)" -ge 5 ] || { echo "FAIL: --mode native must appear ≥5 times"; exit 1; }
101
+
102
+ # 2. block-aware safety contract
103
+ WINDOW=$(awk '/^### Native Agent\(\) Safety Contract/,/^### /' src/commands/rlp-desk.md)
104
+ echo "$WINDOW" | grep -q 'Turn-keepalive: every status report uses' || { echo "FAIL: turn-keepalive sentinel"; exit 1; }
105
+ echo "$WINDOW" | grep -q 'no `subagent_type` parameter' || { echo "FAIL: no-subagent_type sentinel"; exit 1; }
106
+ echo "$WINDOW" | grep -q 'mode="bypassPermissions" mandatory' || { echo "FAIL: bypassPermissions sentinel"; exit 1; }
107
+ echo "$WINDOW" | grep -qi 'long-running.*tmux' || { echo "FAIL: long-running tmux recommendation"; exit 1; }
108
+
109
+ # 3. dispatch snippet preservation (AC1.5a static)
110
+ awk '/^If claude engine \(default\):/,/^If codex engine:/' src/commands/rlp-desk.md > /tmp/_disp_claude
111
+ grep -q 'Agent(' /tmp/_disp_claude || { echo "FAIL: claude dispatch missing Agent("; exit 1; }
112
+ grep -q 'mode="bypassPermissions"' /tmp/_disp_claude || { echo "FAIL: claude dispatch missing bypassPermissions"; exit 1; }
113
+ awk '/^If codex engine:/,/^\*\*⑥\*\*|^### /' src/commands/rlp-desk.md > /tmp/_disp_codex
114
+ grep -q 'Bash("codex exec' /tmp/_disp_codex || { echo "FAIL: codex dispatch missing Bash codex exec"; exit 1; }
115
+
116
+ # 4. Options block exact match
117
+ WINDOW=$(awk '/^Options \(parse from/,/^- `--worker-model/' src/commands/rlp-desk.md)
118
+ echo "$WINDOW" | grep -qE '^\- `--mode native\|tmux` \(default: `native`\)$' || { echo "FAIL: Options block --mode line not exact"; exit 1; }
119
+ echo "$WINDOW" | grep -qE '\-\-mode .*agent' && { echo "FAIL: stale 'agent' in Options block --mode line"; exit 1; }
120
+
121
+ # 5. Tmux IMPORTANT RULES contradiction removed
122
+ ! awk '/^\*\*IMPORTANT RULES:\*\*/,/^####/' src/commands/rlp-desk.md | grep -q "always invokes node" || { echo "FAIL: stale 'always invokes node'"; exit 1; }
123
+
124
+ # 6. Legacy redirect prose present
125
+ grep -q 'Legacy.*\-\-mode agent.*redirect' src/commands/rlp-desk.md || { echo "FAIL: deprecation prose missing"; exit 1; }
126
+ ```
127
+
128
+ #### AC1.5b: manual transcript artifact
129
+
130
+ `docs/verifications/p1-native-mode-transcript.md` (git-tracked):
131
+
132
+ 1. P1 land 후 Claude Code session에서 `/rlp-desk run sample --mode native` 1 iteration 실행
133
+ 2. 전체 transcript 캡처 — 다음 관측 포함:
134
+ - `Agent(model=…, mode="bypassPermissions", …)` worker dispatch 라인
135
+ - status report가 `Bash("echo '...'")` 로 wrap
136
+ - `subagent_type=` 미사용
137
+ 3. Reviewer가 `## Reviewer Sign-off` 섹션에 이름 + 날짜 기재
138
+ 4. CI guard: 파일 존재 + signoff 비-placeholder 검증 (`grep -E "^- Name: \S+"`, `grep -E "^- Date: [0-9]{4}-[0-9]{2}-[0-9]{2}"`)
139
+
140
+ ### d. Re-sync
141
+ - `node scripts/postinstall.js`
142
+ - banner-aware diff for `src/commands/rlp-desk.md` ⇆ `~/.claude/commands/rlp-desk.md`, `src/node/run.mjs` ⇆ `~/.claude/ralph-desk/node/run.mjs`
143
+
144
+ ### Acceptance
145
+ - AC1.1 6 grep/awk guards all return 0
146
+ - AC1.2 us008 신규 3 cases all green
147
+ - AC1.3 us008/us006 기존 회귀 0
148
+ - AC1.4 banner-aware diff src ⇆ install 일치
149
+ - AC1.5a 정적 dispatch grep (#3) 통과
150
+ - AC1.5b transcript artifact + signoff non-placeholder
151
+
152
+ ## Out-of-scope (deferred PR list)
153
+
154
+ - **P2**: `src/node/run.mjs:16` default `'agent'` → `'tmux'` flip + `--mode agent` (Node CLI) hard-error. 19th launch 종료 후, 외부 wrapper 영향 평가 후 별도 PR.
155
+ - **P3**: Node leader 삭제 (`src/node/runner/campaign-main-loop.mjs`, `src/node/tmux/`, `src/node/polling/` 등 ~4.5k LOC) + Bug-7 Node 통합 테스트 폐기 + repo-wide ghost-removal gate (`rg -n "Node leader\|node-leader\|--mode agent" src docs scripts tests` = 의도된 hits만). P2 후.
156
+ - **`--mode agent` reclaim to Native Agent()**: P3 이후 next major version에서만. 이번 PR에선 silent reclaim 없음.
157
+
158
+ ## Pre-mortem
159
+
160
+ 1. **`--mode agent` 호출자가 native와 alpha 의미를 헷갈린다** — slash command에서 호출 시 deprecation+redirect로 native path 진행. 외부 shell wrapper에서 `node run.mjs run X --mode agent` 호출 시 deprecation banner + 기존 Node leader path. 두 경로 모두 메시지로 명시.
161
+ 2. **Native Agent() turn-end가 사용자를 괴롭힌다** — Safety Contract 박스의 turn-keepalive 명문화로 mitigate. 그래도 100%는 아니므로 docs는 long-running = `--mode tmux` 강력 권고.
162
+ 3. **외부 wrapper가 `--mode agent` (Node CLI) 의존** — 동작 unchanged + deprecation banner만. P3에서야 hard-error. wrapper는 그동안 마이그레이션.
163
+
164
+ ## Verification end-to-end (P0+P1 land 후)
165
+
166
+ 1. `git log --oneline HEAD~3..HEAD` — Bug #7 + ADR + P1 commits
167
+ 2. `node --test 'tests/node/*.test.mjs' 'tests/node/*.mjs'` — 315+3 = 318 통과
168
+ 3. `bash tests/test-bug7-post-sentinel-race.sh` + `bash tests/test-bug7-poll-partial-write.sh` 통과
169
+ 4. `bash tests/sv-gate-bug7-mode-prose.sh` (또는 sv-gate-fast.sh) — 6 grep/awk guards 0
170
+ 5. banner-aware diff src ⇆ `~/.claude/`
171
+ 6. AC1.5b: 사용자가 Claude Code session에서 `/rlp-desk run sample --mode native` 실행 후 transcript 검토 + signoff
172
+
173
+ ## Round-by-round resolution table
174
+
175
+ | Round | Verdict | Findings closed |
176
+ |---|---|---|
177
+ | 1 (Architect) | shift to A-strict | option A → A-strict |
178
+ | 2 (Critic codex) | ITERATE 7 | entrypoint, default flip, ADR scope, naming, reclaim, AC, re-sync |
179
+ | 3 (Architect) | ITERATE 2 | synonym ghost, allow-deprecated ghost |
180
+ | 4 (Critic codex) | ITERATE 4 | init blocks (192/227), fallback (334/342), grep guards, ADR scope |
181
+ | 5 (Critic codex) | ITERATE 3 | label expansion (778/802), exact options match, AC1.5 runnable |
182
+ | 6 (Critic codex) | ITERATE 3 (1 actionable, 2 cross-check false-positives) | signoff non-placeholder check |
183
+
184
+ Net: 모든 v0-v5 actionable findings closed. Round 6 finding 3 (signoff non-placeholder)은 v7에 이미 반영됨 (AC1.5b CI guard 4번째 항목). Round 6 finding 1/2는 v6 base에 이미 포함된 사항 — critic의 cross-check 누락.
@@ -0,0 +1,125 @@
1
+ # rlp-desk 전략 재평가 — autoplan 입력
2
+
3
+ > **목표**: rlp-desk를 계속 발전시킬지(patch/redesign), 폐기 후 재구성할지(rebuild), 기존 도구로 pivot할지 결정.
4
+ > **핵심 KPI**: blueprint 처음 → 끝 자율 완료. 사람 개입 최소.
5
+ > **현재 상태**: 6주간 10개 bug, 매주 1-2개 신규 발견, manual recovery마저 broken (#10).
6
+
7
+ ---
8
+
9
+ ## 1. Vision (BOS dev 합의, 2026 초)
10
+
11
+ 1. ralph-loop를 **fresh-context**로 매번 시작 (컨텍스트 오염 없음)
12
+ 2. idea → plan distillation
13
+ 3. PRD 정형화
14
+ 4. Worker/Verifier 사이클로 반복 개선
15
+ 5. **완전 자율화** — 사람 개입 최소
16
+
17
+ → 5번이 단일 success criterion. 1-4는 5번을 달성하기 위한 메커니즘.
18
+
19
+ ---
20
+
21
+ ## 2. Reality — 6주간 측정된 사실
22
+
23
+ ### Bug 발생 패턴
24
+
25
+ | # | 일자 | 카테고리 | 회수 가능 | 다음 fix가 노출한 다음 bug |
26
+ |---|---|---|---|---|
27
+ | #1 | 2026-05-01 | LLM-runtime (`.claude/` self-modification gate) | partial — codex worker로 우회 | #2 (tmux session) |
28
+ | #2 | 2026-05-01 | tmux session lifecycle | yes | #3 |
29
+ | #3 | 2026-05-04 | verifier no-progress | yes | #4 (regression of #3) |
30
+ | #4 | 2026-05-05 | #3 regression | partial | #5 |
31
+ | #5 | 2026-05-05 | worker dead on reuse (pane lifecycle) | yes | #6 |
32
+ | #6 | 2026-05-06 | claude worker idle false-positive | yes | #7 |
33
+ | #7 | 2026-05-06 | post-sentinel process race (1m43s drift) | yes | #8 + #10 |
34
+ | #8 | 2026-05-06 | worker incomplete + leader A4 fallback | partial | #10 |
35
+ | #9 | (별도) | verified_us 영속성 (status.json) | yes | — |
36
+ | #10 | 2026-05-07 | leader ignores phase=verify on relaunch — **회수마저 깨짐** | NO (이게 회수 메커니즘) | ? |
37
+
38
+ **Pattern observed:**
39
+ - 매주 1-2개 신규 bug
40
+ - 절반은 **이전 fix가 노출**한 새 failure mode (regression style)
41
+ - Bug #10이 가장 심각 — 회수 메커니즘 자체가 broken → BLOCKED 시 operator의 manual recovery가 무효화
42
+
43
+ ### Bug 카테고리 분류
44
+
45
+ | 카테고리 | Bug | 비중 | architectural 필연성? |
46
+ |---|---|---|---|
47
+ | (a) tmux/process lifecycle race | #2, #5, #6, #7 | 40% | **YES** — tmux pane lifecycle은 claude/codex TUI lifecycle과 분리됨. race window가 본질적 |
48
+ | (b) artifact contract / schema | #3, #4, #8, #9 | 40% | partial — schema가 더 strict하면 줄어들지만 LLM이 schema 어기는 빈도가 본질적 |
49
+ | (c) LLM-runtime constraint | #1 | 10% | **YES** — Claude Code의 `.claude/` self-modification gate는 외부 변수 |
50
+ | (d) recovery hygiene | #10 | 10% | accidental — fix 가능 |
51
+
52
+ → **80%가 architectural inevitability** (a + c). schema strict + retry는 (b)를 줄이지만 LLM 비결정성이 한계.
53
+
54
+ ### SV gate 한계
55
+
56
+ - 모든 sv-self-verify-*.sh가 **Worker/Verifier metaphor만 사용** → 실제 LLM agent run 없음
57
+ - grep + unit test + regression의 5-category labeling
58
+ - → 10개 bug가 SV gate 통과 후 production에서 발견됐다는 사실 = **framework이 production failure mode를 cover 못 함**
59
+ - Production failure mode는 **LLM/tmux/network/timing 비결정성** — unit test로 잡을 수 없는 영역
60
+
61
+ ### In-flight 미완 branch
62
+
63
+ - `feat/native-agent-revert`: P0(Bug #7 fix) + P1(slash native prose 회복) — 미완. Plan: 5 round ralplan 합의됨, codex critic APPROVED
64
+ - `feat/bug10-relaunch-hygiene`: PR-A commit 95c0d4e + SV gate 추가 — 방금 완료, push 안 됨
65
+
66
+ → 두 branch 모두 land 안 됨 = 새 bug 발견 시 기존 fix가 무력화될 위험
67
+
68
+ ---
69
+
70
+ ## 3. 4가지 옵션
71
+
72
+ ### Option A — Continue patching (현재 path)
73
+ PR-A (Bug #10) → PR-B (bundler) → PR-C (patterns) → 다음 bug → 반복.
74
+
75
+ ### Option B — Fundamental redesign (vision 유지, architecture 재설계)
76
+ **핵심 변경**: tmux pane orchestration 폐기 → Claude Code Native Agent() / subprocess 직접 dispatch. Sentinel file → in-memory channel. 두 변경으로 (a) 카테고리 80%가 제거.
77
+
78
+ ### Option C — Scrap and rebuild (vision 일부 수정)
79
+ 6주 코드 폐기. Vision 5번 (완전 자율화)은 유지하되 1번(fresh-context)은 task-isolated subprocess로 재정의. ralph-loop 자체 폐기 가능 — 그냥 plan→worker→verify 사이클로 단순화.
80
+
81
+ ### Option D — Pivot to existing tool
82
+ - ralph plugin (cradle): 가벼움, 기능 부족
83
+ - omc (oh-my-claudecode): /ralph + /ralplan + /omc-teams + /autopilot — 이미 multi-model orchestration 있음
84
+ - superpowers: subagent-driven-development, executing-plans, brainstorming — plan→exec 사이클은 이미 있음
85
+ - claude-devfleet: dmux 기반, multi-agent
86
+
87
+ ---
88
+
89
+ ## 4. 평가 항목 (각 옵션마다)
90
+
91
+ | 항목 | 정의 | 이유 |
92
+ |---|---|---|
93
+ | Vision 보존도 | 5개 vision 중 살아남는 개수 | "완전 자율화" 달성 가능성 |
94
+ | Time-to-first-successful-blueprint | 처음으로 blueprint를 끝까지 자율 완료하는 데 걸리는 시간 | **단일 핵심 KPI** |
95
+ | Sunk cost write-off % | 폐기되는 코드/SV 비율 | 결정의 reversibility |
96
+ | Bug regression 위험 | 새 시스템에서 #1-#10 같은 bug가 다시 나올 확률 | "다음 6주에 또 10개?" |
97
+ | Personal capacity ROI | 1주 투자 시 deliverable | sustainability |
98
+
99
+ ---
100
+
101
+ ## 5. In-flight branch 처리 결정
102
+
103
+ 이 평가가 끝난 후 결정:
104
+ - `feat/native-agent-revert`: land / abandon / re-scope?
105
+ - `feat/bug10-relaunch-hygiene`: 이미 commit 95c0d4e, push할까 hold할까?
106
+
107
+ 선택 옵션이 무엇이든 두 branch는 처리 필요.
108
+
109
+ ---
110
+
111
+ ## 6. 제약
112
+
113
+ - BOS dev가 실제 캠페인을 돌려야 함 → short-term (1-2주) patching 불가피
114
+ - rlp-desk는 npm published — breaking change는 user-facing (semver 고려)
115
+ - 분석은 advisory only — 실제 코드 수정/commit/push는 사용자 승인 별도
116
+
117
+ ---
118
+
119
+ ## 7. autoplan에 요구 — 이 문서를 입력으로
120
+
121
+ CEO 관점: rlp-desk가 푸는 문제가 옳은가? 다른 도구로 같은 가치를 이미 얻을 수 있나?
122
+ Eng 관점: 6주간의 architectural pattern을 보면 (a) 80% 카테고리가 patching으로 해결될까? 아니면 redesign이 필연인가?
123
+ DX 관점: rlp-desk는 dev tool — operator(BOS dev)가 매번 30분씩 hand-write recovery를 해야 한다는 사실이 DX failure인가?
124
+
125
+ 각 phase에서 dual voices (Codex + Claude subagent) 실행, consensus table 생성, 4 options steelman.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-dev-methodologies/rlp-desk",
3
- "version": "0.15.0",
3
+ "version": "0.15.1",
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",
@@ -189,7 +189,7 @@ Tell the user:
189
189
  /rlp-desk run <actual-slug> --debug
190
190
 
191
191
  # Full options reference:
192
- # --mode agent|tmux (default: agent)
192
+ # --mode native|tmux (default: native; legacy `agent` redirects to native)
193
193
  # --worker-model MODEL haiku|sonnet|opus or gpt-5.5:high|spark:high (default: haiku)
194
194
  # --lock-worker-model disable auto model upgrade
195
195
  # --verifier-model MODEL per-US verifier (default: sonnet)
@@ -217,14 +217,14 @@ Tell the user:
217
217
  # ★ Recommended: tmux mode + claude-only (real-time visibility):
218
218
  /rlp-desk run <actual-slug> --mode tmux --debug
219
219
 
220
- # Agent mode:
221
- /rlp-desk run <actual-slug> --debug
220
+ # Native Agent() mode (slash leader, short / interactive campaigns):
221
+ /rlp-desk run <actual-slug> --mode native --debug
222
222
 
223
223
  # Install codex for cost savings + cross-engine blind-spot coverage:
224
224
  npm install -g @openai/codex
225
225
 
226
226
  # Full options reference:
227
- # --mode agent|tmux (default: agent)
227
+ # --mode native|tmux (default: native; legacy `agent` redirects to native)
228
228
  # --worker-model MODEL haiku|sonnet|opus (default: haiku)
229
229
  # --lock-worker-model disable auto model upgrade
230
230
  # --verifier-model MODEL per-US verifier (default: sonnet)
@@ -252,7 +252,7 @@ Tell the user:
252
252
  **YOU are the leader. Do NOT delegate leadership.**
253
253
 
254
254
  Options (parse from `$ARGUMENTS`):
255
- - `--mode agent|tmux` (default: `agent`) — execution mode
255
+ - `--mode native|tmux` (default: `native`) — execution mode. `native` = slash command is the leader, calls `Agent(...)` (claude) and `Bash("codex exec ...")` (codex). `tmux` = slash command spawns the zsh runner via `node run.mjs --mode tmux`. Legacy `--mode agent` typed against the slash command emits a deprecation notice and redirects to `--mode native` (NOT to be confused with `node run.mjs --mode agent`, which is the deprecated Node-leader alpha — see "Direct Node CLI invocation" below).
256
256
  - `--worker-model MODEL` (default: `haiku`) — Worker model. Format: `model` = claude engine, `model:reasoning` = codex engine. Examples: `haiku`, `sonnet`, `opus`, `spark:high`, `gpt-5.5:high`. Parsed by `parse_model_flag()` which auto-splits engine/model/reasoning.
257
257
  - `--lock-worker-model` — disable automatic model upgrade on failure. Worker stays on the specified model regardless of consecutive failures.
258
258
  - `--verifier-model MODEL` (default: `sonnet`) — per-US verification model. Campaign-fixed (no progressive upgrade). Lighter than final verifier.
@@ -284,20 +284,26 @@ Cross-project aggregation: scan `~/.claude/ralph-desk/analytics/` and read each
284
284
 
285
285
  ### Mode Selection
286
286
 
287
- Parse the `--mode` flag. If absent or `agent`, use the Agent() path below. If `tmux`, use the Tmux path.
287
+ Parse the `--mode` flag. Slash command canonical labels:
288
+
289
+ - `--mode native` (default): **Native Agent() path** below. The slash command IS the leader. It calls `Agent(description=…, model=<m>, mode="bypassPermissions", prompt=…)` for claude workers/verifiers and `Bash("codex exec --model <m> --reasoning-effort <r> <prompt>")` for codex workers/verifiers.
290
+ - `--mode tmux`: **zsh runner path** below. The slash command shells out to `node ~/.claude/ralph-desk/node/run.mjs run --mode tmux …` which spawns `run_ralph_desk.zsh` as a subprocess.
288
291
 
289
- > **v0.14.0 stability tiers:**
290
- > - `--mode tmux` is the **stable, production** path. The Node leader (`run.mjs`)
291
- > now routes tmux invocations to `~/.claude/ralph-desk/run_ralph_desk.zsh`
292
- > as a subprocess that runner has the full safety net (heartbeat,
293
- > copy-mode guard, prompt-stall, no-progress detection, claude model
294
- > upgrade chain). Recommend this for autonomous campaigns.
295
- > - `--mode agent` is **alpha** (Node-native LLM-driven Leader). The runner
296
- > emits a stderr warning when this mode is invoked.
292
+ Legacy `--mode agent` typed against this slash command emits a deprecation notice and redirects to `--mode native`. **Do NOT confuse `/rlp-desk run --mode agent`** (slash command, redirects to Native Agent()) **with** `node run.mjs run --mode agent` (deprecated Node-leader alpha, direct CLI invocation, unrelated code path — see "Direct Node CLI invocation" below).
293
+
294
+ > **Stability tiers:**
295
+ > - `--mode tmux` is the **stable, production** path. The slash command spawns
296
+ > the Node leader, which spawns `run_ralph_desk.zsh` — the zsh runner has the
297
+ > full safety net (heartbeat, copy-mode guard, prompt-stall, no-progress
298
+ > detection, claude model upgrade chain). Recommend this for autonomous
299
+ > campaigns.
300
+ > - `--mode native` is **for short / interactive campaigns**. Native Agent()
301
+ > has no timeout API (platform constraint). Long-running autonomous campaigns
302
+ > SHOULD use `--mode tmux`.
297
303
 
298
304
  #### Tmux Mode (`--mode tmux`)
299
305
 
300
- When `--mode tmux` is specified (v0.14.0+: `run.mjs` accepts the same flags as before but spawns `run_ralph_desk.zsh` as a subprocess and inherits stdio. Flywheel and self-verification flags are not honored under tmux mode — they require `--mode agent`):
306
+ When `--mode tmux` is specified (v0.14.0+: `run.mjs` accepts the same flags as before but spawns `run_ralph_desk.zsh` as a subprocess and inherits stdio. Flywheel and self-verification flags are not honored under tmux mode — they currently require the deprecated Node-leader direct-CLI path `node run.mjs --mode agent` (see "Direct Node CLI invocation" below). Native Agent() port is a post-Node-leader-retirement task):
301
307
 
302
308
  1. **Validate scaffold** — same as Agent() mode: check `.rlp-desk/prompts/<slug>.worker.prompt.md` etc.
303
309
  2. **Check sentinels** — same as Agent() mode.
@@ -331,7 +337,7 @@ node ~/.claude/ralph-desk/node/run.mjs run '<slug>' \
331
337
 
332
338
  **Env-var translation (v5.7 §4.1)**: the slash command historically built `LANE_MODE=strict zsh ...` and `TEST_DENSITY_MODE=strict zsh ...` from CLI flags. The Node leader uses CLI flags instead — translate `--lane-strict` and `--test-density-strict` into the corresponding flags. Direct env-var users (running zsh directly) are unaffected.
333
339
 
334
- 6. **If the Node leader exits with error** — report the error to the user and STOP. Do NOT attempt to work around it. Do NOT create tmux sessions yourself. Do NOT re-launch in a different way. Tell the user what went wrong and suggest `--mode agent` as alternative.
340
+ 6. **If the Node leader exits with error** — report the error to the user and STOP. Do NOT attempt to work around it. Do NOT create tmux sessions yourself. Do NOT re-launch in a different way. Tell the user what went wrong and suggest `--mode native` (slash command Native Agent() path) as alternative.
335
341
  7. **If successful** — tell the user the tmux session has been started. The Node leader takes over as the deterministic Leader. No Agent() calls are made in tmux mode.
336
342
 
337
343
  **IMPORTANT RULES:**
@@ -339,35 +345,36 @@ node ~/.claude/ralph-desk/node/run.mjs run '<slug>' \
339
345
  - MUST launch with `run_in_background: true` so `/rlp-desk` returns control immediately while preserving live tmux visibility.
340
346
  - Run-in-background is used so the shell can keep the command visible and keep the pane layout stable for status checks and completion flow.
341
347
  - Do NOT kill panes after completion. Panes stay alive for inspection. User cleans up with `/rlp-desk clean <slug> --kill-session`.
342
- - v0.14.0: `--with-self-verification`, `--flywheel`, and `--flywheel-guard` are **not honored** under `--mode tmux` — the zsh runner has no SV/flywheel implementation. The Node leader emits a stderr WARNING listing the dropped flags. For SV/flywheel, use `--mode agent` (alpha).
343
- - The slash command always invokes `node ~/.claude/ralph-desk/node/run.mjs run --mode tmux ...`. Do NOT invoke `~/.claude/ralph-desk/run_ralph_desk.zsh` directly — the Node router resolves the runner path, runs legacy detection, and surfaces actionable errors when the runner is missing.
348
+ - v0.14.0: `--with-self-verification`, `--flywheel`, and `--flywheel-guard` are **not honored** under `--mode tmux` — the zsh runner has no SV/flywheel implementation. The Node leader emits a stderr WARNING listing the dropped flags. For SV/flywheel today, use the deprecated Node-leader direct-CLI path `node run.mjs --mode agent` (see "Direct Node CLI invocation" below). The slash command's Native Agent() (`--mode native`) does not yet implement SV/flywheel — port is a post-Node-leader-retirement task.
349
+ - **For `--mode tmux` only**: the slash command invokes `node ~/.claude/ralph-desk/node/run.mjs run --mode tmux ...`. Do NOT invoke `~/.claude/ralph-desk/run_ralph_desk.zsh` directly — the Node router resolves the runner path, runs legacy detection, and surfaces actionable errors when the runner is missing. **For `--mode native`**, the slash command does NOT invoke the Node CLI — it acts as the leader itself; see Native Agent() Mode section below.
344
350
 
345
351
  **tmux UX model (5 items):**
346
352
  - The session returns immediately after launch (`run_in_background: true`) so the command returns control to the parent CLI.
347
353
  - Worker/Verifier panes remain visible to the user during execution.
348
354
  - Users check progress with the **status command**: `/rlp-desk status <slug>`.
349
355
  - On completion, the command returns a completion notification before the loop ends.
350
- - Agent mode remains unchanged, and no tmux-specific behavior is mixed into Agent mode.
351
-
352
- #### Agent Mode (`--mode agent` or default — **alpha**)
353
-
354
- > **v0.14.0:** Agent mode is the alpha LLM-driven path. The Node port shipped
355
- > without zsh-equivalent safety nets (heartbeat, copy-mode guard, prompt-stall
356
- > timeout, no-progress detection, claude model upgrade chain). The runner
357
- > emits a stderr WARNING when agent mode is invoked. For production
358
- > autonomous campaigns, prefer `--mode tmux`.
359
-
360
- **Why Agent mode is structurally immune to Bug 4/5 (mid-execution prompt hang
361
- & A4 premature dispatch):** Worker/Verifier are dispatched as `Agent(...,
362
- mode="bypassPermissions", ...)`. The subagent runs non-interactively under
363
- the platform's bypass it has no tmux pane, no TUI surface, and cannot
364
- surface a `[y/N]` prompt to the parent Leader. The auto-dismiss /
365
- prompt-stall / no-progress timeouts in `run_ralph_desk.zsh` (v5.7 §4.13.b /
366
- §4.16 / §4.17) are therefore tmux-only by design. **Tradeoff**: because
367
- `Agent()` has no timeout API, agent-mode iterations are not bounded — if
368
- the platform's `bypassPermissions` ever fails to suppress an interactive
369
- prompt at the SDK level, the call hangs indefinitely with no rlp-desk-side
370
- watchdog. Use `--mode tmux` if you need bounded execution time.
356
+ - Native Agent() mode remains unchanged, and no tmux-specific behavior is mixed into it.
357
+
358
+ #### Native Agent() Mode (`--mode native` or default)
359
+
360
+ The slash command IS the leader. Workers/Verifiers are spawned via `Agent(model=…, mode="bypassPermissions", prompt=…)` (claude) or `Bash("codex exec --model <m> --reasoning-effort <r> <prompt>")` (codex).
361
+
362
+ ### Native Agent() Safety Contract
363
+
364
+ This contract MUST be observed in every iteration of the leader loop below. Future PRs deleting any of these guarantees break the slash command's behavior.
365
+
366
+ 1. **Turn-keepalive**: every status report uses `Bash("echo '...'")` to emit messages. NEVER output plain text without an accompanying tool call. Plain text = turn ends = loop stops. (Mitigation for commit `29fd29b` platform constraint, permanent.)
367
+ 2. **no `subagent_type` parameter**: the `Agent(...)` call form is exactly `Agent(description=…, model=<m>, mode="bypassPermissions", prompt=…)`. Do NOT pass `subagent_type`. (Mitigation for commit `920a31c`: `subagent_type="executor"` overrode `bypassPermissions` and surfaced a permission popup; permanent.)
368
+ 3. **`mode="bypassPermissions"` mandatory**: every claude `Agent()` worker/verifier dispatch must include `mode="bypassPermissions"`.
369
+ 4. **Long-running campaigns: prefer `--mode tmux`** for production. Native Agent() has no timeout API (platform constraint) — if `bypassPermissions` fails to suppress an interactive prompt at the SDK level, the call hangs indefinitely with no rlp-desk-side watchdog.
370
+
371
+ **Why Native Agent() is structurally immune to Bug 4/5 (mid-execution prompt hang & A4 premature dispatch)**: Worker/Verifier run non-interactively under the platform's bypass — they have no tmux pane, no TUI surface, and cannot surface a `[y/N]` prompt to the parent Leader. The auto-dismiss / prompt-stall / no-progress timeouts in `run_ralph_desk.zsh` (v5.7 §4.13.b / §4.16 / §4.17) are therefore tmux-only by design.
372
+
373
+ **Tradeoff**: because `Agent()` has no timeout API, Native Agent() iterations are not bounded — if the platform's `bypassPermissions` ever fails to suppress an interactive prompt at the SDK level, the call hangs indefinitely with no rlp-desk-side watchdog. Use `--mode tmux` if you need bounded execution time.
374
+
375
+ #### Direct Node CLI invocation (`node run.mjs run <slug> --mode agent` — deprecated alpha)
376
+
377
+ Direct invocation of `node ~/.claude/ralph-desk/node/run.mjs run <slug> --mode agent` is **the deprecated Node-leader alpha path**. This is unrelated to the slash command's Native Agent() path above — different code, different leader, different lifecycle. The Node leader currently retains SV/flywheel implementations not yet ported to Native Agent(). The Node CLI emits a deprecation banner on this mode and is scheduled for hard-error in the next major release. For production tmux orchestration, use `--mode tmux`. For Claude Code Native Agent() campaigns, use `/rlp-desk run <slug> --mode native` from a Claude Code session.
371
378
 
372
379
  ### Preparation
373
380
  1. Validate scaffold: `.rlp-desk/prompts/<slug>.worker.prompt.md` etc.
@@ -775,13 +782,13 @@ Example:
775
782
  ```
776
783
  /rlp-desk brainstorm <description> Plan before init (interactive)
777
784
  /rlp-desk init <slug> [objective] Create project scaffold
778
- /rlp-desk run <slug> [options] Run loop (agent=LLM leader, tmux=shell leader)
785
+ /rlp-desk run <slug> [options] Run loop (native=Native Agent() leader (slash), tmux=zsh leader (production); legacy `agent` redirects to `native` — direct Node CLI `--mode agent` is deprecated alpha)
779
786
  /rlp-desk status <slug> Show loop status
780
787
  /rlp-desk logs <slug> [N] Show iteration log
781
788
  /rlp-desk clean <slug> [--kill-session] Reset for re-run (--kill-session kills tmux)
782
789
 
783
790
  Run options:
784
- --mode agent|tmux Execution mode (default: agent)
791
+ --mode native|tmux Execution mode (default: native)
785
792
  --worker-model MODEL Worker model: haiku|sonnet|opus or gpt-5.5:high|spark:high (default: haiku)
786
793
  --lock-worker-model Disable auto model upgrade on failure
787
794
  --verifier-model MODEL per-US verifier (default: sonnet)
@@ -799,15 +806,18 @@ Run options:
799
806
 
800
807
  ## Architecture
801
808
 
802
- ### Agent Mode (default: `--mode agent`)
809
+ ### Native Agent() Mode (default: `--mode native`)
803
810
  ```
804
- [This session = LEADER (LLM)]
811
+ [This session = LEADER (LLM, slash command itself)]
805
812
 
806
- Agent()├──▶ [Worker: executor (fresh context)]
813
+ Agent()├──▶ [Worker: claude subagent (fresh context, mode="bypassPermissions")]
807
814
  │ └── reads desk files, implements, updates memory
808
815
 
809
- Agent()└──▶ [Verifier: executor (fresh context)]
810
- └── reads done-claim, runs checks, writes verdict
816
+ Agent()└──▶ [Verifier: claude subagent (fresh context, mode="bypassPermissions")]
817
+ └── reads done-claim, runs checks, writes verdict
818
+
819
+ Bash() ───▶ [Worker/Verifier: codex CLI subprocess]
820
+ └── `codex exec --model <m> --reasoning-effort <r> <prompt>`
811
821
  ```
812
822
 
813
823
  ### Tmux Mode (`--mode tmux`)
package/src/node/run.mjs CHANGED
@@ -48,14 +48,14 @@ function buildHelpText() {
48
48
  'Commands:',
49
49
  ' brainstorm <description> Plan before init (not implemented in the Node rewrite yet)',
50
50
  ' init <slug> [objective] Create project scaffold',
51
- ' run <slug> [options] Run loop (agent=LLM leader, tmux=shell leader)',
51
+ ' run <slug> [options] Run loop (tmux=zsh leader [production], agent=Node leader [deprecated alpha], native=slash-only error)',
52
52
  ' status <slug> Show loop status',
53
53
  ' logs <slug> [N] Show iteration log (not implemented in the Node rewrite yet)',
54
54
  ' clean <slug> [--kill-session] Reset for re-run (not implemented in the Node rewrite yet)',
55
55
  ' resume <slug> Resume loop (not implemented in the Node rewrite yet)',
56
56
  '',
57
57
  'Run Options:',
58
- ' --mode agent|tmux',
58
+ ' --mode tmux|agent|native (CLI: tmux=production, agent=deprecated, native=errors with redirect to slash command)',
59
59
  ' --worker-model MODEL',
60
60
  ' --lock-worker-model',
61
61
  ' --verifier-model MODEL',
@@ -358,10 +358,32 @@ async function runRunCommand(args, deps) {
358
358
  return runTmuxViaZsh(slug, options, deps);
359
359
  }
360
360
 
361
- // v0.14.0: agent mode is the alpha LLM-driven path. The Node port shipped
362
- // without zsh-equivalent safety nets (heartbeat, copy-mode guard,
363
- // prompt-stall timeout, no-progress detection, claude model upgrade chain).
364
- // Surface that explicitly so production users pick --mode tmux instead.
361
+ // P1.b (native-agent-revert plan v7): --mode native is slash-command-only.
362
+ // The Node CLI does not implement Native Agent() that path lives in
363
+ // src/commands/rlp-desk.md and runs in a Claude Code session. Surface a
364
+ // hard error here so direct CLI invocation does not silently fall through
365
+ // to the deprecated Node-leader path.
366
+ if (options.mode === 'native') {
367
+ write(
368
+ deps.stderr,
369
+ 'ERROR: --mode native is slash-command-only. The Node CLI does not implement it.',
370
+ );
371
+ write(
372
+ deps.stderr,
373
+ 'Use `/rlp-desk run <slug> --mode native` from a Claude Code session,',
374
+ );
375
+ write(
376
+ deps.stderr,
377
+ 'or use `--mode tmux` (production) / `--mode agent` (deprecated alpha) for direct CLI invocation.',
378
+ );
379
+ return 2;
380
+ }
381
+
382
+ // P1.b: --mode agent (Node-leader alpha) is deprecated. The slash command's
383
+ // Native Agent() path (`/rlp-desk run --mode native`) is unrelated — different
384
+ // code, different leader. We keep the Node-leader behavior unchanged for
385
+ // backward compatibility but surface a strong deprecation banner so wrappers
386
+ // can migrate before the next major release hard-errors this mode.
365
387
  if (
366
388
  options.mode === 'agent'
367
389
  && !process.env.RLP_DESK_QUIET_WARNINGS
@@ -369,7 +391,23 @@ async function runRunCommand(args, deps) {
369
391
  ) {
370
392
  write(
371
393
  deps.stderr,
372
- 'WARNING: --mode agent is alpha. For production tmux orchestration, prefer --mode tmux (zsh-backed, stable).',
394
+ 'WARNING: --mode agent (Node-leader alpha) is deprecated.',
395
+ );
396
+ write(
397
+ deps.stderr,
398
+ 'This is the direct Node-CLI alpha path — UNRELATED to the slash command Native Agent() path (`/rlp-desk run --mode native`).',
399
+ );
400
+ write(
401
+ deps.stderr,
402
+ 'For production tmux orchestration, use `--mode tmux`.',
403
+ );
404
+ write(
405
+ deps.stderr,
406
+ 'For Claude Code Native Agent() campaigns, use `/rlp-desk run --mode native` from a Claude Code session.',
407
+ );
408
+ write(
409
+ deps.stderr,
410
+ 'This mode will hard-error in the next major release.',
373
411
  );
374
412
  }
375
413