Add Companies House chat tools and wire into the research-tools seam

↗ view on GitHub · sloth-ninja · 2026-07-08 · 37dd7ad7

New backend/src/lib/legalSourcesTools/companiesHouseTools.ts:
COMPANIES_HOUSE_TOOLS (search/get_company/get_filing_history in OpenAI
function shape), COMPANIES_HOUSE_SYSTEM_PROMPT, and
executeCompaniesHouseToolCall (get_company batches profile+officers+PSCs
into one payload; officer/PSC failures degrade gracefully).

chatTools.ts: buildSystemPrompt/buildMessages/runLLMStream gain the
ResearchSources-gated seam (companiesHouse flag splices the system
prompt and tool set); runToolCalls gains a companies_house_* branch
mirroring the MCP tool-call pattern (generic tool_start/tool_result SSE
pair) with its own companiesHouseEvents accumulator, pushed into
AssistantEvents so results persist to chat history. chat.ts/
projectChat.ts now derive researchSources/includeResearchTools from
whether a Companies House key is configured (server env or per-user) -
no feature toggle, per docs/MIGRATION_SPEC.md decision 6.3.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Repository Sloth-ninja/JessicaOSS
Author sloth-ninja <ezanahaddis@gmail.com>
Authored
Committed
Parents 9bbc94db
Stats 5 files changed , +622 , -15
Part of WS1: Companies House integration (UK company data)

Capture this commit into my fork

Download a Markdown prompt that tells Claude how to port this exact commit into your working tree. Run it via claude -p < capture-commit-37dd7ad7.md from inside the repo you want the change in.

⬇ Download capture-commit-37dd7ad7.md