ralphflow 0.5.1 → 0.5.3
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/dist/{chunk-DOC64TD6.js → chunk-CA4XP6KI.js} +1 -1
- package/dist/ralphflow.js +237 -28
- package/dist/{server-EX5MWYW4.js → server-64NQCIKJ.js} +88 -21
- package/package.json +1 -1
- package/src/dashboard/ui/app.js +4 -1
- package/src/dashboard/ui/archives.js +27 -2
- package/src/dashboard/ui/index.html +1 -1
- package/src/dashboard/ui/loop-detail.js +1 -1
- package/src/dashboard/ui/prompt-builder.js +39 -4
- package/src/dashboard/ui/sidebar.js +1 -1
- package/src/dashboard/ui/state.js +3 -0
- package/src/dashboard/ui/styles.css +77 -0
- package/src/dashboard/ui/templates.js +3 -0
- package/src/dashboard/ui/utils.js +30 -0
- package/src/templates/code-implementation/loops/00-story-loop/prompt.md +51 -11
- package/src/templates/code-implementation/loops/01-tasks-loop/prompt.md +28 -2
- package/src/templates/code-implementation/loops/02-delivery-loop/prompt.md +27 -4
- package/src/templates/code-review/loops/00-collect-loop/changesets.md +3 -0
- package/src/templates/code-review/loops/00-collect-loop/prompt.md +179 -0
- package/src/templates/code-review/loops/00-collect-loop/tracker.md +16 -0
- package/src/templates/code-review/loops/01-spec-review-loop/prompt.md +238 -0
- package/src/templates/code-review/loops/01-spec-review-loop/tracker.md +16 -0
- package/src/templates/code-review/loops/02-quality-review-loop/issues.md +3 -0
- package/src/templates/code-review/loops/02-quality-review-loop/prompt.md +306 -0
- package/src/templates/code-review/loops/02-quality-review-loop/tracker.md +16 -0
- package/src/templates/code-review/loops/03-fix-loop/prompt.md +265 -0
- package/src/templates/code-review/loops/03-fix-loop/tracker.md +16 -0
- package/src/templates/code-review/ralphflow.yaml +98 -0
- package/src/templates/design-review/loops/00-explore-loop/ideas.md +3 -0
- package/src/templates/design-review/loops/00-explore-loop/prompt.md +207 -0
- package/src/templates/design-review/loops/00-explore-loop/tracker.md +16 -0
- package/src/templates/design-review/loops/01-design-loop/designs.md +3 -0
- package/src/templates/design-review/loops/01-design-loop/prompt.md +201 -0
- package/src/templates/design-review/loops/01-design-loop/tracker.md +16 -0
- package/src/templates/design-review/loops/02-review-loop/prompt.md +255 -0
- package/src/templates/design-review/loops/02-review-loop/tracker.md +16 -0
- package/src/templates/design-review/loops/03-plan-loop/plans.md +3 -0
- package/src/templates/design-review/loops/03-plan-loop/prompt.md +247 -0
- package/src/templates/design-review/loops/03-plan-loop/tracker.md +16 -0
- package/src/templates/design-review/ralphflow.yaml +84 -0
- package/src/templates/research/loops/00-discovery-loop/prompt.md +36 -5
- package/src/templates/research/loops/01-research-loop/prompt.md +22 -2
- package/src/templates/research/loops/02-story-loop/prompt.md +20 -1
- package/src/templates/research/loops/03-document-loop/prompt.md +20 -1
- package/src/templates/systematic-debugging/loops/00-investigate-loop/bugs.md +3 -0
- package/src/templates/systematic-debugging/loops/00-investigate-loop/prompt.md +237 -0
- package/src/templates/systematic-debugging/loops/00-investigate-loop/tracker.md +16 -0
- package/src/templates/systematic-debugging/loops/01-hypothesize-loop/hypotheses.md +3 -0
- package/src/templates/systematic-debugging/loops/01-hypothesize-loop/prompt.md +312 -0
- package/src/templates/systematic-debugging/loops/01-hypothesize-loop/tracker.md +18 -0
- package/src/templates/systematic-debugging/loops/02-fix-loop/fixes.md +3 -0
- package/src/templates/systematic-debugging/loops/02-fix-loop/prompt.md +342 -0
- package/src/templates/systematic-debugging/loops/02-fix-loop/tracker.md +18 -0
- package/src/templates/systematic-debugging/ralphflow.yaml +81 -0
- package/src/templates/tdd-implementation/loops/00-spec-loop/prompt.md +208 -0
- package/src/templates/tdd-implementation/loops/00-spec-loop/specs.md +3 -0
- package/src/templates/tdd-implementation/loops/00-spec-loop/tracker.md +16 -0
- package/src/templates/tdd-implementation/loops/01-tdd-loop/prompt.md +323 -0
- package/src/templates/tdd-implementation/loops/01-tdd-loop/test-cases.md +3 -0
- package/src/templates/tdd-implementation/loops/01-tdd-loop/tracker.md +18 -0
- package/src/templates/tdd-implementation/loops/02-verify-loop/prompt.md +226 -0
- package/src/templates/tdd-implementation/loops/02-verify-loop/tracker.md +16 -0
- package/src/templates/tdd-implementation/loops/02-verify-loop/verifications.md +3 -0
- package/src/templates/tdd-implementation/ralphflow.yaml +73 -0
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
// Archive browsing: listing, file tree, file viewer.
|
|
2
2
|
|
|
3
3
|
import { state, actions } from './state.js';
|
|
4
|
-
import { fetchJson, esc } from './utils.js';
|
|
4
|
+
import { fetchJson, esc, renderMarkdown } from './utils.js';
|
|
5
5
|
|
|
6
6
|
export function switchAppTab(tab) {
|
|
7
7
|
if (tab === state.activeAppTab) return;
|
|
8
8
|
state.activeAppTab = tab;
|
|
9
9
|
state.expandedArchive = null;
|
|
10
10
|
state.archiveFilesCache = {};
|
|
11
|
+
state.archiveSummaryCache = {};
|
|
11
12
|
state.viewingArchiveFile = null;
|
|
12
13
|
actions.renderContent();
|
|
13
14
|
}
|
|
@@ -52,8 +53,21 @@ function renderArchivesView(container, appName) {
|
|
|
52
53
|
if (isExpanded) {
|
|
53
54
|
const files = state.archiveFilesCache[archive.timestamp];
|
|
54
55
|
if (files) {
|
|
56
|
+
// Show summary.md prominently at top if available, otherwise show CLI hint
|
|
57
|
+
const summaryContent = state.archiveSummaryCache[archive.timestamp];
|
|
58
|
+
if (summaryContent) {
|
|
59
|
+
html += `<div class="archive-summary">${renderMarkdown(summaryContent)}</div>`;
|
|
60
|
+
} else {
|
|
61
|
+
html += `<div class="archive-summary-hint">
|
|
62
|
+
<span class="archive-summary-hint-text">No summary yet. Generate one with:</span>
|
|
63
|
+
<code class="archive-summary-hint-cmd">npx ralphflow summarize ${esc(appName)} ${esc(archive.timestamp)}</code>
|
|
64
|
+
</div>`;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Filter summary.md from regular file list
|
|
68
|
+
const displayFiles = files.filter(f => f.path !== 'summary.md');
|
|
55
69
|
html += '<div class="archive-files">';
|
|
56
|
-
for (const file of
|
|
70
|
+
for (const file of displayFiles) {
|
|
57
71
|
const isActive = state.viewingArchiveFile === file.path;
|
|
58
72
|
html += `<div class="archive-file-item${isActive ? ' active' : ''}" data-archive-file="${esc(file.path)}" data-archive-ts="${esc(archive.timestamp)}">
|
|
59
73
|
<span class="archive-file-icon">📄</span>
|
|
@@ -129,6 +143,17 @@ async function toggleArchiveCard(appName, timestamp) {
|
|
|
129
143
|
try {
|
|
130
144
|
const files = await fetchJson(`/api/apps/${encodeURIComponent(appName)}/archives/${encodeURIComponent(timestamp)}/files`);
|
|
131
145
|
state.archiveFilesCache[timestamp] = files;
|
|
146
|
+
|
|
147
|
+
// Auto-fetch summary.md if present
|
|
148
|
+
const hasSummary = files.some(f => f.path === 'summary.md');
|
|
149
|
+
if (hasSummary) {
|
|
150
|
+
try {
|
|
151
|
+
const data = await fetchJson(`/api/apps/${encodeURIComponent(appName)}/archives/${encodeURIComponent(timestamp)}/files/summary.md`);
|
|
152
|
+
state.archiveSummaryCache[timestamp] = data.content || '';
|
|
153
|
+
} catch {
|
|
154
|
+
// summary fetch failed — skip display
|
|
155
|
+
}
|
|
156
|
+
}
|
|
132
157
|
} catch {
|
|
133
158
|
state.archiveFilesCache[timestamp] = [];
|
|
134
159
|
}
|
|
@@ -604,7 +604,7 @@ async function submitDeleteApp(overlay, appName) {
|
|
|
604
604
|
if (state.selectedApp && state.selectedApp.appName === appName) {
|
|
605
605
|
state.selectedApp = null;
|
|
606
606
|
state.selectedLoop = null;
|
|
607
|
-
document.title = 'RalphFlow Dashboard';
|
|
607
|
+
document.title = state.projectName ? state.projectName + ' \u00b7 RalphFlow Dashboard' : 'RalphFlow Dashboard';
|
|
608
608
|
}
|
|
609
609
|
actions.fetchApps();
|
|
610
610
|
} catch (err) {
|
|
@@ -67,6 +67,26 @@ export function renderPromptConfigForm(loopIdx, loop, allLoops) {
|
|
|
67
67
|
return html;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
// -----------------------------------------------------------------------
|
|
71
|
+
// Visual Communication Protocol for generated prompts
|
|
72
|
+
// -----------------------------------------------------------------------
|
|
73
|
+
|
|
74
|
+
function generateVisualProtocol() {
|
|
75
|
+
let s = '';
|
|
76
|
+
s += `## Visual Communication Protocol\n\n`;
|
|
77
|
+
s += `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.\n\n`;
|
|
78
|
+
s += `**Character set:** \`┌ ─ ┐ │ └ ┘ ├ ┤ ┬ ┴ ┼ ═ ● ○ ▼ ▶\`\n\n`;
|
|
79
|
+
s += `**Diagram types to use:**\n\n`;
|
|
80
|
+
s += `- **Scope/Architecture Map** — components and their relationships in a bordered grid\n`;
|
|
81
|
+
s += `- **Decomposition Tree** — hierarchical breakdown with \`├──\` and \`└──\` branches\n`;
|
|
82
|
+
s += `- **Data Flow** — arrows (\`──→\`) showing how information moves between components\n`;
|
|
83
|
+
s += `- **Comparison Table** — bordered table for trade-offs and design options\n`;
|
|
84
|
+
s += `- **Status Summary** — bordered box with completion indicators (\`✓\` done, \`◌\` pending)\n\n`;
|
|
85
|
+
s += `**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.\n\n`;
|
|
86
|
+
s += `---\n\n`;
|
|
87
|
+
return s;
|
|
88
|
+
}
|
|
89
|
+
|
|
70
90
|
// -----------------------------------------------------------------------
|
|
71
91
|
// Prompt generation engine
|
|
72
92
|
// -----------------------------------------------------------------------
|
|
@@ -114,6 +134,9 @@ export function generatePromptFromConfig(loop, loopIndex, allLoops) {
|
|
|
114
134
|
p += `**Pipeline:** \`${pipelineIn} → YOU → ${pipelineOut}\`\n\n`;
|
|
115
135
|
p += `---\n\n`;
|
|
116
136
|
|
|
137
|
+
// ── VISUAL COMMUNICATION PROTOCOL ──
|
|
138
|
+
p += generateVisualProtocol();
|
|
139
|
+
|
|
117
140
|
// ── MULTI-AGENT SECTIONS (conditional) ──
|
|
118
141
|
if (loop.multi_agent) {
|
|
119
142
|
// Tracker Lock Protocol
|
|
@@ -199,11 +222,15 @@ export function generatePromptFromConfig(loop, loopIndex, allLoops) {
|
|
|
199
222
|
p += `After completing ANY stage, exit: \`kill -INT $PPID\`\n\n`;
|
|
200
223
|
p += `---\n\n`;
|
|
201
224
|
|
|
202
|
-
// ── FIRST-RUN
|
|
203
|
-
|
|
204
|
-
p += `## First-Run Handling\n\n`;
|
|
225
|
+
// ── FIRST-RUN / NEW ITEM DETECTION ──
|
|
226
|
+
{
|
|
205
227
|
const scanFile = primaryInputFile || 'input.md';
|
|
206
|
-
p +=
|
|
228
|
+
p += `## First-Run / New ${entityTitle} Detection\n\n`;
|
|
229
|
+
if (loop.multi_agent) {
|
|
230
|
+
p += `If ${entityTitle}s Queue in tracker is empty OR all entries are \`[x]\`: read \`${scanFile}\`, scan \`## ${entityKey}:\` headers + \`**Depends on:**\` tags. For any ${entityLower} NOT already in the queue, add as \`- [ ] ${entityKey}: {title}\` with \`{agent: -, status: pending|blocked}\` metadata (compute from Dependencies), then start.\n\n`;
|
|
231
|
+
} else {
|
|
232
|
+
p += `If ${entityTitle}s Queue in tracker is empty OR all entries are \`[x]\`: read \`${scanFile}\`, scan \`## ${entityKey}:\` headers + \`**Depends on:**\` tags. For any ${entityLower} NOT already in the queue, add as \`- [ ] ${entityKey}: {title}\` and update Dependencies. If new ${entityPlural} were added, proceed to process them.\n\n`;
|
|
233
|
+
}
|
|
207
234
|
p += `---\n\n`;
|
|
208
235
|
}
|
|
209
236
|
|
|
@@ -248,6 +275,14 @@ export function generatePromptFromConfig(loop, loopIndex, allLoops) {
|
|
|
248
275
|
}
|
|
249
276
|
}
|
|
250
277
|
|
|
278
|
+
// Visual diagram trigger
|
|
279
|
+
if (i === 0) {
|
|
280
|
+
p += `${step++}. **Render a Scope Diagram** — output an ASCII architecture/scope map showing the areas this ${entityLower} touches, dependencies, and what needs to change\n`;
|
|
281
|
+
}
|
|
282
|
+
if (i === stageCount - 1 && stageCount > 1) {
|
|
283
|
+
p += `${step++}. **Render a Completion Summary** — output an ASCII status diagram showing what was built/changed, verification results, and how this ${entityLower} fits in overall progress\n`;
|
|
284
|
+
}
|
|
285
|
+
|
|
251
286
|
// Tracker update
|
|
252
287
|
if (loop.multi_agent) {
|
|
253
288
|
p += `${step++}. Acquire lock → update tracker: stage, \`last_heartbeat\`, log entry → release lock\n`;
|
|
@@ -79,7 +79,7 @@ export function selectApp(app) {
|
|
|
79
79
|
state.viewingTemplateName = null;
|
|
80
80
|
state.viewingTemplateConfig = null;
|
|
81
81
|
state.viewingTemplatePrompts = {};
|
|
82
|
-
document.title = app.appName + '
|
|
82
|
+
document.title = app.appName + ' \u00b7 ' + (state.projectName || 'RalphFlow Dashboard');
|
|
83
83
|
renderSidebar();
|
|
84
84
|
actions.renderContent();
|
|
85
85
|
actions.fetchAppStatus(app.appName);
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
export const $ = (sel) => document.querySelector(sel);
|
|
5
5
|
|
|
6
6
|
export const dom = {
|
|
7
|
+
pageTitle: $('#pageTitle'),
|
|
7
8
|
hostDisplay: $('#hostDisplay'),
|
|
8
9
|
sidebarApps: $('#sidebarApps'),
|
|
9
10
|
content: $('#content'),
|
|
@@ -34,7 +35,9 @@ export const state = {
|
|
|
34
35
|
archivesData: [],
|
|
35
36
|
expandedArchive: null,
|
|
36
37
|
archiveFilesCache: {},
|
|
38
|
+
archiveSummaryCache: {},
|
|
37
39
|
viewingArchiveFile: null,
|
|
40
|
+
projectName: null,
|
|
38
41
|
currentPage: 'app',
|
|
39
42
|
templatesList: [],
|
|
40
43
|
showTemplateBuilder: false,
|
|
@@ -1195,6 +1195,62 @@ body {
|
|
|
1195
1195
|
transform: rotate(90deg);
|
|
1196
1196
|
}
|
|
1197
1197
|
|
|
1198
|
+
/* Archive summary display */
|
|
1199
|
+
.archive-summary {
|
|
1200
|
+
border-top: 1px solid var(--border);
|
|
1201
|
+
padding: 16px 20px;
|
|
1202
|
+
background: var(--bg);
|
|
1203
|
+
font-family: var(--mono);
|
|
1204
|
+
font-size: 13px;
|
|
1205
|
+
line-height: 1.6;
|
|
1206
|
+
color: var(--text);
|
|
1207
|
+
overflow-x: auto;
|
|
1208
|
+
}
|
|
1209
|
+
.archive-summary h1,
|
|
1210
|
+
.archive-summary h2,
|
|
1211
|
+
.archive-summary h3 {
|
|
1212
|
+
color: var(--text);
|
|
1213
|
+
margin: 12px 0 6px;
|
|
1214
|
+
font-size: 14px;
|
|
1215
|
+
}
|
|
1216
|
+
.archive-summary h1 { font-size: 15px; margin-top: 0; }
|
|
1217
|
+
.archive-summary .md-code-block {
|
|
1218
|
+
background: var(--bg-surface);
|
|
1219
|
+
border: 1px solid var(--border);
|
|
1220
|
+
border-radius: var(--radius);
|
|
1221
|
+
padding: 12px 16px;
|
|
1222
|
+
margin: 8px 0;
|
|
1223
|
+
overflow-x: auto;
|
|
1224
|
+
white-space: pre;
|
|
1225
|
+
font-size: 12px;
|
|
1226
|
+
line-height: 1.5;
|
|
1227
|
+
}
|
|
1228
|
+
.archive-summary .md-code-block code {
|
|
1229
|
+
font-family: var(--mono);
|
|
1230
|
+
}
|
|
1231
|
+
.archive-summary-hint {
|
|
1232
|
+
border-top: 1px solid var(--border);
|
|
1233
|
+
padding: 12px 20px;
|
|
1234
|
+
display: flex;
|
|
1235
|
+
align-items: center;
|
|
1236
|
+
gap: 10px;
|
|
1237
|
+
flex-wrap: wrap;
|
|
1238
|
+
}
|
|
1239
|
+
.archive-summary-hint-text {
|
|
1240
|
+
font-size: 12px;
|
|
1241
|
+
color: var(--text-dim);
|
|
1242
|
+
}
|
|
1243
|
+
.archive-summary-hint-cmd {
|
|
1244
|
+
font-family: var(--mono);
|
|
1245
|
+
font-size: 11px;
|
|
1246
|
+
color: var(--text-dim);
|
|
1247
|
+
background: var(--bg);
|
|
1248
|
+
border: 1px solid var(--border);
|
|
1249
|
+
border-radius: var(--radius);
|
|
1250
|
+
padding: 3px 8px;
|
|
1251
|
+
user-select: all;
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1198
1254
|
/* Archive file browser */
|
|
1199
1255
|
.archive-files {
|
|
1200
1256
|
border-top: 1px solid var(--border);
|
|
@@ -1474,6 +1530,27 @@ body {
|
|
|
1474
1530
|
font-weight: 600;
|
|
1475
1531
|
margin-bottom: 8px;
|
|
1476
1532
|
}
|
|
1533
|
+
.wizard-description-ref {
|
|
1534
|
+
border-left: 3px solid var(--accent);
|
|
1535
|
+
padding: 8px 12px;
|
|
1536
|
+
margin-bottom: 16px;
|
|
1537
|
+
background: rgba(99, 102, 241, 0.06);
|
|
1538
|
+
border-radius: 0 6px 6px 0;
|
|
1539
|
+
}
|
|
1540
|
+
.wizard-description-ref-label {
|
|
1541
|
+
font-size: 10px;
|
|
1542
|
+
text-transform: uppercase;
|
|
1543
|
+
letter-spacing: 0.5px;
|
|
1544
|
+
color: var(--accent);
|
|
1545
|
+
font-weight: 600;
|
|
1546
|
+
}
|
|
1547
|
+
.wizard-description-ref p {
|
|
1548
|
+
margin: 4px 0 0;
|
|
1549
|
+
font-size: 13px;
|
|
1550
|
+
color: var(--text-secondary);
|
|
1551
|
+
line-height: 1.5;
|
|
1552
|
+
font-style: italic;
|
|
1553
|
+
}
|
|
1477
1554
|
.wizard-hint {
|
|
1478
1555
|
font-size: 13px;
|
|
1479
1556
|
color: var(--text-dim);
|
|
@@ -248,6 +248,9 @@ function renderTemplateWizard() {
|
|
|
248
248
|
} else if (step === 1) {
|
|
249
249
|
// Step 2: Define pipeline steps
|
|
250
250
|
html += '<div class="wizard-step-card">';
|
|
251
|
+
if (wd.description) {
|
|
252
|
+
html += `<div class="wizard-description-ref"><span class="wizard-description-ref-label">Your description</span><p>${esc(wd.description)}</p></div>`;
|
|
253
|
+
}
|
|
251
254
|
html += '<h3 class="wizard-question">Define your pipeline steps</h3>';
|
|
252
255
|
html += '<p class="wizard-hint">Each step becomes a loop. For each, give it a name and optionally list its stages (comma-separated). Stages define what the AI agent does in each iteration cycle.</p>';
|
|
253
256
|
html += '<div class="wizard-loops-list" id="wizardLoopsList">';
|
|
@@ -17,10 +17,36 @@ export function renderMarkdown(md) {
|
|
|
17
17
|
const lines = md.split('\n');
|
|
18
18
|
let inTable = false;
|
|
19
19
|
let tableHtml = '';
|
|
20
|
+
let inCodeBlock = false;
|
|
21
|
+
let codeBlockContent = '';
|
|
20
22
|
|
|
21
23
|
for (let i = 0; i < lines.length; i++) {
|
|
22
24
|
const line = lines[i];
|
|
23
25
|
|
|
26
|
+
// Fenced code blocks
|
|
27
|
+
if (line.startsWith('```')) {
|
|
28
|
+
if (inCodeBlock) {
|
|
29
|
+
html += `<pre class="md-code-block"><code>${esc(codeBlockContent)}</code></pre>`;
|
|
30
|
+
codeBlockContent = '';
|
|
31
|
+
inCodeBlock = false;
|
|
32
|
+
} else {
|
|
33
|
+
if (inTable) {
|
|
34
|
+
inTable = false;
|
|
35
|
+
tableHtml += '</tbody></table>';
|
|
36
|
+
html += tableHtml;
|
|
37
|
+
tableHtml = '';
|
|
38
|
+
}
|
|
39
|
+
inCodeBlock = true;
|
|
40
|
+
codeBlockContent = '';
|
|
41
|
+
}
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (inCodeBlock) {
|
|
46
|
+
codeBlockContent += (codeBlockContent ? '\n' : '') + line;
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
|
|
24
50
|
// Table detection
|
|
25
51
|
if (line.match(/^\|.+\|$/)) {
|
|
26
52
|
if (!inTable) {
|
|
@@ -68,6 +94,10 @@ export function renderMarkdown(md) {
|
|
|
68
94
|
html += tableHtml;
|
|
69
95
|
}
|
|
70
96
|
|
|
97
|
+
if (inCodeBlock) {
|
|
98
|
+
html += `<pre class="md-code-block"><code>${esc(codeBlockContent)}</code></pre>`;
|
|
99
|
+
}
|
|
100
|
+
|
|
71
101
|
return html;
|
|
72
102
|
}
|
|
73
103
|
|
|
@@ -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)
|
|
@@ -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
|
|
@@ -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?
|