@morning-start/dsh-code-toolkit 0.28.0 → 0.28.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +49 -0
- package/README.md +40 -1
- package/agents/audit/AGENT.md +77 -111
- package/agents/caption/AGENT.md +110 -145
- package/agents/caption/examples/loop.md +12 -0
- package/agents/caption/references/flows.md +6 -2
- package/agents/caption/references/loop.md +57 -1
- package/agents/design/AGENT.md +85 -141
- package/agents/review/AGENT.md +51 -67
- package/agents/scrub/AGENT.md +64 -71
- package/agents/simplify/AGENT.md +70 -101
- package/index.js +88 -10
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +2 -2
- package/src/caption.js +149 -0
- package/src/command.js +6 -2
- package/src/i18n.js +60 -32
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,54 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.28.1 — 2026-11-29
|
|
4
|
+
|
|
5
|
+
- **Menu labels and hints were cut to a scan length.** Every `description` had grown
|
|
6
|
+
into an explanation of its flags ("…; add sub for a subagent, report for a plan
|
|
7
|
+
only"), so the `/` menu read like documentation. Descriptions now say what the
|
|
8
|
+
command does; hints list the flags without explaining them where the README already
|
|
9
|
+
does. A test caps both (zh 18/56, en 60/90 characters), so they cannot creep back.
|
|
10
|
+
The plugin-panel description and `market.json` were shortened the same way.
|
|
11
|
+
- **Every persona was cut to its kernel.** `AGENT.md` now carries the role, the judging
|
|
12
|
+
gates, the output contract and the reference table; the justifications, lookup tables,
|
|
13
|
+
worked walkthroughs and output templates moved into the references each role already
|
|
14
|
+
had. Total 57 016 → 43 083 characters (−24%): caption −36%, audit −26%, review −25%,
|
|
15
|
+
simplify −24%, design −21%, scrub −21%. A test now caps every persona at 9 000
|
|
16
|
+
characters — the host's limit is 12 000, but the budget is a cost paid on every run of
|
|
17
|
+
that role, not headroom to fill.
|
|
18
|
+
- **`/code-caption` now runs a plan it owns, not a task it was handed.** The person
|
|
19
|
+
supplies an intent; the protocol derives the goal, the acceptance criteria and an
|
|
20
|
+
ordered plan, writes all three into the ledger head, and gets them approved before
|
|
21
|
+
executing. The plan is a block of outcomes — each one provable, each with its check
|
|
22
|
+
on the same line — with `[ ]` open, `[x]` done, `[~]` blocked, `[-]` dropped. Every
|
|
23
|
+
iteration takes the first unblocked item; when the evidence contradicts the plan, the
|
|
24
|
+
plan is edited in place and the edit names the entry that caused it. The run ends
|
|
25
|
+
when the plan has no open items **and** every criterion holds, not when the first
|
|
26
|
+
plan is exhausted. This is the loop-plus-todo-list shape the command was supposed to
|
|
27
|
+
have; what it had was an append-only log with a fixed contract at the top.
|
|
28
|
+
- **A caption ledger is addressable now.** `list` names every ledger in the project
|
|
29
|
+
(name, title, steps, closed), and `resume <number|name>` continues one with its
|
|
30
|
+
absolute path written into the injected text. A project with five ledgers no longer
|
|
31
|
+
depends on the phrase "continue the current task"; ambiguity is reported with the
|
|
32
|
+
candidates instead of guessed, and `resume` accepts a full slug, the list position,
|
|
33
|
+
or a unique fragment of the slug or title.
|
|
34
|
+
- **`/code-status` stopped printing `undefined`.** An injected protocol (caption,
|
|
35
|
+
pua) leaves a journal record with no scope and no mode, and status printed those
|
|
36
|
+
fields raw: `最近一次:undefined · undefined`. It now names the installed protocol
|
|
37
|
+
and, for caption, the most recent ledger's progress. Found by probing the commands
|
|
38
|
+
with a stub host, not by reading them.
|
|
39
|
+
- **Ledger parsing is tolerant on purpose.** It reads `# title`,
|
|
40
|
+
`- Task/Criteria/Gate/Flow`, `## N. title` and `- Outcome:`; a BOM-prefixed file or
|
|
41
|
+
an unfamiliar shape degrades to the file name instead of disappearing. Head fields
|
|
42
|
+
are first-wins, because a closing entry repeats `- Gate:` with that run's result.
|
|
43
|
+
- **Two governance rules for the loop**: a rejected plan sends you back to
|
|
44
|
+
investigation, and a second rejection means the requirement is wrong; two iterations
|
|
45
|
+
that produce no new fact mean stop and hand back what is blocked. Both are persona
|
|
46
|
+
text — **not measured** (see `evals/results/iteration-8.md`).
|
|
47
|
+
- `validate` / `early` on a command spec now receive the same context as
|
|
48
|
+
`buildText`, so a decision made before injection is the one the injected text acts
|
|
49
|
+
on. `src/caption.js` holds the ledger reader, with no new dependency.
|
|
50
|
+
- 125 → 130 deterministic checks.
|
|
51
|
+
|
|
3
52
|
## 0.28.0 — 2026-11-29
|
|
4
53
|
|
|
5
54
|
- **New `/code-audit`: is the capability wired, or does it only look wired?**
|
package/README.md
CHANGED
|
@@ -151,10 +151,49 @@ agents/pua/
|
|
|
151
151
|
|
|
152
152
|
`/code-caption <任务>` 是这套东西里唯一不 spawn 的命令,因为它的对象不是一次检查,而是**一次长任务的进行方式**。
|
|
153
153
|
|
|
154
|
-
它注入的不是一张清单,而是一个循环:读台账 →
|
|
154
|
+
它注入的不是一张清单,而是一个循环:读台账 → 取计划里下一项 → 看真实状态 → 动手(锚点唯一、改完读回)→ 跑门禁 → 给新守卫做反证 → 记一条 caption 并提交 → 改计划。循环的产物是 `docs/caption/<slug>.md`:头部写目标、判据、门禁和**计划清单**,清单在头部原地改;每条写看到什么、判断什么、做了什么、命令与结果、结论(done / dead end / unverified)。
|
|
155
155
|
|
|
156
156
|
三条规则是它的全部价值:**没有证据就不许声称**、**死路要留痕**、**判据满足才收口,清单空了不算**。另外两条补在同一节:**门禁绿不等于功能在**(碰了入口的改动,必须有一次走到真实入口、真数据、看结果);**关于宿主和第三方的判断先写探针**,「文档说支持」不算证据,探针没跑就进未验证清单。细节在 `agents/caption/references/`,一次健康的运行与一次"忙碌但什么都没证明"的运行在 `examples/` 里对照。
|
|
157
157
|
|
|
158
|
+
### 意图进,清单出
|
|
159
|
+
|
|
160
|
+
caption 不是「你给任务,它照着做」。你给的是一句**意图**,它要自己推出三样东西写进台账头部:
|
|
161
|
+
|
|
162
|
+
- **目标**:一句话能复述给你;
|
|
163
|
+
- **判据**:别人怎么判断做完了——命令、可观察状态,或者一句必须出现的话;
|
|
164
|
+
- **计划**:**按结果切,不按动作切**。每项是一个能被单独证明的结果,并在同一行写清证明它的检查。修 bug 的顺序通常是:复现 → 用守卫钉住现有契约 → 改代码 → 证明守卫会红。
|
|
165
|
+
|
|
166
|
+
三样一起给你批,批了才动手。
|
|
167
|
+
|
|
168
|
+
计划是**活的状态**,不是一次性清单:
|
|
169
|
+
|
|
170
|
+
```markdown
|
|
171
|
+
## Plan
|
|
172
|
+
- [x] 1. 复现失败 — gate: `node --test` 点名 `sum([])`(见条目 1)
|
|
173
|
+
- [x] 2. 钉住现有契约 — gate: 新加的强制转换测试在今天的代码上通过(见条目 2)
|
|
174
|
+
- [ ] 3. 修空输入 — gate: `sum([])` 为 0,其余仍然通过
|
|
175
|
+
- [~] 4. 换成真正的导出库 — blocked: 还没人选库
|
|
176
|
+
- [-] 5. 批量导出 — dropped: 0.9 不做
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
`[ ]` 未做、`[x]` 完成、`[~]` 受阻、`[-]` 放弃。**原地改**,绝不追加第二份计划——计划是当前状态,条目是历史。勾掉时把条目号写在旁边,后来的人不用翻。没有 gate 的那一行不是计划项,是备注。
|
|
180
|
+
|
|
181
|
+
改计划是常态而不是失败:调查出结果后加、拆、删、重排都行,但每次都要写清是哪一条、为什么。一条**永远没被改过**的计划,说明调查没发现任何东西。
|
|
182
|
+
|
|
183
|
+
### 台账是入口
|
|
184
|
+
|
|
185
|
+
一个项目攒几份台账之后,「继续当前任务」就指不清了。所以:
|
|
186
|
+
|
|
187
|
+
```text
|
|
188
|
+
/code-caption list 列出台账:名字、标题、走了几步、收口没有
|
|
189
|
+
/code-caption resume <序号|名字> 接续某一份,注入的文本里直接带绝对路径
|
|
190
|
+
/code-status 说清装的是哪条协议,并附上最近一份台账的进度
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
`resume` 认完整 slug、认列表里的序号、也认 slug 或标题里不重复的片段;**匹配到多份就报歧义,不猜**。台账解析是容错的——只认 `# 标题`、`- Task/Criteria/Gate/Flow`、`## N. 标题` 和 `- Outcome:`,认不出的文件退化成文件名,旧台账不用重写。
|
|
194
|
+
|
|
195
|
+
配套的两条治理规矩:**方案被否不是重写方案**(回到调查,第二次被否说明需求错了,停下来问);**两轮没有新事实就停**(写了卡在哪、要谁定什么,比再试一次值钱)。
|
|
196
|
+
|
|
158
197
|
### 两条常用流程
|
|
159
198
|
|
|
160
199
|
`/code-caption` 的第一步是判断这是改代码还是改文档,写进台账头部:
|
package/agents/audit/AGENT.md
CHANGED
|
@@ -1,119 +1,90 @@
|
|
|
1
1
|
# Capability audit
|
|
2
2
|
|
|
3
|
-
You are auditing an existing product, not a change. The question is not "is this
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
You are auditing an existing product, not a change. The question is not "is this code
|
|
4
|
+
wrong" but **"does this capability actually exist at runtime, or does it only look like
|
|
5
|
+
it does"**. The expensive failure this catches: the README, the changes log, and a test
|
|
6
|
+
all say a feature is done, and the person who clicks it gets nothing.
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
clicks it gets nothing. A bug in code that runs is visible. A capability that was
|
|
10
|
-
never wired is invisible until someone tries to use it — and by then it has been
|
|
11
|
-
counted as finished in three places.
|
|
12
|
-
|
|
13
|
-
Your unit of output is **a capability with a state and the evidence for it**, not
|
|
14
|
-
a finding with a patch. Anything you could improve but that does run is somebody
|
|
15
|
-
else's job: `/code-review` reads a change, you read the whole tree and ask whether
|
|
16
|
-
the chain is closed.
|
|
8
|
+
A row is a capability with a state and the evidence for it, not a patch. Something that
|
|
9
|
+
runs but could be better is `/code-review`'s job.
|
|
17
10
|
|
|
18
11
|
## The five states
|
|
19
12
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
language. The token is what a reader scans, sorts, and diffs between audits.
|
|
13
|
+
One state per capability. The token is the machine-readable half of the contract: use
|
|
14
|
+
it verbatim even when the prose is in another language.
|
|
23
15
|
|
|
24
|
-
| State | Test
|
|
16
|
+
| State | Test | Handling |
|
|
25
17
|
| --- | --- | --- |
|
|
26
|
-
| `wired` | A production entry
|
|
27
|
-
| `half` | The backend or tool exists; the entry point is missing,
|
|
28
|
-
| `fake` | Docs, comments, or tests claim it; production code calls nothing
|
|
29
|
-
| `broken` | An entry point exists but the path
|
|
30
|
-
| `missing` | Genuinely absent
|
|
31
|
-
|
|
32
|
-
`fake` is the state this command exists for
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
capability is claimed and the chain is absent, the state is `fake` regardless of
|
|
36
|
-
how finished the code looks.
|
|
18
|
+
| `wired` | A production entry reaches a handler, that reaches its interface, that reaches storage — and you saw it close, or a test exercises it end to end. | Not a finding. |
|
|
19
|
+
| `half` | The backend or tool exists; the entry point is missing, a stub, or behind a menu nobody can reach. | Wire it. |
|
|
20
|
+
| `fake` | Docs, comments, or tests claim it; **production code calls nothing.** | Report the false claim. |
|
|
21
|
+
| `broken` | An entry point exists but the path dies at runtime: early return, dropped argument, stale state, unreleased lock. | Say where the flow dies. |
|
|
22
|
+
| `missing` | Genuinely absent, nothing claims it. | Not a defect; design's material. |
|
|
23
|
+
|
|
24
|
+
`fake` is the state this command exists for, and the one you will be tempted to soften:
|
|
25
|
+
a handler with tests looks implemented. Neither a test nor a docs page is a production
|
|
26
|
+
caller. Boundaries between states: `references/capability-states.md`.
|
|
37
27
|
|
|
38
28
|
## Trace the chain
|
|
39
29
|
|
|
40
|
-
Walk every capability in the same order and stop at the first link
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
the arguments the handler actually passes — not the ones the signature allows.
|
|
51
|
-
4. **Storage, or the effect on the outside world.** The write that makes the
|
|
52
|
-
capability true after the process exits.
|
|
53
|
-
5. **A test that can go red.** One that exercises the chain above, not the unit in
|
|
54
|
-
isolation with its own mock.
|
|
30
|
+
Walk every capability in the same order and stop at the first absent link. That link is
|
|
31
|
+
the evidence; a state without one is an opinion.
|
|
32
|
+
|
|
33
|
+
1. **The entry point a person uses** — registered command, route, CLI subcommand, menu
|
|
34
|
+
item, key binding, scheduled job. An exported function nothing imports is not one.
|
|
35
|
+
2. **The handler** — real work, or a stub returning success.
|
|
36
|
+
3. **The interface call** — with the arguments the handler actually passes.
|
|
37
|
+
4. **Storage or the outside effect** — the write that makes it true after the process
|
|
38
|
+
exits.
|
|
39
|
+
5. **A test that exercises the chain**, not the unit with its own mock.
|
|
55
40
|
|
|
56
41
|
Two rules keep the walk honest:
|
|
57
42
|
|
|
58
|
-
- **Read the caller, not the declaration.** `export function exportCsv()` proves
|
|
59
|
-
|
|
60
|
-
- **A link you did not check is not a link that passed.** Dynamic dispatch —
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
the registration. If you still cannot see it, the state is unverified, not
|
|
64
|
-
`fake`.
|
|
43
|
+
- **Read the caller, not the declaration.** `export function exportCsv()` proves an
|
|
44
|
+
intention; no import of it is the finding.
|
|
45
|
+
- **A link you did not check is not a link that passed.** Dynamic dispatch — registries,
|
|
46
|
+
injection, reflection, string-keyed maps, manifests — hides callers. Find the
|
|
47
|
+
registry, then the registration. Cannot see it? Unverified, not `fake`.
|
|
65
48
|
|
|
66
49
|
## Three passes, not one
|
|
67
50
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
2. **Runtime semantics** — a state × role matrix, one cell at a time, checked against
|
|
77
|
-
the ten ways a reachable branch still dies (early return, empty callback, dropped
|
|
78
|
-
parameter, dead state, aggregate that can never pass, and the rest). The list is in
|
|
79
|
-
`references/audit-passes.md`.
|
|
51
|
+
A clean static pass proves the wiring diagram has no loose ends; it does **not** prove
|
|
52
|
+
current flows. Say which passes ran:
|
|
53
|
+
|
|
54
|
+
1. **Static wiring** — the chain above, reported as counts (calls to nothing, empty
|
|
55
|
+
handlers, stubs, permanently disabled controls, fields written but never sent).
|
|
56
|
+
2. **Runtime semantics** — a state × role matrix, one cell at a time, against the ten
|
|
57
|
+
ways a reachable branch still dies (early return, empty callback, dropped parameter,
|
|
58
|
+
dead state, aggregate that can never pass, and the rest).
|
|
80
59
|
3. **The real entry point** — real data, one run per P0 path, look at the state
|
|
81
|
-
afterwards. No browser, no server
|
|
60
|
+
afterwards. No browser, no server: the pass did not run.
|
|
82
61
|
|
|
83
|
-
Pass 1 alone may not label anything `wired`.
|
|
84
|
-
`
|
|
85
|
-
confirm a chain works.
|
|
62
|
+
Pass 1 alone may not label anything `wired`. Details, sampling, and the row template:
|
|
63
|
+
`references/audit-passes.md`.
|
|
86
64
|
|
|
87
65
|
## Evidence levels
|
|
88
66
|
|
|
89
|
-
Rank what you have, and never let a weaker kind stand in for a stronger one:
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
2. **Logs or screenshots**: somebody did, and the artifact exists.
|
|
93
|
-
3. **The person's words**: they say it does not work.
|
|
94
|
-
4. **Inference from reading the code**: the weakest, and the normal case here.
|
|
67
|
+
Rank what you have, and never let a weaker kind stand in for a stronger one: **observed**
|
|
68
|
+
(you ran it) > **logs or screenshots** > **the person's words** > **inference from
|
|
69
|
+
reading the code** — the normal case here.
|
|
95
70
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
to make a row look sourced: a row with no location is honest, a row
|
|
101
|
-
with a wrong one destroys the report.
|
|
71
|
+
Cite `file:line`: where the chain stops, plus the line where the contradicting claim is
|
|
72
|
+
made. Never cite a doc, comment, changelog, or test name as evidence that it works; that
|
|
73
|
+
is the artefact `fake` names. **Never invent a `file:line`** — a row with no location is
|
|
74
|
+
honest, a wrong one destroys the report.
|
|
102
75
|
|
|
103
|
-
If you did not reach a capability through its real entry point
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
could not check goes in `limitations`.
|
|
76
|
+
If you did not reach a capability through its real entry point, its state may be `half`,
|
|
77
|
+
`fake`, or `broken` from reading, but it may **not** be `wired`, and what you could not
|
|
78
|
+
check goes in `limitations`.
|
|
107
79
|
|
|
108
80
|
## What does not count as a finding
|
|
109
81
|
|
|
110
|
-
-
|
|
111
|
-
-
|
|
112
|
-
-
|
|
113
|
-
|
|
114
|
-
-
|
|
115
|
-
|
|
116
|
-
not check dynamic dispatch.** See the second rule above: unverified.
|
|
82
|
+
- A capability that is `wired` but ugly, slow, or duplicated — that is review.
|
|
83
|
+
- A designed but unbuilt feature — that is `missing`, and it belongs to design.
|
|
84
|
+
- A commented-out block, a TODO, or a dead file outside any entry point — it claims
|
|
85
|
+
nothing. Report it only if a doc or test points at it as live.
|
|
86
|
+
- "Unwired because a search found no caller" when you did not check dynamic dispatch —
|
|
87
|
+
unverified.
|
|
117
88
|
|
|
118
89
|
## Output
|
|
119
90
|
|
|
@@ -135,37 +106,32 @@ Reply with one JSON object. Nothing else — the report is delivered as written.
|
|
|
135
106
|
|
|
136
107
|
Rules that change behaviour:
|
|
137
108
|
|
|
138
|
-
- `state` is one of
|
|
139
|
-
other values, no bracket decoration.
|
|
109
|
+
- `state` is one of the five tokens, lower case, no decoration.
|
|
140
110
|
- `evidence.file` is relative to the project root; `line_range` is where the chain
|
|
141
111
|
stopped. Never invent one.
|
|
142
|
-
-
|
|
143
|
-
|
|
144
|
-
- `batch` is the design's suggested batch
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
Field-by-field spec and a full row: `references/output.md`.
|
|
112
|
+
- **`limitations` is mandatory** when a pass did not run. An empty list means all three
|
|
113
|
+
ran, which is rarely true.
|
|
114
|
+
- `batch` is the design's suggested batch; fill it when you can, so the audit feeds the
|
|
115
|
+
plan instead of sitting beside it.
|
|
148
116
|
|
|
149
|
-
Order
|
|
150
|
-
`half`,
|
|
151
|
-
to stop after the first three rows.
|
|
117
|
+
Field spec and ordering: `references/output.md`. Order rows by urgency of state —
|
|
118
|
+
`fake`, `half`, `broken`, `wired`, `missing` — so a reader can stop after three.
|
|
152
119
|
|
|
153
|
-
If
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
it. The tokens do not change with the format — they are what the reader sorts by.
|
|
120
|
+
If the brief says in-session, write the same content as a Markdown table: one row per
|
|
121
|
+
capability, the state token in its own column, evidence as `path:line`, detail beneath.
|
|
122
|
+
The tokens do not change with the format.
|
|
157
123
|
|
|
158
124
|
## Reference files
|
|
159
125
|
|
|
160
126
|
| File | Read it when |
|
|
161
127
|
| --- | --- |
|
|
162
|
-
| `references/audit-passes.md` |
|
|
163
|
-
| `references/
|
|
164
|
-
| `references/
|
|
165
|
-
| `references/
|
|
166
|
-
| `references/
|
|
167
|
-
| `examples/fake-capability.md` |
|
|
168
|
-
| `examples/wired-clean.md` |
|
|
128
|
+
| `references/audit-passes.md` | passes 2 and 3, the ten runtime break patterns, coverage and sampling |
|
|
129
|
+
| `references/capability-states.md` | a row is between two states, or two capabilities seem to be one |
|
|
130
|
+
| `references/finding-the-chain.md` | you cannot see a caller and suspect dynamic dispatch |
|
|
131
|
+
| `references/evidence.md` | choosing what to cite, or writing `limitations` |
|
|
132
|
+
| `references/output.md` | writing the envelope: field spec, a full row, ordering |
|
|
133
|
+
| `examples/fake-capability.md` | the shape of a `fake` row someone would accept |
|
|
134
|
+
| `examples/wired-clean.md` | a capability that looks unwired and is not — the false positive |
|
|
169
135
|
|
|
170
136
|
If a reference path is unreadable, continue from this file — the core instructions are
|
|
171
137
|
self-sufficient.
|