Skip to content

yethikrishna/levelcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

85 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

LevelCode - The Open-Source AI Coding Agent

The Open-Source AI Coding Agent That Outperforms Claude Code

CI Status License npm version GitHub stars GitHub forks Bun TypeScript

Features | Swarms | Tech Stack | Installation | Quick Start | SDK | Configuration | Deployment | Docs | Contributing


SEO Description: Open-source AI coding agent and CLI tool with multi-agent architecture. Supports Claude, GPT-4o, DeepSeek, Gemini, and 200+ models via OpenRouter. Outperforms Claude Code on code editing benchmarks with autonomous file editing, agent swarms, TypeScript SDK, and CI/CD integration.

What is LevelCode?

LevelCode is an open-source AI coding assistant that edits your codebase through natural language instructions. Unlike single-model tools like Claude Code, LevelCode coordinates specialized AI agents that work together to understand your project architecture, plan changes, make precise edits, and validate results — delivering higher accuracy and fewer errors.

LevelCode Demo

Benchmark Results

LevelCode beats Claude Code at 61% vs 53% on our evaluations across 175+ coding tasks over multiple open-source repos that simulate real-world tasks.

Agent Success Rate Token Efficiency Speed
LevelCode 61% 45k avg 32s avg
Claude Code 53% 62k avg 45s avg
Aider 48% 38k avg 28s avg
Continue 42% 51k avg 38s avg

Features

Multi-Agent Architecture

When you ask LevelCode to "add authentication to my API," it coordinates a team of specialized agents:

  1. File Picker Agent - Scans your codebase to understand the architecture and find relevant files
  2. Planner Agent - Plans which files need changes and in what order
  3. Editor Agent - Makes precise, contextual edits across multiple files
  4. Reviewer Agent - Validates changes before applying, catching errors early
LevelCode Multi-Agents

This multi-agent approach delivers:

  • Better context understanding across large codebases
  • More accurate, architectural-aware edits
  • Fewer errors and hallucinations compared to single-model tools
  • Automatic validation before changes are applied

Use Any Model via OpenRouter

Unlike Claude Code which locks you into Anthropic's models, LevelCode supports any model on OpenRouter — 200+ models total:

  • Claude (Opus 4, Sonnet 4, Haiku 3.5)
  • GPT-4o, GPT-4 Turbo, o1-preview
  • DeepSeek (V3, DeepSeek-Coder V2)
  • Qwen (Qwen-Coder, Qwen 2.5)
  • Gemini (Gemini 2.5 Pro, Flash)
  • Llama 3.3, Llama 3.1, Mistral Large
  • And 200+ more models from OpenRouter...

TypeScript SDK

Build LevelCode into your own applications, IDE extensions, and CI/CD pipelines with our production-ready TypeScript SDK:

import { LevelCodeClient } from '@levelcode/sdk';

const client = new LevelCodeClient({
  apiKey: process.env.OPENROUTER_API_KEY, // or ANTHROPIC_API_KEY
  cwd: '/path/to/project',
});

const result = await client.run({
  agent: 'base',
  prompt: 'Add error handling to all API endpoints',
  handleEvent: (event) => console.log(event),
});

Custom Agent Workflows

Create your own specialized agents with TypeScript generators — extend LevelCode with custom tools, model selections, and multi-step reasoning:

export default {
  id: 'git-committer',
  displayName: 'Git Committer',
  model: 'openai/gpt-4o',
  toolNames: ['read_files', 'run_terminal_command', 'end_turn'],

  instructionsPrompt:
    'Create meaningful git commits by analyzing changes and crafting clear commit messages.',

  async *handleSteps() {
    yield { tool: 'run_terminal_command', command: 'git diff' };
    yield { tool: 'run_terminal_command', command: 'git log --oneline -5' };
    yield 'STEP_ALL';
  },
};

Agent Swarms

Scale beyond a single agent. LevelCode's Agent Swarm system lets you spin up an entire coordinated development team that works together on complex tasks — each agent with a specialized role, communicating through a structured message protocol.

# Enable swarms
levelcode
> /team:enable

# Create a team with a project brief
> /team:create name="auth-team" brief="Build OAuth2 login with Google and GitHub providers"

# Monitor your swarm in real time
> /team:status

The swarm system automatically assigns agents to the right development phase and coordinates handoffs between them:

Capability Details
24 Specialized Roles From intern to CTO — each with calibrated autonomy, tools, and review requirements
6 Development Phases Requirements, Design, Implementation, Testing, Review, Deployment — with automatic phase gating
Real-Time TUI Panel Live terminal dashboard showing agent status, messages, tasks, and phase progress
Structured Messaging Agents communicate via a typed protocol with inbox polling and message routing
Task Assignment Hierarchical task breakdown with dependency tracking and automatic delegation
File Locking Prevents merge conflicts when multiple agents edit the same files concurrently

See the full Agent Swarms Guide for configuration, role definitions, custom team templates, and advanced workflows.


Tech Stack

Layer Technology
Language TypeScript 5.0+
Runtime Bun 1.3.5+ (also supports Node.js 18+)
Package Manager Bun workspaces (monorepo)
AI Providers OpenRouter, Anthropic (direct), OpenAI (direct)
Supported Models Claude Opus/Sonnet/Haiku, GPT-4o/o1, DeepSeek V3/Coder, Qwen, Gemini, Llama 3.3, Mistral, 200+ total
CLI Framework Custom TUI with Ink/React
Web Dashboard Next.js (optional, in web/)
Database SQLite (local), PostgreSQL (server mode)
SDK TypeScript SDK (@levelcode/sdk)
Testing Bun test runner
CI/CD GitHub Actions

Installation

CLI Installation

# Using npm (recommended)
npm install -g @levelcode/cli

# Using npx (no install needed)
npx @levelcode/cli

# Using bun
bun install -g @levelcode/cli

SDK Installation

# Using npm
npm install @levelcode/sdk

# Using bun
bun add @levelcode/sdk

From Source

# Clone the repository
git clone https://github.com/yethikrishna/levelcode.git
cd levelcode

# Install dependencies
bun install

# Run in development mode
bun dev

System Requirements

  • Node.js 18+ or Bun 1.3.5+
  • Git (optional, for version control features)
  • Terminal with ANSI color support
  • Works on macOS, Linux, and Windows (WSL2 recommended)

Quick Start

LevelCode works fully standalone — no backend server, no account, no login required. Just set your API key and start coding.

1. Set Your API Key

Choose one of the following:

# Option A: OpenRouter (200+ models including Claude, GPT, Gemini, DeepSeek, etc.)
export OPENROUTER_API_KEY="sk-or-v1-..."

# Option B: Anthropic (Claude models directly)
export ANTHROPIC_API_KEY="sk-ant-..."

Get your key from OpenRouter or Anthropic.

2. Run LevelCode

# Navigate to your project
cd your-project

# Start LevelCode
levelcode

That's it. No sign-up, no backend, no configuration needed.

3. Start Coding with AI

Just tell LevelCode what you want in natural language:

  • "Fix the SQL injection vulnerability in user registration"
  • "Add rate limiting to all API endpoints"
  • "Refactor the database connection code for better performance"
  • "Add unit tests for the authentication module"
  • "Migrate this REST API to GraphQL"
  • "Add TypeScript types to all JavaScript files"

LevelCode will find the right files, make changes across your codebase, and validate everything works.

CLI Options

# Use FREE mode (lightweight, lower cost models)
levelcode --free

# Use MAX mode (most capable models)
levelcode --max

# Run in a specific directory
levelcode --cwd /path/to/project

# Continue a previous conversation
levelcode --continue

# Show all options
levelcode --help

SDK Usage

Basic Usage

import { LevelCodeClient } from '@levelcode/sdk';

// Works standalone — just provide your API key
const client = new LevelCodeClient({
  apiKey: process.env.OPENROUTER_API_KEY, // or ANTHROPIC_API_KEY
  cwd: process.cwd(),
});

// Run a coding task
const result = await client.run({
  agent: 'base',
  prompt: 'Add TypeScript types to all function parameters',
  handleEvent: (event) => {
    if (event.type === 'file_edit') {
      console.log(`Edited: ${event.filePath}`);
    }
  },
});

console.log('Output:', result.output);

Custom Agents

import { LevelCodeClient, AgentDefinition } from '@levelcode/sdk';

const codeReviewer: AgentDefinition = {
  id: 'code-reviewer',
  displayName: 'Code Reviewer',
  model: 'anthropic/claude-3-opus',
  toolNames: ['read_files', 'grep', 'end_turn'],
  instructionsPrompt: `You are a senior code reviewer.
    Focus on security, performance, and maintainability.
    Provide actionable feedback with code examples.`,
};

const client = new LevelCodeClient({ apiKey: '...' });

const review = await client.run({
  agent: 'code-reviewer',
  agentDefinitions: [codeReviewer],
  prompt: 'Review the recent changes in src/auth/',
  handleEvent: console.log,
});

CI/CD Integration

# .github/workflows/levelcode-review.yml
name: AI Code Review

on: [pull_request]

jobs:
  review:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Setup Bun
        uses: oven-sh/setup-bun@v1

      - name: Install LevelCode
        run: bun install -g @levelcode/cli

      - name: Run AI Review
        env:
          OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
        run: levelcode "Review changes and suggest improvements" --output review.md

      - name: Post Review
        uses: actions/github-script@v7
        with:
          script: |
            const review = require('fs').readFileSync('review.md', 'utf8');
            github.rest.issues.createComment({
              issue_number: context.issue.number,
              owner: context.repo.owner,
              repo: context.repo.repo,
              body: review
            });

Project Structure

levelcode/
├── cli/                 # Terminal UI application
│   ├── src/            # CLI source code (TUI, commands, REPL)
│   ├── bin/            # CLI binaries
│   └── scripts/        # Build scripts
├── sdk/                 # TypeScript SDK for embedding
│   ├── src/            # SDK source code
│   └── e2e/            # End-to-end tests
├── agents/              # Multi-agent system definitions
│   ├── base2/          # Base agent configurations
│   ├── editor/         # Code editing agents
│   ├── file-explorer/  # File discovery agents
│   ├── researcher/     # Documentation research agents
│   ├── reviewer/       # Code review agents
│   └── thinker/        # Planning/reasoning agents
├── common/             # Shared utilities and types
├── packages/           # Internal packages
│   ├── agent-runtime/  # Agent execution runtime engine
│   └── internal/       # Internal utilities, DB, services
├── web/                # Optional web dashboard (Next.js)
├── evals/              # Evaluation benchmarks (175+ tasks)
├── scripts/            # Build and utility scripts
├── docs/               # Documentation
└── test/               # Integration tests

Configuration

Create a levelcode.config.ts in your project root:

import { defineConfig } from '@levelcode/sdk';

export default defineConfig({
  // Default model
  model: 'anthropic/claude-3.5-sonnet',

  // Per-agent model overrides
  agents: {
    editor: {
      model: 'anthropic/claude-3-opus',
      maxTokens: 8000,
    },
    filePicker: {
      model: 'anthropic/claude-3-haiku',
    },
  },

  // Files to ignore
  ignore: [
    'node_modules/**',
    '*.lock',
    'dist/**',
    '.git/**',
    'build/**',
    '.next/**',
  ],

  // Custom tools (optional)
  tools: [],
});

Environment Variables

Variable Description Required Default
OPENROUTER_API_KEY OpenRouter API key (200+ models) One required
ANTHROPIC_API_KEY Anthropic API key (Claude direct) One required
LEVELCODE_MODEL Default model identifier No Agent default
LEVELCODE_DEBUG Enable debug logging (verbose output) No false
LEVELCODE_CONFIG Path to config file No ./levelcode.config.ts

Standalone Mode: LevelCode runs fully standalone by default. No backend server, database, or account is needed. Just set one API key above and you're ready to go.

Hosted Mode: For team features, billing, and the agent marketplace, visit levelcode.ai.


Deployment

CLI Distribution

LevelCode CLI is distributed via npm:

npm install -g @levelcode/cli

Self-Hosted Server Mode (Coming Soon)

  • Docker deployment for team/server mode
  • WebSocket-based collaborative editing
  • Centralized agent marketplace
  • Team analytics and usage dashboards

IDE Extensions (Roadmap)

  • VS Code Extension (in development)
  • JetBrains Plugin (planned)
  • Vim/Neovim plugin (planned)

Documentation

Document Description
Installation Guide Detailed installation instructions for all platforms
Configuration All configuration options and per-agent settings
SDK Reference Complete SDK API documentation with examples
Custom Agents Creating custom agents with tools and workflows
Custom Tools Building custom tools for LevelCode agents
Agent Swarms Multi-agent team coordination and swarm workflows
Architecture How LevelCode works internally
Contributing Guide How to contribute to LevelCode
Changelog Release notes and version history
Security Policy Security reporting and best practices
Roadmap Upcoming features and milestones

Contributing

We love contributions from the community! Whether you're fixing bugs, creating agents, or improving docs.

Development Setup

# Clone the repo
git clone https://github.com/yethikrishna/levelcode.git
cd levelcode

# Install dependencies
bun install

# Run in development mode
bun dev

# Run tests
bun test

# Type check
bun typecheck

# Start databases (for web dashboard)
bun start-db

# Start web dashboard
bun start-web

Ways to Contribute

  • Bug Fixes — Help us squash bugs and improve stability
  • New Agents — Create specialized agents for specific tasks/languages
  • Model Support — Add new model provider integrations
  • Documentation — Improve guides, examples, and API docs
  • Benchmarks — Add new evaluation tasks to improve testing
  • SDK Improvements — Enhance the TypeScript SDK with new features
  • Tools — Build new tools that agents can use (terminal, browser, etc.)

See CONTRIBUTING.md for detailed guidelines.


Roadmap

  • Standalone Mode (no backend required)
  • Direct OpenRouter/Anthropic API support
  • Multi-agent architecture (File Picker, Planner, Editor, Reviewer)
  • Agent Swarms with 24 specialized roles
  • TypeScript SDK for programmatic access
  • CLI with rich TUI interface
  • CI/CD integration (GitHub Actions)
  • VS Code Extension
  • JetBrains Plugin
  • Web Interface (beta in web/)
  • Team Collaboration Features
  • Self-Hosted Server Mode
  • Plugin/Agent Marketplace
  • Vim/Neovim Plugin
  • Browser automation tools

Comparison with Other Tools

Feature LevelCode Claude Code Aider Continue Cursor
Open Source ✅ Apache 2.0 ❌ Closed ✅ Apache 2.0 ✅ Apache 2.0 ❌ Closed
Multi-Agent ✅ 4+ agents + swarms ❌ Single ❌ Single ❌ Single ❌ Single
Model Choice ✅ 200+ models ❌ Claude only ✅ Multiple ✅ Multiple ✅ Multiple
Standalone ✅ No backend ❌ Requires Claude ✅ Yes ✅ VS Code only ❌ IDE only
SDK ✅ TypeScript ❌ No ❌ Limited ❌ No ❌ No
Agent Swarms ✅ 24 roles ❌ No ❌ No ❌ No ❌ No
Free/Open ✅ MIT/Apache ❌ Paid ✅ Free ✅ Free ❌ Paid

Support


License

LevelCode is open-source software licensed under the Apache License 2.0.


Acknowledgments


Created by Yethikrishna R

If you find LevelCode useful, please consider giving it a star! It helps other developers discover the project.

Star on GitHub


About

Levelcode — Open-source AI coding agent with multi-agent architecture for precise codebase editing. CLI + web UI + eval harness, built with TypeScript and Bun.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

Sponsor this project

Packages

Contributors

Languages