Edgar is a fully Claude Code-compatible CLI implementation, built using Test-Driven Development (TDD) principles. It provides the exact same CLI interface, tool definitions, SDK parameters, hooks, and slash commands as Claude Code, making it a drop-in replacement.
Repository: https://github.com/rysweet/edgar-cli
Run Edgar directly from GitHub using npx:
# Run Edgar directly without installing
npx github:rysweet/edgar-cli
# Execute a single prompt
npx github:rysweet/edgar-cli -p "What is 2+2?"
# Or use the full GitHub URL
npx git+https://github.com/rysweet/edgar-cli.git- Node.js 18.0 or higher
- npm
# Clone the repository
git clone https://github.com/rysweet/edgar-cli.git
cd edgar-cli
# Install dependencies
npm install
# Build the project
npm run build
# Link globally (optional)
npm link
# Now you can use edgar from anywhere
edgar --help- Master Agent Loop: Single-threaded async architecture for processing user requests
- Tool System: Comprehensive set of tools for file operations, command execution, and web interactions
- LLM Integration: Support for multiple LLM providers (Azure OpenAI, OpenAI, Anthropic)
- Subagent System: 21 specialized agents for different tasks
- Output Styles: Customizable response formats
- Configuration Management: Hierarchical configuration system
- Read: Read files with support for images, PDFs, and Jupyter notebooks
- Write: Create or overwrite files with permission preservation
- Edit: Make precise string replacements in files
- Bash: Execute shell commands with safety filters
- Glob: Pattern matching for finding files
- Grep: Content search using ripgrep
- TodoWrite: Task management and tracking
- WebFetch: Fetch and process web content
- WebSearch: Search the web
- Task: Launch specialized subagents
- Development: Builder, Architect, Reviewer, Tester
- Optimization: Optimizer, Database, Performance
- Security: Security, Authentication, Vulnerability Assessment
- Integration: API Designer, Integration, CI/CD Diagnostic
- Analysis: Analyzer, Patterns, Ambiguity
- Workflow: Improvement Workflow, Cleanup, Pre-commit Diagnostic
- Specialized: Prompt Writer, Preference Reviewer, Output Style Setup
Create a .env file in your project directory:
# Azure OpenAI (Currently Configured)
AZURE_OPENAI_KEY=your_key_here
AZURE_OPENAI_ENDPOINT=your_endpoint_here
AZURE_OPENAI_DEPLOYMENT=your_deployment_name
AZURE_OPENAI_API_VERSION=2025-01-01-preview
# OpenAI
OPENAI_API_KEY=your_key_here
OPENAI_MODEL=gpt-4
# Anthropic
ANTHROPIC_API_KEY=your_key_here
ANTHROPIC_MODEL=claude-3-sonnet-20240229
# Default Provider
LLM_PROVIDER=azure # or 'openai', 'anthropic'
# General Settings
LLM_TEMPERATURE=0.7
LLM_MAX_TOKENS=4096# Start interactive session
edgar# Execute a single prompt with -p or --prompt
edgar -p "What is 2+2?"
edgar --prompt "Write a hello world function in Python"edgar -h, --help # Show help
edgar -v, --version # Show version
edgar -d, --debug # Enable debug mode
edgar --no-color # Disable colored output# If .env is not in current directory
AZURE_OPENAI_KEY=xxx AZURE_OPENAI_ENDPOINT=xxx edgar query "What is 2+2?"# List all configuration
edgar config --list
# Set a configuration value
edgar config --set "provider=anthropic"
# Get a configuration value
edgar config --get provider# List available styles
edgar style --list
# Set active style
edgar style --set detailed
# Create a new style
edgar style --create mystyleWhen in interactive mode:
exitorquit- Exit Edgarhelp- Show available commands/style <name>- Change output style/styles- List available styles/clear- Clear conversation history/save <file>- Save conversation/load <file>- Load conversation
Master Loop (master-loop-v2.ts)
├── LLM Providers
│ ├── Azure OpenAI
│ ├── OpenAI
│ └── Anthropic
├── Tool Manager
│ ├── File Tools (Read, Write, Edit)
│ ├── Execution Tools (Bash, Task)
│ ├── Search Tools (Glob, Grep)
│ └── Web Tools (WebFetch, WebSearch)
├── Subagent Manager
│ └── 21 Specialized Agents
└── Output Style Manager
└── 5 Built-in Styles
edgar/
├── src/
│ ├── cli/ # CLI interface
│ ├── config/ # Configuration management
│ ├── core/ # Master loop and session
│ ├── hooks/ # Hook system
│ ├── llm/ # LLM providers
│ │ └── providers/ # Provider implementations
│ ├── output/ # Output styles
│ ├── subagents/ # Subagent system
│ ├── tools/ # Tool implementations
│ └── index.ts # Main entry point
├── tests/ # Comprehensive test suite
├── dist/ # Compiled JavaScript
├── .env # Environment configuration
└── .edgar/ # Configuration directory
- Total Test Suites: 7
- Total Tests: 115+
- All Passing: ✅
- TDD Approach: Tests written first
# Run all tests
npm test
# Run with coverage
npm run test:coverage
# Watch mode
npm run test:watch# Build TypeScript
npm run build
# Clean build
npm run clean
# Development mode
npm run dev# Run ESLint
npm run lint
# Format with Prettier
npm run formatTaskTool uses lazy initialization to avoid circular dependencies with SubagentManager.
Supports both base URL and full endpoint URL formats for flexibility.
- Supports both
.claudeand.edgardirectories - Automatic migration from
.claudeto.edgar - Preference for
.edgarwhen both exist
- Command filtering in Bash tool
- Permission preservation in Write tool
- Unique string validation in Edit tool
- Timeout controls for all operations
- ✅ Azure OpenAI integration with GPT-4.1
- ✅ Query processing and response
- ✅ Configuration management
- ✅ Output style system
- ✅ Global installation via npm link
- ✅ Environment variable loading
- ✅ Tool execution
# Ensure .env is in current directory or set explicitly:
AZURE_OPENAI_KEY=xxx edgar query "test"Verify keys are set correctly and have proper permissions.
Already resolved through lazy initialization in TaskTool.
MIT
Edgar is a reimplementation of Claude Code by Anthropic, built as a comprehensive exercise in:
- Test-Driven Development
- TypeScript architecture
- LLM integration
- Tool system design
- Modular software engineering
Built with Claude's assistance using TDD principles and systematic implementation.
Note: This project demonstrates a complete, working reimplementation of Claude Code with all major features functional and tested.