Back to .md Directory

Interactive Flashcards TUI - Implementation Roadmap

Maps a five-phase build plan for a terminal flashcard app with AI, document support, and RAG features.

May 2, 2026
0 downloads
0 views
ai rag prompt eval openai
View source

What this file does

Maps a five-phase build plan for a terminal flashcard app with AI, document support, and RAG features.

When to use it

  • Planning a phased implementation of a TUI flashcard or study tool
  • Adding AI-powered quiz assessment and session history to an existing app
  • Designing a roadmap for document parsing and RAG integration in a CLI tool
  • Evaluating the scope and architecture of a Rust-based interactive learning project

Assumes this stack

RustSQLiteOpenRouter APIRefinery migrations

Interactive Flashcards TUI - Implementation Roadmap

✅ Phase 1: Core System + AI Integration (COMPLETE)

Completed Features

  • CSV file processing and parsing
  • Full quiz system with navigation and state management
  • TUI interface with menu, quiz, and summary screens
  • Advanced AI integration with persistent workers
  • Timeout handling and error recovery
  • Integrated AI feedback UI
  • Session History Menu - Browse, resume, and delete past quiz sessions
  • Session Assessment - AI-powered post-quiz analysis with grade, mastery level, strengths, weaknesses, and suggestions
  • Session Resume Fixes - Restore last viewed question, preserve skipped questions, and persist out-of-order answers
  • Comprehensive test suite (127 tests)
  • Production-ready with robust error handling

Technical Achievements

  • Zero external dependencies for core functionality
  • Modular architecture with 19 focused files
  • Persistent AI worker threads with automatic recovery
  • Integrated UI design (AI feedback in quiz flow)
  • 30-second evaluation timeouts with user feedback
  • JSON cleaning for robust AI response handling
  • Session persistence and resume functionality
  • SQLite-based session history with date formatting
  • Post-quiz AI session assessment with historical comparison
  • Chat popup markdown spacing normalization

🚧 Phase 2: Document Support (NEXT)

Planned Features

  • PDF/TXT/MD file parsing for custom flashcards
  • Document upload and processing interface
  • Automatic format detection
  • Rich text rendering in quiz interface
  • Document metadata extraction

Technical Implementation

  • File format detection library
  • PDF parsing (pdf-extract or similar)
  • Markdown/HTML rendering support
  • Document chunking for large files
  • Progress indicators for parsing operations

🔮 Phase 3: RAG Integration (FUTURE)

Planned Features

  • Vector embeddings for document context
  • Context-aware answer evaluation
  • Document-based question generation
  • Semantic search within documents
  • Multi-document quiz sessions

Technical Implementation

  • Embedding model integration (OpenAI or local)
  • Vector database (Qdrant or in-memory)
  • Context retrieval algorithms
  • RAG prompt engineering
  • Performance optimization for large documents

🎯 Phase 4: Advanced Features (FUTURE)

Planned Features

  • Score tracking and progress analytics
  • Spaced repetition algorithms
  • Custom difficulty ratings
  • Session persistence and resume
  • Study streak tracking

Technical Implementation

  • SQLite or JSON-based persistence
  • Algorithm implementations (SM-2, etc.)
  • Statistics dashboard UI
  • Export/import functionality
  • Backup and sync capabilities

🎨 Phase 5: User Experience (FUTURE)

Planned Features

  • Settings screen for AI model selection
  • Progress visualization and statistics
  • Keyboard shortcut customization
  • Theme/color scheme options
  • Accessibility improvements

Technical Implementation

  • Configuration file management
  • Theme system with CSS-like styling
  • Keyboard mapping system
  • Accessibility compliance (screen reader support)
  • Performance monitoring and analytics

Architecture Principles

Current Architecture (19 Files)

  • Modular Design: Clear separation of concerns
  • Test-Driven: 127 comprehensive tests
  • Error Resilient: Graceful failure handling
  • Extensible: Easy to add new features
  • Performance Optimized: Sub-second responsiveness

Future-Proof Design

  • Public library API enables GUI/web ports
  • Plugin architecture for new file formats
  • Configurable AI model selection
  • Extensible UI component system

Success Metrics

  • Phase 1: 74 tests, zero warnings, production-ready with polished UI
  • Phase 1.5: 82 tests, async optimization, zero CPU usage, immediate AI responses
  • Phase 1.6: 118 tests, SQLite migration, Refinery migrations, crash-safe data persistence
  • Phase 1.7: 121 tests, Session History Menu with browse/resume/delete functionality
  • Phase 1.8: 127 tests, Session Assessment with AI-powered post-quiz analysis, historical comparison
  • 🚧 Phase 2: Document parsing, multi-format support
  • 🔮 Phase 3: AI context awareness, semantic evaluation
  • 🎯 Phase 4: Learning algorithm implementation
  • 🎨 Phase 5: Advanced user experience features

Database Schema

See DB.md for full documentation on:

  • Table relationships (sessionsflashcards)
  • Column definitions and data types
  • Data flow and session lifecycle
  • AIFeedback JSON schema
  • Migration management with Refinery

Getting Started

# Clone and build
git clone <repository>
cd interactive-flashcards
cargo build --release

# Run with AI evaluation
OPENROUTER_API_KEY="your-key" cargo run

# Run tests
cargo test

CSV decks live in ~/.local/share/interactive-flashcards/flashcards/ (Windows: %USERPROFILE%\.local\share\interactive-flashcards\flashcards).

Current Status: Phase 1.8 complete with Session Assessment feature, Phase 2 ready for implementation.

What's inside

5 phases with completed and planned features, 19-file architecture, 127 tests, database schema reference, and setup commands

Change this for your project

  • Replace ilcors-dev/interactive-flashcards with your own repository URL
  • Replace OPENROUTER_API_KEY="your-key" with your actual API key or provider
  • Replace ~/.local/share/interactive-flashcards/flashcards/ with your app's data directory

Where it goes

Keep alongside your test suite. Used to define and score model evaluations.

Worth borrowing

  • Separating a project into numbered phases with concrete success metrics per phase
  • Linking to a separate database schema file (DB.md) to keep the roadmap concise
  • Using a checklist format with emoji status markers (✅, 🚧, 🔮) for quick visual scanning

Related Documents