A small AI build: your weekly coach
Newbie to Tech · Step 7 of 8 · about 6 minutes to read, 30–45 minutes to do
Practice project: https://github.com/jazken/mood-habit-tracker · start from your main · answer key: branch step-5 (practice coach, no key, no internet). Lesson 7 uses branch step-5. The names don't line up, and that's fine.
Ollama details were checked against its docs and source code on 24 Oct 2026 (SGT). Part B is optional and was not tested end to end by us.
Do this now (you can read the rest after)
You'll add a "Weekly coach note" button. Part A works for everyone, with no AI and no key. Part B, optional, connects a real AI model that runs on your own computer, for free, with no key at all.
Part A: a practice coach (15 minutes, everyone)
- In your tool, make a new branch from
maincalledmy-coach. - Ask, plan first:
Plan a "Weekly coach note" section for index.html.
A button writes a short note from the last 7 saved days:
how many days I checked in, how many habits I marked,
and my most common mood. No AI, no internet, no key.
Don't change anything yet.
- Read the plan, say go, approve each diff. Refresh and click the button.
Part B: a real AI coach on your computer (optional, 20–30 minutes)
- Install Ollama (free and open source) from https://ollama.com/download
- Get a small model. In a terminal, run:
ollama run gemma3:1b(about 806 MB to download). Type/byeto leave. - Ask your tool:
Plan how to make the coach button send my last 7 days to Ollama
running on this computer, at http://localhost:11434/api/generate,
with model gemma3:1b and stream set to false.
Ask for 3 short, kind sentences. If Ollama isn't running,
keep the practice note from Part A. No keys. Don't change anything yet.
- Approve the plan and the diffs. Then ask: "Start a simple local web server for this folder, and tell me the address." Open that address (it starts with
http://localhost), not the file.
Check you did it: the button writes a note. In Part B, the note changes each time and sounds like a coach. Then commit ("Add a weekly coach note"), push my-coach, open a PR into your fork's main, and merge.
Why this matters
Lots of "AI apps" are a normal app plus one call to an AI model. That's what you just built. You also saw the most important rule in AI building: keep secrets out of your code.
Why a local server in Part B?
Opening index.html by double-click uses a file:// address. Ollama's docs say it accepts requests from localhost addresses by default. A tiny local web server gives your page a localhost address, so the request is allowed. Your tool may suggest python3 -m http.server 8000, which needs Python. (We haven't tested the double-click way with Ollama.)
Your live site and Part B: the coach on your GitHub Pages site can't reach the Ollama on your computer. For visitors, the practice note from Part A shows instead. That's why Part A is the fallback.
⚠️ Secrets: the rule that matters most
Many AI services want an API key. A key is like a password that lets your app use a paid service, billed to you.
- Never put a key in
index.html, or any file in your repo. - Your site is public. Anyone can open "View source" on a GitHub Pages site and read every line.
- Git remembers everything. If you commit a key and delete it later, it's still in the history.
- If a key leaks, cancel it right away on the service's website and make a new one. Deleting the line isn't enough.
- Read the diff before every commit. Ask your tool: "Check this diff for keys, passwords or tokens before I commit."
Part B needs no key, because the model runs on your computer. That's the safest way to start. Real apps with keys keep them on a server, never in a web page. That's a later topic.
Put this line in your rules file: "Never write API keys, passwords or tokens into any file in this repo."
In your tool: secrets and commands
- Kiro:
ollamaand server commands will ask Allow / Deny. Allow them once.- Codex: network access is off by default. Talking to Ollama, even on your own computer, may need your approval. We haven't tested this.
- Claude Code: approve the server command once. Don't add an "always allow" rule for it.
- Antigravity: keep the server and
ollamacommands in Ask while you learn.- All tools: a local server keeps running. Ask your tool how to stop it when you're done.
What AI is (and isn't)
The model doesn't "know" you. It predicts likely words from your 7 days of taps. It can be wrong, or say something odd. That's why your app should show the facts (days, habits) next to the AI's words. For a free, plain intro to AI, read chapter 1 of Elements of AI.
Words from this step
| Word | What it means |
|---|---|
| Model | The AI "brain" that writes text |
| API | A way for one program to ask another for something |
| API key | A secret password for an API. Never commit it |
| localhost | Your own computer, as a web address |
| Fallback | What the app does when the fancy part doesn't work |
Answer key
The step-5 branch has the Part A practice coach: https://github.com/jazken/mood-habit-tracker/tree/step-5. It has no key and makes no internet call. Part B isn't in any branch. That's your own build.
Go deeper
- Ollama: https://ollama.com/ · its generate API: https://docs.ollama.com/api/generate · FAQ (allowed addresses): https://docs.ollama.com/faq
- Elements of AI (free): https://www.elementsofai.com/
- GitHub secret scanning: https://docs.github.com/en/code-security/secret-scanning/introduction/about-secret-scanning
- Hugging Face LLM course (free, harder): https://huggingface.co/learn/llm-course
Next: Step 8, Pick your next path.
After you try it
Did this produce something you could use, and what did you have to correct?
Email a reply, or keep a note for yourself. The useful part is the correction — that is the skill, not the first draft.
Email hello@ainewbie.org