GitHub - Jacques2Marais/vibecc: Compiler that transforms natural language specs (.vibe files) into optimized C binaries using LLMs

3 min read Original article ↗

vibecc - Vibe-Oriented Programming Compiler

A compiler that turns high-level specifications in .vibe files into efficient, safe C code using an LLM, then compiles to standalone binaries.

Quick Start

# Build vibecc
go build -o vibecc ./cmd/vibecc

# Initialize a VOP project
./vibecc init

# Set your API key (OpenAI example)
export OPENAI_API_KEY=your-key

# Create a .vibe file
echo "Create a program that prints Hello World" > hello.vibe

# Compile
./vibecc hello.vibe

Installation

# Clone and build
git clone https://github.com/vibecc/vibecc
cd vibecc
go build -o vibecc ./cmd/vibecc

# Optional: install globally
sudo mv vibecc /usr/local/bin/

Usage

vibecc [flags] <path>

# Compile all .vibe files in current directory
vibecc .

# Compile a single file
vibecc myapp.vibe

# Skip code inspection
vibecc --no-inspect .

# Clean and rebuild
vibecc --clean .

# Use specific LLM provider
vibecc --provider anthropic --model claude-sonnet-4-20250514 .

Configuration

LLM Providers

Supported providers:

  • OpenAI: gpt-5.1, gpt-5.1-codex, gpt-5, gpt-4o (default), o3, o4-mini
  • Anthropic: claude-opus-4-5-20251101, claude-sonnet-4-5-20250929 (default), claude-haiku-4-5-20251022
  • Google Gemini: gemini-3-pro-preview, gemini-2.5-flash (default), gemini-2.5-pro
  • Cerebras (ultra-fast): llama-3.3-70b (default), qwen-3-32b, gpt-oss-120b, zai-glm-4.6
  • Ollama (local): llama4:scout (default), llama4:maverick, qwen3:30b, gemma3, mistral-large-3

API Keys

Set via environment variables (never in config files):

# Generic key (works for any provider)
export VIBECC_API_KEY=your-key

# Provider-specific keys
export OPENAI_API_KEY=sk-...
export ANTHROPIC_API_KEY=sk-ant-...
export GEMINI_API_KEY=...
export CEREBRAS_API_KEY=...

Config Files

Configuration is layered (later overrides earlier):

  1. Built-in defaults
  2. Global config: ~/.vibecc/config.json
  3. Project config: .vibe/config.json
  4. Environment variables
  5. CLI flags

Example .vibe/config.json:

{
  "llm": {
    "provider": "anthropic",
    "model": "claude-sonnet-4-20250514"
  }
}

How It Works

  1. Discovery: Find all .vibe files in the project
  2. Validation: LLM checks specs for errors/warnings
  3. Generation: LLM generates C code from specifications
  4. Inspection: User reviews generated code (skip with --no-inspect)
  5. Safety Check: LLM audits code for memory safety, undefined behavior
  6. Compilation: Compile C to binary with gcc/clang
  7. Testing: LLM generates tests, runs them, fixes failures automatically

Project Structure

my-project/
├── *.vibe              # Your specification files
├── .vibe/              # VOP internal state
│   ├── config.json     # Project configuration
│   ├── state.json      # Compilation state
│   ├── history/        # Previous .vibe versions (for diffs)
│   └── diffs/          # Computed diffs
├── .generated/         # LLM-generated C code
│   ├── main.c
│   └── ...
└── bin/                # Compiled binaries

Writing .vibe Files

.vibe files are flexible - use natural language, pseudocode, or structured specs:

# Calculator

Create a command-line calculator that:
1. Takes two numbers and an operator as arguments
2. Supports +, -, *, /
3. Handles division by zero gracefully
4. Prints the result

Example: ./calc 5 + 3 -> 8

Examples

See the examples/ directory for sample .vibe files.

License

MIT