"All is for the best in this best of all possible worlds" - Voltaire
Pangloss is a parallel LLM code generation system that runs multiple AI CLI agents simultaneously to generate code, then intelligently merges the best solutions into a single optimal output.
- Parallel Generation: Runs multiple LLM CLI agents (Codex CLI, Claude Code, Gemini CLI) simultaneously
- Intelligent Merging: Combines the best aspects of each solution using configurable strategies
- Docker Isolation: Each agent runs in its own container with full environment setup
- GitHub Integration: Automatically creates branches, runs tests, and creates pull requests
- Comprehensive Testing: Includes build validation, unit tests, and Playwright E2E tests
# Install dependencies
npm install
# Set up environment variables
npm run dev setup # Creates .env file from template
# Edit .env file and add your API keys
# Generate default configuration
npm run dev config
# Generate code
npm run dev generate \
--repo https://github.com/user/project \
--feature "add-user-authentication" \
--prompt "Add JWT-based user authentication with login/logout endpoints"pangloss generate \
--repo https://github.com/user/project \
--feature "feature-name" \
--prompt "Detailed description of what to implement"pangloss generate \
--repo https://github.com/user/project \
--feature "add-dark-mode" \
--prompt "Add dark mode toggle to the UI with system preference detection" \
--agents "codex-o3,claude-sonnet,gemini-pro" \
--timeout 20 \
--merge-strategy "best_per_file"Pangloss uses a pangloss.config.json file for configuration:
{
"llm_presets": {
"codex": {
"provider": "openai",
"model": "gpt-4",
"temperature": 0.2,
"system_prompt": "You are a precise code generator..."
}
},
"default_agents": ["codex", "claude-sonnet"],
"timeout_minutes": 15
}- Agent Spawning: Creates Docker containers for each LLM CLI agent
- Parallel Generation: Each agent clones the repo and runs CLI tools in
non-interactive mode:
- Codex CLI:
--approval-mode full-auto --quietfor complete automation - Claude Code CLI:
-pwith--output-format stream-jsonfor headless mode - Gemini CLI:
--promptflag for non-interactive execution
- Codex CLI:
- Validation: Runs tests, builds, and Playwright E2E tests on each solution
- Intelligent Merging: Combines the best solutions using configurable strategies
- PR Creation: Creates a final branch and pull request with the optimal solution
- best_overall: Takes the single best-performing solution
- best_per_file: Combines the best version of each modified file
- composite: Advanced merging that combines complementary features
Branches are created with the pattern: {repo-name}/{feature-name}/{agent-name}
Example:
my-app/add-auth/codex-o3my-app/add-auth/claude-sonnetmy-app/add-auth/gemini-promy-app/add-auth/final(merged result)
- Node.js 20+
- Docker and Docker Compose
- Git and GitHub CLI (
gh) - CLI tools: OpenAI Codex CLI, Claude Code CLI, Gemini CLI
- API keys for desired LLM providers
Pangloss uses a .env file for configuration. Create one using:
# Generate .env template
node dist/cli.js setup
# Or manually create .env with:
GITHUB_TOKEN=your_github_personal_access_token
OPENAI_API_KEY=your_openai_api_key # For Codex CLI
ANTHROPIC_API_KEY=your_anthropic_api_key # For Claude Code CLI
GEMINI_API_KEY=your_google_api_key # For Gemini CLI
GOOGLE_API_KEY=your_google_api_key # Alternative for Gemini CLI
# Optional configuration
PANGLOSS_DEFAULT_AGENTS=codex-o3,claude-sonnet,gemini-pro
PANGLOSS_TIMEOUT_MINUTES=15
PANGLOSS_CONFIG_PATH=./pangloss.config.json# Install dependencies
npm install
# Build TypeScript
npm run build
# Run in development mode
npm run dev
# Run tests
npm test
# Lint code
npm run lint┌─────────────────┐
│ Pangloss CLI │
└─────────┬───────┘
│
▼
┌─────────────────┐
│ Orchestrator │
└─────────┬───────┘
│
▼
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Agent 1 │ │ Agent 2 │ │ Agent 3 │
│ (Docker) │ │ (Docker) │ │ (Docker) │
│ │ │ │ │ │
│ - Clone repo │ │ - Clone repo │ │ - Clone repo │
│ - Generate code │ │ - Generate code │ │ - Generate code │
│ - Run tests │ │ - Run tests │ │ - Run tests │
│ - Push branch │ │ - Push branch │ │ - Push branch │
└─────────┬───────┘ └─────────┬───────┘ └─────────┬───────┘
│ │ │
▼ ▼ ▼
┌─────────────────────────────────────────────────────────────────┐
│ Result Merger │
│ │
│ - Analyze all solutions │
│ - Score and rank results │
│ - Merge best solutions │
│ - Create final branch and PR │
└─────────────────────────────────────────────────────────────────┘
MIT License - see LICENSE file for details.