Skip to content
AI Newbie
Menu
Step 7 of 85 min read

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)

  1. In your tool, make a new branch from main called my-coach.
  2. 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.
  1. 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)

  1. Install Ollama (free and open source) from https://ollama.com/download
  2. Get a small model. In a terminal, run: ollama run gemma3:1b (about 806 MB to download). Type /bye to leave.
  3. 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.
  1. 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.

  1. Never put a key in index.html, or any file in your repo.
  2. Your site is public. Anyone can open "View source" on a GitHub Pages site and read every line.
  3. Git remembers everything. If you commit a key and delete it later, it's still in the history.
  4. If a key leaks, cancel it right away on the service's website and make a new one. Deleting the line isn't enough.
  5. 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: ollama and 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 ollama commands 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

WordWhat it means
ModelThe AI "brain" that writes text
APIA way for one program to ask another for something
API keyA secret password for an API. Never commit it
localhostYour own computer, as a web address
FallbackWhat 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

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

Get the AI Newbie Brief