Yuvraj Singh

Back to all work

Mentor Me, in the PocketMentor app

Freelance AI Engineer, Aug 2025 – Present, sole engineer on PocketMentor (2026, in testing)

An AI coach grounded in Joseph Chou's book The Income Breakthrough, inside a 30-day personal-development app. The book became 38 structured records behind a routing index and one read tool instead of vector search, every reply is checked by a separate safety model running in parallel, and the evaluation sets were written before any tuning.

Fig. 1 Ask the coach something and watch it route. The safety classifier runs alongside the reply, and the reply is released once its verdict is in. Illustrative record names and replies, not the book's content.

What it is

PocketMentor is a 30-day personal-development app built around Joseph Chou's G.R.O.W.T.H. framework and his book The Income Breakthrough. I was the sole engineer, working with a designer and a product manager, on Expo and React Native with Supabase (Postgres with row-level security, Deno edge functions). Mentor Me is the coach inside it.

It has two surfaces and one agent. Ask is an open conversation. Guide Me sits on a journaling step in the day's programme and helps with the one question on screen, using the person's draft so far. The difference is context, not identity, so both share one client hook, one egress function and one edge function.

The app has been through TestFlight and Play internal testing and a three-week friends-and-family round, and Mentor Me is in testing.

The corpus decides the architecture

The first question wasn't "which vector database" but how big the corpus is. The book plus the client's existing content library came to about 116,000 words, roughly 155k tokens. That fits in one long context, so retrieval was a choice, and I wrote the options down first:

Turning a book into records

I converted the manuscript once into a tree of Markdown records with typed YAML frontmatter: 27 chapter records, 9 scenario personas, and 2 supporting records, 38 in all. On top of the existing content schema I added two retrieval fields: use_when, which describes the record in the reader's problem language rather than the book's, and user_says, everyday phrasings someone might actually type.

A build step walks the tree, parses frontmatter and splits any record over 2,200 words on its sub-headings (seven are), so the longest chapter can't eat a context window in one call. It writes a committed TypeScript module holding the index, the system prompt and an id-to-record map, bundled into the edge function. The system prompt's source of truth is a Markdown file the author can mark up, and the build fails if that file still describes a tool the build doesn't ship.

Retrieval: what I prototyped, and what shipped

The prototype gave the model a wrapped search tool over the files rather than a shell. On a 16-case seed set, ripgrep exact-phrase counting got the right record into the top 3 on 8 of 12 measurable cases. All four misses were multi-word paraphrases that no record contains verbatim. Scoring query tokens separately, and weighting user_says above titles and body text, got 16 of 16.

Then the deployment target simplified it further. Supabase edge functions run Deno with no shell, so there's no rg to call, and the 38-record index is only 1,756 tokens. So the shipped design inlines the whole routing index in the system prompt and gives the model one tool, read_record(id, section?). The model matches the person's words against the use_when lines itself, and its first tool call is already a fetch, not a search. A mistyped ID costs a turn, not a crash. The loop is capped at three tool steps. Past about 300 records the index stops fitting and search comes back.

Guide Me goes one step further. Where the content team has paired a journal question with specific records, those records are inlined in full and the model is told not to fetch them, so the turn needs no tool call. Measured locally, a one-record Ask turn took 2.9 s, two records 7.2 s, a long sectioned record 12.4 s, and a Guide Me turn 5.6 s against 10 s when it had to fetch the same records. The spread is tool steps, not the model.

Safety runs beside the reply, not after it

Every turn makes two calls at once: the chat model (GLM-5.3-Flash on Together AI) writes the reply while a separate classifier (Llama 3.3 70B with a JSON schema) reads the exchange for crisis signals, so the check adds no wait.

It's a separate model because a model steered into a warm coaching voice is the one least likely to break frame and flag itself, and GLM, asked for schema-constrained JSON, returned chain of thought instead. The classifier first shipped reading the person's messages in isolation and flagged an ordinary answer to a journal prompt as a crisis. Now it reads the whole exchange plus the question being answered.

The gate is one pure function with a test for every row. A crisis verdict replaces the model's reply with reviewed safety copy containing real Australian helpline numbers, even if the reply itself failed. A model asked to improvise crisis copy improvises the phone numbers too. Since October 2026 it fails closed: no usable verdict means the safety copy, not the unchecked reply. That trades a real harm (a helpline number where coaching should be, during a classifier outage) for a worse one, and the trade is written down for the PM to sign off.

Evals before tuning

I wrote the evaluation sets before tuning anything:

The 30% held-out split is stratified and ordered by a hash of the case ID, so it never reads the text, and a script checks that no index wording leaks into held-out questions. Every run is pinned to a manifest of hashes of the knowledge bundle, provider code and seed data, and a deterministic scorer checks retrieval rank and whether quoted spans actually appear in the book.

The question cases test behaviour as well as retrieval: whether the coach answers, asks first, abstains or escalates when it should. Both sets have been scored, and I iterated on them with agents to fit this product's users and failure modes. The quoted-span check earns its place: it catches paraphrases presented as quotes, which a reader would never spot.

Privacy, and one thing the docs didn't say

The edge function takes the caller from the JWT, never the request body, caps each request at 40 messages of 4,000 characters, and logs only message counts and record IDs. A handful of earlier journal answers can join the prompt behind a consent switch; the income goal amount never does.

Turning reasoning "off" on the chat model didn't turn it off, and at default effort it sometimes spent the whole output budget thinking and returned an empty reply. Setting effort to low cut turns from 3.2–4.3 s to about 1.5 s. That's a correctness setting as much as a latency one.