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,237 @@
1
+ ---
2
+ description: Run multi-language translation pipeline unattended with glossary, translation, adaptation, and publishing.
3
+ argument-hint: "[--languages <lang1,lang2,...>] [--all-languages] [--skip-publish] [--skip-adaptation] [--resume]"
4
+ ---
5
+
6
+ # /scr:autopilot-translate -- Unattended Multi-Language Translation Pipeline
7
+
8
+ You are running the full translation pipeline autonomously for one or more target languages. Your job is to chain glossary creation, translation, translation memory, cultural adaptation, back-translation, and multi-publish per language -- all without asking the writer questions unless blocked.
9
+
10
+ ## Usage
11
+
12
+ ```
13
+ /scr:autopilot-translate --languages fr,de,ja
14
+ /scr:autopilot-translate --all-languages
15
+ /scr:autopilot-translate --languages ar --skip-publish
16
+ /scr:autopilot-translate --resume
17
+ ```
18
+
19
+ ---
20
+
21
+ ## Instruction
22
+
23
+ ### STEP 0: BOOTSTRAP (context-cost protocol)
24
+
25
+ Read `.manuscript/CONTEXT.md` first if it exists. If its `Updated` timestamp is newer than `.manuscript/STATE.md` and newer than the newest file in `.manuscript/drafts/body/`, use it as your orientation source for project title, work type, phase, current unit, recent activity, and open items. In STEP 1, skip the raw-file loads for those fields and only load files holding data CONTEXT.md does not surface (translation glossary, language manifest, target-language config).
26
+
27
+ If CONTEXT.md is missing, stale, or contradicts STATE.md, fall back to the original loads in STEP 1 unchanged. See `docs/context-protocol.md` for the contract.
28
+
29
+ ---
30
+
31
+ ### STEP 1: LOAD CONTEXT AND DETERMINE LANGUAGES
32
+
33
+ Load these project files:
34
+
35
+ - `.manuscript/config.json` -- for `target_languages`, `source_language`, title, author
36
+ - `.manuscript/OUTLINE.md` -- for unit count (needed by translate command)
37
+ - `.manuscript/STATE.md` -- for resume position (if `--resume`)
38
+ - Scriveno's installed/shared `CONSTRAINTS.json` (global `~/.scriveno/data/CONSTRAINTS.json` or project `.scriveno/data/CONSTRAINTS.json`) -- for command prerequisites
39
+
40
+ **Determine languages to process:**
41
+
42
+ 1. If `--languages <lang1,lang2,...>` is provided: process only those languages (comma-separated ISO 639-1 codes)
43
+ 2. If `--all-languages` is provided: process all languages listed in `config.json` `target_languages` array
44
+ 3. If neither is provided: show the `target_languages` from config and ask the writer to confirm or select
45
+
46
+ **Validate languages:** Each language code must be a valid ISO 639-1 code. If any are invalid, warn and skip them.
47
+
48
+ ---
49
+
50
+ ### STEP 2: RTL AND CJK DETECTION
51
+
52
+ For each target language, auto-detect script direction and writing system:
53
+
54
+ ```
55
+ RTL_LANGUAGES = ["ar", "he", "ur", "fa", "yi", "ps", "sd"]
56
+ CJK_LANGUAGES = ["zh", "ja", "ko"]
57
+ ```
58
+
59
+ - RTL languages receive `--text-direction rtl` when passed to export commands
60
+ - CJK languages receive appropriate font and spacing flags
61
+ - All other languages default to LTR
62
+
63
+ Log the detection:
64
+ ```
65
+ Language setup:
66
+ fr (French) -- LTR
67
+ ar (Arabic) -- RTL
68
+ ja (Japanese) -- CJK
69
+ he (Hebrew) -- RTL
70
+ ```
71
+
72
+ ---
73
+
74
+ ### STEP 3: PIPELINE PER LANGUAGE (PARALLEL AGENTS)
75
+
76
+ Each language is independent and can conceptually run as a parallel agent. For each target language, execute the following 6-phase pipeline:
77
+
78
+ #### Phase 1: Glossary
79
+
80
+ Check if `.manuscript/translation/GLOSSARY-{lang}.md` exists:
81
+ - **If exists:** Skip with note: `"Glossary for {lang} already exists, skipping."`
82
+ - **If missing:** Run `/scr:translation-glossary --language {lang}` to create it
83
+
84
+ #### Phase 2: Translate
85
+
86
+ Run `/scr:translate --language {lang}` for all units in OUTLINE.md.
87
+
88
+ Track progress per unit:
89
+ ```
90
+ [fr] Phase 2/6: Translating unit 5/12...
91
+ ```
92
+
93
+ The translate command uses the fresh-context-per-unit pattern -- each unit gets its own context with STYLE-GUIDE.md, glossary, and translation memory loaded.
94
+
95
+ #### Phase 3: Translation Memory
96
+
97
+ After all units are translated, run `/scr:translation-memory --build --language {lang}` to capture segment-aligned pairs from the completed translation.
98
+
99
+ Log: `"[fr] Phase 3/6: Building translation memory... 847 segments captured."`
100
+
101
+ #### Phase 4: Cultural Adaptation (unless `--skip-adaptation`)
102
+
103
+ If `--skip-adaptation` is NOT set:
104
+ - Run `/scr:cultural-adaptation --language {lang}`
105
+ - Log flagged items count per severity:
106
+ ```
107
+ [fr] Phase 4/6: Cultural adaptation... 3 high, 7 medium, 12 low flags.
108
+ ```
109
+
110
+ If `--skip-adaptation` IS set:
111
+ - Log: `"[fr] Phase 4/6: Cultural adaptation skipped (--skip-adaptation)."`
112
+
113
+ #### Phase 5: Back-Translate
114
+
115
+ Run `/scr:back-translate --language {lang}` for quality verification.
116
+
117
+ Log drift annotation counts:
118
+ ```
119
+ [fr] Phase 5/6: Back-translation... 2 semantic shifts, 1 addition, 0 omissions.
120
+ ```
121
+
122
+ #### Phase 6: Multi-Publish (unless `--skip-publish`)
123
+
124
+ If `--skip-publish` is NOT set:
125
+ - Determine text direction for this language (RTL/LTR/CJK from Step 2)
126
+ - Run `/scr:multi-publish --language {lang}` for all available export formats
127
+ - For RTL languages, pass `--text-direction rtl` to ensure correct PDF and EPUB output
128
+ - For CJK languages, pass `--cjk-mode` to enable CJK-specific line breaking and font handling
129
+
130
+ If `--skip-publish` IS set:
131
+ - Log: `"[fr] Phase 6/6: Multi-publish skipped (--skip-publish)."`
132
+
133
+ ---
134
+
135
+ ### STEP 4: PROGRESS TRACKING AND RESUME
136
+
137
+ **Progress tracking:**
138
+ - Update STATE.md after each phase completion per language
139
+ - Format: `autopilot-translate: {lang} phase {N}/6 complete`
140
+ - Show live progress: `"[ja] Phase 2/6: Translating unit 5/12..."`
141
+
142
+ **Resume support (`--resume`):**
143
+ - Read STATE.md for last completed phase per language
144
+ - Skip already-completed phases for each language
145
+ - Resume from the last incomplete phase/unit
146
+ - Example: If Arabic completed phases 1-3 and French completed 1-5, resume Arabic at phase 4 and French at phase 6
147
+
148
+ **Interruption handling:**
149
+ - If the process is interrupted, STATE.md contains enough information to resume
150
+ - On resume, output: `"Resuming: ar at phase 4 (cultural adaptation), fr at phase 6 (multi-publish)"`
151
+
152
+ ---
153
+
154
+ ### STEP 5: COMPLETION SUMMARY
155
+
156
+ After all languages complete their pipelines, show a comprehensive summary:
157
+
158
+ ```
159
+ Autopilot Translate Complete
160
+ =============================
161
+ Source language: en (English)
162
+ Duration: ~15 minutes
163
+
164
+ Per Language:
165
+ fr (French) -- LTR
166
+ Units translated: 12
167
+ Word count: ~45,000
168
+ Glossary terms: 87
169
+ TM segments: 847
170
+ Cultural flags: 22 (3 high, 7 medium, 12 low)
171
+ Drift annotations: 3
172
+ Formats exported: PDF, EPUB, DOCX
173
+
174
+ ar (Arabic) -- RTL
175
+ Units translated: 12
176
+ Word count: ~42,000
177
+ Glossary terms: 91
178
+ TM segments: 812
179
+ Cultural flags: 34 (8 high, 14 medium, 12 low)
180
+ Drift annotations: 7
181
+ Formats exported: PDF (RTL), EPUB (RTL), DOCX
182
+
183
+ ja (Japanese) -- CJK
184
+ Units translated: 12
185
+ Word count: ~38,000
186
+ Glossary terms: 103
187
+ TM segments: 923
188
+ Cultural flags: 41 (5 high, 18 medium, 18 low)
189
+ Drift annotations: 5
190
+ Formats exported: PDF (CJK), EPUB (CJK), DOCX
191
+
192
+ Overall:
193
+ Languages: 3
194
+ Total words translated: ~125,000
195
+ Total files exported: 9
196
+
197
+ Errors:
198
+ (none)
199
+
200
+ Next Steps:
201
+ 1. Review cultural adaptation flags (especially high-severity items)
202
+ 2. Review back-translation drift reports for each language
203
+ 3. Check exported files in .manuscript/translation/{lang}/output/
204
+ ```
205
+
206
+ ---
207
+
208
+ ## Anti-patterns
209
+
210
+ - **NEVER** skip the glossary phase -- term consistency across the manuscript depends on it
211
+ - **NEVER** run cultural adaptation before translation is complete for that language
212
+ - **NEVER** export RTL languages without setting `--text-direction rtl` -- the PDF and EPUB will be unreadable
213
+ - **NEVER** continue past a blocking error without logging it -- all errors must appear in the completion summary
214
+ - **NEVER** modify the source manuscript -- translation works on copies in `.manuscript/translation/{lang}/`
215
+
216
+ ## Response Contract
217
+
218
+ Every writer-facing response must end with one to four next-command suggestions. Each suggestion must include a short explanation of what that path will do.
219
+
220
+ Use this format:
221
+
222
+ ```markdown
223
+ Next commands:
224
+ - `/scr:...`: One short sentence explaining what this path will do.
225
+ - `/scr:...`: One short sentence explaining what this alternate path will do.
226
+ ```
227
+
228
+ If exactly one path is clearly best, provide one suggestion. If two, three, or four useful paths exist, show them as alternatives. Do not force a linear path when the writer has a real choice.
229
+
230
+ If the writer seems unsure or no specific next command is obvious, include this default option:
231
+
232
+ ```markdown
233
+ Next commands:
234
+ - `/scr:next`: Inspect the project state and choose the right next step.
235
+ ```
236
+
237
+ If the command stops because a prerequisite is missing, suggest the command that fixes the prerequisite. Keep every explanation practical and writer-facing.
@@ -0,0 +1,200 @@
1
+ ---
2
+ description: Run the full drafting pipeline autonomously. Choose guided, supervised, or full-auto profiles.
3
+ argument-hint: "[--profile guided|supervised|full-auto] [--from <stage>] [--to <stage>] [--unit N] [--resume]"
4
+ ---
5
+
6
+ # Autopilot
7
+
8
+ You are running the Scriveno pipeline autonomously. Your job is to execute the discuss-plan-draft-review-submit chain for each unit in OUTLINE.md, pausing only when the active profile requires it.
9
+
10
+ ## What to do
11
+
12
+ 0. **Bootstrap (context-cost protocol).** Read `.manuscript/CONTEXT.md` first if it exists. If its `Updated` timestamp is newer than `.manuscript/STATE.md` and newer than the newest file in `.manuscript/drafts/body/`, use it for orientation (project title, work type, phase, current unit, recent activity, open items, and record highlights when present) and skip the corresponding raw-file loads in steps 1-3 below; you still need to read `OUTLINE.md` for unit ordering, `RECORD.md` for established-content obligations when present, and `config.json` for the `autopilot` settings block specifically. If CONTEXT.md is missing, stale, or contradicts STATE.md, run steps 1-3 unchanged. See `docs/context-protocol.md` for the contract.
13
+
14
+ 1. **Read `.manuscript/config.json`** for autopilot settings: `profile` (guided, supervised, or full-auto), `enabled`, and `custom_checkpoints` array.
15
+
16
+ 2. **Read `.manuscript/STATE.md`** for current position: current unit, current stage, progress counters, and last actions.
17
+
18
+ 3. **Read `.manuscript/OUTLINE.md`** for total units and their order. This is the master list of what needs to be drafted.
19
+
20
+ 4. **Read `.manuscript/RECORD.md` when present.** Treat it as the compact store for established content: open threads, reader promises, payoffs, continuity facts, movement, and next-unit obligations. Older projects may not have RECORD.md; do not fail if it is missing.
21
+
22
+ 5. **If `--resume` flag is set:** Read STATE.md "Session handoff" and "Progress" sections. Determine the last completed unit and the last stage completed. Output ONE sentence explaining where you left off (e.g., "Last time, you drafted chapter 3 and passed voice check. Picking up at chapter 4, discuss stage."). Then re-enter the main loop from that point.
23
+
24
+ 6. **If `--profile` flag is set:** Override the config.json profile with the provided value. Valid values: `guided`, `supervised`, `full-auto`.
25
+
26
+ 7. **Enter the main loop** (see below).
27
+
28
+ ## Main loop
29
+
30
+ ```
31
+ FOR each unit in OUTLINE.md (starting from current position):
32
+ FOR each stage in [discuss, plan, draft, review, submit]:
33
+ Execute the canonical stage command (/scr:discuss, /scr:plan, etc.) with the unit number as an argument
34
+ Update STATE.md with: timestamp, command name, unit, outcome
35
+ Check pause conditions (see Profile rules below)
36
+ If paused: show review prompt, wait for writer input
37
+ If writer says "stop": exit loop, save state to STATE.md
38
+ If writer says "skip": advance to next unit, update STATE.md
39
+ ```
40
+
41
+ When the loop completes (all units through all stages), show a completion summary: total units, total word count, voice consistency across the manuscript, open record threads or promises, and any flags or issues encountered.
42
+
43
+ ## Profile rules
44
+
45
+ ### Guided
46
+
47
+ The writer reviews after every atomic unit. This is the safest, most hands-on profile.
48
+
49
+ **Pause behavior:** Pause after EVERY atomic unit draft completion.
50
+
51
+ **At each pause, show:**
52
+ 1. One-sentence summary of what was drafted
53
+ 2. The last 200 words of the drafted prose (so the writer can spot-check voice and tone without opening the file)
54
+ 3. Prompt: **"approve / revise / stop"**
55
+
56
+ **On writer response:**
57
+ - **"approve"** -- Continue to the next unit or stage
58
+ - **"revise"** -- Re-enter the draft stage for that unit. Ask the writer what to change, then re-draft with their feedback incorporated
59
+ - **"stop"** -- Save current position to STATE.md and exit the loop. The writer can resume later with `--resume`
60
+
61
+ ### Supervised
62
+
63
+ The writer reviews at structural boundaries. Less interruption, still provides oversight.
64
+
65
+ **Pause behavior:** Batch by structural unit boundary. Use the `mid` level from the work type hierarchy in CONSTRAINTS.json to determine boundaries.
66
+
67
+ - For a novel: `hierarchy.mid = "chapter"` -- pause when ALL scenes in a chapter are drafted
68
+ - For a screenplay: `hierarchy.mid = "sequence"` -- pause when ALL scenes in a sequence are drafted
69
+ - For a memoir: `hierarchy.mid = "chapter"` -- pause when ALL vignettes in a chapter are drafted
70
+ - For any work type: read CONSTRAINTS.json for the work type's hierarchy, use the `mid` level as the batch boundary
71
+
72
+ **Boundary detection:** Read OUTLINE.md to determine which atomic units belong to which mid-level unit. After completing each atomic unit, check whether all atomic units in the current mid-level unit are now complete. If yes, pause.
73
+
74
+ **At each pause, show:**
75
+ 1. List of completed units with word counts (e.g., "Chapter 3: Scene 1 (847 words), Scene 2 (1,102 words), Scene 3 (956 words)")
76
+ 2. Total word count for the structural unit
77
+ 3. Prompt: **"continue / review [unit] / stop"**
78
+
79
+ **On writer response:**
80
+ - **"continue"** -- Proceed to the next structural unit
81
+ - **"review [unit]"** -- Show the specified unit's draft for the writer to read and comment on
82
+ - **"stop"** -- Save state and exit
83
+
84
+ ### Full-auto
85
+
86
+ The writer trusts the pipeline. Autopilot runs until the entire manuscript is complete.
87
+
88
+ **Pause behavior:** Run until ALL units are complete. Pause ONLY on these conditions:
89
+
90
+ 1. **Continuity contradiction** the agent cannot resolve (e.g., a character is in two places at once, a previously established fact is contradicted)
91
+ 2. **Voice drift** exceeding `config.voice.drift_threshold` (default 0.3). After each unit, compare the drafted prose against STYLE-GUIDE.md. If drift exceeds threshold, pause.
92
+ 3. **Plot hole** with no clear resolution path (e.g., a setup with no payoff, a character motivation gap)
93
+ 4. **Missing critical information** that prevents drafting (character motivation gap, setting inconsistency, unresolved plot dependency)
94
+ 5. **Record drift** against `.manuscript/RECORD.md` that the agent cannot resolve safely (e.g., a promised payoff is contradicted, an open thread is closed without being recorded, or a next-unit obligation is skipped)
95
+ 6. **Writer-defined checkpoints** from `config.autopilot.custom_checkpoints` array
96
+
97
+ **Writer-defined checkpoints:** Read each checkpoint string as a natural-language instruction. At each iteration, check if the just-completed unit matches any checkpoint condition against the OUTLINE.md structure. Examples:
98
+ - `"pause after each act climax"` -- Check if the just-completed unit is marked as a climax in OUTLINE.md
99
+ - `"pause before chapter 10"` -- Check if the next unit is chapter 10
100
+ - `"pause after the midpoint"` -- Check if the just-completed unit is at the structural midpoint
101
+
102
+ **On pause (quality gate):** Show a diagnostic report:
103
+ - What triggered the pause (which condition, what was detected)
104
+ - The relevant context (the problematic passage, the contradiction, the drift score)
105
+ - Options for resolution (suggested fixes, or "provide guidance")
106
+ - Wait for writer input before continuing
107
+
108
+ **On completion:** Show a comprehensive summary:
109
+ - Total units drafted
110
+ - Total word count
111
+ - Voice consistency score across the manuscript
112
+ - Open record threads, reader promises, and unresolved next-unit obligations from RECORD.md
113
+ - Any flags or issues encountered during the run
114
+ - List of any quality gate pauses that occurred and how they were resolved
115
+
116
+ ## Resume logic
117
+
118
+ When `--resume` is passed:
119
+
120
+ 1. Read STATE.md "Session handoff" and "Progress" sections
121
+ 2. Determine the last completed unit and the last completed stage
122
+ 3. Output: "Last time, you [action from STATE.md session handoff]. Picking up at [unit] [stage]."
123
+ 4. Re-enter the main loop from that exact point -- do not re-run completed stages or units
124
+ 5. If STATE.md shows no prior autopilot run, start from the beginning and say so
125
+
126
+ ## Adaptive naming
127
+
128
+ Load `.manuscript/config.json` for the `command_unit` field. Keep the runnable commands canonical and adapt only the terminology in output:
129
+
130
+ - If `command_unit` is `"surah"`, run `/scr:draft 2` and describe it as drafting Surah 2
131
+ - If `command_unit` is `"act"`, show "Act 2 complete" not "Chapter 2 complete"
132
+
133
+ Reference CONSTRAINTS.json for work-type-specific hierarchy labels. All progress messages, pause prompts, and summaries must use the adapted terminology without inventing new command ids.
134
+
135
+ ## State management
136
+
137
+ **MANDATORY:** Update STATE.md after EVERY action -- not just at pauses. Resume depends on accurate state.
138
+
139
+ After each stage execution:
140
+ 1. Record in the "Last actions" table: timestamp, command name (e.g., `/scr:draft 3`), unit identifier, outcome (e.g., "drafted, 1,247 words, voice check passed")
141
+ 2. Update progress counters: `units_discussed`, `units_planned`, `units_drafted`, `units_reviewed`, `units_submitted`
142
+ 3. Update `current_unit` and next step
143
+ 4. Update `total_words` running count
144
+
145
+ On pause or stop:
146
+ 1. Write current position to "Session handoff" section so `--resume` can pick up exactly where you left off
147
+ 2. Include what was just completed and what the next action would be
148
+ 3. Record the writer's notes if they provide any
149
+
150
+ ## Response Contract
151
+
152
+ Every writer-facing response must end with one to four next-command suggestions. Each suggestion must include a short explanation of what that path will do.
153
+
154
+ Use this format:
155
+
156
+ ```markdown
157
+ Next commands:
158
+ - `/scr:...`: One short sentence explaining what this path will do.
159
+ - `/scr:...`: One short sentence explaining what this alternate path will do.
160
+ ```
161
+
162
+ If exactly one path is clearly best, provide one suggestion. If two, three, or four useful paths exist, show them as alternatives. Do not force a linear path when the writer has a real choice.
163
+
164
+ If the writer seems unsure or no specific next command is obvious, include this default option:
165
+
166
+ ```markdown
167
+ Next commands:
168
+ - `/scr:next`: Inspect the project state and choose the right next step.
169
+ ```
170
+
171
+ If the command stops because a prerequisite is missing, suggest the command that fixes the prerequisite. Keep every explanation practical and writer-facing.
172
+
173
+ ## Tone
174
+
175
+ **Progress updates:** Concise, one line per unit.
176
+ - "Drafted chapter 3: 1,247 words. Voice check: passed."
177
+ - "Planned scenes 1-4 for chapter 5."
178
+ - "Editor review complete for chapter 2: 3 notes."
179
+
180
+ **At pause points:** Warm, non-technical.
181
+ - "Chapter 3 is ready for your review."
182
+ - "The first act is complete -- 4 chapters, 12,340 words."
183
+ - "Something needs your attention in chapter 7."
184
+
185
+ **Never show** (unless `developer_mode` is `true` in config.json):
186
+ - Git terminology (commits, branches, diffs, hashes)
187
+ - File paths (`.manuscript/drafts/body/3-2-DRAFT.md`)
188
+ - Technical jargon (context window, tokens, agent invocation)
189
+ - Raw error output
190
+
191
+ **When `developer_mode` is `true`:** Show file paths, git operations, and technical details alongside the writer-friendly output.
192
+
193
+ ## Anti-patterns
194
+
195
+ - **NEVER** run without updating STATE.md -- resume depends on accurate state
196
+ - **NEVER** show raw git output in writer mode (when `developer_mode` is `false`)
197
+ - **NEVER** skip the voice comparison after drafting -- even if the voice-check command from Phase 4 is not yet available, use the drafter's built-in self-check (Step 4 in drafter.md)
198
+ - **NEVER** re-draft a unit that STATE.md shows as already submitted -- submitted means the writer approved it
199
+ - **NEVER** skip stages in the chain (discuss-plan-draft-review-submit) unless the writer explicitly says "skip"
200
+ - **NEVER** continue past a quality gate pause in full-auto without writer input -- the whole point is that these are conditions the pipeline cannot resolve alone