@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.
@@ -1,22 +1,22 @@
1
1
  ---
2
- description: Design before code — produce a complete Design Graph for a task, then implement to match it
2
+ description: Design before code - full graph for a task, delegation plan when it needs many workers, then implement to match
3
3
  argument-hint: "<task description>"
4
4
  ---
5
5
  Task: $@
6
6
 
7
- Design it before writing any code. Apply the full Design Thinking pipeline and
8
- produce a complete Design Graph in Graph Protocol format. Code suggestions must
9
- match the graph — if a snippet contradicts the graph, fix the graph or fix the
10
- code, never let them drift silently.
7
+ Design it before writing any code. Three steps, in order.
11
8
 
12
- ## Graph Protocol — quick reference
9
+ ## Step 1: the design graph
13
10
 
14
- Emit ALL sections below, in this order, with these markers:
11
+ Code task: apply the Design Thinking pipeline (§1-§10) and emit every section
12
+ of the output format below. Interface task (screens, flows, components): use
13
+ the Design Graph skeleton from `design-graph.md` instead (JOB, SURFACES, FLOW,
14
+ CARDINALITY, VOID, NEEDS, BOUNDARY, BEHAVIOR, ATTENTION, PROOF, VERDICT).
15
15
 
16
16
  ```
17
- PROBLEM: <one line — if it doesn't fit, the problem is not understood; refine first>
17
+ PROBLEM: <one line; if it doesn't fit, the problem is not understood, refine first>
18
18
 
19
- X → DesignGraph<A, E, R>
19
+ X → Graph → Effect<A, E, R>
20
20
  │ │ │ │ │
21
21
  │ │ │ │ └─ R: what each node needs (§5)
22
22
  │ │ │ └──── E: where the graph breaks (§4)
@@ -27,38 +27,59 @@ X → DesignGraph<A, E, R>
27
27
  └─ the problem
28
28
 
29
29
  SHAPES: records · IDs · state variants · named errors
30
- GRAPH: ascii call graph, annotated inline:
30
+ GRAPH: ascii call graph, annotated inline (planned nodes marked [new]):
31
31
  R: deps · E: err ⟳retry[×n] → ↯escape(alt) | ☠die · 🔒 unknown→trusted
32
32
  CARDINALITY: node (1) one-shot · (N) many over time · (T) time-bounded
33
33
  BOUNDARIES: every untrusted→trusted crossing (parse, don't validate)
34
34
  BEHAVIOR: orthogonal layers (retry, cache, logging) that wrap without changing the graph
35
35
  SCOPE: resources: acquire@x → release@x (structural, not convention)
36
- TEST LAYERS: the R tests provide — same GRAPH, zero code change
36
+ TEST LAYERS: the R tests provide; same GRAPH, zero code change
37
37
  VERDICT: the target structure the implementation must satisfy
38
38
  ```
39
39
 
40
- ## Pipeline to follow
40
+ Pipeline:
41
41
 
42
- 1. **§1 Shapes** — the domain nouns, named before any graph is drawn.
43
- 2. **§2 A** — happy path as a call graph, drawn first.
44
- 3. **§3 Cardinality** — one-shot `(1)`, many `(N)`, time-bounded `(T)` per node.
45
- 4. **§4 E** — every break point gets one of: `⟳retry`, `↯escape(alt)`, `☠die`.
46
- 5. **§5 R** — every node declares its requirements; provided at the composition root.
47
- 6. **§6 Boundary** — parse `unknown → trusted` at edges only; trust inside.
48
- 7. **§7 Behavior** — cross-cutting concerns wrap nodes orthogonally.
49
- 8. **§8 Scope** — acquire/release structurally bound (RAII / defer / context managers).
50
- 9. **§9 Test** — same graph runs with test R; if it can't, hidden deps exist.
51
- 10. **§10 Structure** — happy path body = A only; failure handling at defined
52
- join points = E. Divergent strategies (per-fork failure semantics) are the
53
- one exception — mark them.
42
+ 1. **§1 Shapes**: the domain nouns, named before any graph is drawn.
43
+ 2. **§2 A**: happy path as a call graph, drawn first.
44
+ 3. **§3 Cardinality**: `(1)`, `(N)`, `(T)` per node.
45
+ 4. **§4 E**: every break point gets `⟳retry`, `↯escape(alt)`, or `☠die`.
46
+ 5. **§5 R**: every node declares its requirements; provided at the composition root.
47
+ 6. **§6 Boundary**: parse `unknown → trusted` at edges only; trust inside.
48
+ 7. **§7 Behavior**: cross-cutting concerns wrap nodes orthogonally.
49
+ 8. **§8 Scope**: acquire/release structurally bound (RAII / defer / context managers).
50
+ 9. **§9 Test**: same graph runs with test R; if it can't, hidden deps exist.
51
+ 10. **§10 Code**: happy path body = A only; failure join points = E. Divergent
52
+ strategies (per-fork failure semantics) are the one exception; mark them.
54
53
 
55
- ## Output contract
54
+ ## Step 2: one worker or many (Graph Protocol §3)
56
55
 
57
- - Design Graph first (all Protocol sections), then the implementation.
56
+ - **One worker** (small task, one node, done in this session): no execution
57
+ graph. Go to step 3.
58
+ - **Many workers** (two or more independent parts, or any part a subagent or
59
+ separate worker will do): emit the Graph Protocol blocks from
60
+ `graph-protocol.md`: the DELEGATED GRAPH (nodes, edges, waves), then one
61
+ AGENT SUBGRAPH per node. Each node's SUBGRAPH field is its slice of the
62
+ step 1 graph. Every subgraph carries WHY, INPUTS, OUTPUT, METHOD, VERIFY,
63
+ and a RETURN block. Nodes that touch the same files never share a wave.
64
+
65
+ ## Step 3: implement to match
66
+
67
+ - One worker: implement. Code must match the step 1 graph; if a snippet
68
+ contradicts the graph, fix the graph or fix the code, never let them drift.
69
+ - Many workers: spawn each wave with its AGENT SUBGRAPHs, gate between waves,
70
+ retry a failed node once, re-plan evolved nodes. After the last wave emit
71
+ the IMPLEMENTED GRAPH and compare it with the DELEGATED GRAPH (OFF-SCRIPT,
72
+ GAPS, VERDICT). Re-run VERIFY yourself; never trust a worker's own "pass".
73
+
74
+ Output contract:
75
+
76
+ - Graph first, delegation blocks second (only when many workers), then the
77
+ implementation.
58
78
  - Each layer scopes its own E before handing off; inner errors never leak.
59
- - Adapt vocabulary to the project's language/stack — never the discipline.
60
- - The VERDICT section states the structural invariants the code must satisfy so
61
- the graph can later be re-checked in review (`/cg-review`).
79
+ - Adapt vocabulary to the project's language/stack, never the discipline.
80
+ - The VERDICT states the structural invariants the code must satisfy, so the
81
+ graph can later be re-checked with `/cg-review`.
62
82
 
63
- Full specs live in this package's `references/` directory: `protocol.md`
64
- (notation), `method.md` (the method), `design-graph.md` (artifact).
83
+ Full specs live in this package's `references/` directory: `design-thinking.md`
84
+ (the code method), `output-format.md` (format + checklist), `design-graph.md`
85
+ (the interface method), `graph-protocol.md` (delegation to agents).
@@ -1,21 +1,21 @@
1
1
  ---
2
- description: Review code against its call graph — reconstruct the implemented Design Graph and diff it
2
+ description: Review code against its call graph - reconstruct the implemented graph and diff it
3
3
  argument-hint: "[file | module | diff, default: current diff]"
4
4
  ---
5
5
  Review target: ${@:-the current uncommitted diff (git diff)}
6
6
 
7
- Reconstruct the Design Graph the code ACTUALLY implements — not the one the
7
+ Reconstruct the graph the code ACTUALLY implements — not the one the
8
8
  author intended. Then diff it against the method's completeness checklist.
9
9
  Every mismatch is a finding.
10
10
 
11
- ## Graph Protocol — quick reference
11
+ ## Output format: quick reference
12
12
 
13
13
  Emit ALL sections below, in this order, with these markers:
14
14
 
15
15
  ```
16
16
  PROBLEM: <one line — what this code does, as implemented>
17
17
 
18
- X → DesignGraph<A, E, R>
18
+ X → Graph → Effect<A, E, R>
19
19
  │ │ │ │ │
20
20
  │ │ │ │ └─ R: what each node needs (§5)
21
21
  │ │ │ └──── E: where the graph breaks (§4)
@@ -58,11 +58,17 @@ VERDICT: <matches | mismatches listed by § number>
58
58
 
59
59
  ## Output contract
60
60
 
61
- - Implemented graph first (all Protocol sections), then findings, then VERDICT.
61
+ - Implemented graph first (all output sections), then findings, then VERDICT.
62
62
  - VERDICT must be explicit: "code matches graph" or the mismatch list.
63
63
  - If an intended graph exists (e.g. from a prior `/cg-plan`), diff against it;
64
64
  otherwise review against the checklist alone.
65
65
  - Severity: mark findings that will cause runtime failures vs structural debt.
66
+ - Interface code: reconstruct the Design Graph skeleton (`design-graph.md`)
67
+ and group findings by its § numbers (void states, needs, attention scope).
68
+ - Delegated work: when the target is a DELEGATED GRAPH or AGENT SUBGRAPH plus
69
+ the workers' RETURN blocks (`graph-protocol.md`), compare each SUBGRAPH with
70
+ its IMPLEMENTED GRAPH and the real diff: list OFF-SCRIPT and GAPS, then VERDICT.
66
71
 
67
- Full specs live in this package's `references/` directory: `protocol.md`
68
- (notation), `method.md` (the method), `design-graph.md` (artifact).
72
+ Full specs live in this package's `references/` directory: `design-thinking.md`
73
+ (the code method), `output-format.md` (format + checklist), `design-graph.md`
74
+ (the interface method), `graph-protocol.md` (delegation to agents).
package/prompts/cg.md CHANGED
@@ -1,19 +1,56 @@
1
1
  ---
2
- description: Generate a call graph of a module or task in Graph Protocol format
2
+ description: Generate a call graph of a module or task (Design Thinking output format)
3
3
  argument-hint: "<module | task>"
4
4
  ---
5
5
  Extract (if target is existing code) or sketch (if target is a task) the call graph for: $@
6
6
 
7
- Apply the Design Graph method — nodes are functions, edges are data flow.
7
+ Apply the Design Thinking method: nodes are functions, edges are data flow.
8
8
 
9
- ## Graph Protocol — quick reference
9
+ ## Trace of existing code: call graph block
10
+
11
+ When the target is existing code, the GRAPH section is this block. Plain
12
+ text only, no rendered diagrams.
13
+
14
+ ````
15
+ graph: <short title>
16
+
17
+ Production:
18
+ ```ts
19
+ EntryPoint
20
+ → ComponentA
21
+ → ComponentA.method
22
+ → [condition] ComponentB
23
+ → {queue_or_store}
24
+ ```
25
+
26
+ Tests:
27
+ ```ts
28
+ TestEntryPoint
29
+ → ComponentATestLayer
30
+ → ComponentB.layerMemory
31
+ ```
32
+
33
+ src:
34
+ EntryPoint → path/to/file:LINE
35
+ ComponentA → path/to/component:LINE
36
+ ````
37
+
38
+ - `ts` fence, two-space-indented `→` children; the root has no arrow.
39
+ - Real symbol names only. Production always; Tests only when the test graph
40
+ differs. Never invent a test graph.
41
+ - Every unique node gets verified `path:line` evidence under `src:`. Find it
42
+ with the language server, `rg`, or the code index; never guess.
43
+ - Planned nodes in a sketch are `[new]`, with no line number.
44
+ - A trivial single-fact question (a port, a version) gets a direct answer, no graph.
45
+
46
+ ## Output format: quick reference
10
47
 
11
48
  Emit ALL sections below, in this order, with these markers:
12
49
 
13
50
  ```
14
51
  PROBLEM: <one line>
15
52
 
16
- X → DesignGraph<A, E, R>
53
+ X → Graph → Effect<A, E, R>
17
54
  │ │ │ │ │
18
55
  │ │ │ │ └─ R: what each node needs (§5)
19
56
  │ │ │ └──── E: where the graph breaks (§4)
@@ -24,26 +61,27 @@ X → DesignGraph<A, E, R>
24
61
  └─ the problem
25
62
 
26
63
  SHAPES: records · IDs · state variants · named errors
27
- GRAPH: ascii call graph, annotated inline:
64
+ GRAPH: call graph block above (trace) or ascii call graph (sketch), annotated:
28
65
  R: deps · E: err ⟳retry[×n] → ↯escape(alt) | ☠die · 🔒 unknown→trusted
29
66
  CARDINALITY: node (1) one-shot · (N) many over time · (T) time-bounded
30
67
  BOUNDARIES: every untrusted→trusted crossing (parse, don't validate)
31
68
  BEHAVIOR: orthogonal layers (retry, cache, logging) that wrap without changing the graph
32
69
  SCOPE: resources: acquire@x → release@x (structural, not convention)
33
- TEST LAYERS: the R tests provide — same GRAPH, zero code change
70
+ TEST LAYERS: the R tests provide; same GRAPH, zero code change
34
71
  VERDICT: code matches graph? happy path free of error handling? E fully enumerated?
35
72
  ```
36
73
 
37
74
  ## Rules
38
75
 
39
76
  - The graph is the ground truth. For existing code, reconstruct the graph the
40
- code ACTUALLY implements — not what the author intended.
77
+ code ACTUALLY implements, not what the author intended.
41
78
  - Every node gets cardinality + `R:`. Every failure gets `⟳`, `↯`, or `☠`.
42
79
  Every trust crossing gets `🔒`.
43
80
  - Adapt vocabulary to the target language/stack (exceptions vs Result types,
44
- RAII vs context managers, etc.) — never the discipline.
45
- - If you find nodes that violate the method (tangled happy path, unscoped
46
- resources, hidden dependencies), list them under VERDICT, grouped by § number.
81
+ RAII vs context managers, etc.), never the discipline.
82
+ - Nodes that violate the method (tangled happy path, unscoped resources,
83
+ hidden dependencies) go under VERDICT, grouped by § number.
47
84
 
48
- If the full spec is needed, read it from this package's `references/`
49
- directory: `protocol.md` (notation) and `method.md` (the method).
85
+ Full specs live in this package's `references/` directory: `design-thinking.md`
86
+ (the code method), `output-format.md` (format + checklist), `design-graph.md`
87
+ (the interface method), `graph-protocol.md` (delegation to agents).
@@ -1,91 +1,213 @@
1
- # Design Graph — The Artifact
1
+ > **Source**: Design Graph by [r17x](https://github.com/r17x), from
2
+ > https://gist.github.com/r17x/90eb2f7be93932b5693753aedb09c01a (`OPT_DESIGN_GRAPH.md`).
3
+ > Method text bundled as-is. The output skeleton at the end is added by this package.
2
4
 
3
- A **Design Graph** is the annotated call graph of a concrete problem. It is
4
- what you produce when you apply [Design Thinking](method.md) to something, and
5
- it is written in [Graph Protocol](protocol.md) notation.
5
+ # Design Graph
6
6
 
7
- Nodes are functions. Edges are data flow. The annotations answer, for every
8
- node: what flows through it (A), how many times it runs (cardinality), where
9
- and how it can fail (E), and what it needs to exist (R) — plus the global
10
- concerns: trust boundaries, behavior layers, resource scope, and test layers.
7
+ The same method, turned on the interface. A screen is not a picture — it is a node with three channels, and the layout you draw is the graph the user walks.
11
8
 
12
- A Design Graph is not documentation written after the fact. It is drawn
13
- **before** implementation (planning), **reconstructed** from implementation
14
- (review), and **compared** against implementation (verdict). The graph is the
15
- contract; the code is one instantiation of it.
16
- **Hard gate:** when a turn will produce code or file edits, the graph comes
17
- first — render it (and any clarifying questions), get the user's approval,
18
- and only then write code that matches it.
9
+ Design Thinking answers what flows through the program. Design Graph answers what the person in front of it can be looking at. Same three-channel discipline: one channel for the content, one for every way the content can be absent, one for what the surface needs before it may exist.
10
+
11
+ ```
12
+ Job → Flow → Surface<C, V, N>
13
+ │ │ │ │ │
14
+ │ │ │ │ └─ what the surface needs to exist (§5)
15
+ │ │ │ └──── every way the content is absent (§4)
16
+ │ │ └─────── what the person reads and does (§2)
17
+ │ │
18
+ │ └─ nodes = surfaces, edges = the moves between them
19
+ │
20
+ └─ the job: what the person came here to get done
21
+
22
+ §1 Surfaces the nouns: screens, panes, rows, fields, controls
23
+ §2 C happy path as flow graph
24
+ §3 Cardinality one record (Detail) or many (List / live)
25
+ §4 V void states: empty, loading, partial, error, denied
26
+ §5 N needs: data, permission, prior step, viewport
27
+ §6 Boundary validate at the field, not at submit
28
+ §7 Behavior motion and feedback wrap a surface, never reshape it
29
+ §8 Scope attention is acquired and must be released
30
+ §9 Proof swap N, same flow shape
31
+ §10 Craft markup = C, state styles = V
32
+ ```
33
+
34
+ Read the job. Draw the moves as a flow graph. Build an interface that IS the graph. If a surface can render a state the graph cannot name, the interface is lying.
35
+
36
+ ## 1. Name the surfaces
37
+
38
+ What are the things a person can look at? Before opening a layout tool, define the interface language.
39
+
40
+ - **Surfaces** -- the addressable places. A rail, a list, a detail pane, a drawer. Each one has a name and an owner.
41
+ - **Units** -- the repeated shape inside a surface. A row, a field, a metric. Named once, reused everywhere.
42
+ - **States** -- what a unit can be. Rest, hover, selected, disabled, stale. Enumerated, not improvised at build time.
43
+ - **Moves** -- what the person can do to get somewhere else. Open, select, dismiss, commit, undo.
44
+
45
+ These are the nouns. The moves are the verbs. A design system that names colours but not surfaces has no vocabulary — only a palette.
46
+
47
+ ## 2. Think C first
48
+
49
+ Map the successful job as a flow graph before drawing a single frame. Nodes are surfaces, edges are the moves between them.
50
+
51
+ ```
52
+ Rail(scope) -> List(C) -> Detail(C) -> Commit
53
+ ```
54
+
55
+ This graph is the information architecture. Every screen that does not appear on it is a screen nobody asked for. If two nodes need the same surface, that surface is a component; if a node has one edge in and one edge out, it may not need to be a screen at all.
56
+
57
+ ## 3. One or many?
58
+
59
+ Decide the cardinality of each node before its layout. Getting this wrong is the most expensive mistake in the graph, because it changes the shape of the surface, not its styling.
60
+
61
+ - **One record** -- a detail surface. Reading measure, full metadata, one primary action.
62
+ - **Many records** -- a list surface. Scannable, uniform rows, selection as a wash. Must survive 0, 1, and 10,000.
63
+ - **Live** -- values that change while being read. Show the timestamp, never move the row under the cursor.
64
+
65
+ Do not let a list masquerade as a card, and never let a live value pretend to be static. A surface designed for the average case has no design for the real one.
66
+
67
+ ## 4. Think V second
68
+
69
+ V is the void channel: every way the content can fail to be there. Each node enumerates its own, and each one is a designed surface, not a fallback.
70
+
71
+ - **Empty** -- nothing yet, and that is fine. One grey sentence saying what will appear here.
72
+ - **Loading** -- the shape is known, the values are not. A flat skeleton in the layout the content will occupy.
73
+ - **Partial** -- some of it arrived. Show what you have and mark what is missing — never block the whole surface for one field.
74
+ - **Error** -- it broke, and the person can act. Say what failed, in their words, next to the thing that failed.
75
+ - **Denied** -- they may not see it. Prefer never routing them here over explaining the refusal.
76
+
77
+ A surface with one designed state and four undesigned ones is 20% designed. The void states are where the interface earns trust, because they are the states the person meets on their worst day.
78
+
79
+ ## 5. Think N third
80
+
81
+ Mark what each surface needs before it is allowed to exist. "We cannot show X if we do not have Y."
82
+
83
+ N is the interface's version of compile-time proof. A surface declares its needs — a signed-in user, a selected record, a permission, a minimum viewport, a completed prior step — and the graph must satisfy them on the edge that reaches it.
84
+
85
+ - **Data** -- a record must be selected. No selection is a different node, not an empty pane.
86
+ - **Permission** -- if they cannot act, do not draw the affordance. A disabled button is a last resort.
87
+ - **Prior step** -- step 3 requires step 2. Unreachable is better than reachable and broken.
88
+ - **Viewport** -- three panes need width. Below it, the graph re-routes — the detail becomes a drawer, not a squeeze.
89
+
90
+ If a screen can be reached without its needs met, the flow graph has a hole. That hole is a bug in the design, not a case for the engineer to handle.
91
+
92
+ ## 6. Trust at boundary
93
+
94
+ Where does the person's own input enter the graph? Fields, uploads, pastes, drags, URLs they typed themselves.
95
+
96
+ Validate at the field, not at submit. The boundary of the interface is the control they are touching — that is where unknown becomes trusted, and where the message belongs. One definition of a field gives the label, the constraint and the error sentence together.
97
+
98
+ Trust nothing at the boundary. Trust everything past it. A form that only fails on submit has moved its boundary to the wrong place, and made the person pay for the move.
99
+
100
+ ## 7. Layer behavior
101
+
102
+ What wraps a surface without changing what it says? Motion, focus, feedback, density, keyboard affordance, reduced-motion.
103
+
104
+ These are layers around a node, never edits to it. A wash on hover, a reveal on entry, a ring on focus — the content graph is identical with them and without them. If removing the animation changes what the person can learn from the screen, the animation was carrying content and the layout was underbuilt.
105
+
106
+ The graph says WHAT the surface is. The layers say HOW it responds to being used.
107
+
108
+ ## 8. Scope attention
109
+
110
+ Which surfaces acquire the person's attention? Modals, drawers, menus, toasts, anything that takes the viewport or the focus ring.
111
+
112
+ Attention is a resource with acquire and release. Whatever takes focus returns it to where it came from — on confirm, on cancel, on escape, on interrupt. Whatever covers the graph must name the single move that uncovers it.
113
+
114
+ An overlay with no defined release is a leak. The person is left holding a surface the graph has forgotten about.
115
+
116
+ ## 9. Swap N to prove it
117
+
118
+ The flow graph does not change between the demo and the first real account. Only N changes.
119
+
120
+ Same nodes. Same C flowing through. Same V possible. Different context behind N. Run the graph four times and see whether it still holds:
121
+
122
+ - **Day one** -- nothing in the account. Every list is empty; the graph must still be legible.
123
+ - **Year three** -- 40,000 records, titles twice as long as the mock. Nothing may reflow into nonsense.
124
+ - **Least access** -- the read-only member. Which affordances vanish, and does the layout survive their absence?
125
+ - **Small and slow** -- one hand, poor network, reduced motion on. The graph re-routes; it does not degrade.
126
+
127
+ If the design only works with ideal data, it is not a design — it is a screenshot. This is the payoff of separating C, V and N: you prove the interface by swapping what is behind N and watching the graph hold its shape.
128
+
129
+ ## 10. Markup is C, state styles are V
130
+
131
+ The separation of C (§2) and V (§4) maps directly to how the interface is built:
132
+
133
+ - **the component tree** -- the happy path. Every element is content flowing through the graph. No state branching inside.
134
+ - **the recipe variants** -- the complete V enumeration. Before writing them, read the actual states the surface can be in. Every one is named and styled — none is left to the browser default.
135
+
136
+ This is not a stylistic preference. If state handling lives inside the tree, the content path and the void path are tangled — you cannot read the layout without wading through conditionals, and no one can tell which states were designed and which were merely reached.
137
+
138
+ The tree IS the flow graph from §2. The variants ARE the void enumeration from §4.
139
+
140
+ ### One method, two materials
141
+
142
+ The mapping is exact by construction. Anywhere the two columns disagree, one of the two graphs is wrong — most often the interface, because it is the one that gets drawn before it is thought.
143
+
144
+ | § | DESIGN THINKING | DESIGN GRAPH |
145
+ |---|-----------------|--------------|
146
+ | X | the problem to build | the job to get done |
147
+ | graph | functions and data flow | surfaces and moves |
148
+ | 1 | records, IDs, variants, errors | surfaces, units, states, moves |
149
+ | 2 | A — what flows | C — what is read and done |
150
+ | 3 | Effect or Stream | detail, list, or live |
151
+ | 4 | E — retry, escape, die | V — empty, loading, partial, error, denied |
152
+ | 5 | R — dependencies, proven | N — needs, satisfied on the edge |
153
+ | 6 | parse at the transport edge | validate at the field |
154
+ | 7 | pipe wraps the node | motion wraps the surface |
155
+ | 8 | scope the resource | scope the attention |
156
+ | 9 | swap R in tests | swap N in review |
157
+ | 10 | gen body = A, pipe = E | tree = C, variants = V |
19
158
 
20
159
  ---
21
160
 
22
- ## What a complete Design Graph contains
161
+ ## The Craft Pipeline
23
162
 
24
163
  ```
25
- PROBLEM: <one line>
26
-
27
- X → DesignGraph<A, E, R>
28
- │ │ │ │ │
29
- │ │ │ │ └─ R: what each node needs (§5)
30
- │ │ │ └──── E: where the graph breaks (§4)
31
- │ │ └─────── A: what flows through nodes (§2)
32
- │ │
33
- │ └─ nodes = functions, edges = data flow
34
- │
35
- └─ the problem
36
-
37
- SHAPES: … every noun the graph needs
38
- GRAPH: … ascii call graph with inline R:/E:/🔒/(n) annotations
39
- CARDINALITY: … every node marked (1) (N) or (T)
40
- BOUNDARIES: … every unknown → trusted crossing
41
- BEHAVIOR: … every orthogonal layer and what it wraps
42
- SCOPE: … every resource with acquire@x → release@x
43
- TEST LAYERS: … the R tests provide — same GRAPH, zero code change
44
- VERDICT: … code matches graph? A and E structurally separated?
164
+ JOB
165
+ -> "What are the surfaces?" -> define the interface language
166
+ -> "What is the successful path?" -> draw the flow graph (C)
167
+ -> "One record, many, or live?" -> mark cardinality per surface
168
+ -> "How can the content be absent?" -> annotate void states (V)
169
+ -> "What must be true to show this?" -> annotate needs on the edges (N)
170
+ -> "Where does their input enter?" -> validate at the field
171
+ -> "What wraps a surface without reshaping it?" -> layer motion and feedback
172
+ -> "What takes attention, and how is it given back?" -> scope every overlay
173
+ -> "Does it hold on day one and year three?" -> swap N and re-walk the graph
174
+ -> "Does the build separate C from V?" -> tree = C, variants = V
175
+ -> INTERFACE -> the interface IS the graph
45
176
  ```
46
177
 
47
- ## Completeness checklist
48
-
49
- A Design Graph is complete when all of the following hold:
50
-
51
- - [ ] Every node has a cardinality marker — `(1)`, `(N)`, or `(T)`.
52
- - [ ] Every node lists its `R:` — even if `R: none` (that is a feature: the
53
- node is runnable standalone).
54
- - [ ] Every edge crossing a trust boundary is marked `🔒 unknown → trusted`.
55
- - [ ] Every failure mode has a strategy — `⟳retry`, `↯escape(alt)`, or
56
- `☠die`. No unmarked breaks, no silent swallowing.
57
- - [ ] Every layer scopes its E before handing off (inner errors translated,
58
- never leaked).
59
- - [ ] Every resource has an acquire point and a structural release point.
60
- - [ ] BEHAVIOR lists only layers that can be removed without touching the
61
- happy path.
62
- - [ ] TEST LAYERS shows a full R substitution — if it can't, the graph has
63
- hidden dependencies.
64
- - [ ] VERDICT explicitly answers whether code and graph match, and names the
65
- mismatches.
66
-
67
- ## The three uses
68
-
69
- ### 1. Plan (`/cg-plan`)
70
- Draw the graph first. Code is written only after the VERDICT question — "does
71
- my code match this?" — has a target to be checked against. If a code
72
- suggestion contradicts the graph, fix the graph or fix the code; never let
73
- them drift silently.
74
-
75
- ### 2. Extract (`/cg`)
76
- Given existing code, reconstruct the graph the code *actually* implements —
77
- not the one the author intended. The reconstructed graph is the ground truth
78
- for review and refactoring.
79
-
80
- ### 3. Review (`/cg-review`)
81
- Render the implemented graph, then diff it against the intended graph (or
82
- against the method's completeness checklist when no intended graph exists).
83
- Every mismatch is a finding, grouped by § number. The review ends with a
84
- VERDICT line.
178
+ **If a surface can render a state the graph cannot name, the design is wrong.**
85
179
 
86
180
  ---
87
181
 
88
- ## Worked example
182
+ ## Output skeleton
183
+
184
+ Interface work renders in this fixed order, the UI twin of the
185
+ [Design Thinking output format](output-format.md). Same markers where the
186
+ meaning carries over (`(1)` detail, `(N)` list, `(T)` live, `🔒` field
187
+ boundary, `⛈` behavior layer).
89
188
 
90
- See the end of [protocol.md](protocol.md) for a complete, non-TS worked
91
- example (a resumable URL-sync CLI in Python) with all sections filled.
189
+ ```
190
+ JOB: <one line: what the person came here to get done>
191
+
192
+ Job → Flow → Surface<C, V, N>
193
+ │ │ │ │ │
194
+ │ │ │ │ └─ N: what the surface needs to exist (§5)
195
+ │ │ │ └──── V: every way the content is absent (§4)
196
+ │ │ └─────── C: what the person reads and does (§2)
197
+ │ │
198
+ │ └─ nodes = surfaces, edges = the moves between them
199
+ │
200
+ └─ the job
201
+
202
+ SURFACES: surfaces · units · states · moves
203
+ FLOW: ascii flow graph, annotated inline:
204
+ N: needs · V: empty|loading|partial|error|denied · 🔒 field → trusted
205
+ CARDINALITY: surface (1) detail · (N) list · (T) live
206
+ VOID: every surface × its designed void states
207
+ NEEDS: data · permission · prior step · viewport, satisfied on the edge
208
+ BOUNDARY: every field where input becomes trusted, with its error sentence
209
+ BEHAVIOR: motion, focus, feedback layers that wrap a surface without reshaping it
210
+ ATTENTION: overlays: acquire@move → release@confirm|cancel|escape
211
+ PROOF: day one · year three · least access · small and slow
212
+ VERDICT: does every rendered state have a name on the graph?
213
+ ```