@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.
Files changed (37) hide show
  1. package/CHANGELOG.md +112 -0
  2. package/README.md +111 -11
  3. package/agents/audit/AGENT.md +137 -0
  4. package/agents/audit/examples/fake-capability.md +54 -0
  5. package/agents/audit/examples/wired-clean.md +66 -0
  6. package/agents/audit/references/audit-passes.md +118 -0
  7. package/agents/audit/references/capability-states.md +96 -0
  8. package/agents/audit/references/evidence.md +86 -0
  9. package/agents/audit/references/finding-the-chain.md +80 -0
  10. package/agents/audit/references/output.md +66 -0
  11. package/agents/caption/AGENT.md +112 -135
  12. package/agents/caption/examples/loop.md +12 -0
  13. package/agents/caption/references/evidence.md +46 -0
  14. package/agents/caption/references/flows.md +6 -2
  15. package/agents/caption/references/loop.md +57 -1
  16. package/agents/design/AGENT.md +158 -0
  17. package/agents/design/examples/one-page.md +55 -0
  18. package/agents/design/examples/overkill.md +56 -0
  19. package/agents/design/references/base-maps.md +110 -0
  20. package/agents/design/references/deliverables.md +71 -0
  21. package/agents/design/references/model-and-ports.md +73 -0
  22. package/agents/design/references/plan-and-batches.md +92 -0
  23. package/agents/design/references/scenario-cards.md +133 -0
  24. package/agents/design/references/self-check.md +73 -0
  25. package/agents/pua/AGENT.md +3 -0
  26. package/agents/review/AGENT.md +52 -52
  27. package/agents/scrub/AGENT.md +64 -67
  28. package/agents/simplify/AGENT.md +70 -101
  29. package/index.js +145 -11
  30. package/locale/en.json +2 -2
  31. package/locale/zh.json +2 -2
  32. package/package.json +5 -2
  33. package/src/caption.js +149 -0
  34. package/src/command.js +20 -6
  35. package/src/design.js +70 -0
  36. package/src/i18n.js +98 -24
  37. package/src/report.js +112 -3
@@ -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.
@@ -0,0 +1,133 @@
1
+ # Scenario cards
2
+
3
+ Source: adapted from the local skill `scenario-driven-product-design`
4
+ (`references/scenario-cards.md`), user-authored, no upstream licence; condensed and
5
+ retargeted at this plugin's output.
6
+
7
+ A card describes one scenario. It is not a proposal: no solution, no estimate, no
8
+ file names to edit. If a solution appears on the card, the problem stops being
9
+ visible.
10
+
11
+ ## Template
12
+
13
+ ```markdown
14
+ ### S07 — <one-line goal>
15
+ - Role / entry / permission:
16
+ - Trigger: <user action or system event>
17
+ - Precondition: <the concrete state: draft | active | paused | archived | offline>
18
+ - Main path: step → where it lands (screen / interface / event)
19
+ - Branches: 空 重 并 权 断 慢 大 旧 — only the ones that apply, each one line
20
+ - Failure form: what the person sees · did the ledger record it · can it recover · who cleans up
21
+ - Current state: wired | half | fake | broken | missing — file:line
22
+ - Acceptance: Given … When … Then … (within <limit>)
23
+ - Must not change: <the negative assertion>
24
+ ```
25
+
26
+ The negative assertion is not optional. "Saving a draft must not emit a run event"
27
+ catches a whole class of regressions that the positive acceptance never will,
28
+ because a positive test passes when the extra event is also emitted.
29
+
30
+ ## Two filled cards
31
+
32
+ ### S03 — resume a run after the app restarts
33
+
34
+ - Role: operator / entry: the run list / permission: read + retry
35
+ - Trigger: the app is started with an `in_progress` run in the ledger
36
+ - Precondition: `in_progress`, last heartbeat 4 hours old
37
+ - Main path: run list shows it as interrupted → "retry" resumes from the last
38
+ completed step → the ledger gets a new attempt row
39
+ - Branches: 断 (the child process is gone) · 旧 (a run from before the new field
40
+ exists) · 重 (retry clicked twice)
41
+ - Failure form: the row says "interrupted" with the reason and the last step; the
42
+ ledger has the attempt; retry is safe to press again; nobody cleans up manually
43
+ - Current state: `half` — `src/run/list.js:88` reads the state, no retry handler is
44
+ registered in the command table
45
+ - Acceptance: Given a ledger with a stale `in_progress` run, when the list is
46
+ opened, then the row reads "interrupted · step 3" within 2 s
47
+ - Must not change: opening the list must not write to the ledger
48
+
49
+ ### S11 — approve a plan from another role
50
+
51
+ - Role: approver / entry: the pending list / permission: approve only
52
+ - Trigger: a plan arrives in state `submitted`
53
+ - Precondition: `submitted`, owner is a different role
54
+ - Main path: pending list → open → approve → state `approved` → owner is notified
55
+ - Branches: 权 (the approver is the author) · 并 (two approvers at once) · 断 (the
56
+ owner was deleted)
57
+ - Failure form: refusal names the exit ("ask another approver") and does not change
58
+ state; no notification is sent on refusal
59
+ - Current state: `fake` — `docs/approval.md` describes it; no route and no command
60
+ exists
61
+ - Acceptance: Given a plan owned by role A, when role A tries to approve it, then
62
+ the call returns a refusal naming another approver, and the state stays `submitted`
63
+ - Must not change: a refused approval must not emit an approval event
64
+
65
+ ## The scenario list
66
+
67
+ The list is the index; the cards are the three that matter. Use these columns and
68
+ do not invent others, so two rounds can be diffed:
69
+
70
+ ```text
71
+ | ID | Role | Stage | Intent | One-line goal | Current state | Frequency | Harm | Evidence |
72
+ ```
73
+
74
+ - **Stage** is one of enter / create / run / intervene / close / look back.
75
+ - **Current state** is the five-state token, or `unconfirmed`. It is filled from
76
+ `/code-audit` — never from reading a README.
77
+ - **Frequency** and **Harm** are the two sort keys; give them a scale and keep it
78
+ (per day / per task, and data loss > deadlock > misleading > friction).
79
+ - **Evidence** is `file:line` or the event that proves the row is real. A row with
80
+ no evidence is a wish and does not enter the list.
81
+
82
+ Coverage gate, checked before ranking: at least one row per baseline group, three
83
+ per role, one per stage, three failure rows, and every row cites an entry point or
84
+ an event. Counts, not impressions — write the numbers under the table.
85
+
86
+ ## The eight baseline groups
87
+
88
+ Enumerate against these before brainstorming anything else. Each one asks a question
89
+ the product either answers or does not.
90
+
91
+ | Group | Question | A gap looks like |
92
+ | --- | --- | --- |
93
+ | First use | Empty state: is the first useful result within three steps? | Onboarding that explains instead of producing |
94
+ | Daily path | The most frequent route — where does each step land? | A step that lands in no screen, no interface, no event |
95
+ | Stuck | It is not moving: how does the person find out, and locate why? | A spinner, or a status nobody can explain |
96
+ | Adjustment | Requirements, people, or priority change mid-flight: how to back out and resume? | Only "start over" |
97
+ | Paused | Do "stopped by the user" and "declared dead by the system" look different? | One grey badge for both |
98
+ | Switching | Across projects or teams, is context lost? | The previous project's data still on screen |
99
+ | Collaboration | Handoff, assignment, comment, approval — did the message actually arrive? | A notification nobody receives |
100
+ | Quota and cost | At the limit: does the person see why and what next, or just a number? | A number with no path |
101
+
102
+ Plus three failure classes, at least one scenario each: permission refused, upstream
103
+ cancelled or dependency gone, crash and recovery.
104
+
105
+ ## The quality bar
106
+
107
+ A card is good enough when a stranger could implement it without asking what was
108
+ meant, and could tell whether you did. Concretely:
109
+
110
+ - **Every step lands somewhere.** "The user sees progress" is not a landing; "the
111
+ run row shows `step 3/7`" is.
112
+ - **The precondition is a state**, not a mood: name it in the product's own
113
+ vocabulary.
114
+ - **The branches are chosen, not listed.** Empty/double/concurrent/permission/
115
+ dependency/slow/large/old — write the ones that apply and delete the rest.
116
+ - **The failure form answers three questions**: what is shown, what was recorded,
117
+ who recovers.
118
+ - **The negative assertion is executable** by someone who was not in this
119
+ conversation.
120
+
121
+ ## Three questions that expose a slogan
122
+
123
+ 1. Where does this state come from?
124
+ 2. Where does this write land?
125
+ 3. Who cleans up after it fails?
126
+
127
+ If any answer is "the system handles it", the card is not finished.
128
+
129
+ ## How many cards
130
+
131
+ Full scenario list: every row of the grid. P0 cards: three. More than three P0
132
+ cards means the ranking has not been done; fewer means a scenario is probably
133
+ missing a failure branch.
@@ -0,0 +1,73 @@
1
+ # The delivery check
2
+
3
+ Source: adapted from the local skill `scenario-driven-product-design` (`SKILL.md`,
4
+ 「自检(交付前逐条打勾)」), user-authored, no upstream licence; retargeted at this
5
+ protocol's outputs.
6
+
7
+ Tick every line before you hand a design over. This is a gate, not a summary: an
8
+ unticked line is a finding about the design, so fix the design or write the gap into
9
+ the open-questions section. Do not tick a line you did not check.
10
+
11
+ ## Roles and boundaries
12
+
13
+ - [ ] Every role has an entry point, a write surface, a refusal surface, and an owner
14
+ for failure.
15
+ - [ ] At least one high-frequency need is **denied** by the permission matrix, with
16
+ its alternative entry point written down.
17
+ - [ ] The non-users are named: who this does not serve, and what it does not replace.
18
+
19
+ ## Capability and evidence
20
+
21
+ - [ ] Every row of the feature card has a state and an evidence cell; nothing says
22
+ "should already be implemented".
23
+ - [ ] The capability states come from `/code-audit` or are marked `unconfirmed`;
24
+ none was inferred from a README, a comment, or a test name.
25
+ - [ ] Every numeric claim in the documents came from a command's output, and every
26
+ claim about current behaviour carries `file:line`.
27
+
28
+ ## Scenarios
29
+
30
+ - [ ] The list covers the eight baseline groups and the three failure classes, and
31
+ the counts are written under the table.
32
+ - [ ] Every P0 card has all ten fields, including the boundary eight (empty,
33
+ duplicate, concurrent, permission, dependency, slow, large, old) that apply.
34
+ - [ ] Every P0 card has a negative assertion — what the action must not change.
35
+ - [ ] No card contains a solution. Solutions live in the batch table.
36
+
37
+ ## Structure (when the project has models, ports, or contracts)
38
+
39
+ - [ ] Every model field can answer where its value comes from; a field that cannot
40
+ was deleted or given a port.
41
+ - [ ] Every external dependency is either behind a port with a written admission
42
+ reason, or listed in the not-abstracting list.
43
+ - [ ] Every invariant has a failure code and a test that can go red. An invariant
44
+ with only wording is not an invariant.
45
+ - [ ] Event types and error codes exist in one catalogue, and every name used by the
46
+ documents or the code is in it.
47
+ - [ ] Every decision points at a D number; a changed decision opened a new row and
48
+ names what it supersedes.
49
+
50
+ ## Ranking and batches
51
+
52
+ - [ ] The documents say whether the order used frequency-first or harm-first, and
53
+ did not mix them.
54
+ - [ ] Batch 0 is a gate, and the gate names its scanner, allowlist, ratchet, and
55
+ cross-check.
56
+ - [ ] Every batch has acceptance, risk, and rollback, and the dependency order is in
57
+ the table.
58
+ - [ ] The not-doing table has at least three rows, each with a reason and a condition
59
+ to revisit.
60
+ - [ ] The progress table uses only the four states, and a "done" row has a commit.
61
+
62
+ ## Assumptions
63
+
64
+ - [ ] Every assumption that depends on the host or a third party is either verified
65
+ by a probe or marked **unconfirmed** and tied to the batch that needs it.
66
+ - [ ] The unconfirmed items are in their own section and none of them has migrated
67
+ into a conclusion.
68
+
69
+ ## What to do with a failed line
70
+
71
+ Say which line failed and what it would take to pass. A design delivered with three
72
+ unticked lines and those three named is usable; one delivered with all sixteen ticked
73
+ and two of them false is the failure this checklist exists to prevent.
@@ -64,3 +64,6 @@ earns you two postmortems.
64
64
  | `references/flavors.md` | the session names a corporate flavor, or you need the rhetoric for one |
65
65
  | `references/methodology.md` | you are at L3 and owe the 7-point checklist |
66
66
  | `examples/run.md` | you want the shape of a stuck turn that recovers, and one that does not |
67
+
68
+ If a reference path is unreadable, continue from this file — the core instructions are
69
+ self-sufficient.