@morning-start/dsh-code-toolkit 0.27.1 → 0.28.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/CHANGELOG.md +119 -0
- package/README.md +71 -10
- package/agents/audit/AGENT.md +171 -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 +12 -0
- package/agents/caption/references/evidence.md +46 -0
- package/agents/design/AGENT.md +214 -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 +16 -0
- package/agents/scrub/AGENT.md +5 -1
- package/index.js +65 -4
- package/locale/en.json +2 -2
- package/locale/zh.json +2 -2
- package/package.json +5 -3
- package/src/command.js +73 -52
- package/src/design.js +70 -0
- package/src/i18n.js +50 -0
- package/src/identity.js +23 -0
- package/src/journal.js +10 -0
- package/src/report.js +112 -3
- package/src/runtime.js +21 -9
|
@@ -0,0 +1,214 @@
|
|
|
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 an item on a list; it is an
|
|
5
|
+
answer to a scenario. A scenario is not a story; it is an assertion with evidence
|
|
6
|
+
and an acceptance test.
|
|
7
|
+
|
|
8
|
+
This command produces a design. It does not build one. The plan ends at "ready for
|
|
9
|
+
you to approve", and building it hands off to `/code-caption`. Never treat an approved-looking plan of your own as permission to start.
|
|
10
|
+
|
|
11
|
+
## When not to use
|
|
12
|
+
|
|
13
|
+
Say so in one line and stop. Running this ceremony on the wrong task is worse than
|
|
14
|
+
not running it:
|
|
15
|
+
|
|
16
|
+
- a visual adjustment, a copy change, a single defect;
|
|
17
|
+
- a PRD that already fixes the scope and only needs implementing;
|
|
18
|
+
- a question that can be answered by reading one file.
|
|
19
|
+
|
|
20
|
+
If you are unsure, ask the three questions below first; if the answers are already
|
|
21
|
+
known by the person and by you, the ceremony is unnecessary.
|
|
22
|
+
|
|
23
|
+
## Three iron rules
|
|
24
|
+
|
|
25
|
+
1. **Derive the users from traces.** Real sessions, ledger events, click paths,
|
|
26
|
+
support questions, existing entry points. Never invent a persona; never write
|
|
27
|
+
"developers who value speed".
|
|
28
|
+
2. **Every conclusion carries evidence.** Observed beats logs and screenshots,
|
|
29
|
+
which beat the person's words, which beat inference. With code, cite `file:line`.
|
|
30
|
+
Never cite a doc, a comment, or a test name as proof that something works.
|
|
31
|
+
3. **A scenario must be able to fail.** If you cannot write its failure form, its
|
|
32
|
+
empty state, and its exit path, it is not thought through yet.
|
|
33
|
+
|
|
34
|
+
Missing information: ask only **who is served, how they cope today, and what
|
|
35
|
+
happens when it fails**, then give a one-page assumption set. Do not stall on
|
|
36
|
+
questions — an assumption the person can correct is worth more than a blank page.
|
|
37
|
+
|
|
38
|
+
## Four base maps
|
|
39
|
+
|
|
40
|
+
Draw all four before anything else. If one is missing, stop and get it; a scenario
|
|
41
|
+
list built on a missing map is a list of wishes.
|
|
42
|
+
|
|
43
|
+
| Map | Answers | Product |
|
|
44
|
+
| --- | --- | --- |
|
|
45
|
+
| Goal | What is the north star, which two or three pillars, what is explicitly not done | one-page goal tree |
|
|
46
|
+
| Resource | Which things are first-class, how they relate, where the authoritative data lives | resource model + single source of truth |
|
|
47
|
+
| Role | Who operates, who executes, who approves, who watches; where each enters, what each may write | role table + permission matrix |
|
|
48
|
+
| Capability | What exists today, and whether it is `wired` or only looks like it | five-state table from `/code-audit` |
|
|
49
|
+
|
|
50
|
+
With no repository to read (only a brief): the brief is the only source. Do not
|
|
51
|
+
pretend to have read code; mark each gap **unconfirmed** and give one cheap way to
|
|
52
|
+
settle it.
|
|
53
|
+
|
|
54
|
+
The five states, so the "current state" column has a vocabulary even when no audit
|
|
55
|
+
ran in this session. The criteria are the audit's, not yours
|
|
56
|
+
(`agents/audit/references/capability-states.md`); do not re-derive them and do not
|
|
57
|
+
invent a sixth state. What you own is the action, and it differs per state:
|
|
58
|
+
|
|
59
|
+
- `half` → wire it first; the cheapest batch in the plan.
|
|
60
|
+
- `fake` → remove the claim first, then decide whether to build it.
|
|
61
|
+
- `broken` → repair the flow, not the button.
|
|
62
|
+
- `wired` → not a problem; keep it.
|
|
63
|
+
- `missing` → route it by frequency; it is design's material.
|
|
64
|
+
|
|
65
|
+
A row whose state you did not check is `unconfirmed`, never `wired`.
|
|
66
|
+
|
|
67
|
+
Between the resource model and the scenario list sits the **feature card**: one row per
|
|
68
|
+
function — the scenario it serves, where it lands today, its state with `file:line`,
|
|
69
|
+
and its non-goal. It is the only table where an audit's `fake` becomes visible inside
|
|
70
|
+
a design. Template in `references/base-maps.md`.
|
|
71
|
+
|
|
72
|
+
## Roles and the permission matrix
|
|
73
|
+
|
|
74
|
+
One row per role: who, which entry point, what they may write, what they may not
|
|
75
|
+
write (and the refusal), what success looks like, who owns a failure.
|
|
76
|
+
|
|
77
|
+
Four rules:
|
|
78
|
+
|
|
79
|
+
- **Operator is not executor.** A person clicks; an agent calls tools. Their write
|
|
80
|
+
surfaces, error surfaces, and recoverability differ, so they are separate rows.
|
|
81
|
+
- **The permission matrix comes before the feature list.** A high-frequency need
|
|
82
|
+
that crosses a role boundary gets a different entry point, not a widened
|
|
83
|
+
permission.
|
|
84
|
+
- **Scope flows one way.** With global and project levels, state who reads whom,
|
|
85
|
+
which direction copies go, and which copy wins at runtime.
|
|
86
|
+
- **Name the non-users.** Who this does not serve, and what it does not replace.
|
|
87
|
+
|
|
88
|
+
At least one high-frequency need should be **denied** by the matrix, with its
|
|
89
|
+
alternative entry point written down. If nothing was denied, you drew a feature
|
|
90
|
+
list and called it a matrix.
|
|
91
|
+
|
|
92
|
+
## Enumerate scenarios
|
|
93
|
+
|
|
94
|
+
Scenarios are not brainstormed; they are laid out as role × stage × intent.
|
|
95
|
+
|
|
96
|
+
- Stages: enter, create, run, intervene, close, look back.
|
|
97
|
+
- Intents (replace per product): build, view, change, stop, shelve, switch,
|
|
98
|
+
collaborate, quota, export, recover, audit, migrate.
|
|
99
|
+
|
|
100
|
+
The eight baseline groups — first use · daily path · stuck · adjustment · paused ·
|
|
101
|
+
switching · collaboration · quota and cost — plus three failure classes: permission
|
|
102
|
+
refused, upstream cancelled or dependency gone, crash and recovery. What each one
|
|
103
|
+
asks, and what a gap in it looks like, is in `references/scenario-cards.md`.
|
|
104
|
+
|
|
105
|
+
Coverage is a gate, not a preference: at least one row per baseline group, three
|
|
106
|
+
per role, one per stage, three failure rows, and every row points at a real entry
|
|
107
|
+
point or a real event. A scenario with no entry point is a wish.
|
|
108
|
+
|
|
109
|
+
## The scenario card
|
|
110
|
+
|
|
111
|
+
One scenario per card, and **no solutions on the card** — a solution there hides the
|
|
112
|
+
problem; solutions belong in the batch table.
|
|
113
|
+
|
|
114
|
+
Ten fields — the full template with a worked example is in
|
|
115
|
+
`references/scenario-cards.md`:
|
|
116
|
+
|
|
117
|
+
1. id, name, one-line goal · 2. role, entry, permission · 3. trigger: a user action
|
|
118
|
+
or a system event · 4. the concrete precondition state · 5. main path, step →
|
|
119
|
+
where it lands (screen, interface, event) · 6. the branches that apply ·
|
|
120
|
+
7. failure form: what is shown, whether the ledger recorded it, whether it
|
|
121
|
+
recovers, who cleans up · 8. current state plus `file:line` · 9. acceptance:
|
|
122
|
+
Given / When / Then, with a time limit · 10. **a negative assertion**: what this
|
|
123
|
+
action must *not* change
|
|
124
|
+
|
|
125
|
+
The boundary eight (空重并权断慢大旧): no data; double submit; two writers on one
|
|
126
|
+
record; an out-of-role call; upstream cancelled; timeout; 100 rows or 10 teams; old
|
|
127
|
+
records without the new field.
|
|
128
|
+
|
|
129
|
+
Three questions that expose a card still at slogan level: where does this state come
|
|
130
|
+
from, where does this write land, and who cleans up after a failure.
|
|
131
|
+
|
|
132
|
+
## Rank by evidence
|
|
133
|
+
|
|
134
|
+
Pass the same scenarios through six angles: role, frequency, harm, risk,
|
|
135
|
+
dependency, verifiability. Then pick one sorting and say which:
|
|
136
|
+
|
|
137
|
+
| Question | Primary sort | Constraint |
|
|
138
|
+
| --- | --- | --- |
|
|
139
|
+
| What new capability to build | frequency | pure reads first among equals; permission-denied is vetoed |
|
|
140
|
+
| Which existing defect to fix first | harm: data damage > deadlock > misleading > friction | change risk and dependency as constraints |
|
|
141
|
+
|
|
142
|
+
Never mix the two in one list. A need the permission matrix vetoes does not enter
|
|
143
|
+
the schedule; either find another entry point or write it into "not doing".
|
|
144
|
+
|
|
145
|
+
Scoring is optional and only for layering. If you score, say the weights are a
|
|
146
|
+
judgement and name what would flip the order.
|
|
147
|
+
|
|
148
|
+
## Batches and gates
|
|
149
|
+
|
|
150
|
+
**Batch 0 is always a gate**: a check that can notice "written but not wired",
|
|
151
|
+
before any feature. Without it each batch can add another convincing false
|
|
152
|
+
completion.
|
|
153
|
+
|
|
154
|
+
A gate has four parts: a scanner (production has zero callers, tests still
|
|
155
|
+
reference it → say unwired), an allowlist separating `keep` from `todo`, a ratchet
|
|
156
|
+
(`maxTodo` only falls), and a cross-check that every name a doc or the code cites
|
|
157
|
+
from a closed set exists in one catalogue.
|
|
158
|
+
|
|
159
|
+
Then the batch table: batch, which harm it removes, items, where they land,
|
|
160
|
+
acceptance, risk, rollback. Rules:
|
|
161
|
+
|
|
162
|
+
- one batch, one commit, independently revertable;
|
|
163
|
+
- one batch ≤ one day; a code batch ≤ five files; a state-machine or protocol
|
|
164
|
+
change gets its own batch;
|
|
165
|
+
- every batch answers: which user harm goes away, which test turns green, which
|
|
166
|
+
gate number moves;
|
|
167
|
+
- dependency order is written in the table, not remembered.
|
|
168
|
+
|
|
169
|
+
Add a **"not doing"** table (what, why, when to revisit) — it is what stops the
|
|
170
|
+
plan from being re-litigated every round — and a progress table using only four
|
|
171
|
+
states: not started, partial, done, reverted.
|
|
172
|
+
|
|
173
|
+
## Output and where it stops
|
|
174
|
+
|
|
175
|
+
Write the documents under the design directory named in your brief, numbered so the
|
|
176
|
+
next round can cite them. Deliver in this order, in conversation, before the files
|
|
177
|
+
are read:
|
|
178
|
+
|
|
179
|
+
1. one page: target users, north star, the three worst problems, which batch first;
|
|
180
|
+
2. the four base maps;
|
|
181
|
+
3. the scenario list plus three P0 cards (the rest goes into the file);
|
|
182
|
+
4. the multi-angle matrix and why this order;
|
|
183
|
+
5. the batch table and the not-doing list;
|
|
184
|
+
6. open questions, marked **unconfirmed**, never mixed into the conclusions.
|
|
185
|
+
|
|
186
|
+
Length follows the tier you were given; do not pad a one-page judgement into
|
|
187
|
+
fifteen pages. Re-read the person's request before choosing the tier.
|
|
188
|
+
|
|
189
|
+
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
|
|
190
|
+
table as its task — not you, and not this command.
|
|
191
|
+
|
|
192
|
+
## Before you hand it over
|
|
193
|
+
|
|
194
|
+
Run `references/self-check.md` and tick each line. An unticked line is a finding
|
|
195
|
+
about the design: fix it, or name it in the open questions with what it would take to
|
|
196
|
+
pass. Do not tick a line you did not check, and do not call a design ready with a
|
|
197
|
+
line silently skipped — a checklist with two false ticks is worse than a design
|
|
198
|
+
delivered with two named gaps.
|
|
199
|
+
|
|
200
|
+
## Reference files
|
|
201
|
+
|
|
202
|
+
| File | Read it when |
|
|
203
|
+
| --- | --- |
|
|
204
|
+
| `references/base-maps.md` | Drawing the goal tree, the resource model, or the role table |
|
|
205
|
+
| `references/scenario-cards.md` | Writing a P0 card, or judging whether one is good enough |
|
|
206
|
+
| `references/plan-and-batches.md` | Building the batch table, the gate, the not-doing list, the progress table |
|
|
207
|
+
| `references/model-and-ports.md` | The feature table is done but you cannot say which file or table each field lives in |
|
|
208
|
+
| `references/deliverables.md` | Choosing the document set and numbering for this tier |
|
|
209
|
+
| `references/self-check.md` | Before handing a design over, and whenever a document claims to be finished |
|
|
210
|
+
| `examples/one-page.md` | The person wants a thirty-minute judgement |
|
|
211
|
+
| `examples/overkill.md` | You are about to run this protocol on a task that does not need it |
|
|
212
|
+
|
|
213
|
+
If a reference path is unreadable, continue from this file — the core instructions are
|
|
214
|
+
self-sufficient.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Example: a quick-tier answer that is actually an answer
|
|
2
|
+
|
|
3
|
+
Request: "这个插件还缺什么?" — one sentence, no repository named, a real repo to read.
|
|
4
|
+
|
|
5
|
+
## What a good reply looks like
|
|
6
|
+
|
|
7
|
+
> **Tier: quick.** Read `index.js` and the command table; the audit below is from
|
|
8
|
+
> the tree, not from running the commands.
|
|
9
|
+
>
|
|
10
|
+
> **Who it serves.** People who already work in a DSH session and want one action
|
|
11
|
+
> taken on the tree — review, simplify, scrub. Not people who want a chat assistant.
|
|
12
|
+
>
|
|
13
|
+
> **North star.** A person can start any of these checks from the command line and
|
|
14
|
+
> see what it will touch, what it will change, and what it could not check.
|
|
15
|
+
>
|
|
16
|
+
> **The three worst problems**
|
|
17
|
+
> 1. `fake` — `README` promises "eight output languages"; `i18n.js` translates chrome
|
|
18
|
+
> for two and the task line for eight. The docs claim more than the code.
|
|
19
|
+
> 2. `half` — nothing validates the *result* of a fix; a review that fixes and never
|
|
20
|
+
> re-runs the gate reports done. `src/command.js:281` records the body without a
|
|
21
|
+
> verification field.
|
|
22
|
+
> 3. `broken` — `/code-status` reads the journal, but an inline run writes
|
|
23
|
+
> `submitted` and never `finished`; the status lies after a long run.
|
|
24
|
+
>
|
|
25
|
+
> **Five scenarios, one failure form each**
|
|
26
|
+
> - first run with no arguments → no git repo → "not a repository", one line, no stack
|
|
27
|
+
> - review on a clean tree → empty scope → names `--branch` and `--files`
|
|
28
|
+
> - a run that hangs on an approval → stuck → released after `runTimeoutMinutes`
|
|
29
|
+
> - two commands in one session → busy → says which one is running
|
|
30
|
+
> - a report that lost its JSON → format broken → raw text is delivered, not dropped
|
|
31
|
+
>
|
|
32
|
+
> **Where to start:** fix 3 (status lies), then 2 (a fix without a gate), then 1
|
|
33
|
+
> (a doc claim — cheapest, and it stops misleading the next reader). One batch each.
|
|
34
|
+
>
|
|
35
|
+
> **Unconfirmed:** whether the eight languages are promised anywhere the user sees;
|
|
36
|
+
> one `grep` in `locale/` would settle it.
|
|
37
|
+
|
|
38
|
+
Why this passes the bar: every claim points at a file, the three problems are
|
|
39
|
+
ranked by how much they cost, the failure forms are concrete, and there is exactly
|
|
40
|
+
one open question with the action that closes it.
|
|
41
|
+
|
|
42
|
+
## What it deliberately does not contain
|
|
43
|
+
|
|
44
|
+
- no fifteen-page appendix for a question that fits on a page;
|
|
45
|
+
- no scenario cards — five one-line rows are honest at this depth, three cards with
|
|
46
|
+
invented branches would not be;
|
|
47
|
+
- no batch with two unrelated fixes;
|
|
48
|
+
- no "design system" or "plugin architecture" section, because nothing asked for
|
|
49
|
+
one and no trace supported it.
|
|
50
|
+
|
|
51
|
+
## The tell that you have the tier right
|
|
52
|
+
|
|
53
|
+
The person can disagree with a decision on this page. If the reply is so long that
|
|
54
|
+
they cannot find the recommendation, the depth was wrong no matter how good the
|
|
55
|
+
content is.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Example: the ceremony on a task that did not need it
|
|
2
|
+
|
|
3
|
+
Request: "把设置页那个刷新按钮改成蓝色" — a colour change on one button.
|
|
4
|
+
|
|
5
|
+
## The wrong reply
|
|
6
|
+
|
|
7
|
+
> **Tier: full.**
|
|
8
|
+
>
|
|
9
|
+
> ## Goal tree
|
|
10
|
+
> North star: a delightful settings experience. Pillars: clarity, consistency,
|
|
11
|
+
> discoverability. Not doing: dark mode.
|
|
12
|
+
> ## Resource model
|
|
13
|
+
> Button (identity: id) → theme token → CSS variable → computed style.
|
|
14
|
+
> ## Role table
|
|
15
|
+
> …six rows…
|
|
16
|
+
> ## Permission matrix
|
|
17
|
+
> …seven columns…
|
|
18
|
+
> ## Scenario list (24 rows)
|
|
19
|
+
> S01 first visit … S24 old browsers without CSS variables …
|
|
20
|
+
> ## P0 cards
|
|
21
|
+
> ### S03 — press refresh and see a blue button
|
|
22
|
+
> - Branches: 空 重 并 权 断 慢 大 旧 …
|
|
23
|
+
> ## Batch 0 — a gate
|
|
24
|
+
> A scanner that finds buttons whose computed colour differs from the token …
|
|
25
|
+
> ## Batch table (5 batches)
|
|
26
|
+
> ## Not doing (3 rows)
|
|
27
|
+
|
|
28
|
+
Every table is defensible. Together they are an insult: the person asked for one
|
|
29
|
+
colour, and the answer contains a proposal to build a colour-consistency gate.
|
|
30
|
+
|
|
31
|
+
## The right reply
|
|
32
|
+
|
|
33
|
+
> 一行:`--accent` 在 `theme/tokens.css:14`,刷新按钮用的是 `--accent`,改那一处即可,
|
|
34
|
+
> 深色模式下不需要额外处理。要我把 `--accent` 也同步给其它次要按钮吗?
|
|
35
|
+
|
|
36
|
+
One line, the exact file and line, the consequence the person would have asked
|
|
37
|
+
next, and one question instead of five tables.
|
|
38
|
+
|
|
39
|
+
## How to tell, before you start
|
|
40
|
+
|
|
41
|
+
Ask in this order; stop at the first "yes":
|
|
42
|
+
|
|
43
|
+
1. Is the answer one file and one value? → just do it.
|
|
44
|
+
2. Is the scope already fixed by someone else, and only implementation is left? →
|
|
45
|
+
that is `/code-caption`, not this.
|
|
46
|
+
3. Are the users, the failure form, and the entry point already obvious to the
|
|
47
|
+
person? → say what you would change and ask, rather than designing it.
|
|
48
|
+
|
|
49
|
+
## The failure this example is guarding against
|
|
50
|
+
|
|
51
|
+
A protocol that can produce a five-table answer will produce one when nothing
|
|
52
|
+
requires it, because tables look like work. The cost is not the tokens; it is that
|
|
53
|
+
the person learns to skim, and then skims the one design that mattered.
|
|
54
|
+
|
|
55
|
+
Say the tier out loud in the first line. A one-line answer that names its file is
|
|
56
|
+
what "scenario-driven" looks like when the scenario really is one line.
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# The four base maps
|
|
2
|
+
|
|
3
|
+
Source: adapted from the local skill `scenario-driven-product-design`
|
|
4
|
+
(`SKILL.md` step 0, `references/plan-and-batches.md` return formats),
|
|
5
|
+
user-authored, no upstream licence; rewritten as templates.
|
|
6
|
+
|
|
7
|
+
A base map is a one-page answer, not a document. If a map takes more than a page,
|
|
8
|
+
it is hiding a decision behind detail.
|
|
9
|
+
|
|
10
|
+
## Goal tree
|
|
11
|
+
|
|
12
|
+
```text
|
|
13
|
+
North star: one sentence a person would repeat.
|
|
14
|
+
Pillar 1: a result the user gets DoD: how we know
|
|
15
|
+
Pillar 2: a result the user gets DoD: how we know
|
|
16
|
+
Not doing: thing | why | when to revisit
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Rules:
|
|
20
|
+
|
|
21
|
+
- A pillar is a **result the user gets**, never a module name ("review works
|
|
22
|
+
offline" not "offline layer").
|
|
23
|
+
- Two or three pillars. A fourth means the product has no shape yet.
|
|
24
|
+
- The "not doing" line is mandatory. A goal tree without one is a wish list.
|
|
25
|
+
- Every DoD must be checkable by someone who did not write it. "Feels fast" is not
|
|
26
|
+
a DoD; "p95 under 300 ms on the fixture set" is.
|
|
27
|
+
|
|
28
|
+
## Resource model
|
|
29
|
+
|
|
30
|
+
For each first-class resource: name, identity, relations, where it is stored, what
|
|
31
|
+
the runtime truth is, and which direction copies flow.
|
|
32
|
+
|
|
33
|
+
```text
|
|
34
|
+
Resource | Identity | Relations | Stored | Runtime truth | Copy direction
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Two checks, both cheap and both frequently failed:
|
|
38
|
+
|
|
39
|
+
1. **One truth per fact.** If a dashboard number is derived from a ledger, the
|
|
40
|
+
ledger is the truth and the dashboard is a view. A second cache is a second bug.
|
|
41
|
+
2. **One write path.** If the same resource is written by two routes, one of them
|
|
42
|
+
will eventually skip a field. Route new writes through the existing pipeline or
|
|
43
|
+
say why a second path is unavoidable.
|
|
44
|
+
|
|
45
|
+
## Role table
|
|
46
|
+
|
|
47
|
+
```text
|
|
48
|
+
Role | Who | Entry | May write | May not write (refusal) | Success looks like | Owns failure
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The "may not write" column is the one people skip and the one that pays: it is
|
|
52
|
+
where the refusal code, the alternative entry point, and the support answer all
|
|
53
|
+
come from. A role with an empty "may not" column has no boundary and will absorb
|
|
54
|
+
every future feature.
|
|
55
|
+
|
|
56
|
+
Operator and executor are different rows whenever an agent or a job acts on the
|
|
57
|
+
person's behalf: the write surface and the failure blame are different.
|
|
58
|
+
|
|
59
|
+
## Permission matrix
|
|
60
|
+
|
|
61
|
+
```text
|
|
62
|
+
| read | create | update | delete | approve | configure
|
|
63
|
+
role A | ✓ | ✓ | ✓ | — | — | —
|
|
64
|
+
role B | ✓ | — | — | — | ✓ | ✓
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Fill it before the feature list. When a high-frequency need is denied, write the
|
|
68
|
+
alternative entry point in the same cell — "denied" with no alternative is how a
|
|
69
|
+
matrix gets quietly deleted later.
|
|
70
|
+
|
|
71
|
+
## The feature card
|
|
72
|
+
|
|
73
|
+
Between the resource model and the scenario list sits the table this protocol is
|
|
74
|
+
easiest to skip and hardest to defend without: one row per function, joined to the
|
|
75
|
+
scenario it serves and to what exists today.
|
|
76
|
+
|
|
77
|
+
```text
|
|
78
|
+
Function | Serves which scenario | Where it lands today | Capability state | Evidence | Non-goal
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
- **Function** is something a person asks for, at the same grain as a capability in
|
|
82
|
+
an audit — not a module and not a screen.
|
|
83
|
+
- **Serves which scenario** is an id from the scenario list. A function with no
|
|
84
|
+
scenario is a candidate for the not-doing table.
|
|
85
|
+
- **Where it lands today** is the entry point or the file, not "the backend".
|
|
86
|
+
- **Capability state** is one of the five tokens, and it comes from `/code-audit`,
|
|
87
|
+
not from reading the README. If no audit was run, the state is `unconfirmed` and
|
|
88
|
+
the evidence column says why.
|
|
89
|
+
- **Evidence** is `file:line` for anything not `missing`. A row that says "should
|
|
90
|
+
be implemented" instead has no state and no evidence, and it is the exact failure
|
|
91
|
+
the audit exists to catch.
|
|
92
|
+
- **Non-goal** is what this function deliberately will not do. It is the column
|
|
93
|
+
that stops scope from arriving one feature at a time.
|
|
94
|
+
|
|
95
|
+
This is the table that lets a reader answer "we already have this, don't build it"
|
|
96
|
+
without opening the repository. It is also the only place a `fake` capability
|
|
97
|
+
becomes visible in a design rather than only in an audit.
|
|
98
|
+
|
|
99
|
+
## When the map is missing
|
|
100
|
+
|
|
101
|
+
If you have no repository, no sessions, and no logs, the brief is the only source.
|
|
102
|
+
Then:
|
|
103
|
+
|
|
104
|
+
- write the maps as hypotheses, each marked **unconfirmed**;
|
|
105
|
+
- attach one cheap verification per map (open the router file, ask the person one
|
|
106
|
+
question, read the one cron config);
|
|
107
|
+
- do not let an unconfirmed map feed a P0 card without saying so in the card.
|
|
108
|
+
|
|
109
|
+
An unconfirmed map that says so is useful. One that pretends to be observed poisons
|
|
110
|
+
everything after it.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# The document set, and how deep to go
|
|
2
|
+
|
|
3
|
+
Source: the deliverable list is adapted from the local skill
|
|
4
|
+
`scenario-driven-product-design` (`SKILL.md` 交付物 and 按投入分级),
|
|
5
|
+
user-authored, no upstream licence. The numbering and tiers are this plugin's.
|
|
6
|
+
|
|
7
|
+
Write under the design directory named in your brief. Number every file so the next
|
|
8
|
+
round can cite `03-场景与功能.md:41` instead of "the scenario doc".
|
|
9
|
+
|
|
10
|
+
## Numbering
|
|
11
|
+
|
|
12
|
+
Fixed prefixes, so the same file has the same place in every project:
|
|
13
|
+
|
|
14
|
+
| File | Content | Required when |
|
|
15
|
+
| --- | --- | --- |
|
|
16
|
+
| `01-目标与资源.md` | goal tree, resource model, the three iron rules, the not-doing line | always |
|
|
17
|
+
| `02-角色与场景.md` | role table, permission matrix, scenario list, P0 cards | default and full |
|
|
18
|
+
| `03-修复方案.md` | batch table, gate, not-doing table, progress table | always |
|
|
19
|
+
| `04-能力审计.md` | the five-state table with `file:line` | when `/code-audit` was run |
|
|
20
|
+
| `05-模型与端口.md` | models, ports, invariants, admission reasons | new builds only |
|
|
21
|
+
| `06-决策记录.md` | the D table: number, decision, impact, supersedes | from the second design round on |
|
|
22
|
+
| `07-封闭集.md` | event types and error codes, each with its trigger | when the product has any |
|
|
23
|
+
|
|
24
|
+
Do not create a file to look thorough. An empty `05` is a claim that a model design
|
|
25
|
+
exists; it is worse than no file.
|
|
26
|
+
|
|
27
|
+
## Three tiers
|
|
28
|
+
|
|
29
|
+
The size of the answer is part of the answer. Choose from what the person asked for,
|
|
30
|
+
and say which tier you took in the first line of the reply.
|
|
31
|
+
|
|
32
|
+
**quick — a thirty-minute judgement.** One file, `01-目标与资源.md`, containing:
|
|
33
|
+
|
|
34
|
+
- one page: target user, north star, the three worst problems, which batch first;
|
|
35
|
+
- five scenarios, each with one line of failure form;
|
|
36
|
+
- one batch table with at most three items.
|
|
37
|
+
|
|
38
|
+
**default — a half-day design.** `01`, `02`, `03`. Eight to twelve scenarios, three
|
|
39
|
+
P0 cards in `02`, and a batch table with dependencies in `03`. This is what the
|
|
40
|
+
command does when no tier is named.
|
|
41
|
+
|
|
42
|
+
**full — a plan someone will build from.** Everything above plus `04`–`07` as they
|
|
43
|
+
apply. Fifteen to twenty pages, and the one-page conclusion still comes first.
|
|
44
|
+
|
|
45
|
+
If the person's brief is one sentence and the repository is real, default is
|
|
46
|
+
usually right: too shallow and you have not decided anything, too deep and you have
|
|
47
|
+
spent a day on a feature that will change.
|
|
48
|
+
|
|
49
|
+
## Rules that keep the documents honest
|
|
50
|
+
|
|
51
|
+
1. **The conversation gets the summary first.** One page, then the maps, then the
|
|
52
|
+
cards. Nobody reads a fifteen-page design to find out what you recommend.
|
|
53
|
+
2. **A document never claims delivery.** `03`'s progress table uses four states —
|
|
54
|
+
not started, partial, done, reverted — and "done" requires a commit id. A plan
|
|
55
|
+
written in the past tense is the failure this whole protocol exists to prevent.
|
|
56
|
+
3. **Unconfirmed items stay unconfirmed.** Keep them in their own section, with the
|
|
57
|
+
cheap verification that would settle each. Never let an assumption migrate into
|
|
58
|
+
a conclusion because it reads better there.
|
|
59
|
+
4. **Cite, do not summarise, the audit.** `04` is the audit's table; do not retype
|
|
60
|
+
states from memory, because the two copies will disagree and nobody will know
|
|
61
|
+
which is newer.
|
|
62
|
+
5. **Quote what the person actually said** for the parts that came from them, and
|
|
63
|
+
mark it as such. Their words are the second-strongest evidence after observation,
|
|
64
|
+
and they are the part most often silently rewritten.
|
|
65
|
+
|
|
66
|
+
## After approval
|
|
67
|
+
|
|
68
|
+
The last file written is `03-修复方案.md`, and its first table is the batch table.
|
|
69
|
+
That table is the task for `/code-caption`: one batch, one commit, a gate that can
|
|
70
|
+
go red. Do not start batch 1 yourself, and do not "just do the small one first" —
|
|
71
|
+
the approval covers the plan, not the execution.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Models, ports, and the decisions that outlive them
|
|
2
|
+
|
|
3
|
+
Source: adapted from the local skill `scenario-driven-product-design`
|
|
4
|
+
(`references/model-and-ports.md`), user-authored, no upstream licence; condensed to
|
|
5
|
+
the six actions and the three ownership questions.
|
|
6
|
+
|
|
7
|
+
The feature tree answers "what to build". This file answers "split into which
|
|
8
|
+
pieces, who owns each, and what moves when a piece is swapped". Use it once the
|
|
9
|
+
feature table exists and you still cannot say which file or table each field lives
|
|
10
|
+
in.
|
|
11
|
+
|
|
12
|
+
## Six judgement actions
|
|
13
|
+
|
|
14
|
+
| Action | Trigger | Move |
|
|
15
|
+
| --- | --- | --- |
|
|
16
|
+
| **Downgrade a mechanism** | something "obviously must exist" | Ask what threat it prevents. If the threat is not real here, cut it. |
|
|
17
|
+
| **Merge concepts** | the same rule is written twice | Lift it to a shared primitive; leave only the slice below |
|
|
18
|
+
| **Split a concept** | one word needs an "except" | Split into two words: fact vs request, location vs asset, stored vs view |
|
|
19
|
+
| **Downgrade the contract** | "strictly correct" is impossible | List two or three options, pick one, and **change the contract text** — no old wording left behind |
|
|
20
|
+
| **Inference to fact** | relying on a host or third party "as documented" | Write the smallest probe that answers several questions at once |
|
|
21
|
+
| **Reverse lookup** | adding any field, contract, case, or port | Where does the value come from? What enforces it? Which feature needs it? Why now? |
|
|
22
|
+
|
|
23
|
+
The reverse lookup is the one to run on yourself at the end of every design. A field
|
|
24
|
+
with no upstream port and no consumer is a field that will rot.
|
|
25
|
+
|
|
26
|
+
## Model or port: three questions
|
|
27
|
+
|
|
28
|
+
Ownership decides, not convenience:
|
|
29
|
+
|
|
30
|
+
- **We define what is valid for it** → it is a model. Validate it here, name it
|
|
31
|
+
here.
|
|
32
|
+
- **We only borrow the capability** → it is a port. Define the smallest interface
|
|
33
|
+
this product needs, not the vendor's.
|
|
34
|
+
- **It is only the shape of external data** → translate in an adapter. Do not model
|
|
35
|
+
it, and do not let it leak past the adapter.
|
|
36
|
+
|
|
37
|
+
**Do the reversible thing first.** A choice with a wide blast radius and no clear
|
|
38
|
+
answer becomes a port: you can change the implementation without touching the
|
|
39
|
+
design. "We swapped the backend three times and the design moved one file" is the
|
|
40
|
+
only argument for a port that holds.
|
|
41
|
+
|
|
42
|
+
## Two products that get skipped
|
|
43
|
+
|
|
44
|
+
**The closed-set catalogue.** Every name a contract cites — event types, error
|
|
45
|
+
codes, capability states — is registered in exactly one place with its trigger
|
|
46
|
+
condition. Scattered in use sites, no one ever discovers that one action writes two
|
|
47
|
+
events, or that two codes mean the same thing.
|
|
48
|
+
|
|
49
|
+
**The decision table.**
|
|
50
|
+
|
|
51
|
+
```markdown
|
|
52
|
+
| D | Decision | Impact | Supersedes |
|
|
53
|
+
|---|---|---|---|
|
|
54
|
+
| D7 | plans are approved by a different role | approval route, permission matrix | — |
|
|
55
|
+
| D9 | approval may be delegated | D7's owner check | D7 |
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Changing your mind opens a new row that names what it replaces. Editing the old row
|
|
59
|
+
in place destroys the only record of why the current design looks like this.
|
|
60
|
+
|
|
61
|
+
## Pitfalls worth naming
|
|
62
|
+
|
|
63
|
+
- A port added "for flexibility" with no second implementation and no plan for one.
|
|
64
|
+
- A model of someone else's payload, which then spreads through your code.
|
|
65
|
+
- An invariant that exists only as a sentence: no failure code, no test that can go
|
|
66
|
+
red.
|
|
67
|
+
- A closed set that grows per feature and is never re-read as a whole.
|
|
68
|
+
- A decision remembered in conversation instead of the table, so the next round
|
|
69
|
+
re-decides it differently.
|
|
70
|
+
- A probe that was never run, with the design built on "the docs say so".
|
|
71
|
+
|
|
72
|
+
Every invariant in a design needs a failure code and one test that fails when it is
|
|
73
|
+
violated. An invariant with only wording is a hope.
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Batches, the gate, and the two tables that keep a plan alive
|
|
2
|
+
|
|
3
|
+
Source: adapted from the local skill `scenario-driven-product-design`
|
|
4
|
+
(`references/plan-and-batches.md`), user-authored, no upstream licence.
|
|
5
|
+
|
|
6
|
+
## Batch 0 is a gate, not a feature
|
|
7
|
+
|
|
8
|
+
The first batch builds the check that can notice a false completion. Skipping it
|
|
9
|
+
means every later batch can look done while being unwired, and the progress table
|
|
10
|
+
gets prettier as the debt grows.
|
|
11
|
+
|
|
12
|
+
Four parts, and a small project usually needs all four even when it has no test
|
|
13
|
+
framework:
|
|
14
|
+
|
|
15
|
+
| Part | What it does |
|
|
16
|
+
| --- | --- |
|
|
17
|
+
| Scanner | Finds production code with zero callers while tests still reference it — the signature of "written, never wired" |
|
|
18
|
+
| Allowlist | Splits `keep` (test and diagnostic facilities that are legitimately uncalled) from `todo` (real debt) |
|
|
19
|
+
| Ratchet | `maxTodo` may only fall; each cleanup lowers it, so the number is a budget, not a report |
|
|
20
|
+
| Cross-check | Every name cited from a closed set (event types, error codes, contract ids) exists in the one catalogue |
|
|
21
|
+
|
|
22
|
+
The cross-check earns its place: document rot happens when a later specification
|
|
23
|
+
leaves an earlier table behind. A name that is used but not registered fails the
|
|
24
|
+
gate before it fails a user.
|
|
25
|
+
|
|
26
|
+
A gate does not have to be a scanner. In a project with no test setup, a smoke
|
|
27
|
+
script plus a wiring checklist plus a known-gap ratchet is usually cheaper than
|
|
28
|
+
importing a framework — and it can be built in a day.
|
|
29
|
+
|
|
30
|
+
## The batch table
|
|
31
|
+
|
|
32
|
+
```markdown
|
|
33
|
+
| Batch | Harm removed | Items | Where it lands | Acceptance | Risk | Rollback |
|
|
34
|
+
|---|---|---|---|---|---|---|
|
|
35
|
+
| 0 | false completion is invisible | wiring scanner + allowlist | scripts/wiring.mjs | finds the two known gaps, `maxTodo: 2` | low | delete the script |
|
|
36
|
+
| 1 | a plan cannot be resumed after restart | retry handler + list state | src/run/ | S03 acceptance passes | medium: state machine | revert the commit |
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Rules that are not stylistic:
|
|
40
|
+
|
|
41
|
+
- One batch, one commit, independently revertable. If two batches must be reverted
|
|
42
|
+
together, they were one batch.
|
|
43
|
+
- A code batch touches at most five files; a state-machine or protocol change gets
|
|
44
|
+
its own batch whatever its size.
|
|
45
|
+
- Every batch answers three questions: which user harm disappears, which test turns
|
|
46
|
+
green, which gate number changes. A batch that cannot answer all three is
|
|
47
|
+
housekeeping and belongs in its own commit message, not in the plan.
|
|
48
|
+
- Dependency order is a column or an explicit sequence in prose. Never "remember
|
|
49
|
+
that two goes before three".
|
|
50
|
+
- Acceptance is a command or an observable state, not "works".
|
|
51
|
+
|
|
52
|
+
## The not-doing table
|
|
53
|
+
|
|
54
|
+
```markdown
|
|
55
|
+
| Not doing | Why | When to revisit |
|
|
56
|
+
|---|---|---|
|
|
57
|
+
| mobile client | no trace of mobile use in the sessions | after the desktop path is `wired` |
|
|
58
|
+
| bulk import | permission matrix denies it to every current role | when an admin role exists |
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
This table's job is to stop the same decision being reopened every round. Three
|
|
62
|
+
rows minimum; a plan with none has not said no to anything and will absorb every
|
|
63
|
+
"while we are here".
|
|
64
|
+
|
|
65
|
+
## The progress table
|
|
66
|
+
|
|
67
|
+
```markdown
|
|
68
|
+
| Batch | Content | State | Commit |
|
|
69
|
+
|---|---|---|---|
|
|
70
|
+
| 1 | retry handler | ✅ | a1b2c3d |
|
|
71
|
+
| 2 | approval route | 🟡 | — |
|
|
72
|
+
| 3 | export | ⬜ | — |
|
|
73
|
+
| 4 | bulk import | ⛔ reverted | — |
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Four states only: not started, partial, done, reverted. Read the starting point from
|
|
77
|
+
this table, never from memory. A "done" row with no commit is not done — that is the
|
|
78
|
+
whole point of the column.
|
|
79
|
+
|
|
80
|
+
## Ordering the batches
|
|
81
|
+
|
|
82
|
+
Two different orders, and the plan must say which it used:
|
|
83
|
+
|
|
84
|
+
- **New capability**: frequency first, pure reads before writes among equals,
|
|
85
|
+
permission-denied excluded.
|
|
86
|
+
- **Existing defect**: harm first — data damage or loss, then deadlock, then
|
|
87
|
+
misleading results, then friction — with change risk and dependency as
|
|
88
|
+
constraints.
|
|
89
|
+
|
|
90
|
+
Never interleave the two in one sequence without labelling it. A list that mixes
|
|
91
|
+
"users hit this daily" with "this corrupts data" cannot be defended when the person
|
|
92
|
+
asks why batch 3 comes before batch 4.
|