nwhitehouse bolts web search onto Mike's chat

A toggle in the chat box now lets Mike reach the live web, not just your document set.

searchchat-ui

nwhitehouse wired up a web-search option that sits behind a small globe icon in the chat input. Flip it on and Mike can pull current information from the open internet; leave it off and the capability simply isn't there - no background calls, no surprise spend. It's the same off-by-default discipline already applied to the legal-database tools, which matters when every outbound query can cost money or leak context.

The search itself runs through Brave Search, a paid web-search service with a modest free allowance. Results come back shaped to match Mike's existing legal-search results, so the two could eventually render through one interface. One rough edge: if the API key isn't configured, the toggle still appears but does nothing visible, so a user could click it and wonder why nothing happened.

So what Worth a look for any team that wants Mike to answer questions about current events or recent developments, not just the documents you've fed it - provided you're willing to set up a Brave account.

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 nwhitehouse/mike, oldest first. Source extracted verbatim from the harvested git log.

SHA Subject Author Date
00e1dd66 [feat-003] Brave web search with globe-icon toggle Nick Whitehouse 2026-05-04 ↗ GitHub
commit body
Adds a `web_search` tool backed by the Brave Search API, gated by a
globe-icon toggle on the right side of the chat input (Ruli pattern).
Hard-gated: globe off → tool not in the model's schema. Same shape as
the legal-sources picker, distinct UI surface because web search is a
binary toggle vs the legal sources' per-source multi-select.

Backend
- backend/src/lib/webSearch.ts (new): Brave Search client with 12s
  AbortController timeout. Returns the same shape as legalSearch
  results so feat-004 references-inline can render either source with
  one card component. Graceful degradation when BRAVE_SEARCH_API_KEY
  is missing.
- chatTools.ts: WEB_TOOLS array (kept separate from always-on TOOLS
  so it can be conditionally appended). Dispatch case for web_search
  in runToolCalls. runLLMStream accepts sources.web boolean; when
  true → append WEB_TOOLS + system-prompt line steering the model
  toward web for current/news/commentary.
- routes/chat.ts: extends sources type to { legal?, web? }.
- .env.example: documents BRAVE_SEARCH_API_KEY.

Frontend
- ChatInput.tsx: globe icon button between ModelToggle and send.
  Filled blue when on, gray when off. Per-message state (resets
  after submit, matches legal-sources behaviour). Click toggles.
- MikeMessage.sources extended to include web?: boolean.
- mikeApi.streamChat passes sources through unchanged.

Also writes detailed feat-004 (references inline) and feat-005
(multi-pass research orchestrator) plans into backlog.md so the
direction is documented before implementation.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

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

⬇ Download capture-thread-111.md