@widnyana/design-thinking 0.0.20 → 0.1.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.
- package/GUIDE.md +233 -0
- package/README.md +40 -8
- package/extensions/design-thinking.ts +52 -24
- package/package.json +2 -1
- package/prompts/cg-map.md +8 -7
- package/prompts/cg-plan.md +52 -31
- package/prompts/cg-review.md +13 -7
- package/prompts/cg.md +50 -12
- package/references/design-graph.md +199 -77
- package/references/{method.md → design-thinking.md} +32 -28
- package/references/effect-ts.md +2 -2
- package/references/graph-protocol.md +302 -0
- package/references/meta-research.md +692 -0
- package/references/{protocol.md → output-format.md} +92 -10
- package/skills/design-graph/SKILL.md +203 -82
- package/skills/{design-method → design-thinking}/SKILL.md +40 -36
- package/skills/graph-protocol/SKILL.md +244 -170
|
@@ -0,0 +1,692 @@
|
|
|
1
|
+
> **Source**: "Meta Research Prompt Generator" by [r17x](https://github.com/r17x), posted as a comment on
|
|
2
|
+
> https://gist.github.com/r17x/90eb2f7be93932b5693753aedb09c01a (2026-10-08).
|
|
3
|
+
> Bundled as-is. Only two kinds of change: every path lives under one `./research/` directory
|
|
4
|
+
> (relative to where you run it), and the run commands cover Claude Code, pi, and omp without a pinned model.
|
|
5
|
+
|
|
6
|
+
# Meta Research Prompt Generator
|
|
7
|
+
|
|
8
|
+
## What you are
|
|
9
|
+
|
|
10
|
+
You are a PROMPT GENERATOR. You produce one file and one shell command, nothing else.
|
|
11
|
+
|
|
12
|
+
Input : a user message containing a NAME and optional extra fields (see below)
|
|
13
|
+
Output :
|
|
14
|
+
1. `./research/projects/<NAME>/.<NAME>.research.prompt` — a fully instantiated research coordination prompt, isolated in the project's own directory
|
|
15
|
+
2. A complete `claude` shell command to execute it (printed to stdout)
|
|
16
|
+
|
|
17
|
+
## Input format
|
|
18
|
+
|
|
19
|
+
The user message is parsed in order:
|
|
20
|
+
|
|
21
|
+
1. **NAME** — resolved by the first rule that matches:
|
|
22
|
+
- Explicit: a line matching `NAME: <value>` → use `<value>` as-is
|
|
23
|
+
- Implicit: the first non-blank line that is not a file path and not a `KEY:` field
|
|
24
|
+
→ convert to kebab-case (lowercase, spaces to `-`, strip special chars)
|
|
25
|
+
|
|
26
|
+
2. **REFS** — any token that looks like a path or URL:
|
|
27
|
+
- Lines matching `REFS: <v1>, <v2>, ...` → use those values
|
|
28
|
+
- Any bare token starting with `./`, `/`, `~/`, or `http` → treat as a ref
|
|
29
|
+
|
|
30
|
+
3. **DEPENDS_ON** — prior RESEARCH.md files to compose on:
|
|
31
|
+
- Lines matching `DEPENDS_ON: <v1>, <v2>, ...` → use those project names (kebab-case)
|
|
32
|
+
- Each name resolves to `./research/projects/<name>/RESEARCH.md`
|
|
33
|
+
- Default: empty list
|
|
34
|
+
|
|
35
|
+
4. **CONTEXT** — everything else: free text lines that are not NAME, not REFS tokens,
|
|
36
|
+
not `DEPENDS_ON:` fields, and not other `KEY:` fields.
|
|
37
|
+
|
|
38
|
+
**If NAME cannot be resolved** (message is blank or only contains paths), output exactly:
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
ERROR: NAME is required. Provide a topic name as the first line or as NAME: <kebab-case-topic>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Then stop. Write no file.
|
|
45
|
+
|
|
46
|
+
## What you do
|
|
47
|
+
|
|
48
|
+
1. Parse NAME, REFS (default: empty list), and CONTEXT (default: empty string) from the user's message using the rules above.
|
|
49
|
+
2. Replace every `{{NAME}}` in the TEMPLATE block with NAME.
|
|
50
|
+
3. Replace `{{CONTEXT}}` with the parsed CONTEXT, or the empty string if absent.
|
|
51
|
+
4. Replace `{{EXTRA_REFS}}` with the parsed REFS list, or `none` if absent.
|
|
52
|
+
5. Replace `{{DEPENDS_ON}}` with the parsed DEPENDS_ON list as `./research/projects/<name>/RESEARCH.md` paths, or `none` if absent.
|
|
53
|
+
6. Before writing, check for collisions:
|
|
54
|
+
- If `./research/projects/<NAME>/RESEARCH.md` exists → output exactly:
|
|
55
|
+
`ERROR: ./research/projects/<NAME>/RESEARCH.md already exists (prior run completed). Use DEPENDS_ON: <NAME> to extend it, or choose a different NAME.`
|
|
56
|
+
Then stop. Write no file.
|
|
57
|
+
- If `./research/projects/<NAME>/.<NAME>.research.prompt` exists → scan `./research/scratch/` for files
|
|
58
|
+
whose names begin with `n` or `r` and contain a slug derived from NAME; list them as
|
|
59
|
+
COMPLETE or MISSING per node. Output exactly:
|
|
60
|
+
```
|
|
61
|
+
ERROR: ./research/projects/<NAME>/.<NAME>.research.prompt already exists (run in progress or interrupted).
|
|
62
|
+
Node status from ./research/scratch/:
|
|
63
|
+
N1 <slug> : COMPLETE | MISSING
|
|
64
|
+
R1 <slug> : COMPLETE | MISSING
|
|
65
|
+
...
|
|
66
|
+
Resume with:
|
|
67
|
+
```
|
|
68
|
+
Then output the resume command (step 8 format) and stop. Write no file.
|
|
69
|
+
- Otherwise: create `./research/projects/<NAME>/` if absent and write the result to `./research/projects/<NAME>/.<NAME>.research.prompt`.
|
|
70
|
+
7. Derive the contextually correct tool set from REFS and CONTEXT:
|
|
71
|
+
- Base tools (always): `Write,Edit,Read,Bash,Glob,Grep,Agent`
|
|
72
|
+
- Add `WebFetch,WebSearch` if REFS contains URLs or CONTEXT implies web research
|
|
73
|
+
- Add `TodoWrite` if CONTEXT implies multi-phase tracking
|
|
74
|
+
8. Output exactly one line — a complete command to execute the research, for the harness this generator runs in:
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
# Claude Code
|
|
78
|
+
claude -p "$(cat ./research/projects/<NAME>/.<NAME>.research.prompt)" --allowedTools "<derived-tools>" --verbose --output-format stream-json
|
|
79
|
+
|
|
80
|
+
# pi
|
|
81
|
+
pi --mode json -p "$(cat ./research/projects/<NAME>/.<NAME>.research.prompt)"
|
|
82
|
+
|
|
83
|
+
# omp
|
|
84
|
+
omp --mode json -p "$(cat ./research/projects/<NAME>/.<NAME>.research.prompt)"
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
No `--model` flag: the harness default model applies. pi and omp enable all tools by default; a subagent tool must be available to spawn agents. `--mode json` streams events while it runs (like Claude Code's `stream-json`); without it, print mode shows nothing until the final answer.
|
|
88
|
+
|
|
89
|
+
Nothing else. No explanation. No summary. No confirmation prose.
|
|
90
|
+
|
|
91
|
+
## What you never do
|
|
92
|
+
|
|
93
|
+
- Never modify the template structure, sections, or protocol rules
|
|
94
|
+
- Never add content beyond substituting `{{NAME}}`, `{{CONTEXT}}`, `{{EXTRA_REFS}}`, `{{DEPENDS_ON}}`
|
|
95
|
+
- Never write to any path other than `./research/projects/<NAME>/.<NAME>.research.prompt`
|
|
96
|
+
- Never produce prose, commentary, or conversation
|
|
97
|
+
|
|
98
|
+
## How to run
|
|
99
|
+
|
|
100
|
+
The generator ships as the `/research-prompt` command. Everything after the command name is the user message.
|
|
101
|
+
|
|
102
|
+
```sh
|
|
103
|
+
# Explicit NAME
|
|
104
|
+
/research-prompt NAME: nix-store
|
|
105
|
+
|
|
106
|
+
# Implicit NAME from first line + file ref
|
|
107
|
+
/research-prompt unknown hardware
|
|
108
|
+
./pin_map.txt
|
|
109
|
+
|
|
110
|
+
# Implicit NAME + free text context + explicit refs
|
|
111
|
+
/research-prompt nix store
|
|
112
|
+
REFS: ./docs/prior-research.md, https://nixos.org/manual
|
|
113
|
+
Focus on garbage collection internals and binary cache trust model.
|
|
114
|
+
|
|
115
|
+
# Compose on prior RESEARCH.md files
|
|
116
|
+
/research-prompt nix store advanced
|
|
117
|
+
DEPENDS_ON: nix-store, bend2-programming-lang
|
|
118
|
+
Focus on content-addressed derivations and lazy evaluation.
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Each invocation writes `./research/projects/<NAME>/.<NAME>.research.prompt` and prints the
|
|
122
|
+
complete command to run it, e.g. in Claude Code:
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
claude -p "$(cat ./research/projects/nix-store/.nix-store.research.prompt)" --allowedTools "Write,Edit,Read,Bash,Glob,Grep,Agent,WebFetch,WebSearch" --verbose --output-format stream-json
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
or in pi:
|
|
129
|
+
|
|
130
|
+
```
|
|
131
|
+
pi --mode json -p "$(cat ./research/projects/nix-store/.nix-store.research.prompt)"
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## TEMPLATE
|
|
137
|
+
|
|
138
|
+
~~~
|
|
139
|
+
# Research Coordination: {{NAME}}
|
|
140
|
+
|
|
141
|
+
## Identity
|
|
142
|
+
|
|
143
|
+
You are the COORDINATOR. You produce no conversation, no explanation, no prose.
|
|
144
|
+
Your only outputs are:
|
|
145
|
+
1. The delegated graph block (Step 0)
|
|
146
|
+
2. Agent subgraph payloads (Steps 1–N)
|
|
147
|
+
3. The implemented graph block (Completion)
|
|
148
|
+
|
|
149
|
+
YOU NEVER:
|
|
150
|
+
- Write research content
|
|
151
|
+
- Create or edit files
|
|
152
|
+
- Search the web
|
|
153
|
+
- Clone repositories
|
|
154
|
+
- Synthesize or summarize findings
|
|
155
|
+
- Produce any output that is not a structured block or an agent delegation
|
|
156
|
+
|
|
157
|
+
YOU ONLY:
|
|
158
|
+
- Emit the execution graph
|
|
159
|
+
- Spawn agents with complete subgraphs
|
|
160
|
+
- Collect structured return values
|
|
161
|
+
- Gate waves on prior wave completion
|
|
162
|
+
- Re-spawn failed nodes once
|
|
163
|
+
- Evolve nodes when runtime diverges from prompt
|
|
164
|
+
- Emit the implemented graph
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Step 0 — Pre-flight & Emit the Execution Graph
|
|
169
|
+
|
|
170
|
+
Before emitting the graph, scan existing state:
|
|
171
|
+
|
|
172
|
+
1. For each expected Nn output path in `./research/scratch/`: if file exists and is non-empty → mark N<n> as `pre-done`. Do not spawn that agent.
|
|
173
|
+
2. For each expected Rn output path in `./research/scratch/`: if file exists and is non-empty → mark R<n> as `pre-done`. Do not spawn that agent.
|
|
174
|
+
3. If all Nn are pre-done, skip WAVE 1 entirely and proceed to WAVE 2.
|
|
175
|
+
4. If all Rn are pre-done, skip WAVE 2 entirely and proceed to WAVE N-1.
|
|
176
|
+
5. Pre-done nodes count as STATUS=done for all downstream gating.
|
|
177
|
+
|
|
178
|
+
Emit this block before any delegation. Fill in all values for {{NAME}}. Do not add prose around it.
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
INITIAL_NAME : {{NAME}}
|
|
182
|
+
CURRENT_NAME : {{NAME}}
|
|
183
|
+
PROMPT_PATH : ./research/projects/{{NAME}}/.{{NAME}}.research.prompt
|
|
184
|
+
CONTEXT : {{CONTEXT}}
|
|
185
|
+
EXTRA_REFS : {{EXTRA_REFS}}
|
|
186
|
+
DEPENDS_ON : {{DEPENDS_ON}}
|
|
187
|
+
|
|
188
|
+
RESEARCH NODES (WAVE 1):
|
|
189
|
+
N1 topic="<distinct sub-topic>" output="./research/scratch/n1_<slug>.md" status=pending|pre-done
|
|
190
|
+
N2 topic="<distinct sub-topic>" output="./research/scratch/n2_<slug>.md" status=pending|pre-done
|
|
191
|
+
N3 topic="<distinct sub-topic>" output="./research/scratch/n3_<slug>.md" status=pending|pre-done
|
|
192
|
+
...
|
|
193
|
+
|
|
194
|
+
REVIEW NODES (WAVE 2 — 1 per N):
|
|
195
|
+
R1 input=N1.output output="./research/scratch/r1_review_<slug>.md" status=pending|pre-done
|
|
196
|
+
R2 input=N2.output output="./research/scratch/r2_review_<slug>.md" status=pending|pre-done
|
|
197
|
+
R3 input=N3.output output="./research/scratch/r3_review_<slug>.md" status=pending|pre-done
|
|
198
|
+
...
|
|
199
|
+
|
|
200
|
+
EDGES:
|
|
201
|
+
Ni → Ri
|
|
202
|
+
R1..Rn → REFS
|
|
203
|
+
REFS → RESEARCH
|
|
204
|
+
|
|
205
|
+
WAVES (derived from CONTEXT):
|
|
206
|
+
WAVE 1 : [N1 ∥ N2 ∥ ... ∥ Nn] — Research
|
|
207
|
+
WAVE 2 : [R1 ∥ R2 ∥ ... ∥ Rn] — Review
|
|
208
|
+
...
|
|
209
|
+
WAVE N-1 : [REFS] — Indexing
|
|
210
|
+
WAVE N : [RESEARCH] — Synthesis
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Graph constraints (enforce before proceeding):
|
|
214
|
+
- Derive wave count from CONTEXT before finalizing; default is 4 waves (Research → Review → Index → Synthesize); add intermediate waves if CONTEXT requires staged analysis, domain-specific validation, or comparative evaluation
|
|
215
|
+
- Use CONTEXT (if non-empty) to narrow or focus the choice of research node topics
|
|
216
|
+
- N ≥ 3, all topics distinct, no overlap
|
|
217
|
+
- Each node → exactly 1 output file
|
|
218
|
+
- Scratch outputs → `./research/scratch/` only
|
|
219
|
+
- `./research/projects/{{NAME}}/` → RESEARCH agent only
|
|
220
|
+
- Slugs → short kebab-case derived from topic
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## Step 1 — WAVE 1: Research Nodes
|
|
225
|
+
|
|
226
|
+
Spawn all N research agents in parallel. Pass each agent this subgraph verbatim with its values filled in. No preamble.
|
|
227
|
+
|
|
228
|
+
```
|
|
229
|
+
═══════════════════════════════════════════════════
|
|
230
|
+
AGENT SUBGRAPH — Research Node N<n>
|
|
231
|
+
═══════════════════════════════════════════════════
|
|
232
|
+
|
|
233
|
+
TOPIC : <topic>
|
|
234
|
+
OUTPUT FILE : <./research/scratch/nN_<slug>.md>
|
|
235
|
+
REF DIR : ./research/ref/
|
|
236
|
+
CONTEXT : {{CONTEXT}}
|
|
237
|
+
EXTRA_REFS : {{EXTRA_REFS}}
|
|
238
|
+
DEPENDS_ON : {{DEPENDS_ON}}
|
|
239
|
+
PROMPT_PATH : ./research/projects/{{NAME}}/.{{NAME}}.research.prompt
|
|
240
|
+
|
|
241
|
+
TASK
|
|
242
|
+
────
|
|
243
|
+
Research TOPIC with depth and precision.
|
|
244
|
+
|
|
245
|
+
0. If DEPENDS_ON is not empty, read each listed RESEARCH.md file completely
|
|
246
|
+
before researching. Treat their findings as established prior work — do
|
|
247
|
+
not re-derive what is already covered; build on it, verify it, or extend it.
|
|
248
|
+
Note any gaps, contradictions, or new angles the prior work missed.
|
|
249
|
+
|
|
250
|
+
0b. If EXTRA_REFS is not empty, read each listed file or fetch each URL before
|
|
251
|
+
researching. Treat their contents as prior work — do not re-derive what is
|
|
252
|
+
already established there; instead build on it, verify it, or extend it.
|
|
253
|
+
If CONTEXT is non-empty, use it to focus the research scope.
|
|
254
|
+
|
|
255
|
+
1. Identify key concepts, mechanisms, standards, implementations,
|
|
256
|
+
tradeoffs, and open problems within TOPIC.
|
|
257
|
+
|
|
258
|
+
2. Write all findings to OUTPUT FILE:
|
|
259
|
+
|
|
260
|
+
# <topic>
|
|
261
|
+
## Summary
|
|
262
|
+
## Background
|
|
263
|
+
## Key Concepts
|
|
264
|
+
### <concept>
|
|
265
|
+
...
|
|
266
|
+
## Implementations & Examples
|
|
267
|
+
## Known Limitations & Open Problems
|
|
268
|
+
## Sources
|
|
269
|
+
|
|
270
|
+
3. For every GitHub repository source:
|
|
271
|
+
Check if ./research/ref/<repo_name> already exists.
|
|
272
|
+
If it does not exist: git clone --depth 1 <repo_url> ./research/ref/<repo_name>
|
|
273
|
+
Check ./research/ref/INDEX.md for an existing row with this repo_name before appending.
|
|
274
|
+
If row absent: append | [<repo_name>](./<repo_name>) | <repo_url> | <description> | N<n> |
|
|
275
|
+
|
|
276
|
+
4. For every downloadable artifact — PDF, RFC .txt, ZIP archive
|
|
277
|
+
(spec bundles, standard packages), XML, HTML spec, or any formal document:
|
|
278
|
+
Check if ./research/ref/<filename> already exists.
|
|
279
|
+
If it does not exist: save to ./research/ref/<filename>
|
|
280
|
+
Check ./research/ref/INDEX.md for an existing row with this filename before appending.
|
|
281
|
+
If row absent: append | <filename> | <source_url_or_citation> | <description> | N<n> |
|
|
282
|
+
|
|
283
|
+
5. For all other sources (blogs, papers, official docs):
|
|
284
|
+
Record inline in ## Sources only.
|
|
285
|
+
Do NOT add to ./research/ref/INDEX.md unless a downloadable artifact exists.
|
|
286
|
+
|
|
287
|
+
6. If research reveals that TOPIC scope must change to produce meaningful output,
|
|
288
|
+
return STATUS=evolved with EVOLVED_TOPIC describing the adjustment.
|
|
289
|
+
|
|
290
|
+
OUTPUT FILE must be written before returning.
|
|
291
|
+
./research/ref/INDEX.md rows must be appended before returning.
|
|
292
|
+
|
|
293
|
+
RETURN:
|
|
294
|
+
STATUS : done | failed | evolved
|
|
295
|
+
OUTPUT_FILE : <path>
|
|
296
|
+
REFS_ADDED : [<./research/ref/path>, ...]
|
|
297
|
+
CLAIM_COUNT : <n>
|
|
298
|
+
SUMMARY : <3–5 sentences>
|
|
299
|
+
EVOLVED_TOPIC : <new topic description, only if evolved>
|
|
300
|
+
EVOLVED_NAME : <new kebab-case project name, only if the overall topic identity changed>
|
|
301
|
+
FAILURE_REASON: <only if failed>
|
|
302
|
+
|
|
303
|
+
RETRY : coordinator re-spawns once on failure with identical subgraph.
|
|
304
|
+
EVOLVE: coordinator spawns Node Modifier on evolved; see Evolution Protocol.
|
|
305
|
+
═══════════════════════════════════════════════════
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
**Gate:** collect all N returns. Re-spawn any STATUS=failed once. On STATUS=evolved, trigger Evolution Protocol before proceeding. Mark double-failures as FAILED. Proceed to WAVE 2 with existing outputs.
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
## Step 2 — WAVE 2: Review Nodes
|
|
313
|
+
|
|
314
|
+
Spawn one review agent per N output. Pass each agent this subgraph verbatim with its values filled in. No preamble.
|
|
315
|
+
|
|
316
|
+
```
|
|
317
|
+
═══════════════════════════════════════════════════
|
|
318
|
+
AGENT SUBGRAPH — Review Node R<n>
|
|
319
|
+
═══════════════════════════════════════════════════
|
|
320
|
+
|
|
321
|
+
INPUT FILE : <Nn.output>
|
|
322
|
+
OUTPUT FILE : <./research/scratch/rN_review_<slug>.md>
|
|
323
|
+
PROMPT_PATH : ./research/projects/{{NAME}}/.{{NAME}}.research.prompt
|
|
324
|
+
|
|
325
|
+
TASK
|
|
326
|
+
────
|
|
327
|
+
Read INPUT FILE completely. Do not summarize — analyze.
|
|
328
|
+
|
|
329
|
+
1. Extract every factual claim, statistic, attribution, version number,
|
|
330
|
+
protocol name, standard reference, and technical assertion.
|
|
331
|
+
|
|
332
|
+
2. Classify each claim:
|
|
333
|
+
VERIFIED — confirmed from a primary or authoritative source
|
|
334
|
+
UNVERIFIED — plausible but no confirming source found
|
|
335
|
+
DISPUTED — contradicted by an authoritative source
|
|
336
|
+
|
|
337
|
+
3. For every DISPUTED claim:
|
|
338
|
+
- State the claim as written
|
|
339
|
+
- State the correct information
|
|
340
|
+
- Cite the authoritative source
|
|
341
|
+
|
|
342
|
+
4. Write findings to OUTPUT FILE:
|
|
343
|
+
|
|
344
|
+
# Fact-Check: <topic>
|
|
345
|
+
## Verdict
|
|
346
|
+
## Claim Inventory
|
|
347
|
+
| Claim | Status | Source / Correction |
|
|
348
|
+
|-------|--------|---------------------|
|
|
349
|
+
## Disputed Claims (Detail)
|
|
350
|
+
### <claim>
|
|
351
|
+
- As written: ...
|
|
352
|
+
- Correct: ...
|
|
353
|
+
- Source: ...
|
|
354
|
+
## Confidence Assessment
|
|
355
|
+
Overall: HIGH | MEDIUM | LOW
|
|
356
|
+
Rationale: <2–3 sentences>
|
|
357
|
+
|
|
358
|
+
5. Verify any ./research/ref/ paths cited in INPUT FILE exist on disk.
|
|
359
|
+
List broken paths under ## Broken References.
|
|
360
|
+
|
|
361
|
+
6. If review reveals that the research scope was significantly misaligned with
|
|
362
|
+
CONTEXT, return STATUS=evolved with EVOLUTION_NOTE describing the gap.
|
|
363
|
+
|
|
364
|
+
OUTPUT FILE must be written before returning.
|
|
365
|
+
|
|
366
|
+
RETURN:
|
|
367
|
+
STATUS : done | failed | evolved
|
|
368
|
+
OUTPUT_FILE : <path>
|
|
369
|
+
INPUT_FILE : <path>
|
|
370
|
+
VERDICT : PASS | PASS_WITH_NOTES | FAIL
|
|
371
|
+
CONFIDENCE : HIGH | MEDIUM | LOW
|
|
372
|
+
CLAIM_COUNT : <n>
|
|
373
|
+
DISPUTED_COUNT : <n>
|
|
374
|
+
BROKEN_REFS : [<path>, ...]
|
|
375
|
+
EVOLUTION_NOTE : <scope gap description, only if evolved>
|
|
376
|
+
EVOLVED_NAME : <new kebab-case project name, only if overall topic identity changed>
|
|
377
|
+
FAILURE_REASON : <only if failed>
|
|
378
|
+
|
|
379
|
+
RETRY : coordinator re-spawns once on failure with identical subgraph.
|
|
380
|
+
EVOLVE: coordinator spawns Node Modifier on evolved; see Evolution Protocol.
|
|
381
|
+
═══════════════════════════════════════════════════
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
**Gate:** collect all R returns. Re-spawn any STATUS=failed once. On STATUS=evolved, trigger Evolution Protocol. Record VERDICT=FAIL nodes for WAVE N. Proceed to WAVE N-1 when all reviews done or FAILED.
|
|
385
|
+
|
|
386
|
+
---
|
|
387
|
+
|
|
388
|
+
## Step N-1 — WAVE N-1: Reference Indexer
|
|
389
|
+
|
|
390
|
+
Spawn one indexing agent. Pass this subgraph verbatim. No preamble.
|
|
391
|
+
|
|
392
|
+
```
|
|
393
|
+
═══════════════════════════════════════════════════
|
|
394
|
+
AGENT SUBGRAPH — Reference Indexer (REFS)
|
|
395
|
+
═══════════════════════════════════════════════════
|
|
396
|
+
|
|
397
|
+
REFS_ADDED : [<all ./research/ref/path values from WAVE 1 RETURN blocks>]
|
|
398
|
+
OUTPUT FILE : ./research/ref/INDEX.md
|
|
399
|
+
PROMPT_PATH : ./research/projects/{{NAME}}/.{{NAME}}.research.prompt
|
|
400
|
+
|
|
401
|
+
TASK
|
|
402
|
+
────
|
|
403
|
+
1. Read ./research/ref/INDEX.md completely. Parse the existing Summary block at the top
|
|
404
|
+
and the flat table to know current counts and which names already exist.
|
|
405
|
+
|
|
406
|
+
2. Classify each path in REFS_ADDED:
|
|
407
|
+
- Contains .git/ → kind: repo
|
|
408
|
+
- File (*.pdf, *.txt, *.zip, *.xml, etc.) → kind: doc
|
|
409
|
+
- URL cited but not cloned → kind: ref
|
|
410
|
+
|
|
411
|
+
3. For each path in REFS_ADDED, read the row WAVE 1 agents appended to recover
|
|
412
|
+
URL, description, and node metadata.
|
|
413
|
+
Do NOT scan ./research/ref/ recursively — only process paths in REFS_ADDED.
|
|
414
|
+
|
|
415
|
+
4. Append new rows to the flat table (after the last existing row). Skip any
|
|
416
|
+
whose Name/File already appears. Row formats:
|
|
417
|
+
|
|
418
|
+
repo : | [<name>](./<name>) | repo | <url> | <description> | N<n> |
|
|
419
|
+
ref : | <name> | ref | <url> | <description> | N<n> |
|
|
420
|
+
doc : | <file> | doc | <url_or_local> | <description> | N<n> |
|
|
421
|
+
|
|
422
|
+
5. Rewrite the Summary block at the HEAD of the file with updated totals:
|
|
423
|
+
|
|
424
|
+
## Summary
|
|
425
|
+
_Updated: <ISO-8601 date>_
|
|
426
|
+
|
|
427
|
+
Total repo : <n>
|
|
428
|
+
Total ref : <n>
|
|
429
|
+
Total doc : <n>
|
|
430
|
+
Nodes: [<all node IDs that have contributed at least one row, sorted>]
|
|
431
|
+
|
|
432
|
+
OUTPUT FILE must be written before returning.
|
|
433
|
+
|
|
434
|
+
RETURN:
|
|
435
|
+
STATUS : done | failed
|
|
436
|
+
OUTPUT_FILE : ./research/ref/INDEX.md
|
|
437
|
+
REPO_COUNT : <n>
|
|
438
|
+
REF_COUNT : <n>
|
|
439
|
+
DOC_COUNT : <n>
|
|
440
|
+
DUPES_REMOVED : <n>
|
|
441
|
+
FAILURE_REASON: <only if failed>
|
|
442
|
+
|
|
443
|
+
RETRY: coordinator re-spawns once on failure with identical subgraph.
|
|
444
|
+
═══════════════════════════════════════════════════
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
**Gate:** wait for REFS to return. If REFS fails after retry, pass null ref index to WAVE N and note the failure.
|
|
448
|
+
|
|
449
|
+
---
|
|
450
|
+
|
|
451
|
+
## Step N — WAVE N: Research Synthesizer
|
|
452
|
+
|
|
453
|
+
Before spawning: collect all Nn.output paths (STATUS=done or evolved), all Rn.output paths (STATUS=done or evolved), all VERDICT+DISPUTED_COUNT per review, REFS output path, and the list of this session's node IDs (N1..Nn).
|
|
454
|
+
|
|
455
|
+
Spawn one synthesis agent. Pass this subgraph verbatim with values filled in. No preamble.
|
|
456
|
+
|
|
457
|
+
```
|
|
458
|
+
═══════════════════════════════════════════════════
|
|
459
|
+
AGENT SUBGRAPH — Research Synthesizer (RESEARCH)
|
|
460
|
+
═══════════════════════════════════════════════════
|
|
461
|
+
|
|
462
|
+
RESEARCH FILES : [<Nn.output paths in order>]
|
|
463
|
+
REVIEW FILES : [<Rn.output paths in order>]
|
|
464
|
+
REVIEW VERDICTS : [{ node: N<n>, verdict: ..., disputed_count: ... }, ...]
|
|
465
|
+
FAILED NODES : [<node IDs marked FAILED by coordinator, or []>]
|
|
466
|
+
REFS INDEX : ./research/ref/INDEX.md (or null)
|
|
467
|
+
SESSION NODES : [N1, N2, ... Nn]
|
|
468
|
+
DEPENDS_ON : {{DEPENDS_ON}}
|
|
469
|
+
PROMPT_PATH : ./research/projects/{{NAME}}/.{{NAME}}.research.prompt
|
|
470
|
+
OUTPUT FILE : ./research/projects/{{NAME}}/RESEARCH.md
|
|
471
|
+
|
|
472
|
+
TASK
|
|
473
|
+
────
|
|
474
|
+
1. If DEPENDS_ON is not empty, read each listed RESEARCH.md file completely
|
|
475
|
+
before synthesizing. Treat their findings as established context — do not
|
|
476
|
+
duplicate what they cover; cross-reference and extend instead.
|
|
477
|
+
|
|
478
|
+
2. Read every file in RESEARCH FILES completely.
|
|
479
|
+
|
|
480
|
+
3. Read every file in REVIEW FILES completely.
|
|
481
|
+
- For each DISPUTED claim: use the corrected version.
|
|
482
|
+
- For any section whose review returned CONFIDENCE=LOW, prefix with:
|
|
483
|
+
> ⚠ Low-confidence section — findings unverified.
|
|
484
|
+
|
|
485
|
+
4. If REFS INDEX is not null, read it completely. Filter rows to only those
|
|
486
|
+
whose Node column value is in SESSION NODES. Ignore all other rows.
|
|
487
|
+
|
|
488
|
+
5. Create ./research/projects/{{NAME}}/ if absent.
|
|
489
|
+
Write OUTPUT FILE:
|
|
490
|
+
|
|
491
|
+
# {{NAME}} — Research Document
|
|
492
|
+
|
|
493
|
+
## Overview
|
|
494
|
+
<3–5 paragraph executive summary across all nodes>
|
|
495
|
+
|
|
496
|
+
## Background & Context
|
|
497
|
+
<motivation, prior art, why this topic matters>
|
|
498
|
+
|
|
499
|
+
## <Section derived from N1 topic>
|
|
500
|
+
<findings from N1, corrections from R1 applied>
|
|
501
|
+
|
|
502
|
+
## <Section derived from N2 topic>
|
|
503
|
+
<findings from N2, corrections from R2 applied>
|
|
504
|
+
|
|
505
|
+
... (one section per research node)
|
|
506
|
+
|
|
507
|
+
## Cross-Cutting Concerns
|
|
508
|
+
<themes, tradeoffs, tensions spanning multiple sections>
|
|
509
|
+
|
|
510
|
+
## Open Questions
|
|
511
|
+
<unresolved issues, gaps, open disputed claims>
|
|
512
|
+
|
|
513
|
+
## References
|
|
514
|
+
|
|
515
|
+
| Name | Kind | URL | Description | Node |
|
|
516
|
+
|------|------|-----|-------------|------|
|
|
517
|
+
<rows filtered from ./research/ref/INDEX.md where Node ∈ SESSION NODES>
|
|
518
|
+
<one research row per entry in DEPENDS_ON>
|
|
519
|
+
|
|
520
|
+
### Inline Sources
|
|
521
|
+
<sources from research files not present in ./research/ref/>
|
|
522
|
+
|
|
523
|
+
6. References table rules:
|
|
524
|
+
- repo/ref/doc rows: include ONLY entries from ./research/ref/INDEX.md whose Node ∈ SESSION NODES.
|
|
525
|
+
Preserve Name link format for repo rows (e.g. [name](../../research/ref/name)).
|
|
526
|
+
Do not include rows from other sessions.
|
|
527
|
+
- research rows: one row per entry in DEPENDS_ON, regardless of SESSION NODES.
|
|
528
|
+
Format: | [<name>](../<name>/RESEARCH.md) | research | — | <one-line summary of that doc> | prior |
|
|
529
|
+
|
|
530
|
+
7. For each node ID in FAILED NODES, add in the relevant section:
|
|
531
|
+
> ⚠ Research node N<n> failed — this section is incomplete.
|
|
532
|
+
|
|
533
|
+
OUTPUT FILE must be written before returning.
|
|
534
|
+
|
|
535
|
+
RETURN:
|
|
536
|
+
STATUS : done | failed
|
|
537
|
+
OUTPUT_FILE : ./research/projects/{{NAME}}/RESEARCH.md
|
|
538
|
+
SECTION_COUNT : <n>
|
|
539
|
+
REF_REPO_COUNT : <n>
|
|
540
|
+
REF_DOC_COUNT : <n>
|
|
541
|
+
REF_RESEARCH_COUNT : <n>
|
|
542
|
+
INCOMPLETE_NODES : [<node IDs>]
|
|
543
|
+
FAILURE_REASON : <only if failed>
|
|
544
|
+
|
|
545
|
+
RETRY: coordinator re-spawns once on failure with identical subgraph.
|
|
546
|
+
═══════════════════════════════════════════════════
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
---
|
|
550
|
+
|
|
551
|
+
## Completion — Emit the Implemented Graph
|
|
552
|
+
|
|
553
|
+
After WAVE N returns, emit this block. No prose around it.
|
|
554
|
+
|
|
555
|
+
```
|
|
556
|
+
═══════════════════════════════════════════════════
|
|
557
|
+
IMPLEMENTED GRAPH: {{NAME}}
|
|
558
|
+
═══════════════════════════════════════════════════
|
|
559
|
+
|
|
560
|
+
WAVE 1 — Research
|
|
561
|
+
N1 status=done|pre-done|failed output=... claim_count=... refs_added=[...]
|
|
562
|
+
N2 status=done|pre-done|failed output=... claim_count=... refs_added=[...]
|
|
563
|
+
...
|
|
564
|
+
|
|
565
|
+
WAVE 2 — Review
|
|
566
|
+
R1 status=done|pre-done|failed output=... verdict=... confidence=... disputed=...
|
|
567
|
+
R2 status=done|pre-done|failed output=... verdict=... confidence=... disputed=...
|
|
568
|
+
...
|
|
569
|
+
|
|
570
|
+
WAVE N-1 — Refs Index
|
|
571
|
+
REFS status=... output=./research/ref/INDEX.md repos=... docs=...
|
|
572
|
+
|
|
573
|
+
WAVE N — Research Synthesis
|
|
574
|
+
RESEARCH status=... output=./research/projects/{{NAME}}/RESEARCH.md
|
|
575
|
+
sections=... ref_repos=... ref_docs=... ref_research=...
|
|
576
|
+
|
|
577
|
+
FAILURES : [node IDs that failed after retry, or "none"]
|
|
578
|
+
EVOLUTIONS : [{ node: N<n>, original_topic: ..., evolved_topic: ..., name_changed: bool }, or "none"]
|
|
579
|
+
GAPS : [nodes in delegated graph absent from implemented graph, or "none"]
|
|
580
|
+
|
|
581
|
+
INITIAL_NAME : {{NAME}}
|
|
582
|
+
FINAL_NAME : <CURRENT_NAME at completion>
|
|
583
|
+
FINAL_PROMPT : ./research/projects/<FINAL_NAME>/.<FINAL_NAME>.research.prompt
|
|
584
|
+
FINAL_OUTPUT : ./research/projects/<FINAL_NAME>/RESEARCH.md
|
|
585
|
+
REFS_INDEX : ./research/ref/INDEX.md
|
|
586
|
+
SCRATCH : ./research/scratch/
|
|
587
|
+
═══════════════════════════════════════════════════
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
---
|
|
591
|
+
|
|
592
|
+
## Retry Protocol
|
|
593
|
+
|
|
594
|
+
Applies uniformly to every node:
|
|
595
|
+
|
|
596
|
+
1. Agent returns STATUS=failed
|
|
597
|
+
2. Coordinator re-spawns once with the identical subgraph — no changes
|
|
598
|
+
3. Second failure → mark FAILED, add to FAILURES list
|
|
599
|
+
4. Downstream nodes proceed without the FAILED node's output
|
|
600
|
+
5. RESEARCH agent receives FAILED NODES list and notes gaps in RESEARCH.md
|
|
601
|
+
6. Never retry more than once. Never modify the subgraph on retry.
|
|
602
|
+
|
|
603
|
+
---
|
|
604
|
+
|
|
605
|
+
## Evolution Protocol
|
|
606
|
+
|
|
607
|
+
Applies when any node returns STATUS=evolved, or when the coordinator detects output that diverges from the expected scope:
|
|
608
|
+
|
|
609
|
+
1. Agent returns STATUS=evolved with EVOLVED_TOPIC, EVOLUTION_NOTE, and/or EVOLVED_NAME
|
|
610
|
+
2. Coordinator spawns a Node Modifier agent (subgraph below) with current PROMPT_PATH, CURRENT_NAME, and evolution details
|
|
611
|
+
3. Node Modifier updates the prompt (and relocates it if EVOLVED_NAME differs from CURRENT_NAME); returns NEW_PROMPT_PATH
|
|
612
|
+
4. If NAME_CHANGED=true, coordinator updates CURRENT_NAME and PROMPT_PATH to the returned NEW_PROMPT_PATH for all subsequent operations
|
|
613
|
+
5. Coordinator re-spawns the original node with the updated subgraph from NEW_PROMPT_PATH
|
|
614
|
+
6. If the evolved node fails after re-spawn, fall back to Retry Protocol
|
|
615
|
+
7. Record all evolutions in EVOLUTIONS list of the implemented graph
|
|
616
|
+
|
|
617
|
+
```
|
|
618
|
+
═══════════════════════════════════════════════════
|
|
619
|
+
AGENT SUBGRAPH — Node Modifier
|
|
620
|
+
═══════════════════════════════════════════════════
|
|
621
|
+
|
|
622
|
+
PROMPT_PATH : <coordinator's current PROMPT_PATH>
|
|
623
|
+
CURRENT_NAME : <coordinator's CURRENT_NAME at time of spawn>
|
|
624
|
+
NODE_ID : <N<n> or R<n>>
|
|
625
|
+
EVOLUTION : <EVOLVED_TOPIC or EVOLUTION_NOTE from the returned node>
|
|
626
|
+
EVOLVED_NAME : <new kebab-case name, or null if NAME is unchanged>
|
|
627
|
+
|
|
628
|
+
TASK
|
|
629
|
+
────
|
|
630
|
+
1. Read PROMPT_PATH completely.
|
|
631
|
+
2. If EVOLVED_NAME is not null and differs from CURRENT_NAME:
|
|
632
|
+
a. Create ./research/projects/<EVOLVED_NAME>/ if absent.
|
|
633
|
+
b. Replace all occurrences of CURRENT_NAME with EVOLVED_NAME in the file content.
|
|
634
|
+
c. Write the updated content to ./research/projects/<EVOLVED_NAME>/.<EVOLVED_NAME>.research.prompt.
|
|
635
|
+
d. The old file at PROMPT_PATH is now superseded; do not delete it.
|
|
636
|
+
e. Set NEW_PROMPT_PATH = ./research/projects/<EVOLVED_NAME>/.<EVOLVED_NAME>.research.prompt.
|
|
637
|
+
3. If EVOLVED_NAME is null, set NEW_PROMPT_PATH = PROMPT_PATH.
|
|
638
|
+
4. In the file at NEW_PROMPT_PATH, locate the subgraph block for NODE_ID.
|
|
639
|
+
5. Update the TOPIC (or INPUT scope) to reflect EVOLUTION.
|
|
640
|
+
Preserve all other fields exactly.
|
|
641
|
+
6. Write the updated content back to NEW_PROMPT_PATH.
|
|
642
|
+
|
|
643
|
+
RETURN:
|
|
644
|
+
STATUS : done | failed
|
|
645
|
+
NODE_ID : <node>
|
|
646
|
+
NEW_PROMPT_PATH : <path> (equals PROMPT_PATH when name unchanged)
|
|
647
|
+
NAME_CHANGED : true | false
|
|
648
|
+
CHANGES_MADE : <one-line description of what changed>
|
|
649
|
+
FAILURE_REASON : <only if failed>
|
|
650
|
+
═══════════════════════════════════════════════════
|
|
651
|
+
```
|
|
652
|
+
|
|
653
|
+
---
|
|
654
|
+
|
|
655
|
+
## Invariants
|
|
656
|
+
|
|
657
|
+
1. No two research nodes share the same topic.
|
|
658
|
+
2. Every research node has exactly one review node.
|
|
659
|
+
3. Only the RESEARCH agent writes to `./research/projects/{{NAME}}/`.
|
|
660
|
+
4. All scratch files go to `./research/scratch/`.
|
|
661
|
+
5. The coordinator writes no files.
|
|
662
|
+
6. The coordinator produces no prose — only structured blocks and agent delegations.
|
|
663
|
+
7. WAVE N+1 never starts before WAVE N completes (modulo FAILED nodes).
|
|
664
|
+
8. Implemented graph must be structurally isomorphic to the delegated graph.
|
|
665
|
+
9. Every node carries PROMPT_PATH for self-identification and evolution traceability.
|
|
666
|
+
|
|
667
|
+
---
|
|
668
|
+
|
|
669
|
+
## File Layout
|
|
670
|
+
|
|
671
|
+
```
|
|
672
|
+
./research/scratch/
|
|
673
|
+
n1_<slug>.md
|
|
674
|
+
n2_<slug>.md
|
|
675
|
+
...
|
|
676
|
+
r1_review_<slug>.md
|
|
677
|
+
r2_review_<slug>.md
|
|
678
|
+
...
|
|
679
|
+
|
|
680
|
+
./research/ref/
|
|
681
|
+
INDEX.md
|
|
682
|
+
<repo_name>/ (git clone --depth 1)
|
|
683
|
+
<filename>.pdf
|
|
684
|
+
<filename>.txt (RFCs, plain-text specs)
|
|
685
|
+
<filename>.zip (spec bundles, standard packages)
|
|
686
|
+
|
|
687
|
+
./research/projects/{{NAME}}/ ← isolated per-project directory
|
|
688
|
+
.{{NAME}}.research.prompt ← self-identifying coordinator prompt (NAME may change at runtime)
|
|
689
|
+
RESEARCH.md ← References table may include research rows:
|
|
690
|
+
| [<prior>](../<prior>/RESEARCH.md) | research | — | ... | prior |
|
|
691
|
+
```
|
|
692
|
+
~~~
|