Review Table rows can now launch a Saved Legal Task directly

zgbrenner wires the Suggested Saved Legal Task column in a Review Table to actually open the assistant. A lawyer clicks a cell, confirms a modal, and the assistant opens prefilled with the matching task, the document attached, and extracted row values in the prompt - nothing auto-sends.

workflow

The mapping between recognized task names and their built-in IDs is strict. The cell value is normalized for whitespace, case, tag-pill brackets, and trailing punctuation, then must match exactly against one of the eight canonical names. Partial values, None, Unknown, blanks, and unrecognized strings produce no button at all. The button itself only appears once the cell finishes generating. A test asserts that each target ID resolves to a real built-in workflow.

The launch path threads a newChatDraft through the chat-history context. Confirming the modal creates a new chat - inside the review's matter when one exists, standalone otherwise - stores a draft object carrying prompt text, a workflow reference, and the document ID, then navigates to the assistant. The chat input seeds itself from that draft via a useRef captured before the context clears, so the draft doesn't leak into subsequent chats. The existing file-attachment mechanism carries the document ID, keeping the raw ID out of the visible prompt text.

The auto-send path is explicitly bypassed. The draft is staged, not dispatched. The prefilled prompt instructs the model to treat row values as unverified, avoid inventing facts or legal authorities, and lean on the uploaded document. The confirmation modal and the side panel both show a plain-English reminder before the user sees the assistant.

No raw internal identifiers (document ID, review ID, cell ID, column ID) appear in the prompt text. zgbrenner noted two follow-ups: surface the launch button directly on the row rather than requiring a click into the cell panel, and let the lawyer override the suggested task before confirming.

So what The staged-draft pattern (prefill without auto-send, prompt instructs model to treat context as unverified) is worth examining if you have any extraction-to-action flow in your product. The strict name-to-ID mapping rather than fuzzy matching is a deliberate design choice; it means the feature works reliably for recognized tasks and silently does nothing for everything else, which is the right failure mode for a legal tool.

View this fork on GitHub →

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

Commits in this thread

1 commit from zgbrenner/gary, oldest first. Source extracted verbatim from the harvested git log.

SHA Subject Author Date
b01092b7 feat: run a Saved Legal Task from a Review Table row Claude 2026-05-20 ↗ GitHub
commit body
Make the "Suggested Saved Legal Task" column actionable. When Gary
suggests a recognized task for a document, a lawyer can launch that
task in the assistant prefilled with the row's context.

- suggestedTask.ts: maps the eight recognized task names to built-in
  Saved Legal Task ids. Matching tolerates whitespace, case, tag
  brackets, and trailing punctuation but is never fuzzy - an
  unrecognized value resolves to null rather than guessing. Also
  builds the row-context prompt (task name, matter, document name,
  extracted fields, and attorney-review safety language).
- RunSuggestedTaskModal.tsx: a simple "Run Saved Legal Task?"
  confirmation with a prompt preview and Open in Assistant / Cancel.
- TRSidePanel: shows a "Run Suggested Task" action - only on the
  Suggested Saved Legal Task column's cell, and only when the value
  resolves to a recognized task and the cell has finished generating.
- TabularReviewView: resolves the row's suggested task, builds the
  row-context prompt from the row's other cells, and on confirm
  creates a chat, prefills an assistant draft, and opens it.
- Prefill, not auto-run: a new newChatDraft channel on
  ChatHistoryContext carries a draft (content + workflow + attached
  document) that ChatInput seeds its initial state from. The lawyer
  reviews and sends manually - nothing is auto-submitted. ChatView
  renders an empty-with-draft chat instead of the loading skeleton.
- The row's document is attached via the existing chat file
  mechanism; the document_id rides in the attachment, never in the
  visible prompt text. No raw internal ids appear in the prompt.
- Safety: the prompt instructs Gary to treat the row as draft and
  unverified, use the uploaded document, not invent facts / dates /
  legal authorities / deadlines / parties, and flag uncertainty.
- Docs: add "Running a Saved Legal Task from a Review Table" to the
  U.S. lawyer guide; add a terminology-map entry.
- Tests: suggestedTask.test.ts covers the eight-task mapping (and
  that each id is a real assistant built-in), match tolerance, the
  no-fuzzy-match guarantee, blank/Unknown/None handling, the prompt's
  attorney-review language, Unknown fallbacks, and the absence of raw
  internal ids and legacy terminology.

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-569.md from inside the repo you want the changes in.

⬇ Download capture-thread-569.md