Inspiration
In a national survey of Nigerian adults, 81% had faced a legal problem in the past year, and only 5% of those who acted turned to a lawyer (HiiL, 2023).
Getting legal help begins with uncertainty: which facts matter, which law applies, which documents to gather, and who can help. People repeat their story in every conversation, and lawyers receive enquiries with the context missing.
Recourse began with a question: what if your legal assistant remembered your matter, helped you prepare, and worked with a lawyer's own agent under instructions you approved?
What it does
Recourse is a network of legal agents. Each one belongs to someone.
- Your personal agent. It keeps your matter across sessions. It proposes facts from what you say and asks you to confirm them. It reads your PDF and DOCX documents and cites the clause. It explains published law with a citation for each claim, and says so when the law is not in its library.
- A lawyer's or firm's professional agent. The lawyer builds it by conversation, with no code and no prompt writing: describe the work, answer questions, run simulations, publish. It answers only inside a versioned delegation policy. Anything else waits for a person.
- The firm's legal agents. Private work agents for research, document review and drafting. Their records, work plans and screens are built. The runner that completes their work is an early prototype that runs only in local development; it is off in the hosted app.
Built on Open Alvary. Open Alvary is our open library of African law: each text is compared with the official original and approved by a person. It is a separate project that we started before this hackathon, with a public API and MCP server that anyone can build on. Recourse is one example of what a builder can make with it: an agent that quotes the published words, links the section, and checks that the law is still current.
Consent sits between them. Before anything leaves your matter you see the exact package: which lawyer, which facts, which question. Approval is bound to a hash of that package. Correct a fact afterwards and the approval no longer applies.
A person stays in charge of advice. A lawyer approves the exact text of a substantive reply. Edit the text and the approval is void.
The Frankenstein part: seven things that don't usually share a body
| Stitched in | What it is here | Why it doesn't normally fit |
|---|---|---|
| A private chat | One person, one matter, memory they can correct or erase | Legal problems are private; networks are not |
| A professional network | @handles for lawyers and firms, a directory, connections between professionals, referrals, direct chat with staff takeover |
A connection grants no access to any client or matter. A person's own handle stays private unless they share it |
| Three kinds of agent | Personal, professional and legal agents exchanging typed, authenticated messages under a named mandate | Agents owned by different people, who must not see each other's threads |
| A law library | Open Alvary, our open catalogue of African law: verified text, currentness, exact quotations | A model wants to paraphrase; the library insists on the published words |
| Other countries' law | Adapters for EUR-Lex, the US eCFR and CourtListener, and legislation.gov.uk, plus Google Search grounding on Gemini | Every source carries one of three labels (verified corpus, public API, web) and only the first is ever called verified. Built; switched off on staging until metered |
| A law-firm back office | Conflict screening, team permissions, quotes, invoices and receipts | Runs beside a consumer chat, on the same matter, without leaking either way |
| A job engine | Leases, fencing tokens and an outbox in PostgreSQL, woken by Cloud Tasks | A chat is instant; legal work waits days. A worker can restart mid-task and send nothing twice |
Around that body:
- Five languages. The interface is in English, French, Portuguese, Swahili and Arabic. The agent chats in the person's language and any message can be translated in place.
- Two clients, one core. The web app, and native iOS and Android apps in React Native and Expo that share the same API client and design tokens. The mobile apps build and launch; they are still in development.
- A virus scanner. ClamAV runs as a sidecar and scans every upload before anything reads it.
- Law by jurisdiction. Nigeria and Rwanda come from Open Alvary. The agent never assumes a jurisdiction; it asks, and a matter without one cannot be sent to a lawyer.
The stitches are the product. Each seam is a rule in code: no default jurisdiction, no reply without an approved package, no source called verified unless it is.
How we built it
With Kiro, spec first. We used Kiro IDE, Kiro CLI and Kiro Crew. Recourse is a large app (a web client, a mobile client, an API, background workers and 17 feature areas with legal rules that cannot bend), so no single Kiro tool covered it and each had its own job. Everything Kiro uses is committed in the repo's .kiro/ folder.
- Specs set the order of work. 17 specs, 622 tasks in 92 waves, requirements in EARS form, with scripts that check every task graph. Each legal rule (consent before sharing, screening before disclosure, no unverified citations) is a numbered requirement with a test.
- Steering and hooks hold the rules. 8 steering files, two of which load only for the files they govern, and 7 hooks tied to saves, spec tasks and tool use.
- Custom agents review the work. Three, run in Kiro CLI. One found that a referral reached the receiving lawyer with no conflict screening.
- MCP connects Kiro to the law. Through the Open Alvary server, Kiro checked our recorded evidence against the live catalogue and found a gap that reading the file could not show.
- Property-based tests catch what examples miss. A Hypothesis property found a live bug: any verified lawyer could erase a source on another client's matter. The rule it proved is now in Kiro steering.
- Also used: a power that bundles our legal research rules, Kiro Crew for delegated fixes and a scheduled build, and Kiro memory for settled product decisions.
Kiro was our main coding agent. When our Kiro credits ran out we carried on with another coding tool we subscribe to, working from the same specs and steering, and returned to Kiro when our subscription renewed. KIRO_USAGE.md in the repo is the dated log.
The stack: React, TypeScript and Vite; React Native and Expo; Python, FastAPI, SQLAlchemy and Alembic; PostgreSQL with pgvector; LangGraph; LiteLLM in front of Gemini on Vertex AI; Firebase Auth and Hosting; Cloud Run, Cloud SQL and Cloud Tasks; ClamAV; pytest, Hypothesis, Playwright and axe.
What existed before. Open Alvary (another project by Ruhu, Inc.), our law catalogue, predates the hackathon. Recourse calls it over HTTP and holds none of its code. The first Recourse commit is dated 31 October 2026, and the dates are in the commit history. Earlier planning and other pre-existing work are listed in SUBMISSION-DISCLOSURE.md.
Challenges we ran into
- Passing tests that proved nothing. A review found nine trust gaps, including a lawyer who could verify themself. The suite was green because the tests set up privileged state directly and never walked the real path. We rewrote them to send the requests the app sends.
- Our own shortcuts. On day one we added demo endpoints with canned replies. The spec said one real application, so we deleted them the same day and recorded the decision.
- An access rule that read correctly. A permission check ended
or prof is not None. Four example tests passed. A Hypothesis property generated an unrelated verified lawyer and found they could withdraw a client's source, which erases its text. - A network that must not gossip. Handles, connections and referrals make a legal product social. Each one needed a rule for what it does not reveal.
- "Not held" is not "no such law". Every answer path had to keep that difference, in five languages.
Accomplishments that we're proud of
- Consent that follows the content. Change what is shared and you must ask again.
- A two-firm exchange that survives a worker restart with no duplicate message, proven by test.
- Honest sources. Three provenance labels, and only one is called verified.
- Tested like a product. 2,162 backend tests, 351 web tests and 103 browser cases on desktop and phone, in light and dark.
- A build log that records what failed as well as what worked.
What we learned
- A spec is worth most when a script can check it.
- Write each steering rule as something a test can assert. The bug our property test caught became a steering rule the same day.
- Put property-based tests on permission rules. The case you did not think of is the one that hurts.
- A hook on save is cheaper than a review a week later.
What's next for Recourse
- Finish the release gates: frozen evaluation sets, a supervised pilot with verified lawyers, activation one category at a time.
- Finish the legal-agent runner, so a firm's agents can complete work orders outside local development.
- Turn on the wider sources (EU, US, UK and web grounding) once they are metered.
- Ship the mobile apps.
- More law: Ghana, Kenya and South Africa through Open Alvary (another project by Ruhu, Inc.).
Built With
- alembic
- docker
- expo.io
- fastapi
- gcp
- gemini
- hypothesis
- kiro
- kirocrew
- litellm
- postgresql
- pydantic
- pytest
- python
- react
- react-native
- sqlalchemy
- typescript
- vite