Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Revised Roadmap: TUI + WASM Architecture

Overview

The revised roadmap reflects the shift to a TUI-first, dual-target architecture (native terminal + WASM web) while maintaining the security-focused core.

Architecture Phases

┌────────────────────────────────────────────────────────────────────┐
│                        ARCHITECTURE EVOLUTION                       │
├────────────────────────────────────────────────────────────────────┤
│                                                                    │
│   Phase 1          Phase 2           Phase 3          Phase 4      │
│   (Months 1-3)     (Months 3-5)      (Months 5-7)     (Month 8+)   │
│                                                                    │
│   ┌─────────┐      ┌─────────┐       ┌─────────┐      ┌─────────┐  │
│   │   Core  │ ────>│   Core  │──────>│   Core  │─────>│   Core  │  │
│   │ + TUI   │      │ + Web   │       │ Security│      │Plugins  │  │
│   └─────────┘      └─────────┘       └─────────┘      └─────────┘  │
│        │                │                 │                │       │
│        ▼                ▼                 ▼                ▼       │
│   Terminal-only    Terminal + Web    Production      Ecosystem    │
│   Prototype        Demo              Ready             Ready       │
│                                                                    │
└────────────────────────────────────────────────────────────────────┘

Phase 1: Core + Native TUI (Months 1-3)

Goal

Working terminal application with basic LLM interaction

Month 1: Foundation

Week 1-2: Project Setup

  • Initialize workspace with 4 crates:
    • harness-core - Shared business logic
    • harness-tui - Native terminal app
    • harness-cli - Command-line interface
    • harness-web - WASM web app (stub)
  • Set up CI/CD for native builds
  • Configure cross-compilation targets
  • Add tracing/logging infrastructure
  • Create development environment scripts

Week 3-4: Core Types

  • Define conversation models
  • Implement message types (text, tool calls)
  • Create LLM provider trait
  • Add configuration system
  • Implement conversation persistence (SQLite)

Deliverables:

  • Workspace compiles
  • Core types documented and tested
  • SQLite schema defined

Month 2: TUI Implementation

Week 5-6: Basic UI

  • Set up ratatui with crossterm backend
  • Create main app loop
  • Implement conversation list sidebar
  • Build message view with scrolling
  • Add input area with multiline support

Week 7-8: Interaction

  • Keyboard navigation (vim bindings)
  • Command palette (: commands)
  • Conversation creation/deletion
  • Message rendering (markdown)
  • Basic syntax highlighting

Deliverables:

  • Interactive TUI functional
  • Can create conversations
  • Basic keyboard navigation

Month 3: LLM Integration

Week 9-10: OpenAI Provider

  • Implement HTTP client abstraction
  • OpenAI API integration
  • Streaming response handling
  • Error handling and retries
  • Conversation context management

Week 11-12: Polish

  • Configuration file support
  • API key management (secure storage)
  • Conversation import/export
  • Basic search functionality
  • README and usage docs

Deliverables:

  • Can chat with GPT-4 via TUI
  • Configuration management
  • Alpha release (terminal only)

Phase 2: WASM Web Deployment (Months 3-5)

Goal

Same application running in browser via WebAssembly

Month 4: Web Foundation

Week 13-14: WASM Setup

  • Configure trunk for WASM builds
  • Add ratzilla backend
  • Set up conditional compilation for core
  • Create web-specific storage (LocalStorage)
  • Implement web HTTP client (fetch-based)

Week 15-16: Web UI

  • Adapt TUI widgets for web rendering
  • Handle browser events (keyboard, resize)
  • Add web-specific features:
    • URL routing (conversation IDs)
    • Browser history integration
    • Download conversations
  • Responsive layout adjustments

Deliverables:

  • WASM build compiles
  • Runs in browser with TUI aesthetic

Month 5: Cross-Platform Polish

Week 17-18: Data Sync

  • Export/import format (JSON)
  • Git-based sync option
  • Conversation backup/restore
  • Cross-device workflow documentation

Week 19-20: Tool System v1

  • Define tool schema
  • Implement tool registry
  • Add example tools:
    • Read file
    • Execute command (native only)
    • Search web
  • Tool result rendering

Deliverables:

  • Native and web versions feature-parity
  • Tool system functional
  • Beta release (both platforms)

Phase 3: Security Hardening (Months 5-7)

Goal

Production-ready security for code execution

Month 6: Sandboxing

Week 21-22: WASM Sandbox

  • Integrate wasmtime for tool execution
  • Define WASI capabilities
  • Implement tool isolation
  • Resource limits (CPU, memory)

Week 23-24: Container Sandbox

  • gVisor integration for complex tools
  • Docker/gVisor runtime setup
  • Network egress filtering
  • Filesystem restrictions

Deliverables:

  • Tools run in sandboxed environment
  • Resource limits enforced

Month 7: Security Features

Week 25-26: Audit System

  • Comprehensive audit logging
  • Tamper-evident log storage
  • Operation tracing
  • Security event alerts

Week 27-28: Access Control

  • API key authentication
  • Permission system
  • Rate limiting
  • Abuse prevention

Deliverables:

  • Security audit passes
  • Production security checklist complete

Phase 4: Ecosystem (Month 8+)

Goal

Extensible platform with plugin support

Month 8+: Advanced Features

  • Plugin System: WASM-based tool plugins
  • Multi-Provider: Claude, local models, etc.
  • Collaboration: Shared conversations
  • Zellij Plugin: Optional integration
  • Server Mode: API for remote access
  • Mobile: PWA for mobile browsers

Technology Timeline

MonthNative TUIWeb WASMSecurityFeatures
1Core + SQLite--Types, config
2Ratatui UI--Chat, navigation
3OpenAI--Streaming
4PolishRatzilla-Browser UI
5ToolsSync-Tool system
6--WASMtimeSandboxing
7--gVisor, auditProduction
8+PluginsPWAHardeningEcosystem

Workspace Evolution

Month 1-3: Foundation

crates/
├── harness-core/      # Business logic
├── harness-tui/       # Terminal app
└── harness-cli/       # CLI

Month 4-5: Web Addition

crates/
├── harness-core/      # Business logic (now with wasm cfg)
├── harness-tui/       # Terminal app
├── harness-web/       # WASM web app ★ new
└── harness-cli/       # CLI

Month 6-8: Security & Plugins

crates/
├── harness-core/      # Business logic
├── harness-tui/       # Terminal app
├── harness-web/       # WASM web app
├── harness-cli/       # CLI
├── harness-sandbox/   # Sandboxing implementations ★ new
└── harness-plugin/    # Plugin SDK ★ new

Success Metrics by Phase

Phase 1 (Month 3)

  • TUI works on Linux/macOS
  • Can have multi-turn conversation
  • Conversations persist
  • < 1 second startup time

Phase 2 (Month 5)

  • Web version runs in Chrome/Firefox
  • Feature parity with native
  • Tools can read files
  • Export/import works

Phase 3 (Month 7)

  • Tools run in sandbox
  • Complete audit trail
  • Passes security review
  • No critical vulnerabilities

Phase 4 (Month 8+)

  • 5+ community plugins
  • 100+ GitHub stars
  • Documentation complete
  • Stable release

Risk Mitigation

RiskPhaseMitigation
WASM compilation issues2Start with simple examples, test early
Ratatui/web feature gaps2Maintain feature flags, graceful degradation
Sandbox performance3Benchmark early, optimize hot paths
Storage sync complexity2Start with file-based, add cloud later
Scope creepAllStrict milestone definitions, monthly reviews

Comparison with Original Plan

Original (API-first)

  • REST API with Axum
  • Web frontend (React/Vue)
  • TUI as secondary client
  • Server required

Revised (TUI-first)

  • Native TUI with ratatui
  • WASM web via ratzilla
  • Shared core logic
  • Works offline (local models)
  • Optional server later

Advantages of Revised Approach

  1. Simpler deployment: No server to run for personal use
  2. Better UX: TUI-first feels more natural for developers
  3. Code reuse: Same UI code for terminal and web
  4. Offline capable: Can work without internet (local LLMs)
  5. Lower latency: No HTTP overhead for local usage

Trade-offs

  1. Web features: No real-time collaboration (initially)
  2. Multi-user: Requires server mode (future feature)
  3. Mobile: Browser-based only (no native app)

Conclusion

The revised roadmap prioritizes:

  1. Terminal experience: Where developers spend most time
  2. Web accessibility: Via WASM, not separate codebase
  3. Security: Sandboxed execution from the start
  4. Gradual complexity: Start simple, add features incrementally

This approach aligns with the philosophy of tools like opencode, lazygit, and k9s—terminal-native first, with web as a convenient alternative when needed.