Package Exports
- xibecode
- xibecode/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (xibecode) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
XibeCode - AI Coding Assistant
Production-ready autonomous coding agent powered by Claude AI
XibeCode is a professional CLI tool that brings autonomous AI coding capabilities to your terminal. Like Claude Code, but open-source, customizable, and with advanced context management.
๐ What's New in v0.1.6
v0.1.6:
- ๐ Codebase Search - New
grep_codetool using ripgrep (grep fallback) for lightning-fast code search across your project - ๐ Web Search - New
web_searchtool powered by DuckDuckGo โ free, no API key required - ๐ URL Fetching - New
fetch_urltool to read any webpage as clean text (HTML auto-stripped) - ๐ง Project Memory - Persistent
.xibecode/memory.mdthat saves project knowledge across sessions - ๐ฏ Verified Edit Tool -
verified_editwith old content verification prevents hallucinated edits - ๐ก๏ธ Safer Editing by Default - AI uses
verified_editas primary editing method with smart fallbacks
Previous Updates:
- ๐งช Test Integration - Auto-detect & run tests (Vitest, Jest, pytest, Go test)
- ๐ Git Awareness - Create checkpoints, check status, revert changes safely
- ๐ก๏ธ Safety Controls - Dry-run mode, risk assessment, command blocking
- ๐ Plugin System - Extend XibeCode with custom tools
- ๐ฆ Smart Package Manager - Prefers pnpm โ bun โ npm
- ๐ง Enhanced Reasoning - Advanced problem-solving, pattern recognition, and error handling
- ๐ก MCP Integration - Connect to external MCP servers for extended capabilities
๐ฏ Key Features
Core Capabilities
- โ Autonomous Agent Loop - AI iteratively works on tasks until completion
- โ Smart Context Management - Automatically loads related files (imports, tests, configs)
- โ Advanced File Editing - Search/replace, line-range edits, automatic backups
- โ Cross-Platform - Works on Windows, macOS, and Linux
- โ Beautiful TUI - Real-time progress, colored output, clear visualization
- โ Loop Detection - Prevents infinite loops and runaway executions
- โ Multiple Edit Methods - Smart edit, line-range edit, insert, revert
๐ New Features
- โ Web Search - Search the web from within the AI (DuckDuckGo, free, no API key)
- โ Codebase Search - Ripgrep-powered code search across your entire project
- โ URL Fetching - Read any webpage as clean text for research
- โ
Project Memory - Persist project knowledge across sessions in
.xibecode/memory.md - โ Verified Editing - Content-verified file edits that prevent AI mistakes
- โ Test Integration - Auto-detect and run tests (Vitest, Jest, pytest, Go test)
- โ Git Awareness - Check status, create checkpoints, revert changes safely
- โ Dry-Run Mode - Preview changes without making them
- โ Safety Controls - Risk assessment and command blocking for dangerous operations
- โ Plugin System - Extend XibeCode with custom tools and workflows
๐ Skills System
XibeCode includes a skills system that activates specialized AI workflows for common tasks:
Built-in Skills:
refactor-clean-code- Clean code principles & SOLID patternsdebug-production- Systematic debugging workflowwrite-tests- Comprehensive testing with 80%+ coveragesecurity-audit- OWASP Top 10 security checksoptimize-performance- Performance profiling & optimization
Usage:
# In chat mode
/skill list # Show all skills
/skill refactor-clean-code # Activate a skill
/skill off # Deactivate current skillWhen a skill is active, the AI follows specialized instructions and best practices for that domain. Create custom skills in .xibecode/skills/ (markdown files with YAML frontmatter).
File Operations
- ๐ Read files (whole or partial for large files)
- ๐ Write files (create or overwrite)
- โ๏ธ Edit files (search/replace with automatic backups)
- ๐ฏ Verified edits (content verification before applying)
- โ๏ธ Edit specific line ranges
- โฉ๏ธ Revert to previous versions
- ๐ Search files with glob patterns
- ๐ Grep codebase with ripgrep
- ๐ List directories
- ๐ง Get intelligent context (related files)
Web & Research
- ๐ Search the web (DuckDuckGo, free)
- ๐ Fetch and read any URL as text
- ๐ง Project memory persistence
Command Execution
- โก Run shell commands
- ๐ง Cross-platform command support
- ๐ Capture stdout/stderr
- โ Exit code handling
๐ฆ Installation
From npm (Recommended)
npm install -g xibecodeFrom Source
git clone https://github.com/iotserver24/xibecode
cd xibecode
npm install
npm run build
npm link๐ Quick Start
1. Set up API Key
# Interactive setup
xibecode config
# Or set directly
xibecode config --set-key YOUR_ANTHROPIC_API_KEY
# Or use environment variable
export ANTHROPIC_API_KEY=your_key_here2. Run Your First Task
xibecode run "Create a Python script that prints hello world"3. Try Interactive Chat
xibecode chat๐ก Usage
Run Command (Autonomous Mode)
The main command for autonomous coding tasks:
xibecode run [prompt] [options]Options:
-f, --file <path>- Read prompt from a file-m, --model <model>- AI model to use (default: claude-sonnet-4-5-20250929)-b, --base-url <url>- Custom API base URL-k, --api-key <key>- API key (overrides config)-d, --max-iterations <number>- Maximum iterations (default: 50)-v, --verbose- Show detailed logs--dry-run- Preview changes without making them--changed-only- Focus only on git-changed files
Examples:
# Simple task
xibecode run "Create a REST API with Express"
# From file
xibecode run --file task.txt
# With verbose logging
xibecode run "Fix the bug in app.js" --verbose
# Using specific model
xibecode run "Optimize this code" --model claude-opus-4-5-20251101
# Custom API endpoint
xibecode run "task" --base-url https://custom-api.com
# New in v2.0: Dry-run mode
xibecode run "Refactor authentication" --dry-run
# Focus on git-changed files only
xibecode run "Fix linting errors" --changed-only
# Run tests after making changes
xibecode run "Add validation and run tests to verify"Chat Command (Interactive Mode)
For quick questions and iterative development:
xibecode chat [options]Options:
-m, --model <model>- AI model to use-b, --base-url <url>- Custom API base URL-k, --api-key <key>- API key
Commands in chat:
tools on/off- Toggle tool executionclear- Clear screenexitorquit- Exit chat
Example:
$ xibecode chat
You: How do I implement JWT authentication?
Assistant: [explains JWT auth]
You: Write the code for it
Assistant: [writes code using tools]
You: Add it to my Express app
Assistant: [modifies app.js]Config Command
Manage your configuration:
# Interactive setup
xibecode config
# Quick operations
xibecode config --set-key YOUR_KEY
xibecode config --set-url https://custom-api.com
xibecode config --set-model claude-opus-4-5-20251101
xibecode config --show
xibecode config --reset๐จ What Makes XibeCode Different
1. Smart Context Management
XibeCode automatically understands your project:
xibecode run "Add error handling to userController.js"The AI will:
- Read
userController.js - Find and read imported files
- Check for related test files
- Look at config files (package.json, tsconfig.json)
- Make informed edits with full context
2. Advanced File Editing
Four ways to edit files, with verified_edit as the recommended default:
Verified Edit (DEFAULT - Most Reliable) ๐ฏ
// AI reads the file first, then provides old content for verification
{
tool: "verified_edit",
path: "app.js",
start_line: 5,
end_line: 5,
old_content: "const port = 3000;",
new_content: "const port = process.env.PORT || 3000;"
}
// If old_content doesn't match โ edit is REJECTED and actual content is returned
// AI can then re-read and retry with correct contentSearch/Replace (Fallback)
{
tool: "edit_file",
path: "app.js",
search: "const port = 3000;",
replace: "const port = process.env.PORT || 3000;"
}Line Range (For Large Files)
{
tool: "edit_lines",
path: "app.js",
start_line: 10,
end_line: 15,
new_content: "// Updated code here"
}Insert (Add New Code)
{
tool: "insert_at_line",
path: "app.js",
line: 5,
content: "const express = require('express');"
}3. Automatic Backups & Revert
Every edit creates a backup. Made a mistake?
xibecode run "Revert app.js to previous version"4. Cross-Platform
Works identically on:
- โ Windows (PowerShell)
- โ macOS (bash/zsh)
- โ Linux (bash)
The AI automatically uses the right commands for your OS.
5. Beautiful Real-Time UI
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ XibeCode AI Agent โ
โ Autonomous Coding Assistant v0.1.5 โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ Task:
Create a REST API with Express
โ๏ธ Configuration:
Model: claude-sonnet-4-5-20250929
Max Iterations: 50
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Iteration 1/50 (2%) - 0.5s
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ read_file
โ package.json
โ Success
โ 25 lines
๐ write_file
โ src/server.js
โ Success
โ File created (45 lines)
๐ฌ Assistant:
I've created an Express server with the following endpoints...๐ ๏ธ Advanced Features
Custom API Endpoints
Use with Azure, AWS Bedrock, or custom Claude deployments:
# Via config
xibecode config --set-url https://your-custom-endpoint.com
# Via command
xibecode run "task" --base-url https://your-custom-endpoint.comWorking with Large Files
For files >1000 lines, read in chunks:
xibecode run "Fix the bug around line 500 in large-file.js"The AI will:
- Read lines 450-550 (context around the area)
- Make targeted edit using line numbers
- Verify the change
Project Context Understanding
xibecode run "Understand this project structure and suggest improvements"The AI will use get_context to:
- Map import relationships
- Find test files
- Read configs
- Build a mental model
Error Recovery
If something fails, the AI will:
- Read the error message
- Analyze what went wrong
- Try a different approach
- Can revert changes if needed
๐งช Test Integration
XibeCode automatically detects and runs your project tests:
# Fix failing tests
xibecode run "Fix the failing tests"
# Run tests after changes
xibecode run "Add validation to User model and ensure all tests pass"Supported test runners:
- Node.js: Vitest, Jest, Mocha, Ava
- Python: pytest, unittest
- Go:
go test
Package manager detection:
- Prioritizes: pnpm โ bun โ npm
- Detects from lock files (
pnpm-lock.yaml,bun.lockb,package-lock.json)
Example workflow:
xibecode run "Refactor the authentication module:
1. Read the current code
2. Make improvements
3. Run tests to verify
4. Fix any test failures
5. Repeat until all tests pass"๐ Git Integration
Work smarter with git-aware workflows:
Check Repository State
xibecode run "Show me the current git status"The AI will use get_git_status to see:
- Current branch
- Staged/unstaged/untracked files
- Clean/dirty state
- Commits ahead/behind upstream
Focus on Changed Files
xibecode run "Fix linting errors in changed files" --changed-onlyThe AI will:
- Get list of modified files with
get_git_changed_files - Focus edits only on those files
- More efficient for large codebases
Create Safe Checkpoints
xibecode run "Refactor the database layer (create checkpoint first)"The AI can:
- Create checkpoints with
create_git_checkpoint - Use git stash or commit strategy (configurable)
- Revert to checkpoints if something goes wrong
Example:
// The AI executes:
create_git_checkpoint({
message: "before refactoring database layer",
strategy: "stash" // or "commit"
})
// ... makes changes ...
// If needed:
revert_to_git_checkpoint({
checkpoint_id: "stash@{0}",
checkpoint_type: "stash",
confirm: true
})Prepare Branches for Review
xibecode run "Prepare this branch for code review:
- Run tests
- Fix any linting errors
- Generate a summary of changes"๐ Safety Features
Dry-Run Mode
Preview changes without making them:
xibecode run "Refactor the auth module" --dry-runIn dry-run mode:
- All file operations show what would happen
- No actual changes are made
- Git operations are simulated
- Perfect for testing complex tasks
Example output:
[DRY RUN] Would replace lines 15-20 with 8 new lines
[DRY RUN] Would write 150 lines to src/auth/index.ts
[DRY RUN] Would create stash checkpoint: "before auth refactor"Risk Assessment
XibeCode automatically assesses risk for operations:
High-risk operations (require extra care):
- Deleting files/directories
- Force push to git
- Destructive shell commands
- Reverting to checkpoints
Blocked operations:
- Fork bombs
- Deleting root/home directories
- Direct disk writes
- Extremely dangerous commands
Example:
$ xibecode run "Delete all test files"
โ HIGH RISK: Deletes files/directories permanently
โข Ensure backups exist before deletion
โข Suggestion: Consider using `mv` to move files to a temporary location firstSafer Alternatives
XibeCode suggests safer alternatives for risky commands:
rm -rfโ "Usemvto move files first"git push --forceโ "Usegit push --force-with-lease"npm installโ "Usepnpm installorbun install"
๐ Plugin System
Extend XibeCode with custom tools and domain-specific logic:
Create a Plugin
// my-plugin.js
export default {
name: 'my-custom-plugin',
version: '1.0.0',
description: 'Adds custom tools for my workflow',
registerTools() {
return [
{
schema: {
name: 'deploy_to_staging',
description: 'Deploy the app to staging environment',
input_schema: {
type: 'object',
properties: {
branch: { type: 'string', description: 'Branch to deploy' }
},
required: ['branch']
}
},
async handler(input) {
// Your custom logic here
return { success: true, deployed: true, branch: input.branch };
}
}
];
},
initialize() {
console.log('My plugin loaded!');
}
};Load Plugins
# Via config
xibecode config --show
# Edit ~/.xibecode/config.json
{
"plugins": [
"/path/to/my-plugin.js",
"./local-plugin.js"
]
}
# Or use directly
xibecode run "Deploy to staging" The AI will automatically have access to your custom tools!
Plugin Examples
Database migrations:
registerTools() {
return [{
schema: { name: 'run_migration', ... },
handler: async (input) => {
// Run database migration
}
}];
}Internal APIs:
registerTools() {
return [{
schema: { name: 'query_internal_api', ... },
handler: async (input) => {
// Call internal company API
}
}];
}๐ Usage Examples
Build a Feature
xibecode run "Add user authentication to the Express API:
- POST /auth/register
- POST /auth/login
- JWT token generation
- Middleware to protect routes
- Hash passwords with bcrypt"Fix a Bug
xibecode run "The tests in test/user.test.js are failing.
Debug and fix the issues." --verboseRefactor Code
xibecode run "Refactor src/ to use TypeScript:
- Convert all .js files to .ts
- Add type annotations
- Create types.ts for shared types
- Update tsconfig.json"Generate Tests
xibecode run "Write comprehensive tests for userController.js:
- Test all endpoints
- Test error cases
- Use Jest
- Achieve >80% coverage"โ๏ธ Configuration
XibeCode stores config in ~/.xibecode/
Available Settings
{
"apiKey": "sk-ant-...", // Your Anthropic API key
"baseUrl": "https://...", // Custom API endpoint (optional)
"model": "claude-sonnet-4-5-...", // Default model
"maxIterations": 50, // Default max iterations
"defaultVerbose": false, // Default verbose mode
// New in v2.0
"preferredPackageManager": "pnpm", // Package manager: "pnpm", "bun", or "npm"
"enableDryRunByDefault": false, // Enable dry-run mode by default
"gitCheckpointStrategy": "stash", // Git checkpoint: "stash" or "commit"
"testCommandOverride": "", // Custom test command (optional)
"plugins": [], // Array of plugin paths
// Latest version
"mcpServers": {} // MCP server configurations (object-based)
}Environment Variables
ANTHROPIC_API_KEY=your_key # API key
ANTHROPIC_BASE_URL=https://... # Custom endpoint
XIBECODE_MODEL=claude-opus-4-... # Default modelConfig priority: CLI flags > Environment > Config file
๐ก MCP Integration (Model Context Protocol)
XibeCode supports the Model Context Protocol (MCP), enabling connection to external servers that provide additional tools, resources, and capabilities.
What is MCP?
MCP is an open protocol that standardizes how applications provide context to LLMs. With MCP, you can:
- Extend Tools: Add tools from external servers (databases, APIs, etc.)
- Access Resources: Read data from external sources
- Use Prompt Templates: Leverage pre-built prompts from servers
Adding an MCP Server
File-Based Configuration (Easiest - Recommended)
Edit the MCP servers configuration file directly:
# Show file path
xibecode mcp file
# Open file in your editor
xibecode mcp edit
# Or edit manually
nano ~/.xibecode/mcp-servers.jsonFile Format (~/.xibecode/mcp-servers.json):
{
"mcpServers": {
"filesystem": {
"command": "mcp-server-filesystem",
"args": ["--root", "/path/to/files"]
},
"github": {
"command": "mcp-server-github",
"args": ["--token", "YOUR_TOKEN"],
"env": {
"GITHUB_TOKEN": "your_token_here"
}
}
}
}Note: The configuration format has been updated to use an object-based structure. If you have an existing configuration using the legacy array format with
"servers": [...], it will be automatically migrated to the new format when you run any MCP command.
File Management Commands:
# Create default file with examples
xibecode mcp init
# Reload servers from file (after editing)
xibecode mcp reload
# Show file path and status
xibecode mcp fileCommands
# Open file to add/edit servers
xibecode mcp add
# or
xibecode mcp edit
# List all configured servers
xibecode mcp list
# Remove a server (or edit file manually)
xibecode mcp remove filesystem
# Show file path
xibecode mcp file
# Reload after editing
xibecode mcp reloadAlternative Methods
Via config command (interactive):
xibecode config --add-mcp-server my-server
# Follow interactive promptsVia config menu:
xibecode config
# Select "๐ก Manage MCP Servers" โ "โ Add MCP Server"MCP Server Configuration
MCP servers support two transport types:
stdio Transport (Local Process)
For local MCP servers that run as a subprocess. Currently only stdio transport is supported:
Note: The MCP configuration now uses a simpler object-based format. Instead of command-line flags, edit the configuration file directly:
# Open the config file
xibecode mcp edit
# Add your server to the file using the new format:
{
"mcpServers": {
"filesystem": {
"command": "mcp-server-filesystem",
"args": ["--root", "/path/to/files"]
}
}
}Using MCP Tools
Once configured, MCP tools are automatically available to XibeCode:
# In chat mode, view MCP servers and tools
xibecode chat
> /mcpMCP tools are prefixed with the server name (e.g., filesystem::read_file, remote-api::query).
Popular MCP Servers
- @modelcontextprotocol/server-filesystem - File system access
- @modelcontextprotocol/server-github - GitHub API integration
- @modelcontextprotocol/server-postgres - PostgreSQL database access
- @modelcontextprotocol/server-slack - Slack integration
- Custom servers - Build your own with the MCP SDK
Example: Adding GitHub MCP Server
# Install the GitHub MCP server
npm install -g @modelcontextprotocol/server-github
# Open the config file to add the server
xibecode mcp edit
# Edit the file and add:
# {
# "mcpServers": {
# "github": {
# "command": "mcp-server-github",
# "args": ["--token", "YOUR_GITHUB_TOKEN"]
# }
# }
# }
# Reload servers
xibecode mcp reload
# Now XibeCode can use GitHub tools
xibecode chat
> Create an issue in my repo about the bug we just found๐ง Enhanced AI Capabilities
XibeCode includes advanced reasoning capabilities that enable it to:
Systematic Problem Solving
- Problem Decomposition: Breaks complex tasks into manageable steps
- Hypothesis-Driven Development: Forms and tests hypotheses systematically
- Root Cause Analysis: Traces issues to their source, not just symptoms
- Pattern Recognition: Identifies design patterns and anti-patterns
Advanced Context Awareness
- Project Structure Understanding: Maps dependencies and data flows
- Change Impact Analysis: Considers downstream effects before modifications
- Historical Context: Uses git history to understand code evolution
- Cross-File Dependencies: Tracks relationships between files
Coding Best Practices
- SOLID Principles: Applies proper software design principles
- Error Handling: Structured error classification and recovery strategies
- Performance Optimization: Data structure selection and algorithm analysis
- Security Best Practices: Input validation, secure defaults, proper authentication
Multi-Step Planning
- Task Breakdown: Decomposes large features into atomic steps
- Dependency Mapping: Identifies prerequisites and execution order
- Milestone Definition: Sets intermediate validation points
- Rollback Planning: Plans for failure scenarios and recovery
๐ Safety Features
- Loop Detection - Stops if AI repeats the same action 3+ times
- Max Iterations - Hard limit on iterations (default: 50)
- Automatic Backups - Every edit is backed up
- Revert Capability - Can undo changes
- Error Recovery - Handles failures gracefully
- Read-Before-Edit - AI reads files before modifying
๐ Performance
- Startup: <1 second
- First response: 2-5 seconds (API latency)
- Tool execution: Instant to seconds
- Memory: ~50MB typical
- Context window: 100k tokens (smart management)
๐ Comparison
| Feature | XibeCode | Claude Code | Aider |
|---|---|---|---|
| Open Source | โ | โ | โ |
| Custom API URL | โ | โ | โ |
| Smart Context | โ | โ | โ ๏ธ |
| File Editing | โ Advanced | โ | โ |
| Cross-Platform | โ | โ | โ |
| Loop Detection | โ | โ | โ |
| Auto Backups | โ | โ ๏ธ | โ |
| Beautiful TUI | โ | โ | โ ๏ธ |
| Price | Free (your API) | $20/mo | Free |
๐ค Contributing
Contributions welcome! Please see CONTRIBUTING.md
๐ License
MIT
๐ Credits
Built with:
Inspired by Claude Code and Aider
Made with โค๏ธ for developers who love AI-assisted coding