@morning-start/dsh-code-toolkit 0.29.0 → 0.30.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.
@@ -2,8 +2,7 @@
2
2
 
3
3
  ## What counts as evidence
4
4
 
5
- Evidence is something another person could re-run and get the same answer. In
6
- order of strength:
5
+ Evidence is something another person could re-run and get the same answer. In order of strength:
7
6
 
8
7
  1. A command and its exit status (`node --test` → `pass 12 / fail 0`, exit 0).
9
8
  2. A command and its output, quoted exactly, including the failing line.
@@ -11,41 +10,35 @@ order of strength:
11
10
  4. A screenshot or rendered value, when the claim is visual.
12
11
  5. Nothing. "I checked" is not a level of evidence.
13
12
 
14
- Record the command, not the interpretation. `npm test` with no output is not
15
- evidence that it passed; a truncated output is not evidence either.
13
+ Record the command, not the interpretation. `npm test` with no output does not prove it passed; a
14
+ truncated output proves nothing.
16
15
 
17
16
  ## Choosing the gate
18
17
 
19
- The gate is the command that would fail if the claim were false. Ask: "if I were
20
- wrong, what would go red?" If the answer is "nothing", the gate is decorative.
18
+ The gate is the command that would fail if the claim were false. Ask "if I were wrong, what would
19
+ go red?" — if the answer is "nothing", the gate is decorative.
21
20
 
22
21
  - Behavior change → the test that exercises it.
23
- - Guard or check added → the check itself, plus the proof below.
24
- - Refactor with no behavior change → the full suite that covered it before.
25
- - Documentation or contract → the checker that reads the document (link check,
26
- schema check, generated contract).
22
+ - Guard added → the check itself, plus the proof below.
23
+ - Refactor with no behavior change → the suite that covered it before.
24
+ - Documentation or contract → the checker that reads the document.
27
25
  - Environment or wiring → the command that boots the thing and prints its state.
28
26
 
29
- Prefer a gate with a real exit status. A gate whose output is piped into a
30
- pager or a formatter can lose the exit code; run it bare, or check the status
31
- explicitly.
27
+ Prefer a real exit status: a gate piped into a pager or a formatter can lose it. Run it bare, or
28
+ check the status explicitly.
32
29
 
33
30
  ## Proving a guard
34
31
 
35
- A new guard is a claim about the future: "this cannot regress unnoticed". Prove
36
- it the way you prove any claim:
32
+ A new guard is a claim about the future. Prove it the way you prove any claim:
37
33
 
38
34
  1. Break exactly what the guard protects.
39
- 2. Run the guard. It must fail, and the failure must point at the broken thing.
40
- 3. Restore. Run again. It must pass.
35
+ 2. Run it. It must fail, and the failure must point at the broken thing.
36
+ 3. Restore, run again: it must pass.
41
37
 
42
- If step 2 is green, the guard tests nothing — often because it matches a literal
43
- that the code path never produces, or because the branch it checks is
44
- unreachable.
45
-
46
- Restoring is part of the proof, so make it reversible: record the exact line
47
- before editing, or keep the edit as a single anchored replacement. A proof that
48
- leaves the repository broken is worse than no proof.
38
+ A green step 2 means the guard tests nothing — often it matches a literal the code never produces,
39
+ or the branch it checks is unreachable. Make restoring part of the proof: record the exact line
40
+ before editing, or keep the edit as one anchored replacement. A proof that leaves the repository
41
+ broken is worse than none.
49
42
 
50
43
  ## Recording a dead end
51
44
 
@@ -57,23 +50,22 @@ leaves the repository broken is worse than no proof.
57
50
  - Next: write the probe as a file instead of a one-liner
58
51
  ```
59
52
 
60
- The command and the output are what make it useful. "Didn't work" costs the next
61
- iteration the same discovery again.
53
+ The command and the output are what make it useful. "Didn't work" costs the next iteration the same
54
+ discovery.
62
55
 
63
56
  ## Reach the real entry point
64
57
 
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:
58
+ A gate proves the thing you named, not the feature a person starts. When the change touches an
59
+ entry point — a command, a route, a screen, a scheduled job — one iteration goes through it the way
60
+ a person does:
68
61
 
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.
62
+ - **the real entry point**, not the module a test imports: type the command, open the screen, call
63
+ the route;
64
+ - **real data**, not only the fixture: a document with history, an input with awkward characters;
65
+ - **look at the result**: what printed, what the state is now, whether the effect survived the
66
+ process. A screenshot is fine; it does not replace the state.
75
67
 
76
- Record it like any other evidence — what you did, what you expected, what happened:
68
+ Record it like any evidence:
77
69
 
78
70
  ```markdown
79
71
  - Command: `node src/app.js export 3`
@@ -82,47 +74,39 @@ Record it like any other evidence — what you did, what you expected, what happ
82
74
  - State: export → fake; the renderer test passes but nothing reaches it
83
75
  ```
84
76
 
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.
77
+ If the environment cannot run the entry point — no browser, server or device — that goes in the
78
+ unverified list, and "the tests pass" is then the whole claim.
88
79
 
89
80
  ## Assumptions about the host
90
81
 
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.
82
+ Anything you believe about the host, the platform or a third party is a claim. One probe usually
83
+ settles several.
93
84
 
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.
85
+ - **Read the installed code first.** The version in `node_modules` or inside the running application
86
+ beats the documentation, which beats your memory.
87
+ - **Probe when reading is not enough.** The smallest script that prints the fact: does the API
88
+ accept this shape, does the event fire with these fields, does the path resolve here. Keep the
89
+ probe file — a second question usually arrives.
90
+ - **Record the answer with the question**, e.g. `steer()` rejects a partial message →
91
+ `Error: message.id is required`. That line stops the next iteration from re-deriving it.
92
+ - **Until it runs, it is unverified.** Put it in the unverified list with the batch that depends on
93
+ it, rather than building three steps on a guess.
105
94
 
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.
95
+ A plan resting on an unrun assumption is fine; reporting it as settled is not.
108
96
 
109
97
  ## Two recurring self-inflicted failures
110
98
 
111
- - **Loose anchors.** Replacing by a short string that appears twice deletes the
112
- wrong block, or deletes half of one. Confirm the anchor is unique (and that it
113
- is inside the function you meant) before replacing; read the region after.
114
- - **Inline quoting.** Long `node -e` / shell one-liners lose quotes, backticks,
115
- and newlines in ways that look like logic errors. Write a small script file
116
- instead; it is faster than the third attempt at escaping.
99
+ - **Loose anchors.** Replacing by a string that appears twice deletes the wrong block, or half of
100
+ one. Confirm the anchor is unique and inside the function you meant; read the region afterwards.
101
+ - **Inline quoting.** Long `node -e` or shell one-liners lose quotes, backticks and newlines in ways
102
+ that look like logic errors. Write a script file; it is faster than the third escaping attempt.
117
103
 
118
104
  ## The unverified list
119
105
 
120
- Keep it short, specific, and visible in the final report. Each item says what was
121
- not checked and why it could not be:
106
+ Short, specific, visible in the final report — each item says what was not checked and why:
122
107
 
123
108
  - "Dark theme not checked — no dark renderer in this environment."
124
109
  - "Migration path not run — requires a database this workspace does not have."
125
110
  - "Real-device layout not checked — only the headless viewport was rendered."
126
111
 
127
- An item on this list is honest. An item missing from it is a claim the user will
128
- believe.
112
+ An item on this list is honest. An item missing from it is a claim the user will believe.
@@ -1,51 +1,46 @@
1
1
  # Writing an expert
2
2
 
3
- An expert is a paragraph in a brief, not a file. It has one job: make a child
4
- agent that cannot see this conversation behave like a specialist instead of a
5
- generalist who happened to be handed a task.
3
+ An expert is a paragraph in a brief, not a file. Its job: make a child that cannot see this
4
+ conversation behave like a specialist instead of a generalist who happened to be handed a task.
6
5
 
7
- The failure mode is always the same. A vague brief gets a vague answer, the
8
- parent reads it as "nothing found", and the slice is quietly unverified. The
9
- expert paragraph is what prevents that.
6
+ **Why not the host's equivalent.** DSH does compose agents — the agent preset — but a preset is
7
+ user-level configuration chosen before a session starts, not something a running loop can create
8
+ for one slice. A paragraph goes in that child's brief, applies to that child only, and dies with
9
+ it. Do not write a persona file for an expert; nothing would load it.
10
+
11
+ The failure mode is always the same: a vague brief gets a vague answer, the parent reads it as
12
+ "nothing found", and the slice is quietly unverified.
10
13
 
11
14
  ## The five parts
12
15
 
13
- Every expert description has these, in this order. Omit one and the child fills
14
- the gap with its own defaults.
15
-
16
- 1. **Identity and bar.** Who it is and what standard it holds. Not "you are a
17
- senior engineer" — that is a costume. "You audit migrations for irreversible
18
- operations; a migration that cannot be rolled back is a defect, not a
19
- preference" is a bar.
20
- 2. **What it looks at.** The exact inputs: which paths, which files, which
21
- commands. A specialist is defined by its inputs more than by its adjectives.
22
- 3. **What counts as a finding.** The criteria, with the threshold spelled out.
23
- "Flag any `ALTER` that drops a column or narrows a type" beats "look for
24
- risky migrations".
25
- 4. **What is not a finding.** The exclusion list. This is the part people skip,
26
- and it is the part that decides whether the report is usable. Name the
27
- tempting false positives explicitly.
28
- 5. **Output shape.** One line per finding, or a table, or a verdict plus
29
- evidence. Fixed shape, so the parent can merge N experts without reading N
30
- essays.
16
+ In this order. Omit one and the child fills the gap with its own defaults.
17
+
18
+ 1. **Identity and bar.** Who it is and what standard it holds. Not "you are a senior engineer" —
19
+ that is a costume. "You audit migrations for irreversible operations; a migration that cannot
20
+ be rolled back is a defect, not a preference" is a bar.
21
+ 2. **What it looks at.** The exact inputs: paths, files, commands. A specialist is defined by its
22
+ inputs more than by its adjectives.
23
+ 3. **What counts as a finding.** The criteria with the threshold spelled out. "Flag any `ALTER`
24
+ that drops a column or narrows a type" beats "look for risky migrations".
25
+ 4. **What is not a finding.** The exclusion list. People skip it, and it decides whether the report
26
+ is usable — name the tempting false positives explicitly.
27
+ 5. **Output shape.** One line per finding, or a table, or a verdict plus evidence. Fixed, so the
28
+ parent can merge N experts without reading N essays.
31
29
 
32
30
  ## Rules that make an expert usable
33
31
 
34
- - **One question.** An expert that is asked two things answers the easier one.
35
- If the slice needs two questions, that is two experts.
36
- - **Give it the evidence path, not the answer.** "Check whether `resolve()` can
37
- return null by reading its callers" produces work. "Is there a null bug?"
38
- produces a guess.
39
- - **State the bar, not the vibe.** "Be thorough" and "be careful" are not
40
- instructions a model can follow; a threshold is.
41
- - **Name the false positives.** The expert should know what a plausible-looking
42
- non-finding looks like in this codebase, or it will report them.
43
- - **Make the output copy-pasteable.** The parent merges by reading; a shape that
44
- cannot be merged is a shape that will be summarized badly.
45
- - **No delegation.** The expert reports; it does not spawn. Depth is the
46
- parent's decision, not the child's.
47
- - **Read-only unless stated.** An expert that writes needs an explicit path
48
- list; without one it reports.
32
+ - **One question.** An expert asked two things answers the easier one; two questions are two
33
+ experts. Keep the question small enough that its answer fits on a screen.
34
+ - **Give it the evidence path, not the answer.** "Check whether `resolve()` can return null by
35
+ reading its callers" produces work; "is there a null bug?" produces a guess.
36
+ - **State the bar, not the vibe.** "Be thorough" is not an instruction a model can follow; a
37
+ threshold is.
38
+ - **Make the output copy-pasteable.** The parent merges by reading; a shape that cannot be merged
39
+ will be summarized badly.
40
+ - **No delegation.** The expert reports; it does not spawn. Depth is the parent's decision.
41
+ - **Read-only unless stated.** An expert that writes needs an explicit path list; without one it
42
+ reports. Shared files stay with the parent.
43
+ - **Two to four in parallel** is the useful range — past that the briefs cost more than the work.
49
44
 
50
45
  ## A worked example
51
46
 
@@ -74,31 +69,20 @@ rolled back>`. If nothing qualifies, output `no findings` and the commands you
74
69
  ran. Do not edit anything.
75
70
  ```
76
71
 
77
- The difference is not length. The weak version leaves the child to invent the
78
- bar, the inputs, the threshold and the shape; the strong one leaves it only the
79
- work.
72
+ The difference is not length. The weak version leaves the child to invent the bar, the inputs, the
73
+ threshold and the shape; the strong one leaves it only the work.
80
74
 
81
75
  ## When to create one mid-run
82
76
 
83
- An expert is worth creating the moment a step needs knowledge the loop does not
84
- have. The signals:
85
-
86
- - **An unfamiliar subsystem.** You can read it, but reading it well would take
87
- longer than briefing someone who only reads it.
88
- - **A domain rule you cannot verify from the code.** A wire format, a schema, a
89
- regulation, a third-party contract. The expert's job is to state the rule and
90
- where it comes from, not to guess.
91
- - **Width.** Five modules need the same question answered; one expert per module
92
- finishes in the time one expert takes to do all five.
93
- - **A second pair of eyes on a risky change** — but only for the change, not as
94
- a vote on your reasoning.
77
+ The moment a step needs knowledge the loop does not have. The signals: an unfamiliar subsystem
78
+ where reading it well takes longer than briefing someone who only reads it; a domain rule you
79
+ cannot verify from the code (a wire format, a schema, a regulation) — the expert states the rule
80
+ and where it came from, it does not guess; width, where five modules need the same question; a
81
+ second pair of eyes on a risky change, for the change only, not as a vote on your reasoning.
95
82
 
96
- The signals that it is **not** worth it:
97
-
98
- - The next step is one file you have already read.
99
- - You would spend more time writing the brief than doing the work.
100
- - You are using the expert to avoid deciding something you already know.
101
- - The slice has no boundary you can state in paths.
83
+ Not worth it when: the next step is one file you already read; the brief would cost more than the
84
+ work; you are using the expert to avoid deciding something you already know; the slice has no
85
+ boundary you can state in paths.
102
86
 
103
87
  ## The lifecycle of an expert
104
88
 
@@ -107,35 +91,24 @@ brief (in the ledger) → dispatch → work in parallel → merge against the br
107
91
  → run the whole gate → record the entry
108
92
  ```
109
93
 
110
- Each arrow is a place where the run can fail quietly:
94
+ Each arrow is a place where the run fails quietly:
111
95
 
112
96
  | Stage | The quiet failure | The check that catches it |
113
97
  |---|---|---|
114
98
  | brief | vague bar, no exclusion list | can you name what it must *not* report? |
115
- | dispatch | two experts on one path | every path in the brief is disjoint from every other |
99
+ | dispatch | two experts on one path | every path is disjoint from every other |
116
100
  | work | the expert edits outside its scope | `git status` before you trust the result |
117
- | merge | you accept a claim without its evidence | every finding cites a file:line and a command |
101
+ | merge | a claim accepted without its evidence | every finding cites a file:line and a command |
118
102
  | gate | per-expert green, merged red | you run the whole gate yourself |
119
- | record | the same bad brief reused | the ledger entry names the expert and the outcome |
120
-
121
- ## Sizing
122
-
123
- - **One expert per question**, and a question small enough that its answer fits
124
- in a screen. If the answer would need a section, split it.
125
- - **Two to four experts in parallel** is the useful range. Past that the briefs
126
- cost more than the work, and the merge becomes the bottleneck.
127
- - **The parent keeps the shared files.** Experts read them; the parent writes
128
- them. An expert that needs a shared file edited reports the need.
103
+ | record | the same bad brief reused | the entry names the expert and the outcome |
129
104
 
130
105
  ## What the ledger records
131
106
 
132
- One line per dispatch, with the expert's name so the next iteration can tell
133
- which expert was wrong:
107
+ One line per dispatch, naming the expert so the next iteration can tell which one was wrong:
134
108
 
135
109
  ```markdown
136
110
  - Dispatch: migration-auditor (analysis, migrations/**, read-only) → 3 findings, merged 2
137
111
  ```
138
112
 
139
- If an expert's findings keep getting rejected at merge, the expert paragraph is
140
- wrong, not the child. Fix the bar or the exclusion list, and say which in the
141
- next entry.
113
+ If an expert's findings keep getting rejected at merge, the paragraph is wrong, not the child. Fix
114
+ the bar or the exclusion list, and say which in the next entry.
@@ -1,17 +1,17 @@
1
1
  # The two flows
2
2
 
3
- Most work in a repository is one of two shapes: **change code** or **change
4
- documentation**. They share the same spine — ask, investigate, propose, get
5
- approval, execute, summarize — and differ in what "done" means. Code is done when
6
- a gate proves it and a person confirms it. Documentation is done when the summary
7
- says what changed and why.
3
+ Most repository work is one of two shapes: **change code** or **change documentation**. Both share
4
+ the spine — ask, investigate, propose, get approval, execute, summarize — and differ in what "done"
5
+ means. Code is done when a gate proves it and a person confirms; documentation is done when the
6
+ summary says what changed and why.
8
7
 
9
8
  Two rules apply to both:
10
9
 
11
- - **The approval gate is real.** Do not start executing before the person has
12
- approved the plan. A plan that was never read is not an approval.
13
- - **Investigate before proposing.** A proposal that could have been written
14
- without opening the repository is a guess with formatting.
10
+ - **The approval gate is real.** Do not execute before the person approved the plan. A plan that
11
+ was never read is not an approval. Ask with `ask_user_question`, three options — approve, amend,
12
+ reject — so the answer is a decision and not a paragraph.
13
+ - **Investigate before proposing.** A proposal that could have been written without opening the
14
+ repository is a guess with formatting.
15
15
 
16
16
  ## Flow A — changing code
17
17
 
@@ -22,36 +22,34 @@ requirement → investigate → propose → human approves → execute (refining
22
22
 
23
23
  | Step | What you produce | What ends it |
24
24
  |---|---|---|
25
- | **1. Requirement** | The need in one sentence, plus what "done" would look like | You can say it back without adding anything |
25
+ | **1. Requirement** | The need in one sentence, plus what "done" looks 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** | 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
-
33
- After the approval, two steps come before execution: set the **goal** (stage 2 — only when
34
- the person asked for the work to finish without them), then turn the approved proposal into
35
- the **plan block** (stage 3), each item with its check. Execution takes one item at a time.
36
- | **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 |
37
- | **5. Test** | The gate command and its output; a guard proven red then green | The evidence is in the ledger, not in your memory |
27
+ | **3. Propose** | The plan block — ordered outcomes, each with its gate — plus files, risks, what you will not do | The person approves, amends, or rejects |
28
+ | **4. Execute** | One plan item per iteration; tick it with its entry number, edit the plan when evidence contradicts it | The plan has no open items and the gate is green |
29
+ | **5. Test** | The gate command and its output; a guard proven red then green | The evidence is in the ledger, not your memory |
38
30
  | **6. Human confirms** | The report: what changed, what was verified, what was not | The person says it is right |
39
31
  | **7. Update the docs** | README / DETAIL / CHANGELOG / AGENTS, whichever the change made stale | The docs describe the code as it now is |
40
32
 
33
+ A rejection sends you back to **2. Investigate** with the objection in hand — not to a redraft of the
34
+ same plan. A second rejection means the requirement is wrong: say so and ask (see
35
+ `references/loop.md`).
36
+
37
+ Between the approval and execution: set the **goal** (stage 2, only when the person asked for the
38
+ work to finish without them), then turn the approved proposal into the **plan block** (stage 3) with
39
+ a check on every line.
40
+
41
41
  Rules that keep this flow honest:
42
42
 
43
- - **Investigation is read-only.** Do not edit while investigating; a plan written
44
- after half the edits is a rationalization.
45
- - **The proposal names the gate.** If you cannot name the command that will prove
46
- the change, you are not ready to propose.
47
- - **Refine in the open.** When step 4 contradicts the plan, say so in the ledger
48
- and adjust the plan — do not silently do something else.
49
- - **Testing is not "it looks right".** A command and its exit status, or it did
50
- not happen.
51
- - **Docs come last, and they are part of done.** A change whose README still
52
- describes the old behavior is not finished; it is a trap for the next person.
53
- - **Stop at the confirmation gate.** Do not push, publish or rewrite history
54
- before the person confirms.
43
+ - **Investigation is read-only.** A plan written after half the edits is a rationalization.
44
+ - **The proposal names the gate.** If you cannot name the command that proves the change, you are
45
+ not ready to propose.
46
+ - **Refine in the open.** When step 4 contradicts the plan, say so in the ledger and adjust — never
47
+ silently do something else.
48
+ - **Testing is not "it looks right".** A command and its exit status, or it did not happen.
49
+ - **Docs come last and are part of done.** A change whose README still describes the old behavior is
50
+ a trap for the next person.
51
+ - **Stop at the confirmation gate.** Do not push, publish or rewrite history before the person
52
+ confirms.
55
53
 
56
54
  ## Flow B — changing documentation
57
55
 
@@ -65,41 +63,37 @@ requirement → investigate → propose → human approves → execute (refining
65
63
  | **1. Requirement** | Which document, for whom, and what is wrong with it now | You can name the reader whose behavior should change |
66
64
  | **2. Investigate** | The current text, the code it describes, and where the two disagree | You can list the claims that are stale or missing |
67
65
  | **3. Propose** | The outline: sections to add, rewrite, delete; what stays | The person approves the outline |
68
- | **4. Execute** | Write section by section; check each claim against the code as you go | Every claim is either verified or marked as unverified |
69
- | **5. Summary** | What changed, section by section, and what you could not verify | The person can see the diff's intent without reading the diff |
66
+ | **4. Execute** | Write section by section, checking each claim against the code | Every claim is verified or marked unverified |
67
+ | **5. Summary** | What changed, section by section, and what you could not verify | The person sees the diff's intent without reading the diff |
70
68
 
71
69
  Rules that keep this flow honest:
72
70
 
73
- - **Documentation is a claim about code.** Every factual sentence should be
74
- checkable against a file or a command. If you cannot check it, mark it.
75
- - **Investigate the code, not only the doc.** The most common defect in a doc
76
- change is a confident sentence about behavior that changed last week.
77
- - **Propose an outline, not a rewrite.** "I will rewrite the README" is not a
78
- proposal; "I will replace sections 3 and 5 and delete 7" is.
79
- - **Delete before you add.** A doc that grows every time it is edited becomes
80
- unreadable. If a section is wrong, removing it is a valid change.
81
- - **The summary is not a changelog of your keystrokes.** It says what a reader
82
- will now find that they did not find before.
71
+ - **Documentation is a claim about code.** Every factual sentence is checkable against a file or a
72
+ command; if you cannot check it, mark it.
73
+ - **Investigate the code, not only the doc.** The commonest defect is a confident sentence about
74
+ behavior that changed last week.
75
+ - **Propose an outline, not a rewrite.** "I will rewrite the README" is not a proposal; "I will
76
+ replace 3 and 5 and delete 7" is.
77
+ - **Delete before you add.** A doc that grows every time it is edited becomes unreadable; removing a
78
+ wrong section is a valid change.
79
+ - **The summary is not a keystroke log.** It says what a reader now finds that they did not before.
83
80
 
84
81
  ## Choosing the flow
85
82
 
86
- - The change alters behavior → **Flow A**, even if it also touches docs.
87
- - The change alters only what people read → **Flow B**.
88
- - Both → run **A**, and treat the doc update as its last step. Do not run two
89
- flows over the same subject; the second one will contradict the first.
83
+ - Alters behavior → **Flow A**, even if it also touches docs.
84
+ - Alters only what people read → **Flow B**.
85
+ - Both → run **A** and treat the doc update as its last step. Never run two flows over one subject;
86
+ the second contradicts the first.
90
87
 
91
88
  ## Where the loop fits
92
89
 
93
- This protocol is the loop from `AGENT.md`. Steps 1–3 are iterations too: reading
94
- the code, finding the gate, and writing the plan each end with a ledger entry.
95
- The approval gate is the one place the loop stops and waits for a person — the
96
- only other stops are a real fork in the task (scope change, irreversible action,
97
- unauthorized cost).
90
+ This is the loop from `AGENT.md`. Steps 1–3 are iterations too — reading the code, finding the gate
91
+ and writing the plan each end with an entry. The approval gate is the one place the loop stops for a
92
+ person; the only other stops are a real fork (scope change, irreversible action, unauthorized cost).
98
93
 
99
- Record the flow in the ledger head, so a later reader knows which contract this
100
- run was under:
94
+ Record the flow in the ledger head, so a later reader knows which contract this run was under:
101
95
 
102
96
  ```markdown
103
97
  - Flow: A (code) | B (docs)
104
98
  - Approved: <what the person approved, and when>
105
- ```
99
+ ```