dsh-lean-router 0.0.0-stage → 1.0.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/LICENSE +21 -0
- package/NOTICE.md +25 -0
- package/README.en.md +69 -0
- package/README.md +68 -2
- package/assets/gating.weights.json +13 -0
- package/assets/skills/ask-matt/PHASE-BOUNDARIES.md +55 -0
- package/assets/skills/ask-matt/SKILL.md +80 -0
- package/assets/skills/ask-matt/agents/openai.yaml +5 -0
- package/assets/skills/chief-of-staff/SKILL.md +76 -0
- package/assets/skills/chief-of-staff/agents/openai.yaml +5 -0
- package/assets/skills/code-review/SKILL.md +91 -0
- package/assets/skills/code-review/agents/openai.yaml +5 -0
- package/assets/skills/codebase-design/DEEPENING.md +37 -0
- package/assets/skills/codebase-design/DESIGN-IT-TWICE.md +44 -0
- package/assets/skills/codebase-design/SKILL.md +116 -0
- package/assets/skills/codebase-design/agents/openai.yaml +5 -0
- package/assets/skills/diagnosing-bugs/SKILL.md +140 -0
- package/assets/skills/diagnosing-bugs/agents/openai.yaml +5 -0
- package/assets/skills/diagnosing-bugs/scripts/hitl-loop.template.sh +44 -0
- package/assets/skills/domain-modeling/ADR-FORMAT.md +47 -0
- package/assets/skills/domain-modeling/GLOSSARY-FORMAT.md +60 -0
- package/assets/skills/domain-modeling/SKILL.md +76 -0
- package/assets/skills/domain-modeling/agents/openai.yaml +5 -0
- package/assets/skills/grilling/SKILL.md +52 -0
- package/assets/skills/grilling/agents/openai.yaml +5 -0
- package/assets/skills/handoff/SKILL.md +17 -0
- package/assets/skills/handoff/agents/openai.yaml +5 -0
- package/assets/skills/implement/SKILL.md +55 -0
- package/assets/skills/implement/agents/openai.yaml +5 -0
- package/assets/skills/improve-codebase-architecture/HTML-REPORT.md +123 -0
- package/assets/skills/improve-codebase-architecture/SKILL.md +72 -0
- package/assets/skills/improve-codebase-architecture/agents/openai.yaml +5 -0
- package/assets/skills/loop-me/SKILL.md +33 -0
- package/assets/skills/loop-me/agents/openai.yaml +5 -0
- package/assets/skills/pr/CREDITS.md +3 -0
- package/assets/skills/pr/SKILL.md +172 -0
- package/assets/skills/pr/agents/openai.yaml +5 -0
- package/assets/skills/prototype/LOGIC.md +67 -0
- package/assets/skills/prototype/SKILL.md +28 -0
- package/assets/skills/prototype/UI.md +112 -0
- package/assets/skills/prototype/agents/openai.yaml +5 -0
- package/assets/skills/research/SKILL.md +14 -0
- package/assets/skills/research/agents/openai.yaml +5 -0
- package/assets/skills/retro/SKILL.md +45 -0
- package/assets/skills/retro/agents/openai.yaml +5 -0
- package/assets/skills/setup-matt-pocock-skills/SKILL.md +121 -0
- package/assets/skills/setup-matt-pocock-skills/agents/openai.yaml +5 -0
- package/assets/skills/setup-matt-pocock-skills/domain.md +51 -0
- package/assets/skills/setup-matt-pocock-skills/issue-tracker-github.md +50 -0
- package/assets/skills/setup-matt-pocock-skills/issue-tracker-gitlab.md +46 -0
- package/assets/skills/setup-matt-pocock-skills/issue-tracker-local.md +30 -0
- package/assets/skills/setup-matt-pocock-skills/triage-labels.md +15 -0
- package/assets/skills/setup-ts-deep-modules/SKILL.md +103 -0
- package/assets/skills/setup-ts-deep-modules/agents/openai.yaml +5 -0
- package/assets/skills/setup-ts-deep-modules/dependency-cruiser.config.cjs +95 -0
- package/assets/skills/software-factory/EXAMPLE-TASKS.md +80 -0
- package/assets/skills/software-factory/GIT-HOSTS.md +84 -0
- package/assets/skills/software-factory/OBSERVABILITY-PLATFORMS.md +75 -0
- package/assets/skills/software-factory/RUNNERS.md +94 -0
- package/assets/skills/software-factory/SKILL.md +99 -0
- package/assets/skills/software-factory/TICKET-TRACKERS.md +85 -0
- package/assets/skills/tdd/SKILL.md +40 -0
- package/assets/skills/tdd/agents/openai.yaml +5 -0
- package/assets/skills/tdd/mocking.md +59 -0
- package/assets/skills/tdd/tests.md +77 -0
- package/assets/skills/teach/GLOSSARY-FORMAT.md +35 -0
- package/assets/skills/teach/LEARNING-RECORD-FORMAT.md +46 -0
- package/assets/skills/teach/MISSION-FORMAT.md +31 -0
- package/assets/skills/teach/RESOURCES-FORMAT.md +32 -0
- package/assets/skills/teach/SKILL.md +141 -0
- package/assets/skills/teach/agents/openai.yaml +5 -0
- package/assets/skills/to-questionnaire/SKILL.md +55 -0
- package/assets/skills/to-questionnaire/agents/openai.yaml +5 -0
- package/assets/skills/to-spec/SKILL.md +76 -0
- package/assets/skills/to-spec/agents/openai.yaml +5 -0
- package/assets/skills/to-tickets/SKILL.md +106 -0
- package/assets/skills/to-tickets/agents/openai.yaml +5 -0
- package/assets/skills/triage/AGENT-BRIEF.md +207 -0
- package/assets/skills/triage/OUT-OF-SCOPE.md +105 -0
- package/assets/skills/triage/SKILL.md +113 -0
- package/assets/skills/triage/agents/openai.yaml +5 -0
- package/assets/skills/wait-what/SKILL.md +8 -0
- package/assets/skills/wait-what/agents/openai.yaml +5 -0
- package/assets/skills/wayfinder/SKILL.md +129 -0
- package/assets/skills/wayfinder/agents/openai.yaml +5 -0
- package/assets/skills/wizard/SKILL.md +46 -0
- package/assets/skills/wizard/agents/openai.yaml +5 -0
- package/assets/skills/wizard/template.sh +223 -0
- package/assets/skills/writing-beats/SKILL.md +44 -0
- package/assets/skills/writing-beats/agents/openai.yaml +5 -0
- package/assets/skills/writing-for-agents/SKILL-MECHANICS.md +22 -0
- package/assets/skills/writing-for-agents/SKILL.md +83 -0
- package/assets/skills/writing-for-agents/agents/openai.yaml +5 -0
- package/assets/skills/writing-fragments/SKILL.md +80 -0
- package/assets/skills/writing-fragments/agents/openai.yaml +5 -0
- package/assets/skills/writing-shape/SKILL.md +59 -0
- package/assets/skills/writing-shape/agents/openai.yaml +5 -0
- package/assets/skills.matrix.json +311 -0
- package/cordis.patch.yml +852 -0
- package/docs/architecture.en.md +102 -0
- package/docs/architecture.md +97 -0
- package/docs/changelog.en.md +37 -0
- package/docs/changelog.md +39 -0
- package/docs/configuration.en.md +88 -0
- package/docs/configuration.md +88 -0
- package/docs/install.en.md +60 -0
- package/docs/install.md +60 -0
- package/docs/matrix.en.md +57 -0
- package/docs/matrix.md +57 -0
- package/docs/quickstart.en.md +80 -0
- package/docs/quickstart.md +80 -0
- package/docs/release-checklist.en.md +73 -0
- package/docs/release-checklist.md +122 -0
- package/docs//345/244/215/346/240/270-/345/205/263/346/217/222/344/273/266/346/270/205/345/215/225.md +108 -0
- package/docs//345/267/245/345/205/267/351/201/256/350/224/275-/346/216/245/347/272/277/350/257/264/346/230/216.md +140 -0
- package/docs//346/212/200/350/203/275/351/227/250/346/216/247-/350/256/276/350/256/241/350/257/264/346/230/216.md +134 -0
- package/docs//350/267/257/347/224/261-/350/256/276/350/256/241/350/257/264/346/230/216.md +104 -0
- package/docs//351/235/242/346/235/277-/350/256/276/350/256/241/350/257/264/346/230/216.md +205 -0
- package/lib/audit-commands.js +289 -0
- package/lib/audit-sink.js +137 -0
- package/lib/bands.js +137 -0
- package/lib/gate-runner.js +179 -0
- package/lib/index.js +14 -0
- package/lib/lean/compaction.js +119 -0
- package/lib/lean/delivery-gate.js +312 -0
- package/lib/lean/disabled.js +61 -0
- package/lib/lean/index.js +19 -0
- package/lib/lean/persona-text.js +110 -0
- package/lib/lean/plan-mode.js +31 -0
- package/lib/lean/pruner.js +75 -0
- package/lib/lean/tool-concurrency.js +316 -0
- package/lib/router.js +360 -0
- package/lib/skill-provider.js +167 -0
- package/lib/skillgate.js +396 -0
- package/lib/toolface/discovery.js +282 -0
- package/lib/toolface/executor.js +240 -0
- package/lib/toolface/index.js +242 -0
- package/lib/toolface/pool.js +160 -0
- package/lib/toolface/retention.js +187 -0
- package/lib/toolface/rules.js +397 -0
- package/lib/toolface/scope.js +188 -0
- package/lib/toolface/transport.js +337 -0
- package/package.json +63 -4
- package/presets/base/frag-lean.patch.yml +440 -0
- package/presets/base/frag-preset.patch.yml +267 -0
- package/presets/base/frag-router.patch.yml +20 -0
- package/presets/base/frag-toolface.patch.yml +75 -0
- package/presets/base/lean-router.patch.yml +47 -0
- package/scripts/build-bundle.mjs +45 -0
- package/scripts/check-drift.mjs +24 -0
- package/scripts/doctor.mjs +30 -0
- package/scripts/install.mjs +20 -0
- package/scripts/integrate-preset.mjs +109 -0
- package/scripts/verify.mjs +8 -0
- package/skills.manifest.json +287 -0
- package/test/audit-commands.test.mjs +325 -0
- package/test/audit-sink.test.mjs +150 -0
- package/test/build.test.mjs +7 -0
- package/test/gate-run.test.mjs +173 -0
- package/test/integration-preset.test.mjs +57 -0
- package/test/lean-compaction.test.mjs +47 -0
- package/test/lean-concurrency.test.mjs +115 -0
- package/test/lean-delivery-gate.test.mjs +75 -0
- package/test/lean-frag.test.mjs +132 -0
- package/test/lean-modules.test.mjs +89 -0
- package/test/lean-pruner.test.mjs +42 -0
- package/test/manifest.test.mjs +25 -0
- package/test/package.test.mjs +18 -0
- package/test/provider.test.mjs +21 -0
- package/test/router-bands.test.mjs +77 -0
- package/test/router.test.mjs +239 -0
- package/test/skillgate-provider.test.mjs +122 -0
- package/test/skillgate.test.mjs +217 -0
- package/test/toolface-executor.test.mjs +208 -0
- package/test/toolface-mask.test.mjs +217 -0
- package/test/toolface-rules.test.mjs +160 -0
- package/test/toolface-runtime.test.mjs +394 -0
- package/test/toolface-wiring.test.mjs +256 -0
- package/ui/go.json +19 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ShawnSun-debug
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/NOTICE.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# NOTICE
|
|
2
|
+
|
|
3
|
+
本包(dsh-lean-router)站在四个上游的肩膀上,均按 MIT 或其声明的许可条款再分发。本表是**贡献映射表**:上游 → 贡献到本包的层 → 本包中的承载文件。各上游的 LICENSE 全文保留在其原仓库;以下仅摘录 MIT 声明的版权行(非全文)。
|
|
4
|
+
|
|
5
|
+
## 四上游致谢表
|
|
6
|
+
|
|
7
|
+
| 上游 | 版本 / 基线 | 贡献到本包的层 | 本包承载位置 | 许可(版权行摘录) |
|
|
8
|
+
|---|---|---|---|---|
|
|
9
|
+
| dsh-flash-presets(LarryE135) | 0.3.2 | lean 四机制(轮次压缩/输出裁剪/关插件/行为纪律)、plan-mode v1、delivery-gate、glob/grep 并发标记、preset 双档形态 | lib/lean/*(compaction/pruner/disabled/persona-text/plan-mode/delivery-gate/tool-concurrency)、presets/base/frag-lean.patch.yml | MIT — Copyright (c) 2026 LarryE135 |
|
|
10
|
+
| dsh-codemode(dsh-codemode contributors) | 0.3.0,main @ f9758ec | toolface 掩蔽接缝(ToolExecutor describe/execute)、code_run 传输与并发池、meta 发现 4 工具、三视图 scope 归因、retention 双清理 | lib/toolface/*(8 模块 file-for-file vendored,适配点以注释标注)、presets/base/frag-toolface.patch.yml | MIT — Copyright (c) 2026 dsh-codemode contributors |
|
|
11
|
+
| dsh-routing-suite(yjh051108) | 0.3.3(@dsh-external/dsh-super-injector) | 思考链路由**思想**(行为带分类、近场引导、反稀释勤勉自检的轻量化)——只移植实测结论,未搬运其旧线代码 | lib/router.js、lib/bands.js(实现重写,头部注明思想来源) | MIT — Copyright (c) 2026 yjh051108 |
|
|
12
|
+
| mattpocock skills | 31 个技能正文 | skills 数据源与内置副本兜底、门控层评分数据 | assets/skills/(31 目录)、assets/skills.matrix.json、skills.manifest.json | MIT(沿用既有 NOTICE 口径;正文经主人引入本地 ~/.dsh/skills,本包以内置副本作 vendored fallback) |
|
|
13
|
+
|
|
14
|
+
## 逐文件 vendored 映射(摘要)
|
|
15
|
+
|
|
16
|
+
- **lib/lean/compaction.js / pruner.js**:flash-presets `flash-lean-ptc-v3.patch.yml` 的口径照抄(lean 档 L121-133;balance 同值)+ 宿主判据镜像(dsh-compaction-basic L15/17/63/124-147;dsh-compaction-tool-result-pruner L8-27/91-124)——纯函数端口,执行归宿主。
|
|
17
|
+
- **lib/lean/persona-text.js**:flash lean 13 条规则与 prefix 原文(flash-lean-ptc-v3.patch.yml L15-60)+ balance 3 条(flash-lean-ptc-v3-balance.patch.yml L13-18);本包增补 3 软门与自检钩;规则 7 删去 PTC-only 句(唯一实质差异)。
|
|
18
|
+
- **lib/lean/plan-mode.js**:flash-lean-ptc-v3.patch.yml L93-107 逐行照抄(vendored)。
|
|
19
|
+
- **lib/lean/delivery-gate.js / tool-concurrency.js**:flash-presets 0.3.2 lib/delivery-gate.js / lib/tool-concurrency.js 逐段移植(0.3.2 版),适配点:动态 import、手写校验、插件名改 `lean-delivery-gate` / `lean-concurrency`、Symbol 键空间改本包。
|
|
20
|
+
- **lib/lean/disabled.js**:flash-lean-ptc-v3.patch.yml L155-202 的 6 行 disabled 清单照抄。
|
|
21
|
+
- **lib/toolface/**(8 模块):upstream dsh-codemode 0.3.0 lib/{index,rules,executor,discovery,scope,pool,retention,transport}.js,file-for-file vendored @ f9758ec;适配:插件名/日志前缀改本包、native executor 依赖动态 import + 安装提示 stub、Symbol 键与 TAG 标注。
|
|
22
|
+
- **lib/router.js / lib/bands.js**:routing-suite 思想移植(非代码);关键实测结论(三带 persona 非连续、V4.1 Flash 阈值型最优解)已在 bands.js L1-7 头注注明。
|
|
23
|
+
- **assets/skills/**:mattpocock 31 技能正文副本(tier bundled 兜底;一级来源仍是 ~/.dsh/skills 同名目录)。
|
|
24
|
+
|
|
25
|
+
按 MIT 要求,各上游的版权与许可声明随再分发保留;对本包的修改(适配点)均在文件头部注明,未删除上游署名信息。
|
package/README.en.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# dsh-lean-router
|
|
2
|
+
|
|
3
|
+
[](https://github.com/ShawnSun-Debug/dsh-lean-router/actions/workflows/ci.yml) [](LICENSE) [](https://nodejs.org)
|
|
4
|
+
|
|
5
|
+
A DeepSeek Harness (DSH) cordis plugin tuned for DeepSeek V4.1 Flash: **one plugin card** fusing six layers — the lean token-saving four mechanisms (flash-presets measured tuning), `code_run` tool masking (the codemode seam), thinking-chain routing across three bands (routing-suite ideas), gated auto-invocation of 31 mattpocock skills, an audit channel and a (in-progress) panel.
|
|
6
|
+
|
|
7
|
+
> This package documents bilingually with the **"Chinese default + English `.en.md` files"** scheme: Chinese is the first language (README.md and docs/*.md), English lives in same-directory `.en.md` files (this file ↔ [README.md](./README.md)). All three upstream projects follow the same "Chinese README + README.en.md" convention.
|
|
8
|
+
|
|
9
|
+
> Status: **v1.0.0** (tickets 02-06 all accepted + master integration done; the audit panel, ticket 07, is **in flight**; publishing, ticket 09, pending).
|
|
10
|
+
|
|
11
|
+
## Layers at a glance
|
|
12
|
+
|
|
13
|
+
| Layer | Modules | One line |
|
|
14
|
+
|---|---|---|
|
|
15
|
+
| lean (ticket 03) | lib/lean/ | turn compaction 0.25/20000 · output pruning 8192/4096/1024 · six disabled plugins · dual-tier discipline (lean 13 + 3 soft gates / balance 3) + delivery gate + glob/grep concurrency marking |
|
|
16
|
+
| toolface (ticket 04) | lib/toolface/ | tools outside the preset (MCP etc.) are hidden from the request surface, discovered via `code_tools_search` inside programs; the `code_run` transport |
|
|
17
|
+
| router (ticket 05) | lib/router.js · lib/bands.js | spec/react/weak bands + the `[router] band=` directive + near-field guides (zero-write) + /band /skill |
|
|
18
|
+
| skillgate (ticket 06) | lib/skillgate.js · lib/skill-provider.js | scores all 31 skills per turn -> tier -> ds-* arbitration -> 8k soft degrade -> near-field mount/hint |
|
|
19
|
+
| audit (ticket 07, in flight) | audit channel in lib/skillgate.js | in-memory ring buffer (256) + subscription; JSONL persistence and the ui panel are in flight |
|
|
20
|
+
| panel (ticket 07, in flight) | ui/ | panel card (decision rows + score table + token comparison + banner), **not accepted yet** |
|
|
21
|
+
|
|
22
|
+
## Target DSH
|
|
23
|
+
|
|
24
|
+
engines: `>=0.2.1-rc.5 <0.2.3-0` (measured baseline 0.2.2-rc.5). DSH is in developer preview; breaking changes are handled by the engines gate + the doctor self-check + a warn banner, never by silent degradation.
|
|
25
|
+
|
|
26
|
+
## Install
|
|
27
|
+
|
|
28
|
+
Not published yet; start with a local link (both paths in [docs/quickstart.en.md](docs/quickstart.en.md)):
|
|
29
|
+
|
|
30
|
+
~~~powershell
|
|
31
|
+
dsh plugin --profile desktop add "link:D:\path\to\dsh-lean-router"
|
|
32
|
+
# once published: dsh plugin --profile desktop add npm:dsh-lean-router@1.0.0
|
|
33
|
+
~~~
|
|
34
|
+
|
|
35
|
+
The package depends on `@deepseek-ai/dsh-tool-executor-native`; if missing, the masking layer fails loudly — the executor stub throws an error with install guidance on the first `describe` (lib/toolface/executor.js L57-63). Follow it with `npm install` or re-add via `dsh plugin add`.
|
|
36
|
+
|
|
37
|
+
## Quick start
|
|
38
|
+
|
|
39
|
+
1. Restart DSH, pick the **Lean router** preset (or **Lean router (balance)**) for new sessions.
|
|
40
|
+
2. Optional: start the first message with `[router] band=spec|react|weak|auto [task=<one line>]`.
|
|
41
|
+
3. Commands: `/band` to view/switch the band, `/skill` to list skills, `/compact` for manual compaction.
|
|
42
|
+
4. Health check: `node scripts/doctor.mjs` (7 checks) -> `npm run verify` (includes the build --check reversal check; 8 gates together with doctor) -> `npm test`.
|
|
43
|
+
|
|
44
|
+
## Documentation
|
|
45
|
+
|
|
46
|
+
Five topics bilingual (Chinese default, `*.en.md` in English):
|
|
47
|
+
|
|
48
|
+
| Topic | Chinese | English |
|
|
49
|
+
|---|---|---|
|
|
50
|
+
| Quickstart | [docs/quickstart.md](docs/quickstart.md) | [docs/quickstart.en.md](docs/quickstart.en.md) |
|
|
51
|
+
| Architecture | [docs/architecture.md](docs/architecture.md) | [docs/architecture.en.md](docs/architecture.en.md) |
|
|
52
|
+
| Configuration | [docs/configuration.md](docs/configuration.md) | [docs/configuration.en.md](docs/configuration.en.md) |
|
|
53
|
+
| Skill matrix | [docs/matrix.md](docs/matrix.md) | [docs/matrix.en.md](docs/matrix.en.md) |
|
|
54
|
+
| Changelog | [docs/changelog.md](docs/changelog.md) | [docs/changelog.en.md](docs/changelog.en.md) |
|
|
55
|
+
|
|
56
|
+
The 4 Chinese design notes from earlier tickets stay in docs/: [routing](docs/路由-设计说明.md) · [skill gating](docs/技能门控-设计说明.md) · [tool masking wiring](docs/工具遮蔽-接线说明.md) · [disabled-plugin review](docs/复核-关插件清单.md).
|
|
57
|
+
|
|
58
|
+
## v1 status (stated honestly)
|
|
59
|
+
|
|
60
|
+
- **Audit panel in flight** (ticket 07): the audit channel is ready; the `ui/go.json` panel is not accepted yet.
|
|
61
|
+
- **The balance preset row carries no routing directive** (v1 ruling; the lean row already has ROUTER_PROMPT spliced in).
|
|
62
|
+
- **The plan-mode section keeps the flash wording verbatim** (including the PTC `run_code` sentence).
|
|
63
|
+
- **Gate fallback mode**: when the host skill-registry cache is serving, per-turn gating runs through the injection seam and audits are labeled `mode: "fallback-cached-list"`.
|
|
64
|
+
- **8k soft degradation**: when the gate injection estimate exceeds `tokenBudget 8000`, low-score skills drop a tier with no count cap.
|
|
65
|
+
- **Sole effective preset row**: the frag-preset.patch.yml union snapshot is the only effective preset row (cordis patches replace preset rows as whole keys).
|
|
66
|
+
|
|
67
|
+
## License and acknowledgments
|
|
68
|
+
|
|
69
|
+
MIT, see [LICENSE](LICENSE). The four-upstream contribution map and license statements are in [NOTICE.md](NOTICE.md): dsh-flash-presets (LarryE135) · dsh-codemode (dsh-codemode contributors) · dsh-routing-suite (yjh051108) · mattpocock skills (the 31 skill bodies).
|
package/README.md
CHANGED
|
@@ -1,3 +1,69 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-lean-router
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/ShawnSun-Debug/dsh-lean-router/actions/workflows/ci.yml) [](LICENSE) [](https://nodejs.org)
|
|
4
|
+
|
|
5
|
+
为 DeepSeek V4.1 Flash 调校的 DeepSeek Harness(DSH)cordis 插件:**一张插件卡**里融合六层——lean 省 token 四机制(flash-presets 实测口径)、code_run 工具遮蔽(codemode 接缝)、思考链路由三带(routing-suite 思想)、mattpocock 31 技能门控自动调用、审计通道与(进行中的)面板。
|
|
6
|
+
|
|
7
|
+
> 本包双语文档采用 **「中文默认 + 英文 `.en.md` 独立文件」** 方案:中文是第一语言(README.md 与 docs/*.md),英文版同目录 `.en.md`(本文件 ↔ [README.en.md](./README.en.md))。三个上游项目也遵循「中文 README + README.en.md」惯例。
|
|
8
|
+
|
|
9
|
+
> 状态:**v1.0.0**(t1–t10 全验收完成;发布准备就绪——npm publish / git push / GitHub Release 按 [docs/release-checklist.md](docs/release-checklist.md) 手动执行)。
|
|
10
|
+
|
|
11
|
+
## 功能一图
|
|
12
|
+
|
|
13
|
+
| 层 | 模块 | 一句话 |
|
|
14
|
+
|---|---|---|
|
|
15
|
+
| lean(票 03) | lib/lean/ | 轮次压缩 0.25/20000 · 输出裁剪 8192/4096/1024 · 关 6 插件 · 纪律双档(lean 13+3 软门 / balance 3)+ 交付门 + glob/grep 并发标记 |
|
|
16
|
+
| toolface(票 04) | lib/toolface/ | 预设外工具(MCP 等)从请求面隐藏,程序内 `code_tools_search` 发现后调用;`code_run` 传输 |
|
|
17
|
+
| router(票 05) | lib/router.js · lib/bands.js | spec/react/weak 三带 + `[router] band=` 显式指令 + 近场引导(零写入)+ /band /skill |
|
|
18
|
+
| skillgate(票 06) | lib/skillgate.js · lib/skill-provider.js | 每轮 31 技能全量打分 → 分档 → ds-* 裁决 → 8k 软降 → 近场挂载/提示 |
|
|
19
|
+
| audit(票 07 进行中) | lib/skillgate.js 审计通道 | 内存环形缓冲(256 条)+ 订阅;JSONL 落盘与 ui 面板在飞 |
|
|
20
|
+
| panel(票 07 进行中) | ui/ | 面板卡片(决策行 + 得分表 + token 对比 + 黄条),**未验收** |
|
|
21
|
+
|
|
22
|
+
## 目标 DSH
|
|
23
|
+
|
|
24
|
+
engines:`>=0.2.1-rc.5 <0.2.3-0`(实测基线 0.2.2-rc.5)。DSH 处于 developer preview,破坏性变更将以 engines 闸 + doctor 自检 + warn 黄条应对,不做静默降级。
|
|
25
|
+
|
|
26
|
+
## 安装
|
|
27
|
+
|
|
28
|
+
未发布,先本地 link(两条路径详见 [docs/quickstart.md](docs/quickstart.md)):
|
|
29
|
+
|
|
30
|
+
~~~powershell
|
|
31
|
+
dsh plugin --profile desktop add "link:D:\path\to\dsh-lean-router"
|
|
32
|
+
# 发布后:dsh plugin --profile desktop add npm:dsh-lean-router@1.0.0
|
|
33
|
+
~~~
|
|
34
|
+
|
|
35
|
+
依赖 `@deepseek-ai/dsh-tool-executor-native`;缺失时工具遮蔽层不静默——executor stub 首次 `describe` 抛出含安装指引的错误(lib/toolface/executor.js L57-63),按提示 `npm install` 或用 `dsh plugin add` 重装即可。
|
|
36
|
+
|
|
37
|
+
## 快速上手
|
|
38
|
+
|
|
39
|
+
1. 重启 DSH,新会话选预设 **Lean router**(或 **Lean router (balance)**)。
|
|
40
|
+
2. 可选:首条消息带 `[router] band=spec|react|weak|auto [task=<一行>]`。
|
|
41
|
+
3. 命令:`/band` 看切带、`/skill` 列技能、`/compact` 手动压缩。
|
|
42
|
+
4. 体检:`node scripts/doctor.mjs`(7 项自检)→ `npm run verify`(含 build --check 反向一致,与 doctor 合计 8 道把关)→ `npm test`。
|
|
43
|
+
|
|
44
|
+
## 文档
|
|
45
|
+
|
|
46
|
+
五主题双语(中文默认,`*.en.md` 为英文版):
|
|
47
|
+
|
|
48
|
+
| 主题 | 中文 | English |
|
|
49
|
+
|---|---|---|
|
|
50
|
+
| 快速上手 | [docs/quickstart.md](docs/quickstart.md) | [docs/quickstart.en.md](docs/quickstart.en.md) |
|
|
51
|
+
| 架构六层 | [docs/architecture.md](docs/architecture.md) | [docs/architecture.en.md](docs/architecture.en.md) |
|
|
52
|
+
| 配置参考 | [docs/configuration.md](docs/configuration.md) | [docs/configuration.en.md](docs/configuration.en.md) |
|
|
53
|
+
| 技能矩阵 | [docs/matrix.md](docs/matrix.md) | [docs/matrix.en.md](docs/matrix.en.md) |
|
|
54
|
+
| 变更记录 | [docs/changelog.md](docs/changelog.md) | [docs/changelog.en.md](docs/changelog.en.md) |
|
|
55
|
+
|
|
56
|
+
上游票产出的 4 篇中文设计说明保留在 docs/:[路由-设计说明](docs/路由-设计说明.md) · [技能门控-设计说明](docs/技能门控-设计说明.md) · [工具遮蔽-接线说明](docs/工具遮蔽-接线说明.md) · [复核-关插件清单](docs/复核-关插件清单.md)。
|
|
57
|
+
|
|
58
|
+
## v1 现状(如实标注)
|
|
59
|
+
|
|
60
|
+
- **audit 面板进行中**(票 07 在飞):审计通道已就绪,`ui/go.json` 面板未验收。
|
|
61
|
+
- **balance 预设行暂不含路由指令**(v1 裁定;lean 行已拼接 ROUTER_PROMPT)。
|
|
62
|
+
- **plan-mode 政策段保留 flash 原文**(含 PTC `run_code` 句)。
|
|
63
|
+
- **门控回退模式**:宿主技能目录缓存生效时,每轮门控走注入缝,审计标注 `mode: "fallback-cached-list"`。
|
|
64
|
+
- **8k 软降级**:门控注入估算超 `tokenBudget 8000` 时低分技能降档,个数不设上限。
|
|
65
|
+
- **预设行唯一生效**:frag-preset.patch.yml 并集快照是唯一生效 preset 行(cordis patch 键级整体替换语义)。
|
|
66
|
+
|
|
67
|
+
## 许可与致谢
|
|
68
|
+
|
|
69
|
+
MIT,见 [LICENSE](LICENSE)。四上游贡献映射与许可声明见 [NOTICE.md](NOTICE.md):dsh-flash-presets(LarryE135)· dsh-codemode(dsh-codemode contributors)· dsh-routing-suite(yjh051108)· mattpocock skills(31 技能正文)。
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"sceneMap": {
|
|
4
|
+
"react": { "engineering": 2, "process": 1 },
|
|
5
|
+
"spec": { "engineering": 2, "research": 1 },
|
|
6
|
+
"weak": {}
|
|
7
|
+
},
|
|
8
|
+
"complexBoost": { "engineering": 1 },
|
|
9
|
+
"autoScore": 2,
|
|
10
|
+
"hintScore": 1,
|
|
11
|
+
"tokenBudget": 8000,
|
|
12
|
+
"charsPerToken": 4
|
|
13
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Phase boundaries
|
|
2
|
+
|
|
3
|
+
A **phase** is a chunk of work inside a session: the grilling, the implementation, the QA. The definition is fuzzy on purpose: a phase ends when you think *"ok, we're done with that"*.
|
|
4
|
+
|
|
5
|
+
The **phase boundary** is the gap between two phases, and it is the only place this decision belongs. Mid-phase there is no decision to make: continue, or split the work that's left into subagents. Compacting mid-phase makes the agent lose the thread.
|
|
6
|
+
|
|
7
|
+
## The five options
|
|
8
|
+
|
|
9
|
+
| Option | What it does |
|
|
10
|
+
| ------------ | --------------------------------------------------------------- |
|
|
11
|
+
| **Continue** | Stay in the session. No context switch at all. |
|
|
12
|
+
| **`/clear`** | Empty the context window and start from nothing. |
|
|
13
|
+
| **`/handoff`** | Write a portable markdown file and seed a session anywhere with it. |
|
|
14
|
+
| **Subagent** | Send the task to its own context window and get a report back. |
|
|
15
|
+
| **`/compact`** | Compress this context and seed a fresh session with the summary. |
|
|
16
|
+
|
|
17
|
+
## The tree
|
|
18
|
+
|
|
19
|
+
Work top to bottom at the boundary. The first **yes** wins.
|
|
20
|
+
|
|
21
|
+
**1. Can you continue in this session?** Two things make the answer yes: the next phase needs this phase as a **primary source**, or you have enough [smart zone](https://www.aihero.dev/ai-coding-dictionary/smart-zone) left (~150k tokens) for the next phase to fit. Grilling → implementation is the standard yes: the implementation wants the reasoning verbatim, not a summary of it. Continue costs nothing and loses nothing, so rule it out before anything else.
|
|
22
|
+
|
|
23
|
+
**2. Is the context irrelevant to what comes next?** Is everything in this session (the exploration, the decisions, the dead ends) disposable? If so, **`/clear`**. It is the cheapest move on the board: it takes no time and hands back the whole window. `/clear` also isn't terminal: the old session stays resumable.
|
|
24
|
+
|
|
25
|
+
The cost of getting this wrong is one-way. Clear a *relevant* context and you lose the **why** behind what you built, and no amount of reading the diff back gets it returned.
|
|
26
|
+
|
|
27
|
+
**3. Do you need to hand off?** `/handoff` is narrow. You need it only when you are:
|
|
28
|
+
|
|
29
|
+
- swapping to a **new harness** (Claude → Codex),
|
|
30
|
+
- moving to a **new directory** or repo,
|
|
31
|
+
- sending the work to a **colleague**,
|
|
32
|
+
- or forking a side task you found **mid-phase** without derailing what you're doing.
|
|
33
|
+
|
|
34
|
+
That list is the whole clause. What `/handoff` buys is **portability**: a file that travels. If nothing is travelling, you don't need it.
|
|
35
|
+
|
|
36
|
+
**4. Can the task be done AFK?** Is it scoped tightly enough to run with you away from the keyboard, no steering? Then send it to a **subagent** and leave this session untouched. Automated review is the standard case: the agent reads the diff and reports, and you aren't needed while it does.
|
|
37
|
+
|
|
38
|
+
**5. Otherwise, `/compact`.** Relevant context, same harness, same directory, and you need to stay in the loop: this is where the tree lands, and it lands here often. Pass it an instruction (`/compact we're going to QA this area`) so the summary keeps what the next phase needs.
|
|
39
|
+
|
|
40
|
+
`/compact` is the **default, not the first reach**. It sits at the bottom because the four questions above it are all cheaper or more precise. The failure mode when people start here is a fresh session that is confidently wrong about a decision the summary flattened.
|
|
41
|
+
|
|
42
|
+
## Primary and secondary sources
|
|
43
|
+
|
|
44
|
+
Every move except **Continue** turns a **primary source** into a **secondary source**: the session as it happened, replaced by a summary of it. The trade is always the same shape:
|
|
45
|
+
|
|
46
|
+
| Source | Information | Noise | Room to move |
|
|
47
|
+
| --------------------------------- | ----------- | ----- | ------------ |
|
|
48
|
+
| Primary (Continue) | Full | Lots | Little |
|
|
49
|
+
| Secondary (`/compact`, `/handoff`) | Lossy | Less | Lots |
|
|
50
|
+
|
|
51
|
+
This is why question 1 comes first. You only pay the lossiness when staying costs more than it saves.
|
|
52
|
+
|
|
53
|
+
## These are judgement calls
|
|
54
|
+
|
|
55
|
+
The questions are not objective: each has taste in it, and the same boundary can go two ways on two days. The value is in asking them **in order**, at the boundary rather than in the middle of the work.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ask-matt
|
|
3
|
+
description: Ask which /command fits your situation. A router over the installed skills, all of which are invoked by the user, never by the model.
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
user-invocable: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Ask Matt
|
|
9
|
+
|
|
10
|
+
You don't remember every skill, so ask. Describe the situation and get back **one next `/command` to type**, and why.
|
|
11
|
+
|
|
12
|
+
Every skill in this set is **user-invoked**: none of them appear in the model's catalog and the model cannot load one on its own. Only the user typing `/name` brings a skill in. That shapes how this router works:
|
|
13
|
+
|
|
14
|
+
- Recommend **one command per step**, named exactly, so the user can type it.
|
|
15
|
+
- When a skill needs another one, its body points at a file (for example `../tdd/SKILL.md`) that you can read directly. Reading such a file is not invoking the skill; it is following the instructions already in front of you.
|
|
16
|
+
- Before describing what a skill does or recommending that a step be skipped, read that skill's `SKILL.md`. The summaries here are for orientation only.
|
|
17
|
+
|
|
18
|
+
A **flow** is a path through the skills. Most paths run along one **main flow**, and a few **on-ramps** merge onto it.
|
|
19
|
+
|
|
20
|
+
## The main flow: idea → ship
|
|
21
|
+
|
|
22
|
+
1. **`/grilling`** sharpens the idea by interview. With `--docs` it is stateful: decisions land in `GLOSSARY.md` and ADRs as you go. Use `--docs` whenever there is a working directory to leave a paper trail in; use the plain mode for a plan, a design, or a piece of writing with no repo under it.
|
|
23
|
+
2. **Branch: can you settle every question in conversation?** If a question needs a runnable answer (state, business logic, a UI you have to see), detour through a prototype:
|
|
24
|
+
- **`/handoff`** out, then open a fresh session against that file,
|
|
25
|
+
- **`/prototype`** to answer the question with throwaway code,
|
|
26
|
+
- **`/handoff`** back what you learned, and reference it from the original idea thread.
|
|
27
|
+
3. **Branch: is this a multi-session build?**
|
|
28
|
+
- **Yes** → **`/to-spec`** (turn the thread into a spec), then **`/to-tickets`** to split it into tracer-bullet tickets, each declaring its **blocking edges**.
|
|
29
|
+
- **No** → **`/implement`** right here, in the same context window.
|
|
30
|
+
4. **`/implement`** does the build either way, in one of its two shapes: hand it a spec and it treats the tickets as a **task graph**, running implementer subagents across the ready **frontier** in parallel and landing everything on one **integration branch**; hand it a single ticket and it builds that on the current branch. Both drive `/tdd` (one red-green slice at a time) and close with `/code-review`.
|
|
31
|
+
5. **`/pr`** shapes the body when the work goes up as a pull request: the smallest visual that shows the change, before/after evidence that it works, and a one-way or two-way door call.
|
|
32
|
+
6. **`/retro`** closes the loop. It looks back over the session and suggests changes to the agent's **environment**, not the code: navigation pointers, automated checks, the coding standards `/code-review` enforces, steering files, tooling. Mechanical mistakes become deterministic checks; judgement calls become coding standards.
|
|
33
|
+
|
|
34
|
+
Reach for **`/tdd`** on its own when you just want to build one concrete behaviour test-first without a spec, and **`/code-review`** on its own whenever you want a branch or PR reviewed against a fixed point.
|
|
35
|
+
|
|
36
|
+
### Context hygiene
|
|
37
|
+
|
|
38
|
+
Keep the grilling, the spec, and the tickets in **one unbroken context window** so they build on the same thinking. Each `/implement` then starts fresh from the ticket. Run `/retro` in the session it looks back on, before you clear.
|
|
39
|
+
|
|
40
|
+
The limit is the window in which the model still reasons sharply (roughly 150k tokens for current models). If a session approaches it before `/to-tickets`, do not push on degraded: compact or split at the nearest phase boundary and carry on.
|
|
41
|
+
|
|
42
|
+
## On-ramps
|
|
43
|
+
|
|
44
|
+
A starting situation that generates work, then merges onto the main flow.
|
|
45
|
+
|
|
46
|
+
- **Bugs and requests piling up** → **`/triage`**. It moves issues through triage roles and produces agent-ready issues, which `/implement` later picks up. Triage is only for issues **you didn't create**: bug reports, incoming requests, anything that arrives raw. Tickets that `/to-tickets` produced are already agent-ready, so don't triage them.
|
|
47
|
+
- **Something's broken** → **`/diagnosing-bugs`**. For the hard ones: the bug that resists a first glance, the intermittent flake, the regression that crept in between two known-good states. It refuses to theorise until it has a **tight feedback loop** (one command that already goes red on *this* bug), then fixes with a regression test. After the fix, run `/retro` to ask what would have prevented it; if the real finding is that there is no good seam to lock it down, that is a job for `/improve-codebase-architecture`.
|
|
48
|
+
- **A huge, foggy effort, too big for one session** → **`/wayfinder`**, the most cognitively demanding flow here. When the way from here to the destination isn't visible yet, it charts a **shared map** of decision tickets and resolves them one at a time, producing **decisions, not deliverables**, until the fog clears. Where `/grilling --docs` sharpens an idea you can hold in one session, wayfinder is for the idea you can't: slower and denser, so never use it on a well-scoped feature. When the map clears it **hands off, it doesn't build**: merge back into the main flow at `/to-spec`.
|
|
49
|
+
- **You have a spare moment to keep the codebase healthy** → **`/improve-codebase-architecture`**. It surveys for **deepening opportunities** and presents them as a visual report; picking one generates an idea you take back to `/grilling --docs`.
|
|
50
|
+
|
|
51
|
+
## Vocabulary underneath
|
|
52
|
+
|
|
53
|
+
Two references that run *beneath* the other skills, each the single source of truth for its vocabulary. Reach for them directly when the **words**, not the process, are the problem, or follow them when a skill above points at them.
|
|
54
|
+
|
|
55
|
+
- **`/domain-modeling`**: sharpen the project's *domain* language: challenge a fuzzy term, resolve an overloaded word ("account" doing three jobs), record a hard-to-reverse decision as an ADR. This is the discipline `/grilling --docs` drives to keep `GLOSSARY.md` a clean glossary.
|
|
56
|
+
- **`/codebase-design`**: the deep-module vocabulary (module, interface, depth, seam, adapter, leverage, locality) for designing a module's *shape*: a lot of behaviour behind a small interface at a clean seam. `/tdd` and `/improve-codebase-architecture` both speak it.
|
|
57
|
+
|
|
58
|
+
## Phase boundaries
|
|
59
|
+
|
|
60
|
+
A **phase** is a chunk of work inside a session: the grilling, the implementation, the QA. At the boundary between two of them you have five options, and picking between them is the fuzziest decision in this whole map: **continue**, **clear** the window, **`/handoff`** a portable file, send a **subagent**, or **compact**. Read [PHASE-BOUNDARIES.md](PHASE-BOUNDARIES.md) for the ordered tree, the reasoning behind each branch, and why "Continue" is the one to rule out first. `/handoff` is narrow: a new harness, a new directory, a colleague, or forking a side task mid-phase. What it buys is portability.
|
|
61
|
+
|
|
62
|
+
## Standalone
|
|
63
|
+
|
|
64
|
+
Off the main flow entirely.
|
|
65
|
+
|
|
66
|
+
- **`/research`**: delegate reading legwork to a background agent. It investigates against **primary sources**, then leaves a cited Markdown file in the repo. Keep working while it reads. Research feeds thinking rather than replacing it, so take its file into `/grilling --docs`.
|
|
67
|
+
- **`/prototype`**: a small, throwaway program that answers one design question: does this state model feel right, or what should this UI look like. Throwaway is a constraint on how the code is written, not a promise to destroy it: the answer folds into the real code, and the prototype itself is kept as a **primary source** on a `prototype/<name>` branch, pointed at from the implementation issue.
|
|
68
|
+
- **`/wizard`**: for the steps only a **human** can take: provisioning infrastructure, setting up credentials or CI secrets, clicking through an unfamiliar dashboard, running a one-off migration. It generates an interactive bash script that opens each URL, captures each value, and writes it into `.env` and secrets, so the procedure stops being something you re-explain every time. If you could just do it yourself, do it yourself; this is for where a human is genuinely in the loop.
|
|
69
|
+
- **`/to-questionnaire`**: when the thing blocking you isn't in your head or the codebase but in **someone else's**. It writes them a questionnaire to fill in, interviewing you about the **send** (who it goes to, what you need back) and aiming the questions at the gap. What comes back is material for `/grilling --docs` or `/to-spec`.
|
|
70
|
+
- **`/wait-what`**: the corrective for a message that didn't land. Use it mid-conversation, inside any other skill, and the agent re-pitches what it just said with the context you were missing, in plain English, using the `GLOSSARY.md` vocabulary.
|
|
71
|
+
- **`/teach`**: learn a concept over multiple sessions, using the current directory as a stateful workspace.
|
|
72
|
+
- **`/writing-for-agents`**: the reference for writing documents agents consume: skills, AGENTS.md, pointed-at docs.
|
|
73
|
+
- **`/writing-fragments`** → **`/writing-beats`** or **`/writing-shape`**: writing a long piece. Fragments is explore (mine raw material, no structure). Beats is exploit as a choose-your-own-adventure journey; shape is exploit as a thesis-driven article grown paragraph by paragraph. Both read `../_shared/WRITING-MECHANICS.md` for the grounding accounting they share.
|
|
74
|
+
- **`/loop-me`**: `/grilling` aimed at **workflow** specs, with its own vocabulary and definition of done.
|
|
75
|
+
- **`/software-factory`**: the shared language for designing a system of agents that turns tickets, PRs, and schedules into merged code. Vocabulary, not a process.
|
|
76
|
+
- **`/chief-of-staff`** and **`/setup-ts-deep-modules`**: the two heavier in-progress skills. Chief-of-staff pursues a long-running goal in one session by co-ordinating subagents; setup-ts-deep-modules wires dependency-cruiser into a TypeScript repo so each package is a deep module.
|
|
77
|
+
|
|
78
|
+
## Precondition
|
|
79
|
+
|
|
80
|
+
**`/setup-matt-pocock-skills`**: run before your first engineering flow to configure the issue tracker, triage labels, and doc layout the other skills assume. Custom issue trackers also work.
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: chief-of-staff
|
|
3
|
+
description: Pursue a long-running goal in a single session by co-ordinating subagents.
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
user-invocable: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
You are a chief of staff, co-ordinating subagents and schedules to pursue a long-running goal. This session will run for a long time, accruing tribal knowledge and helping you make long-term strategic decisions.
|
|
9
|
+
|
|
10
|
+
You are the Directly Responsible Individual for this goal. You are empowered to think much longer-term than you're used to. You must think on two tracks simultaneously:
|
|
11
|
+
|
|
12
|
+
- Tactical: how do I complete the immediate task?
|
|
13
|
+
- Strategic: how do I modify the environment to improve the outcomes of the _next_ task?
|
|
14
|
+
|
|
15
|
+
## Schedules
|
|
16
|
+
|
|
17
|
+
Harness-permitting, you will suggest recurring schedules which can help in achieving the goal.
|
|
18
|
+
|
|
19
|
+
## Subagents
|
|
20
|
+
|
|
21
|
+
All work should be done in subagents. Protect your context window.
|
|
22
|
+
|
|
23
|
+
Use background agents so you can stay in active dialogue with the user. Start every subagent with a fresh context window.
|
|
24
|
+
|
|
25
|
+
Communication to and from subagents should be sparse. Communicate primarily through **context pointers**: research notes, previous commits, wiki pages, and others. Don't duplicate information already available via pointers.
|
|
26
|
+
|
|
27
|
+
## Wiki
|
|
28
|
+
|
|
29
|
+
Keep your memory in a **wiki**: a folder of interlinked markdown pages that outlives this session. Tribal knowledge that lives only in your context is lost at compaction; the wiki is how it reaches the next session. Look for a shared wiki first, one the user or other agents already keep, and write your pages into it, following its conventions where they differ from the ones below. Only if there is none, agree a location with the user before the first write.
|
|
30
|
+
|
|
31
|
+
- `index.md` lists every page with a link and a one-line summary, grouped by category.
|
|
32
|
+
- Each other page covers one thing: a decision, a recurring problem, a subsystem, a user preference. Link related pages to each other.
|
|
33
|
+
- Sources (issues, PRs, transcripts, subagent reports) are never copied in or edited. Pages cite them.
|
|
34
|
+
|
|
35
|
+
Three operations keep it alive:
|
|
36
|
+
|
|
37
|
+
- **Ingest.** When you learn something durable (a decision, a user correction, a subagent's finding), update every page it touches and the index, not only a new page.
|
|
38
|
+
- **Query.** Before a decision, read `index.md` and the pages it points to. If the answer you build is worth keeping, file it as a page.
|
|
39
|
+
- **Lint.** Periodically look for contradictions, orphan pages, missing links and claims newer sources have overtaken. Suggest this as a schedule.
|
|
40
|
+
|
|
41
|
+
### Write history, not the present
|
|
42
|
+
|
|
43
|
+
The wiki is a historical record. It never claims to describe how things are now, because it cannot keep up with the code.
|
|
44
|
+
|
|
45
|
+
- Date every claim: "On 2026-10-13, Matt decided..."
|
|
46
|
+
- When a claim concerns code, cite the commit it was true at, with its repo: "As of `mattpocock/skills@abc1234`, `retro` loads `writing-for-agents` in step 1."
|
|
47
|
+
- Never write "currently", "now" or "is" about code without a date or commit beside it.
|
|
48
|
+
- When something changes, add a new dated claim and mark the old one superseded. Don't rewrite the old one.
|
|
49
|
+
|
|
50
|
+
## Procedures
|
|
51
|
+
|
|
52
|
+
Some procedures you run live in other skills, installed beside this one. To run one, read its `SKILL.md` at the path below, relative to this skill's directory, and follow it.
|
|
53
|
+
|
|
54
|
+
- **Retro** (`../retro/SKILL.md`): run a retro on about one in five of your subagents' sessions, including those an `implement` run dispatches. Pick first the ones where something went wrong. In place of retro's last step, decide yourself which candidates are worth pursuing, then pursue them.
|
|
55
|
+
- **Large chunks of work**: write a spec with `../to-spec/SKILL.md`, break it into tickets with `../to-tickets/SKILL.md`, publish both to the issue tracker, then implement them with `../implement/SKILL.md`.
|
|
56
|
+
|
|
57
|
+
## Strategic View
|
|
58
|
+
|
|
59
|
+
As part of any and all work, FIRST consider how the environment the agents operate in might be improved. Agents thrive in the **pit of success**:
|
|
60
|
+
|
|
61
|
+
- API's and functions which are extremely constrained and limited
|
|
62
|
+
- Lint rules which force correctness
|
|
63
|
+
- CODING_STANDARDS.md files which let code reviewers enforce best practices
|
|
64
|
+
|
|
65
|
+
They also need relevant **data sources** to succeed:
|
|
66
|
+
|
|
67
|
+
- Logs from critical running processes, like dev servers (or production logs)
|
|
68
|
+
- Access to test environment databases
|
|
69
|
+
- Access to the browser (when necessary) for clicking around and taking screenshots
|
|
70
|
+
|
|
71
|
+
Finally, create environments (and codebases) that obey the **"no workarounds"** rule:
|
|
72
|
+
|
|
73
|
+
- No one-off workarounds, or hacks that bypass established processes
|
|
74
|
+
- Any deviations from conventions must be fixed proactively, before feature work is done
|
|
75
|
+
|
|
76
|
+
Be relentless in improving the environment. Use every user message as an excuse to search for these improvements.
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-review
|
|
3
|
+
description: "Review the changes since a fixed point (commit, branch, tag, or merge-base) along two axes: Standards (does the code follow this repo's documented coding standards?) and Spec (does the code match what the originating issue/spec asked for?). Runs both reviews in parallel sub-agents and reports them side by side. Use when the user wants to review a branch, a PR, work-in-progress changes, or asks to \"review since X\"."
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
user-invocable: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Two-axis review of the diff between `HEAD` and a fixed point the user supplies:
|
|
9
|
+
|
|
10
|
+
- **Standards**: does the code conform to this repo's documented coding standards?
|
|
11
|
+
- **Spec**: does the code faithfully implement the originating issue / spec?
|
|
12
|
+
|
|
13
|
+
Both axes run as **parallel sub-agents** so they don't pollute each other's context, then this skill aggregates their findings. Start every sub-agent with a fresh context window.
|
|
14
|
+
|
|
15
|
+
The issue tracker should have been provided to you. If not, tell the user to run `/setup-matt-pocock-skills`.
|
|
16
|
+
|
|
17
|
+
## Process
|
|
18
|
+
|
|
19
|
+
### 1. Pin the fixed point
|
|
20
|
+
|
|
21
|
+
Whatever the user said is the fixed point (a commit SHA, branch name, tag, `main`, `HEAD~5`, etc.). If they didn't specify one, ask for it.
|
|
22
|
+
|
|
23
|
+
Capture the diff command once: `git diff <fixed-point>...HEAD` (three-dot, so the comparison is against the merge-base). Also note the list of commits via `git log <fixed-point>..HEAD --oneline`.
|
|
24
|
+
|
|
25
|
+
Before going further, confirm the fixed point resolves (`git rev-parse <fixed-point>`) and the diff is non-empty. A bad ref or empty diff should fail here, not inside two parallel sub-agents.
|
|
26
|
+
|
|
27
|
+
### 2. Identify the spec source
|
|
28
|
+
|
|
29
|
+
Look for the originating spec, in this order:
|
|
30
|
+
|
|
31
|
+
1. Issue references in the commit messages (`#123`, `Closes #45`, GitLab `!67`, etc.), fetched via the workflow in the tracker doc.
|
|
32
|
+
2. A path the user passed as an argument.
|
|
33
|
+
3. A spec file under `docs/`, `specs/`, or `.scratch/` matching the branch name or feature.
|
|
34
|
+
4. If nothing is found, ask the user where the spec is. If they say there isn't one, the **Spec** sub-agent will skip and report "no spec available".
|
|
35
|
+
|
|
36
|
+
### 3. Identify the standards sources
|
|
37
|
+
|
|
38
|
+
Search the repo for every file that documents how code should be written. When `CODING_STANDARDS.md` or `CONTRIBUTING.md` exists, it must be on the list.
|
|
39
|
+
|
|
40
|
+
On top of whatever the repo documents, the Standards axis always carries the **smell baseline** below: a fixed set of Fowler code smells (_Refactoring_, ch.3) that applies even when a repo documents nothing. Two rules bind it:
|
|
41
|
+
|
|
42
|
+
- **The repo overrides.** A documented repo standard always wins; where it endorses something the baseline would flag, suppress the smell.
|
|
43
|
+
- **Always a judgement call.** Each smell is a labelled heuristic ("possible Feature Envy"), never a hard violation. Like any standard here, skip anything tooling already enforces.
|
|
44
|
+
|
|
45
|
+
Each smell reads *what it is* → *how to fix*; match it against the diff:
|
|
46
|
+
|
|
47
|
+
- **Mysterious Name**: a function, variable, or type whose name doesn't reveal what it does or holds. → rename it; if no honest name comes, the design's murky.
|
|
48
|
+
- **Duplicated Code**: the same logic shape appears in more than one hunk or file in the change. → extract the shared shape, call it from both.
|
|
49
|
+
- **Feature Envy**: a method that reaches into another object's data more than its own. → move the method onto the data it envies.
|
|
50
|
+
- **Data Clumps**: the same few fields or params keep travelling together (a type wanting to be born). → bundle them into one type, pass that.
|
|
51
|
+
- **Primitive Obsession**: a primitive or string standing in for a domain concept that deserves its own type. → give the concept its own small type.
|
|
52
|
+
- **Repeated Switches**: the same `switch`/`if`-cascade on the same type recurs across the change. → replace with polymorphism, or one map both sites share.
|
|
53
|
+
- **Shotgun Surgery**: one logical change forces scattered edits across many files in the diff. → gather what changes together into one module.
|
|
54
|
+
- **Divergent Change**: one file or module is edited for several unrelated reasons. → split so each module changes for one reason.
|
|
55
|
+
- **Speculative Generality**: abstraction, parameters, or hooks added for needs the spec doesn't have. → delete it; inline back until a real need shows.
|
|
56
|
+
- **Message Chains**: long `a.b().c().d()` navigation the caller shouldn't depend on. → hide the walk behind one method on the first object.
|
|
57
|
+
- **Middle Man**: a class or function that mostly just delegates onward. → cut it, call the real target direct.
|
|
58
|
+
- **Refused Bequest**: a subclass or implementer that ignores or overrides most of what it inherits. → drop the inheritance, use composition.
|
|
59
|
+
|
|
60
|
+
### 4. Spawn both sub-agents in parallel
|
|
61
|
+
|
|
62
|
+
Issue both sub-agent calls together, in the foreground, and aggregate the reports they return.
|
|
63
|
+
|
|
64
|
+
**Standards sub-agent prompt** should include:
|
|
65
|
+
|
|
66
|
+
- The full diff command and commit list.
|
|
67
|
+
- The list of standards-source files you found in step 3, **plus the smell baseline from step 3** pasted in full (the sub-agent has no other access to it).
|
|
68
|
+
- The brief: "Report, per file/hunk where relevant, (a) every place the diff violates a documented standard: cite the standard (file + the rule); and (b) any baseline smell you spot: name it and quote the hunk. Distinguish hard violations from judgement calls: documented-standard breaches can be hard, but baseline smells are always judgement calls, and a documented repo standard overrides the baseline. Skip anything tooling enforces. Under 400 words."
|
|
69
|
+
|
|
70
|
+
**Spec sub-agent prompt** should include:
|
|
71
|
+
|
|
72
|
+
- The diff command and commit list.
|
|
73
|
+
- The path or fetched contents of the spec.
|
|
74
|
+
- The brief: "Report: (a) requirements the spec asked for that are missing or partial; (b) behaviour in the diff that wasn't asked for (scope creep); (c) requirements that look implemented but where the implementation looks wrong. Quote the spec line for each finding. Under 400 words."
|
|
75
|
+
|
|
76
|
+
If the spec is missing, skip the Spec sub-agent and note this in the final report.
|
|
77
|
+
|
|
78
|
+
### 5. Aggregate
|
|
79
|
+
|
|
80
|
+
Present the two reports under `## Standards` and `## Spec` headings, verbatim or lightly cleaned. Do **not** merge or rerank findings, because the two axes are deliberately separate (see _Why two axes_).
|
|
81
|
+
|
|
82
|
+
End with a one-line summary: total findings per axis, and the worst issue _within each axis_ (if any). Don't pick a single winner across axes: that's the reranking the separation exists to prevent.
|
|
83
|
+
|
|
84
|
+
## Why two axes
|
|
85
|
+
|
|
86
|
+
A change can pass one axis and fail the other:
|
|
87
|
+
|
|
88
|
+
- Code that follows every standard but implements the wrong thing → **Standards pass, Spec fail.**
|
|
89
|
+
- Code that does exactly what the issue asked but breaks the project's conventions → **Spec pass, Standards fail.**
|
|
90
|
+
|
|
91
|
+
Reporting them separately stops one axis from masking the other.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Deepening
|
|
2
|
+
|
|
3
|
+
How to deepen a cluster of shallow modules safely, given its dependencies. Assumes the vocabulary in [SKILL.md](SKILL.md): **module**, **interface**, **seam**, **adapter**.
|
|
4
|
+
|
|
5
|
+
## Dependency categories
|
|
6
|
+
|
|
7
|
+
When assessing a candidate for deepening, classify its dependencies. The category determines how the deepened module is tested across its seam.
|
|
8
|
+
|
|
9
|
+
### 1. In-process
|
|
10
|
+
|
|
11
|
+
Pure computation, in-memory state, no I/O. Always deepenable: merge the modules and test through the new interface directly. No adapter needed.
|
|
12
|
+
|
|
13
|
+
### 2. Local-substitutable
|
|
14
|
+
|
|
15
|
+
Dependencies that have local test stand-ins (PGLite for Postgres, in-memory filesystem). Deepenable if the stand-in exists. The deepened module is tested with the stand-in running in the test suite. The seam is internal; no port at the module's external interface.
|
|
16
|
+
|
|
17
|
+
### 3. Remote but owned (Ports & Adapters)
|
|
18
|
+
|
|
19
|
+
Your own services across a network boundary (microservices, internal APIs). Define a **port** (interface) at the seam. The deep module owns the logic; the transport is injected as an **adapter**. Tests use an in-memory adapter. Production uses an HTTP/gRPC/queue adapter.
|
|
20
|
+
|
|
21
|
+
Recommendation shape: *"Define a port at the seam, implement an HTTP adapter for production and an in-memory adapter for testing, so the logic sits in one deep module even though it's deployed across a network."*
|
|
22
|
+
|
|
23
|
+
### 4. True external (Mock)
|
|
24
|
+
|
|
25
|
+
Third-party services (Stripe, Twilio, etc.) you don't control. The deepened module takes the external dependency as an injected port; tests provide a mock adapter.
|
|
26
|
+
|
|
27
|
+
## Seam discipline
|
|
28
|
+
|
|
29
|
+
- **One adapter means a hypothetical seam. Two adapters means a real one.** Don't introduce a port unless at least two adapters are justified (typically production + test). A single-adapter seam is just indirection.
|
|
30
|
+
- **Internal seams vs external seams.** A deep module can have internal seams (private to its implementation, used by its own tests) as well as the external seam at its interface. Don't expose internal seams through the interface just because tests use them.
|
|
31
|
+
|
|
32
|
+
## Testing strategy: replace, don't layer
|
|
33
|
+
|
|
34
|
+
- Old unit tests on shallow modules become waste once tests at the deepened module's interface exist; delete them.
|
|
35
|
+
- Write new tests at the deepened module's interface. The **interface is the test surface**.
|
|
36
|
+
- Tests assert on observable outcomes through the interface, not internal state.
|
|
37
|
+
- Tests should survive internal refactors, since they describe behaviour, not implementation. If a test has to change when the implementation changes, it's testing past the interface.
|