Date: 2025-12-13 Purpose: Evaluate current architecture for AI-powered development assistant expansion
What You Have ✅:
- Clean MVC architecture using Bubbletea framework
- ~2,700 lines of well-organized Go code
- Multiple view modes: Chat, Command Palette, Settings, Programs, Onboarding
- Command system with categories (
finance:*,stoic:*,tech:*,system:*) - API client for agent-gateway communication
- Configuration management
- Connection health checks
Strengths:
- ✅ Professional, polished interface
- ✅ Modular component structure
- ✅ Command palette pattern (already supports deep navigation)
- ✅ Settings and onboarding flows
- ✅ Good separation of concerns
What to Keep:
- ✅ KEEP EVERYTHING - This is solid foundation
- Command registry system in
ui/commands.go - Chat interface with LLM integration
- Settings management
- Connection handling
What Needs Extension:
⚠️ Command registry needs to scale to hundreds of commands⚠️ Command palette needs better filtering/search for deep hierarchies⚠️ Need file picker/browser for AI commands that work with files
What You Have ✅:
- Go/Gorilla Mux REST API (~9K LOC in agent-gateway binary)
- API key authentication
- CORS support
- Logging (access + error logs)
- Health checks
- Systemd service integration
- Database manager for SQLite backends
- Executor for running external programs
- Programs registry system (extensible!)
- LLM integration (Ollama)
Current Handlers:
handlers/meta.go- Health/statshandlers/stoic.go- Stoic thoughtshandlers/tech.go- Tech tipshandlers/financial_*.go- Finance features (4 handlers)handlers/llm.go- LLM chat with command suggestionshandlers/programs.go- Extensible programs
Strengths:
- ✅ Production-ready (systemd service, logging, graceful shutdown)
- ✅ Programs registry is brilliant - exactly what we need!
- ✅ CommandBuilder pattern for external programs
- ✅ Already has LLM integration
- ✅ Clean handler separation
What to Keep:
- ✅ KEEP EVERYTHING - This is your solid API foundation
- Programs registry pattern (
programs/program.go) - CommandBuilder for shell command execution
- Handler structure
- Middleware (auth, logging, CORS)
What Needs Extension:
⚠️ Add new programs for AI dev tools⚠️ May need category/namespace support in registry⚠️ Need script execution wrapper program
TUI → API Flow:
User input in TUI
↓
Command detected (e.g., "finance:dashboard")
↓
TUI calls client.Client methods
↓
HTTP request to agent-gateway (http://battlestag:8080)
↓
Handler processes request
↓
May call external program via executor
↓
JSON response back to TUI
↓
TUI displays result
Programs System:
programs.Registry
├─ task-manager (Go program calling bash scripts)
├─ lab-monitor (Go program calling bash scripts)
└─ [Future: AI tools as programs]
~/scripts/
├── ai/ # AI-powered development tools
│ ├── code-review
│ ├── test-gen
│ ├── doc-gen
│ ├── security-scan
│ ├── refactor
│ └── explain
│
├── finance/ # Financial automation
│ ├── statement-parser
│ ├── budget-analyzer
│ └── tax-calculator
│
├── health/ # Health & wellness
│ ├── meal-planner
│ ├── workout-tracker
│ └── sleep-analyzer
│
├── automotive/ # Car maintenance
│ ├── maintenance-reminder
│ ├── fuel-tracker
│ └── repair-log
│
├── business/ # Business tools
│ ├── invoice-gen
│ ├── proposal-writer
│ └── meeting-notes
│
└── lib/ # Shared libraries
├── llm-helper.sh # LLM API wrapper
└── common.sh # Shared utilities
New Program Type: ScriptProgram
// programs/script_program.go
type ScriptProgram struct {
category string
name string
scriptPath string
description string
}
// Auto-register all scripts in ~/scripts/
func RegisterScriptsFromDirectory(registry *Registry, baseDir string)New Handler: handlers/ai.go
// Unified AI handler that routes to appropriate scripts
func HandleAICommand(w http.ResponseWriter, r *http.Request) {
// Parse request
// Call script via CommandBuilder
// Stream results back
}New Command Category:
{
Name: "🤖 AI Dev",
Key: "ai",
Description: "AI-powered development tools",
}
// Sub-commands auto-generated from ~/scripts/ai/
ai:review
ai:test
ai:doc
ai:security
ai:refactor
ai:explainAuto-discovery:
- TUI calls
/api/programs/liston startup - API scans
~/scripts/and returns available commands - TUI dynamically builds command registry
TUI (100%):
- ✅ All UI components
- ✅ Command palette system
- ✅ Chat interface
- ✅ Settings management
- ✅ Client/API integration
- ✅ Bubbletea framework choice
API Gateway (100%):
- ✅ All handlers
- ✅ Programs registry
- ✅ CommandBuilder
- ✅ Middleware
- ✅ Database manager
- ✅ Executor
- ✅ LLM client
Why Keep Everything?
- Architecture is sound
- Code quality is good
- Already handles extensibility (programs registry)
- Just needs new programs registered
Nothing!
The architecture is solid. We only need to extend, not replace.
- Create
~/scripts/directory structure - Move existing LLM helpers to
~/scripts/lib/ - Create AI dev tools in
~/scripts/ai/ - Make all scripts follow consistent interface
- Create
programs/script_program.go- generic script wrapper - Add script auto-discovery on startup
- New endpoint:
GET /api/scripts/categories(list all categories) - New endpoint:
GET /api/scripts/:category(list scripts in category) - New endpoint:
POST /api/scripts/:category/:name(execute script)
- Extend command registry to support dynamic commands
- Add file picker component for AI commands
- Enhance command palette with better search/filtering
- Add progress indicators for long-running AI tasks
- Create deployment script
- Docker containers for easy deployment
- Configuration templates
- Client customization guide
finance → dashboard, assets, liabilities, upload, query
stoic → today, random
tech → random, latest
system → programs, settings, clear, help, quit
Option A: Breadcrumb Navigation
┌─ Command Palette ─────────────────────────┐
│ ai > code > │
├───────────────────────────────────────────┤
│ ▸ review Review code for bugs │
│ ▸ test Generate unit tests │
│ ▸ security Security audit │
│ ▸ refactor Improve code quality │
│ ▸ doc Generate documentation │
└───────────────────────────────────────────┘
Option B: Fuzzy Search
┌─ Command Palette ─────────────────────────┐
│ Search: rev │
├───────────────────────────────────────────┤
│ ▸ ai:code-review Review code │
│ ▸ finance:review-asset Asset review │
│ ▸ git:revert Revert changes │
└───────────────────────────────────────────┘
Option C: Tree View (Expandable)
┌─ Command Palette ─────────────────────────┐
│ ▾ ai │
│ ▾ code │
│ ▸ review │
│ ▸ test │
│ ▾ docs │
│ ▸ generate │
│ ▾ finance │
│ ▸ dashboard │
└───────────────────────────────────────────┘
Option D: Recent + Favorites + Search
┌─ Command Palette ─────────────────────────┐
│ ⭐ Favorites │
│ ▸ ai:code-review │
│ ▸ finance:dashboard │
│ │
│ 🕐 Recent │
│ ▸ ai:test │
│ ▸ stoic:today │
│ │
│ 🔍 Search: _ │
└───────────────────────────────────────────┘
Recommendation: Hybrid Approach
- Fuzzy search (primary)
- Recent commands (quick access)
- Breadcrumb navigation (when drilling down)
- Favorites (power users)
Many AI commands need file input. Need UI for this:
File Picker Component:
┌─ Select File ─────────────────────────────┐
│ 📁 ~/projects/myapp/ │
├───────────────────────────────────────────┤
│ 📁 src/ │
│ 📁 tests/ │
│ 📄 main.rb │
│ 📄 config.yml │
│ 📄 README.md │
│ │
│ Selected: main.rb │
│ [Cancel] [Confirm] │
└───────────────────────────────────────────┘
Or Prompt for Path:
┌─ AI: Code Review ─────────────────────────┐
│ File path: src/auth.rb_ │
│ │
│ Or paste code: │
│ ┌─────────────────────────────────────┐ │
│ │ │ │
│ │ │ │
│ └─────────────────────────────────────┘ │
│ [Cancel] [Review] │
└───────────────────────────────────────────┘
- Your architecture is excellent - Don't rebuild, extend
- Programs registry is the key - Use it for script management
- TUI command system scales - Just needs better search/navigation
- Script-based approach - Perfect for client customization
- Modular design - Easy to add categories for clients
- Design final scripts structure - Get your approval
- Build script_program.go - Generic script wrapper
- Enhance command palette - Better navigation for deep hierarchies
- Add file picker - For AI commands
- Test end-to-end - TUI → API → Script → LLM → Results
Ready to proceed?