@ai-dev-methodologies/rlp-desk 0.0.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.
- package/LICENSE +21 -0
- package/README.md +182 -0
- package/docs/architecture.md +129 -0
- package/docs/getting-started.md +153 -0
- package/docs/protocol-reference.md +220 -0
- package/examples/calculator/.claude/ralph-desk/plans/prd-loop-test.md +37 -0
- package/examples/calculator/.claude/ralph-desk/plans/test-spec-loop-test.md +29 -0
- package/examples/calculator/.claude/ralph-desk/prompts/loop-test.verifier.prompt.md +29 -0
- package/examples/calculator/.claude/ralph-desk/prompts/loop-test.worker.prompt.md +32 -0
- package/install.sh +53 -0
- package/package.json +40 -0
- package/scripts/postinstall.js +48 -0
- package/scripts/uninstall.js +45 -0
- package/src/commands/rlp-desk.md +164 -0
- package/src/governance.md +170 -0
- package/src/scripts/init_ralph_desk.zsh +245 -0
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
#!/bin/zsh
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# =============================================================================
|
|
5
|
+
# Ralph Desk Project Initializer for Claude Code
|
|
6
|
+
#
|
|
7
|
+
# User-level tool: ~/.claude/ralph-desk/init_ralph_desk.zsh
|
|
8
|
+
# Creates project-local scaffold in: .claude/ralph-desk/
|
|
9
|
+
#
|
|
10
|
+
# Usage:
|
|
11
|
+
# ~/.claude/ralph-desk/init_ralph_desk.zsh <slug> [objective]
|
|
12
|
+
# =============================================================================
|
|
13
|
+
|
|
14
|
+
SLUG="${1:?Usage: $0 <slug> [objective]}"
|
|
15
|
+
OBJECTIVE="${2:-TBD - fill in the objective}"
|
|
16
|
+
ROOT="${ROOT:-$PWD}"
|
|
17
|
+
DESK="$ROOT/.claude/ralph-desk"
|
|
18
|
+
RUNNER_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
19
|
+
|
|
20
|
+
echo "Initializing Ralph Desk: $SLUG"
|
|
21
|
+
echo " Root: $ROOT"
|
|
22
|
+
echo " Desk: $DESK"
|
|
23
|
+
echo ""
|
|
24
|
+
|
|
25
|
+
mkdir -p "$DESK/prompts" "$DESK/context" "$DESK/memos" "$DESK/plans" "$DESK/logs/$SLUG"
|
|
26
|
+
|
|
27
|
+
# --- Worker Prompt ---
|
|
28
|
+
F="$DESK/prompts/$SLUG.worker.prompt.md"
|
|
29
|
+
if [[ ! -f "$F" ]]; then
|
|
30
|
+
cat > "$F" <<EOF
|
|
31
|
+
Execute the plan for $SLUG.
|
|
32
|
+
|
|
33
|
+
Required reads every iteration:
|
|
34
|
+
- PRD: $DESK/plans/prd-$SLUG.md
|
|
35
|
+
- Test Spec: $DESK/plans/test-spec-$SLUG.md
|
|
36
|
+
- Campaign Memory: $DESK/memos/$SLUG-memory.md
|
|
37
|
+
- Latest Context: $DESK/context/$SLUG-latest.md
|
|
38
|
+
|
|
39
|
+
Iteration rules:
|
|
40
|
+
- Use fresh context only; do NOT depend on prior chat history.
|
|
41
|
+
- Execute exactly ONE bounded next action.
|
|
42
|
+
- If campaign memory has an unresolved Next iteration contract, do that first.
|
|
43
|
+
- Refresh context file with the current frontier.
|
|
44
|
+
- Rewrite campaign memory in full.
|
|
45
|
+
- Write evidence artifacts.
|
|
46
|
+
|
|
47
|
+
Stop behavior:
|
|
48
|
+
- Objective achieved → write done-claim JSON to $DESK/memos/$SLUG-done-claim.json, exit
|
|
49
|
+
- Autonomous blocker → write to $DESK/memos/$SLUG-blocked.md, exit
|
|
50
|
+
- Otherwise → set stop=continue, define next iteration contract in memory, exit
|
|
51
|
+
|
|
52
|
+
Objective: $OBJECTIVE
|
|
53
|
+
EOF
|
|
54
|
+
echo " + $F"
|
|
55
|
+
else echo " · $F"; fi
|
|
56
|
+
|
|
57
|
+
# --- Verifier Prompt ---
|
|
58
|
+
F="$DESK/prompts/$SLUG.verifier.prompt.md"
|
|
59
|
+
if [[ ! -f "$F" ]]; then
|
|
60
|
+
cat > "$F" <<EOF
|
|
61
|
+
Independent verifier for Ralph Desk: $SLUG
|
|
62
|
+
|
|
63
|
+
Required reads:
|
|
64
|
+
- PRD: $DESK/plans/prd-$SLUG.md
|
|
65
|
+
- Test Spec: $DESK/plans/test-spec-$SLUG.md
|
|
66
|
+
- Campaign Memory: $DESK/memos/$SLUG-memory.md
|
|
67
|
+
- Latest Context: $DESK/context/$SLUG-latest.md
|
|
68
|
+
- Done Claim: $DESK/memos/$SLUG-done-claim.json
|
|
69
|
+
|
|
70
|
+
Process:
|
|
71
|
+
1. Read PRD acceptance criteria
|
|
72
|
+
2. Read done claim
|
|
73
|
+
3. Run fresh verification: build, test, lint, typecheck
|
|
74
|
+
4. Check each criterion against fresh evidence
|
|
75
|
+
5. Write verdict JSON to: $DESK/memos/$SLUG-verify-verdict.json
|
|
76
|
+
|
|
77
|
+
Verdict JSON:
|
|
78
|
+
{
|
|
79
|
+
"verdict": "pass|fail|blocked",
|
|
80
|
+
"verified_at_utc": "ISO timestamp",
|
|
81
|
+
"summary": "...",
|
|
82
|
+
"criteria_results": [{"criterion":"...","met":true/false,"evidence":"..."}],
|
|
83
|
+
"missing_evidence": [],
|
|
84
|
+
"issues": [],
|
|
85
|
+
"recommended_state_transition": "complete|continue|blocked",
|
|
86
|
+
"next_iteration_contract": "...",
|
|
87
|
+
"evidence_paths": []
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
Rules:
|
|
91
|
+
- Do NOT trust the worker's claim. Verify with fresh evidence.
|
|
92
|
+
- If uncertain, verdict = fail.
|
|
93
|
+
- Do NOT modify code or write sentinel files.
|
|
94
|
+
EOF
|
|
95
|
+
echo " + $F"
|
|
96
|
+
else echo " · $F"; fi
|
|
97
|
+
|
|
98
|
+
# --- Context ---
|
|
99
|
+
F="$DESK/context/$SLUG-latest.md"
|
|
100
|
+
if [[ ! -f "$F" ]]; then
|
|
101
|
+
cat > "$F" <<EOF
|
|
102
|
+
# $SLUG - Latest Context
|
|
103
|
+
|
|
104
|
+
## Current Frontier
|
|
105
|
+
### Completed
|
|
106
|
+
### In Progress
|
|
107
|
+
### Next
|
|
108
|
+
- (TBD by first worker)
|
|
109
|
+
|
|
110
|
+
## Key Decisions
|
|
111
|
+
## Known Issues
|
|
112
|
+
## Files Changed This Iteration
|
|
113
|
+
## Verification Status
|
|
114
|
+
EOF
|
|
115
|
+
echo " + $F"
|
|
116
|
+
else echo " · $F"; fi
|
|
117
|
+
|
|
118
|
+
# --- Campaign Memory ---
|
|
119
|
+
F="$DESK/memos/$SLUG-memory.md"
|
|
120
|
+
if [[ ! -f "$F" ]]; then
|
|
121
|
+
cat > "$F" <<EOF
|
|
122
|
+
# $SLUG - Campaign Memory
|
|
123
|
+
|
|
124
|
+
## Stop Status
|
|
125
|
+
continue
|
|
126
|
+
|
|
127
|
+
## Objective
|
|
128
|
+
$OBJECTIVE
|
|
129
|
+
|
|
130
|
+
## Current State
|
|
131
|
+
Iteration 0 - not started
|
|
132
|
+
|
|
133
|
+
## Next Iteration Contract
|
|
134
|
+
Start from the beginning: read PRD and plan the first bounded action.
|
|
135
|
+
|
|
136
|
+
## Patterns Discovered
|
|
137
|
+
## Learnings
|
|
138
|
+
## Evidence Chain
|
|
139
|
+
EOF
|
|
140
|
+
echo " + $F"
|
|
141
|
+
else echo " · $F"; fi
|
|
142
|
+
|
|
143
|
+
# --- PRD ---
|
|
144
|
+
F="$DESK/plans/prd-$SLUG.md"
|
|
145
|
+
if [[ ! -f "$F" ]]; then
|
|
146
|
+
cat > "$F" <<EOF
|
|
147
|
+
# PRD: $SLUG
|
|
148
|
+
|
|
149
|
+
## Objective
|
|
150
|
+
$OBJECTIVE
|
|
151
|
+
|
|
152
|
+
## User Stories
|
|
153
|
+
|
|
154
|
+
### US-001: [Title]
|
|
155
|
+
- **Priority**: P0
|
|
156
|
+
- **Acceptance Criteria**:
|
|
157
|
+
- [ ] [Specific, testable criterion]
|
|
158
|
+
- **Status**: not started
|
|
159
|
+
|
|
160
|
+
## Non-Goals
|
|
161
|
+
## Technical Constraints
|
|
162
|
+
## Done When
|
|
163
|
+
- All acceptance criteria pass
|
|
164
|
+
- Independent verifier confirms
|
|
165
|
+
EOF
|
|
166
|
+
echo " + $F"
|
|
167
|
+
else echo " · $F"; fi
|
|
168
|
+
|
|
169
|
+
# --- Test Spec ---
|
|
170
|
+
F="$DESK/plans/test-spec-$SLUG.md"
|
|
171
|
+
if [[ ! -f "$F" ]]; then
|
|
172
|
+
cat > "$F" <<EOF
|
|
173
|
+
# Test Specification: $SLUG
|
|
174
|
+
|
|
175
|
+
## Verification Commands
|
|
176
|
+
### Build
|
|
177
|
+
\`\`\`bash
|
|
178
|
+
# TODO
|
|
179
|
+
\`\`\`
|
|
180
|
+
### Test
|
|
181
|
+
\`\`\`bash
|
|
182
|
+
# TODO
|
|
183
|
+
\`\`\`
|
|
184
|
+
### Lint
|
|
185
|
+
\`\`\`bash
|
|
186
|
+
# TODO
|
|
187
|
+
\`\`\`
|
|
188
|
+
|
|
189
|
+
## Criteria → Verification Mapping
|
|
190
|
+
| Criterion | Method | Command |
|
|
191
|
+
|-----------|--------|---------|
|
|
192
|
+
| US-001 AC1 | TODO | TODO |
|
|
193
|
+
EOF
|
|
194
|
+
echo " + $F"
|
|
195
|
+
else echo " · $F"; fi
|
|
196
|
+
|
|
197
|
+
# --- .gitignore for runtime artifacts ---
|
|
198
|
+
GITIGNORE="$ROOT/.gitignore"
|
|
199
|
+
MARKER="# RLP Desk runtime artifacts"
|
|
200
|
+
if [[ -f "$GITIGNORE" ]]; then
|
|
201
|
+
if ! grep -qF "$MARKER" "$GITIGNORE"; then
|
|
202
|
+
echo "" >> "$GITIGNORE"
|
|
203
|
+
cat >> "$GITIGNORE" <<'GIEOF'
|
|
204
|
+
# RLP Desk runtime artifacts
|
|
205
|
+
.claude/ralph-desk/logs/
|
|
206
|
+
.claude/ralph-desk/memos/*-done-claim.json
|
|
207
|
+
.claude/ralph-desk/memos/*-verify-verdict.json
|
|
208
|
+
.claude/ralph-desk/memos/*-complete.md
|
|
209
|
+
.claude/ralph-desk/memos/*-blocked.md
|
|
210
|
+
.claude/ralph-desk/memos/*-iter-signal.json
|
|
211
|
+
GIEOF
|
|
212
|
+
echo " + .gitignore (rlp-desk rules appended)"
|
|
213
|
+
else
|
|
214
|
+
echo " · .gitignore (rlp-desk rules already present)"
|
|
215
|
+
fi
|
|
216
|
+
else
|
|
217
|
+
cat > "$GITIGNORE" <<'GIEOF'
|
|
218
|
+
# RLP Desk runtime artifacts
|
|
219
|
+
.claude/ralph-desk/logs/
|
|
220
|
+
.claude/ralph-desk/memos/*-done-claim.json
|
|
221
|
+
.claude/ralph-desk/memos/*-verify-verdict.json
|
|
222
|
+
.claude/ralph-desk/memos/*-complete.md
|
|
223
|
+
.claude/ralph-desk/memos/*-blocked.md
|
|
224
|
+
.claude/ralph-desk/memos/*-iter-signal.json
|
|
225
|
+
GIEOF
|
|
226
|
+
echo " + .gitignore (created with rlp-desk rules)"
|
|
227
|
+
fi
|
|
228
|
+
|
|
229
|
+
echo ""
|
|
230
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
231
|
+
echo "Scaffold ready: $SLUG"
|
|
232
|
+
echo ""
|
|
233
|
+
echo "Next:"
|
|
234
|
+
echo " 1. Edit PRD: $DESK/plans/prd-$SLUG.md"
|
|
235
|
+
echo " 2. Edit test spec: $DESK/plans/test-spec-$SLUG.md"
|
|
236
|
+
echo " 3. Run:"
|
|
237
|
+
echo ""
|
|
238
|
+
echo " LOOP_NAME=$SLUG \\"
|
|
239
|
+
echo " PROMPT_FILE=$DESK/prompts/$SLUG.worker.prompt.md \\"
|
|
240
|
+
echo " VERIFIER_PROMPT_FILE=$DESK/prompts/$SLUG.verifier.prompt.md \\"
|
|
241
|
+
echo " CONTEXT_FILE=$DESK/context/$SLUG-latest.md \\"
|
|
242
|
+
echo " EXTRA_REQUIRED_FILES=$DESK/plans/prd-$SLUG.md:$DESK/plans/test-spec-$SLUG.md:$DESK/memos/$SLUG-memory.md \\"
|
|
243
|
+
echo " MAX_ITER=20 \\"
|
|
244
|
+
echo " $RUNNER_DIR/run_ralph_desk.zsh"
|
|
245
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|