Statute sources, saving law into a matter, drag-and-drop files, and research that finishes

✅ merged · #1 · wardethan2000-eng/mike ← wardethan2000-eng/mike · opened 16d ago by wardethan2000-eng · merged 16d ago by wardethan2000-eng · self · +4,312-446 across 55 files · ↗ on GitHub

From the PR description

Seven commits of work that was already running on the live site but had never been committed or published.

Statutes and cases as sources

  • A statute the assistant looks up appears as a numbered source that opens in the reading panel, like a case does.
  • A case or statute can be filed into a matter with one click. This was completely broken - every save failed, because the value used to record where a saved file came from was never added to the list the database accepts. Fixed, plus the four things that stood between it and everyday use: the button now appears without being asked for, a source already filed still shows as filed after a reload, a failed save no longer leaves an empty folder behind, and the saved file is the law itself rather than the whole web page around it.

Files in chats

  • A matter chat now has an attach button, and a file dropped on the chat side stays with that chat instead of joining the matter files. Drop it on the file list to file it in the matter - where you drop it decides.
  • Dragging files in was silently failing for real drags. The app only accepted a drag the browser labelled one particular way, and several file managers label it differently, so those drags did nothing at all and the browser took over and left the page. All five places that accept dropped files now share one test.

Research that finishes

  • Chats that searched, found law and then stopped without answering were hitting a hidden ten-round limit on tool use. There is now one shared budget across every model, running out never ends a turn in silence, and a Keep going button carries on from where it stopped.

Document editing

  • Edits can add and remove whole paragraphs rather than only changing existing words, which is what writing on the firm letterhead needs.

Verified in a browser against the live site, not only by tests.

🤖 Generated with Claude Code

Our analysis

Complete source filing and research workflows — read the full analysis →

Chat-only matter attachments — read the full analysis →

Save legal sources to a matter — read the full analysis →

Think the analysis missed something the PR description covers?

Commits in this PR (7)

SHA Subject Author Date
33e4441c feat: list and undo buttons in the document editor Ethan Ward 2026-08-19 ↗ GitHub
commit body
Adds the toolbar controls for the list and undo support already in the
engine: bulleted list, numbered list, and an undo button that steps the
document back to how it was before the last save.

The list buttons toggle - pressing the same one again turns the
paragraphs back into ordinary text. A paragraph the document already
renders as a list item (inside a ul/ol) is recognised as one, so an
existing list is not flattened to body text by the next save. Undo
re-fetches and re-renders the restored document.

Verified end to end in the browser: a bulleted list persisted into the
saved .docx as a real Word list (w:numPr + numbering definitions
registered in the package), and undo restored the previous version
without destroying the later one.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018RCY6K4dNwdbo9gU3HQ9un
ada4e2eb feat: save a case or statute from a chat into the matter's Law folder Ethan Ward 2026-08-19 ↗ GitHub
commit body
A case or statute the assistant pulls can now be filed into a matter with one
click, from the reading panel or from the sources list under an answer. The
saved file is the court's own PDF where one exists and a Word document of the
text where it does not, so it opens in the viewer, downloads, is found by a
search of the matter, and can be quoted back with a page number. Saving the
same source twice reuses the copy already there. Case citations now open the
reading panel in project chats too, which is where saving them matters most.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018RCY6K4dNwdbo9gU3HQ9un
464b7aa0 feat: attach files to a matter chat without filing them in the matter Ethan Ward 2026-08-19 ↗ GitHub
commit body
Matter chats had no attach button, so the only way to give the assistant
a file was to add it to the matter Documents list first. Now the button
is there, and a file dropped on the chat side stays with that chat -
drop it on the file list or the Documents tab to file it in the matter.

The drop panel is limited to the chat side so it no longer covers the
file list, and the backend merges chat-only attachments into a matter
chat context, which previously saw matter documents only.

Note: backend/src/lib/chat/contextBuilders.ts and routes/projectChat.ts
also carry earlier uncommitted edits from another session on this shared
tree; they are included here because they cannot be separated by path.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PoCRDAPyEq4wwBVFFbDzck
598d1c6a fix: accept dragged files the browser labels a different way Ethan Ward 2026-08-19 ↗ GitHub
commit body
A drag was only recognised when the browser labelled it exactly "Files".
Some Linux file managers, and some apps, hand a dragged file over as
"text/uri-list" or "application/x-moz-file" instead, and those drags were
ignored outright - no drop panel, no upload, nothing, which reads as
drag-and-drop simply not working. Ignoring the drag also let the browser
take it instead and leave the app to open the file, losing the page.

All five places that accept dropped files now share one test, and a drag
that carries only a link says so instead of appearing to do nothing.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PoCRDAPyEq4wwBVFFbDzck
b3fcb9b2 fix: let a saved case or statute actually be written Ethan Ward 2026-08-19 ↗ GitHub
commit body
Saving a source into a matter failed every time. The saved file is
recorded with a note saying where it came from, and the value used for a
case or statute was never added to the list the database accepts, so the
write was rejected and the save always failed. Adding the value is all
that was missing.

Applied to the live database as well.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PoCRDAPyEq4wwBVFFbDzck
512ba17b polish: make saving a case or statute usable Ethan Ward 2026-08-19 ↗ GitHub
commit body
Four things stood between this feature and everyday use.

The Save button only turned up when the assistant happened to list the
statute as a numbered source, which it often did not, so asking for a
statute usually left nothing to save. It is now told to list one every
time it reports the wording of a statute it looked up.

A source already in the matter looked unsaved after a page reload,
inviting a pointless click. The button now asks what the matter already
holds and says "In Law" for anything that is there.

A save that failed left an empty Law folder behind in the matter. The
folder is now taken back out if nothing ends up filed.

The saved file itself carried the whole web page - the site menus, and a
title broken into single letters - ahead of the law. That came from the
statute lookup, which has been narrowed to the statute block, so the
assistant reads less clutter as well.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PoCRDAPyEq4wwBVFFbDzck
0d4423f5 feat: research that finishes, statutes as sources, and freer document editing Ethan Ward 2026-08-19 ↗ GitHub
commit body
Three pieces of work that were running live but had never been committed.
They share several files, so they could not be separated into commits that
each still build.

Research that finishes. A chat that searched, found law and then stopped
with no answer was hitting a hidden limit of ten rounds of tool use; short
lookups fit inside it and real research did not. There is now one shared
budget across every model, and running out of it never ends a turn in
silence - the assistant is made to answer from what it has and say what it
could not check. Where it stops, a Keep going button carries on from that
point instead of starting again.

Statutes as sources. A statute the assistant looks up now appears as a
numbered source that opens in the reading panel, the same way cases do,
rather than as loose text in the reply.

Freer document editing. Edits to a document can now add and remove whole
paragraphs instead of only changing words already there, which is what
writing a letter on the firm letterhead needs.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PoCRDAPyEq4wwBVFFbDzck

Capture this PR into my fork

Download a Markdown prompt that tells Claude how to port every commit in this PR into your working tree. Run it via claude -p < capture-pull-1.md from inside the repo you want the changes in.

⬇ Download capture-pull-1.md