Skip to content

Add Coach: an in-editor writing coach for drafts#205

Open
leomattic wants to merge 6 commits into
trunkfrom
test/leo-branch
Open

Add Coach: an in-editor writing coach for drafts#205
leomattic wants to merge 6 commits into
trunkfrom
test/leo-branch

Conversation

@leomattic
Copy link
Copy Markdown

@leomattic leomattic commented May 20, 2026

Closes #189

Coach

Coach is a right-rail mode in the draft editor that reviews a draft and helps improve it. General-purpose, and especially useful when writing in a language you are still learning. It reads top to bottom:

Dashboard (auto on tab entry when the draft changed) — one Haiku review pass returns a headline score (rounded mean of clarity / structure / engagement / correctness; click for the per-dimension breakdown), register and reading grade, and a lower-is-better AI-likeness meter with a one-pass Humanize all.

Findings — located issues in four lenses, each with an editor underline and a teaching popover: Grammar, Style, AI tells, and Voice (only once a writing voice exists). Per-issue Apply / Ignore; Rescan re-runs.

Rewrite (selection, or the current sentence) — Beautify / Natural / Simpler / Rephrase / Humanize / My voice each return two options to pick from; Fix returns one correction as a diff.

Go deeper — opt-in Sonnet structure pass: buried ledes, overloaded paragraphs, weak openings and endings, each jumping to its paragraph.

Notes

  • One runCoachPass helper backs every pass; scan + score are fused into coach:review (old coach:scan / coach:score removed). Parse/normalize, headline mean, AI-tell selection, and rewrite-variant policy are IO-free modules with unit tests.
  • Coach de-dashes its own output, so it never emits the AI tells it flags.

Testing

tsc, ESLint, Stylelint, Prettier clean; unit suite green. Verified live via Playwright: one review call populates the dashboard and findings; headline matches the breakdown; two rewrite variants vs a single Fix diff; flattened flow with no accordions.

🤖 Generated with Claude Code

leomattic and others added 2 commits May 20, 2026 17:12
A right-rail Coach tab that reviews a draft and helps improve it, aimed at
foreign-language writers and anyone who wants coaching:

- Review: scans the draft for grammar, style (collocations, repetition,
  filler, passive voice) and AI-tell issues, underlines them in the editor,
  and explains each in a teaching popover. Auto-runs on entering the tab when
  results are stale.
- Rewrite: selection-driven actions (Beautify, Natural, Fix, Simpler,
  Rephrase, Humanize) returning one suggestion, shown as a before/after diff
  before you apply.
- Structure: opt-in paragraph-level review (organization, transitions, weak
  openings/endings) with click-to-jump.
- A "how this reads" summary (AI register + local readability) and a richer
  hover popover (definition, synonyms, sentence rewrite).

Generated prose is de-dashed so the tool that flags AI tells doesn't emit
them itself. New pure helpers (deDash, wordDiff, readability) and the JSON
parser are unit-tested.

Closes #189

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
# Conflicts:
#	src/main/channels/ui-prefs-set.ts
#	src/renderer/components/DraftSidebar.tsx
#	src/renderer/screens/DraftEditorScreen.tsx
leomattic added a commit that referenced this pull request May 20, 2026
@leomattic leomattic self-assigned this May 20, 2026
leomattic and others added 4 commits May 21, 2026 14:07
Grows Coach into a general writing coach (not only for foreign-language
writers) and deepens the Review and Rewrite sections:

- My Voice: the Rewrite "My voice" button reads checks/voice.md and
  rewrites the selection in the user's voice; when no voice exists it
  launches the existing voice setup flow.
- Voice lens: Review flags spans that drift from the voice profile,
  shown only once a voice has been set up.
- Explain the change: each rewrite carries a one-line "why", rendered
  under the before/after diff.
- Rubric scorecard: an opt-in pass scoring clarity, structure,
  engagement, and correctness, each with a one-line rationale.

Generated prose stays de-dashed throughout.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
# Conflicts:
#	src/main/channels/index.ts
#	src/main/ipc.ts
#	src/preload/preload.ts
#	src/renderer/components/DraftSidebar.tsx
Consolidates the four Coach passes onto a shared runCoachPass helper and
fuses scan + score into one whole-document review call, then builds the
product changes on top: a pinned scoring dashboard (headline = rounded mean,
breakdown in a popover), a distinct lower-is-better AI-likeness meter with a
one-pass Humanize, two-variant subjective rewrites (Fix stays single), and a
flattened top-to-bottom flow (dashboard, findings, contextual rewrite, go
deeper) replacing the three accordions.

Pure logic is split into coach-normalize.ts plus renderer libs
(headlineScore, aiTellIds) with unit tests. Implements the six slices of the
coach-iteration plan.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The "Chat / Add to chat" selection menu opened on any editor selection,
overlapping the Coach rewrite flow (which drives off the same selection).
Mirror the existing checks-tab suppression so it stays hidden on coach too.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@leomattic leomattic marked this pull request as ready for review May 22, 2026 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add "Coach" writing-aid panel for foreign-language writers

1 participant