zgbrenner gives every AI answer a one-click path into Word

Drafts now leave the chat window as clean, formatted documents instead of copy-paste mush.

draftingworkflow

zgbrenner has added three export buttons beneath every assistant reply: copy to clipboard, download as a plain text/Markdown file, or download a Word document. The point is fidelity - headings, bullets, and simple tables survive the trip into Word intact, so what you see in the chat is what lands in your draft.

Each downloaded file opens with a title block naming the matter, task, and date, plus a reminder that the output still needs attorney review. The export is also deliberately literal: it copies the AI's text exactly as written and never strips or alters anything, even when a draft legitimately discusses things like access tokens. Very short replies skip the buttons entirely, so the interface stays clean. The whole thing is built as a tested, self-contained module.

So what Anyone who drafts in Word will care: this closes the annoying gap between an AI answer and a usable document.

View this fork on GitHub →

Spotted something wrong? Or know the PR text has fresher detail than the writeup above?

Commits in this thread

3 commits from zgbrenner/gary, oldest first. Source extracted verbatim from the harvested git log.

SHA Subject Author Date
cc41294b Merge pull request #1 from foolish-bandit/claude/gary-us-simplification-AjDDT Zack Brenner 2026-05-19 ↗ GitHub
Add Copy Draft, Markdown, and Word export for Gary's AI outputs
b4345deb feat: add Copy Draft, Markdown, and Word export for AI outputs Claude 2026-05-19 ↗ GitHub
commit body
Adds three export actions below every Gary assistant response so U.S.
lawyers can move drafts into Word, email, or their own templates in one
click:

- "Copy Draft" - clipboard copy with HTML + Markdown payloads so paste
  into Word preserves headings and bullets; plain-English status text.
- "Download Markdown" - `.md` file with safe filename like
  `contract-review-draft-2026-05-19.md`, wrapped with a short title
  block (matter, Saved Legal Task, date) and an attorney-review
  reminder.
- "Download Word Draft" - `.docx` via the already-installed `docx`
  package; preserves headings, paragraphs, bullets, and simple GFM
  tables; ends with a short footer note.

Helpers live in `frontend/src/lib/exportDraft.ts` and are reused by both
the standalone assistant chat and the per-matter chat. Exports include
only the assistant's prose - internal events, tool calls, IDs, and
annotations are intentionally excluded.

Adds focused tests in `exportDraft.test.ts` covering filename safety,
header content, attorney-review reminder, no API-key/internal-ID
leakage, and clipboard failure messaging.

Updates the U.S. lawyer setup guide with a "Copying or Downloading
Drafts" section, and extends the terminology map.
347a4240 fix: hide export row on very short replies; clarify no-scrub invariant Claude 2026-05-19 ↗ GitHub
commit body
- AssistantMessage: only render Copy Draft / Download Markdown /
  Download Word Draft when the assistant's prose is at least 200
  characters. Tiny conversational replies like "Done." or
  "I need more information." stay uncluttered.
- exportDraft: document explicitly that the wrapper preserves AI
  content verbatim and never scrubs or redacts. The invariant we
  guard is the inverse - nothing the wrapper adds should introduce
  credential-shaped tokens.
- exportDraft.test: add a positive test confirming that legitimate
  legal text discussing "API key" rotation or "Bearer token"
  authentication is preserved unchanged in the export.

Capture this thread into my fork

Download a single Markdown prompt that tells Claude how to port every commit above into your working tree — adapting paths and structure to match your repo. Run it via claude -p < capture-thread-532.md from inside the repo you want the changes in.

⬇ Download capture-thread-532.md