renn-studio 0.6.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.
Files changed (112) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +36 -0
  3. package/agents/renn-architect.md +1463 -0
  4. package/agents/renn-auditor.md +1053 -0
  5. package/agents/renn-codebase-mapper.md +908 -0
  6. package/agents/renn-design-reviewer.md +422 -0
  7. package/agents/renn-designer.md +814 -0
  8. package/agents/renn-detective.md +1204 -0
  9. package/agents/renn-integration-checker.md +957 -0
  10. package/agents/renn-navigator.md +659 -0
  11. package/agents/renn-plan-reviewer.md +812 -0
  12. package/agents/renn-project-scout.md +880 -0
  13. package/agents/renn-runner.md +842 -0
  14. package/agents/renn-stage-scout.md +705 -0
  15. package/agents/renn-synthesizer.md +256 -0
  16. package/bin/install.js +1466 -0
  17. package/commands/renn.add-stage.md +211 -0
  18. package/commands/renn.add-todo.md +194 -0
  19. package/commands/renn.audit-milestone.md +280 -0
  20. package/commands/renn.audit.md +219 -0
  21. package/commands/renn.check-todos.md +229 -0
  22. package/commands/renn.complete-milestone.md +136 -0
  23. package/commands/renn.continue.md +46 -0
  24. package/commands/renn.dash.md +308 -0
  25. package/commands/renn.debug.md +169 -0
  26. package/commands/renn.design-screens.md +107 -0
  27. package/commands/renn.design-system.md +100 -0
  28. package/commands/renn.discuss-stage.md +86 -0
  29. package/commands/renn.help.md +550 -0
  30. package/commands/renn.insert-stage.md +231 -0
  31. package/commands/renn.list-stage-assumptions.md +49 -0
  32. package/commands/renn.map-codebase.md +72 -0
  33. package/commands/renn.new-milestone.md +80 -0
  34. package/commands/renn.pause.md +132 -0
  35. package/commands/renn.plan-milestone-gaps.md +314 -0
  36. package/commands/renn.plan-stage.md +118 -0
  37. package/commands/renn.remove-stage.md +353 -0
  38. package/commands/renn.research-stage.md +200 -0
  39. package/commands/renn.restyle.md +98 -0
  40. package/commands/renn.run-stage.md +343 -0
  41. package/commands/renn.set-profile.md +116 -0
  42. package/commands/renn.settings.md +151 -0
  43. package/commands/renn.ship.md +52 -0
  44. package/commands/renn.start.md +95 -0
  45. package/commands/renn.status.md +530 -0
  46. package/commands/renn.watch.md +51 -0
  47. package/hooks/dist/renn-check-update.js +67 -0
  48. package/hooks/dist/renn-statusline.js +96 -0
  49. package/package.json +89 -0
  50. package/renn/references/continuation-format.md +249 -0
  51. package/renn/references/design-artifacts.md +674 -0
  52. package/renn/references/design-tokens.md +162 -0
  53. package/renn/references/gates.md +1078 -0
  54. package/renn/references/git-integration.md +254 -0
  55. package/renn/references/horsepower-profiles.md +84 -0
  56. package/renn/references/planning-config.md +189 -0
  57. package/renn/references/questioning.md +141 -0
  58. package/renn/references/security-checklist.md +2184 -0
  59. package/renn/references/tdd.md +263 -0
  60. package/renn/references/ui-brand.md +189 -0
  61. package/renn/references/verification-patterns.md +612 -0
  62. package/renn/templates/DEBUG.md +159 -0
  63. package/renn/templates/INTEL.md +283 -0
  64. package/renn/templates/RECAP.md +246 -0
  65. package/renn/templates/UAT.md +247 -0
  66. package/renn/templates/architect-prompt.md +119 -0
  67. package/renn/templates/brief.md +190 -0
  68. package/renn/templates/codebase/architecture.md +264 -0
  69. package/renn/templates/codebase/concerns.md +310 -0
  70. package/renn/templates/codebase/conventions.md +307 -0
  71. package/renn/templates/codebase/design.md +336 -0
  72. package/renn/templates/codebase/integrations.md +280 -0
  73. package/renn/templates/codebase/stack.md +186 -0
  74. package/renn/templates/codebase/structure.md +295 -0
  75. package/renn/templates/codebase/testing.md +480 -0
  76. package/renn/templates/config.json +36 -0
  77. package/renn/templates/continue-here.md +80 -0
  78. package/renn/templates/detective-prompt.md +93 -0
  79. package/renn/templates/milestone-archive.md +123 -0
  80. package/renn/templates/milestone.md +117 -0
  81. package/renn/templates/proof.md +326 -0
  82. package/renn/templates/pulse.md +176 -0
  83. package/renn/templates/research/architecture.md +206 -0
  84. package/renn/templates/research/features.md +149 -0
  85. package/renn/templates/research/pitfalls.md +202 -0
  86. package/renn/templates/research/recap.md +187 -0
  87. package/renn/templates/research/stack.md +122 -0
  88. package/renn/templates/research/ux.md +283 -0
  89. package/renn/templates/research-lite.md +146 -0
  90. package/renn/templates/research.md +582 -0
  91. package/renn/templates/specs.md +233 -0
  92. package/renn/templates/stage-prompt.md +571 -0
  93. package/renn/templates/track.md +211 -0
  94. package/renn/templates/user-setup.md +315 -0
  95. package/renn/workflows/audit-stage.md +717 -0
  96. package/renn/workflows/audit-work.md +596 -0
  97. package/renn/workflows/complete-milestone.md +875 -0
  98. package/renn/workflows/continue-project.md +306 -0
  99. package/renn/workflows/design-stage.md +2019 -0
  100. package/renn/workflows/diagnose-issues.md +231 -0
  101. package/renn/workflows/initialize-project.md +1039 -0
  102. package/renn/workflows/list-assumptions.md +178 -0
  103. package/renn/workflows/map-codebase.md +374 -0
  104. package/renn/workflows/new-milestone.md +718 -0
  105. package/renn/workflows/plan-stage.md +810 -0
  106. package/renn/workflows/research-stage.md +289 -0
  107. package/renn/workflows/run-plan.md +1844 -0
  108. package/renn/workflows/run-stage.md +692 -0
  109. package/renn/workflows/scope-stage.md +546 -0
  110. package/renn/workflows/ship-project.md +859 -0
  111. package/renn/workflows/transition.md +556 -0
  112. package/renn/workflows/watch-project.md +797 -0
@@ -0,0 +1,810 @@
1
+ <purpose>
2
+ Create executable stage prompts (run.md files) through a research → plan → verify loop.
3
+
4
+ Use this workflow when planning a stage's runs. Handles research scouting, architect spawning, plan reviewer verification, and revision iterations.
5
+ </purpose>
6
+
7
+ <core_principle>
8
+ Fresh context per agent. Orchestrator stays lean (~15%), each subagent gets 100% fresh 200k. Intel.md loaded early and passed to ALL agents to constrain scope.
9
+ </core_principle>
10
+
11
+ <process>
12
+
13
+ <step name="validate_environment" priority="first">
14
+ Validate .renn/ exists and resolve model profile:
15
+
16
+ ```bash
17
+ ls .renn/ 2>/dev/null
18
+ ```
19
+
20
+ **If not found:** Error - user should run `/renn.start` first.
21
+
22
+ **Resolve model profile for agent spawning:**
23
+
24
+ ```bash
25
+ MODEL_PROFILE=$(cat .renn/config.json 2>/dev/null | grep -o '"horsepower"[[:space:]]*:[[:space:]]*"[^"]*"' | grep -o '"[^"]*"$' | tr -d '"' || echo "balanced")
26
+ ```
27
+
28
+ Default to "balanced" if not set.
29
+
30
+ **Model lookup table:**
31
+
32
+ | Agent | max | balanced | eco |
33
+ |-------|---------|----------|--------|
34
+ | renn-stage-scout | opus | sonnet | haiku |
35
+ | renn-architect | opus | opus | sonnet |
36
+ | renn-plan-reviewer | sonnet | sonnet | haiku |
37
+
38
+ Store resolved models for use in Task calls below.
39
+ </step>
40
+
41
+ <step name="parse_arguments">
42
+ Extract from $ARGUMENTS:
43
+
44
+ - Stage number (integer or decimal like `2.1`)
45
+ - `--research` flag to force re-research
46
+ - `--skip-research` flag to skip research
47
+ - `--gaps` flag for gap closure mode
48
+ - `--skip-verify` flag to bypass verification loop
49
+
50
+ **If no stage number:** Detect next unplanned stage from track.
51
+
52
+ **Normalize stage to zero-padded format:**
53
+
54
+ ```bash
55
+ # Normalize stage number (8 → 08, but preserve decimals like 2.1 → 02.1)
56
+ if [[ "$STAGE" =~ ^[0-9]+$ ]]; then
57
+ STAGE=$(printf "%02d" "$STAGE")
58
+ elif [[ "$STAGE" =~ ^([0-9]+)\.([0-9]+)$ ]]; then
59
+ STAGE=$(printf "%02d.%s" "${BASH_REMATCH[1]}" "${BASH_REMATCH[2]}")
60
+ fi
61
+ ```
62
+
63
+ **Check for existing research and runs:**
64
+
65
+ ```bash
66
+ ls .renn/stages/${STAGE}-*/*-research.md 2>/dev/null
67
+ ls .renn/stages/${STAGE}-*/*-run.md 2>/dev/null
68
+ ```
69
+ </step>
70
+
71
+ <step name="validate_stage">
72
+ ```bash
73
+ # Strip leading zeros for track.md lookup (track uses "Stage 1:", not "Stage 01:")
74
+ STAGE_UNPADDED=$(echo "$STAGE" | sed 's/^0\+\([0-9]\)/\1/')
75
+ grep -A5 "^### Stage ${STAGE_UNPADDED}:" .renn/track.md 2>/dev/null
76
+ ```
77
+
78
+ **If not found:** Error with available stages. **If found:** Extract stage number, name, description.
79
+ </step>
80
+
81
+ <step name="ensure_stage_directory">
82
+ ```bash
83
+ # STAGE is already normalized (08, 02.1, etc.) from parse_arguments
84
+ STAGE_DIR=$(ls -d .renn/stages/${STAGE}-* 2>/dev/null | head -1)
85
+ if [ -z "$STAGE_DIR" ]; then
86
+ # Create stage directory from track name
87
+ # Anchor to ### headings to avoid matching list items (which contain markdown ** and descriptions)
88
+ STAGE_UNPADDED=$(echo "$STAGE" | sed 's/^0\+\([0-9]\)/\1/')
89
+ STAGE_NAME=$(grep "^### Stage ${STAGE_UNPADDED}:" .renn/track.md | head -1 | sed 's/^### Stage [0-9]*: //' | sed 's/ \[UI\]$//' | tr '[:upper:]' '[:lower:]' | tr ' ' '-')
90
+ mkdir -p ".renn/stages/${STAGE}-${STAGE_NAME}"
91
+ STAGE_DIR=".renn/stages/${STAGE}-${STAGE_NAME}"
92
+ fi
93
+
94
+ # Load intel.md immediately - this informs ALL downstream agents
95
+ INTEL_CONTENT=$(cat "${STAGE_DIR}"/*-intel.md 2>/dev/null)
96
+
97
+ # Extract project name from brief.md heading (used in designer spawn)
98
+ PROJECT_NAME=$(head -1 .renn/brief.md 2>/dev/null | sed 's/^# //')
99
+ ```
100
+
101
+ **CRITICAL:** Store `INTEL_CONTENT` now. It must be passed to:
102
+ - **Scout** — constrains what to research (locked decisions vs Claude's discretion)
103
+ - **Architect** — locked decisions must be honored, not revisited
104
+ - **Reviewer** — verifies runs respect user's stated vision
105
+ - **Revision** — context for targeted fixes
106
+
107
+ If intel.md exists, display: `Using stage context from: ${STAGE_DIR}/*-intel.md`
108
+ </step>
109
+
110
+ <step name="handle_research">
111
+ **If `--gaps` flag:** Skip research (gap closure uses proof.md instead).
112
+
113
+ **If `--skip-research` flag:** Skip to check_existing_runs.
114
+
115
+ **Check config for research setting:**
116
+
117
+ ```bash
118
+ WORKFLOW_RESEARCH=$(cat .renn/config.json 2>/dev/null | grep -o '"research"[[:space:]]*:[[:space:]]*[^,}]*' | grep -o 'true\|false' || echo "true")
119
+ ```
120
+
121
+ **If `checks.research` is `false` AND `--research` flag NOT set:** Skip to check_existing_runs.
122
+
123
+ **Otherwise:**
124
+
125
+ Check for existing research:
126
+
127
+ ```bash
128
+ ls "${STAGE_DIR}"/*-research.md 2>/dev/null
129
+ ```
130
+
131
+ **If research.md exists AND `--research` flag NOT set:**
132
+ - Display: `Using existing research: ${STAGE_DIR}/${STAGE}-research.md`
133
+ - Skip to check_existing_runs
134
+
135
+ **If research.md missing OR `--research` flag set:**
136
+
137
+ Display stage banner:
138
+ ```
139
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
140
+ RENN ► SCOUTING STAGE {X}
141
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
142
+
143
+ ◆ Spawning scout...
144
+ ```
145
+
146
+ Proceed to spawn scout.
147
+
148
+ ### Spawn renn-stage-scout
149
+
150
+ Gather additional context for research prompt:
151
+
152
+ ```bash
153
+ # Get stage description from track (use STAGE_UNPADDED from validate_stage)
154
+ STAGE_DESC=$(grep -A5 "^### Stage ${STAGE_UNPADDED}:" .renn/track.md)
155
+
156
+ # Get specs if they exist
157
+ SPECS=$(cat .renn/specs.md 2>/dev/null | grep -A100 "## Requirements" | head -50)
158
+
159
+ # Get prior decisions from pulse.md
160
+ DECISIONS=$(grep -A20 "### Decisions Made" .renn/pulse.md 2>/dev/null)
161
+
162
+ # INTEL_CONTENT already loaded in ensure_stage_directory
163
+
164
+ # Read UX.md for scout (if exists)
165
+ UX_CONTENT_FOR_SCOUT=$(cat .renn/research/UX.md 2>/dev/null)
166
+ ```
167
+
168
+ Fill research prompt and spawn:
169
+
170
+ ```markdown
171
+ <objective>
172
+ Research how to implement Stage {stage_number}: {stage_name}
173
+
174
+ Answer: "What do I need to know to PLAN this stage well?"
175
+ </objective>
176
+
177
+ <stage_context>
178
+ **IMPORTANT:** If intel.md exists below, it contains user decisions from /renn.discuss-stage.
179
+
180
+ - **Decisions section** = Locked choices — research THESE deeply, don't explore alternatives
181
+ - **Claude's Discretion section** = Your freedom areas — research options, make recommendations
182
+ - **Deferred Ideas section** = Out of scope — ignore completely
183
+
184
+ {intel_content}
185
+ </stage_context>
186
+
187
+ <additional_context>
188
+ **Stage description:**
189
+ {stage_description}
190
+
191
+ **Specs (if any):**
192
+ {specs}
193
+
194
+ **Prior decisions from pulse.md:**
195
+ {decisions}
196
+ </additional_context>
197
+
198
+ <ux_context>
199
+ **UX.md content (if exists -- use for Stage UX Patterns section):**
200
+
201
+ If UX.md content is present below, generate a ## Stage UX Patterns section in your research.md output. Cross-reference these project-level findings with the specific stage being researched. If no UX.md content below, omit the Stage UX Patterns section.
202
+
203
+ {ux_content_for_scout}
204
+ </ux_context>
205
+
206
+ <output>
207
+ Write research findings to: {stage_dir}/{stage}-research.md
208
+ </output>
209
+ ```
210
+
211
+ ```
212
+ Task(
213
+ prompt=research_prompt,
214
+ subagent_type="renn-stage-scout",
215
+ model="{scout_model}",
216
+ description="Research Stage {stage}"
217
+ )
218
+ ```
219
+
220
+ ### Handle Scout Return
221
+
222
+ **`## RESEARCH COMPLETE`:**
223
+ - Display: `Research complete. Proceeding to planning...`
224
+ - Continue to check_existing_runs
225
+
226
+ **`## RESEARCH BLOCKED`:**
227
+ - Display blocker information
228
+ - Offer: 1) Provide more context, 2) Skip research and plan anyway, 3) Abort
229
+ - Wait for user response
230
+ </step>
231
+
232
+ <step name="handle_ui_stage_redirect">
233
+ **If `--gaps` flag:** Set `UI_STAGE=false`. Skip to check_existing_runs.
234
+
235
+ Check the stage heading from track.md for a [UI] tag:
236
+
237
+ ```bash
238
+ STAGE_HEADING=$(grep "^### Stage ${STAGE_UNPADDED}:" .renn/track.md | head -1)
239
+ ```
240
+
241
+ If the heading contains `[UI]` -> set `UI_STAGE=true`.
242
+ If the heading does NOT contain `[UI]` -> set `UI_STAGE=false`. Continue to check_existing_runs.
243
+
244
+ No keyword matching. No UNCERTAIN state. The [UI] tag is authoritative.
245
+
246
+ ### Design Artifact Check (only when UI_STAGE=true)
247
+
248
+ ```bash
249
+ UX_BRIEF_FILE=".renn/design/ux-brief.md"
250
+ if [ ! -f "$UX_BRIEF_FILE" ]; then
251
+ UX_BRIEF_FILE="${STAGE_DIR}/${STAGE}-ux-brief.md"
252
+ fi
253
+ if [ -f "$UX_BRIEF_FILE" ]; then
254
+ echo "Design artifacts found. Loading UX brief..."
255
+ UX_BRIEF=$(cat "$UX_BRIEF_FILE")
256
+ else
257
+ echo ""
258
+ echo "Stage ${STAGE} is a UI stage but has no design artifacts."
259
+ echo "Run /renn.design-system first to create the design system."
260
+ echo "Then run /renn.design-screens ${STAGE} to create screen prototypes."
261
+ echo "Then re-run /renn.plan-stage ${STAGE}."
262
+ echo ""
263
+ exit 1
264
+ fi
265
+ ```
266
+
267
+ Store `UI_STAGE` and `UX_BRIEF` for downstream use.
268
+ </step>
269
+
270
+ <step name="handle_dx_interview">
271
+ **Skip conditions (check in order):**
272
+ 1. `--gaps` flag set -> skip (gap closure does not re-run interviews)
273
+ 2. `UI_STAGE` is true -> skip (UX handled by design-system/design-screens)
274
+ 3. UX.md does not exist -> skip (display: "No UX.md found. Skipping DX interview.")
275
+ 4. UX.md has no DX content -> skip
276
+
277
+ **Check for DX content in UX.md:**
278
+
279
+ ```bash
280
+ DX_CONTENT=""
281
+ if [ -f ".renn/research/UX.md" ]; then
282
+ if grep -q "Proven DX Patterns\|Project Type: CLI\|Project Type: API\|Project Type: Library" .renn/research/UX.md; then
283
+ DX_CONTENT=$(cat .renn/research/UX.md)
284
+ fi
285
+ fi
286
+ if [ -z "$DX_CONTENT" ]; then
287
+ echo "No DX patterns found in UX.md. Skipping DX interview."
288
+ DX_INTERVIEW_ANSWERS=""
289
+ DX_QUESTIONS_ASKED=0
290
+ # Skip to check_existing_runs
291
+ fi
292
+ ```
293
+
294
+ **Display banner:**
295
+
296
+ ```
297
+ RENN > DX INTERVIEW FOR STAGE {X}
298
+
299
+ Before planning, let's discuss the developer experience for this stage.
300
+ ```
301
+
302
+ **Generate 3-5 questions dynamically from UX.md DX findings:**
303
+
304
+ Read DX_CONTENT and generate questions from these categories.
305
+
306
+ **Plain-language rule:** Even though the user is likely a developer, prefer concrete descriptions over pattern names. Say "show a helpful suggestion with the error" instead of "actionable error messages." Describe the experience, not the design principle.
307
+
308
+ 1. **Proven DX Patterns (1-2 questions):** From the "Proven DX Patterns" table, generate questions about which patterns to adopt for this stage's specific functionality.
309
+ - Template: "Similar tools do [concrete behavior]. Should this work the same way?"
310
+ - Options: 2-3 concrete implementations + "Let Claude decide (Research suggests: [recommendation])"
311
+
312
+ 2. **Anti-Patterns (0-1 questions):** From the "Anti-Patterns" table, generate an awareness question if a relevant anti-pattern exists.
313
+ - Template: "A common frustration with [domain] tools is [description of bad experience]. When that happens here, how should we handle it?"
314
+ - Options: 2-3 alternatives + "Let Claude decide"
315
+
316
+ 3. **Critical DX Flows (1-2 questions):** From the "Critical Flows" table, generate questions about high-friction flows in this stage.
317
+ - Template: "When a developer [flow description], should it [option A] or [option B]?"
318
+ - Options: 2-3 DX approaches + "Let Claude decide"
319
+
320
+ 4. **Emotional Design (1 question):** From the "Emotional Design Goals" section, generate one calibration question.
321
+ - Template: "We want developers to feel [emotion] when using this. Which approach gets closer to that?"
322
+ - Options: 2-3 concrete approaches + "Let Claude decide"
323
+
324
+ **Question format (same AskUserQuestion conventions as UX interview):**
325
+ - 2-4 concrete options per question
326
+ - EVERY question includes "Let Claude decide" with research-backed default
327
+ - Third-person framing for flow questions, direct framing for preference questions
328
+ - Target 3-5 total questions (shorter than UX interview's 4-6)
329
+ - Track `DX_QUESTIONS_ASKED` count
330
+
331
+ **Compile answers:**
332
+
333
+ ```xml
334
+ <dx_interview_answers>
335
+ ### [Question Topic 1]
336
+ Question: {question text}
337
+ Answer: {user's choice or "Let Claude decide"}
338
+ Research default: {what UX.md recommends}
339
+
340
+ ### [Question Topic 2]
341
+ Question: {question text}
342
+ Answer: {user's choice or "Let Claude decide"}
343
+ Research default: {what UX.md recommends}
344
+
345
+ ...
346
+ </dx_interview_answers>
347
+ ```
348
+
349
+ **Store for downstream:**
350
+ - `DX_INTERVIEW_ANSWERS` -- compiled answers
351
+ - `DX_QUESTIONS_ASKED` -- count
352
+ - `DX_CONTENT` -- original UX.md DX content for synthesis
353
+ </step>
354
+
355
+ <step name="dx_synthesis">
356
+ **Skip conditions:**
357
+ 1. handle_dx_interview was skipped (`DX_INTERVIEW_ANSWERS` is empty) -> skip
358
+ 2. `UI_STAGE` is true -> skip
359
+
360
+ **Synthesize inline (no agent spawn):**
361
+
362
+ Read:
363
+ - `DX_CONTENT` (DX sections from UX.md)
364
+ - `DX_INTERVIEW_ANSWERS` (user decisions from DX interview)
365
+
366
+ Produce `DX_BRIEF` by combining both sources into concrete DX implications:
367
+
368
+ ```markdown
369
+ ## DX Direction for Stage {X}: {Name}
370
+
371
+ ### Developer Workflow
372
+ - [From interview answers, e.g., "CLI commands use consistent --flag naming per clig.dev"]
373
+ - [Research defaults for "Let Claude decide" answers]
374
+
375
+ ### Error Handling
376
+ - [From adopted patterns, e.g., "Errors write to stderr with actionable suggestions"]
377
+ - [From anti-pattern avoidance, e.g., "No stack traces unless --verbose"]
378
+
379
+ ### API/Interface Design
380
+ - [From adopted patterns + interview answers]
381
+ - [From critical flow decisions]
382
+
383
+ ### Emotional Guardrails
384
+ - Primary: [from DX emotional design, e.g., "productive -- fast startup, minimal config"]
385
+ - Avoid: [from DX anti-emotion, e.g., "lost -- clear help text, discoverable commands"]
386
+
387
+ ### Research References
388
+ - [Cross-references to UX.md DX sections that informed decisions]
389
+ ```
390
+
391
+ **Rules for synthesis:**
392
+ - For answers where user made a choice: use the user's choice verbatim
393
+ - For "Let Claude decide" answers: use the research-backed default from UX.md
394
+ - Translate abstract DX principles into concrete implementation guidance
395
+ - If all answers were "Let Claude decide": produce DX_BRIEF entirely from UX.md research defaults
396
+ - Keep DX_BRIEF concise (20-40 lines). Digest, not report.
397
+
398
+ **Persist DX_BRIEF to file:**
399
+
400
+ Write DX_BRIEF to `${STAGE_DIR}/${STAGE}-dx-brief.md` as plain markdown (no XML tags, no frontmatter). Same convention as ux-brief.md.
401
+
402
+ Display: "DX brief synthesized and saved to ${STAGE_DIR}/${STAGE}-dx-brief.md."
403
+
404
+ **Store:** `DX_BRIEF` variable for read_context_files and architect context.
405
+ </step>
406
+
407
+ <step name="check_existing_runs">
408
+ ```bash
409
+ ls "${STAGE_DIR}"/*-run.md 2>/dev/null
410
+ ```
411
+
412
+ **If exists:** Offer: 1) Continue planning (add more runs), 2) View existing, 3) Replan from scratch. Wait for response.
413
+ </step>
414
+
415
+ <step name="read_context_files">
416
+ Read and store context file contents for the architect agent. The `@` syntax does not work across Task() boundaries - content must be inlined.
417
+
418
+ ```bash
419
+ # Read required files
420
+ PULSE_CONTENT=$(cat .renn/pulse.md)
421
+ TRACK_CONTENT=$(cat .renn/track.md)
422
+
423
+ # Read optional files (empty string if missing)
424
+ SPECS_CONTENT=$(cat .renn/specs.md 2>/dev/null)
425
+ # INTEL_CONTENT already loaded in ensure_stage_directory
426
+ RESEARCH_CONTENT=$(cat "${STAGE_DIR}"/*-research.md 2>/dev/null)
427
+
428
+ # Load UX brief from design-stage output (if UI stage with completed design)
429
+ # UX_BRIEF may already be loaded from handle_ui_stage_redirect
430
+ if [ -z "$UX_BRIEF" ]; then
431
+ UX_BRIEF=$(cat .renn/design/ux-brief.md 2>/dev/null)
432
+ fi
433
+ if [ -z "$UX_BRIEF" ]; then
434
+ UX_BRIEF=$(cat "${STAGE_DIR}"/${STAGE}-ux-brief.md 2>/dev/null)
435
+ fi
436
+
437
+ # Load DX brief from dx_synthesis output (if non-UI stage with DX interview)
438
+ # DX_BRIEF may already be loaded from dx_synthesis step
439
+ if [ -z "$DX_BRIEF" ]; then
440
+ DX_BRIEF=$(cat "${STAGE_DIR}"/${STAGE}-dx-brief.md 2>/dev/null)
441
+ fi
442
+
443
+ # Detect design artifacts (created by design-stage, not plan-stage)
444
+ HAS_DESIGN=false
445
+ if [ -f ".renn/design/stylekit.yaml" ] && ls .renn/design/screens/*.yaml 2>/dev/null >/dev/null; then
446
+ HAS_DESIGN=true
447
+ fi
448
+
449
+ # Design context (only if design artifacts exist on disk)
450
+ if [ "$HAS_DESIGN" = "true" ]; then
451
+ DESIGN_SCREEN_SPECS=$(ls .renn/design/screens/*.yaml 2>/dev/null)
452
+ DESIGN_SUMMARIES=""
453
+ for spec in $DESIGN_SCREEN_SPECS; do
454
+ [ -f "$spec" ] || continue
455
+ screen_name=$(grep -m1 "^screen:" "$spec" | sed 's/screen: //')
456
+ description=$(grep -m1 "^description:" "$spec" | sed 's/description: //')
457
+ DESIGN_SUMMARIES="${DESIGN_SUMMARIES}\n- ${screen_name}: ${description} (@.renn/design/screens/${screen_name}.yaml)"
458
+ done
459
+ DESIGN_STYLEKIT_PATH=".renn/design/stylekit.yaml"
460
+ IMPLEMENTATION_GUIDE=$(cat .renn/design/implementation-guide.md 2>/dev/null)
461
+ fi
462
+
463
+ # Gap closure files (only if --gaps mode)
464
+ PROOF_CONTENT=$(cat "${STAGE_DIR}"/*-proof.md 2>/dev/null)
465
+ UAT_CONTENT=$(cat "${STAGE_DIR}"/*-uat.md 2>/dev/null)
466
+ ```
467
+ </step>
468
+
469
+ <step name="spawn_architect">
470
+ Display stage banner:
471
+ ```
472
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
473
+ RENN ► PLANNING STAGE {X}
474
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
475
+
476
+ ◆ Spawning architect...
477
+ ```
478
+
479
+ Fill prompt with inlined content and spawn:
480
+
481
+ ```markdown
482
+ <planning_context>
483
+
484
+ **Stage:** {stage_number}
485
+ **Mode:** {standard | gap_closure}
486
+
487
+ **Project Pulse:**
488
+ {pulse_content}
489
+
490
+ **Track:**
491
+ {track_content}
492
+
493
+ **Specs (if exists):**
494
+ {specs_content}
495
+
496
+ **Stage Intel (if exists):**
497
+
498
+ IMPORTANT: If stage intel exists below, it contains USER DECISIONS from /renn.discuss-stage.
499
+ - **Decisions** = LOCKED — honor these exactly, do not revisit or suggest alternatives
500
+ - **Claude's Discretion** = Your freedom — make implementation choices here
501
+ - **Deferred Ideas** = Out of scope — do NOT include in this stage
502
+
503
+ {intel_content}
504
+
505
+ **Research (if exists):**
506
+ {research_content}
507
+
508
+ {IF UX_BRIEF is non-empty:}
509
+
510
+ **UX Brief (if exists):**
511
+ {UX_BRIEF}
512
+
513
+ This ux_brief was produced by inline synthesis of UX.md research + UX interview answers.
514
+ It provides concrete UX direction for this stage. When planning UI tasks, reference these
515
+ interaction patterns, spacing guidelines, component choices, and emotional guardrails.
516
+ The ux_brief is INFORMATIONAL context for the architect -- it does NOT override user
517
+ decisions from intel.md.
518
+
519
+ {END IF}
520
+
521
+ {IF DX_BRIEF is non-empty:}
522
+
523
+ **DX Brief (if exists):**
524
+ {DX_BRIEF}
525
+
526
+ This dx_brief was produced by inline synthesis of UX.md DX research + DX interview answers.
527
+ It provides concrete DX direction for this stage. When planning implementation tasks,
528
+ reference these developer workflow patterns, error handling guidelines, and interface
529
+ design principles. The dx_brief is INFORMATIONAL context for the architect -- it does
530
+ NOT override user decisions from intel.md.
531
+
532
+ {END IF}
533
+
534
+ **Gap Closure (if --gaps mode):**
535
+ {proof_content}
536
+ {uat_content}
537
+
538
+ {IF HAS_DESIGN is true:}
539
+
540
+ **Design:**
541
+ Global stylekit: .renn/design/stylekit.yaml
542
+ All screen specs: .renn/design/screens/
543
+ Implementation guide: .renn/design/implementation-guide.md
544
+
545
+ Screen summary (all screens -- [NEW] = created this stage, [EXISTING] = from prior stages):
546
+ {design_summaries}
547
+
548
+ **Implementation Guide (framework translation):**
549
+ {IMPLEMENTATION_GUIDE}
550
+
551
+ IMPORTANT: Every UI implementation task MUST include these @ references in
552
+ the task's <context> section. The paths are STABLE across stages:
553
+
554
+ <context>
555
+ @.renn/design/stylekit.yaml
556
+ @.renn/design/screens/{screen-name}.yaml (structure spec)
557
+ @.renn/design/screens/{screen-name}.html (visual source of truth)
558
+ @.renn/design/implementation-guide.md (framework translation)
559
+ </context>
560
+
561
+ The HTML prototype is the VISUAL SOURCE OF TRUTH. The YAML spec describes
562
+ structure. The implementation guide provides framework-specific translation.
563
+
564
+ Task actions must NOT pre-translate design into approximate CSS classes.
565
+ Reference the implementation guide for framework-specific patterns and the
566
+ HTML prototype for visual specification. Do NOT approximate styling in task
567
+ action text -- let the runner read the prototype and guide directly.
568
+
569
+ **Context budget:** Limit each task to at most 1-2 HTML prototype @ references
570
+ to manage runner context budget. Multi-screen runs should split screen
571
+ implementations across tasks.
572
+
573
+ For screens marked [NEW]: task implements the full screen from scratch.
574
+ For screens from prior stages that this stage modifies: task modifies the existing implementation to match updated screen spec. Use `git diff .renn/design/screens/{screen-name}.yaml` to see what changed.
575
+
576
+ Tasks that implement UI without referencing their screen spec and HTML
577
+ prototype will produce output inconsistent with the approved design.
578
+
579
+ **Design-fidelity must_haves:** When a run touches UI, include these
580
+ design-fidelity truths in the run's must_haves alongside functional truths:
581
+
582
+ ```yaml
583
+ must_haves:
584
+ truths:
585
+ # Functional truths (stage-specific)
586
+ - "..."
587
+ # Design-fidelity truths (add for UI-touching runs)
588
+ - "All stylekit semantic tokens implemented in project CSS system"
589
+ - "Icon system uses {icon-library-from-guide} not hand-drawn SVGs"
590
+ - "Dark mode uses token overrides not per-component hardcoded values"
591
+ artifacts:
592
+ - path: "{project-globals-css}"
593
+ provides: "Design token system"
594
+ contains: "semantic color tokens from stylekit.yaml"
595
+ key_links:
596
+ - from: "{globals-css}"
597
+ to: "stylekit.yaml"
598
+ via: "CSS custom properties matching token names"
599
+ pattern: "--color-primary|--color-secondary|--color-background"
600
+ ```
601
+
602
+ Omit dark mode truth if stylekit has no dark theme. Replace
603
+ `{icon-library-from-guide}` with the actual icon library from the
604
+ implementation guide. Replace `{project-globals-css}` with the project's
605
+ actual CSS entry point.
606
+
607
+ </planning_context>
608
+
609
+ <downstream_consumer>
610
+ Output consumed by /renn.run-stage
611
+ Runs must be executable prompts with:
612
+
613
+ - Frontmatter (batch, depends_on, files_modified, autonomous)
614
+ - Tasks in XML format
615
+ - Verification criteria
616
+ - must_haves for goal-backward verification
617
+ </downstream_consumer>
618
+
619
+ <quality_gate>
620
+ Before returning ARCHITECTING COMPLETE:
621
+
622
+ - [ ] run.md files created in stage directory
623
+ - [ ] Each run has valid frontmatter
624
+ - [ ] Tasks are specific and actionable
625
+ - [ ] Dependencies correctly identified
626
+ - [ ] Batches assigned for parallel execution
627
+ - [ ] must_haves derived from stage goal
628
+ </quality_gate>
629
+ ```
630
+
631
+ ```
632
+ Task(
633
+ prompt=filled_prompt,
634
+ subagent_type="renn-architect",
635
+ model="{architect_model}",
636
+ description="Plan Stage {stage}"
637
+ )
638
+ ```
639
+
640
+ </step>
641
+
642
+ <step name="handle_architect_return">
643
+ Parse architect output:
644
+
645
+ **`## ARCHITECTING COMPLETE`:**
646
+ - Display: `Architect created {N} run(s). Files on disk.`
647
+ - If `--skip-verify`: Skip to present_final_status
648
+ - Check config: `WORKFLOW_REVIEW=$(cat .renn/config.json 2>/dev/null | grep -o '"review"[[:space:]]*:[[:space:]]*[^,}]*' | grep -o 'true\|false' || echo "true")`
649
+ - If `checks.review` is `false`: Skip to present_final_status
650
+ - Otherwise: Proceed to spawn_reviewer
651
+
652
+ **`## GATE REACHED`:**
653
+ - Present to user, get response, spawn continuation (see revision_loop)
654
+
655
+ **`## ARCHITECTING INCONCLUSIVE`:**
656
+ - Show what was attempted
657
+ - Offer: Add context, Retry, Manual
658
+ - Wait for user response
659
+ </step>
660
+
661
+ <step name="spawn_reviewer">
662
+ Display:
663
+ ```
664
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
665
+ RENN ► VERIFYING RUNS
666
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
667
+
668
+ ◆ Spawning plan reviewer...
669
+ ```
670
+
671
+ Read runs for the reviewer:
672
+
673
+ ```bash
674
+ # Read all runs in stage directory
675
+ RUNS_CONTENT=$(cat "${STAGE_DIR}"/*-run.md 2>/dev/null)
676
+
677
+ # INTEL_CONTENT already loaded in ensure_stage_directory
678
+ # SPECS_CONTENT already loaded in read_context_files
679
+ ```
680
+
681
+ Fill reviewer prompt with inlined content and spawn:
682
+
683
+ ```markdown
684
+ <verification_context>
685
+
686
+ **Stage:** {stage_number}
687
+ **Stage Goal:** {goal from TRACK}
688
+
689
+ **Runs to verify:**
690
+ {runs_content}
691
+
692
+ **Specs (if exists):**
693
+ {specs_content}
694
+
695
+ **Stage Intel (if exists):**
696
+
697
+ IMPORTANT: If stage intel exists below, it contains USER DECISIONS from /renn.discuss-stage.
698
+ Runs MUST honor these decisions. Flag as issue if runs contradict user's stated vision.
699
+
700
+ - **Decisions** = LOCKED — runs must implement these exactly
701
+ - **Claude's Discretion** = Freedom areas — runs can choose approach
702
+ - **Deferred Ideas** = Out of scope — runs must NOT include these
703
+
704
+ {intel_content}
705
+
706
+ </verification_context>
707
+
708
+ <expected_output>
709
+ Return one of:
710
+ - ## VERIFICATION PASSED — all checks pass
711
+ - ## ISSUES FOUND — structured issue list
712
+ </expected_output>
713
+ ```
714
+
715
+ ```
716
+ Task(
717
+ prompt=reviewer_prompt,
718
+ subagent_type="renn-plan-reviewer",
719
+ model="{reviewer_model}",
720
+ description="Verify Stage {stage} runs"
721
+ )
722
+ ```
723
+ </step>
724
+
725
+ <step name="handle_reviewer_return">
726
+ **If `## VERIFICATION PASSED`:**
727
+ - Display: `Runs verified. Ready for execution.`
728
+ - Proceed to present_final_status
729
+
730
+ **If `## ISSUES FOUND`:**
731
+ - Display: `Reviewer found issues:`
732
+ - List issues from reviewer output
733
+ - Check iteration count
734
+ - Proceed to revision_loop
735
+ </step>
736
+
737
+ <step name="revision_loop">
738
+ Track: `iteration_count` (starts at 1 after initial plan + check)
739
+
740
+ **If iteration_count < 3:**
741
+
742
+ Display: `Sending back to architect for revision... (iteration {N}/3)`
743
+
744
+ Read current runs for revision context:
745
+
746
+ ```bash
747
+ RUNS_CONTENT=$(cat "${STAGE_DIR}"/*-run.md 2>/dev/null)
748
+ # INTEL_CONTENT already loaded in ensure_stage_directory
749
+ ```
750
+
751
+ Spawn renn-architect with revision prompt:
752
+
753
+ ```markdown
754
+ <revision_context>
755
+
756
+ **Stage:** {stage_number}
757
+ **Mode:** revision
758
+
759
+ **Existing runs:**
760
+ {runs_content}
761
+
762
+ **Reviewer issues:**
763
+ {structured_issues_from_reviewer}
764
+
765
+ **Stage Intel (if exists):**
766
+
767
+ IMPORTANT: If stage intel exists, revisions MUST still honor user decisions.
768
+
769
+ {intel_content}
770
+
771
+ </revision_context>
772
+
773
+ <instructions>
774
+ Make targeted updates to address reviewer issues.
775
+ Do NOT replan from scratch unless issues are fundamental.
776
+ Revisions must still honor all locked decisions from Stage Intel.
777
+ Return what changed.
778
+ </instructions>
779
+ ```
780
+
781
+ ```
782
+ Task(
783
+ prompt=revision_prompt,
784
+ subagent_type="renn-architect",
785
+ model="{architect_model}",
786
+ description="Revise Stage {stage} runs"
787
+ )
788
+ ```
789
+
790
+ - After architect returns → spawn reviewer again (spawn_reviewer)
791
+ - Increment iteration_count
792
+
793
+ **If iteration_count >= 3:**
794
+
795
+ Display: `Max iterations reached. {N} issues remain:`
796
+ - List remaining issues
797
+
798
+ Offer options:
799
+ 1. Force proceed (execute despite issues)
800
+ 2. Provide guidance (user gives direction, retry)
801
+ 3. Abandon (exit planning)
802
+
803
+ Wait for user response.
804
+ </step>
805
+
806
+ <step name="present_final_status">
807
+ Route to the command's `<offer_next>` section.
808
+ </step>
809
+
810
+ </process>