Ridwan HamidBack to the journey

Case study 01

Tie the Camel

AI that knows when not to answer.

A source-linked Islamic reflection aid for people stuck on a decision. It helps them find a calm next step grounded in real sources, and it recognises when a question needs a person rather than a model.

Role
Designed and built end to end: product, backend, front end, infrastructure and evaluation
Status
Live since April 2026
Stack
Next.js, FastAPI, PostgreSQL with pgvector, Redis, Claude Haiku, Terraform on AWS

The problem

Someone stuck on a decision usually gets one of two things from software: a chatbot that answers anything with confidence, or a reference site built for looking things up. Tie the Camel aims for a third: a calm next step, linked to real sources, from a tool that is clear about its limits.

Some questions need a scholar, or urgent help, rather than a model. The design starts there.

How a question flows

A question passes three layers of routing before anything is generated:

  • A deterministic gate, which recognises crisis and personal-ruling patterns before any model is called.
  • An LLM classifier, which routes the rest.
  • A confidence floor, which catches what the classifier is unsure of.

Safety before the model

The first check is deliberately not an LLM. Messages that match crisis or personal-ruling patterns are caught before any model call, and get dedicated panels that point to the right kind of help. CI checks the gate against a gold set of examples on every change.

The product states its limits up front, in its own words: it doesn’t replace a qualified scholar for personal rulings, it doesn’t provide crisis support, and it doesn’t guarantee certainty.

Retrieval and abstention

Everyday language rarely matches the phrasing of classical questions and answers. Retrieval combines full-text and vector search, fuses the two with weighted reciprocal-rank fusion and reranks the result. A theme-expansion layer and two slots reserved for curated notes help close the gap.

Synthesis returns strict JSON and can abstain. When the sources don’t support an answer, it is built to say so instead of guessing, with a deterministic fallback behind it.

Evaluation, and one trade-off

A resumable evaluation harness covers 705 scenarios, with canaries and re-probes for flaky results.

It made one trade-off explicit. On its 254-scenario suite, the retrieval changes cut adequacy misses from 3 to 0, while median latency rose from 14.4 s to 17.3 s.

The service

The FastAPI backend runs on AWS App Runner behind CloudFront, which also serves the Next.js front end. PostgreSQL with pgvector holds the sources for search, alongside Redis, with Claude Haiku as the model. Embeddings are computed inside the container, and the whole deployment is defined in Terraform.

The product

Tie the Camel’s home screen: “What are you stuck on?”, with a box to describe the situation and options such as “I’m overthinking”. (opens larger)
The question it starts from.
A dialog titled “How Tie the Camel works”: it looks for the strongest approved sources, separates what is in your control from what is not, and gives grounded next steps. (opens larger)
How it works, in the product’s own words.
A dialog titled “What this does not do”: it does not replace a qualified scholar for personal rulings, does not provide crisis support and does not guarantee certainty. (opens larger)
Its limits, stated up front.