paste-as-ai
Non-intrusive AI writing suggestions for Markdown
Modular system for integrating AI suggestions into writing workflows with prose-aware diffing
A system for integrating AI-powered writing suggestions into Markdown workflows. Non-intrusive—suggestions appear alongside your text, never replacing it without consent.
Problem
AI writing tools either take over (auto-complete everywhere) or stay hidden (chat interfaces). Neither fits a focused writing workflow. You want suggestions visible but not intrusive, comparable but not committed.
Architecture
TypeScript monorepo with modular components:
packages/
├── diff-engine/ # Prose-aware text comparison
├── editor/ # TipTap extension for rendering
├── view-switcher/ # Toggle original ↔ suggested
├── export/ # Final document pipeline
└── ssg-*/ # Static site integrations
├── ssg-core/
├── ssg-astro/
└── ssg-eleventy/
Data Flow:
Original Text → AI Suggestion → Diff Engine → Side-by-side View
↓
Accept/Reject → Export
Key Pattern: Prose-Aware Diffing
Traditional diffs are line-based (git). Prose needs token-based comparison:
// Line diff: "Changed line 5"
// Prose diff: "Changed 'quickly' to 'swiftly' in paragraph 2"
tokenDiff({
original: "The fox jumped quickly",
suggested: "The fox leaped swiftly",
// Maps tokens to character positions
// Preserves sentence/paragraph context
})
The diff-engine computes differences at the word level, mapping back to character positions for precise highlighting.
Sidecar Metadata
Suggestions stored separately from content:
content/
├── post.md # Your writing (clean)
└── post.suggestions.json # AI suggestions (sidecar)
Your markdown stays pristine. Suggestions are metadata you can accept, reject, or ignore.
Current Status
Why This Exists
Writing tools should enhance focus, not demand attention. This project explores suggestion UX that respects the writer’s flow—visible when wanted, invisible when not, never destructive to the original text.