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.