@fractalsynapse/dsh-chapters 0.0.0-stage → 0.2.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/LICENSE +14 -0
  2. package/README.md +76 -2
  3. package/cordis.patch.yml +363 -0
  4. package/docs/architecture.md +692 -0
  5. package/docs/autorun-guide.md +248 -0
  6. package/docs/backlog.md +2022 -0
  7. package/docs/contract.md +938 -0
  8. package/docs/development.md +990 -0
  9. package/docs/host-compaction-seam.md +225 -0
  10. package/docs/host-protected-head-ask.md +80 -0
  11. package/docs/knowledge-repo.md +1332 -0
  12. package/docs/plans-carriage.md +571 -0
  13. package/docs/project-state.md +642 -0
  14. package/docs/provider.md +98 -0
  15. package/docs/superpowers/plans/2026-10-17-chapters-save.md +198 -0
  16. package/docs/superpowers/plans/2026-11-02-chapter-removal.md +151 -0
  17. package/docs/superpowers/specs/2026-11-02-chapter-removal-design.md +115 -0
  18. package/docs/verify.md +561 -0
  19. package/lib/archive.d.ts +161 -0
  20. package/lib/archive.js +229 -0
  21. package/lib/archive.js.map +1 -0
  22. package/lib/arrival.d.ts +23 -0
  23. package/lib/arrival.js +125 -0
  24. package/lib/arrival.js.map +1 -0
  25. package/lib/artifact-query.d.ts +62 -0
  26. package/lib/artifact-query.js +187 -0
  27. package/lib/artifact-query.js.map +1 -0
  28. package/lib/attach.d.ts +46 -0
  29. package/lib/attach.js +120 -0
  30. package/lib/attach.js.map +1 -0
  31. package/lib/auto-save.d.ts +145 -0
  32. package/lib/auto-save.js +334 -0
  33. package/lib/auto-save.js.map +1 -0
  34. package/lib/aux-message.d.ts +17 -0
  35. package/lib/aux-message.js +20 -0
  36. package/lib/aux-message.js.map +1 -0
  37. package/lib/client.js +1419 -0
  38. package/lib/client.js.map +1 -0
  39. package/lib/codegraph.d.ts +76 -0
  40. package/lib/codegraph.js +190 -0
  41. package/lib/codegraph.js.map +1 -0
  42. package/lib/commands.d.ts +52 -0
  43. package/lib/commands.js +946 -0
  44. package/lib/commands.js.map +1 -0
  45. package/lib/compose.d.ts +30 -0
  46. package/lib/compose.js +185 -0
  47. package/lib/compose.js.map +1 -0
  48. package/lib/continue-core.d.ts +245 -0
  49. package/lib/continue-core.js +405 -0
  50. package/lib/continue-core.js.map +1 -0
  51. package/lib/diag.d.ts +55 -0
  52. package/lib/diag.js +186 -0
  53. package/lib/diag.js.map +1 -0
  54. package/lib/engine-core.d.ts +301 -0
  55. package/lib/engine-core.js +531 -0
  56. package/lib/engine-core.js.map +1 -0
  57. package/lib/engine-note.d.ts +35 -0
  58. package/lib/engine-note.js +32 -0
  59. package/lib/engine-note.js.map +1 -0
  60. package/lib/engine.d.ts +329 -0
  61. package/lib/engine.js +1179 -0
  62. package/lib/engine.js.map +1 -0
  63. package/lib/enrich-queue.d.ts +66 -0
  64. package/lib/enrich-queue.js +126 -0
  65. package/lib/enrich-queue.js.map +1 -0
  66. package/lib/enrich-store.d.ts +31 -0
  67. package/lib/enrich-store.js +103 -0
  68. package/lib/enrich-store.js.map +1 -0
  69. package/lib/enrich-wire.d.ts +163 -0
  70. package/lib/enrich-wire.js +353 -0
  71. package/lib/enrich-wire.js.map +1 -0
  72. package/lib/enrich.d.ts +102 -0
  73. package/lib/enrich.js +267 -0
  74. package/lib/enrich.js.map +1 -0
  75. package/lib/gitops.d.ts +107 -0
  76. package/lib/gitops.js +539 -0
  77. package/lib/gitops.js.map +1 -0
  78. package/lib/index.d.ts +241 -0
  79. package/lib/index.js +1162 -0
  80. package/lib/index.js.map +1 -0
  81. package/lib/indexing.d.ts +98 -0
  82. package/lib/indexing.js +223 -0
  83. package/lib/indexing.js.map +1 -0
  84. package/lib/injections.d.ts +90 -0
  85. package/lib/injections.js +165 -0
  86. package/lib/injections.js.map +1 -0
  87. package/lib/last-resort.d.ts +24 -0
  88. package/lib/last-resort.js +27 -0
  89. package/lib/last-resort.js.map +1 -0
  90. package/lib/log-shape.d.ts +38 -0
  91. package/lib/log-shape.js +93 -0
  92. package/lib/log-shape.js.map +1 -0
  93. package/lib/models-command.d.ts +74 -0
  94. package/lib/models-command.js +100 -0
  95. package/lib/models-command.js.map +1 -0
  96. package/lib/notice.d.ts +74 -0
  97. package/lib/notice.js +92 -0
  98. package/lib/notice.js.map +1 -0
  99. package/lib/plans.d.ts +154 -0
  100. package/lib/plans.js +315 -0
  101. package/lib/plans.js.map +1 -0
  102. package/lib/preset.d.ts +186 -0
  103. package/lib/preset.js +212 -0
  104. package/lib/preset.js.map +1 -0
  105. package/lib/prompt-keys.d.ts +7 -0
  106. package/lib/prompt-keys.js +8 -0
  107. package/lib/prompt-keys.js.map +1 -0
  108. package/lib/prompt-loop.d.ts +73 -0
  109. package/lib/prompt-loop.js +147 -0
  110. package/lib/prompt-loop.js.map +1 -0
  111. package/lib/prompt-push.d.ts +47 -0
  112. package/lib/prompt-push.js +115 -0
  113. package/lib/prompt-push.js.map +1 -0
  114. package/lib/prompt-runner.d.ts +48 -0
  115. package/lib/prompt-runner.js +90 -0
  116. package/lib/prompt-runner.js.map +1 -0
  117. package/lib/prompt-state.d.ts +142 -0
  118. package/lib/prompt-state.js +101 -0
  119. package/lib/prompt-state.js.map +1 -0
  120. package/lib/prompt.d.ts +270 -0
  121. package/lib/prompt.js +408 -0
  122. package/lib/prompt.js.map +1 -0
  123. package/lib/provider.d.ts +44 -0
  124. package/lib/provider.js +66 -0
  125. package/lib/provider.js.map +1 -0
  126. package/lib/redact.d.ts +24 -0
  127. package/lib/redact.js +85 -0
  128. package/lib/redact.js.map +1 -0
  129. package/lib/registry.d.ts +187 -0
  130. package/lib/registry.js +235 -0
  131. package/lib/registry.js.map +1 -0
  132. package/lib/removal.d.ts +159 -0
  133. package/lib/removal.js +556 -0
  134. package/lib/removal.js.map +1 -0
  135. package/lib/render.d.ts +97 -0
  136. package/lib/render.js +530 -0
  137. package/lib/render.js.map +1 -0
  138. package/lib/repair-run.d.ts +76 -0
  139. package/lib/repair-run.js +506 -0
  140. package/lib/repair-run.js.map +1 -0
  141. package/lib/repair.d.ts +208 -0
  142. package/lib/repair.js +357 -0
  143. package/lib/repair.js.map +1 -0
  144. package/lib/repo.d.ts +78 -0
  145. package/lib/repo.js +184 -0
  146. package/lib/repo.js.map +1 -0
  147. package/lib/rules-commands.d.ts +46 -0
  148. package/lib/rules-commands.js +379 -0
  149. package/lib/rules-commands.js.map +1 -0
  150. package/lib/rules.d.ts +267 -0
  151. package/lib/rules.js +478 -0
  152. package/lib/rules.js.map +1 -0
  153. package/lib/save-core.d.ts +72 -0
  154. package/lib/save-core.js +220 -0
  155. package/lib/save-core.js.map +1 -0
  156. package/lib/search.d.ts +112 -0
  157. package/lib/search.js +282 -0
  158. package/lib/search.js.map +1 -0
  159. package/lib/session-rules.d.ts +222 -0
  160. package/lib/session-rules.js +454 -0
  161. package/lib/session-rules.js.map +1 -0
  162. package/lib/signature.d.ts +45 -0
  163. package/lib/signature.js +199 -0
  164. package/lib/signature.js.map +1 -0
  165. package/lib/store.d.ts +156 -0
  166. package/lib/store.js +368 -0
  167. package/lib/store.js.map +1 -0
  168. package/lib/sync.d.ts +220 -0
  169. package/lib/sync.js +810 -0
  170. package/lib/sync.js.map +1 -0
  171. package/lib/tools.d.ts +113 -0
  172. package/lib/tools.js +1090 -0
  173. package/lib/tools.js.map +1 -0
  174. package/lib/treedx/client.d.ts +57 -0
  175. package/lib/treedx/client.js +82 -0
  176. package/lib/treedx/client.js.map +1 -0
  177. package/lib/treedx/provider.d.ts +39 -0
  178. package/lib/treedx/provider.js +479 -0
  179. package/lib/treedx/provider.js.map +1 -0
  180. package/lib/treedx/state.d.ts +27 -0
  181. package/lib/treedx/state.js +65 -0
  182. package/lib/treedx/state.js.map +1 -0
  183. package/lib/types.d.ts +210 -0
  184. package/lib/types.js +31 -0
  185. package/lib/types.js.map +1 -0
  186. package/lib/version.d.ts +9 -0
  187. package/lib/version.js +10 -0
  188. package/lib/version.js.map +1 -0
  189. package/lib/vocabulary.d.ts +41 -0
  190. package/lib/vocabulary.js +118 -0
  191. package/lib/vocabulary.js.map +1 -0
  192. package/lib/warnings.d.ts +10 -0
  193. package/lib/warnings.js +18 -0
  194. package/lib/warnings.js.map +1 -0
  195. package/package.json +151 -3
package/LICENSE ADDED
@@ -0,0 +1,14 @@
1
+ Copyright 2026 Fractal Synapse Labs
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+
package/README.md CHANGED
@@ -1,3 +1,77 @@
1
- # Temporary Holding Version
1
+ # dsh-chapters
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ **Long memory for local AI: a [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)
4
+ plugin that archives agent conversations as verbatim chapters, continues sessions from a Table of
5
+ Contents at zero inference-token cost, and turns that archive into a shared, searchable knowledge
6
+ pool.** Published on npm as [`@fractalsynapse/dsh-chapters`](https://www.npmjs.com/package/@fractalsynapse/dsh-chapters);
7
+ source at [fractalsynapse/dsh-chapters](https://github.com/fractalsynapse/dsh-chapters).
8
+
9
+ > **All documentation lives on the documentation site — this README is a doorway, not a duplicate.**
10
+ > ### 📖 https://fractalsynapse.github.io/dsh-chapters/
11
+
12
+ ## Install (the whole setup)
13
+
14
+ ```bash
15
+ dsh plugin --profile web add @fractalsynapse/dsh-chapters # install into your harness profile
16
+ dsh plugin --profile web update @fractalsynapse/dsh-chapters # keep current — restart `dsh web` after
17
+ ```
18
+
19
+ `--profile <name>` is required on every `dsh plugin` command (`web` = the browser harness profile).
20
+ After restart you have the fork button, seven agent tools, twelve `/chapters-*` commands (through
21
+ `0.2.17`, including `/chapters-remove`) — and the optional `chapters` preset that routes `/compact`
22
+ through the zero-token engine.
23
+
24
+ ## Find the right page for your question
25
+
26
+ | You want to… | Go to |
27
+ |---|---|
28
+ | understand what this is / why (the ten benefits) | [Home → “What it gives you”](https://fractalsynapse.github.io/dsh-chapters/) |
29
+ | install, upgrade, uninstall, verify provenance | [§23 Install, upgrade, provenance](https://fractalsynapse.github.io/dsh-chapters/operations/install/) |
30
+ | run your first compaction/continuation | [§1 Quickstart](https://fractalsynapse.github.io/dsh-chapters/start/quickstart/) → [§2 Your first continuation](https://fractalsynapse.github.io/dsh-chapters/start/first-continuation/) |
31
+ | link a shared knowledge pool (git or TreeDX) | [§3 Link a knowledge pool](https://fractalsynapse.github.io/dsh-chapters/start/link-pool/) · [§10 The pool](https://fractalsynapse.github.io/dsh-chapters/knowledge/pool/) |
32
+ | run any command — exact syntax, scope, outputs | [§15 Commands](https://fractalsynapse.github.io/dsh-chapters/reference/commands/) |
33
+ | delete a bad chapter (the wrong-project prompt) | [§15 Commands → `/chapters-remove`](https://fractalsynapse.github.io/dsh-chapters/reference/commands/#chapters-remove--delete-a-bad-chapter-for-real) |
34
+ | know what the agent-facing tools do | [§16 Agent tools](https://fractalsynapse.github.io/dsh-chapters/reference/tools/) |
35
+ | tune a threshold, budget, or trigger | [§17 Configuration](https://fractalsynapse.github.io/dsh-chapters/reference/configuration/) |
36
+ | understand *why not summaries* / the economics | [§5 Why not summaries?](https://fractalsynapse.github.io/dsh-chapters/concepts/why-not-summaries/) |
37
+ | read the design rules the system won't break | [§6 The four invariants](https://fractalsynapse.github.io/dsh-chapters/concepts/invariants/) |
38
+ | the theory behind retrieval-over-compression (RLM) | [§8 Recursive context theory](https://fractalsynapse.github.io/dsh-chapters/concepts/recursive-context/) |
39
+ | propose/approve rules for agents | [§13 Rules & governance](https://fractalsynapse.github.io/dsh-chapters/knowledge/rules/) |
40
+ | let a second model propose your next prompt | [§28 Prompt recommendations](https://fractalsynapse.github.io/dsh-chapters/concepts/prompt-recommendations/) |
41
+ | debug something (“seems broken, is it?”) | [§4 FAQ & troubleshooting](https://fractalsynapse.github.io/dsh-chapters/start/faq/) |
42
+ | prompt-cache / llama.cpp behavior | [§21 Cache behavior on llama.cpp](https://fractalsynapse.github.io/dsh-chapters/evidence/llamacpp-cache/) |
43
+ | see measured results (production run + benchmarks) | [§19 Benchmarks](https://fractalsynapse.github.io/dsh-chapters/evidence/benchmarks/) · [§20 Field study](https://fractalsynapse.github.io/dsh-chapters/evidence/field-study/) |
44
+ | compare with other memory approaches | [§22 The alternatives, compared](https://fractalsynapse.github.io/dsh-chapters/evidence/comparison/) |
45
+ | check security/privacy boundaries | [§27 Security & privacy](https://fractalsynapse.github.io/dsh-chapters/operations/security/) |
46
+ | release history & known-fixed incidents | [§26 Changelog](https://fractalsynapse.github.io/dsh-chapters/operations/changelog/) |
47
+ | **develop the plugin itself** | [§24 Developing](https://fractalsynapse.github.io/dsh-chapters/operations/development/) → the engineering specs below |
48
+
49
+ ## Developing / contributing
50
+
51
+ Three ways to set up a development environment — pick whichever fits your workflow:
52
+
53
+ | Mode | Best for | Command |
54
+ |------|----------|---------|
55
+ | **Centralized** (your live profile) | Day-to-day development on your main machine | `./dev/install/install.sh && dsh web` |
56
+ | **Compartmentalized** (isolated DSH_HOME) | Testing changes without touching your live sessions | `DSH_HOME=/tmp/dsh-dev ./dev/install/install.sh` |
57
+ | **Containerized** (full stack) | Isolated platform with vLLM + Playwright + Chromium | `cd dev/install && docker compose up -d` |
58
+
59
+ All three install the same plugin set: dsh-chapters, [dsh-codegraph](https://github.com/jiangzhenguo/dsh-codegraph)
60
+ (structural code search via pre-indexed AST graph), and dsh-tinyfish-search. Full details in
61
+ [`dev/install/README.md`](dev/install/README.md). The containerized stack additionally ships its own
62
+ vLLM model server (Qwen3-4B-AWQ with inference + systemone endpoints), a DSH Web UI service, and a
63
+ CI-capable test runner — everything runs locally with no external API keys required.
64
+
65
+ The site's Part VI covers the daily loop; the repository itself holds the engineering truth for agents:
66
+
67
+ - **[`AGENTS.md`](AGENTS.md)** — working spec for AI agents developing this repo (invariants, budget, hard rules)
68
+ - **[`docs/`](docs/)** — deep specs: `contract.md` (host API facts), `architecture.md` (mechanics), `development.md` (build/test loop + tape system), `verify.md` (every claim's procedure), `knowledge-repo.md` (design record), `host-compaction-seam.md`, `provider.md`
69
+ - **[`dev/install/`](dev/install/)** — installer, containerized platform, and local-llm skill
70
+ - **benchmarks**: `npm run bench` — three arms, local model, never CI ([protocol](benchmarks/README.md))
71
+
72
+ Feature requests and bugs: [open an issue](https://github.com/fractalsynapse/dsh-chapters/issues) —
73
+ measured reports get measured answers.
74
+
75
+ ## License
76
+
77
+ Apache-2.0 — see [LICENSE](LICENSE). Your conversations, chapters, and knowledge pools stay yours.
@@ -0,0 +1,363 @@
1
+ # dsh-chapters bundle patch — ACTIVE: package.json declares this file as the
2
+ # plugin's composition patch, applied when a profile adds the plugin. The YAML
3
+ # below the comment block is functional; everything in this comment is the
4
+ # complete configuration reference (kept in sync with src/index.ts and
5
+ # src/engine.ts — verified 2026-10-01 against both schemas, including the
6
+ # 2026-09-21 transport keys). The site's §17 (Configuration) is the readable
7
+ # authority; this header mirrors it.
8
+ # Scratch-profile install: DSH_HOME=$PWD/.dshdev dsh plugin --profile web add "link:$(pwd)"
9
+ #
10
+ # Two planes, two surfaces:
11
+ # HOST PLANE — the `config:` block below (defaults shown commented; set any
12
+ # under your profile's plugin entry).
13
+ # REALM PLANE — the compaction ENGINE row inside the preset's composition (the
14
+ # `preset-chapters` row at the foot of this file); shared names behave per
15
+ # plane. Design record: docs/knowledge-repo.md §12.
16
+ #
17
+ # PRESET DELIVERY — the preset is a DECLARATION ROW, exactly like the host's own presets.
18
+ # `preset-chapters` (the id is the host convention `preset-<id>`) is inserted by this
19
+ # file, its `config` IS the preset definition (`id/name/description/order/plugins`), and
20
+ # because it is an ordinary Loader entry you can see it in the plugin list and the config
21
+ # editor, override it from your profile patch, or `disabled: true` it.
22
+ # Its row module is ours — '@fractalsynapse/dsh-chapters/preset' (src/preset.ts) — not the
23
+ # host's '@deepseek-ai/dsh-agent-preset'. It mirrors that plugin line for line (injects
24
+ # `agentPresets`, preserves child `!!js` expressions, yields the registry disposer to
25
+ # Cordis) and adds one thing: rows this host cannot import are dropped at boot and NAMED,
26
+ # because a single unresolvable child row makes the WHOLE preset `broken` — which is the
27
+ # same user-visible failure as no preset at all (measured: `DECLARED BUT BROKEN —
28
+ # tool-schedule … never started` on a host where that package was never published). The
29
+ # host package cannot be named directly because a row that fails to import aborts the
30
+ # plugin tree of any host predating declaration rows; ours resolves everywhere our
31
+ # package runs. Support floor: 0.2.0.
32
+ # After activation the plugin then ASKS THE ROSTER, and the mounted rows: file presence
33
+ # is not preset existence, and "declared" is not "usable". The `dsh-chapters:` lines at
34
+ # startup say which of the four states you are in.
35
+ #
36
+ # config:
37
+ # # ---- identity -------------------------------------------------------
38
+ # installChaptersPreset: true # INERT since 0.1.18 — the preset is the `preset-chapters`
39
+ # # row above, so `disabled: true` on THAT row is the switch.
40
+ # # Kept so an existing profile patch still parses.
41
+ # compactionThresholdRatio: 0.9 # INERT since 0.1.18 for the same reason: it is
42
+ # # `thresholdRatio` on the preset's chapters-engine row now.
43
+ # # fallbackPreset: 'chapters' # preset mounted for children when the
44
+ # # caller's own preset cannot be resolved — and
45
+ # # the id the roster check looks for. This id is
46
+ # # DURABLE STATE: every child's log records it,
47
+ # # so renaming it orphans those sessions.
48
+ # harnessId: '<hostname>' # per-machine identity: git commit author,
49
+ # # token scoping, edits/<harness>/ curation
50
+ # # partition, rule-approval authorship
51
+ #
52
+ # # ---- stores ---------------------------------------------------------
53
+ # artifactStoreRoot: '.dsh-chapters' # workspace store: chapters, artifacts,
54
+ # # rules; must be reachable by `read`
55
+ #
56
+ # # ---- chapters & composition ----------------------------------------
57
+ # chapterTokenTarget: 8000 # soft per-chapter size target
58
+ # chapterLimit: 8000 # hard split threshold
59
+ # warningsDisplayCap: 6 # how many warning TEXTS a door prints before '…and M more' (#61).
60
+ # # The field failure was delivery: 86 warnings — naming a hollow
61
+ # # chapter and an unarchived 0-4082 hole — reached a human as
62
+ # # '(86 warning(s))'. A count is not a message.
63
+ # segmentCandidateCapTokens: 4000 # ceiling on chapters_segment's oversized-result candidate list (#61):
64
+ # # it emitted 49,932 chars while reporting 'Omitted 275266 bytes',
65
+ # # ~81K est tokens into a 32K window. Ranked by size DESC, so the cap
66
+ # # removes the small stuff, and the response names what was withheld.
67
+ # diagnosticsLog: '' # where door/child failures are appended (#61). Empty ⇒ the FIRST door
68
+ # # that touches a project resolves <store-root>/diagnostics.log;
69
+ # # DSH_CHAPTERS_ENGINE_ERRORS overrides it; the literal 'off' is the
70
+ # # only silence. Before this, unset meant NO TRACE ON DISK — the three
71
+ # # SAIP compaction finalization failures left none.
72
+ # childAutoArchive: true # the seventh archive moment (#61): a ch-* continuation child is not a
73
+ # # subagent, so door 5 never sees it. `ch-dc3be3ab` reached 2,363
74
+ # # events and 3 completed turns with chapters: [] — nothing failed,
75
+ # # NO MOMENT WAS WATCHING. Set false to close this door.
76
+ # childAutoArchiveMinTurns: 4 # after the first archive, how many unarchived completed turns re-arm it
77
+ # # (the first archive always fires: never-archived is the defect).
78
+ # chapterOversizeFactor: 2 # hard oversize multiple of chapterTokenTarget (#59): over the
79
+ # # TARGET warns ("split at the next boundary, never clip"), over
80
+ # # target × factor every door REFUSES with its numbers before
81
+ # # reserving one. The field shipped an 89,982-token chapter and a
82
+ # # 237,870-token orphan against an 8K target; a chapter nobody can
83
+ # # re-read is not an archive. 0/unset behaviour = warn only.
84
+ # mergeThreshold: 0.3 # τ for merging turns into one chapter at
85
+ # # archive time. Composition is archive-time
86
+ # # only: tune for future archives.
87
+ # subagentAutoSave: true # archive a subagent's completed turns into
88
+ # # searchable chapters when its run settles
89
+ # # (save-only: no session, no compaction;
90
+ # # enrichment queued, never per-child).
91
+ # # false = listener never registers.
92
+ #
93
+ # # ---- context economy -------------------------------------------------
94
+ # toolResultDeferFloorTokens: 200 # archive-time inline floor
95
+ # continuationBudgetRatio: 0.25 # notice+note allowance as share of
96
+ # # the window REMAINING AFTER the
97
+ # # header — never of the whole window.
98
+ # # Over budget = refuse with numbers.
99
+ # searchDefaultMaxTokens: 400 # chapters_search pack size
100
+ #
101
+ # # ---- knowledge sync --------------------------------------------------
102
+ # knowledgeRemote: '' # repo URL; '' = link via /chapters-link
103
+ # # (view | <path> | <url> <token>)
104
+ # projectKeyOverride: '' # wins over the remote-derived project key
105
+ # syncDebounceMs: 30000 # coalesce window for post-archive pushes
106
+ #
107
+ # # ---- P2 enrichment ---------------------------------------------------
108
+ # # The host plane is the COMMAND SURFACE (manual drains only); the realm
109
+ # # engine row owns the auto triggers — enrichmentTrigger exists on the row.
110
+ # enrichmentEnabled: true # kill switch: false = pure no-op everywhere,
111
+ # # corpus stays fully working (deterministic)
112
+ # enrichmentModel: '' # 'provider/model'; '' = conversation route.
113
+ # # /chapters-enrich model <x|clear> overrides
114
+ # enrichmentIdleMs: 60000 # idle trigger silence window (row value)
115
+ # enrichmentBatchCap: 5 # chapters per drain
116
+ #
117
+ # # ---- P2 vocabulary -----------------------------------------------------
118
+ # vocabApply: false # SHADOW by default: candidates are reported
119
+ # # in every sync status, nothing written;
120
+ # # true = git-visible topic-alias curation
121
+ # vocabCoMin: 3 # co-occurrences across chapters to trust
122
+ # vocabOverlapMin: 0.5 # label token-set Jaccard threshold
123
+ #
124
+ # # ---- P3 rules ----------------------------------------------------------
125
+ # coreRulesBudgetTokens: 1200 # cap on the notice's CORE RULES block;
126
+ # # overflow refuses with per-rule numbers —
127
+ # # the notice NEVER clips
128
+ # rulesCoreBonus: 0.15 # rank bonus for rules effective-core on
129
+ # # THIS machine (approval = per-machine
130
+ # # curation fact, record §15)
131
+ #
132
+ # # ---- prompt recommendations (#71, site §28) ----------------------------
133
+ # promptModel: '' # the model that DEFINES the next work.
134
+ # # '' ⇒ the feature does not exist (zero calls,
135
+ # # zero surface); setting one IS the enable.
136
+ # # Runtime: /chapters-prompt model <p/m|clear>
137
+ # promptContextChars: 4000 # hard budget on the assembled input slice
138
+ # # (chapter summaries + screened live tail)
139
+ # promptMaxChars: 240 # cap on the recommendation; over-cap ⇒ retry
140
+ # # once ⇒ refuse with numbers, never truncate
141
+ #
142
+ # # ---- transport (2026-09-21 provider-seam amendment) -------------------
143
+ # knowledgeProvider: 'auto' # 'auto' | 'git' | 'treedx'; 'auto' dispatches
144
+ # # on the remote scheme (treedx+ → TreeDX),
145
+ # # an explicit value must match the scheme or
146
+ # # the link refuses — never a silent fallback
147
+ # treedxFetchTimeoutMs: 15000 # TreeDX HTTP timeout per call
148
+ # treedxWorkspaceTtlSeconds: 900 # TreeDX workspace lease TTL
149
+ # treedxLeaseRetries: 3 # pull-retry budget when the lease is held
150
+ # treedxLeaseRetryDelayMs: 1000 # delay between lease retries
151
+ #
152
+ # Realm-row-only keys (in the preset's engine row, not this patch):
153
+ # harnessId, sessionRulesEnabled, rulesMarkerPrefix, coreRulesBudgetTokens,
154
+ # enrichmentMaxTokens (4000 — one auxiliary completion budget; sized to cover
155
+ # reasoning tokens, since the measured route reports reasoning inside completion usage
156
+ # and does not enforce max_tokens)
157
+ # rulesEnrichment (true — the ladder mines standing orders),
158
+ # rulesMinedPerChapter (3), rulesAutoActivate (true — mined inferences govern on
159
+ # arrival; false holds them for approve), rulesModel ('' — or a dedicated
160
+ # 'provider/model' for mining, one extra bounded call per chapter),
161
+ # projectRulesDisplayCap, sessionRulesDisplayCap, rulesRelevance (#50 §7/§7.5 —
162
+ # the realm plane owns what an in-place checkpoint renders; the host plugin config
163
+ # owns what a continuation notice renders; same names, same defaults, set both to
164
+ # diverge from the default)
165
+ # thresholdRatio, retainRatio, retainTokens, maxTokens, compactionRetries,
166
+ # maxOverflowRetries, auto, summarizationProvider/summarizationModel (legacy
167
+ # override), enrichmentTrigger (afterPush|idle|both|manual),
168
+ # elicitedPlot (true — one bounded call to mint a missing PLOT note),
169
+ # toolResultArtifactTokens (8000 — arrival-stub floor; keep ABOVE your chunk
170
+ # size: a floor below it stubs chunks and compaction silently stops being
171
+ # needed, measured), plus shared names above honored per plane.
172
+ # ---------------------------------------------------------------------------
173
+
174
+ - insert:
175
+ - id: '@fractalsynapse/dsh-chapters'
176
+ name: '@fractalsynapse/dsh-chapters'
177
+
178
+ # ── the `chapters` agent preset — a DECLARATION ROW, exactly as @deepseek-ai/dsh-web-app
179
+ # ships its own presets/standard.patch.yml. Row id `preset-chapters` follows the host's
180
+ # `preset-<id>` convention; `config.id: chapters` is DURABLE STATE (every continuation
181
+ # child records it as `agent-preset/selected`, so renaming it orphans those sessions).
182
+ #
183
+ # The row's `name` is OUR plugin (`@fractalsynapse/dsh-chapters/preset`), which mirrors
184
+ # @deepseek-ai/dsh-agent-preset line for line — `inject: ['agentPresets']`,
185
+ # `static [EntryGroup.key] = true` so child `!!js` expressions survive until the child
186
+ # activates, `[Service.init]` yields the registry disposer so Cordis owns its lifetime —
187
+ # and drops rows THIS host cannot import before registering. Why not the host package
188
+ # directly: a row naming @deepseek-ai/dsh-agent-preset is unresolvable on a pre-0.1.7
189
+ # host and an unresolvable row aborts that host's whole plugin tree, while one stale
190
+ # child row (e.g. @deepseek-ai/dsh-tool-schedule, unpublished at 0.2.0-rc.2) makes the
191
+ # ENTIRE preset `broken` — measured both ways. Same row, same visibility in
192
+ # `dsh --dump-default-config`/the config editor, no boot that it can brick.
193
+ #
194
+ # Four deltas from the host's own standard list, each ours deliberately:
195
+ # 1. compaction-basic -> chapters-engine (the zero-inference summarize())
196
+ # 2. tool-result-pruner.thresholdChars 8192 -> 1000000 (dormant by choice: chapters
197
+ # defer oversized results at ARCHIVE time; an in-surface prune is a prefix cliff
198
+ # on local hardware — and that plugin REJECTS unknown config keys, so the three
199
+ # keys below are the whole surface)
200
+ # 3. the PLOT: persona suffix, with NO {{cwd}} (hosts from 0.2.1-alpha.2 register only
201
+ # provider/model and an unregistered variable throws at prompt assembly, killing
202
+ # every turn of every chapters session)
203
+ # 4. tool-ralph ENABLED (the host standard list mounts it disabled)
204
+ # `noUnusedLocals`-equivalent discipline applies: keys the host dropped between versions
205
+ # are not carried here (toolFilter was one — alpha.4 throws on it).
206
+ - insert:
207
+ - id: preset-chapters
208
+ name: '@fractalsynapse/dsh-chapters/preset'
209
+ config:
210
+ id: chapters
211
+ name: Chapters
212
+ description: Full coding agent; context relief via zero-inference chapter compaction.
213
+ order: 0
214
+ plugins:
215
+ - id: persona
216
+ name: '@deepseek-ai/dsh-persona'
217
+ config:
218
+ prefix: You are a coding agent powered by the {{model}} model.
219
+ suffix: "When a task spans multiple turns, end each reply with one line beginning 'PLOT:' (max 60 words — objective, current hypothesis, immediate next step). A checkpoint carries this plot forward; if it looks stale, revise it on your next plot line.\n\n## Chapters memory and rules\nThis session keeps an archive of its own history, and a rule tier on top of it.\nBefore starting a task, run `chapters_rules` with the task description: it returns the standing orders in force here — project rules your team approved, plus session rules captured from this conversation, including ones nobody spelled out (each says which). Name the rules you actually followed, or say none; a rule cited wrongly twice is one the human revokes with a single command.\nWhen you need earlier work, a past decision, or bug history, run `chapters_search` FIRST — before re-reading files or asking the human. Read a cited chapter for the exact bytes; `chapters_artifact` holds the oversized tool outputs.\nDelegated subagents are covered by the same rules and the same archive: a child inherits the orders of the session that delegated it, so query them rather than assuming a fresh start."
220
+
221
+ - id: agent-instructions
222
+ name: '@deepseek-ai/dsh-agent-instructions'
223
+ config:
224
+ maxBytes: 65536
225
+ - id: time-context
226
+ name: '@deepseek-ai/dsh-time-context'
227
+ - id: tool-bash
228
+ name: '@deepseek-ai/dsh-tool-bash'
229
+ disabled: !!js process.platform === 'win32'
230
+ - id: tool-pwsh
231
+ name: '@deepseek-ai/dsh-tool-pwsh'
232
+ disabled: !!js process.platform !== 'win32'
233
+ - id: tool-fs
234
+ name: '@deepseek-ai/dsh-tool-fs'
235
+ - id: tool-fs-search
236
+ name: '@deepseek-ai/dsh-tool-fs-search'
237
+ config:
238
+ sampleOverCapGlobResults: false
239
+ - id: tool-jobs
240
+ name: '@deepseek-ai/dsh-tool-jobs'
241
+ - id: tool-schedule
242
+ name: '@deepseek-ai/dsh-tool-schedule'
243
+ - id: skill-filesystem
244
+ name: '@deepseek-ai/dsh-skill-filesystem'
245
+ - id: tool-skill
246
+ name: '@deepseek-ai/dsh-tool-skill'
247
+ - id: command-goal
248
+ name: '@deepseek-ai/dsh-command-goal'
249
+ - id: tool-goal
250
+ name: '@deepseek-ai/dsh-tool-goal'
251
+ - id: planning
252
+ name: cordis:group
253
+ group: true
254
+ isolate:
255
+ planMode: true
256
+ config:
257
+ - id: plan-mode
258
+ name: '@deepseek-ai/dsh-plan-mode'
259
+ config:
260
+ section: |
261
+ You are in plan mode. Stay in plan mode until exit_plan_mode succeeds or the user switches the session mode. Imperative language to implement changes means plan the implementation, not execute it. A user's conversational agreement — including an answer confirming something you asked — approves nothing and does not end plan mode; fold the confirmed decision into the plan and submit it through exit_plan_mode.
262
+
263
+ Explore first. Use non-mutating reads, searches, static analysis, and checks to ground the plan in the actual repository. Do not edit or write files, change configuration, run formatters or code generation that rewrites tracked files, commit, or otherwise carry out the plan. Prefer existing functions and patterns over new machinery.
264
+
265
+ The tool catalog stays the same across modes for request-cache stability. These plan-mode rules override any later tool description or guidance that suggests using mutation tools; those tools remain listed to keep the tool catalog unchanged. Do not use todo_write to track this planning phase: it tracks implementation after an approved plan, while the plan itself belongs in exit_plan_mode.
266
+
267
+ Resolve discoverable facts by inspection. Use ask_user_question only for user-owned choices or material ambiguity that inspection cannot answer. Do not ask the user where code lives or how current behavior works when you can find out.
268
+
269
+ Make the plan decision-complete: state the goal and success criteria; group implementation changes by subsystem; identify public API, schema, and data-flow changes; cover edge cases, failure modes, tests, acceptance criteria, and explicit assumptions. Keep it concise enough to review but detailed enough that another engineer can implement it without making design decisions.
270
+
271
+ When ready, call exit_plan_mode with the complete plan markdown, starting with a # title. Make exit_plan_mode the only and final tool call in that assistant response: it presents the plan for approval, and implementation begins only in a later step after approval. Do not paste the final plan as a plain reply or ask "should I proceed?" through prose or ask_user_question. If review rejects it, incorporate the feedback and present again. If the review channel is unavailable or aborted, stay in plan mode and ask the user to switch modes manually; do not proceed with implementation.
272
+ - id: compaction
273
+ name: cordis:group
274
+ group: true
275
+ isolate:
276
+ compaction: true
277
+ toolResultPruner: true
278
+ config:
279
+ - id: chapters-engine
280
+ name: '@fractalsynapse/dsh-chapters/engine'
281
+ config:
282
+ thresholdRatio: 0.9
283
+ # #140: bound the base engine's pressure headroom. Its default (65,536) is a reservation for a routed
284
+ # summarize call; this engine's summarize() is deterministic and routes nothing, so on any window under
285
+ # 65,536 — 32K is the target hardware — the default makes `contextWindow − reserved − headroom`
286
+ # negative and the base THROWS instead of compacting (see docs/backlog.md, #140). 8,192 leaves a
287
+ # positive pressure budget at 32K and is inert at 128K, where the ratio still sets the trigger
288
+ # (min(window × 0.9, window − 8,192): 115.2K vs 119.8K, so large windows keep the same boundary).
289
+ headroomTokens: 8192
290
+ - id: command-compact
291
+ name: '@deepseek-ai/dsh-command-compact'
292
+ - id: tool-result-pruner
293
+ name: '@deepseek-ai/dsh-compaction-tool-result-pruner'
294
+ config:
295
+ thresholdChars: 1000000
296
+ headChars: 4096
297
+ tailChars: 1024
298
+ - id: delegation
299
+ name: cordis:group
300
+ group: true
301
+ isolate:
302
+ workflowEngine: true
303
+ config:
304
+ - id: tool-subagent-control
305
+ name: '@deepseek-ai/dsh-tool-subagent-control'
306
+ - id: tool-subagent-list-agents
307
+ name: '@deepseek-ai/dsh-tool-subagent-control/list-agents'
308
+ - id: tool-subagent
309
+ name: '@deepseek-ai/dsh-tool-subagent'
310
+ config:
311
+ provider: spawn
312
+ toolName: subagent
313
+ modelSelectionSettings: true
314
+ backgroundMode: continuable
315
+ - id: tool-subagent-fork
316
+ name: '@deepseek-ai/dsh-tool-subagent'
317
+ config:
318
+ provider: fork
319
+ toolName: subagent_fork
320
+ backgroundMode: continuable
321
+ - id: tool-subagent-codex
322
+ name: '@deepseek-ai/dsh-tool-subagent'
323
+ disabled: true
324
+ config:
325
+ provider: codex
326
+ toolName: subagent_codex
327
+ backgroundMode: one-shot
328
+ maxDepth: provider-managed
329
+ - id: tool-subagent-claude-code
330
+ name: '@deepseek-ai/dsh-tool-subagent'
331
+ disabled: true
332
+ config:
333
+ provider: claude-code
334
+ toolName: subagent_claude_code
335
+ backgroundMode: one-shot
336
+ maxDepth: provider-managed
337
+ - id: workflow-ptc
338
+ name: '@deepseek-ai/dsh-workflow-ptc'
339
+ config:
340
+ provider: spawn
341
+ - id: tool-workflow
342
+ name: '@deepseek-ai/dsh-tool-workflow'
343
+ - id: tool-ralph
344
+ name: '@deepseek-ai/dsh-tool-ralph'
345
+ config:
346
+ subagentProvider: spawn
347
+ maxRounds: 64
348
+ - id: tool-ask-user
349
+ name: '@deepseek-ai/dsh-tool-ask-user'
350
+ - id: tool-todo
351
+ name: '@deepseek-ai/dsh-tool-todo'
352
+ config:
353
+ allowParallelInProgress: true
354
+ - id: tool-web
355
+ name: '@deepseek-ai/dsh-tool-web'
356
+ config:
357
+ fetch: true
358
+ searchTimeoutMs: 60000
359
+ - id: present
360
+ name: '@deepseek-ai/dsh-tool-present'
361
+ - id: tool-plugin-manager
362
+ name: '@deepseek-ai/dsh-plugin-manager/tools'
363
+ disabled: true