ralphflow 0.5.0 → 0.5.2
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/README.md +2 -0
- package/dist/{chunk-TCCMQDVT.js → chunk-DOC64TD6.js} +32 -2
- package/dist/ralphflow.js +584 -24
- package/dist/{server-DOSLU36L.js → server-EX5MWYW4.js} +210 -10
- package/package.json +6 -2
- package/src/dashboard/ui/app.js +203 -0
- package/src/dashboard/ui/archives.js +167 -0
- package/src/dashboard/ui/index.html +2 -3210
- package/src/dashboard/ui/loop-detail.js +880 -0
- package/src/dashboard/ui/notifications.js +151 -0
- package/src/dashboard/ui/prompt-builder.js +362 -0
- package/src/dashboard/ui/sidebar.js +97 -0
- package/src/dashboard/ui/state.js +54 -0
- package/src/dashboard/ui/styles.css +2140 -0
- package/src/dashboard/ui/templates.js +1858 -0
- package/src/dashboard/ui/utils.js +115 -0
- package/src/templates/code-implementation/loops/00-story-loop/prompt.md +73 -11
- package/src/templates/code-implementation/loops/01-tasks-loop/prompt.md +51 -2
- package/src/templates/code-implementation/loops/02-delivery-loop/prompt.md +48 -4
- package/src/templates/research/loops/00-discovery-loop/prompt.md +58 -5
- package/src/templates/research/loops/01-research-loop/prompt.md +44 -2
- package/src/templates/research/loops/02-story-loop/prompt.md +42 -1
- package/src/templates/research/loops/03-document-loop/prompt.md +42 -1
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
// Shared utility functions used across dashboard modules.
|
|
2
|
+
|
|
3
|
+
export function esc(s) {
|
|
4
|
+
if (s == null) return '';
|
|
5
|
+
const d = document.createElement('div');
|
|
6
|
+
d.textContent = String(s);
|
|
7
|
+
return d.innerHTML;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export async function fetchJson(url) {
|
|
11
|
+
const res = await fetch(url);
|
|
12
|
+
return res.json();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function renderMarkdown(md) {
|
|
16
|
+
let html = '';
|
|
17
|
+
const lines = md.split('\n');
|
|
18
|
+
let inTable = false;
|
|
19
|
+
let tableHtml = '';
|
|
20
|
+
|
|
21
|
+
for (let i = 0; i < lines.length; i++) {
|
|
22
|
+
const line = lines[i];
|
|
23
|
+
|
|
24
|
+
// Table detection
|
|
25
|
+
if (line.match(/^\|.+\|$/)) {
|
|
26
|
+
if (!inTable) {
|
|
27
|
+
inTable = true;
|
|
28
|
+
tableHtml = '<table>';
|
|
29
|
+
// Header row
|
|
30
|
+
const cells = line.split('|').filter(Boolean).map(c => c.trim());
|
|
31
|
+
tableHtml += '<thead><tr>' + cells.map(c => `<th>${esc(c)}</th>`).join('') + '</tr></thead><tbody>';
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
// Separator row
|
|
35
|
+
if (line.match(/^\|[\s\-|]+\|$/)) continue;
|
|
36
|
+
// Data row
|
|
37
|
+
const cells = line.split('|').filter(Boolean).map(c => c.trim());
|
|
38
|
+
tableHtml += '<tr>' + cells.map(c => `<td>${esc(c)}</td>`).join('') + '</tr>';
|
|
39
|
+
continue;
|
|
40
|
+
} else if (inTable) {
|
|
41
|
+
inTable = false;
|
|
42
|
+
tableHtml += '</tbody></table>';
|
|
43
|
+
html += tableHtml;
|
|
44
|
+
tableHtml = '';
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Headers
|
|
48
|
+
if (line.startsWith('### ')) { html += `<h3>${esc(line.slice(4))}</h3>`; continue; }
|
|
49
|
+
if (line.startsWith('## ')) { html += `<h2>${esc(line.slice(3))}</h2>`; continue; }
|
|
50
|
+
if (line.startsWith('# ')) { html += `<h1>${esc(line.slice(2))}</h1>`; continue; }
|
|
51
|
+
|
|
52
|
+
// Checkboxes
|
|
53
|
+
if (line.match(/^- \[x\]/i)) {
|
|
54
|
+
html += `<div class="cb-done">${esc(line)}</div>`;
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
if (line.match(/^- \[ \]/)) {
|
|
58
|
+
html += `<div class="cb-todo">${esc(line)}</div>`;
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Regular lines
|
|
63
|
+
html += line.trim() === '' ? '<br>' : `<div>${esc(line)}</div>`;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (inTable) {
|
|
67
|
+
tableHtml += '</tbody></table>';
|
|
68
|
+
html += tableHtml;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return html;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function calculatePipelineProgress(loops) {
|
|
75
|
+
const perLoop = [];
|
|
76
|
+
let aggCompleted = 0;
|
|
77
|
+
let aggTotal = 0;
|
|
78
|
+
for (const loop of (loops || [])) {
|
|
79
|
+
const st = loop.status || {};
|
|
80
|
+
const completed = st.completed || 0;
|
|
81
|
+
const total = st.total || 0;
|
|
82
|
+
const fraction = total > 0 ? completed / total : 0;
|
|
83
|
+
perLoop.push({ key: loop.key, completed, total, fraction });
|
|
84
|
+
if (total > 0) {
|
|
85
|
+
aggCompleted += completed;
|
|
86
|
+
aggTotal += total;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
const percentage = aggTotal > 0 ? Math.round(aggCompleted / aggTotal * 100) : 0;
|
|
90
|
+
return { perLoop, completed: aggCompleted, total: aggTotal, percentage };
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export function formatModelName(model) {
|
|
94
|
+
if (!model) return null;
|
|
95
|
+
return model.replace(/^claude-/, '');
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export function getLoopStatusClass(loop) {
|
|
99
|
+
if (!loop.status) return 'pending';
|
|
100
|
+
const st = loop.status;
|
|
101
|
+
if (st.total > 0 && st.completed === st.total) return 'complete';
|
|
102
|
+
if (st.agents && st.agents.length > 0) return 'running';
|
|
103
|
+
if (st.total > 0 && st.completed > 0 && st.completed < st.total) return 'running';
|
|
104
|
+
if (st.stage && st.stage !== '—' && st.stage !== 'idle') return 'running';
|
|
105
|
+
return 'pending';
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export function extractNotifMessage(payload) {
|
|
109
|
+
if (!payload) return 'Attention needed';
|
|
110
|
+
if (typeof payload === 'string') return payload;
|
|
111
|
+
if (payload.message) return payload.message;
|
|
112
|
+
if (payload.type) return payload.type;
|
|
113
|
+
if (payload.event) return payload.event;
|
|
114
|
+
return 'Attention needed';
|
|
115
|
+
}
|
|
@@ -12,13 +12,39 @@ Read `.ralph-flow/{{APP_NAME}}/00-story-loop/tracker.md` FIRST to determine wher
|
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
+
## Visual Communication Protocol
|
|
16
|
+
|
|
17
|
+
When communicating scope, structure, relationships, or status, render **ASCII diagrams** using Unicode box-drawing characters. These help the user see the full picture at the terminal without scrolling through prose.
|
|
18
|
+
|
|
19
|
+
**Character set:** `┌ ─ ┐ │ └ ┘ ├ ┤ ┬ ┴ ┼ ═ ● ○ ▼ ▶`
|
|
20
|
+
|
|
21
|
+
**Diagram types to use:**
|
|
22
|
+
|
|
23
|
+
- **Scope/Architecture Map** — components and their relationships in a bordered grid
|
|
24
|
+
- **Decomposition Tree** — hierarchical breakdown with `├──` and `└──` branches
|
|
25
|
+
- **Data Flow** — arrows (`──→`) showing how information moves between components
|
|
26
|
+
- **Comparison Table** — bordered table for trade-offs and design options
|
|
27
|
+
- **Status Summary** — bordered box with completion indicators (`✓` done, `◌` pending)
|
|
28
|
+
|
|
29
|
+
**Rules:** Keep diagrams under 20 lines and under 70 characters wide. Populate with real data from current context. Render inside fenced code blocks. Use diagrams to supplement, not replace, prose.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
15
33
|
## State Machine (3 stages per story)
|
|
16
34
|
|
|
17
35
|
**FIRST — Check completion.** Read the tracker. If the Stories Queue has entries
|
|
18
|
-
AND every entry is `[x]` (no pending stories)
|
|
19
|
-
|
|
36
|
+
AND every entry is `[x]` (no pending stories):
|
|
37
|
+
1. **Re-scan `stories.md`** — read all `## STORY-{N}:` headers and compare
|
|
38
|
+
against the Stories Queue in the tracker.
|
|
39
|
+
2. **New stories found** (in `stories.md` but not in the queue) → add them as
|
|
40
|
+
`- [ ] STORY-{N}: {title}` to the Stories Queue, update the Dependency Graph
|
|
41
|
+
from their `**Depends on:**` tags, then proceed to process the lowest-numbered
|
|
42
|
+
ready story via the normal state machine.
|
|
43
|
+
3. **No new stories** → go to **"No Stories? Collect Them"** to ask the user.
|
|
44
|
+
|
|
20
45
|
Only write `<promise>ALL STORIES PROCESSED</promise>` when the user explicitly
|
|
21
|
-
confirms they have no more stories to add.
|
|
46
|
+
confirms they have no more stories to add AND `stories.md` has no stories
|
|
47
|
+
missing from the tracker queue.
|
|
22
48
|
|
|
23
49
|
Pick the lowest-numbered `ready` story. NEVER process a `blocked` story.
|
|
24
50
|
|
|
@@ -28,7 +54,8 @@ Pick the lowest-numbered `ready` story. NEVER process a `blocked` story.
|
|
|
28
54
|
|
|
29
55
|
**Triggers when:**
|
|
30
56
|
- `stories.md` has no stories at all (first run, empty queue with no entries), OR
|
|
31
|
-
- All stories in the queue are completed (`[x]`)
|
|
57
|
+
- All stories in the queue are completed (`[x]`), no `pending` stories remain, AND
|
|
58
|
+
`stories.md` has been re-scanned and contains no stories missing from the queue
|
|
32
59
|
|
|
33
60
|
**Flow:**
|
|
34
61
|
1. Tell the user: *"No pending stories. Tell me what you want to build — describe features, problems, or goals in your own words."*
|
|
@@ -45,9 +72,13 @@ CLARIFY → Ask user up to 20 questions (5 at a time) → stage: decompose
|
|
|
45
72
|
DECOMPOSE → Break into TASK-GROUP(s) + tasks, append to tasks.md, mark done → kill
|
|
46
73
|
```
|
|
47
74
|
|
|
48
|
-
## First-Run
|
|
75
|
+
## First-Run / New Story Detection
|
|
49
76
|
|
|
50
|
-
If Stories Queue in tracker is empty
|
|
77
|
+
If Stories Queue in tracker is empty OR all entries are `[x]`: read `stories.md`,
|
|
78
|
+
scan `## STORY-{N}:` headers + `**Depends on:**` tags. For any story NOT already
|
|
79
|
+
in the queue, add as `- [ ] STORY-{N}: {title}` and build/update the Dependency Graph.
|
|
80
|
+
If new stories were added, proceed to process them. If the queue is still empty
|
|
81
|
+
after scanning, go to **"No Stories? Collect Them"**.
|
|
51
82
|
|
|
52
83
|
---
|
|
53
84
|
|
|
@@ -56,23 +87,32 @@ If Stories Queue in tracker is empty: read `stories.md`, scan `## STORY-{N}:` he
|
|
|
56
87
|
1. Read tracker → pick lowest-numbered `ready` story
|
|
57
88
|
2. Read the story from `stories.md` (+ any referenced screenshots)
|
|
58
89
|
3. **Explore the codebase** — read `CLAUDE.md` for project context, then **20+ key files** across the areas this story touches. Understand current behavior, patterns, conventions, and what needs to change.
|
|
59
|
-
4.
|
|
90
|
+
4. **Render a Scope Map** — output an ASCII architecture/scope diagram showing:
|
|
91
|
+
- The areas of the codebase this story touches (components, modules, services)
|
|
92
|
+
- Dependencies and data flow between affected areas
|
|
93
|
+
- What exists today (`●`) vs. what needs to change (`○`)
|
|
94
|
+
5. Update tracker: `active_story: STORY-{N}`, `stage: clarify`, log entry
|
|
60
95
|
|
|
61
96
|
## STAGE 2: CLARIFY
|
|
62
97
|
|
|
63
98
|
1. Formulate questions about scope, priorities, edge cases, design choices
|
|
64
|
-
2. **
|
|
99
|
+
2. **Present understanding diagram first** — render an ASCII scope/architecture diagram showing your understanding of the story's scope. This gives the user a visual anchor to correct misconceptions before answering questions.
|
|
100
|
+
3. **Ask up to 20 questions, 5 at a time** via `AskUserQuestion` — structure each round visually:
|
|
101
|
+
- For multi-option decisions: numbered list with one-line descriptions
|
|
102
|
+
- For design trade-offs: include a **comparison table** showing trade-offs (e.g., approach vs. complexity vs. speed)
|
|
103
|
+
- For scope boundaries: use an in/out list format
|
|
65
104
|
- Round 1: Scope, intent, must-haves
|
|
66
105
|
- Round 2+: Design choices, edge cases, preferences — based on prior answers
|
|
67
106
|
- Stop early if clear enough
|
|
68
|
-
|
|
69
|
-
|
|
107
|
+
4. Save Q&A summary in tracker log
|
|
108
|
+
5. Update tracker: `stage: decompose`, log entry with key decisions
|
|
70
109
|
|
|
71
110
|
## STAGE 3: DECOMPOSE
|
|
72
111
|
|
|
73
112
|
1. Find next TASK-GROUP and TASK numbers (check existing in `01-tasks-loop/tasks.md`)
|
|
74
113
|
2. **Read already-written tasks** — if sibling tasks exist, read them to align scope boundaries
|
|
75
|
-
3.
|
|
114
|
+
3. **Render a Decomposition Tree** — output an ASCII tree showing the planned TASK-GROUP(s) and their tasks, with dependency arrows between tasks that depend on each other
|
|
115
|
+
4. Break story into TASK-GROUP(s) — one per distinct functional area, 2-6 tasks each
|
|
76
116
|
4. For each task, ask yourself: *What does success look like? How would someone confirm? What could silently break?*
|
|
77
117
|
5. **Sanity-check:** Do NOT embed specific file paths in tasks — describe *what* changes, not *where*. The tasks loop will explore the codebase itself.
|
|
78
118
|
6. Append to `01-tasks-loop/tasks.md` (format below)
|
|
@@ -134,6 +174,28 @@ If Stories Queue in tracker is empty: read `stories.md`, scan `## STORY-{N}:` he
|
|
|
134
174
|
|
|
135
175
|
---
|
|
136
176
|
|
|
177
|
+
## Decision Reporting Protocol
|
|
178
|
+
|
|
179
|
+
When you make a substantive decision a human reviewer would want to know about, report it to the dashboard:
|
|
180
|
+
|
|
181
|
+
**When to report:**
|
|
182
|
+
- Scope boundary decisions (included/excluded functionality from a story)
|
|
183
|
+
- Approach choices (why you decomposed tasks one way vs. another)
|
|
184
|
+
- Trade-off resolutions (prioritizing one concern over another)
|
|
185
|
+
- Interpretation of ambiguous requirements (how you resolved unclear user intent)
|
|
186
|
+
- Self-answered clarification questions (questions you could have asked but resolved yourself)
|
|
187
|
+
|
|
188
|
+
**How to report:**
|
|
189
|
+
```bash
|
|
190
|
+
curl -s --connect-timeout 2 --max-time 5 -X POST "http://127.0.0.1:4242/api/decision?app=$RALPHFLOW_APP&loop=$RALPHFLOW_LOOP" -H 'Content-Type: application/json' -d '{"item":"STORY-{N}","agent":"story-loop","decision":"{one-line summary}","reasoning":"{why this choice}"}'
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
**Do NOT report** routine operations: picking the next story, updating tracker, stage transitions, heartbeat updates. Only report substantive choices that affect the work product.
|
|
194
|
+
|
|
195
|
+
**Best-effort only:** If the dashboard is unreachable (curl fails), continue working normally. Decision reporting must never block or delay your work.
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
137
199
|
## Rules
|
|
138
200
|
|
|
139
201
|
- One story at a time. All 3 stages run in one iteration, one `kill` at the end.
|
|
@@ -14,6 +14,24 @@ Read `.ralph-flow/{{APP_NAME}}/01-tasks-loop/tracker.md` FIRST to determine wher
|
|
|
14
14
|
|
|
15
15
|
---
|
|
16
16
|
|
|
17
|
+
## Visual Communication Protocol
|
|
18
|
+
|
|
19
|
+
When communicating scope, structure, relationships, or status, render **ASCII diagrams** using Unicode box-drawing characters. These help the user see the full picture at the terminal without scrolling through prose.
|
|
20
|
+
|
|
21
|
+
**Character set:** `┌ ─ ┐ │ └ ┘ ├ ┤ ┬ ┴ ┼ ═ ● ○ ▼ ▶`
|
|
22
|
+
|
|
23
|
+
**Diagram types to use:**
|
|
24
|
+
|
|
25
|
+
- **Scope/Architecture Map** — components and their relationships in a bordered grid
|
|
26
|
+
- **Decomposition Tree** — hierarchical breakdown with `├──` and `└──` branches
|
|
27
|
+
- **Data Flow** — arrows (`──→`) showing how information moves between components
|
|
28
|
+
- **Comparison Table** — bordered table for trade-offs and design options
|
|
29
|
+
- **Status Summary** — bordered box with completion indicators (`✓` done, `◌` pending)
|
|
30
|
+
|
|
31
|
+
**Rules:** Keep diagrams under 20 lines and under 70 characters wide. Populate with real data from current context. Render inside fenced code blocks. Use diagrams to supplement, not replace, prose.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
17
35
|
## Tracker Lock Protocol
|
|
18
36
|
|
|
19
37
|
Before ANY write to `tracker.md`, you MUST acquire the lock:
|
|
@@ -112,7 +130,11 @@ After completing ANY stage, exit: `kill -INT $PPID`
|
|
|
112
130
|
3. If sibling tasks are done, read their commits/diffs to align
|
|
113
131
|
4. Read `CLAUDE.md` for project context
|
|
114
132
|
5. Explore codebase — **40+ files:** affected areas, dependencies, patterns
|
|
115
|
-
6.
|
|
133
|
+
6. **Render an Implementation Map** — output an ASCII diagram showing:
|
|
134
|
+
- Files/modules to create or modify (grouped by area)
|
|
135
|
+
- Data flow or control flow for the change
|
|
136
|
+
- How this task's changes connect to sibling tasks in the group
|
|
137
|
+
7. Acquire lock → update tracker: your Agent Status row `active_task: TASK-{N}`, `stage: execute`, `last_heartbeat`, log entry → release lock
|
|
116
138
|
7. Implement changes. Match existing patterns per `CLAUDE.md`.
|
|
117
139
|
8. Deploy/rebuild (commands in `CLAUDE.md`)
|
|
118
140
|
9. **Quick verify:** check container logs for errors, hit health endpoints, confirm no crashes
|
|
@@ -126,7 +148,11 @@ After completing ANY stage, exit: `kill -INT $PPID`
|
|
|
126
148
|
3. **Functional verify:** test the actual change — hit new/modified endpoints, check DB state, verify expected behavior through CLI/curl/API calls
|
|
127
149
|
4. **FAIL** → fix the issue, re-deploy, re-verify. If stuck, log details in tracker and move on
|
|
128
150
|
5. **PASS** → continue to documentation
|
|
129
|
-
6.
|
|
151
|
+
6. **Render a Completion Summary** — output an ASCII status diagram showing:
|
|
152
|
+
- What was built/changed (files, endpoints, components)
|
|
153
|
+
- Verification results (pass/fail per acceptance criterion)
|
|
154
|
+
- How this task fits in the TASK-GROUP progress
|
|
155
|
+
7. Update `CLAUDE.md` (≤150 words net). Commit separately.
|
|
130
156
|
7. Create/update `.claude/skills/` if this task produced reusable knowledge. Skip if nothing reusable.
|
|
131
157
|
8. **Mark done & unblock dependents:**
|
|
132
158
|
- Acquire lock
|
|
@@ -149,6 +175,29 @@ After completing ANY stage, exit: `kill -INT $PPID`
|
|
|
149
175
|
|
|
150
176
|
If Tasks Queue in tracker is empty: read `tasks.md`, scan `## TASK-{N}:` headers, populate queue with `{agent: -, status: pending|blocked}` metadata (compute from Dependencies), then start.
|
|
151
177
|
|
|
178
|
+
## Decision Reporting Protocol
|
|
179
|
+
|
|
180
|
+
When you make a substantive decision a human reviewer would want to know about, report it to the dashboard:
|
|
181
|
+
|
|
182
|
+
**When to report:**
|
|
183
|
+
- Scope boundary decisions (what's included/excluded from the task)
|
|
184
|
+
- Approach choices (implementation strategy, library selection, architecture decisions)
|
|
185
|
+
- Trade-off resolutions (performance vs. readability, scope vs. complexity)
|
|
186
|
+
- Interpretation of ambiguous requirements (how you resolved unclear task intent)
|
|
187
|
+
- Self-answered clarification questions (questions you could have asked but resolved yourself)
|
|
188
|
+
- File overlap or conflict decisions (how you handled shared files with other agents)
|
|
189
|
+
|
|
190
|
+
**How to report:**
|
|
191
|
+
```bash
|
|
192
|
+
curl -s --connect-timeout 2 --max-time 5 -X POST "http://127.0.0.1:4242/api/decision?app=$RALPHFLOW_APP&loop=$RALPHFLOW_LOOP" -H 'Content-Type: application/json' -d '{"item":"TASK-{N}","agent":"{{AGENT_NAME}}","decision":"{one-line summary}","reasoning":"{why this choice}"}'
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
**Do NOT report** routine operations: claiming a task, updating heartbeat, stage transitions, waiting for blocked tasks. Only report substantive choices that affect the implementation.
|
|
196
|
+
|
|
197
|
+
**Best-effort only:** If the dashboard is unreachable (curl fails), continue working normally. Decision reporting must never block or delay your work.
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
152
201
|
## Rules
|
|
153
202
|
|
|
154
203
|
- One task at a time per agent. One stage per iteration.
|
|
@@ -12,6 +12,24 @@ Read `.ralph-flow/{{APP_NAME}}/02-delivery-loop/tracker.md` FIRST to determine w
|
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
+
## Visual Communication Protocol
|
|
16
|
+
|
|
17
|
+
When communicating scope, structure, relationships, or status, render **ASCII diagrams** using Unicode box-drawing characters. These help the user see the full picture at the terminal without scrolling through prose.
|
|
18
|
+
|
|
19
|
+
**Character set:** `┌ ─ ┐ │ └ ┘ ├ ┤ ┬ ┴ ┼ ═ ● ○ ▼ ▶`
|
|
20
|
+
|
|
21
|
+
**Diagram types to use:**
|
|
22
|
+
|
|
23
|
+
- **Scope/Architecture Map** — components and their relationships in a bordered grid
|
|
24
|
+
- **Decomposition Tree** — hierarchical breakdown with `├──` and `└──` branches
|
|
25
|
+
- **Data Flow** — arrows (`──→`) showing how information moves between components
|
|
26
|
+
- **Comparison Table** — bordered table for trade-offs and design options
|
|
27
|
+
- **Status Summary** — bordered box with completion indicators (`✓` done, `◌` pending)
|
|
28
|
+
|
|
29
|
+
**Rules:** Keep diagrams under 20 lines and under 70 characters wide. Populate with real data from current context. Render inside fenced code blocks. Use diagrams to supplement, not replace, prose.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
15
33
|
## First-Run Handling
|
|
16
34
|
|
|
17
35
|
If Delivery Queue is empty, build it by scanning the task tracker:
|
|
@@ -47,18 +65,23 @@ Phase 1 → Phase 2 flows continuously in one iteration (no kill between them).
|
|
|
47
65
|
2. Read phase plans from `01-tasks-loop/phases/`
|
|
48
66
|
3. Read `CLAUDE.md` for project context
|
|
49
67
|
4. **Review independently:** Walk through each task's verification steps. Note anything wrong, broken, or inconsistent. Build a presentation narrative.
|
|
50
|
-
5.
|
|
68
|
+
5. **Build a Delivery Diagram** — prepare an ASCII diagram for presentation showing:
|
|
69
|
+
- All task-groups in this story with completion status
|
|
70
|
+
- Per-task status (`✓` done, `✗` cancelled, `!` issues found)
|
|
71
|
+
- Data flow or architecture of what was built
|
|
72
|
+
6. For cancelled tasks/groups: note what was superseded and why
|
|
51
73
|
6. Record review notes in tracker log
|
|
52
74
|
7. Update tracker: `active_story: STORY-{N}`, `stage: present-and-feedback`
|
|
53
75
|
8. **Flow directly into Phase 2** (no stop)
|
|
54
76
|
|
|
55
77
|
## PHASE 2: PRESENT-AND-FEEDBACK (combined, one AskUserQuestion call)
|
|
56
78
|
|
|
57
|
-
1. **Present structured walkthrough
|
|
58
|
-
-
|
|
79
|
+
1. **Present structured walkthrough with diagrams:**
|
|
80
|
+
- Open with an ASCII **architecture/scope diagram** showing what was built (components, data flow, integrations)
|
|
81
|
+
- Per task-group: what was built (plain language), completion status, how to verify it
|
|
59
82
|
- Any issues the agent found during Phase 1 review
|
|
60
83
|
- Cancelled tasks/groups with brief explanation of what was superseded
|
|
61
|
-
2. **Ask 3-4 questions in ONE `AskUserQuestion` call
|
|
84
|
+
2. **Ask 3-4 questions in ONE `AskUserQuestion` call** — use visual grouping:
|
|
62
85
|
- **Q1: Working correctly?** Does everything work as expected? Note any specific issues.
|
|
63
86
|
- **Q2: Behavior or appearance?** Anything to change about look, feel, or behavior?
|
|
64
87
|
- **Q3: Missing or new ideas?** Anything missing, or new ideas sparked by what you see?
|
|
@@ -92,6 +115,27 @@ After resolving all feedback:
|
|
|
92
115
|
|
|
93
116
|
---
|
|
94
117
|
|
|
118
|
+
## Decision Reporting Protocol
|
|
119
|
+
|
|
120
|
+
When you make a substantive decision a human reviewer would want to know about, report it to the dashboard:
|
|
121
|
+
|
|
122
|
+
**When to report:**
|
|
123
|
+
- Feedback categorization decisions (classifying feedback as BUG vs. CHANGE)
|
|
124
|
+
- Scope decisions during bug fixes (what to fix now vs. defer to a new story)
|
|
125
|
+
- Presentation choices (how you framed or organized the walkthrough)
|
|
126
|
+
- Trade-off resolutions when multiple feedback items conflict
|
|
127
|
+
|
|
128
|
+
**How to report:**
|
|
129
|
+
```bash
|
|
130
|
+
curl -s --connect-timeout 2 --max-time 5 -X POST "http://127.0.0.1:4242/api/decision?app=$RALPHFLOW_APP&loop=$RALPHFLOW_LOOP" -H 'Content-Type: application/json' -d '{"item":"STORY-{N}","agent":"delivery-loop","decision":"{one-line summary}","reasoning":"{why this choice}"}'
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**Do NOT report** routine operations: picking the next story, updating tracker, phase transitions. Only report substantive choices that affect the delivery outcome.
|
|
134
|
+
|
|
135
|
+
**Best-effort only:** If the dashboard is unreachable (curl fails), continue working normally. Decision reporting must never block or delay your work.
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
95
139
|
## Rules
|
|
96
140
|
|
|
97
141
|
- One STORY at a time. All 3 phases run in one iteration, one `kill` at the end.
|
|
@@ -12,13 +12,37 @@ Read `.ralph-flow/{{APP_NAME}}/00-discovery-loop/tracker.md` FIRST to determine
|
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
+
## Visual Communication Protocol
|
|
16
|
+
|
|
17
|
+
When communicating scope, structure, relationships, or status, render **ASCII diagrams** using Unicode box-drawing characters. These help the user see the full picture at the terminal without scrolling through prose.
|
|
18
|
+
|
|
19
|
+
**Character set:** `┌ ─ ┐ │ └ ┘ ├ ┤ ┬ ┴ ┼ ═ ● ○ ▼ ▶`
|
|
20
|
+
|
|
21
|
+
**Diagram types to use:**
|
|
22
|
+
|
|
23
|
+
- **Scope/Architecture Map** — components and their relationships in a bordered grid
|
|
24
|
+
- **Decomposition Tree** — hierarchical breakdown with `├──` and `└──` branches
|
|
25
|
+
- **Data Flow** — arrows (`──→`) showing how information moves between components
|
|
26
|
+
- **Comparison Table** — bordered table for trade-offs and design options
|
|
27
|
+
- **Status Summary** — bordered box with completion indicators (`✓` done, `◌` pending)
|
|
28
|
+
|
|
29
|
+
**Rules:** Keep diagrams under 20 lines and under 70 characters wide. Populate with real data from current context. Render inside fenced code blocks. Use diagrams to supplement, not replace, prose.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
15
33
|
## No Brief? Collect One
|
|
16
34
|
|
|
35
|
+
If the tracker queue has entries and all are `[x]`:
|
|
36
|
+
1. **Re-scan `topics.md`** — read all `## TOPIC-{N}:` headers and compare against
|
|
37
|
+
the Topics Queue in the tracker. If new topics found, add them as
|
|
38
|
+
`- [ ] TOPIC-{N}: {title}` with appropriate metadata and proceed to process them.
|
|
39
|
+
2. **No new topics** → proceed to "No Brief? Collect One" below.
|
|
40
|
+
|
|
17
41
|
If `topics.md` has no unprocessed topics and the tracker queue is empty/all done:
|
|
18
42
|
1. Tell the user: *"No research brief found. Tell me what you want to research — describe questions, problems, or domains you want to understand."*
|
|
19
43
|
2. Use `AskUserQuestion` to prompt: "What do you want to research or understand?" (open-ended)
|
|
20
44
|
3. As the user narrates, capture the research brief in tracker log under `## Research Brief`
|
|
21
|
-
4. **Confirm scope** —
|
|
45
|
+
4. **Confirm scope with a visual summary** — render an ASCII scope map showing the research boundaries, then use `AskUserQuestion` (up to 5 questions) to validate: correct scope? right depth? any areas to include/exclude? target audience? desired output format (PDF, PPT, document)?
|
|
22
46
|
5. Apply corrections, finalize brief, proceed to normal flow
|
|
23
47
|
|
|
24
48
|
---
|
|
@@ -31,9 +55,14 @@ EXPLORE → Search broadly for sub-domains, angles, key questions → stage: de
|
|
|
31
55
|
DECOMPOSE → Break into TOPIC entries, write to topics.md, seed research tracker → kill
|
|
32
56
|
```
|
|
33
57
|
|
|
34
|
-
## First-Run
|
|
58
|
+
## First-Run / New Topic Detection
|
|
35
59
|
|
|
36
|
-
If Topics Queue in tracker is empty
|
|
60
|
+
If Topics Queue in tracker is empty OR all entries are `[x]`: read `topics.md`,
|
|
61
|
+
scan `## TOPIC-{N}:` headers + `**Depends on:**` tags. For any topic NOT already
|
|
62
|
+
in the queue, add as `- [ ] TOPIC-{N}: {title}` with appropriate metadata, and
|
|
63
|
+
update Dependencies. If new topics were added, proceed to process them.
|
|
64
|
+
If the queue remains empty and Research Brief exists: proceed to SCOPE.
|
|
65
|
+
If Topics Queue is populated with unchecked items, check for remaining unprocessed items.
|
|
37
66
|
|
|
38
67
|
---
|
|
39
68
|
|
|
@@ -46,7 +75,8 @@ If Topics Queue in tracker is empty and Research Brief exists: proceed to SCOPE.
|
|
|
46
75
|
- What depth is needed (surface survey vs. deep dive)
|
|
47
76
|
- Who is the audience (technical, executive, public)
|
|
48
77
|
- What output format is expected
|
|
49
|
-
4.
|
|
78
|
+
4. **Render a Scope Map** — output an ASCII diagram showing research domain boundaries (in-scope vs. out), key sub-domains identified, audience and depth indicators
|
|
79
|
+
5. Update tracker: `stage: explore`, log entry with scope decisions
|
|
50
80
|
|
|
51
81
|
## STAGE 2: EXPLORE
|
|
52
82
|
|
|
@@ -61,7 +91,8 @@ If Topics Queue in tracker is empty and Research Brief exists: proceed to SCOPE.
|
|
|
61
91
|
## STAGE 3: DECOMPOSE
|
|
62
92
|
|
|
63
93
|
1. Find next TOPIC numbers (check existing in `00-discovery-loop/topics.md`)
|
|
64
|
-
2.
|
|
94
|
+
2. **Render a Topic Tree** — output an ASCII decomposition tree showing all planned topics with priority markers (H/M/L), dependency arrows between topics, and estimated depth indicators (surface/moderate/deep)
|
|
95
|
+
3. Break the research space into **5-15 specific topics**, each:
|
|
65
96
|
- Independently researchable by a single agent
|
|
66
97
|
- Specific enough to produce focused findings (not "research everything about X")
|
|
67
98
|
- Clearly scoped with guiding questions
|
|
@@ -107,6 +138,28 @@ If all topics have been discovered and queue is empty: `<promise>ALL TOPICS DISC
|
|
|
107
138
|
|
|
108
139
|
---
|
|
109
140
|
|
|
141
|
+
## Decision Reporting Protocol
|
|
142
|
+
|
|
143
|
+
When you make a substantive decision a human reviewer would want to know about, report it to the dashboard:
|
|
144
|
+
|
|
145
|
+
**When to report:**
|
|
146
|
+
- Scope boundary decisions (what's in/out of the research scope)
|
|
147
|
+
- Topic decomposition choices (why topics were split a certain way)
|
|
148
|
+
- Priority assignments (why a topic is high vs. medium vs. low priority)
|
|
149
|
+
- Depth decisions (surface vs. deep investigation for specific areas)
|
|
150
|
+
- Dependency structure choices (why certain topics must precede others)
|
|
151
|
+
|
|
152
|
+
**How to report:**
|
|
153
|
+
```bash
|
|
154
|
+
curl -s --connect-timeout 2 --max-time 5 -X POST "http://127.0.0.1:4242/api/decision?app=$RALPHFLOW_APP&loop=$RALPHFLOW_LOOP" -H 'Content-Type: application/json' -d '{"item":"TOPIC-{N}","agent":"discovery-loop","decision":"{one-line summary}","reasoning":"{why this choice}"}'
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
**Do NOT report** routine operations: updating tracker, stage transitions. Only report substantive choices that affect the research direction.
|
|
158
|
+
|
|
159
|
+
**Best-effort only:** If the dashboard is unreachable (curl fails), continue working normally. Decision reporting must never block or delay your work.
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
110
163
|
## Rules
|
|
111
164
|
|
|
112
165
|
- One research brief at a time. All 3 stages run in one iteration, one `kill` at the end.
|
|
@@ -14,6 +14,24 @@ Read `.ralph-flow/{{APP_NAME}}/01-research-loop/tracker.md` FIRST to determine w
|
|
|
14
14
|
|
|
15
15
|
---
|
|
16
16
|
|
|
17
|
+
## Visual Communication Protocol
|
|
18
|
+
|
|
19
|
+
When communicating scope, structure, relationships, or status, render **ASCII diagrams** using Unicode box-drawing characters. These help the user see the full picture at the terminal without scrolling through prose.
|
|
20
|
+
|
|
21
|
+
**Character set:** `┌ ─ ┐ │ └ ┘ ├ ┤ ┬ ┴ ┼ ═ ● ○ ▼ ▶`
|
|
22
|
+
|
|
23
|
+
**Diagram types to use:**
|
|
24
|
+
|
|
25
|
+
- **Scope/Architecture Map** — components and their relationships in a bordered grid
|
|
26
|
+
- **Decomposition Tree** — hierarchical breakdown with `├──` and `└──` branches
|
|
27
|
+
- **Data Flow** — arrows (`──→`) showing how information moves between components
|
|
28
|
+
- **Comparison Table** — bordered table for trade-offs and design options
|
|
29
|
+
- **Status Summary** — bordered box with completion indicators (`✓` done, `◌` pending)
|
|
30
|
+
|
|
31
|
+
**Rules:** Keep diagrams under 20 lines and under 70 characters wide. Populate with real data from current context. Render inside fenced code blocks. Use diagrams to supplement, not replace, prose.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
17
35
|
## Tracker Lock Protocol
|
|
18
36
|
|
|
19
37
|
Before ANY write to `tracker.md`, you MUST acquire the lock:
|
|
@@ -117,7 +135,8 @@ After completing ANY stage, exit: `kill -INT $PPID`
|
|
|
117
135
|
- Note data points, statistics, quotes, and source URLs
|
|
118
136
|
- If the topic requires it, explore primary sources (government sites, official reports)
|
|
119
137
|
6. **Organize raw notes** — keep structured scratch notes as you research
|
|
120
|
-
7.
|
|
138
|
+
7. **Render an Evidence Map** — output an ASCII diagram showing key findings organized by sub-theme, source quality indicators, consensus vs. disagreement areas, and gaps that need attention
|
|
139
|
+
8. Acquire lock → update tracker: `stage: synthesize`, `last_heartbeat`, log entry → release lock
|
|
121
140
|
8. Exit: `kill -INT $PPID`
|
|
122
141
|
|
|
123
142
|
## STAGE 2: SYNTHESIZE
|
|
@@ -128,7 +147,8 @@ After completing ANY stage, exit: `kill -INT $PPID`
|
|
|
128
147
|
- Include specific data points, statistics, and source citations
|
|
129
148
|
- Note confidence level for each key claim
|
|
130
149
|
- Flag gaps — what couldn't be found, what needs primary research
|
|
131
|
-
3.
|
|
150
|
+
3. **Render a Findings Summary** — output an ASCII status diagram showing key claims with confidence levels (H/M/L), how this topic connects to sibling topics, and gaps flagged for follow-up
|
|
151
|
+
4. Acquire lock:
|
|
132
152
|
- Add topic to `completed_topics` list
|
|
133
153
|
- Check off topic in Topics Queue: `[x]`, set `{completed}`
|
|
134
154
|
- **Unblock dependents:** for each topic in `## Dependencies` that lists the just-completed topic, check if ALL its dependencies are now in `completed_topics`. If yes, update that topic's status from `blocked` → `pending`
|
|
@@ -170,6 +190,28 @@ After completing ANY stage, exit: `kill -INT $PPID`
|
|
|
170
190
|
|
|
171
191
|
If Topics Queue in tracker is empty: read `topics.md`, scan `## TOPIC-{N}:` headers + `**Depends on:**` tags, populate queue with `{agent: -, status: pending|blocked}` metadata, then start.
|
|
172
192
|
|
|
193
|
+
## Decision Reporting Protocol
|
|
194
|
+
|
|
195
|
+
When you make a substantive decision a human reviewer would want to know about, report it to the dashboard:
|
|
196
|
+
|
|
197
|
+
**When to report:**
|
|
198
|
+
- Research direction choices (which angles to pursue vs. skip)
|
|
199
|
+
- Source credibility judgments (why you trusted or dismissed a source)
|
|
200
|
+
- Scope boundary decisions (what's in/out for this topic's investigation)
|
|
201
|
+
- Conflicting evidence resolution (how you weighed contradictory findings)
|
|
202
|
+
- Gap identification decisions (what couldn't be found and whether to flag it)
|
|
203
|
+
|
|
204
|
+
**How to report:**
|
|
205
|
+
```bash
|
|
206
|
+
curl -s --connect-timeout 2 --max-time 5 -X POST "http://127.0.0.1:4242/api/decision?app=$RALPHFLOW_APP&loop=$RALPHFLOW_LOOP" -H 'Content-Type: application/json' -d '{"item":"TOPIC-{N}","agent":"{{AGENT_NAME}}","decision":"{one-line summary}","reasoning":"{why this choice}"}'
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
**Do NOT report** routine operations: claiming a topic, updating heartbeat, stage transitions, waiting for blocked topics. Only report substantive choices that affect the research findings.
|
|
210
|
+
|
|
211
|
+
**Best-effort only:** If the dashboard is unreachable (curl fails), continue working normally. Decision reporting must never block or delay your work.
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
173
215
|
## Rules
|
|
174
216
|
|
|
175
217
|
- One topic at a time per agent. One stage per iteration.
|
|
@@ -12,6 +12,24 @@ Read `.ralph-flow/{{APP_NAME}}/02-story-loop/tracker.md` FIRST to determine wher
|
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
+
## Visual Communication Protocol
|
|
16
|
+
|
|
17
|
+
When communicating scope, structure, relationships, or status, render **ASCII diagrams** using Unicode box-drawing characters. These help the user see the full picture at the terminal without scrolling through prose.
|
|
18
|
+
|
|
19
|
+
**Character set:** `┌ ─ ┐ │ └ ┘ ├ ┤ ┬ ┴ ┼ ═ ● ○ ▼ ▶`
|
|
20
|
+
|
|
21
|
+
**Diagram types to use:**
|
|
22
|
+
|
|
23
|
+
- **Scope/Architecture Map** — components and their relationships in a bordered grid
|
|
24
|
+
- **Decomposition Tree** — hierarchical breakdown with `├──` and `└──` branches
|
|
25
|
+
- **Data Flow** — arrows (`──→`) showing how information moves between components
|
|
26
|
+
- **Comparison Table** — bordered table for trade-offs and design options
|
|
27
|
+
- **Status Summary** — bordered box with completion indicators (`✓` done, `◌` pending)
|
|
28
|
+
|
|
29
|
+
**Rules:** Keep diagrams under 20 lines and under 70 characters wide. Populate with real data from current context. Render inside fenced code blocks. Use diagrams to supplement, not replace, prose.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
15
33
|
## No Findings? Wait
|
|
16
34
|
|
|
17
35
|
If `findings.md` has no unprocessed findings and the tracker queue is empty/all done:
|
|
@@ -47,7 +65,8 @@ If Stories Queue in tracker is empty:
|
|
|
47
65
|
1. Read tracker → pick next unprocessed story from queue
|
|
48
66
|
2. Read ALL source findings for this story from `findings.md`
|
|
49
67
|
3. Read completed stories from `stories.md` to maintain consistency and avoid repetition
|
|
50
|
-
4. **
|
|
68
|
+
4. **Render a Narrative Map** — output an ASCII diagram showing source findings and how they connect to this story's theme, the narrative arc (hook → evidence → implications), and how this story relates to other completed/planned stories
|
|
69
|
+
5. **Draft the narrative:**
|
|
51
70
|
- Open with a compelling hook or framing question
|
|
52
71
|
- Build the argument/narrative logically
|
|
53
72
|
- Weave in specific data points, statistics, and evidence from findings
|
|
@@ -96,6 +115,28 @@ If all stories written: `<promise>ALL STORIES WRITTEN</promise>`
|
|
|
96
115
|
|
|
97
116
|
---
|
|
98
117
|
|
|
118
|
+
## Decision Reporting Protocol
|
|
119
|
+
|
|
120
|
+
When you make a substantive decision a human reviewer would want to know about, report it to the dashboard:
|
|
121
|
+
|
|
122
|
+
**When to report:**
|
|
123
|
+
- Theme grouping decisions (why findings were clustered into specific stories)
|
|
124
|
+
- Narrative framing choices (how you chose to frame the story's angle)
|
|
125
|
+
- Evidence weighting (which data points to emphasize vs. downplay)
|
|
126
|
+
- Audience adaptation decisions (how you adjusted tone or depth for the target audience)
|
|
127
|
+
- Scope decisions (what to include/exclude from a story's narrative)
|
|
128
|
+
|
|
129
|
+
**How to report:**
|
|
130
|
+
```bash
|
|
131
|
+
curl -s --connect-timeout 2 --max-time 5 -X POST "http://127.0.0.1:4242/api/decision?app=$RALPHFLOW_APP&loop=$RALPHFLOW_LOOP" -H 'Content-Type: application/json' -d '{"item":"STORY-{N}","agent":"story-loop","decision":"{one-line summary}","reasoning":"{why this choice}"}'
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
**Do NOT report** routine operations: picking the next story, updating tracker, stage transitions. Only report substantive choices that affect the story content.
|
|
135
|
+
|
|
136
|
+
**Best-effort only:** If the dashboard is unreachable (curl fails), continue working normally. Decision reporting must never block or delay your work.
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
99
140
|
## Rules
|
|
100
141
|
|
|
101
142
|
- One story at a time. Both stages run in one iteration, one `kill` at the end.
|