A proof-of-concept writing app with AI feedback. You write in a distraction-free editor, and as you pause, Redline surfaces inline editorial notes anchored to specific spans of your text with suggested rewrites you can accept with a click — like an editor's redlines, in real time.
- Automatic feedback — after you stop typing, the app sends your text to Claude and gets back notes anchored to spans. Notes appear as colored inline highlights (orange = suggestion, red = issue).
- Click to review — click a highlight to open a pinned panel showing the note plus suggested rewrites in different styles.
- Accept a rewrite — accepting replaces the highlighted span in place.
- Stays in sync — a note disappears if you edit its text (the feedback no longer applies), and accepting a rewrite doesn't trigger a new round of feedback.
src/app/api/feedback/route.ts— calls the Claude API (Anthropic SDK) with the document text and returns structured notes. The model returns a verbatimquotefor each note; the server resolves it to a character range (models copy text reliably but count offsets poorly).src/components/feedback-extension.ts— a ProseMirror plugin that renders the notes as inline decorations and drops a note when its underlying text changes.src/components/use-feedback.ts— owns the generation lifecycle: debounced auto-runs, request cancellation, and applying the results.src/components/feedback-panel.tsx/editor.tsx— the review UI.
Prerequisites: Node.js 18.18+ and an Anthropic API key.
-
Install dependencies:
npm install
-
Add your API key to a
.env.localfile in the project root:ANTHROPIC_API_KEY=sk-ant-...
-
Start the dev server:
npm run dev
-
Open http://localhost:3000 and start writing. After you pause, feedback highlights will appear; click one to review and accept a rewrite.