cowriter 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.md +283 -0
  2. package/assets/cowriter-header.png +0 -0
  3. package/frontend/app/api/cowriter/codex/route.ts +65 -0
  4. package/frontend/app/api/cowriter/cover/route.ts +45 -0
  5. package/frontend/app/api/cowriter/events/hub.ts +24 -0
  6. package/frontend/app/api/cowriter/events/route.ts +77 -0
  7. package/frontend/app/api/cowriter/route.ts +83 -0
  8. package/frontend/app/api/cowriter/selection/route.ts +69 -0
  9. package/frontend/app/api/cowriter/selection/store.ts +27 -0
  10. package/frontend/app/globals.css +274 -0
  11. package/frontend/app/layout.tsx +14 -0
  12. package/frontend/app/page.tsx +1554 -0
  13. package/frontend/components/ui.tsx +66 -0
  14. package/frontend/lib/highlight.ts +53 -0
  15. package/frontend/lib/markdown.ts +47 -0
  16. package/frontend/lib/project.ts +335 -0
  17. package/frontend/lib/skills.ts +15 -0
  18. package/frontend/lib/turndown-plugin-gfm.d.ts +5 -0
  19. package/frontend/lib/types.ts +143 -0
  20. package/frontend/lib/utils.ts +6 -0
  21. package/frontend/lib/writing-skills.json +58 -0
  22. package/frontend/next-env.d.ts +6 -0
  23. package/frontend/next.config.js +10 -0
  24. package/frontend/package.json +44 -0
  25. package/frontend/postcss.config.mjs +7 -0
  26. package/frontend/tsconfig.json +22 -0
  27. package/package.json +62 -0
  28. package/scripts/cowriter-ai.mjs +1126 -0
  29. package/templates/init/.codex/skills/cowriter/SKILL.md +273 -0
  30. package/templates/init/.codex/skills/cowriter/references/actions.md +52 -0
  31. package/templates/init/.codex/skills/cowriter/references/character-voice.md +23 -0
  32. package/templates/init/.codex/skills/cowriter/references/context-priming.md +15 -0
  33. package/templates/init/.codex/skills/cowriter/references/continuity-review.md +22 -0
  34. package/templates/init/.codex/skills/cowriter/references/import-existing.md +16 -0
  35. package/templates/init/.codex/skills/cowriter/references/onboarding.md +45 -0
  36. package/templates/init/.codex/skills/cowriter/references/project-model.md +45 -0
  37. package/templates/init/.codex/skills/cowriter/references/prose-diagnostics.md +33 -0
  38. package/templates/init/.codex/skills/cowriter/references/prose-review.md +22 -0
  39. package/templates/init/.codex/skills/cowriter/references/scene-planning.md +28 -0
  40. package/templates/init/.codex/skills/cowriter/references/state-updates.md +22 -0
  41. package/templates/init/.codex/skills/cowriter/references/title-brainstorming.md +27 -0
  42. package/templates/init/.cowriter/project.yaml +3 -0
  43. package/templates/init/.cowriter/reports/.gitkeep +1 -0
  44. package/templates/init/AGENTS.md +79 -0
  45. package/templates/init/chapters/001-opening.md +0 -0
  46. package/templates/init/characters/primary-character.yaml +6 -0
  47. package/templates/init/outline.yaml +4 -0
  48. package/templates/init/story.yaml +8 -0
@@ -0,0 +1,273 @@
1
+ ---
2
+ name: cowriter
3
+ description: Work inside local Cowriter book projects from Codex.app. Use when the user mentions Cowriter, a manuscript, chapters, story bible, synopsis, characters, outline, continuity, selected prose, or wants Codex to draft/revise long-form fiction in a local book workspace.
4
+ compatibility: Requires Node.js, an installed `cowriter` CLI or local checkout, and browser access to localhost for the workspace UI.
5
+ metadata:
6
+ author: Cowriter
7
+ allowed-tools: Bash(cowriter *), Bash(npx cowriter *), Bash(curl http://localhost:*)
8
+ user-invocable: true
9
+ ---
10
+
11
+ # Cowriter
12
+
13
+ Cowriter is a local book-writing workspace for Codex.app. Codex is the interview and collaboration surface; the localhost UI is the manuscript and story-material workspace.
14
+
15
+ ## First Step
16
+
17
+ Check project and app context:
18
+
19
+ ```bash
20
+ cowriter info -o json
21
+ ```
22
+
23
+ If the CLI is installed globally or from npm, this is equivalent:
24
+
25
+ ```bash
26
+ npx cowriter info -o json
27
+ ```
28
+
29
+ Use JSON output for all data-returning commands.
30
+
31
+ ## Core Workflow
32
+
33
+ 1. Run `info -o json` from the book folder, or with `--path`.
34
+ 2. If the app is not running for this book, tell the writer to run `npx cowriter serve --open` from the book folder and open the reported localhost URL in Codex Browser. Do not start the long-running serve process yourself unless the writer explicitly asks.
35
+ 3. If there is no book folder yet, ask whether the writer has a title, a synopsis, or an existing folder.
36
+ 4. Initialize the project with `init`, or ask the writer to serve the existing folder with `serve --path`.
37
+ 5. Inspect the current book context before making writing suggestions.
38
+ 6. Interview in short turns when the book is empty.
39
+ 7. If the writer refers to selected text and the text is not already available in chat or file context, use the selection context API when it would materially improve the response.
40
+ 8. When discussing a specific manuscript passage, call the Cowriter highlight API so the UI selects that passage for the writer.
41
+ 9. Edit the book files directly when changes are approved.
42
+ 10. Save approved project changes immediately as the work progresses.
43
+ 11. Commit book changes at sensible creative checkpoints and when the work session is complete.
44
+
45
+ ## Commands
46
+
47
+ ```bash
48
+ cowriter info -o json
49
+ cowriter serve --path /absolute/path/to/book --open
50
+ cowriter init /absolute/path/to/book -o json
51
+ cowriter upgrade --path ~/Writing/Book -o json
52
+ cowriter inspect --path ~/Writing/Book -o json
53
+ cowriter diagnose prose --path ~/Writing/Book --chapter chapters/001-opening.md -o json
54
+ ```
55
+
56
+ Prefer `cowriter` or `npx cowriter` inside book projects. Use the local `node scripts/cowriter-ai.mjs` form only when working inside the Cowriter repository.
57
+
58
+ Expected local setup from a new book folder:
59
+
60
+ ```bash
61
+ mkdir my-book && cd my-book
62
+ npx cowriter init
63
+ npx cowriter serve --open
64
+ ```
65
+
66
+ Then add that folder as the active Codex project. Each `serve` process represents one book folder, chooses an available port starting at `47891`, reports the localhost URL, and remains running in its terminal.
67
+
68
+ If Codex Browser is not already open at the reported localhost URL, or it is open on a different localhost port, open or navigate Codex Browser to that exact URL for the writer.
69
+
70
+ ## Selection Context API
71
+
72
+ The web workspace publishes the current manuscript selection for the served book. If the writer asks about "this", "the selected text", or a selected passage and the selected text is not already in the conversation or local file context, you may retrieve it from the workspace:
73
+
74
+ ```bash
75
+ curl -sS "$COWRITER_URL/api/cowriter/selection"
76
+ ```
77
+
78
+ The response is shaped like:
79
+
80
+ ```json
81
+ {
82
+ "activeProjectPath": "/absolute/path/to/book",
83
+ "selection": {
84
+ "source": "manuscript",
85
+ "selectedText": "exact selected manuscript text",
86
+ "chapterPath": "chapters/001-opening.md",
87
+ "chapterTitle": "Opening",
88
+ "range": { "from": 42, "to": 96 },
89
+ "activePage": 0,
90
+ "surroundingText": "nearby manuscript context",
91
+ "updatedAt": 1760000000000
92
+ }
93
+ }
94
+ ```
95
+
96
+ Use this endpoint only when it gives needed context. If `selection` is `null`, stale, or not useful, continue from the available project files or ask the writer for the passage.
97
+
98
+ ## UI Highlight API
99
+
100
+ When talking about a specific manuscript passage with the writer, ask the Cowriter web UI to highlight that passage. Derive the base URL from `cowriter info -o json` at `app.url`, then call:
101
+
102
+ ```bash
103
+ curl -sS -X POST "$COWRITER_URL/api/cowriter/codex" \
104
+ -H 'content-type: application/json' \
105
+ --data '{"command":"highlight","text":"exact passage text","chapterPath":"chapters/001-opening.md"}'
106
+ ```
107
+
108
+ Use the exact quoted passage text when possible. Include `chapterPath` when you know the chapter file, and include `occurrence` when the same passage appears more than once. If the workspace is not open or the highlight is not found, continue the writing conversation normally.
109
+
110
+ ## Onboarding
111
+
112
+ When there is no book folder yet, or `inspect` returns `bookIsEmpty: true`, ask:
113
+
114
+ > What do you know about the book right now: a title, a synopsis, or an existing folder?
115
+
116
+ Ask one onboarding question at a time. Wait for the writer's answer before asking the next question; do not bundle premise, protagonist, setting, ending, and folder questions into a single turn unless the user explicitly asks for a checklist. After each answer, save accepted stable details when appropriate, then ask the next most useful question. Stop interviewing when there is enough context to draft or revise the next page, or when the writer wants to start writing.
117
+
118
+ If the writer has a title:
119
+
120
+ 1. Ask for the working title and local folder.
121
+ 2. Initialize the folder with `cowriter init /path --title "Working Title" -o json`.
122
+ 3. Interview for a rough one-paragraph synopsis, one question at a time.
123
+ 4. Save accepted synopsis text directly to `story.yaml`.
124
+ 5. Do not demand detailed fields before synopsis exists.
125
+
126
+ If the writer has a synopsis:
127
+
128
+ 1. Ask for the synopsis and local folder.
129
+ 2. Generate a working title and say it is editable.
130
+ 3. Initialize the folder with `cowriter init /path --title "Working Title" --synopsis "..." -o json`.
131
+ 4. Ask at most three focused interview questions, one at a time: protagonist pressure, setting constraint, and ending or emotional promise.
132
+ 5. Save accepted story fields, character notes, and outline beats directly to the project files.
133
+
134
+ If the writer has an existing project:
135
+
136
+ 1. Tell the writer to run `cowriter serve --path /absolute/path/to/book --open`.
137
+ 2. Inspect it.
138
+ 3. Summarize the current book state.
139
+ 4. Recommend the next concrete writing task.
140
+
141
+ ## Direct File Editing
142
+
143
+ Codex should edit Cowriter project files directly. The localhost web workspace watches the book folder and refreshes when these files change.
144
+
145
+ Primary files:
146
+
147
+ - `chapters/*.md` for manuscript chapters.
148
+ - `story.yaml` for title, synopsis, setting, themes, genre, tone, perspective, and continuity.
149
+ - `characters/*.yaml` for character records.
150
+ - `outline.yaml` for outline beats.
151
+ - `.cowriter/project.yaml` for project metadata.
152
+
153
+ Do not use action envelopes or temporary JSON files for writing edits. The current workflow is direct file editing.
154
+
155
+ After editing files, run:
156
+
157
+ ```bash
158
+ cowriter inspect --path /absolute/path/to/book -o json
159
+ ```
160
+
161
+ Use `git diff -- chapters story.yaml characters outline.yaml .cowriter` when you need to show exactly what changed.
162
+
163
+ ## Local Prose Diagnostics
164
+
165
+ Use deterministic prose diagnostics when the writer asks for a prose check, style scan, AI-ish wording scan, rhythm check, or a review of a whole chapter before revision. This is advisory only; it does not rewrite manuscript text.
166
+
167
+ Run diagnostics for a chapter:
168
+
169
+ ```bash
170
+ cowriter diagnose prose --path /absolute/path/to/book --chapter chapters/001-opening.md -o json
171
+ ```
172
+
173
+ The command reports metrics and findings for repetition, long paragraphs, sentence rhythm, dialogue percentage, filler or AI-ish terms, mixed quote styles, and em dash density.
174
+
175
+ When the writer asks to save the review, write a report artifact:
176
+
177
+ ```bash
178
+ cowriter diagnose prose --path /absolute/path/to/book --chapter chapters/001-opening.md --write-report -o json
179
+ ```
180
+
181
+ `--write-report` creates `.cowriter/reports/*.md`, which `cowriter inspect -o json` lists under `project.reports`. Do not run `--write-report` by default; use it only when the writer asks for a saved review or when creating an approved checkpoint report.
182
+
183
+ After writing a diagnostics report, run:
184
+
185
+ ```bash
186
+ cowriter inspect --path /absolute/path/to/book -o json
187
+ ```
188
+
189
+ For selected-passage feedback, prefer reading selected text or the relevant chapter context and responding in chat. The diagnostics command is chapter-level only.
190
+
191
+ ## Iterative Writing Workflows
192
+
193
+ Infer the workflow from the writer's request and the current project state. Keep work scoped to the selected passage, active scene, current chapter, or relevant story material.
194
+
195
+ Use these workflow references when they match the task:
196
+
197
+ - `context priming`: gather the smallest useful context packet before drafting or reviewing.
198
+ - `scene planning`: turn the next outline beat into a concrete scene task.
199
+ - `title brainstorming`: propose grouped title candidates; update `story.yaml.title` only after the writer chooses one.
200
+ - `prose review`: review selected prose or a chapter for craft issues; use diagnostics as one optional input.
201
+ - `continuity review`: compare manuscript and story materials for contradictions.
202
+ - `character voice review`: sharpen dialogue and character-specific language.
203
+ - `state updates`: extract stable facts after an approved scene or chapter checkpoint.
204
+ - `existing manuscript import`: help convert existing drafts into Cowriter chapters and story materials.
205
+
206
+ All workflow outputs are advisory until the writer approves a file edit. Reports in `.cowriter/reports/*.md` are project artifacts, not manuscript source. Stable story facts may be saved to `story.yaml`, `characters/*.yaml`, or `outline.yaml` only after approval.
207
+
208
+ ## Save-As-You-Go Rule
209
+
210
+ Cowriter projects are live writing workspaces. Do not merely discuss or stage planned manuscript/story changes in chat.
211
+
212
+ - When the writer approves a change, immediately edit the relevant Markdown/YAML file.
213
+ - After applying, run `inspect -o json` to confirm the project reflects the change.
214
+ - Keep each saved change narrow and reversible; do not wait until the end of the conversation to write a batch of unrelated changes.
215
+ - If the writer is still deciding, ask before writing. Once they decide, save it.
216
+ - Still commit at sensible checkpoints and at the end of the work session, but do not treat committing as a substitute for saving.
217
+
218
+ ## Commit Checkpoints
219
+
220
+ Commit when a coherent writing unit is complete, not after every keystroke and not only at the end of a long session.
221
+
222
+ Good commit moments:
223
+
224
+ - After accepted onboarding material is saved: synopsis, initial story fields, first character records, or first outline.
225
+ - After a scene/chapter draft or revision pass is saved.
226
+ - After a continuity/story-bible update that records stable facts.
227
+ - Before switching to a different kind of task, such as moving from manuscript prose to character development.
228
+ - Before pausing, ending the work session, or handing control back after meaningful file changes.
229
+
230
+ Before committing:
231
+
232
+ 1. Run `git status --short`.
233
+ 2. Review the relevant diff, usually `git diff -- chapters story.yaml characters outline.yaml .cowriter`.
234
+ 3. Stage only Cowriter book files changed for this writing unit.
235
+ 4. Use a concise book-focused message, such as `Develop opening scene`, `Refine synopsis`, or `Update continuity notes`.
236
+
237
+ Do not commit unrelated user edits, generated build output, or work-in-progress alternatives the writer has not accepted.
238
+
239
+ ## Skill Upgrades
240
+
241
+ When the user asks to update Cowriter skills, run:
242
+
243
+ ```bash
244
+ cowriter upgrade --path /absolute/path/to/book -o json
245
+ ```
246
+
247
+ This refreshes `.codex/skills/cowriter` and updates the project-local Cowriter instruction block in `AGENTS.md`.
248
+
249
+ ## Writing Rules
250
+
251
+ - Keep the manuscript and story materials as the center of gravity.
252
+ - Infer the writing workflow from context; do not make the writer choose a skill.
253
+ - Treat generated titles as working titles.
254
+ - Record stable story facts in `story.yaml`; record guesses as tentative notes or questions.
255
+ - Save approved story and manuscript changes to the project files as soon as they are accepted.
256
+ - Prefer narrow edits to whole-chapter rewrites unless the user explicitly asks for a rewrite.
257
+ - Preserve point of view, tense, tone, and continuity unless asked to change them.
258
+ - Commit at sensible creative checkpoints and after work sessions, staging only relevant book files.
259
+
260
+ ## References
261
+
262
+ - `references/project-model.md`
263
+ - `references/actions.md`
264
+ - `references/onboarding.md`
265
+ - `references/prose-diagnostics.md`
266
+ - `references/context-priming.md`
267
+ - `references/scene-planning.md`
268
+ - `references/title-brainstorming.md`
269
+ - `references/prose-review.md`
270
+ - `references/continuity-review.md`
271
+ - `references/character-voice.md`
272
+ - `references/state-updates.md`
273
+ - `references/import-existing.md`
@@ -0,0 +1,52 @@
1
+ # Cowriter File Editing
2
+
3
+ Cowriter now uses direct file edits instead of action envelopes for normal writing work.
4
+
5
+ Edit these files directly:
6
+
7
+ ```text
8
+ chapters/*.md
9
+ story.yaml
10
+ characters/*.yaml
11
+ outline.yaml
12
+ .cowriter/project.yaml
13
+ .cowriter/reports/*.md
14
+ ```
15
+
16
+ Use `.cowriter/reports/*.md` for approved review artifacts such as prose, continuity, character voice, or session-summary reports. Do not treat reports as manuscript source; they are advisory project artifacts that `cowriter inspect` can list for Codex and the workspace.
17
+
18
+ For deterministic chapter prose diagnostics, run:
19
+
20
+ ```bash
21
+ cowriter diagnose prose --path /absolute/path/to/book --chapter chapters/001-opening.md -o json
22
+ ```
23
+
24
+ Only add `--write-report` when the writer asks to save the diagnostics as a report artifact.
25
+
26
+ After a direct edit, inspect the project:
27
+
28
+ ```bash
29
+ cowriter inspect --path /absolute/path/to/book -o json
30
+ ```
31
+
32
+ Use git diff to review file changes:
33
+
34
+ ```bash
35
+ git diff -- chapters story.yaml characters outline.yaml .cowriter
36
+ ```
37
+
38
+ Do not route edits through legacy action JSON. Current Cowriter skills should use direct Markdown/YAML edits and then inspect the project.
39
+
40
+ When selected manuscript text is needed and not already available, retrieve optional selection context from the served workspace:
41
+
42
+ ```bash
43
+ curl -sS "$COWRITER_URL/api/cowriter/selection"
44
+ ```
45
+
46
+ For UI-only passage highlighting, call the served workspace instead of editing files:
47
+
48
+ ```bash
49
+ curl -sS -X POST "$COWRITER_URL/api/cowriter/codex" \
50
+ -H 'content-type: application/json' \
51
+ --data '{"command":"highlight","text":"exact passage text","chapterPath":"chapters/001-opening.md"}'
52
+ ```
@@ -0,0 +1,23 @@
1
+ # Character Voice Review
2
+
3
+ Use character voice review when the writer asks whether dialogue sounds distinct, wants a character sharpened, or needs a voice pass on selected prose.
4
+
5
+ Inputs:
6
+
7
+ - the selected passage or relevant chapter
8
+ - the character record in `characters/*.yaml`
9
+ - story tone, perspective, and continuity constraints
10
+ - dialogue excerpts where the character appears
11
+
12
+ Output:
13
+
14
+ - voice fingerprint: diction, sentence shape, evasions, tells, and pressure habits
15
+ - places where the character sounds generic or inconsistent
16
+ - suggested lines or small edits when requested
17
+ - possible updates to desire, conflict, role, or notes
18
+
19
+ Allowed writes after approval:
20
+
21
+ - update the relevant `characters/*.yaml`
22
+ - patch selected manuscript dialogue
23
+ - write an advisory character voice report
@@ -0,0 +1,15 @@
1
+ # Context Priming
2
+
3
+ Use context priming before drafting, revising, or reviewing when the writer's request depends on book state that is not already in the conversation.
4
+
5
+ Gather the smallest useful packet:
6
+
7
+ - `cowriter inspect --path /absolute/path/to/book -o json`
8
+ - active chapter or selected passage when relevant
9
+ - current `story.yaml` fields that affect the request
10
+ - relevant character records and outline beats
11
+ - recent advisory reports only when they directly apply
12
+
13
+ Then summarize the operative context in a few lines and proceed with the requested work. Do not make the writer choose a workflow name.
14
+
15
+ If context is missing, ask one focused question or name the assumption before drafting. Save only approved changes.
@@ -0,0 +1,22 @@
1
+ # Continuity Review
2
+
3
+ Use continuity review when the writer asks whether the manuscript contradicts itself, whether a scene still fits the book, or what facts should be remembered.
4
+
5
+ Check:
6
+
7
+ - timeline order and elapsed time
8
+ - character knowledge boundaries
9
+ - location transitions
10
+ - object possession
11
+ - relationship state
12
+ - world rules, setting constraints, and promises in `story.yaml`
13
+ - contradictions between manuscript, outline, characters, and reports
14
+
15
+ Output blockers first, then warnings, then open questions. Include file or chapter references when possible.
16
+
17
+ Allowed writes after approval:
18
+
19
+ - update `story.yaml.continuity`
20
+ - update relevant `characters/*.yaml` notes
21
+ - update `outline.yaml` if a beat has changed
22
+ - write an advisory report under `.cowriter/reports/*.md`
@@ -0,0 +1,16 @@
1
+ # Existing Manuscript Import
2
+
3
+ Use existing manuscript import when the writer has drafts outside Cowriter and wants help turning them into a Cowriter book project.
4
+
5
+ Start by inspecting the folder and asking what should be treated as manuscript source. Keep imports transparent and reversible.
6
+
7
+ Useful steps:
8
+
9
+ - identify candidate chapter files
10
+ - propose a chapter naming scheme under `chapters/*.md`
11
+ - extract or ask for a working title and synopsis
12
+ - propose initial `story.yaml` fields
13
+ - propose initial character records and outline beats
14
+ - preserve the original source files unless the writer asks otherwise
15
+
16
+ Do not silently overwrite existing Cowriter chapters or story materials. Ask before moving, converting, or replacing files.
@@ -0,0 +1,45 @@
1
+ # Cowriter Onboarding
2
+
3
+ The first interaction should be small and writer-centered. Ask one onboarding question at a time, wait for the answer, and then choose the next most useful question. Do not bundle premise, character, setting, ending, and folder questions into one turn unless the writer asks for a checklist.
4
+
5
+ Prompt:
6
+
7
+ > What do you know about the book right now: a title, a synopsis, or an existing folder?
8
+
9
+ ## Title Path
10
+
11
+ Ask for:
12
+
13
+ - working title
14
+ - local folder
15
+
16
+ Create the project. Then ask for a rough one-paragraph synopsis before requesting detailed story fields.
17
+ Interview toward that synopsis one question at a time.
18
+
19
+ ## Synopsis Path
20
+
21
+ Ask for:
22
+
23
+ - one-paragraph synopsis
24
+ - local folder
25
+
26
+ Generate a working title, create the project, and save the synopsis. Make clear the title is editable.
27
+
28
+ Interview with no more than three focused questions, asked one at a time:
29
+
30
+ - Who is under the most pressure?
31
+ - What setting or world rule makes the story harder?
32
+ - What ending direction or emotional promise should the book move toward?
33
+
34
+ Then propose concrete edits to `story.yaml`, `characters/*.yaml`, and `outline.yaml`. When the writer accepts them, write those files directly.
35
+
36
+ ## Existing Folder Path
37
+
38
+ Open and inspect the folder. Summarize:
39
+
40
+ - title
41
+ - synopsis status
42
+ - chapter count and active chapter
43
+ - character count
44
+ - outline beat count
45
+ - next writing task
@@ -0,0 +1,45 @@
1
+ # Cowriter Project Model
2
+
3
+ A Cowriter book is a local git-backed folder:
4
+
5
+ ```text
6
+ chapters/*.md
7
+ story.yaml
8
+ characters/*.yaml
9
+ outline.yaml
10
+ .cowriter/project.yaml
11
+ .cowriter/reports/*.md
12
+ ```
13
+
14
+ `story.yaml` contains:
15
+
16
+ - `title`
17
+ - `synopsis`
18
+ - `setting`
19
+ - `themes`
20
+ - `genre`
21
+ - `tone`
22
+ - `perspective`
23
+ - `continuity`
24
+
25
+ Each character file contains:
26
+
27
+ - `id`
28
+ - `name`
29
+ - `role`
30
+ - `desire`
31
+ - `conflict`
32
+ - `notes`
33
+
34
+ `outline.yaml` contains:
35
+
36
+ ```yaml
37
+ beats:
38
+ - id: opening-beat
39
+ title: ""
40
+ summary: ""
41
+ ```
42
+
43
+ Codex should edit book files directly with conservative path handling, then run `cowriter inspect` to confirm the project shape still loads.
44
+
45
+ `.cowriter/reports/*.md` files are readable Cowriter report artifacts. They may contain optional YAML frontmatter with `type`, `title`, `status`, `createdAt`, and `chapter`. Current review workflows may write reports there only when the writer has approved generating a review artifact.
@@ -0,0 +1,33 @@
1
+ # Cowriter Prose Diagnostics
2
+
3
+ Cowriter includes a deterministic chapter-level prose diagnostics command. Use it when the writer asks for a prose check, style scan, AI-ish wording scan, rhythm check, or an advisory review before revision.
4
+
5
+ Run diagnostics:
6
+
7
+ ```bash
8
+ cowriter diagnose prose --path /absolute/path/to/book --chapter chapters/001-opening.md -o json
9
+ ```
10
+
11
+ The command is read-only unless `--write-report` is passed. It returns:
12
+
13
+ - chapter path
14
+ - metrics: word count, paragraph count, sentence count, dialogue percent, average sentence words, and em dash count
15
+ - findings with `info`, `warning`, or `issue` severity
16
+
17
+ Current deterministic checks cover:
18
+
19
+ - repeated nearby words
20
+ - paragraphs over 120 words
21
+ - unusually uniform sentence rhythm
22
+ - dialogue percentage that is very low or very high in longer chapters
23
+ - filler or AI-ish terms
24
+ - mixed straight and curly double quotes
25
+ - em dash density
26
+
27
+ To save an approved report artifact:
28
+
29
+ ```bash
30
+ cowriter diagnose prose --path /absolute/path/to/book --chapter chapters/001-opening.md --write-report -o json
31
+ ```
32
+
33
+ Saved reports live in `.cowriter/reports/*.md` and are advisory project artifacts, not manuscript source. Do not use diagnostics as a pass/fail gate, and do not rewrite the manuscript unless the writer approves a specific edit.
@@ -0,0 +1,22 @@
1
+ # Prose Review
2
+
3
+ Use prose review when the writer asks for craft feedback on selected prose, a page, a scene, or a chapter.
4
+
5
+ Review for:
6
+
7
+ - repetition and over-explanation
8
+ - sentence rhythm and paragraph length
9
+ - dialogue balance and subtext
10
+ - weak filtering, abstraction, or filler
11
+ - cliche or generic diction
12
+ - point-of-view, tense, and tone drift
13
+
14
+ For whole chapters, the deterministic diagnostics command can provide a first pass:
15
+
16
+ ```bash
17
+ cowriter diagnose prose --path /absolute/path/to/book --chapter chapters/001-opening.md -o json
18
+ ```
19
+
20
+ Use `--write-report` only when the writer asks for a saved review artifact.
21
+
22
+ Default output is advisory findings ordered by importance. Offer narrow patch suggestions only when useful. Rewrite manuscript text only after the writer approves a specific edit.
@@ -0,0 +1,28 @@
1
+ # Scene Planning
2
+
3
+ Use scene planning when the writer asks what to write next, wants to shape an outline beat, or needs a concrete scene task.
4
+
5
+ Inputs:
6
+
7
+ - synopsis, genre, tone, and perspective
8
+ - active or next outline beat
9
+ - relevant character desire, conflict, and knowledge
10
+ - continuity constraints
11
+ - desired chapter or scene target if the writer gives one
12
+
13
+ Output a focused scene plan with:
14
+
15
+ - scene goal
16
+ - obstacle or pressure
17
+ - turn, reveal, or reversal
18
+ - emotional movement
19
+ - exit image or handoff into the next beat
20
+ - continuity facts to preserve
21
+
22
+ Allowed writes after approval:
23
+
24
+ - update `outline.yaml`
25
+ - update relevant `characters/*.yaml` notes
26
+ - update `story.yaml.continuity`
27
+
28
+ Keep the plan usable for the next writing step. Do not draft the scene unless the writer asks.
@@ -0,0 +1,22 @@
1
+ # State Updates
2
+
3
+ Use state updates after an approved scene, chapter, or revision checkpoint. The goal is to keep story materials aligned with the manuscript.
4
+
5
+ Extract only stable facts:
6
+
7
+ - timeline events
8
+ - character location, knowledge, relationship, desire, or conflict changes
9
+ - object and setting state
10
+ - decisions the writer confirmed
11
+ - continuity constraints introduced by the new prose
12
+
13
+ Propose the updates before writing them. Keep guesses as questions or tentative notes.
14
+
15
+ Allowed writes after approval:
16
+
17
+ - `story.yaml.continuity`
18
+ - `characters/*.yaml`
19
+ - `outline.yaml`
20
+ - advisory report under `.cowriter/reports/*.md`
21
+
22
+ Run `cowriter inspect --path /absolute/path/to/book -o json` after saving.
@@ -0,0 +1,27 @@
1
+ # Title Brainstorming
2
+
3
+ Use title brainstorming when the writer asks for titles, alternatives to the current title, subtitles, series-title ideas, or title direction.
4
+
5
+ Inputs:
6
+
7
+ - synopsis
8
+ - genre, tone, themes, and perspective
9
+ - protagonist, setting, and central conflict
10
+ - writer preferences, comparable titles, title styles to avoid, and forbidden words
11
+
12
+ Output grouped candidates with short rationales. Useful groups include:
13
+
14
+ - literary
15
+ - commercial
16
+ - genre-forward
17
+ - character-focused
18
+ - setting-focused
19
+ - thematic
20
+ - short and punchy
21
+
22
+ Rules:
23
+
24
+ - Treat every generated title as a working title.
25
+ - Do not replace the project title automatically.
26
+ - Update `story.yaml.title` only after the writer explicitly chooses a title.
27
+ - If the writer chooses one, save the exact chosen title and run `cowriter inspect --path /absolute/path/to/book -o json`.
@@ -0,0 +1,3 @@
1
+ title: {{metadataTitle}}
2
+ author: {{author}}
3
+ createdAt: {{createdAt}}
@@ -0,0 +1 @@
1
+ Reports generated by Cowriter review workflows live here.