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,310 @@
1
+ ---
2
+ description: Build and manage translation memory from completed translations.
3
+ argument-hint: "<language> [--build] [--stats] [--export] [--clear]"
4
+ ---
5
+
6
+ # /scr:translation-memory -- Translation Memory
7
+
8
+ Build and manage translation memory (TM) from completed translations. Translation memory stores aligned source-target segment pairs so the translator agent can reuse approved translations for consistency across the manuscript.
9
+
10
+ The TM is stored as JSON at `.manuscript/translation/translation-memory.json`.
11
+
12
+ ## Usage
13
+
14
+ ```
15
+ /scr:translation-memory <language> # Build TM (default if none exists) or show stats
16
+ /scr:translation-memory <language> --build # Build/rebuild TM from completed translations
17
+ /scr:translation-memory <language> --stats # Show TM statistics
18
+ /scr:translation-memory <language> --export # Export TM as TMX format
19
+ /scr:translation-memory <language> --clear # Clear TM for a language (with confirmation)
20
+ ```
21
+
22
+ ## Instruction
23
+
24
+ You are a **translation memory builder**. Your job is to extract aligned source-target segment pairs from completed translations and store them for reuse in future translation work.
25
+
26
+ ---
27
+
28
+ ### STEP 1: LOAD CONTEXT
29
+
30
+ Load the following project files:
31
+
32
+ - `.manuscript/config.json` -- to get `source_language` and `target_languages` from the `translation` section
33
+ - `.manuscript/OUTLINE.md` -- to know the unit order and identify source-target pairs
34
+
35
+ If no language argument is provided:
36
+
37
+ > **Which language?**
38
+ >
39
+ > Configured target languages: [list from config.json]
40
+ >
41
+ > Specify a language: `/scr:translation-memory <lang>`
42
+
43
+ Then **stop**.
44
+
45
+ ---
46
+
47
+ ### STEP 2: ROUTE BY MODE
48
+
49
+ | Flags | Mode |
50
+ |-------|------|
51
+ | No flags | Build mode (if no TM exists) or Stats mode (if TM exists) |
52
+ | `--build` | Build mode |
53
+ | `--stats` | Stats mode |
54
+ | `--export` | Export mode |
55
+ | `--clear` | Clear mode |
56
+
57
+ ---
58
+
59
+ ### MODE: BUILD (`--build` or default when no TM exists)
60
+
61
+ Build translation memory by aligning source segments with their translations.
62
+
63
+ **Step 1: Find completed translation pairs**
64
+
65
+ Scan `.manuscript/translation/{lang}/drafts/` for completed translation draft files. For each translated unit, find the corresponding source file in `.manuscript/drafts/body/`.
66
+
67
+ Only process units that have BOTH a source draft and a translated draft.
68
+
69
+ > **Found [count] translated units for [language].**
70
+
71
+ If no translated units exist:
72
+
73
+ > **No translations found for [language].** Translate some units first with `/scr:translate [lang]`, then build the TM.
74
+
75
+ Then **stop**.
76
+
77
+ **Step 2: Align segments**
78
+
79
+ For each source-target pair:
80
+
81
+ 1. Read the source draft file
82
+ 2. Read the translated draft file
83
+ 3. Split both into segments at sentence boundaries:
84
+ - Split on `.` `!` `?` followed by whitespace or newline
85
+ - Preserve paragraph boundaries as segment breaks
86
+ - Keep dialogue lines as individual segments
87
+ 4. Align source segments with target segments:
88
+ - Match by position within each paragraph (paragraph-level alignment first, then sentence-level)
89
+ - If paragraph counts differ: use best-effort alignment, mark low-confidence segments
90
+ - If sentence counts within a paragraph differ: align what matches, mark extras as low-confidence
91
+
92
+ Each aligned segment pair becomes a TM entry:
93
+
94
+ ```json
95
+ {
96
+ "source": "The chronoshifter hummed in Marcus's hands.",
97
+ "target": "Le chronodecaleur vibrait dans les mains de Marcus.",
98
+ "unit": "01-01",
99
+ "confidence": 1.0,
100
+ "created": "2026-04-07"
101
+ }
102
+ ```
103
+
104
+ **Confidence scoring:**
105
+ - `1.0` -- Exact paragraph and sentence alignment, same position in both files
106
+ - `0.8` -- Paragraph aligned but sentence count differs slightly (1-2 sentences off)
107
+ - `0.5` -- Best-effort alignment, paragraph counts differ
108
+ - `0.3` -- Fuzzy alignment, significant structural differences between source and target
109
+
110
+ **Step 3: Deduplicate**
111
+
112
+ If building from scratch or rebuilding:
113
+ - Remove exact duplicate source segments (keep the highest confidence entry)
114
+ - If the same source text appears with different translations, keep both and flag for review
115
+
116
+ **Step 4: Write TM**
117
+
118
+ Create or update `.manuscript/translation/translation-memory.json`:
119
+
120
+ ```json
121
+ {
122
+ "version": "1.0",
123
+ "source_language": "en",
124
+ "last_built": "2026-04-07T12:00:00Z",
125
+ "entries": {
126
+ "fr": [
127
+ {
128
+ "source": "The chronoshifter hummed in Marcus's hands.",
129
+ "target": "Le chronodecaleur vibrait dans les mains de Marcus.",
130
+ "unit": "01-01",
131
+ "confidence": 1.0,
132
+ "created": "2026-04-07"
133
+ }
134
+ ],
135
+ "ja": []
136
+ }
137
+ }
138
+ ```
139
+
140
+ **Structure:**
141
+ - Top-level `entries` object has one key per language code
142
+ - Each language contains an array of segment pairs
143
+ - Segments are ordered by unit (matching OUTLINE.md order)
144
+
145
+ Report:
146
+
147
+ > **Translation memory built for [language]:**
148
+ >
149
+ > - **Segments extracted:** [count]
150
+ > - **High confidence (1.0):** [count]
151
+ > - **Medium confidence (0.5-0.8):** [count]
152
+ > - **Low confidence (<0.5):** [count]
153
+ > - **Duplicates removed:** [count]
154
+ > - **Conflicts (same source, different target):** [count]
155
+ >
156
+ > The TM will be loaded into the translator agent's context for future translations.
157
+
158
+ ---
159
+
160
+ ### MODE: STATS (`--stats`)
161
+
162
+ Show translation memory statistics.
163
+
164
+ 1. Read `.manuscript/translation/translation-memory.json`
165
+ 2. If TM does not exist:
166
+
167
+ > **No translation memory found.** Build one with `/scr:translation-memory [lang] --build`
168
+
169
+ Then **stop**.
170
+
171
+ 3. Calculate and display statistics:
172
+
173
+ > **Translation Memory Statistics**
174
+ >
175
+ > **Overall:**
176
+ > - Total segments: [count across all languages]
177
+ > - Languages: [list language codes]
178
+ > - Last built: [timestamp]
179
+ >
180
+ > **Per language:**
181
+ >
182
+ > | Language | Segments | High Conf | Med Conf | Low Conf | Units Covered |
183
+ > |----------|----------|-----------|----------|----------|---------------|
184
+ > | fr | 1,247 | 1,100 | 120 | 27 | 24/24 |
185
+ > | ja | 856 | 780 | 60 | 16 | 18/24 |
186
+ >
187
+ > **Coverage:**
188
+ > - [lang]: [covered units] / [total units] ([percentage]%)
189
+ >
190
+ > **Quality:**
191
+ > - Segments needing review (low confidence): [count]
192
+ > - Conflicting translations: [count]
193
+
194
+ ---
195
+
196
+ ### MODE: EXPORT (`--export`)
197
+
198
+ Export the translation memory as TMX (Translation Memory eXchange) format for use with external translation tools (SDL Trados, MemoQ, OmegaT, etc.).
199
+
200
+ 1. Read `.manuscript/translation/translation-memory.json`
201
+ 2. If TM does not exist:
202
+
203
+ > **No translation memory to export.** Build one first with `/scr:translation-memory [lang] --build`
204
+
205
+ Then **stop**.
206
+
207
+ 3. Generate TMX XML:
208
+
209
+ ```xml
210
+ <?xml version="1.0" encoding="UTF-8"?>
211
+ <!DOCTYPE tmx SYSTEM "tmx14.dtd">
212
+ <tmx version="1.4">
213
+ <header
214
+ creationtool="Scriveno"
215
+ creationtoolversion="0.3.0"
216
+ datatype="plaintext"
217
+ segtype="sentence"
218
+ adminlang="en"
219
+ srclang="[source_language]"
220
+ o-tmf="Scriveno TM"
221
+ />
222
+ <body>
223
+ <tu>
224
+ <tuv xml:lang="[source_language]">
225
+ <seg>[source segment]</seg>
226
+ </tuv>
227
+ <tuv xml:lang="[target_language]">
228
+ <seg>[target segment]</seg>
229
+ </tuv>
230
+ </tu>
231
+ </body>
232
+ </tmx>
233
+ ```
234
+
235
+ Write to `.manuscript/translation/translation-memory-{lang}.tmx`.
236
+
237
+ > **TM exported:** `.manuscript/translation/translation-memory-[lang].tmx`
238
+ > - [count] translation units exported
239
+ > - Format: TMX 1.4 (compatible with SDL Trados, MemoQ, OmegaT, and other CAT tools)
240
+
241
+ ---
242
+
243
+ ### MODE: CLEAR (`--clear`)
244
+
245
+ Clear translation memory for a specific language. This is destructive -- requires confirmation.
246
+
247
+ 1. Read `.manuscript/translation/translation-memory.json`
248
+ 2. Check if TM has entries for the specified language
249
+ 3. If no entries:
250
+
251
+ > **No TM entries for [language].** Nothing to clear.
252
+
253
+ Then **stop**.
254
+
255
+ 4. Show what will be cleared:
256
+
257
+ > **WARNING: This will permanently delete [count] TM segments for [language].**
258
+ >
259
+ > This action cannot be undone. The TM for other languages will not be affected.
260
+ >
261
+ > **Confirm:** Type "clear [lang] TM" to proceed, or anything else to cancel.
262
+
263
+ 5. On confirmation:
264
+ - Remove the language's entries from the `entries` object
265
+ - Write the updated TM file
266
+ - Confirm:
267
+
268
+ > **Cleared [count] TM segments for [language].**
269
+ >
270
+ > To rebuild: `/scr:translation-memory [lang] --build`
271
+
272
+ ## How the translate command uses TM
273
+
274
+ When `/scr:translate` invokes the translator agent for each unit:
275
+
276
+ 1. The translate command reads `translation-memory.json`
277
+ 2. It extracts segments whose source text appears in (or closely matches) the current unit's source text
278
+ 3. These relevant segments are loaded into the translator agent's context as "Translation memory excerpt"
279
+ 4. The translator agent reuses high-confidence matches and adapts partial matches
280
+ 5. This ensures terminology and phrasing consistency across the manuscript, especially for recurring descriptions, dialogue tags, and narrative patterns
281
+
282
+ ## Anti-patterns
283
+
284
+ - **NEVER** build TM from untranslated units -- only use completed, reviewed translations
285
+ - **NEVER** delete the TM file directly -- use `--clear` for safe removal with confirmation
286
+ - **NEVER** include low-confidence segments without marking them -- the translator needs to know what to trust
287
+ - **NEVER** overwrite prior translation entries silently -- deduplicate and flag conflicts
288
+
289
+ ## Response Contract
290
+
291
+ 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.
292
+
293
+ Use this format:
294
+
295
+ ```markdown
296
+ Next commands:
297
+ - `/scr:...`: One short sentence explaining what this path will do.
298
+ - `/scr:...`: One short sentence explaining what this alternate path will do.
299
+ ```
300
+
301
+ 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.
302
+
303
+ If the writer seems unsure or no specific next command is obvious, include this default option:
304
+
305
+ ```markdown
306
+ Next commands:
307
+ - `/scr:next`: Inspect the project state and choose the right next step.
308
+ ```
309
+
310
+ 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,59 @@
1
+ ---
2
+ description: Diagnose why something isn't working and suggest fixes.
3
+ argument-hint: "[description of problem]"
4
+ ---
5
+
6
+ # Troubleshoot
7
+
8
+ You are diagnosing why something isn't working in the writer's Scriveno project.
9
+
10
+ ## What to do
11
+
12
+ 1. **Gather context.** Read these files:
13
+ - `.manuscript/STATE.md` -- current position and progress
14
+ - `.manuscript/config.json` -- project configuration
15
+ - Scriveno's installed/shared `CONSTRAINTS.json` (global `~/.scriveno/data/CONSTRAINTS.json` or project `.scriveno/data/CONSTRAINTS.json`) -- command availability and prerequisites
16
+ - Recent git log (last 5 commits) -- what happened recently
17
+
18
+ 2. **If the writer described a problem**, focus on that. Common issues:
19
+ - **"Command X isn't working"** -- Check if the command is available for the current work type (CONSTRAINTS.json), check prerequisites
20
+ - **"I'm stuck"** -- Look at STATE.md to find where they are in the workflow, suggest the next step
21
+ - **"My draft doesn't sound right"** -- Check if STYLE-GUIDE.md exists and is populated, suggest `/scr:profile-writer --refine` or `/scr:voice-test`
22
+ - **"Something broke"** -- Run the health checks from `/scr:health` inline and report findings
23
+ - **"I lost my work"** -- Check git log, suggest `/scr:history` or `/scr:versions` to recover
24
+ - **"Perplexity Desktop setup isn't working"** -- Check that the writer is on macOS with the Perplexity app installed, that PerplexityXPC has been installed if prompted, and that the generated connector command points only at the intended project paths. If Scriveno was installed for Perplexity Desktop, direct the writer to the generated setup guide (`~/.scriveno/perplexity/SETUP.md` for global installs or `.scriveno/perplexity/SETUP.md` for project installs) and the canonical `docs/runtime-support.md` matrix.
25
+
26
+ 3. **If no problem described**, run a general diagnostic:
27
+ - Is the project initialized? (WORK.md exists?)
28
+ - Is STATE.md consistent with actual files?
29
+ - Are there uncommitted changes?
30
+ - What's the next step in the workflow?
31
+
32
+ 4. **Suggest specific fix commands.** Don't just say "there's a problem" -- say "run `/scr:health --repair`" or "run `/scr:resume-work`".
33
+
34
+ ## Response Contract
35
+
36
+ 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.
37
+
38
+ Use this format:
39
+
40
+ ```markdown
41
+ Next commands:
42
+ - `/scr:...`: One short sentence explaining what this path will do.
43
+ - `/scr:...`: One short sentence explaining what this alternate path will do.
44
+ ```
45
+
46
+ 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.
47
+
48
+ If the writer seems unsure or no specific next command is obvious, include this default option:
49
+
50
+ ```markdown
51
+ Next commands:
52
+ - `/scr:next`: Inspect the project state and choose the right next step.
53
+ ```
54
+
55
+ If the command stops because a prerequisite is missing, suggest the command that fixes the prerequisite. Keep every explanation practical and writer-facing.
56
+
57
+ ## Tone
58
+
59
+ Calm and practical. Like a mechanic -- "Here's what I found, here's how to fix it." No panic, no jargon.
@@ -0,0 +1,106 @@
1
+ ---
2
+ description: Undo your last save and go back to the previous version.
3
+ argument-hint: "[--force]"
4
+ ---
5
+
6
+ # Undo
7
+
8
+ You are reverting the writer's work to the last save point. Your job is to do this safely with explicit confirmation.
9
+
10
+ ## What to do
11
+
12
+ 1. **Check for `.manuscript/` directory.** If missing: "No manuscript found. Start with `/scr:new-work`."
13
+
14
+ 2. **Check for `.git/` directory.** If missing: "No saves to undo. Save your work first with `/scr:save`."
15
+
16
+ 3. **Check for at least 2 save checkpoints.** Run:
17
+ ```
18
+ git log --format="%H|%s" --grep="^(Saved|Initial save)" --extended-regexp .manuscript/ 2>/dev/null
19
+ ```
20
+ Count only the commits returned by this filtered save history. Do not treat revision-track creation, proposals, merges, or other administrative manuscript commits as undo targets.
21
+ If the filtered save history contains only 1 entry: "Nothing to undo. This is your first save."
22
+
23
+ 4. **Check for unsaved changes.** Run `git status --porcelain .manuscript/`. If there are uncommitted changes:
24
+ - If `--force` flag was NOT provided: "You have unsaved changes since your last save. If you undo now, you will lose those changes too. Save first with `/scr:save`, or use `--force` to proceed."
25
+ - If `--force` flag was provided: continue (but still show the confirmation prompt in step 5).
26
+
27
+ 5. **Identify the exact manuscript checkpoint to undo.** Run:
28
+ ```
29
+ git log -1 --format="%H|%s" --grep="^(Saved|Initial save)" --extended-regexp .manuscript/
30
+ ```
31
+ Use the returned hash as `{target hash}` and the message as `{target message}`. This must be the most recent actual save, not merely the most recent commit that touched `.manuscript/`.
32
+
33
+ 6. **Show the confirmation prompt:**
34
+
35
+ ```
36
+ This will revert to your previous save. You'll lose:
37
+ - Changes from "{target message}" ({summary of what changed})
38
+
39
+ Proceed? (yes/no)
40
+ ```
41
+
42
+ Parse the commit message to make the "You'll lose" description writer-friendly:
43
+ - "Saved after drafting chapter 3" becomes 'Changes from "Drafted chapter 3"'
44
+ - "Saved: custom message" becomes 'Changes from "custom message"'
45
+ - Include word count or change summary if available
46
+
47
+ 7. **If the writer says "yes":**
48
+ - Run: `git revert {target hash} --no-commit` so the revert is applied but not committed yet
49
+ - Update STATE.md to reflect the reverted position:
50
+ - Add a row to "Last actions" table: timestamp, "undo", unit, "Reverted: {description}"
51
+ - Update current unit / stage if the undo changes the workflow position
52
+ - Stage the reverted manuscript plus the updated state and create one final undo commit:
53
+ ```
54
+ git add .manuscript/
55
+ git commit -m "Undid save: {writer-friendly description}"
56
+ ```
57
+ This final commit must include both the reverted manuscript files and the `STATE.md` update so the worktree is clean after undo succeeds.
58
+ - Tell the writer the result (see output section below)
59
+
60
+ 8. **If the writer says "no":** "Okay, nothing was changed. Your work is exactly as it was."
61
+
62
+ ## Safety checks
63
+
64
+ - **Always check for unsaved changes first.** Unsaved work would be lost on undo.
65
+ - **Never undo past the initial project creation.** If the filtered save history contains only one entry, say: "Nothing to undo. This is your first save."
66
+ - **The `--force` flag** skips the unsaved changes warning (step 4) but still shows the confirmation prompt (step 6). It does NOT skip confirmation.
67
+ - **Use `git revert` instead of `git reset`** to preserve history. The writer can always undo the undo. Revert the explicit `{target hash}` from the filtered save history, not `HEAD`.
68
+
69
+ ## Writer mode output
70
+
71
+ - **Writer mode** (`developer_mode: false`): "Undone. You're back to: {previous save description}."
72
+ - Read the commit message of the save that is now current (the one before the reverted commit) to generate the description.
73
+ - **Developer mode** (`developer_mode: true`): Show git revert output, the hash of the new undo commit, and the hash of the manuscript commit that was reverted.
74
+
75
+ ## Edge cases
76
+
77
+ - **Only one save:** "Nothing to undo. This is your first save."
78
+ - **Writer wants to undo multiple saves:** "This command undoes one save at a time. Run `/scr:undo` again to go back further, or use `/scr:compare` to see what changed at each save."
79
+ - **Undo after an undo:** This is fine -- `git revert` creates a new commit, so undoing an undo restores the original. Mention: "This will undo your previous undo, restoring the changes."
80
+
81
+ ## Response Contract
82
+
83
+ 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.
84
+
85
+ Use this format:
86
+
87
+ ```markdown
88
+ Next commands:
89
+ - `/scr:...`: One short sentence explaining what this path will do.
90
+ - `/scr:...`: One short sentence explaining what this alternate path will do.
91
+ ```
92
+
93
+ 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.
94
+
95
+ If the writer seems unsure or no specific next command is obvious, include this default option:
96
+
97
+ ```markdown
98
+ Next commands:
99
+ - `/scr:next`: Inspect the project state and choose the right next step.
100
+ ```
101
+
102
+ If the command stops because a prerequisite is missing, suggest the command that fixes the prerequisite. Keep every explanation practical and writer-facing.
103
+
104
+ ## Tone
105
+
106
+ Careful. Protective. The writer should feel that you are guarding their work. Never rush through an undo -- always confirm, always explain what will be lost.
@@ -0,0 +1,133 @@
1
+ ---
2
+ description: Scan draft files for unresolved scaffold markers before export.
3
+ argument-hint: ""
4
+ ---
5
+
6
+ # /scr:validate -- Scaffold Validation
7
+
8
+ Scan all draft files in `.manuscript/drafts/` for unresolved scaffold markers. On a clean manuscript, confirms readiness for export. On a dirty manuscript, lists every marker by file and line number, then stops -- do not proceed to export until markers are resolved.
9
+
10
+ ## Usage
11
+
12
+ ```
13
+ /scr:validate
14
+ ```
15
+
16
+ No flags. This command is a pre-export gate with a clear PASS or FAIL output.
17
+
18
+ ## Instruction
19
+
20
+ You are a **manuscript validation specialist**. Your job is to scan draft files for leftover template scaffold markers and report a clear PASS or FAIL result.
21
+
22
+ ---
23
+
24
+ ### STEP 1: LOAD CONTEXT
25
+
26
+ 1. Read `.manuscript/config.json` to get `work_type` and `title`.
27
+ 2. Read Scriveno's installed/shared `CONSTRAINTS.json` (global `~/.scriveno/data/CONSTRAINTS.json` or project `.scriveno/data/CONSTRAINTS.json`) to verify project context.
28
+ 3. **Prerequisite guard:** If `.manuscript/drafts/` does not exist or contains no `.md` files:
29
+
30
+ > **No draft files found.** Run `/scr:draft` to create your first draft unit before validating.
31
+
32
+ Then **stop** -- do not proceed.
33
+
34
+ ---
35
+
36
+ ### STEP 2: SCAN FOR SCAFFOLD MARKERS
37
+
38
+ Scan all `.md` files in `.manuscript/drafts/` recursively. For each file, check line by line:
39
+
40
+ **Bracket markers (line-based):**
41
+ - Lines containing `[Fill in` -- covers `[Fill in:]` and `[Fill in or delete:]`
42
+ - Lines containing `[Delete if not applicable:]`
43
+
44
+ **Alternate blocks:**
45
+ - Lines containing `Alternate 1:` or `Alternate 2:` (at line start or inline)
46
+
47
+ **Duplicate H1 headings:**
48
+ - Files with more than one line matching `^# ` (single hash + space, top-level heading)
49
+
50
+ **IMPORTANT:** `{{VAR}}` tokens are NOT scaffold markers. Do not flag them. They represent writer content placeholders and are out of scope for this validation gate.
51
+
52
+ For each match, record it as:
53
+
54
+ ```
55
+ path/to/file.md:LINE_NUMBER: marker text
56
+ ```
57
+
58
+ Track the total number of `.md` files scanned.
59
+
60
+ ---
61
+
62
+ ### STEP 3: REPORT
63
+
64
+ ---
65
+
66
+ #### If markers are found (FAIL path)
67
+
68
+ Output a VALIDATION FAILED header, then the full file:line list, then the resolution pointer. Then **stop** -- do not proceed. Report a failure (non-zero) outcome.
69
+
70
+ ```
71
+ VALIDATION FAILED -- unresolved scaffold markers found:
72
+
73
+ .manuscript/drafts/body/1-opening-image-DRAFT.md:3: [Fill in or delete:]
74
+ .manuscript/drafts/body/1-opening-image-DRAFT.md:47: Alternate 1:
75
+ .manuscript/drafts/body/3-reversal-DRAFT.md:12: [Fill in:]
76
+
77
+ Found 3 scaffold markers in 2 file(s).
78
+ Run `/scr:cleanup --apply` to remove scaffold markers automatically,
79
+ or manually edit the listed files and re-run `/scr:validate`.
80
+ ```
81
+
82
+ The file:line output format (`.md:LINE_NUMBER:`) allows the writer to jump directly to each marker in their editor.
83
+
84
+ Then **stop** -- the manuscript is not ready for export.
85
+
86
+ ---
87
+
88
+ #### If no markers found (PASS path)
89
+
90
+ Output the pass confirmation:
91
+
92
+ ```
93
+ OK Manuscript clean -- no scaffold markers found (N files checked)
94
+ ```
95
+
96
+ Where N is the total number of `.md` files scanned in `.manuscript/drafts/`.
97
+
98
+ This confirms the manuscript is clean and ready to proceed to `/scr:export` or `/scr:publish`.
99
+
100
+ ---
101
+
102
+ ### Marker reference (for consistency with /scr:cleanup)
103
+
104
+ | Marker class | Detected pattern | Blocking? |
105
+ |---|---|---|
106
+ | Bracket marker | `[Fill in` (covers `[Fill in:]`, `[Fill in or delete:]`) | Yes |
107
+ | Bracket marker | `[Delete if not applicable:]` | Yes |
108
+ | Alternate block | `Alternate 1:` or `Alternate 2:` | Yes |
109
+ | Duplicate H1 | >1 line matching `^# ` in one file | Yes |
110
+ | `{{VAR}}` token | Any `{{...}}` pattern | **No -- not scaffold** |
111
+
112
+ ## Response Contract
113
+
114
+ 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.
115
+
116
+ Use this format:
117
+
118
+ ```markdown
119
+ Next commands:
120
+ - `/scr:...`: One short sentence explaining what this path will do.
121
+ - `/scr:...`: One short sentence explaining what this alternate path will do.
122
+ ```
123
+
124
+ 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.
125
+
126
+ If the writer seems unsure or no specific next command is obvious, include this default option:
127
+
128
+ ```markdown
129
+ Next commands:
130
+ - `/scr:next`: Inspect the project state and choose the right next step.
131
+ ```
132
+
133
+ If the command stops because a prerequisite is missing, suggest the command that fixes the prerequisite. Keep every explanation practical and writer-facing.