@morning-start/dsh-code-toolkit 0.27.4 → 0.28.1
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/CHANGELOG.md +112 -0
- package/README.md +111 -11
- package/agents/audit/AGENT.md +137 -0
- package/agents/audit/examples/fake-capability.md +54 -0
- package/agents/audit/examples/wired-clean.md +66 -0
- package/agents/audit/references/audit-passes.md +118 -0
- package/agents/audit/references/capability-states.md +96 -0
- package/agents/audit/references/evidence.md +86 -0
- package/agents/audit/references/finding-the-chain.md +80 -0
- package/agents/audit/references/output.md +66 -0
- package/agents/caption/AGENT.md +112 -135
- package/agents/caption/examples/loop.md +12 -0
- package/agents/caption/references/evidence.md +46 -0
- package/agents/caption/references/flows.md +6 -2
- package/agents/caption/references/loop.md +57 -1
- package/agents/design/AGENT.md +158 -0
- package/agents/design/examples/one-page.md +55 -0
- package/agents/design/examples/overkill.md +56 -0
- package/agents/design/references/base-maps.md +110 -0
- package/agents/design/references/deliverables.md +71 -0
- package/agents/design/references/model-and-ports.md +73 -0
- package/agents/design/references/plan-and-batches.md +92 -0
- package/agents/design/references/scenario-cards.md +133 -0
- package/agents/design/references/self-check.md +73 -0
- package/agents/pua/AGENT.md +3 -0
- package/agents/review/AGENT.md +52 -52
- package/agents/scrub/AGENT.md +64 -67
- package/agents/simplify/AGENT.md +70 -101
- package/index.js +145 -11
- package/locale/en.json +2 -2
- package/locale/zh.json +2 -2
- package/package.json +5 -2
- package/src/caption.js +149 -0
- package/src/command.js +20 -6
- package/src/design.js +70 -0
- package/src/i18n.js +98 -24
- package/src/report.js +112 -3
package/agents/caption/AGENT.md
CHANGED
|
@@ -1,165 +1,142 @@
|
|
|
1
1
|
# Caption loop
|
|
2
2
|
|
|
3
|
-
You are running one long task
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
You are running one long task until it is actually done. You are not handed a plan: the
|
|
4
|
+
person gives you an **intent** — "make the export work" — and you derive the goal, the
|
|
5
|
+
acceptance criteria and the task list from it. Then you work the list one item per
|
|
6
|
+
iteration, and you change the list when the repository contradicts it.
|
|
7
|
+
|
|
8
|
+
That is a loop over a list you own. What goes wrong is not the design — it is losing the
|
|
9
|
+
thread: working without a proof, repeating a dead end, ticking an item that was never
|
|
10
|
+
true, or reporting done while items remain open.
|
|
11
|
+
|
|
12
|
+
## From intent to a plan
|
|
13
|
+
|
|
14
|
+
Before the first working iteration, write three things into the ledger head:
|
|
15
|
+
|
|
16
|
+
- **Goal** — one sentence you can say back to the person without adding anything.
|
|
17
|
+
- **Criteria** — how someone else tells it is done: a command, an observable state, or a
|
|
18
|
+
file that must say something. "Works better" is not a criterion.
|
|
19
|
+
- **Plan** — ordered **outcomes, not activities**. Each item is one result provable on
|
|
20
|
+
its own, and each names the check that proves it. Ordering and sizing:
|
|
21
|
+
`references/loop.md`.
|
|
22
|
+
|
|
23
|
+
**The approval gate is not optional.** The person approves goal, criteria and plan
|
|
24
|
+
together — a plan nobody read is not an approval, and a plan you keep in your head is not
|
|
25
|
+
a plan. If the intent admits two materially different readings, ask before writing the
|
|
26
|
+
plan; that one question is worth interrupting for.
|
|
7
27
|
|
|
8
28
|
## The loop
|
|
9
29
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
not
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
your memory of the conversation.
|
|
28
|
-
3. **Choose one step.** The smallest action that changes what you know or what
|
|
29
|
-
the code does. One change per iteration: if a step needs two unrelated edits,
|
|
30
|
-
it is two steps.
|
|
31
|
-
4. **Act.** Read before you edit. Make the anchor unique before you replace it —
|
|
32
|
-
a loose anchor silently deletes the wrong block. After writing, read the
|
|
33
|
-
changed region back.
|
|
34
|
-
5. **Verify.** Run the gate. The gate is a command whose exit status decides, not
|
|
35
|
-
your opinion. A red gate is data, not failure: diagnose, adjust, and run the
|
|
36
|
-
next iteration.
|
|
37
|
-
6. **Prove a new guard.** When you add a test, a check, or a guard, show it can
|
|
38
|
-
fail: break the thing it protects, watch it go red, restore it, watch it go
|
|
30
|
+
Every iteration takes **one item off the plan**.
|
|
31
|
+
|
|
32
|
+
Before the first iteration, decide the flow — **changing code** or **changing
|
|
33
|
+
documentation** — and write it in the ledger head. Both share one spine: requirement →
|
|
34
|
+
investigate → propose → **the person approves** → execute → summarize;
|
|
35
|
+
`references/flows.md` has each step.
|
|
36
|
+
|
|
37
|
+
1. **Read the ledger first.** Head, plan, last entry — before anything else. It is the
|
|
38
|
+
only memory that survives compaction; never re-derive what it settled.
|
|
39
|
+
2. **Take the next open item** — the first unblocked one, not the most interesting, and
|
|
40
|
+
not a new one you just thought of. Too big to prove in one step? Split it now.
|
|
41
|
+
3. **Observe the real state** — run the check that would prove the item, or read the file
|
|
42
|
+
you are about to change. Work from the repository, not from memory.
|
|
43
|
+
4. **Act.** Read before you edit; make the anchor unique; read the changed region back.
|
|
44
|
+
5. **Verify.** Run the item's gate. Exit status decides, not your opinion. A red gate is
|
|
45
|
+
data: diagnose, adjust, run the next iteration.
|
|
46
|
+
6. **Prove a new guard.** Break what it protects, watch it go red, restore, watch it go
|
|
39
47
|
green. A guard you never saw fail is decoration.
|
|
40
|
-
7. **Record one caption entry, then commit.**
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
If a step changed the shape of the task, say so instead of pressing on.
|
|
48
|
+
7. **Record one caption entry, then commit.** Saw, decided, did, evidence, outcome — and
|
|
49
|
+
tick the plan item with that entry's number.
|
|
50
|
+
8. **Re-plan.** When the evidence contradicted the plan, edit the plan: add, split, drop,
|
|
51
|
+
reorder, naming the entry that caused it. A plan edited without a reason is drift.
|
|
45
52
|
|
|
46
|
-
|
|
53
|
+
The loop ends when the plan has no open items **and** every criterion holds — not when
|
|
54
|
+
the first plan is exhausted.
|
|
47
55
|
|
|
48
|
-
Dispatch
|
|
49
|
-
lanes, and they have different rules:
|
|
56
|
+
## Dispatch
|
|
50
57
|
|
|
51
|
-
|
|
52
|
-
returning findings with `file:line` and the command that produced them. No
|
|
53
|
-
writes, no conflicts; you merge.
|
|
54
|
-
- **Build writes**, so it needs exclusive ownership: each agent owns a disjoint
|
|
55
|
-
set of paths. Shared files — barrels, indexes, configs, lockfiles, shared
|
|
56
|
-
tests — belong to exactly one owner, normally you.
|
|
58
|
+
Dispatch only when the work splits into slices that cannot collide.
|
|
57
59
|
|
|
58
|
-
**
|
|
60
|
+
- **Analysis is read-only**, so it may fan out: one agent per area, findings with
|
|
61
|
+
`file:line` and the command that produced them. No writes, no conflicts.
|
|
62
|
+
- **Build writes**, so each agent owns a **disjoint** set of paths. Shared files —
|
|
63
|
+
barrels, indexes, configs, lockfiles, shared tests — belong to **exactly one owner**,
|
|
64
|
+
normally you. **Never run two writers on the same path**, and never split one coupled
|
|
65
|
+
change across two agents.
|
|
59
66
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
exactly one of those checks. Do not hand-roll a review brief and then also run
|
|
65
|
-
`/code-review sub` on the same paths — that is two writers of the same report.
|
|
67
|
+
Two mechanisms only: `subagent` / `subagent_fork` for an analysis slice or a build slice
|
|
68
|
+
nobody else touches; `/code-review sub`, `/code-simplify sub`, `/code-scrub sub` when the
|
|
69
|
+
slice is exactly that check. The child does not see this conversation — everything it
|
|
70
|
+
needs goes in the brief. Details: `references/dispatch.md`.
|
|
66
71
|
|
|
67
|
-
|
|
72
|
+
## Creating experts mid-run
|
|
68
73
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
what counts as a finding, what does not, and the output shape. A brief that says
|
|
72
|
-
"you are an expert reviewer" has said nothing; one that names the threshold and
|
|
73
|
-
the false positives has. Read `references/experts.md` before writing one.
|
|
74
|
+
An expert is a paragraph, not a file: identity and bar, what it looks at, what counts as
|
|
75
|
+
a finding, what is not, output shape. Five steps:
|
|
74
76
|
|
|
75
|
-
|
|
77
|
+
1. **Write the brief first, in the ledger** — the question, the bar, what "done" is.
|
|
78
|
+
2. **Decide the lane** — analysis (read-only, may fan out) or build (exclusive paths).
|
|
79
|
+
3. **Dispatch, then keep working** — an expert is not a blocking call.
|
|
80
|
+
4. **Merge against the brief** — accept only what answers it.
|
|
81
|
+
5. **Record it** — what the expert was, what came back, what you did with it.
|
|
76
82
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
an unfamiliar subsystem, a domain rule (a schema, a protocol, a regulation), or
|
|
80
|
-
an area wide enough that reading it yourself would cost more than briefing
|
|
81
|
-
someone.
|
|
82
|
-
|
|
83
|
-
Creating one is a step like any other, so it goes through the loop:
|
|
84
|
-
|
|
85
|
-
1. **Write the brief first, in the ledger.** Identity and bar, inputs, what
|
|
86
|
-
counts, what does not, output shape, and the paths it may read or write. A
|
|
87
|
-
brief you would not accept from a colleague is not ready.
|
|
88
|
-
2. **Decide the lane.** Analysis experts are read-only and may run in parallel.
|
|
89
|
-
Build experts write, so each needs a disjoint path set and the shared files
|
|
90
|
-
stay with you.
|
|
91
|
-
3. **Dispatch, then keep working.** Do not sit idle waiting for a read-only
|
|
92
|
-
expert; do the next independent step. For a build expert, wait — two writers
|
|
93
|
-
on one tree is the collision this whole section exists to prevent.
|
|
94
|
-
4. **Merge against the brief.** Read the result as a claim, not a fact: check
|
|
95
|
-
the evidence it cites, and run the whole gate yourself afterwards. A green
|
|
96
|
-
per-expert gate does not mean the merged tree is green.
|
|
97
|
-
5. **Record it.** One ledger entry per expert: name, lane, paths, gate, merged
|
|
98
|
-
or rejected, and why. If an expert's findings keep getting rejected, the
|
|
99
|
-
brief was wrong — fix the brief, not the child.
|
|
100
|
-
|
|
101
|
-
**An expert is not a second opinion on your own work.** Do not dispatch a review
|
|
102
|
-
of code you just wrote to an expert and treat its silence as proof; it did not
|
|
103
|
-
see your reasoning, and it will not see what you did not write down.
|
|
104
|
-
|
|
105
|
-
**Do not create an expert to avoid a decision.** If the next step is small, or
|
|
106
|
-
you already know what to do, doing it is cheaper than briefing someone. Dispatch
|
|
107
|
-
is for width and for knowledge, not for delegating judgement.
|
|
108
|
-
|
|
109
|
-
A dispatch brief states the task, the exact paths the agent may read and write,
|
|
110
|
-
what it must not touch, the gate it must run, and the output shape. An agent that
|
|
111
|
-
needs a file outside its scope stops and reports instead of editing it.
|
|
112
|
-
|
|
113
|
-
Never run two writers on the same path, and never dispatch one coupled change to
|
|
114
|
-
two agents. After merging, run the whole gate yourself: a green per-agent gate
|
|
115
|
-
does not mean the merged tree is green. Record each dispatch in the ledger —
|
|
116
|
-
who, which lane, which paths, the gate, and whether it was merged.
|
|
83
|
+
Do not create an expert to avoid a decision, and not as a second opinion on your own
|
|
84
|
+
code. Method and worked briefs: `references/experts.md`.
|
|
117
85
|
|
|
118
86
|
## Rules that make the loop honest
|
|
119
87
|
|
|
120
|
-
- **
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
- **
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
88
|
+
- **No evidence, no claim.** "Done" is a command and its output.
|
|
89
|
+
- **Dead ends are first-class.** Record the command, the output, and why it failed; an
|
|
90
|
+
unrecorded one costs the next iteration the same discovery.
|
|
91
|
+
- **Stop on outcomes, not on activity.** The plan has no open items **and** the criteria
|
|
92
|
+
hold. A ticked item is not proof; the gate is.
|
|
93
|
+
- **One gate per iteration.** Do not batch five changes and then test.
|
|
94
|
+
- **A green gate is not a working feature.** When the change touches an entry point, one
|
|
95
|
+
iteration must take the real entry point the way a person does, with real data. Record
|
|
96
|
+
the click, the input, and the state afterwards.
|
|
97
|
+
- **Assume nothing about the host.** Read the installed version, or write the smallest
|
|
98
|
+
probe that prints the answer. "The docs say" is a lead, not evidence.
|
|
99
|
+
- **A rejection is information.** Go back to investigation with the objection; a second
|
|
100
|
+
rejection means the requirement is wrong — stop and ask.
|
|
101
|
+
- **Stop when the loop stops paying.** Two iterations with no new fact mean stop and hand
|
|
102
|
+
back what is blocked. A recorded "stuck here" beats a third attempt.
|
|
103
|
+
- **Ask only at real forks** — scope change, irreversible action, unauthorized cost.
|
|
104
|
+
Everything else: continue. Whatever is not verified stays in the unverified list.
|
|
132
105
|
|
|
133
106
|
## The ledger
|
|
134
107
|
|
|
135
|
-
Write
|
|
136
|
-
|
|
137
|
-
|
|
108
|
+
Write it to `docs/caption/<slug>.md`, creating the directory if needed. Three parts:
|
|
109
|
+
|
|
110
|
+
**Head** — `# Caption: <title>`, then `- Task`, `- Criteria`, `- Gate`, `- Flow`,
|
|
111
|
+
`- Approved`. First values win; a closing entry may repeat `- Gate:`.
|
|
112
|
+
|
|
113
|
+
**Plan** — the open work, one line per item with the check that proves it: `[ ]` open,
|
|
114
|
+
`[x]` done, `[~]` blocked, `[-]` dropped. **Edit it in place**; never append a second
|
|
115
|
+
plan — the plan is current state, the entries are history. Tick with the entry number.
|
|
116
|
+
|
|
117
|
+
**Entries** — appended, one per iteration: `## 3. <title>`, then `- Saw`, `- Decided`,
|
|
118
|
+
`- Did`, `- Evidence`, `- Outcome: done | dead end | unverified`.
|
|
138
119
|
|
|
139
|
-
|
|
140
|
-
## 3. <short title>
|
|
141
|
-
- Saw: <the state that made this the next step>
|
|
142
|
-
- Decided: <why this step, and what it would prove>
|
|
143
|
-
- Did: <files touched, commands run>
|
|
144
|
-
- Evidence: `<command>` → <result, exit status>
|
|
145
|
-
- Outcome: done | dead end | unverified
|
|
146
|
-
```
|
|
120
|
+
Shape and ordering rules: `references/loop.md`.
|
|
147
121
|
|
|
148
122
|
## When the task ends
|
|
149
123
|
|
|
150
|
-
Report what changed, the gate output, each criterion
|
|
151
|
-
|
|
152
|
-
|
|
124
|
+
Report what changed, the gate output, each criterion, the dead ends, the unverified list,
|
|
125
|
+
and how the plan ended. Do not summarize the loop away. `references/loop.md` has the
|
|
126
|
+
closing shape.
|
|
153
127
|
|
|
154
128
|
## Reference files
|
|
155
129
|
|
|
156
130
|
| File | Read it when |
|
|
157
131
|
| --- | --- |
|
|
158
|
-
| `references/loop.md` |
|
|
159
|
-
| `references/flows.md` |
|
|
160
|
-
| `references/evidence.md` |
|
|
161
|
-
| `references/dispatch.md` |
|
|
162
|
-
| `references/experts.md` |
|
|
163
|
-
| `examples/loop.md` |
|
|
164
|
-
| `examples/dispatch.md` |
|
|
165
|
-
| `examples/theater.md` |
|
|
132
|
+
| `references/loop.md` | a step stalls, the gate stays red, or you need to split an item |
|
|
133
|
+
| `references/flows.md` | before the first item: code change or doc change, and what each owes |
|
|
134
|
+
| `references/evidence.md` | choosing a gate, proving a guard, or recording a dead end |
|
|
135
|
+
| `references/dispatch.md` | before handing work to another agent, or deciding to parallelize |
|
|
136
|
+
| `references/experts.md` | you are about to write an expert brief |
|
|
137
|
+
| `examples/loop.md` | the shape of a healthy run before writing entries |
|
|
138
|
+
| `examples/dispatch.md` | the shape of a safe split |
|
|
139
|
+
| `examples/theater.md` | the run feels busy but nothing is being proven |
|
|
140
|
+
|
|
141
|
+
If a reference path is unreadable, continue from this file — the core instructions are
|
|
142
|
+
self-sufficient.
|
|
@@ -10,8 +10,20 @@ Ledger head:
|
|
|
10
10
|
- Task: make `sum()` return 0 for an empty list without changing existing results.
|
|
11
11
|
- Criteria: full suite green; `sum([])` is `0`; `sum([1,'2'])` still throws.
|
|
12
12
|
- Gate: `node --test`
|
|
13
|
+
- Flow: A (code)
|
|
14
|
+
- Approved: plan below, 2026-11-29
|
|
15
|
+
|
|
16
|
+
## Plan
|
|
17
|
+
- [ ] 1. Reproduce the failure — gate: `node --test` names `sum([])`
|
|
18
|
+
- [ ] 2. Pin the current contract — gate: the coercion test passes on today's code
|
|
19
|
+
- [ ] 3. Fix the empty case — gate: `sum([])` is 0, everything else still passes
|
|
20
|
+
- [ ] 4. Prove the guard — gate: breaking coercion turns entry 3's test red
|
|
13
21
|
```
|
|
14
22
|
|
|
23
|
+
The plan was edited once, after entry 2: item 2's original wording ("add a throw for
|
|
24
|
+
non-numeric strings") was wrong, because the current contract coerces. Splitting and
|
|
25
|
+
rewording it there is the loop working, not the plan failing.
|
|
26
|
+
|
|
15
27
|
Entries:
|
|
16
28
|
|
|
17
29
|
```markdown
|
|
@@ -60,6 +60,52 @@ leaves the repository broken is worse than no proof.
|
|
|
60
60
|
The command and the output are what make it useful. "Didn't work" costs the next
|
|
61
61
|
iteration the same discovery again.
|
|
62
62
|
|
|
63
|
+
## Reach the real entry point
|
|
64
|
+
|
|
65
|
+
A gate proves the thing you named. It does not prove the feature a person starts.
|
|
66
|
+
When the change touches an entry point — a command, a route, a screen, a scheduled
|
|
67
|
+
job — one iteration must go through it the way a person does:
|
|
68
|
+
|
|
69
|
+
- **the real entry point**, not the module the test imports: type the command, open
|
|
70
|
+
the screen, call the route;
|
|
71
|
+
- **real data**, not only the fixture: a document with history, a project with a
|
|
72
|
+
ledger, an input with the awkward characters;
|
|
73
|
+
- **look at the result**: what was printed, what the state is now, whether the effect
|
|
74
|
+
survived the process. A screenshot is fine; it does not replace the state.
|
|
75
|
+
|
|
76
|
+
Record it like any other evidence — what you did, what you expected, what happened:
|
|
77
|
+
|
|
78
|
+
```markdown
|
|
79
|
+
- Command: `node src/app.js export 3`
|
|
80
|
+
- Expected: a file appears at out/3.md and the command exits 0
|
|
81
|
+
- Actual: `Error: no such command: export` — the table registers new/open only
|
|
82
|
+
- State: export → fake; the renderer test passes but nothing reaches it
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
If the environment cannot run the entry point — no browser, no server, no device —
|
|
86
|
+
say that in the unverified list. "The tests pass" is then the whole claim, and it
|
|
87
|
+
should be the whole sentence.
|
|
88
|
+
|
|
89
|
+
## Assumptions about the host
|
|
90
|
+
|
|
91
|
+
Anything you believe about the host, the platform, or a third party is a claim. The
|
|
92
|
+
cheap way to settle one is a probe, and one probe usually answers several questions.
|
|
93
|
+
|
|
94
|
+
- **Read the installed code first.** The version in `node_modules` or in the running
|
|
95
|
+
application beats the documentation, which beats your memory.
|
|
96
|
+
- **Probe when reading is not enough.** The smallest script that prints the fact you
|
|
97
|
+
need: does the API accept this shape, does the event fire with these fields, does
|
|
98
|
+
the path resolve on this platform. Keep the probe file; a second question usually
|
|
99
|
+
arrives.
|
|
100
|
+
- **Record the answer with the question**, e.g. `steer()` rejects a partial message
|
|
101
|
+
→ `Error: message.id is required`. That line is what stops the next iteration from
|
|
102
|
+
re-deriving it.
|
|
103
|
+
- **Until it runs, it is unverified.** Put it in the unverified list with the batch
|
|
104
|
+
that depends on it, rather than building three steps on top of a guess.
|
|
105
|
+
|
|
106
|
+
A design or a plan that rests on an unrun assumption is not wrong to exist; it is
|
|
107
|
+
wrong to be reported as settled.
|
|
108
|
+
|
|
63
109
|
## Two recurring self-inflicted failures
|
|
64
110
|
|
|
65
111
|
- **Loose anchors.** Replacing by a short string that appears twice deletes the
|
|
@@ -24,8 +24,12 @@ requirement → investigate → propose → human approves → execute (refining
|
|
|
24
24
|
|---|---|---|
|
|
25
25
|
| **1. Requirement** | The need in one sentence, plus what "done" would look like | You can say it back without adding anything |
|
|
26
26
|
| **2. Investigate** | The real state: files, call sites, tests, the current gate, the constraints in AGENTS.md | You can name the files you will touch and the command that proves the change |
|
|
27
|
-
| **3. Propose** |
|
|
28
|
-
|
|
27
|
+
| **3. Propose** | The plan block — ordered outcomes, each with its gate — plus the files, the risks, what you will not do | The person approves, amends, or rejects |
|
|
28
|
+
|
|
29
|
+
A rejection sends you back to **2. Investigate**, with the objection in hand — not to
|
|
30
|
+
a redraft of the same plan. A second rejection means the requirement is wrong: say so
|
|
31
|
+
and ask (see `references/loop.md`).
|
|
32
|
+
| **4. Execute** | One plan item per iteration; tick it with its entry number, and edit the plan when the evidence contradicts it | The plan has no open items and the gate is green |
|
|
29
33
|
| **5. Test** | The gate command and its output; a guard proven red then green | The evidence is in the ledger, not in your memory |
|
|
30
34
|
| **6. Human confirms** | The report: what changed, what was verified, what was not | The person says it is right |
|
|
31
35
|
| **7. Update the docs** | README / DETAIL / CHANGELOG / AGENTS, whichever the change made stale | The docs describe the code as it now is |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# The loop in depth
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## A plan is a hypothesis
|
|
4
4
|
|
|
5
5
|
A plan is a hypothesis about how the work divides. It is written before the code
|
|
6
6
|
answers back. The loop is how the hypothesis gets corrected: every iteration
|
|
@@ -12,6 +12,39 @@ executed faithfully while the third batch quietly changed the shape of the
|
|
|
12
12
|
problem, and batches four through seven build on an assumption that stopped
|
|
13
13
|
being true.
|
|
14
14
|
|
|
15
|
+
That is why the plan lives **in the ledger**, as a block you edit, and not in your
|
|
16
|
+
head. A plan in the conversation is lost at the first compaction; a plan you only
|
|
17
|
+
narrate cannot be diffed between iterations.
|
|
18
|
+
|
|
19
|
+
## The plan block
|
|
20
|
+
|
|
21
|
+
```markdown
|
|
22
|
+
## Plan
|
|
23
|
+
- [ ] 1. Reproduce the failing case — gate: `node --test` names `sum([])`
|
|
24
|
+
- [ ] 2. Pin the current contract — gate: the coercion test passes today
|
|
25
|
+
- [ ] 3. Fix the empty case — gate: `sum([])` is 0, everything else still passes
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Four rules make it a plan rather than a wish:
|
|
29
|
+
|
|
30
|
+
- **An item is an outcome with a check on the same line.** No gate, no item — that is
|
|
31
|
+
a note, and notes go in the entry. If one item needs two gates, it is two items.
|
|
32
|
+
- **It is ordered, not bucketed.** Put the thing that unblocks the most first. For a
|
|
33
|
+
defect the order is usually: reproduce → guard → change → prove the guard. For a
|
|
34
|
+
feature: the smallest end-to-end path, then widen. Dependencies are why the order
|
|
35
|
+
is written down at all.
|
|
36
|
+
- **It is edited in place.** Adding items after an investigation is normal, not a
|
|
37
|
+
failure of planning. Every edit names the entry that caused it: "split item 3 after
|
|
38
|
+
entry 4 showed the parser and the renderer fail separately". A plan never edited in
|
|
39
|
+
a long run means the investigation is not telling you anything.
|
|
40
|
+
- **`[~]` is not `[-]`.** Blocked means an identified blocker and a named owner — a
|
|
41
|
+
missing credential, a decision the person has to make, an environment nobody has.
|
|
42
|
+
Dropped means out of scope, with the reason. Neither is a way to make the list look
|
|
43
|
+
finished.
|
|
44
|
+
|
|
45
|
+
Ticking is a claim: the entry beside it must carry the command and its result. An item
|
|
46
|
+
ticked without evidence is the failure the whole ledger exists to prevent.
|
|
47
|
+
|
|
15
48
|
## Why the ledger is external
|
|
16
49
|
|
|
17
50
|
Long tasks get compacted. After compaction you keep a summary, not the detail:
|
|
@@ -59,6 +92,29 @@ Before the step, list the mirrors. In the gate, include whatever reads the
|
|
|
59
92
|
second mirror. If no such check exists, that is the finding: add the guard, and
|
|
60
93
|
prove it fails when a mirror is missing.
|
|
61
94
|
|
|
95
|
+
## When there is nothing new to learn
|
|
96
|
+
|
|
97
|
+
The ending is criteria-based, but the loop also has to be able to fail early. Two
|
|
98
|
+
consecutive iterations with no new fact is that signal: nothing was learned, nothing
|
|
99
|
+
changed, and the next step would be the third attempt at the same thing.
|
|
100
|
+
|
|
101
|
+
What counts as "a new fact": a command's output you had not seen, a call site you
|
|
102
|
+
had not read, a constraint the person stated, a test that now behaves differently.
|
|
103
|
+
Re-running the same command and getting the same result is not a new fact. Neither is
|
|
104
|
+
rewording the plan.
|
|
105
|
+
|
|
106
|
+
When it happens:
|
|
107
|
+
|
|
108
|
+
1. Write the entry: what you tried, what it proved, and what is now blocked.
|
|
109
|
+
2. Name the decision the person has to make — a scope change, a missing credential,
|
|
110
|
+
an environment you cannot reach. "Blocked on X" is a result; "still working on it"
|
|
111
|
+
is not.
|
|
112
|
+
3. Stop. Do not spend the next iteration re-deriving what the ledger already says.
|
|
113
|
+
|
|
114
|
+
The same applies to a rejected plan: return to investigation with the objection in
|
|
115
|
+
hand. If the second plan is rejected too, the requirement is the thing to question,
|
|
116
|
+
and that conversation is with the person, not with the repository.
|
|
117
|
+
|
|
62
118
|
## Recovering after compaction
|
|
63
119
|
|
|
64
120
|
1. Read the ledger head: task, criteria, gate.
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# Scenario-driven product design
|
|
2
|
+
|
|
3
|
+
Write down **who, in what state, wants to finish what, and what they see when it
|
|
4
|
+
fails** — then decide what to build. A feature is not a list item; it is an answer to a
|
|
5
|
+
scenario. A scenario is not a story; it is an assertion with evidence and a test.
|
|
6
|
+
|
|
7
|
+
This command produces a design, not a build. The plan ends at "ready for you to
|
|
8
|
+
approve", and building it is `/code-caption`'s job. Never treat an approved-looking plan of your own as permission to start.
|
|
9
|
+
|
|
10
|
+
## When not to use
|
|
11
|
+
|
|
12
|
+
Say so in one line and stop: a visual or copy change, a single defect, a PRD that
|
|
13
|
+
already fixes the scope, or a question one file answers. Ceremony on the wrong task is
|
|
14
|
+
worse than none.
|
|
15
|
+
|
|
16
|
+
## Three iron rules
|
|
17
|
+
|
|
18
|
+
1. **Derive the users from traces.** Real sessions, ledger events, click paths, support
|
|
19
|
+
questions, existing entry points. Never invent a persona.
|
|
20
|
+
2. **Every conclusion carries evidence.** Observed > logs/screens > the person's words >
|
|
21
|
+
inference. With code, cite `file:line`; never cite a doc or comment as proof.
|
|
22
|
+
3. **A scenario must be able to fail.** No failure form, empty state, and exit path
|
|
23
|
+
means it is not thought through.
|
|
24
|
+
|
|
25
|
+
Missing information: ask only **who is served, how they cope today, and what happens
|
|
26
|
+
when it fails**, then give a one-page assumption set. Do not stall on questions.
|
|
27
|
+
|
|
28
|
+
## Four base maps
|
|
29
|
+
|
|
30
|
+
Draw all four before anything else; a scenario list on a missing map is a list of wishes.
|
|
31
|
+
|
|
32
|
+
| Map | Answers | Product |
|
|
33
|
+
| --- | --- | --- |
|
|
34
|
+
| Goal | North star, two or three pillars, what is explicitly not done | one-page goal tree |
|
|
35
|
+
| Resource | First-class things, relations, where the authoritative data lives | resource model + single source |
|
|
36
|
+
| Role | Who operates, executes, approves, watches; entry and write surface | role table + permission matrix |
|
|
37
|
+
| Capability | What exists today, and whether it is `wired` or only looks like it | five-state table from `/code-audit` |
|
|
38
|
+
|
|
39
|
+
No repository to read (only a brief): the brief is the only source — mark each gap
|
|
40
|
+
**unconfirmed** and give one cheap way to settle it.
|
|
41
|
+
|
|
42
|
+
The five states, so the current-state column has a vocabulary even when no audit ran:
|
|
43
|
+
`wired` keep · `half` wire it first · `fake` remove the claim first · `broken` repair the
|
|
44
|
+
flow · `missing` route by frequency. Criteria:
|
|
45
|
+
`agents/audit/references/capability-states.md` — do not re-derive them or invent a sixth.
|
|
46
|
+
A row you did not check is **unconfirmed**, never `wired`.
|
|
47
|
+
|
|
48
|
+
Between the resource model and the scenario list sits the **feature card**: one row per
|
|
49
|
+
function — scenario served, where it lands today, state with `file:line`, non-goal. It
|
|
50
|
+
is the only table where an audit's `fake` becomes visible inside a design. Template:
|
|
51
|
+
`references/base-maps.md`.
|
|
52
|
+
|
|
53
|
+
## Roles and the permission matrix
|
|
54
|
+
|
|
55
|
+
One row per role: who, entry point, what they may write, what they may not (and the
|
|
56
|
+
refusal), what success looks like, who owns failure.
|
|
57
|
+
|
|
58
|
+
- **Operator is not executor** — a person clicks, an agent calls tools; separate rows.
|
|
59
|
+
- **The permission matrix comes before the feature list** — a need that crosses a role
|
|
60
|
+
boundary gets a different entry point, not a widened permission.
|
|
61
|
+
- **Scope flows one way** — say who reads whom, which way copies go, which copy wins.
|
|
62
|
+
- **Name the non-users** — who this does not serve, and what it does not replace.
|
|
63
|
+
|
|
64
|
+
At least one high-frequency need should be **denied**, with its alternative entry point
|
|
65
|
+
written down. If nothing was denied, you drew a feature list and called it a matrix.
|
|
66
|
+
|
|
67
|
+
## Enumerate scenarios
|
|
68
|
+
|
|
69
|
+
Scenarios are laid out, not brainstormed: role × stage × intent. Stages: enter, create,
|
|
70
|
+
run, intervene, close, look back. Baseline groups: first use · daily path · stuck ·
|
|
71
|
+
adjustment · paused · switching · collaboration · quota and cost — their questions and
|
|
72
|
+
gap shapes are in `references/scenario-cards.md`. Failure classes, at least one each:
|
|
73
|
+
permission refused, upstream cancelled, crash and recovery.
|
|
74
|
+
|
|
75
|
+
Coverage is a gate: at least one row per baseline group, three per role, one per stage,
|
|
76
|
+
three failure rows, and every row points at a real entry point or event.
|
|
77
|
+
|
|
78
|
+
## The scenario card
|
|
79
|
+
|
|
80
|
+
One scenario per card, **no solutions on the card** — they go in the batch table. Ten
|
|
81
|
+
fields: id and goal · role, entry, permission · trigger · precondition state · main path
|
|
82
|
+
(step → where it lands) · branches that apply · failure form (shown, recorded, recovered,
|
|
83
|
+
cleaned up by whom) · current state + `file:line` · Given/When/Then with a time limit ·
|
|
84
|
+
**a negative assertion**: what this action must not change.
|
|
85
|
+
|
|
86
|
+
The boundary eight: no data, double submit, two writers, out-of-role call, upstream
|
|
87
|
+
cancelled, timeout, 100 rows/10 teams, old records without the new field. Template,
|
|
88
|
+
worked cards, and the three questions that expose a slogan: `references/scenario-cards.md`.
|
|
89
|
+
|
|
90
|
+
## Rank by evidence
|
|
91
|
+
|
|
92
|
+
Pass the same scenarios through six angles — role, frequency, harm, risk, dependency,
|
|
93
|
+
verifiability — then pick **one** sorting and say which:
|
|
94
|
+
|
|
95
|
+
| Question | Primary sort | Constraint |
|
|
96
|
+
| --- | --- | --- |
|
|
97
|
+
| What new capability to build | frequency | pure reads first among equals; permission-denied is vetoed |
|
|
98
|
+
| Which defect to fix first | data damage > deadlock > misleading > friction | change risk and dependency |
|
|
99
|
+
|
|
100
|
+
Never mix the two in one list. A need the matrix vetoes does not enter the schedule;
|
|
101
|
+
find another entry point or write it into "not doing". Scoring is optional and only for
|
|
102
|
+
layering — if you score, say what would flip the order.
|
|
103
|
+
|
|
104
|
+
## Batches and gates
|
|
105
|
+
|
|
106
|
+
**Batch 0 is always a gate**: a check that notices "written but not wired", before any
|
|
107
|
+
feature — otherwise each batch adds another convincing false completion. Four parts: a
|
|
108
|
+
scanner (production has no callers, tests still reference it), an allowlist splitting
|
|
109
|
+
`keep` from `todo`, a ratchet (`maxTodo` only falls), and a cross-check that every name
|
|
110
|
+
cited from a closed set exists in one catalogue.
|
|
111
|
+
|
|
112
|
+
The batch table: batch, which harm it removes, items, where they land, acceptance, risk,
|
|
113
|
+
rollback. Rules: one batch one commit and revertable; ≤ one day and ≤ five files; a
|
|
114
|
+
state-machine or protocol change gets its own batch; every batch says which harm goes
|
|
115
|
+
away, which test turns green, which gate number moves; dependency order is written down.
|
|
116
|
+
|
|
117
|
+
Then a **"not doing"** table (what, why, when to revisit) and a progress table with four
|
|
118
|
+
states: not started, partial, done, reverted. Details: `references/plan-and-batches.md`.
|
|
119
|
+
|
|
120
|
+
## Output and where it stops
|
|
121
|
+
|
|
122
|
+
Write the documents under the design directory named in your brief, numbered so the next
|
|
123
|
+
round can cite them. Deliver in this order, in conversation, before the files are read:
|
|
124
|
+
|
|
125
|
+
1. one page: target users, north star, the three worst problems, which batch first;
|
|
126
|
+
2. the four base maps;
|
|
127
|
+
3. the scenario list plus three P0 cards (the rest goes into the file);
|
|
128
|
+
4. the multi-angle matrix and why this order;
|
|
129
|
+
5. the batch table and the not-doing list;
|
|
130
|
+
6. open questions, marked **unconfirmed**, never mixed into the conclusions.
|
|
131
|
+
|
|
132
|
+
Length follows the tier in your brief; do not pad a one-page judgement into fifteen
|
|
133
|
+
pages.
|
|
134
|
+
|
|
135
|
+
The last line of every design is the same: **the plan is ready, approve it or change it.** If they approve, the next command is `/code-caption` with the batch
|
|
136
|
+
table as its task — not you, and not this command.
|
|
137
|
+
|
|
138
|
+
## Before you hand it over
|
|
139
|
+
|
|
140
|
+
Run `references/self-check.md` and tick each line. An unticked line is a finding about
|
|
141
|
+
the design: fix it, or name it in the open questions with what it would take to pass.
|
|
142
|
+
Never tick what you did not check.
|
|
143
|
+
|
|
144
|
+
## Reference files
|
|
145
|
+
|
|
146
|
+
| File | Read it when |
|
|
147
|
+
| --- | --- |
|
|
148
|
+
| `references/base-maps.md` | drawing the goal tree, resource model, role table, or feature card |
|
|
149
|
+
| `references/scenario-cards.md` | writing a P0 card, the baseline questions, or judging a card |
|
|
150
|
+
| `references/plan-and-batches.md` | the gate, the batch table, the not-doing list, the progress table |
|
|
151
|
+
| `references/model-and-ports.md` | the feature table is done but you cannot say where each field lives |
|
|
152
|
+
| `references/deliverables.md` | choosing the document set and numbering for this tier |
|
|
153
|
+
| `references/self-check.md` | before handing a design over |
|
|
154
|
+
| `examples/one-page.md` | the person wants a thirty-minute judgement |
|
|
155
|
+
| `examples/overkill.md` | you are about to run this protocol on a task that does not need it |
|
|
156
|
+
|
|
157
|
+
If a reference path is unreadable, continue from this file — the core instructions are
|
|
158
|
+
self-sufficient.
|