zgbrenner builds Gary a one-click exit into Word

Generated drafts no longer get stranded in the chat window - lawyers can move them into their own tools in a single click.

draftingworkflow

zgbrenner added a row of export actions beneath every finished Gary response, closing the awkward gap between the assistant producing a draft and an attorney actually working with it. Three options sit under each reply: copy to clipboard (and paste into Word with headings and bullets intact), download as a plain text file with a tidy dated name, or download a fully formatted Word document - tables and all. It works in both the standalone chat and the per-matter view, carrying the matter name and task into the exported file so context comes along.

The guardrails are the interesting part. Exports contain only the assistant's prose - never the internal plumbing, IDs, or keys behind the scenes - and every file opens with an attorney-review reminder, so the "draft, not advice" framing survives the trip out of the app.

So what Anyone evaluating Gary for real legal work should note this: it now fits into a lawyer's existing Word-and-email workflow instead of asking them to live inside the chat.

View this fork on GitHub →

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

Commits in this thread

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

SHA Subject Author Date
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-575.md from inside the repo you want the changes in.

⬇ Download capture-thread-575.md