Davemaina1 stops Mike from citing Kenyan law it never looked up

The fork rewrites the AI's instructions so it can't fall back on memory for legal citations - it has to search first or admit it found nothing.

searchcompliance

Davemaina1 swapped a single permissive line - answer from your own legal knowledge when no documents are provided - for a strict rule: before citing any Kenyan statute, case, or regulation, the model must search a curated Kenyan legal corpus and a set of trusted Kenyan and East African legal websites. Citing from training data is banned outright. If both searches come up empty, the model has to say so and point the user to the official kenyalaw.org rather than guess.

The results are also tagged with enough detail to tell binding authority from merely persuasive - court, year, and whether a ruling actually binds in Kenya - and the trusted-source list was widened to cover primary authorities, major regulators, and oversight bodies. The effect is an assistant that grounds every Kenyan legal claim in a real source or openly declines.

So what Anyone weighing a legal AI for a specific jurisdiction should care: this is a concrete pattern for killing confident, made-up citations.

View this fork on GitHub →

Spotted something wrong? Or know the PR text has fresher detail than the writeup above?

Commits in this thread

3 commits from Davemaina1/iroh_, oldest first. Source extracted verbatim from the harvested git log.

SHA Subject Author Date
7244c0be feat: add Kenyan legal authority grounding contract to system prompt Davemaina1 2026-05-13 ↗ GitHub
commit body
Replaces the open-ended "answer based on your legal knowledge" line with
an 8-rule honesty contract that:
- Requires retrieval via search_kenya_law (local corpus) and
  search_legal_authority_web (approved domains) before citing any
  Kenyan statute, case, regulation, or guidance
- Prohibits citing Kenyan legal authority from training data
- Requires surfacing corpus-vs-web conflicts and preferring newer authority
- Mandates an explicit "no results" admission when both tools come up empty
- Bans invented or paraphrased citations outright
- Flags EA Court of Appeal cases (pre-1977) as persuasive, not binding
- Directs users to kenyalaw.org / relevant regulator for out-of-corpus
  authorities

Retrieval tools (search_kenya_law, search_legal_authority_web) are not yet
registered - contract is placed ahead of implementation intentionally so
the model refuses rather than hallucinates if a retrieval gap occurs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
07e1243e feat: add Kenya Law RAG and trusted web search tools Davemaina1 2026-05-13 ↗ GitHub
commit body
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>
83f72e57 Fix normalizer metadata projection; verify and expand domain allowlist Davemaina1 2026-05-13 ↗ GitHub

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

⬇ Download capture-thread-378.md