Skip to content

CodeAI Code Assistant

30x faster • Zero-overhead tRPC • Real-time streaming • Multi-client sync

Code

The Problem

Traditional AI assistants are slow and network-bound:

typescript
// Traditional AI assistants
Client → HTTP (3ms) → JSON Serialization → Server → Logic
// Slow, network-bound, single-client

The Solution

Code uses in-process communication for zero overhead:

typescript
// Code
Client → Direct Function Call (0.1ms) → Server
// 30x faster, zero serialization, multi-client ready

Performance Comparison

OperationHTTP (localhost)In-ProcessImprovement
Simple query~3ms~0.1ms30x faster
Streaming start~5ms~0.2ms25x faster
Tool execution~4ms~0.15ms27x faster

Quick Start

bash
# Clone repository
git clone https://github.com/SylphxAI/code.git
cd code

# Install dependencies
bun install

# Build core packages
bun run build

# Run Terminal UI
bun dev:code

# Run Web UI (in another terminal)
bun dev:web

Architecture Highlights

Stack Overview

┌─────────────────────────────────────────────────────┐
│  🖥️  Terminal UI      🌐  Web UI                   │  React (Ink/Next.js)
├─────────────────────────────────────────────────────┤
│  @sylphx/code-client                                │  Pure UI Client
│  - Event-driven sync (33 tests ✅)                 │  - Zero business logic
│  - Zustand stores                                   │  - Optimistic updates
│  - tRPC in-process link                             │  - Multi-client ready
├─────────────────────────────────────────────────────┤
│  @sylphx/code-server                                │  Business Logic
│  - tRPC v11 server                                  │  - Daemon-ready
│  - Subscription streaming                           │  - Multi-session
│  - Server-side decisions                            │  - AppContext
├─────────────────────────────────────────────────────┤
│  @sylphx/code-core                                  │  Headless SDK
│  - AI providers                                     │  - 10+ tools
│  - Session persistence                              │  - Agent system
│  - Tool execution                                   │  - libSQL database
└─────────────────────────────────────────────────────┘

Key Design Principles

1. Pure UI Client + Daemon Server

  • Client handles UI state only (currentSessionId, isStreaming)
  • Server contains all business logic and can run independently
  • Optimistic updates for instant feedback
  • Event-driven communication with zero circular dependencies

2. Zero-Overhead Communication

  • Direct function calls via tRPC v11
  • No JSON serialization overhead
  • No network latency
  • Pure TypeScript end-to-end type safety

3. Multi-Client Synchronization

All clients synchronized via server events:

TUI Client 1 ←──┐
TUI Client 2 ←──┼── Server SSE Events
Web Client   ←──┘

Build Performance

Built with Bun for blazing-fast builds:

PackageLines of CodeBuild Time
code-core~8,00075ms
code-server~2,00023ms
code (TUI)~6,00039ms

Architecture Quality (v0.1.0)

MetricBeforeAfterImprovement
Separation of Concerns3/109/10+200%
Decoupling4/1010/10+150%
Testability2/109/10+350%
Multi-Client Ready5/1010/10+100%

Overall: 4.4/10 → 9.6/10 (+118%)

Support

License

MIT © Sylphx


30x faster. Zero overhead. Built for developers.
The AI code assistant that actually understands performance

Released under the MIT License.