Skip to content
Live nowSeason 2 · Episode 15 · Agentic Coding Guide
← Back to builds
Screenshot of A calculator that uses AI to not only solve problems but explain why it works.

A calculator that uses AI to not only solve problems but explain why it works.

by ₥AN$A

★ 5.0 (1)

Voted by ₥AN$A

You enter a question and the AI uses a calcluator function to compute the solution and then uses the LLM to explain the why behind the answer.

Models
Claude Sonnet 5
Cost
100k
Prompts & issues

# MAITH — Prompt & Build Log A chronological summary of what was asked and what was built. Private keys and secrets are intentionally excluded. ## The app **MAITH** — an AI calculator. You ask a math question in plain English; the AI reasons and calls tools, while **math.js** computes every number exactly (the AI never does arithmetic itself). It shows step-by-step working, handles scientific functions, and renders interactive graphs. White-on-black terminal-style chat UI with a scrollable "scratch" area. - **Stack:** Node.js / Express, OpenRouter (model `anthropic/claude-sonnet-5`), math.js, KaTeX, marked.js, Plotly. - **Live:** https://maith.cortexresearch.group - **Hosting:** Railway, auto-deploying from GitHub `main`. ## Prompts, in order 1. Build an AI calculator: plain-English input, AI + a real calculator to answer, explain, and show the work. Scientific + graphing. Simple white-on-black chat box with a "scratch" canvas that populates. First write a high-level spec. 2. Chose the math-engine approach (deterministic engine as source of truth). 3. Use an OpenRouter API; ship to Railway. 4. Chose inline-only scratch layout. 5. Chose interactive graphs. 6. "Do it" — build it fast for a demo. 7. Use the `sonnet 5` model. 8. Give an elevator pitch + a walkthrough. 9. Fix the answer cutting off (it started mid-way, at step 5). 10. Lock the page so it doesn't stretch — only the scratch area scrolls. Add export/import of chats as `.md`. Persist chats in local cache. 11. Commit and push to GitHub. 12. Connect Railway to the GitHub repo for auto-deploy. 13. Connect the domain `maith.cortexresearch.group`; make a cool OG image for socials. 14. Verify the domain. 15. Add a "buy me a coffee" link at the bottom (username `cortexresearch`). 16. Change the favicon to a math emoji if one exists. 17. Verify the TLS cert. 18. Make answers look better (Markdown wasn't rendering) — tested with "explain e=mc2". 19. "Send this to Railway." 20. Update the website title to **MAITH**. 21. Update the OG image to say **MAITH** too. 22. Commit the `og.html` template to the repo. 23. Create this summary file (excluding private keys). ## Key fixes along the way - **Truncated answers:** the server returned only the final tool-round's text. Fixed by accumulating narration across every round and joining it. - **Locked layout:** `html, body { overflow: hidden }`; only `#chat` scrolls. - **Markdown + math coexistence:** shield math spans → `marked.parse` → restore → KaTeX. Also fixed raw `\( \)` on cache-restore by booting after `DOMContentLoaded` (KaTeX loads deferred). - **Model selection:** `anthropic/claude-3.5-sonnet` 404'd on OpenRouter; switched to `anthropic/claude-sonnet-5`. - **Custom domain:** already attached and resolving (CNAME to Railway); verified live with a valid TLS cert. - **Rebrand to MAITH:** title, header wordmark, OG/Twitter tags, export filename, server log, OpenRouter `X-Title`, README. - **OG card:** regenerated with the MAITH wordmark; `?v=2` cache-bust on the image URL so social scrapers refetch. Template + `build-og.sh` committed under `tools/`. ## Security note An OpenRouter API key was shared in chat during setup. It was stored **only** as a Railway environment variable — never written to any file in this repo — and the user was advised to rotate it. No secrets appear in this log or the codebase.