Blazing fast code agent in pure Rust
The fastest open-source alternative to Claude Code.
10x faster startup β’ Single binary β’ Works offline with Ollama
Installation β’ Features β’ Documentation β’ Contributing
| Claude Code | Aider | Sage | |
|---|---|---|---|
| Startup Time | ~500ms | ~800ms | ~50ms |
| Binary Size | ~200MB | ~100MB | ~15MB |
| Offline Mode | β | β | β Ollama |
| Open Source | β | β | β |
| MCP Support | β | β | β |
| Memory System | β | β | β |
| Single Binary | β | β | β |
macOS / Linux:
curl -fsSL https://raw.githubusercontent.com/majiayu000/sage/main/install.sh | bashWindows (PowerShell):
irm https://raw.githubusercontent.com/majiayu000/sage/main/install.ps1 | iexHomebrew:
brew install majiayu000/sage/sageCargo:
cargo install --git https://github.com/majiayu000/sage sage-cli# Interactive mode (default)
sage
# Execute task interactively
sage "Create a Python script that fetches GitHub trending repos"
# Print mode - execute and exit (non-interactive)
sage -p "Explain this code"
# Continue most recent session
sage -c
# Resume specific session
sage -r <session-id>- 10x faster startup - Rust native, no runtime overhead
- Single ~15MB binary - No dependencies, instant install
- Efficient memory - Low footprint, handles large codebases
- Anthropic - Claude Sonnet, Opus (with prompt caching)
- OpenAI - GPT-4, GPT-4 Turbo
- Google - Gemini Pro
- Ollama - Llama, Mistral, CodeLlama (offline)
- Azure OpenAI - Enterprise deployments
- OpenRouter - Access 100+ models
- Doubao - ByteDance models
- GLM - Zhipu AI models
| Category | Tools |
|---|---|
| File Ops | Read, Write, Edit, Glob, Grep, NotebookEdit |
| Shell | Bash, KillShell, Task, TaskOutput |
| Web | WebSearch, WebFetch, Browser |
| Planning | TodoWrite, EnterPlanMode, ExitPlanMode |
| Git | Full Git integration |
- Memory System - Learns your coding patterns across sessions
- Checkpoints - Save and restore agent state
- Trajectory Recording - Full execution history for debugging
- MCP Protocol - Extend with Model Context Protocol servers
- Plugin System - Custom tool development
- 16+ Slash Commands -
/resume,/undo,/cost,/plan,/compact,/title, etc. - Session Resume - Continue where you left off (
sage -corsage -r <id>) - Interactive Mode - Multi-turn conversations
- File Change Tracking - Built-in undo support
# Start interactive session
sage
# Or with initial task
sage "Create a REST API with user authentication"> Create a REST API with user authentication
[Sage creates files, runs commands, shows progress...]
> /cost
βββββββββββββββββββββββββββββββββββ
β Session Cost & Usage β
βββββββββββββββββββββββββββββββββββ€
β Input tokens: 12,450 β
β Output tokens: 3,200 β
β Total cost: $0.047 β
βββββββββββββββββββββββββββββββββββ
> /resume
[Shows list of previous sessions...]
To resume: sage -r <session-id>
# Execute task and exit (non-interactive)
sage -p "Add error handling to main.rs"
# With maximum steps
sage --max-steps 30 -p "Refactor the auth module"# Continue most recent session
sage -c
# Resume specific session by ID
sage -r abc123| Command | Description |
|---|---|
/help |
Show help information |
/clear |
Clear conversation history |
/compact |
Summarize and compact context |
/resume [id] |
Resume previous session |
/cost |
Show token usage and cost |
/undo [msg-id] |
Undo file changes |
/plan [open|clear] |
View/manage execution plan |
/checkpoint [name] |
Save current state |
/restore [id] |
Restore to checkpoint |
/context |
Show context usage |
/status |
Show agent status |
/tasks |
List background tasks |
/commands |
List all slash commands |
/title <title> |
Set session title |
/init |
Initialize Sage in project |
/config |
Manage configuration |
/login |
Configure API key for provider |
/logout |
Clear stored credentials |
Create sage_config.json or use environment variables:
{
"default_provider": "anthropic",
"model_providers": {
"anthropic": {
"model": "claude-sonnet-4-20250514",
"api_key": "${ANTHROPIC_API_KEY}",
"enable_prompt_caching": true
},
"ollama": {
"model": "codellama",
"base_url": "http://localhost:11434"
}
},
"max_steps": 20,
"working_directory": "."
}# API Keys
export ANTHROPIC_API_KEY="sk-ant-..."
export OPENAI_API_KEY="sk-..."
# Configuration
export SAGE_DEFAULT_PROVIDER="anthropic"
export SAGE_MAX_STEPS="30"Use Sage as a library in your Rust projects:
use sage_sdk::{SageAgentSdk, RunOptions};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Load from config file
let sdk = SageAgentSdk::with_config_file("sage_config.json")?;
// Or create with default config
// let sdk = SageAgentSdk::new()?;
// Run a task
let options = RunOptions::new("Create a README file");
let result = sdk.run(options).await?;
println!("Execution completed: {:?}", result.outcome());
Ok(())
}sage/
βββ crates/
β βββ sage-core/ # Core agent logic, LLM providers, session, tools
β βββ sage-cli/ # Command-line interface
β βββ sage-sdk/ # High-level SDK for embedding
β βββ sage-tools/ # Built-in tool implementations
βββ docs/ # Documentation
βββ examples/ # Usage examples
βββ benchmarks/ # Performance benchmarks
Run the startup benchmark:
./benchmarks/startup.shCode Agent Startup Benchmark
ββββββββββββββββββββββββββββ
Agent Avg (ms)
ββββββββββββββββββββββββββββ
sage 45
claude 520
aider 780
Sage is 11.5x faster than Claude Code
- User Guide - Getting started, configuration, usage
- Architecture - System design, components
- Tools Reference - All available tools
- Development - Contributing, building
Contributions are welcome! Please read our Contributing Guide.
# Clone
git clone https://github.com/majiayu000/sage
cd sage
# Build
cargo build --release
# Test
cargo test
# Run
./target/release/sage --helpMIT License - see LICENSE for details.
Inspired by:
- Claude Code - Anthropic's CLI tool design
- Trae Agent - ByteDance's agent architecture
- Aider - AI pair programming
β Star us on GitHub if you find Sage useful!
Made with π¦ by the Sage Team
