Add Coach: an in-editor writing coach for drafts#205
Open
leomattic wants to merge 6 commits into
Open
Conversation
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
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #189
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
runCoachPasshelper backs every pass; scan + score are fused intocoach:review(oldcoach:scan/coach:scoreremoved). Parse/normalize, headline mean, AI-tell selection, and rewrite-variant policy are IO-free modules with unit tests.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