Skip to content

TheOmran/EvenCode

Repository files navigation

EvenCode

AI-powered coding assistant for Even Realities G2 smart glasses. Voice-driven conversations with Claude Code, displayed on the G2's monochrome display.

Talk to your codebase hands-free -- speak through the G2 glasses, get responses from Claude Code, scroll through results, answer interactive questions, all without touching a keyboard.

EvenCode on G2 glasses

How It Works

[G2 Glasses] <--BLE--> [iPhone Even App] <--HTTPS--> [Backend Server (Mac/Pi)]
                         (WebView app)                 (Express + Claude Agent SDK)
  1. You speak into the G2 glasses
  2. Audio is sent to the backend server over HTTPS (via Cloudflare tunnel)
  3. Server transcribes speech locally with whisper.cpp (zero API cost)
  4. Transcribed text goes to a Claude Code agent session via the Agent SDK
  5. Responses stream back to the glasses display
  6. Each conversation runs in an isolated git worktree

Architecture

packages/
  server/         # CLI + Express backend (SQLite, BullMQ, Claude Agent SDK, Whisper)
  glasses-app/    # G2 web app (Vite, Even Hub SDK)
  shared/         # Types and constants shared between server and app

Prerequisites

  • Node.js >= 20
  • pnpm (package manager)
  • Redis (job queue backend)
  • Claude Code CLI installed and authenticated (~/.claude/.credentials.json)
  • cloudflared (optional, for public tunnel access)
  • Git (worktree management)

Platform Support

Platform Whisper Model Notes
macOS base.en Recommended for development
Raspberry Pi 5 tiny.en ~11s transcription for short clips

Installation

From Source

git clone https://github.com/your-org/EvenCode.git
cd EvenCode
pnpm install
pnpm build

Global CLI Install

pnpm build:cli
npm install -g ./packages/server

This makes the evencode command available globally.

Quick Setup

Run the interactive setup to check prerequisites and download the Whisper model:

evencode setup

Or use the shell script for a full automated setup (installs Redis, cloudflared, etc.):

bash scripts/setup.sh

Configuration

Copy the example env file and edit it:

cp .env.example .env
Variable Default Description
PORT 3456 Server port
HOST 0.0.0.0 Bind address
REPO_PATH Current directory Git repo for Claude to work on
WORKTREE_BASE ~/.evencode/worktrees Where git worktrees are created
DB_PATH ~/.evencode/data.db SQLite database path
REDIS_URL redis://127.0.0.1:6379 Redis connection URL
AUTH_TOKEN Auto-generated Bearer token for API auth
WHISPER_MODEL base.en Whisper model (tiny.en for Pi)
MAX_CONCURRENT_JOBS 2 Parallel job queue workers
AUDIO_TMP_DIR /tmp/glasses-audio Temp directory for audio files
CLAUDE_MODEL Claude default Override Claude model (see below)

Usage

Start the Server

evencode start --workspace /path/to/your/repo

The server will:

  1. Initialize the database and connect to Redis
  2. Prune orphaned git worktrees from previous runs
  3. Prompt to start a Cloudflare tunnel (if cloudflared is installed)
  4. Display a QR code to connect your glasses

CLI Options

evencode start [options]
  -w, --workspace <path>   Override working directory (git repo)
  -m, --model <model>      Claude model to use

evencode setup             Check prerequisites and download Whisper model
evencode status            Show active conversations

Choosing a Claude Model

Override the default Claude model with --model:

# Use Sonnet for faster, cheaper responses
evencode start -w /path/to/repo --model claude-sonnet-4-6

# Use Opus for maximum capability
evencode start -w /path/to/repo --model claude-opus-4-6

# Use Haiku for speed on constrained hardware
evencode start -w /path/to/repo --model claude-haiku-4-5-20251001

You can also set this via the CLAUDE_MODEL environment variable in .env.

Development

Run the server and glasses app in dev mode (two terminals):

# Terminal 1: Backend server
pnpm dev:server -- start --workspace /path/to/repo

# Terminal 2: Glasses app (Vite dev server)
pnpm dev:app

Test the glasses app in the Even Realities simulator:

npx @evenrealities/evenhub-simulator@latest http://127.0.0.1:5173

API Overview

All endpoints require Authorization: Bearer <token> (except /health).

Method Endpoint Description
GET /health Health check
GET /auth/verify Verify auth token
GET /system/qr Connection QR code
POST /conversations Create new conversation (+ git worktree)
GET /conversations List conversations
GET /conversations/:id Get conversation details
DELETE /conversations/:id Archive and remove worktree
GET /conversations/:id/messages?since= Poll for messages
POST /conversations/:id/messages Send text message
POST /conversations/:id/audio Send audio (base64 PCM)
GET /jobs/:id Job status
POST /jobs/:id/retry Retry failed job

Contributing

  1. Fork the repo and create a feature branch
  2. Install dependencies: pnpm install
  3. Run in dev mode (see Development section above)
  4. Test against the Even Realities simulator before real hardware
  5. Submit a pull request

Project Structure Notes

  • Monorepo managed with pnpm workspaces
  • TypeScript strict mode across all packages
  • Shared types live in packages/shared -- import from @evencode/shared
  • The glasses app is vanilla TypeScript (no framework) due to the constrained G2 display SDK
  • The server bundles the built glasses app into glasses-app-dist/ for production serving

Key Patterns

  • Job queue: All audio transcription and Claude queries run through BullMQ for reliability and retry
  • Git worktrees: Each conversation gets an isolated branch (glasses/<id>) so Claude can make changes without conflicts
  • Render lock: The glasses display SDK requires serialized calls -- the renderer enforces this
  • Polling: The glasses app polls the server (3s active, 5s home) since the G2 WebView doesn't support WebSockets

Acknowledgments

  • cc-g2 -- Event handling patterns, bridge initialization, display pagination, and SDK quirk workarounds in the glasses app were ported from this project
  • whisper.cpp by Georgi Gerganov -- Local speech-to-text engine
  • whisper-node -- Node.js bindings for whisper.cpp
  • Claude Code Agent SDK by Anthropic -- Powers the AI coding sessions
  • Even Realities -- G2 glasses and Even Hub SDK
  • Cloudflare -- Quick tunnel for exposing the local server

License

Proprietary. All rights reserved.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages