AI · Web
MOOD — AI Journal
Journal, then ask your journal questions.
MOOD is a journaling app that reads you back. Every entry you save is analyzed into a structured record — mood, subject, summary, and a sentiment score from -10 to 10 — and you can then ask your journal questions in plain English: "What was my best day?", "How have I been feeling lately?". Answers come back grounded in your own writing, with links to the specific entries they came from.
It was built as a hands-on way to understand Retrieval-Augmented Generation rather than treat it as a black box, so every stage of the pipeline is implemented by hand in a single readable file. Entries are enriched with their stored analysis before embedding, turned into 1,536-dimension vectors, and matched against the embedded question by cosine similarity — which is how "Have I been sleeping badly?" surfaces "I tossed and turned all night" despite sharing no keywords.
The most useful lesson in the codebase is knowing when not to use vectors. "What was my best day?" is a ranking problem, not a similarity one — embedding it surfaces entries that merely mention good days — so those questions skip retrieval entirely and sort by the sentiment score already in the database. The final call is then constrained by a Zod schema, forcing the model to return its answer alongside the entries it used, which is what lets the UI cite its sources instead of asking you to trust it.
Highlights
- Hand-built RAG pipeline: enrichment → embedding → similarity search → grounded answer
- Cosine-similarity retrieval over 1,536-dimension OpenAI embeddings
- Query routing — metadata ranking for best/worst questions, vectors for everything else
- Zod-constrained structured output, so every answer cites the entries behind it
- Automatic per-entry analysis: mood, subject, summary, and sentiment score
- Clerk-authenticated, with Prisma and Neon Postgres persistence
- Mood timeline, distribution, and statistics views built from the analysis data