Build Your Own AI Assistant That Gets Smarter
This guide documents months of real-world iteration building a personal AI assistant called Gizmo. You'll learn how to create a system that remembers your preferences, learns from mistakes, saves tokens, and actually gets better over time—not just a chatbot that forgets everything when the window closes.
# Why Build Your Own AI Assistant?
Out-of-the-box AI assistants are powerful but stateless. Every conversation starts from zero. They don't remember your preferences, your tech stack, or the mistakes they made yesterday.
A personal AI assistant solves these by creating persistent context, structured learning, and automatic memory. The assistant becomes an extension of your brain—one that doesn't forget.
- Fresh start every session
- You re-explain preferences
- Makes the same mistakes
- No project context
- Generic responses
- Remembers everything
- Knows your style automatically
- Learns from corrections
- Deep project context
- Personalized responses
# Architecture Overview
A smart AI assistant is built on five pillars. Each one adds a layer of intelligence that compounds over time.
# The CLAUDE.md Foundation
CLAUDE.md is the heart of your assistant. It's a markdown file that Claude Code
reads automatically at the start of every session. Think of it as your assistant's operating manual.
~/.claude/CLAUDE.md (global) or ./CLAUDE.md (project-specific)# Project Name
## Who You Are
Personal AI assistant for [name]. Built on Claude Code.
## Communication Style
- Direct and concise — no fluff
- Make decisions instead of over-asking
- Builder-to-builder communication
## Technical Preferences
- SvelteKit for web (not React)
- Python 3.12 for ML (not 3.14)
- Supabase for backend
## Don't Do
- Don't use "cohort" — use "intake"
- Don't add emojis unless asked
- Don't over-explain — be brief
## Session Learnings
### Patterns That Work
- [Pattern description] (YYYY-MM-DD)
### Avoid
- [Anti-pattern description] (YYYY-MM-DD)
## Session Log
**2026-01-25** - What was accomplished. See: sessions/file.mdEssential Sections
How should the assistant talk to you? Concise or verbose? Technical or simple?
- Prefer action over discussion- Don't ask for confirmation on small decisionsYour tech stack, tool choices, and conventions.
- Use Cloudflare Pages for deployment- Prefer CSS Grid over Flexbox for layoutsPatterns that work and mistakes to avoid. Updated after every session.
- Don't use $ in passwords (URL encoding issues)- Always test DB with psql before debugging codeExplicit prohibitions. Things that waste time or annoy you.
- Don't use value stacks in pricing cards- Never auto-commit without asking# Bootstrap Files
Bootstrap files are auto-loaded context that gives your assistant immediate situational awareness. Instead of re-explaining your current projects and priorities every session, these files do it automatically.
# User Profile: JV
## Communication Style
- Direct and concise — no fluff
- Prefers action over discussion
- Appreciates decisions over over-asking
## Technical Preferences
- SvelteKit for web (not React)
- Python 3.12 for ML/tools
- Cloudflare Pages for deployment
## Don't Do
- Don't use "cohort" — use "intake"
- Don't add emojis unless asked
- Don't over-explain — be brief# Current Focus (Week of 2026-01-25)
## Active Projects
### Farm Doctor (Android App)
- Status: Scaffolded, needs testing on device
- Next: Build APK, test on physical device
- Model: YOLOv8 papaya detection (82% mAP)
### code:zero Website
- Status: Live, iterating on content
- Recent: Pricing redesign, projects page
## Pending Tasks
1. Test Farm Doctor on physical Android device
2. Set up n8n workflows for email automation
3. Buy codezero.my domain from Exabytes"SILENTLY read ~/.claude/bootstrap/*.md at session start. Do not announce or summarize."Token Impact
# Session Continuity
The worst thing about AI assistants is losing context when the window closes. Session continuity solves this by automatically saving state and resuming seamlessly.
## Session Continuity (AUTOMATIC)
**At session start:**
1. Check for `/sessions/current.md` (interrupted session)
2. If not found, read most recent `/sessions/YYYY-MM-DD-*.md`
3. DO NOT announce — just be informed and ready
**During session:**
- After completing any significant task, update `/sessions/current.md`
- Include: what's done, current state, open threads
**At session end (detect "bye", "thanks", "done"):**
1. Rename current.md to /sessions/YYYY-MM-DD-HHMMSS.md
2. Update Session Log in CLAUDE.md
3. Confirm: "Session saved: [filename]. See you next time."# Memory Systems
Session files create searchable history. But plain text search isn't enough— you need semantic search to find relevant context even when keywords don't match.
Fast, exact matching. Good when you know the specific terms.
Query: "supabase password" Finds: "Never use $ in Supabase passwords"Understands meaning. Finds related content even with different words.
Query: "database connection issues" Finds: "Test with psql before debugging code"Combines both: semantic similarity + keyword matching + recency boost.
score = 0.6×vector + 0.2×BM25 + 0.15×recency + 0.05×complexitySetting Up Hybrid Search
Clone the vector memory tool
Link your sessions folder
The tool indexes all .md files in this directory
Create a wrapper script
#!/bin/bash
cd ~/tools/claude-code-vector-memory && \
source venv/bin/activate && \
python search.py "$@"Index your sessions
# Learning Capture
This is where the magic happens. Every correction, every preference, every successful pattern gets captured and persisted. The assistant literally gets smarter over time.
Successful approaches to reuse in future sessions.
- Test DB with psql before debugging app code (2026-01-15) - Use Python 3.12 for ML tools, not 3.14 (2026-01-20) - Price in CTA button converts better (2026-01-22)Anti-patterns and mistakes to never repeat.
- Don't use $ in DB passwords (URL encoding) (2026-01-15) - Don't hardcode YOLO folder names (auto-increment) (2026-01-25) - Don't change Supabase password quickly (circuit breaker) (2026-01-15)User preferences learned through interaction.
- User prefers action over discussion (2025-01-10) - Don't use "cohort" — use "intake" (2025-01-10) - Stay on Opus, don't sacrifice intelligence (2026-01-11)Auto-Capture Rules
## Automatic Learning
**Learn when:**
- User corrects output
- User states preference
- Pattern succeeds
- Mistake is made
**Save to:**
- Preferences Discovered (if user preference)
- Patterns That Work (if successful approach)
- Avoid (if mistake or anti-pattern)
**Format:** `- [Specific, actionable learning] (YYYY-MM-DD)`
**Rules:**
- Be specific, be actionable
- No duplicates
- Update immediately
- Say "Noted: [learning]" (one line only)- SvelteKit for web (not React) (2026-01-25)# MCP Integrations
Model Context Protocol (MCP) connects your assistant to external tools. Instead of copy-pasting from Google Drive or manually running git commands, the assistant accesses them directly.
Read, search, and organize files directly from Drive.
Create PRs, read issues, manage repositories.
Query databases, manage migrations, deploy functions.
Browser automation, OAuth flows, web scraping.
Configuration
{
"mcpServers": {
"gdrive": {
"command": "npx",
"args": ["-y", "@anthropic-ai/mcp-gdrive"],
"env": {
"GDRIVE_CREDENTIALS_PATH": "/Users/you/.config/mcp-gdrive/credentials.json"
}
},
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_xxxxxxxxxxxxx"
}
}
}
}"env" object, not as --env command args. Many guides get this wrong.# Skills System
Skills are reusable workflows that the assistant can invoke. Instead of
explaining how to write a commit message every time, create a /commit skill
that does it automatically.
Creating a Skill
# /commit Skill
Commit all changes with a well-crafted message.
## Workflow
1. Run `git status` to see changes
2. Run `git diff --staged` to see what's being committed
3. Run `git log --oneline -5` to match message style
4. Draft a concise commit message (1-2 sentences)
5. Stage relevant files (not .env or secrets)
6. Commit with: git commit -m "message"
7. Push to remote
## Rules
- Never commit .env files
- Never use --force push
- Include Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Focus on "why" not "what"# Token Optimization
Every token costs money. These techniques have saved 3,000-10,000 tokens per session in real-world usage.
Token-Saving Habits
Load Priority
CLAUDE.md (always) → session state (if exists) → task files only. Never read everything.
Grep Before Read
Find the specific lines first, then read just that range. Don't read whole files.
Concise Default
Be brief by default. Verbose only when user asks "explain" or "why".
Cache in Memory
Don't re-read files. If you read it once, reference from memory.
# What NOT to Do
These mistakes were learned the hard way. Each one cost hours of debugging or thousands of wasted tokens.
$, #, @ break URL encoding. Use alphanumeric only
or URL-encode them ($ → %24).psql "connection-string" -c "SELECT 1" first to verify
the database is reachable. Don't debug your app if the problem is DNS or networking.ls runs/detect/ | sort -V | tail -1@modelcontextprotocol/server-gdrive has broken OAuth.
Use @isaacphi/mcp-gdrive instead."env" object in ~/.claude.json, not as --env KEY=value in the args array.# Full Setup Checklist
Follow this checklist to build your own AI assistant from scratch. Each step builds on the previous one.
~/.claude/CLAUDE.md with basic structuresessions/ folder for session logs~/.claude/bootstrap/ directory