AI-powered coding assistant CLI with Claude, GPT-4, and 10+ AI providers. Features streaming responses, 20+ tools, session management, and beautiful terminal UI.
npm install codesavant> AI-powered coding assistant CLI that brings Claude, GPT-4, and other leading AI models directly to your terminal.



---
- š¤ Multi-Provider Support - Works with Anthropic Claude, OpenAI GPT-4, Groq, DeepSeek, Google Gemini, Ollama, and AWS Bedrock
- šÆ Interactive REPL - Rich terminal interface with streaming responses and real-time tool execution
- š§ 20+ Built-in Tools - File operations, web search, code analysis, task management
- šØ Aurora Theme - Beautiful, modern color scheme optimized for terminal readability
- š¾ Session Management - Save, resume, and checkpoint your conversations
- š MCP Integration - Model Context Protocol support for extensibility
- š Craft Skills - AI-powered workflows for TDD, debugging, planning, and code review
- š Multiple Execution Modes - Interactive, single-command, pipe mode, or resume sessions
- š”ļø Security First - Permission system with SSRF protection and command validation
- š Context Management - Automatic token tracking and conversation compression
---
CodeSavant requires Bun runtime (v1.0.0+).
``bashmacOS, Linux, WSL
curl -fsSL https://bun.sh/install | bash
$3
`bash
Global installation
bun install -g codesavantOr with npm
npm install -g codesavant
`---
š Quick Start
$3
`bash
codesavant
`On first run, you'll be prompted to configure your preferred AI provider:
`
Welcome to CodeSavant!
No providers configured. Let's set one up.Which provider would you like to configure?
1. Anthropic (Claude)
2. OpenAI (GPT-4)
3. Groq (Fast inference)
4. Ollama (Local models)
> 1
Enter your Anthropic API key: sk-ant-...
ā API key saved!
`$3
`
> Hello! I need help refactoring my TypeScript code.ā I'd be happy to help you refactor your TypeScript code! Could you share
ā the code you'd like to refactor, along with any specific goals you have?
> Read src/utils/parser.ts and suggest improvements
[Tool: Read] ā Complete
file: src/utils/parser.ts
ā Based on the code, here are my suggestions for refactoring:
ā 1. Extract magic numbers into constants
ā 2. Add explicit return types
ā 3. Use more descriptive variable names...
`---
š Usage
$3
`bash
Interactive REPL (default)
codesavantSingle command execution
codesavant -p "explain this error"Pipe content as context
cat error.log | codesavant --pipeResume a previous session
codesavant -r abc123Specify provider and model
codesavant --provider openai --model gpt-4oPlan mode (read-only tools)
codesavant --planYOLO mode (auto-approve all)
codesavant --yoloStrict mode (approve everything)
codesavant --strict
`$3
| Option | Description | Example |
|--------|-------------|---------|
|
-p, --print | Execute prompt and exit | codesavant -p "fix bug" |
| --pipe | Read prompt from stdin | cat file \| codesavant --pipe |
| -r, --resume | Resume previous session | codesavant -r abc123 |
| --provider | Set AI provider | codesavant --provider anthropic |
| --model | Set model | codesavant --model gpt-4o |
| --plan | Read-only mode | codesavant --plan |
| --yolo | Auto-approve all tools | codesavant --yolo |
| --strict | Approve all tools manually | codesavant --strict |
| --cwd | Set working directory | codesavant --cwd /project |
| -o, --output-format | Output format (text/json/markdown) | codesavant -o json |
| --version | Show version | codesavant --version |
| --help | Show help | codesavant --help |---
š® REPL Commands
Once in the interactive REPL, use these slash commands:
$3
`bash
/session # Show current session info
/session list # List recent sessions
/resume [#|id] # Resume a session
/checkpoint [name] # Create checkpoint
/clear # Clear conversation
/exit # Exit REPL
`$3
`bash
/config # Show configuration
/status # Show session status
/provider # Display current provider
/model # Display current model
/permissions [mode] # Show/set permissions
/login # Show auth status
/doctor # Run health checks
`$3
`bash
/memory # Show project memory
/context # Show context usage
/history [count] # Show recent messages
/cost # Show token usage
/compact # Compress conversation
`$3
`bash
/help # Show all commands
/skills # List available skills
/tasks # Display task list
/mcp # Show MCP server status
/plan # Toggle plan mode
/rewind [args] # Revert file changes
`---
š¤ Supported AI Providers
$3
`bash
Set API key
export ANTHROPIC_API_KEY="sk-ant-..."Use Claude
codesavant --provider anthropic --model claude-sonnet-4-20250514
`Models:
-
claude-sonnet-4-20250514 (recommended)
- claude-3-opus-20240229
- claude-3-sonnet-20240229
- claude-3-haiku-20240307$3
`bash
Set API key
export OPENAI_API_KEY="sk-..."Use GPT-4
codesavant --provider openai --model gpt-4o
`Models:
-
gpt-4o (recommended)
- gpt-4o-mini
- gpt-4-turbo
- gpt-4
- gpt-3.5-turbo$3
`bash
Set API key
export GROQ_API_KEY="gsk_..."Use Groq
codesavant --provider groq --model llama-3.1-70b-versatile
`Models:
-
llama-3.1-70b-versatile
- llama-3.2-90b-vision-preview
- mixtral-8x7b-32768$3
`bash
Set API key
export GOOGLE_API_KEY="AIza..."Use Gemini
codesavant --provider gemini --model gemini-2.0-flash-exp
`Models:
-
gemini-2.0-flash-exp
- gemini-1.5-pro
- gemini-1.5-flash$3
`bash
Set API key
export DEEPSEEK_API_KEY="sk-..."Use DeepSeek
codesavant --provider deepseek --model deepseek-chat
`Models:
-
deepseek-chat
- deepseek-coder$3
`bash
Start Ollama server
ollama servePull a model
ollama pull llama3.2Use Ollama
codesavant --provider ollama --model llama3.2
`Models: Any Ollama model (llama3.2, codellama, mistral, etc.)
$3
`bash
Configure AWS credentials
aws configureUse Bedrock
codesavant --provider bedrock --model anthropic.claude-3-sonnet-20240229-v1:0
`---
š Craft Skills (AI Workflows)
Craft skills are specialized AI workflows for software engineering tasks.
$3
`bash
Brainstorm and explore requirements
/craft ideate Debug systematically
/craft diagnose
`Example:
`
> /craft ideate user authentication systemā I'm using the ideate skill to brainstorm the authentication system.
ā
ā Let's explore the requirements. What authentication method do you prefer?
ā 1. JWT tokens (stateless)
ā 2. Session-based (server-side state)
ā 3. OAuth 2.0 (third-party)
ā
> 1
ā Great choice! Let's design a JWT-based auth system...
`$3
`bash
Test-driven development
/craft proof Create implementation plan
/craft blueprint Execute plan step-by-step
/craft build Parallel subagent execution
/craft assembly-line Create isolated git worktree
/craft workspace
`Example:
`
> /craft proof login endpointā I'm using TDD workflow. Let me write failing tests first...
ā
[Tool: Write] ā Complete
file: tests/auth/login.test.ts
ā Tests written. Running to verify they fail...
ā
[Tool: Bash] ā Complete
command: bun test tests/auth/login.test.ts
ā ā 3 tests failing (expected). Now implementing minimal code to pass...
`$3
`bash
Verify work with evidence
/craft inspect Code review checklist
/craft reviewFinal deployment checks
/craft ship
`---
š§ Built-in Tools
CodeSavant provides 20+ tools that AI can use to help you:
$3
| Tool | Description | Example Use |
|------|-------------|-------------|
| Read | Read file contents | "Read src/main.ts" |
| Write | Create/overwrite files | "Create a new config.json" |
| Edit | Modify existing files | "Update the port in server.ts to 3000" |
| Glob | Find files by pattern | "Find all .tsx files" |
| Grep | Search file contents | "Search for TODO comments" |
$3
| Tool | Description | Example Use |
|------|-------------|-------------|
| Bash | Execute shell commands | "Run the tests" |
| LSP | Code analysis | "Get diagnostics for this file" |
| Notebook | Jupyter notebook ops | "Read notebook cells" |
$3
| Tool | Description | Example Use |
|------|-------------|-------------|
| WebSearch | Search the internet | "Search for React 18 docs" |
| WebFetch | Fetch & analyze pages | "Fetch and summarize this article" |
$3
| Tool | Description | Example Use |
|------|-------------|-------------|
| TaskCreate | Create structured tasks | Used by workflows |
| TaskList | List all tasks | "Show my tasks" |
| TaskUpdate | Update task status | Automatic during work |
$3
| Tool | Description | Example Use |
|------|-------------|-------------|
| Task (Subagent) | Spawn parallel agents | For complex multi-step work |
| Skill | Execute custom skills | Via /craft commands |
| AskUser | Interactive questions | AI asks for clarification |
---
š Configuration
$3
CodeSavant uses
.codesavant/settings.json:`json
{
"providers": {
"anthropic": {
"apiKey": "sk-ant-..."
},
"openai": {
"apiKey": "sk-..."
}
},
"defaultProvider": "anthropic",
"defaultModel": "claude-sonnet-4-20250514",
"hooks": {
"session_start": "echo 'Session started!'",
"user_prompt_submit": "git status"
},
"permissions": {
"mode": "default"
}
}
`$3
Create
.codesavant/SAVANT.md for project context:`markdown
Project: MyApp
Architecture
- Next.js 14 app router
- PostgreSQL database
- tRPC API layerCoding Standards
- Use TypeScript strict mode
- Prefer functional components
- Write tests for all features
`AI will read this automatically for project context.
$3
Create custom skills in
.codesavant/skills/:`markdown
---
name: deploy
category: implementation
description: Deploy to production
---Deploy Skill
Follow these steps to deploy:
1. Run tests:
bun test
2. Build: bun run build
3. Deploy: vercel deploy --prod
`---
šØ Aurora Theme
CodeSavant features a modern "Aurora" color scheme:
- Electric Blue - Assistant messages, primary UI
- Aqua - User input, selections
- Emerald - Success states, completions
- Amber - Warnings, processing
- Crimson - Errors, failures
- Violet - Keywords, special states
Colors are optimized for terminal readability on both light and dark backgrounds.
---
š” Examples
$3
`bash
codesavant> Review the changes in src/auth.ts and suggest improvements
[Tool: Read] ā Complete
file: src/auth.ts
ā I've reviewed the authentication code. Here are my findings:
ā
ā Security Issues:
ā 1. Line 23: Password stored in plaintext - should use bcrypt
ā 2. Line 45: JWT secret hardcoded - move to environment variable
ā
ā Code Quality:
ā 1. Consider extracting validation logic into separate function
ā 2. Add error handling for database connection failures
ā
ā Would you like me to fix these issues?
> Yes, fix the security issues
[Tool: Edit] ā Complete
file: src/auth.ts
ā I've updated the code to:
ā - Hash passwords with bcrypt
ā - Load JWT secret from environment variable
ā - Add proper error handling
ā
ā Changes made to src/auth.ts (lines 23-50)
`$3
`bash
codesavant> /craft proof user registration endpoint
ā Starting TDD workflow. Writing failing tests first...
[Tool: Write] ā Complete
file: tests/api/register.test.ts
ā Test cases written:
ā 1. Should register new user with valid data
ā 2. Should reject duplicate email
ā 3. Should validate password strength
ā 4. Should return JWT token on success
ā
ā Running tests...
[Tool: Bash] ā Complete
command: bun test tests/api/register.test.ts
ā ā All 4 tests failing (expected)
ā
ā Now implementing minimal code to pass tests...
[Tool: Write] ā Complete
file: src/api/register.ts
[Tool: Bash] ā Complete
command: bun test tests/api/register.test.ts
ā ā All 4 tests passing!
ā
ā Implementation complete. Ready to commit?
> Yes
[Tool: Bash] ā Complete
command: git add . && git commit -m "feat: add user registration endpoint"
`$3
`bash
codesavant> My app crashes with "Cannot read property 'name' of undefined"
ā Let's debug this systematically. Can you share the error stack trace
ā or the file where the error occurs?
> Read src/components/UserProfile.tsx
[Tool: Read] ā Complete
file: src/components/UserProfile.tsx
ā Found the issue at line 15:
ā
ā
`typescript
ā const userName = user.name; // user might be undefined
ā `
ā
ā The problem is accessing user.name without checking if user exists first.
ā
ā Root cause: The component renders before the user data is loaded.
ā
ā Fix: Add a loading check:
ā
ā `typescript
ā if (!user) return ;
ā const userName = user.name;
ā `
ā
ā Should I apply this fix?> Yes
[Tool: Edit] ā Complete
file: src/components/UserProfile.tsx
`$3
`bash
Analyze an error log
cat error.log | codesavant --pipe -p "analyze this error and suggest a fix"Review a diff
git diff | codesavant --pipe -p "review these changes"Explain code
cat complex-algorithm.ts | codesavant --pipe -p "explain this algorithm step by step"
`$3
`bash
Start working on a feature
codesavant> I need to add OAuth authentication
ā Let's plan the OAuth implementation...
ā [Long conversation with code changes]
> /checkpoint oauth-implementation
ā ā Checkpoint created: oauth-implementation
> /exit
Later, resume the session
codesavant -r> /resume
ā Recent sessions:
ā 1. [2h ago] OAuth authentication (15 messages)
ā 2. [1d ago] Bug fix in parser (8 messages)
ā
ā Which session? (1-2)
> 1
ā Resuming session...
ā [Previous conversation restored]
> Continue with the OAuth implementation
`---
š Security
CodeSavant includes comprehensive security features:
$3
- Default - Approve destructive operations interactively
- Plan (
--plan) - Read-only, no file modifications
- YOLO (--yolo) - Auto-approve (use with caution!)
- Strict (--strict) - Approve all tools manually$3
- ā
SSRF Protection - Blocks private IPs, localhost in WebFetch
- ā
Path Validation - Prevents traversal attacks in file operations
- ā
Command Safety - Array-based command spawning (no shell injection)
- ā
Secrets Handling - API keys from environment/config only
- ā
Tool Risk Assessment - High-risk tools require approval
$3
`bash
Use plan mode for exploratory analysis
codesavant --planReview changes before committing
codesavant # (default mode prompts for destructive ops)Avoid YOLO mode in production environments
codesavant --yolo # ā ļø Use only in safe environments
`---
š Advanced Features
$3
Execute commands at key lifecycle events:
`json
{
"hooks": {
"session_start": "git pull origin main",
"user_prompt_submit": "git status",
"session_end": "git stash"
}
}
`$3
Connect external tools via Model Context Protocol:
`json
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_TOKEN": "ghp_..."
}
}
}
}
`$3
Run long operations in the background:
`bash
> /bg npm run buildā Task started in background (ID: bg_abc123)
ā You can continue working...
> /tasks
ā Active Tasks:
ā ā bg_abc123: npm run build (Running, 45s)
`$3
Revert changes from previous operations:
`bash
> /rewindā Recent file changes:
ā 1. src/config.ts (2 min ago)
ā 2. src/auth.ts (5 min ago)
ā
ā Revert which file? (1-2, or 'all')
> 1
[Tool: Bash] ā Complete
command: git restore src/config.ts
ā ā Reverted src/config.ts
`---
š Context Management
CodeSavant automatically manages context window:
`bash
> /contextā Context Usage:
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā 45,230 / 200,000 tokens (23%)
ā
ā Breakdown:
ā - System: 2,450 tokens (5%)
ā - User: 18,920 tokens (42%)
ā - Assistant: 20,860 tokens (46%)
ā - Tools: 3,000 tokens (7%)
ā
ā Status: ā Healthy
`When approaching limits, use
/compact to compress:`bash
> /compactā Compressing conversation history...
ā
ā Before: 45,230 tokens (23%)
ā After: 22,100 tokens (11%)
ā
ā ā Compressed 50% of conversation
ā ā Key information preserved
`---
š Troubleshooting
$3
`bash
Check authentication
codesavant
> /loginRun diagnostics
> /doctorā Running health checks...
ā ā Provider: anthropic (authenticated)
ā ā Storage: ~/.codesavant/ (writable)
ā ā Working directory: /project (writable)
ā ā All systems operational
`$3
`bash
Check permissions
ls -la ~/.codesavant/Should see:
drwxr-xr-x sessions/
-rw-r--r-- settings.json
Fix permissions if needed
chmod 755 ~/.codesavant
chmod 644 ~/.codesavant/settings.json
`$3
`bash
Check cost/usage
> /costā Token Usage (This Session):
ā - Input: 12,450 tokens
ā - Output: 8,920 tokens
ā - Total: 21,370 tokens
ā
ā Estimated Cost: $0.32
`---
š¤ Contributing
We welcome contributions! CodeSavant is open source under the MIT license.
$3
`bash
Clone repository
git clone https://github.com/vaggarwal039/codesavant.git
cd codesavantInstall dependencies
bun installRun in development
bun run src/cli.tsRun tests
bun testBuild for production
bun run build
`$3
`
codesavant/
āāā src/
ā āāā cli.ts # CLI entry point
ā āāā repl-ink.tsx # Interactive REPL
ā āāā agent.ts # AI agent orchestration
ā āāā providers/ # AI provider implementations
ā āāā tools/ # Built-in tools
ā āāā skills/ # Craft skills
ā āāā components/ # UI components
ā āāā ...
āāā tests/ # Test suite (4,500+ tests)
āāā docs/ # Documentation
āāā package.json
``---
MIT License - see LICENSE file for details.
---
Built with:
- Bun - Fast JavaScript runtime
- Ink - React for CLIs
- Commander.js - CLI framework
- Chalk - Terminal styling
Powered by:
- Anthropic Claude
- OpenAI GPT-4
- Google Gemini
- Groq
- DeepSeek
---
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: vishal.a.aggarwal@pwc.com
---
Coming soon:
- [ ] Web dashboard for session management
- [ ] VS Code extension
- [ ] Custom theme editor
- [ ] Team collaboration features
- [ ] Cloud session sync
- [ ] More AI providers (Cohere, Mistral, etc.)
---
Made with ā¤ļø by Vishal Aggarwal
Star ā this repo if you find it useful!