cd /news/ai-tools/studybuddy-cli-an-ai-study-companion… · home › topics › ai-tools › article
[ARTICLE · art-144808] src=dev.to ↗ pub= topic=ai-tools verified=true sentiment=↑ positive

StudyBuddy CLI — An AI Study Companion Built for My Friend Who's Cramming for Exams

A developer built StudyBuddy CLI, a terminal-based AI study companion that converts notes into flashcards and quizzes users via the SM-2 spaced-repetition algorithm, running entirely locally through Ollama so study data never leaves the machine. The tool uses two LLM prompts — one to generate Q&A pairs as JSON from raw text and another to explain wrong answers — and stores decks and progress as JSON files under ~/.studybuddy/.

by read4 min views1 publishedOct 4, 2026

This is a submission for the Hacktoberfest Weekend Challenge: Build for a Friend

My friend is cramming for mid-term exams and has been spending hours re-reading notes without actually retaining anything. I built StudyBuddy CLI — a terminal-based AI study companion that turns messy notes into smart flashcards and quizzes you using spaced repetition, so you actually learn instead of just memorizing.

The killer feature? It runs 100% locally on their laptop using Ollama. No accounts, no cloud uploads, no subscriptions. Their study data — including potentially sensitive class notes — never leaves their machine.

Here's what it does:

When I showed it to my friend, they said: "Wait, this runs offline? I can use this during study sessions at the library where the WiFi is terrible." That's exactly the point.

Here's what the CLI looks like when you launch it:

  ___ _           _      ___         _    _      
 / __| |_ _  _ __| |_  _| _ )_  _ __| |__| |_  _ 
 \__ \  _| || / _` | || | _ \ || / _` / _` | || |
 |___/\__|\_, \__,_|\_, |___/\_,_\__,_\__,_|\_, |
                    |__/                    |__/ 
  AI-Powered Study Companion  •  Ollama  •  100% Local

  ✔ Connected to Ollama • llama3.2:latest

  🔥 5-day streak  │  📚 3 decks  │  🃏 42 cards  │  🎯 85% accuracy

The quiz flow works like this:

The progress dashboard tracks everything:

  🔥 Current Streak: 5 days   |   🏆 Longest: 12 days

┌───────────────┬──────┐
│ Cards Studied │ 150  │
│ Correct       │ 120  │
│ Incorrect     │ 30   │
│ Accuracy      │ 80%  │
│ Decks Created │ 5    │
└───────────────┴──────┘

  📊 Last 7 Days
  Mon  ███████████      11
  Tue  ████████████████ 16
  Wed  ██████████       10
  Thu  ░                 0
  Fri  ████████         8
  Sat  █████████████    13
  Sun  ███████████████  15

AI-powered study companion with spaced repetition — runs 100% locally with Ollama.

Built for a friend who's cramming for exams and deserves a study tool that respects their privacy, works offline, and actually helps them learn — not just memorize.

studybuddy-cli/
├── bin/studybuddy.js        # CLI entry point
├── src/
│   ├── index.js              # Interactive menus
│   ├── ai/ollama.js          # Ollama REST API client
│   ├── cards/
│   │   ├── generator.js      # AI flashcard generation
│   │   ├── importer.js       # PDF/text extraction
│   │   └── manager.js        # Deck & card CRUD
│   ├── quiz/
│   │   ├── engine.js         # Quiz runner
│   │   └── sm2.js            # SM-2 algorithm
│   ├── progress/tracker.js   # Streaks & stats
│   ├── ui/
│   │   ├── display.js        # Banner, dashboard
│   │   └── theme.js          # Color palette
│   └── voice/
│       ├── page.html         # Web Speech API page
│       └── server.js         # Local HTTP server
├── LICENSE                   # MIT
└── README.md

All data is stored locally in ~/.studybuddy/ as JSON files — one per deck, plus a global progress file.

Open-source AI stack:

The AI is used in two key places:

1. Flashcard generation — a carefully crafted system prompt tells Ollama to produce Q&A pairs as a JSON array from raw text. The parser handles markdown fences, leading prose, and other LLM quirks gracefully.

2. Wrong-answer explanations — when you get a card wrong, a second prompt asks the model to explain why the correct answer is right, given what you said. It's encouraging, not condescending. Here's a real example:

Q: What is the primary pigment in photosynthesis?

Your answer: Carotene

AI: You were close! Carotene is indeed an important pigment in plants, but it's not the primary one. Chlorophyll is the superstar of photosynthesis — it's the pigment that absorbs light mainly in the red and blue wavelengths, which is why plants appear green.

The interactive terminal UI uses chalk for colors, figlet for the ASCII banner, gradient-string for gradient effects, ora for spinners, and @inquirer/prompts for the menu system.

Concern How StudyBuddy handles it
Privacy Study notes never leave the machine. No API keys, no cloud. My friend studies medical terminology — that data shouldn't be on someone else's server.
Offline Works in a library with no WiFi. Once the model is downloaded, zero internet needed.
Cost Free forever. No per-token charges. A broke college student shouldn't have to pay to study.
Flexibility Swap models instantly. Llama 3.2 for quality, Phi for speed on an older laptop.
Transparency Every prompt is in the source code. No black-box behavior — you can see exactly what the AI is told to do.

A closed API couldn't do this. It would require internet, cost money per question, and send study notes to a server my friend doesn't control. Open-source AI made it possible to build a tool that's genuinely theirs.

── more in #ai-tools 4 stories · sorted by recency
── more on @studybuddy cli 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/studybuddy-cli-an-ai…] indexed:0 read:4min 2026-10-04 · —