scriveno 2.0.5

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 (239) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +222 -0
  3. package/agents/continuity-checker.md +85 -0
  4. package/agents/drafter.md +248 -0
  5. package/agents/plan-checker.md +209 -0
  6. package/agents/researcher.md +114 -0
  7. package/agents/translator.md +204 -0
  8. package/agents/voice-checker.md +154 -0
  9. package/bin/install.js +1620 -0
  10. package/commands/scr/add-note.md +51 -0
  11. package/commands/scr/add-unit.md +101 -0
  12. package/commands/scr/art-direction.md +225 -0
  13. package/commands/scr/autopilot-publish.md +210 -0
  14. package/commands/scr/autopilot-translate.md +237 -0
  15. package/commands/scr/autopilot.md +200 -0
  16. package/commands/scr/back-matter.md +630 -0
  17. package/commands/scr/back-translate.md +197 -0
  18. package/commands/scr/beta-reader.md +97 -0
  19. package/commands/scr/blurb.md +149 -0
  20. package/commands/scr/book-proposal.md +210 -0
  21. package/commands/scr/build-ebook.md +448 -0
  22. package/commands/scr/build-poetry-submission.md +202 -0
  23. package/commands/scr/build-print.md +598 -0
  24. package/commands/scr/build-smashwords.md +171 -0
  25. package/commands/scr/build-world.md +158 -0
  26. package/commands/scr/cast-list.md +104 -0
  27. package/commands/scr/chapter-header.md +158 -0
  28. package/commands/scr/character-arc.md +108 -0
  29. package/commands/scr/character-ref.md +160 -0
  30. package/commands/scr/character-sheet.md +143 -0
  31. package/commands/scr/character-touch.md +157 -0
  32. package/commands/scr/character-voice-sample.md +111 -0
  33. package/commands/scr/check-notes.md +50 -0
  34. package/commands/scr/cleanup.md +159 -0
  35. package/commands/scr/compare.md +112 -0
  36. package/commands/scr/complete-draft.md +49 -0
  37. package/commands/scr/continuity-check.md +129 -0
  38. package/commands/scr/copy-edit.md +118 -0
  39. package/commands/scr/cover-art.md +382 -0
  40. package/commands/scr/cultural-adaptation.md +177 -0
  41. package/commands/scr/demo.md +93 -0
  42. package/commands/scr/dialogue-audit.md +143 -0
  43. package/commands/scr/discuss.md +118 -0
  44. package/commands/scr/discussion-questions.md +129 -0
  45. package/commands/scr/do.md +68 -0
  46. package/commands/scr/draft.md +97 -0
  47. package/commands/scr/editor-review.md +466 -0
  48. package/commands/scr/export.md +942 -0
  49. package/commands/scr/fast.md +65 -0
  50. package/commands/scr/front-matter.md +696 -0
  51. package/commands/scr/health.md +113 -0
  52. package/commands/scr/help.md +121 -0
  53. package/commands/scr/history.md +92 -0
  54. package/commands/scr/illustrate-scene.md +211 -0
  55. package/commands/scr/import.md +95 -0
  56. package/commands/scr/insert-unit.md +108 -0
  57. package/commands/scr/line-edit.md +146 -0
  58. package/commands/scr/manager.md +77 -0
  59. package/commands/scr/manuscript-stats.md +139 -0
  60. package/commands/scr/map-illustration.md +213 -0
  61. package/commands/scr/map-manuscript.md +134 -0
  62. package/commands/scr/merge-units.md +136 -0
  63. package/commands/scr/multi-publish.md +344 -0
  64. package/commands/scr/new-character.md +167 -0
  65. package/commands/scr/new-revision.md +50 -0
  66. package/commands/scr/new-work.md +148 -0
  67. package/commands/scr/next.md +125 -0
  68. package/commands/scr/originality-check.md +170 -0
  69. package/commands/scr/outline.md +131 -0
  70. package/commands/scr/pacing-analysis.md +170 -0
  71. package/commands/scr/panel-layout.md +225 -0
  72. package/commands/scr/pause-work.md +88 -0
  73. package/commands/scr/plan.md +112 -0
  74. package/commands/scr/plant-seed.md +57 -0
  75. package/commands/scr/plot-graph.md +199 -0
  76. package/commands/scr/polish.md +141 -0
  77. package/commands/scr/profile-writer.md +154 -0
  78. package/commands/scr/progress.md +51 -0
  79. package/commands/scr/publish.md +455 -0
  80. package/commands/scr/query-letter.md +183 -0
  81. package/commands/scr/quick-write.md +82 -0
  82. package/commands/scr/relationship-map.md +129 -0
  83. package/commands/scr/remove-unit.md +120 -0
  84. package/commands/scr/reorder-units.md +126 -0
  85. package/commands/scr/resume-work.md +97 -0
  86. package/commands/scr/sacred/annotation-layer.md +105 -0
  87. package/commands/scr/sacred/chronology.md +121 -0
  88. package/commands/scr/sacred/concordance.md +88 -0
  89. package/commands/scr/sacred/cross-reference.md +97 -0
  90. package/commands/scr/sacred/doctrinal-check.md +129 -0
  91. package/commands/scr/sacred/genealogy.md +107 -0
  92. package/commands/scr/sacred/source-tracking.md +101 -0
  93. package/commands/scr/sacred/verse-numbering.md +103 -0
  94. package/commands/scr/sacred-numbering-format.md +103 -0
  95. package/commands/scr/save.md +109 -0
  96. package/commands/scr/scan.md +291 -0
  97. package/commands/scr/sensitivity-review.md +169 -0
  98. package/commands/scr/series-bible.md +127 -0
  99. package/commands/scr/session-report.md +80 -0
  100. package/commands/scr/settings.md +58 -0
  101. package/commands/scr/split-unit.md +123 -0
  102. package/commands/scr/spread-layout.md +187 -0
  103. package/commands/scr/storyboard.md +262 -0
  104. package/commands/scr/subject-touch.md +168 -0
  105. package/commands/scr/submit.md +50 -0
  106. package/commands/scr/subplot-map.md +147 -0
  107. package/commands/scr/sync.md +116 -0
  108. package/commands/scr/synopsis.md +137 -0
  109. package/commands/scr/theme-tracker.md +128 -0
  110. package/commands/scr/thread.md +83 -0
  111. package/commands/scr/timeline.md +141 -0
  112. package/commands/scr/track.md +564 -0
  113. package/commands/scr/translate.md +260 -0
  114. package/commands/scr/translation-glossary.md +298 -0
  115. package/commands/scr/translation-memory.md +310 -0
  116. package/commands/scr/troubleshoot.md +59 -0
  117. package/commands/scr/undo.md +106 -0
  118. package/commands/scr/validate.md +133 -0
  119. package/commands/scr/versions.md +94 -0
  120. package/commands/scr/voice-check.md +133 -0
  121. package/commands/scr/voice-test.md +68 -0
  122. package/data/CONSTRAINTS.json +1606 -0
  123. package/data/demo/.manuscript/BRIEF.md +37 -0
  124. package/data/demo/.manuscript/CHARACTERS.md +90 -0
  125. package/data/demo/.manuscript/OUTLINE.md +46 -0
  126. package/data/demo/.manuscript/PLOT-GRAPH.md +75 -0
  127. package/data/demo/.manuscript/STATE.md +44 -0
  128. package/data/demo/.manuscript/STYLE-GUIDE.md +119 -0
  129. package/data/demo/.manuscript/THEMES.md +51 -0
  130. package/data/demo/.manuscript/WORK.md +51 -0
  131. package/data/demo/.manuscript/config.json +59 -0
  132. package/data/demo/.manuscript/drafts/body/1-the-letter-DRAFT.md +51 -0
  133. package/data/demo/.manuscript/drafts/body/2-the-workshop-DRAFT.md +51 -0
  134. package/data/demo/.manuscript/drafts/body/3-the-pier-DRAFT.md +45 -0
  135. package/data/demo/.manuscript/drafts/body/4-the-clock-DRAFT.md +59 -0
  136. package/data/demo/.manuscript/plans/5-the-reunion-PLAN.md +52 -0
  137. package/data/demo/.manuscript/reviews/2-the-workshop-REVIEW.md +61 -0
  138. package/data/export-templates/scriveno-academic.latex +184 -0
  139. package/data/export-templates/scriveno-acm.latex +67 -0
  140. package/data/export-templates/scriveno-apa7.latex +83 -0
  141. package/data/export-templates/scriveno-book.typst +175 -0
  142. package/data/export-templates/scriveno-chapbook.typst +121 -0
  143. package/data/export-templates/scriveno-elsevier.latex +76 -0
  144. package/data/export-templates/scriveno-epub.css +386 -0
  145. package/data/export-templates/scriveno-fixed-layout-epub.css +76 -0
  146. package/data/export-templates/scriveno-fixed-layout.opf +23 -0
  147. package/data/export-templates/scriveno-ieee.latex +77 -0
  148. package/data/export-templates/scriveno-lncs.latex +79 -0
  149. package/data/export-templates/scriveno-picturebook.typst +113 -0
  150. package/data/export-templates/scriveno-poetry-submission-styles.md +45 -0
  151. package/data/export-templates/scriveno-poetry-submission.docx +0 -0
  152. package/data/export-templates/scriveno-smashwords-styles.md +45 -0
  153. package/data/export-templates/scriveno-smashwords.docx +0 -0
  154. package/data/export-templates/scriveno-stageplay.typst +129 -0
  155. package/data/proof/creative-context/README.md +79 -0
  156. package/data/proof/voice-dna/GUIDED-SAMPLE.md +19 -0
  157. package/data/proof/voice-dna/README.md +45 -0
  158. package/data/proof/voice-dna/STYLE-GUIDE-EXCERPT.md +43 -0
  159. package/data/proof/voice-dna/UNGUIDED-SAMPLE.md +11 -0
  160. package/data/proof/watchmaker-flow/README.md +78 -0
  161. package/docs/architecture.md +425 -0
  162. package/docs/command-reference.md +2384 -0
  163. package/docs/configuration.md +228 -0
  164. package/docs/context-protocol.md +81 -0
  165. package/docs/contributing.md +430 -0
  166. package/docs/creative-context.md +158 -0
  167. package/docs/development.md +152 -0
  168. package/docs/drafter-quality.md +127 -0
  169. package/docs/getting-started.md +198 -0
  170. package/docs/history-protocol.md +96 -0
  171. package/docs/proof-artifacts.md +56 -0
  172. package/docs/publishing.md +296 -0
  173. package/docs/release-notes.md +457 -0
  174. package/docs/runtime-support.md +77 -0
  175. package/docs/sacred-texts.md +296 -0
  176. package/docs/shipped-assets.md +129 -0
  177. package/docs/testing.md +156 -0
  178. package/docs/translation.md +343 -0
  179. package/docs/voice-dna.md +297 -0
  180. package/docs/work-types.md +339 -0
  181. package/lib/architectural-profiles.js +134 -0
  182. package/package.json +54 -0
  183. package/templates/BRIEF.md +51 -0
  184. package/templates/CHARACTERS.md +64 -0
  185. package/templates/CONTEXT.md +56 -0
  186. package/templates/OUTLINE.md +36 -0
  187. package/templates/RECORD.md +68 -0
  188. package/templates/STATE.md +50 -0
  189. package/templates/STYLE-GUIDE.md +121 -0
  190. package/templates/THEMES.md +36 -0
  191. package/templates/WORK.md +67 -0
  192. package/templates/WORLD.md +62 -0
  193. package/templates/WRITING-RULES.md +156 -0
  194. package/templates/academic/ARGUMENT-MAP.md +40 -0
  195. package/templates/academic/CONCEPTS.md +34 -0
  196. package/templates/academic/CONTEXT.md +29 -0
  197. package/templates/academic/PROPOSAL.md +37 -0
  198. package/templates/academic/QUESTIONS.md +24 -0
  199. package/templates/config.json +72 -0
  200. package/templates/pitfalls/comic.md +54 -0
  201. package/templates/pitfalls/commentary.md +62 -0
  202. package/templates/pitfalls/memoir.md +48 -0
  203. package/templates/pitfalls/novel.md +53 -0
  204. package/templates/pitfalls/poetry_collection.md +63 -0
  205. package/templates/pitfalls/research_paper.md +66 -0
  206. package/templates/pitfalls/runbook.md +64 -0
  207. package/templates/pitfalls/screenplay.md +54 -0
  208. package/templates/platforms/README.md +16 -0
  209. package/templates/platforms/apple/manifest.yaml +20 -0
  210. package/templates/platforms/bn/manifest.yaml +20 -0
  211. package/templates/platforms/d2d/manifest.yaml +20 -0
  212. package/templates/platforms/google/manifest.yaml +20 -0
  213. package/templates/platforms/ingram/manifest.yaml +44 -0
  214. package/templates/platforms/kdp/manifest.yaml +42 -0
  215. package/templates/platforms/kobo/manifest.yaml +20 -0
  216. package/templates/platforms/smashwords/manifest.yaml +26 -0
  217. package/templates/sacred/COSMOLOGY.md +88 -0
  218. package/templates/sacred/DOCTRINES.md +45 -0
  219. package/templates/sacred/FIGURES.md +69 -0
  220. package/templates/sacred/FRAMEWORK.md +98 -0
  221. package/templates/sacred/LINEAGES.md +52 -0
  222. package/templates/sacred/README.md +20 -0
  223. package/templates/sacred/THEOLOGICAL-ARC.md +69 -0
  224. package/templates/sacred/catholic/manifest.yaml +93 -0
  225. package/templates/sacred/islamic-hafs/manifest.yaml +134 -0
  226. package/templates/sacred/islamic-warsh/manifest.yaml +134 -0
  227. package/templates/sacred/jewish/manifest.yaml +56 -0
  228. package/templates/sacred/orthodox/manifest.yaml +98 -0
  229. package/templates/sacred/pali/manifest.yaml +20 -0
  230. package/templates/sacred/protestant/manifest.yaml +86 -0
  231. package/templates/sacred/sanskrit/manifest.yaml +20 -0
  232. package/templates/sacred/tewahedo/manifest.yaml +106 -0
  233. package/templates/sacred/tibetan/manifest.yaml +20 -0
  234. package/templates/technical/AUDIENCE.md +26 -0
  235. package/templates/technical/DEPENDENCIES.md +19 -0
  236. package/templates/technical/DOC-BRIEF.md +45 -0
  237. package/templates/technical/PROCEDURES.md +37 -0
  238. package/templates/technical/REFERENCES.md +36 -0
  239. package/templates/technical/SYSTEM.md +25 -0
@@ -0,0 +1,228 @@
1
+ # Configuration
2
+
3
+ This guide covers the configuration surfaces Scriveno actually ships today: package-level installer metadata, shared constraint data, runtime install targets, and per-project `.manuscript/config.json`.
4
+
5
+ ## What is configurable
6
+
7
+ Scriveno is intentionally narrow in where configuration lives:
8
+
9
+ - `package.json` defines the npm package metadata, installer entrypoint, and supported Node baseline
10
+ - `data/CONSTRAINTS.json` is the central registry for work types, command availability, adaptive terminology, and export rules
11
+ - `bin/install.js` defines installer targets and where Scriveno writes commands, skills, agents, or guided setup assets
12
+ - `.manuscript/config.json` stores project-specific writing settings after `/scr:new-work`
13
+
14
+ There is no compiled app config, no environment-variable matrix for the core workflow, and no runtime dependency graph beyond Node.js for the installer.
15
+
16
+ ## Installer baseline
17
+
18
+ The installer compatibility floor is:
19
+
20
+ ```json
21
+ "engines": {
22
+ "node": ">=20.0.0"
23
+ }
24
+ ```
25
+
26
+ That same `>=20.0.0` floor is enforced in:
27
+
28
+ - `package.json`
29
+ - `bin/install.js`
30
+ - `docs/runtime-support.md`
31
+
32
+ For new installs, use a currently supported LTS release such as Node.js 24. Node.js 20 reached end of life on 2026-04-30, so it remains a compatibility floor, not the recommended fresh-install target.
33
+
34
+ For runtime support details, use [Runtime Support](runtime-support.md). That document is the canonical compatibility matrix.
35
+
36
+ ## Shared Scriveno data
37
+
38
+ Scriveno commands are designed to load the shared constraints file from an installed Scriveno location first:
39
+
40
+ - global install: `~/.scriveno/data/CONSTRAINTS.json`
41
+ - project install: `.scriveno/data/CONSTRAINTS.json`
42
+
43
+ The repo-local copy at `data/CONSTRAINTS.json` is the authoring source of truth. The installer copies that data into the runtime-facing install location.
44
+
45
+ `CONSTRAINTS.json` controls:
46
+
47
+ - all 50 work types and 9 work-type groups
48
+ - all shipped command registrations
49
+ - adaptive renames and group-specific command behavior
50
+ - export availability and prerequisite rules
51
+
52
+ If a command or doc claim conflicts with `CONSTRAINTS.json`, fix the command or doc to match the constraints file.
53
+
54
+ ## Project config
55
+
56
+ When a writer runs `/scr:new-work`, Scriveno creates `.manuscript/config.json`. The command file in [new-work.md](../commands/scr/new-work.md) defines the baseline shape:
57
+
58
+ ```json
59
+ {
60
+ "scriveno_version": "2.0.5",
61
+ "work_type": "<chosen>",
62
+ "group": "<group>",
63
+ "command_unit": "<unit>",
64
+ "developer_mode": false,
65
+ "created_at": "<ISO timestamp>",
66
+ "autopilot": {
67
+ "enabled": false,
68
+ "profile": "guided"
69
+ }
70
+ }
71
+ ```
72
+
73
+ That `scriveno_version` value should track the current package release and the live `/scr:new-work` contract, not an older milestone snapshot.
74
+
75
+ Every project gets those core keys. Additional blocks are added only when the work type requires them.
76
+
77
+ ### Technical writing projects
78
+
79
+ Technical writing work types add a `technical` block seeded from `config_defaults` in `data/CONSTRAINTS.json`. That block is used to capture things like:
80
+
81
+ - audience level
82
+ - prerequisite knowledge
83
+ - supported environment
84
+ - supported versions
85
+ - source-of-truth references
86
+ - review mode
87
+
88
+ Technical projects also swap in the specialized templates under `templates/technical/`.
89
+
90
+ ### Sacred and historical projects
91
+
92
+ Sacred work types add top-level sacred profile keys seeded from `config_defaults` and `architectural_profiles.defaults_by_work_type.tradition`. New projects should not nest these values under a `sacred` object.
93
+
94
+ The supported tradition profile slugs are:
95
+
96
+ - `catholic`
97
+ - `orthodox`
98
+ - `tewahedo`
99
+ - `protestant`
100
+ - `jewish`
101
+ - `islamic-hafs`
102
+ - `islamic-warsh`
103
+ - `pali`
104
+ - `tibetan`
105
+ - `sanskrit`
106
+
107
+ Sacred project config can include:
108
+
109
+ - `tradition`
110
+ - `verse_numbering_system`
111
+ - `calendar_system`
112
+ - `translation_philosophy`
113
+ - `canonical_alignment`
114
+ - `annotation_traditions`
115
+ - `doctrinal_framework`
116
+ - `preserve_source_terms`
117
+ - `transliteration_style`
118
+
119
+ Sacred projects also load the template variants under `templates/sacred/`. Older projects with a nested `sacred` object are accepted as legacy input by commands that read these keys, but new projects should use the top-level shape.
120
+
121
+ ### Platform defaults
122
+
123
+ Some work types can also set a top-level `platform`, seeded from `architectural_profiles.defaults_by_work_type.platform`. Ebook and print builders use this value when the writer does not pass `--platform`.
124
+
125
+ The shipped ebook platform profile slugs are:
126
+
127
+ - `kdp`
128
+ - `ingram`
129
+ - `apple`
130
+ - `bn`
131
+ - `d2d`
132
+ - `kobo`
133
+ - `google`
134
+ - `smashwords`
135
+
136
+ `/scr:build-ebook` validates the selected platform, loads `templates/platforms/{platform}/manifest.yaml`, checks that the manifest accepts EPUB, and carries the platform label plus `epub_variant` into the output metadata.
137
+
138
+ ### Drafter quality settings
139
+
140
+ Starting in `1.6.0`, projects can include an optional `draft` block to tune how the drafter loads context and applies rule scaffolding. The block is optional; absent block falls back to the documented defaults.
141
+
142
+ ```json
143
+ "draft": {
144
+ "rigor": "standard",
145
+ "context_profile": "standard",
146
+ "pitfalls_enabled": true
147
+ }
148
+ ```
149
+
150
+ - `draft.rigor`: `standard` (default) or `strict`. Strict prepends a per-sentence rules check, useful when routing to weaker models that need scaffolding to stay on-voice.
151
+ - `draft.context_profile`: `minimal`, `standard` (default), or `full`. Controls how much context the drafter loads per atomic unit. Minimal trims THEMES, WORK, and off-stage CHARACTERS for short scenes; full loads cross-document references for sacred-work continuity.
152
+ - `draft.pitfalls_enabled`: `true` (default) or `false`. When `false`, skip loading the per-work-type pitfall pack from `templates/pitfalls/<work_type>.md`. WRITING-RULES.md still loads. Use when the writer's voice deliberately leans into a trap (parody, pastiche, period voice).
153
+
154
+ `/scr:settings` exposes all three knobs in its display and change flow. See [Drafter Quality](drafter-quality.md) for the full system, including model-tier recommendations and the override hierarchy (STYLE-GUIDE.md beats WRITING-RULES.md beats the pitfall pack).
155
+
156
+ ## Developer mode
157
+
158
+ Scriveno defaults projects to:
159
+
160
+ ```json
161
+ "developer_mode": false
162
+ ```
163
+
164
+ That setting exists so non-technical writers can stay in writer-first language. In writer mode, Scriveno prefers terms like `save`, `version`, and `compare` instead of raw git terminology.
165
+
166
+ The broader product behavior is described in [Getting Started](getting-started.md) and [README.md](../README.md). The repo does not currently ship a separate standalone developer-mode settings reference beyond the project config itself.
167
+
168
+ ## Installer targets
169
+
170
+ `bin/install.js` currently defines 11 installer targets:
171
+
172
+ - 8 command-directory runtimes
173
+ - 2 skills or manifest-style runtimes
174
+ - 1 guided local-MCP target for Perplexity Desktop
175
+
176
+ The installer also decides whether the install is global or project-local and writes files into the matching runtime-specific directories. The target matrix and support framing live in [Runtime Support](runtime-support.md).
177
+
178
+ Use `/scr:sync` when the source tree has changed and an installed runtime surface needs to be refreshed from that local source. Sync is intentionally narrower than update: it re-runs the installer for selected or detected runtimes and does not fetch a newer package release.
179
+
180
+ ## Export prerequisites
181
+
182
+ Scriveno keeps export tools out of `package.json`. They are external prerequisites the agent invokes through the shell when needed.
183
+
184
+ Current documented prerequisites include:
185
+
186
+ - Pandoc
187
+ - Typst
188
+ - Ghostscript
189
+ - ImageMagick
190
+ - Afterwriting
191
+ - Screenplain
192
+
193
+ The authoritative guidance for those tools is split across:
194
+
195
+ - [Publishing](publishing.md)
196
+ - [Shipped Assets](shipped-assets.md)
197
+ - [Runtime Support](runtime-support.md)
198
+
199
+ ## Changing configuration safely
200
+
201
+ Use this rule of thumb:
202
+
203
+ - change `data/CONSTRAINTS.json` for command availability, work-type structure, adaptive terminology, or export rules
204
+ - change `bin/install.js` for runtime targets or install paths
205
+ - change command files for workflow behavior
206
+ - change `.manuscript/config.json` only as project state, not as product schema authoring
207
+
208
+ After changing configuration surfaces, run:
209
+
210
+ ```bash
211
+ npm test
212
+ ```
213
+
214
+ And for release-facing changes, also run:
215
+
216
+ ```bash
217
+ npm run release:check
218
+ ```
219
+
220
+ ## Related docs
221
+
222
+ - [Getting Started](getting-started.md)
223
+ - [Architecture](architecture.md)
224
+ - [Contributing](contributing.md)
225
+ - [Drafter Quality](drafter-quality.md)
226
+ - [Voice DNA](voice-dna.md)
227
+ - [Runtime Support](runtime-support.md)
228
+ - [Publishing](publishing.md)
@@ -0,0 +1,81 @@
1
+ # Context preference protocol
2
+
3
+ This is the canonical context-cost contract for Scriveno commands. The goal is to stop every session-aware command from independently re-loading STATE.md, OUTLINE.md, RECORD.md, config.json, and other orientation files when the auto-regenerated `.manuscript/CONTEXT.md` already summarizes them.
4
+
5
+ It is part of the trust layer:
6
+ - `STATE.md` -- structured snapshot (data)
7
+ - `RECORD.md` -- compact established-content store
8
+ - `.manuscript/CONTEXT.md` -- one-page narrative bootstrap (synthesis)
9
+ - `.manuscript/HISTORY.log` -- append-only audit trail
10
+
11
+ ## The rule
12
+
13
+ Before loading STATE.md, OUTLINE.md, or config.json individually, any command whose first action is "load orientation files" MUST do this check:
14
+
15
+ ```
16
+ 1. Read .manuscript/CONTEXT.md if it exists.
17
+ 2. Compare its `Updated` timestamp to .manuscript/STATE.md and to the
18
+ newest file in .manuscript/drafts/body/ (if drafts exist).
19
+ 3. If CONTEXT.md is fresher than both, USE IT for orientation. Skip
20
+ the raw-file loads unless you need a specific field CONTEXT.md
21
+ does not contain.
22
+ 4. If CONTEXT.md is missing, older than STATE.md, or older than the
23
+ newest draft, treat STATE.md as authoritative and continue with
24
+ the original load instructions. Suggest /scr:save (which
25
+ regenerates CONTEXT.md) at the end of the response.
26
+ ```
27
+
28
+ Drafter commands and any command whose job is to *write* a draft, plan, or analysis do not skip raw-file loads -- they need the full source. The protocol applies to **orientation-only** reads at the start of session-aware commands.
29
+
30
+ ## Which fields CONTEXT.md provides
31
+
32
+ CONTEXT.md (template at `templates/CONTEXT.md`) holds:
33
+
34
+ - Project title and work type (substitute for `config.json` lookups)
35
+ - Phase and active unit (substitute for STATE.md `Current phase` / `Current unit`)
36
+ - Last 5 actions (substitute for STATE.md `Last actions` table)
37
+ - Open items: drafted-but-not-reviewed, planned-but-not-drafted, voice warnings, continuity flags, scaffold markers (substitute for STATE.md `Pending`)
38
+ - Record highlights: open threads, reader promises, and next-unit obligations (substitute for a full RECORD.md read when routing only needs orientation)
39
+ - Suggested next step (substitute for `/scr:next` re-derivation)
40
+ - Last `/scr:scan` verdict
41
+
42
+ If a command needs something CONTEXT.md does NOT have (e.g. specific draft content, individual unit metadata, the full OUTLINE.md ordering), load only that specific file. CONTEXT.md replaces the orientation read, not every read.
43
+
44
+ ## How to apply
45
+
46
+ Add this block at the top of `## What to do` (or equivalent), before the existing load instructions. Adapt prose lightly per command but keep the rule machine-readable:
47
+
48
+ ```markdown
49
+ ### STEP 0: BOOTSTRAP (context-cost protocol)
50
+
51
+ Read `.manuscript/CONTEXT.md` first if it exists. If its `Updated` timestamp
52
+ is newer than STATE.md and newer than the newest file in
53
+ `.manuscript/drafts/body/`, treat it as your orientation source for the
54
+ fields below (project title, work type, phase, current unit, last actions,
55
+ open items, suggested next step). Skip the corresponding raw-file loads in
56
+ STEP 1 unless you need a field CONTEXT.md does not surface.
57
+
58
+ If CONTEXT.md is missing, stale, or contradicts STATE.md, fall back to the
59
+ original loads. Note in your final response that CONTEXT.md should be
60
+ regenerated on the next /scr:save.
61
+
62
+ See `docs/context-protocol.md` for the full contract.
63
+ ```
64
+
65
+ ## Why pipe-delimited freshness, not file size
66
+
67
+ Filesystem mtime is a cheap, durable signal that does not require parsing the file. Comparing one timestamp against two others (STATE.md, newest draft) is two `stat` calls. The alternative -- parsing CONTEXT.md to check internal coherence -- costs more tokens than just loading STATE.md, defeating the purpose.
68
+
69
+ ## When the protocol does not apply
70
+
71
+ - **Drafter agents** (drafter.md, voice-checker.md, etc.) -- they need the full source files for fidelity.
72
+ - **Read-only data display commands** (`/scr:progress`, `/scr:session-report`) -- already cheap; no orientation files to skip.
73
+ - **First-write commands** (`/scr:new-work`, `/scr:import`) -- no CONTEXT.md exists yet.
74
+ - **The CONTEXT.md regenerators themselves** (`/scr:save`, `/scr:pause-work`, `/scr:resume-work`) -- they MUST load the raw files to rebuild CONTEXT.md correctly. They are the *writers* of CONTEXT.md, not consumers.
75
+ - **`/scr:scan`** -- its job is to detect drift, so it must read the raw files to compare against CONTEXT.md.
76
+
77
+ ## Expected savings
78
+
79
+ For a typical session-aware command (`/scr:next`, `/scr:plan`, `/scr:export`, `/scr:publish`, etc.) that previously loaded STATE.md (~50 lines), config.json (~30 lines), OUTLINE.md (~100-300 lines), and a CONSTRAINTS.json adaptation slice, the bootstrap step replaces ~200-500 lines of raw orientation reads with one ~30-line CONTEXT.md read. Savings compound across chained commands (autopilot, publish presets).
80
+
81
+ The protocol is a hint, not a hard gate. A command that misses an edge case can still load raw files explicitly. The cost is paid; correctness is preserved.