@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
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
# Design Thinking
|
|
1
|
+
# Design Thinking
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
The code method. Read the problem. Draw the data flow as a call graph. Write
|
|
4
|
+
code that IS the graph. If the code doesn't match the graph, something is wrong.
|
|
5
|
+
|
|
6
|
+
One of three methods with the same shape (see [design-graph.md](design-graph.md)
|
|
7
|
+
for the interface, [graph-protocol.md](graph-protocol.md) for delegation to
|
|
8
|
+
agents). The original is written in Effect-TS ([effect-ts.md](effect-ts.md)).
|
|
9
|
+
This version is stack-agnostic: where the original says `Effect`, `gen`, or
|
|
10
|
+
`pipe`, use your stack's equivalent (Result types, exceptions at layer joins,
|
|
11
|
+
middleware, RAII, constructor injection). The discipline never changes, only
|
|
12
|
+
the vocabulary.
|
|
6
13
|
|
|
7
|
-
The method is language-neutral. Where it says "Effect", "gen", or "pipe" in the
|
|
8
|
-
Effect-TS appendix (`effect-ts.md`), substitute your stack's equivalent: Result
|
|
9
|
-
types, exceptions at layer joins, middleware, RAII, constructor injection —
|
|
10
|
-
whatever your language provides. The discipline never changes, only the vocabulary.
|
|
11
14
|
**Hard gate — applies in every harness (pi, omp, Claude Code, any agent):**
|
|
12
15
|
When the user asks for a feature, change, fix, or refactor — or when any turn
|
|
13
|
-
will end in proposed code or file edits — you MUST render the
|
|
14
|
-
(
|
|
15
|
-
implement only after the user approves the design.
|
|
16
|
-
first is fine; the FIRST edit is not allowed
|
|
17
|
-
not optional and not stack-dependent.
|
|
18
|
-
|
|
19
|
-
Render every result in [Graph Protocol](protocol.md) format.
|
|
16
|
+
will end in proposed code or file edits — you MUST render the graph (in the
|
|
17
|
+
[output format](output-format.md)) and any clarifying questions BEFORE
|
|
18
|
+
touching any file, and implement only after the user approves the design.
|
|
19
|
+
Reading and exploring code first is fine; the FIRST edit is not allowed
|
|
20
|
+
before the graph. This rule is not optional and not stack-dependent.
|
|
20
21
|
|
|
21
22
|
```
|
|
22
|
-
X →
|
|
23
|
+
X → Graph → Effect<A, E, R>
|
|
23
24
|
│ │ │ │ │
|
|
24
25
|
│ │ │ │ └─ what each node needs (§5)
|
|
25
26
|
│ │ │ └──── where the graph breaks (§4)
|
|
@@ -38,9 +39,12 @@ X → DesignGraph<A, E, R>
|
|
|
38
39
|
§7 Behavior orthogonal layers wrap without changing the graph
|
|
39
40
|
§8 Scope acquire/release tied to lifecycle
|
|
40
41
|
§9 Test swap R, same graph shape
|
|
41
|
-
§10
|
|
42
|
+
§10 Code happy path body = A, failure join points = E
|
|
42
43
|
```
|
|
43
44
|
|
|
45
|
+
`Effect<A, E, R>` names any computation: it succeeds with A, fails with E,
|
|
46
|
+
and needs R to run.
|
|
47
|
+
|
|
44
48
|
## 1. Name the shapes
|
|
45
49
|
|
|
46
50
|
What are the things? Before drawing a graph, define the domain language.
|
|
@@ -54,7 +58,7 @@ What are the things? Before drawing a graph, define the domain language.
|
|
|
54
58
|
These are the nouns. The graph is the verbs. You cannot draw the graph until
|
|
55
59
|
you know what flows through it.
|
|
56
60
|
|
|
57
|
-
→ *
|
|
61
|
+
→ *Output section: SHAPES.*
|
|
58
62
|
|
|
59
63
|
## 2. Think A first
|
|
60
64
|
|
|
@@ -68,7 +72,7 @@ What is the success data flow? What goes in, what comes out, what transforms
|
|
|
68
72
|
happen in between? This graph IS your program structure. Draw it first. The
|
|
69
73
|
code follows.
|
|
70
74
|
|
|
71
|
-
→ *
|
|
75
|
+
→ *Output section: GRAPH (edges) + header tree (A).*
|
|
72
76
|
|
|
73
77
|
## 3. One or many?
|
|
74
78
|
|
|
@@ -83,7 +87,7 @@ Is each node one-shot or a flow?
|
|
|
83
87
|
Same three channels (A, E, R) in all cases. Different cardinality. Mark it on
|
|
84
88
|
the graph so the code matches.
|
|
85
89
|
|
|
86
|
-
→ *
|
|
90
|
+
→ *Output section: CARDINALITY.*
|
|
87
91
|
|
|
88
92
|
## 4. Think E second
|
|
89
93
|
|
|
@@ -102,7 +106,7 @@ that as Result types, checked exceptions, error returns, or a strict rule that
|
|
|
102
106
|
exceptions only cross at layer joins. You decide at each node: retry, escape,
|
|
103
107
|
or propagate. Only `die` when the program's assumptions are violated.
|
|
104
108
|
|
|
105
|
-
→ *
|
|
109
|
+
→ *Output section: GRAPH (E annotations) + VERDICT.*
|
|
106
110
|
|
|
107
111
|
## 5. Think R third
|
|
108
112
|
|
|
@@ -116,7 +120,7 @@ database connection, a config value, an HTTP client. R shrinks as you provide
|
|
|
116
120
|
layers. When R is empty, the program can run. If R is not empty, the compiler
|
|
117
121
|
or the wiring tells you exactly what's missing.
|
|
118
122
|
|
|
119
|
-
→ *
|
|
123
|
+
→ *Output section: GRAPH (R annotations) + TEST LAYERS.*
|
|
120
124
|
|
|
121
125
|
## 6. Trust at boundary
|
|
122
126
|
|
|
@@ -130,7 +134,7 @@ transformer. Define it once, use it everywhere.
|
|
|
130
134
|
Trust nothing at the boundary. Trust everything inside. The boundary is the
|
|
131
135
|
only place you parse. After that, the types guarantee shape.
|
|
132
136
|
|
|
133
|
-
→ *
|
|
137
|
+
→ *Output section: BOUNDARIES.*
|
|
134
138
|
|
|
135
139
|
## 7. Layer behavior
|
|
136
140
|
|
|
@@ -143,7 +147,7 @@ without wading through retry logic and timeout configuration. Behavior is
|
|
|
143
147
|
composed orthogonally. The graph says WHAT happens. The layers say HOW it
|
|
144
148
|
behaves under pressure.
|
|
145
149
|
|
|
146
|
-
→ *
|
|
150
|
+
→ *Output section: BEHAVIOR.*
|
|
147
151
|
|
|
148
152
|
## 8. Scope resources
|
|
149
153
|
|
|
@@ -154,7 +158,7 @@ Acquire/release must be structurally bound: RAII, `defer`, context managers,
|
|
|
154
158
|
`try/finally` at the owning node — even on error, even on interrupt. Cleanup
|
|
155
159
|
is structural, not a TODO comment you hope someone remembers.
|
|
156
160
|
|
|
157
|
-
→ *
|
|
161
|
+
→ *Output section: SCOPE.*
|
|
158
162
|
|
|
159
163
|
## 9. Swap R to prove it
|
|
160
164
|
|
|
@@ -168,9 +172,9 @@ doing too much.
|
|
|
168
172
|
This is the payoff of separating A, E, and R — you prove the graph correct by
|
|
169
173
|
swapping what's behind R.
|
|
170
174
|
|
|
171
|
-
→ *
|
|
175
|
+
→ *Output section: TEST LAYERS.*
|
|
172
176
|
|
|
173
|
-
## 10.
|
|
177
|
+
## 10. Happy path is A, join points are E
|
|
174
178
|
|
|
175
179
|
The separation of A (§2) and E (§4) maps directly onto code structure, in any
|
|
176
180
|
language:
|
|
@@ -197,7 +201,7 @@ storage errors and produces a domain error. Auth catches domain errors and
|
|
|
197
201
|
produces an access error. The handler catches access errors and produces the
|
|
198
202
|
declared interface error. Each layer's handling is a complete enumeration of
|
|
199
203
|
what IT received — not what originated three layers down. Consumers never see
|
|
200
|
-
implementation errors from deeper layers. *(See
|
|
204
|
+
implementation errors from deeper layers. *(See [output-format.md](output-format.md) for the diagram.)*
|
|
201
205
|
|
|
202
206
|
### Divergent strategies
|
|
203
207
|
|
package/references/effect-ts.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
> **Source**: Design Thinking by [r17x](https://github.com/r17x) —
|
|
2
2
|
> https://gist.github.com/r17x/90eb2f7be93932b5693753aedb09c01a
|
|
3
3
|
> Bundled verbatim as the original Effect-TS instantiation of the method.
|
|
4
|
-
> The generalized, stack-agnostic version lives in [
|
|
5
|
-
> the
|
|
4
|
+
> The generalized, stack-agnostic version lives in [design-thinking.md](design-thinking.md);
|
|
5
|
+
> the output format lives in [output-format.md](output-format.md).
|
|
6
6
|
|
|
7
7
|
# Design Thinking
|
|
8
8
|
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
> **Source**: Graph Protocol by [r17x](https://github.com/r17x), from
|
|
2
|
+
> https://gist.github.com/r17x/90eb2f7be93932b5693753aedb09c01a (`OPT_GRAPH_PROTOCOL.md`).
|
|
3
|
+
> Method text bundled as-is. The block formats at the end (execution graph,
|
|
4
|
+
> AGENT SUBGRAPH, IMPLEMENTED GRAPH, retry and evolution) are taken from r17x's
|
|
5
|
+
> "Meta Research Prompt Generator" ([meta-research.md](meta-research.md)) and
|
|
6
|
+
> made generic for any delegated task.
|
|
7
|
+
|
|
8
|
+
# Graph Protocol
|
|
9
|
+
|
|
10
|
+
The same method, turned on the orchestration. A task is not a checklist — it is a graph with nodes, edges, and channels, and the delegation you write is the subgraph the worker walks.
|
|
11
|
+
|
|
12
|
+
Design Thinking answers what flows through the program. Graph Protocol answers what flows through the orchestration. Same three-channel discipline: one channel for the work, one channel for where delegation breaks, one channel for what each agent needs.
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
X → Graph → Delegation<A, E, R>
|
|
16
|
+
│ │ │ │ │
|
|
17
|
+
│ │ │ │ └─ what each agent needs (§5)
|
|
18
|
+
│ │ │ └──── where the delegation breaks (§4)
|
|
19
|
+
│ │ └─────── what flows through agents (§2)
|
|
20
|
+
│ │
|
|
21
|
+
│ └─ nodes = tasks, edges = data dependencies
|
|
22
|
+
│
|
|
23
|
+
└─ the problem: what you're trying to build
|
|
24
|
+
|
|
25
|
+
§1 Task Nodes the nouns: files, modules, domains, workers
|
|
26
|
+
§2 A happy path as execution graph
|
|
27
|
+
§3 Cardinality one worker (SMALL) or many (MEDIUM/LARGE)
|
|
28
|
+
§4 E break points: wrong context, missing input, misinterpretation
|
|
29
|
+
§5 R requirements: subgraph, design method, verification, WHY
|
|
30
|
+
§6 Boundary subgraph in, implemented graph out — structured at edges
|
|
31
|
+
§7 Behavior observe wraps delegation without changing the graph
|
|
32
|
+
§8 Scope worker attention is acquired and must be released
|
|
33
|
+
§9 Proof compare delegated subgraph vs implemented graph
|
|
34
|
+
§10 Structure prompt = subgraph, return = implemented graph
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Read the problem. Draw the task flow as an execution graph. Delegate work that IS the subgraph. If the implemented graph does not match the delegated subgraph, the delegation is wrong.
|
|
38
|
+
|
|
39
|
+
## 1. Name the task nodes
|
|
40
|
+
|
|
41
|
+
What are the units of work? Before drawing an execution graph, define the orchestration language.
|
|
42
|
+
|
|
43
|
+
- **Nodes** -- the discrete units of work. A service change, a component update, a config edit. Each has a domain and a worker.
|
|
44
|
+
- **Domains** -- who owns the node. Each domain maps to a worker with the right expertise. One node, one owner.
|
|
45
|
+
- **Edges** -- data dependencies between nodes. Node C needs the output of nodes A and B. No edge means independent.
|
|
46
|
+
- **Waves** -- groups of independent nodes that run in parallel. Edges between waves create gates.
|
|
47
|
+
|
|
48
|
+
These are the nouns. The execution is the verbs. You cannot delegate until you know what depends on what.
|
|
49
|
+
|
|
50
|
+
## 2. Think A first
|
|
51
|
+
|
|
52
|
+
Map the successful task as an execution graph before spawning any worker.
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
wave1[A∥B] → gate → wave2[C] → wave3[D]
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
What is the happy path through the task? Which nodes are independent (parallel)? Which depend on prior results (sequential)? This graph IS your delegation plan. Draw it first. The spawning follows.
|
|
59
|
+
|
|
60
|
+
## 3. One or many?
|
|
61
|
+
|
|
62
|
+
Is the task one worker or many?
|
|
63
|
+
|
|
64
|
+
- **One worker** -- a small or trivial task. Single node, no execution graph needed. Inline the task in the prompt.
|
|
65
|
+
- **Many workers** -- a medium or large task. Multiple nodes, draw the execution graph. Each worker gets its subgraph.
|
|
66
|
+
- **Waves** -- independent nodes in the same wave spawn in parallel. The gate between waves waits for all prior nodes.
|
|
67
|
+
|
|
68
|
+
Same three channels (A, E, R) in all cases. Different cardinality. Mark it on the graph so the delegation matches.
|
|
69
|
+
|
|
70
|
+
## 4. Think E second
|
|
71
|
+
|
|
72
|
+
Mark where the delegation can break. Each break point is one of three things:
|
|
73
|
+
|
|
74
|
+
- **Wrong context** -- the worker does not understand the problem as deeply as the coordinator. Missing files, missing WHY, missing constraints.
|
|
75
|
+
- **Missing input** -- a node in wave 2 needs the output of wave 1, but the coordinator did not pass it. The edge is invisible.
|
|
76
|
+
- **Misinterpretation** -- the worker implements the LETTER of the delegation, not the INTENT. The subgraph was ambiguous.
|
|
77
|
+
|
|
78
|
+
Delegation failures are not worker failures — they are coordinator failures. The coordinator controls the prompt. If the worker misunderstands, the prompt was wrong.
|
|
79
|
+
|
|
80
|
+
## 5. Think R third
|
|
81
|
+
|
|
82
|
+
Mark what each worker needs before it can do the work. "The worker cannot do X if it does not have Y."
|
|
83
|
+
|
|
84
|
+
R is the delegation prompt completeness check. Every worker needs:
|
|
85
|
+
- **Subgraph** -- what to implement, in the notation the worker's domain expects
|
|
86
|
+
- **Design method** -- which methodology applies to this worker's domain, and which sections govern the work
|
|
87
|
+
- **Verification command** -- how the worker proves the work is correct
|
|
88
|
+
- **WHY** -- the reason this node exists, not just what to change
|
|
89
|
+
|
|
90
|
+
If any R is missing from the prompt, the worker will guess. Guessing is the source of misinterpretation (§4).
|
|
91
|
+
|
|
92
|
+
## 6. Trust at boundary
|
|
93
|
+
|
|
94
|
+
Where does unstructured data cross the orchestration boundary? The coordinator sends a prompt. The worker sends a result.
|
|
95
|
+
|
|
96
|
+
Structure at the boundary. The coordinator includes the subgraph in the prompt — not prose, not "fix the thing," but the graph the worker must implement. The worker returns the implemented graph in its result — not a bare signal, but the graph it actually built.
|
|
97
|
+
|
|
98
|
+
Trust nothing at the boundary. Trust everything inside. The boundary is the only place the graph is transferred. After that, the worker owns its subgraph.
|
|
99
|
+
|
|
100
|
+
## 7. Layer behavior
|
|
101
|
+
|
|
102
|
+
What wraps the delegation without changing the graph? Observations, session tracking, phase transitions.
|
|
103
|
+
|
|
104
|
+
The coordinator records the delegated subgraph BEFORE spawning. The worker records the implemented graph AFTER implementing. These observations wrap the delegation without changing what the worker does. The happy path stays clean — you can read it without wading through session tracking.
|
|
105
|
+
|
|
106
|
+
## 8. Scope attention
|
|
107
|
+
|
|
108
|
+
A worker is a resource. It is acquired (spawned) and must be released (completed with structured data).
|
|
109
|
+
|
|
110
|
+
The coordinator acquires a worker's attention by spawning it. The worker releases attention by completing with the implemented graph. Between acquire and release, the worker owns its subgraph. The coordinator does not interfere — it waits at the gate.
|
|
111
|
+
|
|
112
|
+
If a worker is spawned without a clear subgraph, its attention is wasted. If a worker completes without reporting its implemented graph, the data is lost. Acquire with structure. Release with data.
|
|
113
|
+
|
|
114
|
+
## 9. Compare to prove it
|
|
115
|
+
|
|
116
|
+
The delegated subgraph and the implemented graph must match. If they do not, something is wrong.
|
|
117
|
+
|
|
118
|
+
After the worker completes, the coordinator reads both records:
|
|
119
|
+
- The delegated subgraph (what was asked)
|
|
120
|
+
- The implemented graph (what was built)
|
|
121
|
+
|
|
122
|
+
Same nodes. Same A flowing through. Same E possible. If the implemented graph has nodes the delegated subgraph did not mention, the worker went off-script. If the delegated subgraph has nodes the implemented graph did not cover, the worker missed something. This is the payoff of structuring at the boundary — you prove the delegation correct by comparing graphs.
|
|
123
|
+
|
|
124
|
+
## 10. Prompt is subgraph, return is implemented graph
|
|
125
|
+
|
|
126
|
+
The separation of delegation (§6) and return (§7) maps directly to orchestration structure:
|
|
127
|
+
|
|
128
|
+
- **The prompt** -- carries the subgraph. The graph the worker must implement, in the notation the domain expects, with context and verification.
|
|
129
|
+
- **The return** -- carries the implemented graph. The graph the worker actually built, structured so the coordinator can compare it against the delegated subgraph.
|
|
130
|
+
|
|
131
|
+
This is not a stylistic preference. If the subgraph lives in prose and the return is a bare string, the delegation and verification are tangled — you cannot read what was asked without parsing natural language, and you cannot verify what was built without reading the entire diff. The prompt IS the delegated graph. The return IS the implemented graph.
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## The Protocol Pipeline
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
TASK
|
|
139
|
+
-> "What are the task nodes?" -> define nodes, domains, edges
|
|
140
|
+
-> "What is the happy path?" -> draw the execution graph (A)
|
|
141
|
+
-> "One worker or many?" -> mark cardinality
|
|
142
|
+
-> "Where can the delegation break?" -> annotate break points (E)
|
|
143
|
+
-> "What does each worker need?" -> annotate requirements (R)
|
|
144
|
+
-> "Where does the graph cross boundaries?" -> subgraph in, implemented graph out
|
|
145
|
+
-> "What wraps delegation without changing it?" -> observe before and after
|
|
146
|
+
-> "What resources need release?" -> scope worker attention
|
|
147
|
+
-> "Does the implemented graph match?" -> compare delegated vs implemented
|
|
148
|
+
-> "Does my prompt separate subgraph from prose?" -> prompt = subgraph, return = graph
|
|
149
|
+
-> DELEGATION -> the delegation IS the subgraph
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**If the implemented graph does not match the delegated subgraph, the delegation is wrong.**
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Block formats
|
|
157
|
+
|
|
158
|
+
The method says the prompt IS the subgraph and the return IS the implemented
|
|
159
|
+
graph. These are the fixed blocks that carry them. Emit them with no prose
|
|
160
|
+
around them.
|
|
161
|
+
|
|
162
|
+
### When to use them
|
|
163
|
+
|
|
164
|
+
Apply §3 first. One worker (a small task, one node) needs no execution graph:
|
|
165
|
+
do the work, or inline the task in one prompt. Many workers (two or more
|
|
166
|
+
nodes, or any node a separate agent will run) get all blocks below.
|
|
167
|
+
|
|
168
|
+
### 1. Execution graph (the delegated graph)
|
|
169
|
+
|
|
170
|
+
Emit before any agent is spawned.
|
|
171
|
+
|
|
172
|
+
```
|
|
173
|
+
DELEGATED GRAPH: <task name>
|
|
174
|
+
|
|
175
|
+
NODES:
|
|
176
|
+
N1 domain=<owner> output=<file, dir, or commit> status=pending|pre-done
|
|
177
|
+
N2 domain=<owner> output=<...> status=pending|pre-done
|
|
178
|
+
...
|
|
179
|
+
|
|
180
|
+
EDGES:
|
|
181
|
+
N1 → N3 (N3 reads N1.output)
|
|
182
|
+
N2 → N3
|
|
183
|
+
|
|
184
|
+
WAVES:
|
|
185
|
+
WAVE 1 : [N1 ∥ N2] — <purpose>
|
|
186
|
+
WAVE 2 : [N3] — <purpose>
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Constraints:
|
|
190
|
+
- One node, one owner, one output.
|
|
191
|
+
- No edge between two nodes means they are independent and share a wave.
|
|
192
|
+
- A node whose output already exists and is non-empty is `pre-done`: do not
|
|
193
|
+
spawn it, count it as done for gating.
|
|
194
|
+
- Nodes that touch the same files never share a wave.
|
|
195
|
+
|
|
196
|
+
### 2. AGENT SUBGRAPH (the prompt)
|
|
197
|
+
|
|
198
|
+
One per node, passed to the agent verbatim with values filled in. No preamble.
|
|
199
|
+
This block covers every R from §5: subgraph, design method, verification, WHY.
|
|
200
|
+
|
|
201
|
+
```
|
|
202
|
+
═══════════════════════════════════════════════════
|
|
203
|
+
AGENT SUBGRAPH — <node id> <short title>
|
|
204
|
+
═══════════════════════════════════════════════════
|
|
205
|
+
|
|
206
|
+
WHY : <the reason this node exists, not only what to change>
|
|
207
|
+
INPUTS : <outputs of upstream nodes this node reads, or none>
|
|
208
|
+
OUTPUT : <exact path(s) or artifact this node must produce>
|
|
209
|
+
METHOD : <which method and sections govern the work, e.g. Design Thinking §2 §4 §6>
|
|
210
|
+
SUBGRAPH : <this node's slice of the design graph, in the method's notation>
|
|
211
|
+
VERIFY : <command that proves the work, or "coordinator verifies">
|
|
212
|
+
CONSTRAINTS : <files it may touch, files it must not touch, rules>
|
|
213
|
+
|
|
214
|
+
TASK
|
|
215
|
+
────
|
|
216
|
+
1. <bounded step>
|
|
217
|
+
2. <bounded step>
|
|
218
|
+
...
|
|
219
|
+
|
|
220
|
+
OUTPUT must exist before returning.
|
|
221
|
+
|
|
222
|
+
RETURN:
|
|
223
|
+
STATUS : done | failed | evolved
|
|
224
|
+
OUTPUT : <path(s)>
|
|
225
|
+
IMPLEMENTED GRAPH : <the graph actually built, same notation as SUBGRAPH>
|
|
226
|
+
VERIFY_RESULT : <pass | fail + first failing line | not run>
|
|
227
|
+
SUMMARY : <3-5 sentences>
|
|
228
|
+
EVOLVED_SCOPE : <new scope, only if evolved>
|
|
229
|
+
FAILURE_REASON : <only if failed>
|
|
230
|
+
|
|
231
|
+
RETRY : coordinator re-spawns once on failure with identical subgraph.
|
|
232
|
+
EVOLVE: coordinator re-plans the node on evolved; see Evolution.
|
|
233
|
+
═══════════════════════════════════════════════════
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### 3. Gates
|
|
237
|
+
|
|
238
|
+
After each wave: collect every RETURN. Re-spawn any `failed` node once.
|
|
239
|
+
Handle `evolved` nodes (below) before the next wave. A node that fails twice is
|
|
240
|
+
FAILED: downstream nodes proceed without its output and say so. WAVE n+1 never
|
|
241
|
+
starts before WAVE n is done or FAILED.
|
|
242
|
+
|
|
243
|
+
### 4. Retry
|
|
244
|
+
|
|
245
|
+
1. Agent returns `STATUS=failed`.
|
|
246
|
+
2. Re-spawn once with the identical subgraph. No changes.
|
|
247
|
+
3. Second failure: mark FAILED, add to FAILURES.
|
|
248
|
+
4. Never retry more than once. Never change the subgraph on retry.
|
|
249
|
+
|
|
250
|
+
### 5. Evolution
|
|
251
|
+
|
|
252
|
+
When a node returns `STATUS=evolved` (the work showed the scope must change to
|
|
253
|
+
produce a useful output), the coordinator, not the worker, updates the node:
|
|
254
|
+
|
|
255
|
+
1. Rewrite that node's AGENT SUBGRAPH with the new scope. Keep every other
|
|
256
|
+
field.
|
|
257
|
+
2. If the change adds or removes edges, update the DELEGATED GRAPH and say so.
|
|
258
|
+
3. Re-spawn the node with the updated subgraph. If it then fails, apply Retry.
|
|
259
|
+
4. Record the change in EVOLUTIONS.
|
|
260
|
+
|
|
261
|
+
### 6. Implemented graph (the return)
|
|
262
|
+
|
|
263
|
+
Emit after the last wave. No prose around it.
|
|
264
|
+
|
|
265
|
+
```
|
|
266
|
+
═══════════════════════════════════════════════════
|
|
267
|
+
IMPLEMENTED GRAPH: <task name>
|
|
268
|
+
═══════════════════════════════════════════════════
|
|
269
|
+
|
|
270
|
+
WAVE 1 — <purpose>
|
|
271
|
+
N1 status=done|pre-done|failed output=... verify=...
|
|
272
|
+
N2 status=done|pre-done|failed output=... verify=...
|
|
273
|
+
|
|
274
|
+
WAVE 2 — <purpose>
|
|
275
|
+
N3 status=... output=... verify=...
|
|
276
|
+
|
|
277
|
+
FAILURES : [node ids that failed after retry, or none]
|
|
278
|
+
EVOLUTIONS : [{ node, original_scope, evolved_scope }, or none]
|
|
279
|
+
OFF-SCRIPT : [nodes or files in implemented graphs that no subgraph asked for, or none]
|
|
280
|
+
GAPS : [delegated nodes or files no implemented graph covers, or none]
|
|
281
|
+
VERDICT : matches | mismatches listed above
|
|
282
|
+
═══════════════════════════════════════════════════
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
Compare every RETURN's IMPLEMENTED GRAPH with its SUBGRAPH (§9). Do not trust
|
|
286
|
+
a worker's own "pass": re-run VERIFY yourself where you can.
|
|
287
|
+
|
|
288
|
+
### 7. Invariants
|
|
289
|
+
|
|
290
|
+
1. One node, one owner, one output.
|
|
291
|
+
2. Every spawned agent gets an AGENT SUBGRAPH. No free-text delegation.
|
|
292
|
+
3. Every agent returns a RETURN block. A bare "done" is a failed return.
|
|
293
|
+
4. WAVE n+1 never starts before WAVE n completes (modulo FAILED nodes).
|
|
294
|
+
5. The implemented graph is structurally the same as the delegated graph, or
|
|
295
|
+
the VERDICT names each difference.
|
|
296
|
+
|
|
297
|
+
### Harness note
|
|
298
|
+
|
|
299
|
+
Spawn each node with the harness's subagent tool: `Agent` in Claude Code, the
|
|
300
|
+
built-in task tool in omp, a subagent package in pi. When no subagent tool
|
|
301
|
+
exists, run the nodes yourself in wave order. Use the same AGENT SUBGRAPH as
|
|
302
|
+
your own instructions for that node, and write the same RETURN block.
|