@ai-dev-methodologies/rlp-desk 0.10.0 → 0.11.0

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.
@@ -1,161 +0,0 @@
1
- # Flywheel Redesign Spec
2
-
3
- ## Problem
4
-
5
- rlp-desk's current loop is: Worker → Verify → FAIL → fix contract → Worker (same approach).
6
- When the approach itself is wrong, retrying with fixes wastes iterations.
7
- The loop needs a direction review step that challenges premises and forces alternatives before the next Worker runs.
8
-
9
- ## Design
10
-
11
- ### Loop Structure
12
-
13
- ```
14
- First iteration (no flywheel):
15
- Worker → Verify → PASS → next US
16
-
17
- On FAIL (--flywheel on-fail):
18
- Verify FAIL
19
- → Flywheel Agent (fresh context, opus)
20
- Step 0A: Premise Challenge
21
- Step 0B: Existing Code Leverage
22
- Step 0C: Ideal State Mapping
23
- Step 0D: Implementation Alternatives (min 2)
24
- Step 0E: Scope Decision (HOLD/PIVOT/REDUCE/EXPAND)
25
- Step 0F: Contract Rewrite + Rejected Directions
26
- → Worker (reads updated contract) → Verify
27
- ```
28
-
29
- Flywheel runs BEFORE Worker. It decides direction, Worker executes.
30
-
31
- ### Execution Modes
32
-
33
- tmux mode (3 panes):
34
- ```
35
- ┌──────────────┬──────────────┬──────────────┐
36
- │ Flywheel │ Worker │ Verifier │
37
- │ claude opus │ claude/codex │ claude/codex │
38
- │ direction │ implements │ verifies │
39
- └──────────────┴──────────────┴──────────────┘
40
- ```
41
- - Leader dispatches to flywheel pane, polls flywheel-signal.json
42
- - After signal received, dispatches Worker with updated contract
43
-
44
- agent mode:
45
- - Leader calls Agent() with flywheel prompt → fresh context automatic
46
- - Agent() returns decision directly (no file signal needed)
47
- - Leader updates memory, then dispatches Worker agent
48
-
49
- ### CLI Flags
50
-
51
- ```
52
- --flywheel off|on-fail (default: off)
53
- --flywheel-model MODEL (default: opus)
54
- ```
55
-
56
- ### 4 Scope Decisions
57
-
58
- | Decision | When | Action |
59
- |----------|------|--------|
60
- | HOLD | Premises valid, approach correct | Refine contract with specific fixes |
61
- | PIVOT | Premise broken, approach wrong | Switch to alternative, record rejected direction |
62
- | REDUCE | US too complex for current scope | Split AC or simplify, defer remainder |
63
- | EXPAND | Missing prerequisite discovered | Add AC or expand contract |
64
-
65
- ### Flywheel Prompt Template (plan-ceo-review core internalized)
66
-
67
- 6-step review process:
68
-
69
- **0A. Premise Challenge**
70
- List every assumption in the current approach. For each, state whether this iteration's evidence supports or contradicts it. Broken premise → PIVOT or REDUCE.
71
-
72
- **0B. Existing Code Leverage**
73
- Check if Worker missed reusable code. Check if a different approach fits existing patterns better.
74
-
75
- **0C. Ideal State Mapping**
76
- Describe the ideal completion of this US in 2-3 sentences. How far is the current approach from ideal?
77
-
78
- **0D. Implementation Alternatives (MANDATORY)**
79
- Minimum 2 alternatives. Each: summary, effort (S/M/L), risk, tradeoff vs current approach.
80
-
81
- **0E. Scope Decision**
82
- Choose HOLD/PIVOT/REDUCE/EXPAND. Justify with evidence from this iteration only.
83
-
84
- **0F. Contract Rewrite**
85
- Rewrite Next Iteration Contract in campaign memory.
86
- Record decision in Key Decisions.
87
- Record failed approaches in Rejected Directions (prevents future Workers from repeating).
88
-
89
- **CEO Cognitive Patterns (embedded in prompt):**
90
- 1. First-principles — ignore convention, start from the problem
91
- 2. 10x check — can 2x effort yield 10x better result?
92
- 3. Inversion — what must be true for this approach to fail?
93
- 4. Simplicity bias — prefer simple over complex solutions
94
- 5. User-back — reason backwards from end-user experience
95
- 6. Time-value — does this pivot save 3+ iterations?
96
- 7. Sunk cost immunity — ignore prior investment
97
- 8. Blast radius — assess impact scope of direction change
98
- 9. Reversibility — prefer easily reversible decisions
99
- 10. Evidence > opinion — judge only by this iteration's actual results
100
-
101
- ### Signal Protocol
102
-
103
- flywheel-signal.json:
104
- ```json
105
- {
106
- "iteration": N,
107
- "decision": "hold|pivot|reduce|expand",
108
- "summary": "one line explanation",
109
- "rejected_directions": ["approach X because Y"],
110
- "contract_updated": true,
111
- "timestamp": "ISO"
112
- }
113
- ```
114
-
115
- ### Campaign Memory Updates
116
-
117
- Flywheel agent writes directly to campaign memory:
118
- - **Next Iteration Contract**: rewritten based on decision
119
- - **Key Decisions**: flywheel decision + reasoning appended
120
- - **Rejected Directions**: new section, append-only (Worker reads to avoid repeating)
121
-
122
- ### Files Changed
123
-
124
- | File | Change |
125
- |------|--------|
126
- | src/scripts/init_ralph_desk.zsh | Flywheel prompt template, 3rd pane setup, --flywheel flags in presets |
127
- | src/node/runner/campaign-main-loop.mjs | Flywheel dispatch (tmux + agent), shouldRunFlywheel(), pane management |
128
- | src/node/run.mjs | --flywheel, --flywheel-model flag parsing |
129
- | src/commands/rlp-desk.md | Flywheel documentation, options reference |
130
- | src/governance.md | Flywheel step in Leader loop protocol |
131
- | src/scripts/run_ralph_desk.zsh | 3rd pane creation for tmux mode |
132
-
133
- ### What Stays (from current branch)
134
-
135
- - SV Report generation (generateSVReport in campaign-reporting.mjs)
136
- - Brainstorm step 0 SV feedback (rlp-desk.md)
137
- - analyticsDir in buildPaths
138
-
139
- ### What Gets Removed (from current branch)
140
-
141
- - Current pivot implementation (shouldRunPivot, dispatchPivot, buildPivotTriggerCmd)
142
- - Current pivot prompt template in init_ralph_desk.zsh
143
- - Current --pivot-mode, --pivot-model flags
144
- - test-pivot-step.mjs
145
-
146
- ## Verification
147
-
148
- ### TDD Tests
149
- - shouldRunFlywheel logic (off/on-fail conditions)
150
- - Flywheel prompt contains all 6 steps + 10 cognitive patterns
151
- - Signal protocol parsing
152
- - Rejected directions persistence across iterations
153
- - 3-pane creation in tmux mode
154
-
155
- ### Self-Verification (3 scenarios)
156
- - LOW: --flywheel off → normal loop unchanged
157
- - MEDIUM: --flywheel on-fail + FAIL → flywheel fires → memory updated → Worker reflects
158
- - CRITICAL: PIVOT decision → rejected direction recorded → next Worker avoids it
159
-
160
- ### E2E
161
- - Test project with intentional FAIL → flywheel activates → direction change → success