feat: add Kenya Law RAG and trusted web search tools
Implements two retrieval tools that ground Iroh's legal responses in
authoritative Kenyan sources rather than training-data recall:
- search_kenya_law: ChromaDB semantic search over the Kenya Law corpus
using Xenova/all-MiniLM-L6-v2 embeddings (384-dim, mean pool,
normalized). Lazy-cached embedder and collection. east_africa
jurisdiction filter applied via where clause; kenya filter omitted
to avoid silently dropping chunks that predate the metadata field.
Returns 400-char snippets with distance; notes weak results (>0.6).
- search_legal_authority_web: Tavily search restricted to 12 trusted
Kenyan/East African legal authority domains (kenyalaw.org,
parliament.go.ke, judiciary.go.ke, etc.). Never throws - all
failures surface as { results: [], note }.
Both tools registered in TOOLS[] and dispatched in runToolCalls.
chromadb and @xenova/transformers added as dependencies.
CHROMA_DB_PATH and TAVILY_API_KEY documented in .env.example.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| Repository | Davemaina1/iroh_ |
|---|---|
| Author | Davemaina1 <dmain7015@gmail.com> |
| Authored | |
| Parents | 7244c0be |
| Stats | 6 files changed , +1231 |
| Part of | Kenya legal grounding: honesty contract + retrieval tools |
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-07e1243e.md
from inside the repo you want the change in.