feat(law): batasdb Philippine primary-law search tool

↗ view on GitHub · emileriksenkeev · 2026-07-14 · 42c1aa0e

Adds search_ph_law - a backend-proxied assistant tool over the batasdb corpus
(statutes/RAs, BIR issuances, SC & CTA jurisprudence). Grounds PH legal claims
in current authority with citations, effectivity/overruled flags, and citator
warnings.

- backend/src/lib/batasdb.ts: client with a result cache (batas_cache, long TTL
  since law changes slowly) and a monthly live-call budget guard (batas_usage +
  atomic batas_bump_usage RPC). Cache hits are free; on budget exhaustion falls
  back to stale cache. Key stays server-side via BATAS_API_KEY.
- chatTools: LAW_TOOLS (search_ph_law) + dispatch + system-prompt grounding
  guidance. Kept separate from VAULT_TOOLS.
- Wired into interactive chat only (chat.ts, projectChat.ts) - NOT the wiki
  builder, to protect the monthly budget.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Repository emileriksenkeev/sydOS
Author emileriksenkeev <emil@keev.co>
Authored
Parents de18ad0e
Stats 5 files changed , +423 , -2
Part of batasdb - Philippine primary-law search tool

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-42c1aa0e.md from inside the repo you want the change in.

⬇ Download capture-commit-42c1aa0e.md