Skip to content

Repository files navigation

Forge Code

A browser-based agentic coding assistant with a multi-model architecture.

┌─────────────────────────────────────────────────────────────┐
│                    Browser (React Router v7)                │
├─────────────────────────────────────────────────────────────┤
│  MessageStream │ ToolViewer │ DiffViewer │ ContextTracker   │
└───────────────────────────┬─────────────────────────────────┘
                            │ WebSocket
┌───────────────────────────┴─────────────────────────────────┐
│                    Bun Server                               │
├─────────────────────────────────────────────────────────────┤
│  AgentLoop     │ ToolExecutor │ ModelRouter │ WSHandler     │
└───────────────────────────┬─────────────────────────────────┘
                            │
┌───────────────────────────┴─────────────────────────────────┐
│  Anthropic API              │         Google AI API         │
│  ├─ claude-sonnet-4.5       │         ├─ gemini-flash-lite  │
│  └─ claude-opus-4.5         │         └─ gemini-3-pro       │
└─────────────────────────────────────────────────────────────┘

Features

  • Autonomous agent loop with file and bash tools
  • Real-time streaming over WebSocket
  • Multi-model strategy: cheap scanning, smart generation, SOTA verification
  • Session persistence with SQLite
  • Tool call visualization with syntax highlighting

Quick Start

# Install dependencies
bun install

# Copy environment config
cp .env.example .env
# Edit .env with your API keys

# Run migrations
bun run db:push

# Start both frontend and backend
bun run dev:all

Frontend: http://localhost:5173 WebSocket: ws://localhost:3001

Commands

bun run dev       # React Router dev server
bun run server    # Bun WebSocket server
bun run dev:all   # Both concurrently
bun run build     # Production build
bun run typecheck # Type checking

# Database
bun run db:generate  # Generate migrations
bun run db:migrate   # Run migrations
bun run db:push      # Push schema changes
bun run db:studio    # Drizzle Studio

Environment

ANTHROPIC_API_KEY=   # Required for Claude models
GOOGLE_AI_API_KEY=   # Required for Gemini models
WS_PORT=3001         # WebSocket server port

Architecture

Frontend (app/)

  • Routes: app/routes.ts — React Router v7 route config
  • Components: app/components/ — MessageStream, ToolCallView, InputBar, etc.
  • Hooks: app/hooks/ — useWebSocket, useClaudeSession
  • State: app/stores/sessionStore.ts — Zustand with localStorage

Backend (server/)

  • Entry: server/index.ts — Bun.serve WebSocket handler
  • Agent Loop: server/agent/agent-loop.ts — Think → Act → Observe cycle
  • Tools: server/tools/ — bash, read_file, write_file, edit_file, glob, grep
  • Providers: server/providers/ — Anthropic and Gemini API clients
  • Database: server/db/ — SQLite via Drizzle ORM

Tools

Tool Description
bash Execute shell commands
read_file Read file contents
write_file Create or overwrite file
edit_file Replace text in file
glob Find files by pattern
grep Search file contents
list_dir List directory contents

License

Proprietary

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages