Sugar - AI-powered autonomous development system for Claude Code CLI
Project description
Sugar - AI-Powered Autonomous Development System
An intelligent autonomous development assistant that works 24/7 to improve your codebase using Claude AI.
Sugar is a lightweight autonomous development system specifically designed for Claude Code CLI integration that can be installed as a library in any project. It continuously discovers work from GitHub issues, error logs, and code quality analysis, then automatically implements fixes and improvements using Claude's advanced reasoning capabilities.
โจ What Makes Sugar Special
- ๐ค Truly Autonomous: Runs 24/7 discovering and fixing issues without human intervention
- ๐ง Advanced Agent Integration: Intelligently selects optimal Claude agents for each task type
- ๐ Dynamic Agent Discovery: Works with any Claude agents you have configured locally
- ๐ Smart Discovery: Automatically finds work from GitHub issues, error logs, and code analysis
- ๐ฏ Project-Focused: Each project gets isolated Sugar instance with custom configuration
- ๐ง Battle-Tested: Handles real development workflows with git, GitHub, testing, and deployment
- ๐ Quality Tracking: Monitors agent performance with detailed analytics and confidence scoring
- ๐ Learning System: Adapts and improves based on success/failure patterns
๐ Quick Start
Prerequisites
Required: Sugar requires Claude Code CLI to be installed and accessible.
-
Install Claude Code CLI (if not already installed):
- Visit Claude Code CLI documentation for installation instructions
- Or install via npm:
npm install -g @anthropic-ai/claude-code-cli - Verify installation:
claude --version
-
Ensure Claude CLI is in your PATH or note its location for configuration
โ ๏ธ Important: Sugar is designed to run outside of Claude Code sessions. Run Sugar directly in your terminal/shell, not within a Claude Code session. Sugar will call Claude Code CLI as needed to execute tasks.
Installation
Install from PyPI (recommended):
pip install sugarai
โ ๏ธ IMPORTANT DISCLAIMER: By installing and using Sugar, you agree to the Terms of Service and Disclaimer. Sugar is provided "AS IS" without warranty. Users are solely responsible for reviewing AI-generated code and ensuring appropriate safeguards. Sugar is not affiliated with or endorsed by Anthropic, Inc. "Claude" and "Claude Code" are trademarks of Anthropic, Inc.
Or install from source for latest development version:
# Method 1: Clone and install (recommended for development)
git clone https://github.com/cdnsteve/sugar.git
cd sugar
pip install -e .
# Method 2: Direct from Git (SSH) - Always use main branch
pip install -e git+ssh://git@github.com/cdnsteve/sugar.git@main#egg=sugar
๐ Detailed setup instructions: Local Development Setup
Initialize in Your Project
cd /path/to/your/project
sugar init
Note: Sugar will auto-detect your Claude CLI installation. If it's not in your PATH, you can specify the location in .sugar/config.yaml after initialization.
Add Some Work
sugar add "Implement user authentication" --type feature --priority 4
sugar add "Fix memory leak in auth module" --type bug_fix --urgent
sugar add "Add unit tests for payments" --type test --priority 3
Get Help Anytime
# Comprehensive help and quick reference
sugar help
# Command-specific help
sugar add --help
sugar run --help
Start Autonomous Development
# Test with dry run first
sugar run --dry-run --once
# Start 24/7 autonomous operation
sugar run
๐ฏ What Sugar Does
Sugar operates in two modes:
๐ค Autonomous Discovery
Sugar continuously:
- ๐ Discovers work from error logs, feedback, and GitHub issues
- ๐ Analyzes code quality and identifies improvements
- ๐งช Detects missing tests and coverage gaps
- โก Executes tasks using Claude Code CLI with full context
- ๐ฟ Creates branches & PRs or commits directly to main (configurable)
- ๐ฌ Updates GitHub issues with detailed progress and completion status
- ๐ง Learns and adapts from results to improve future performance
- ๐ Repeats autonomously 24/7 without human intervention
๐ค Manual Task Management
You can also directly add tasks:
- ๐ Add specific tasks via
sugar add "task description" - ๐ฏ Set priorities and task types (bug_fix, feature, test, etc.)
- ๐ Manage work queue with full CLI control
- ๐ Combined workflow - manual tasks + autonomous discovery
๐ Clean Project Structure
Sugar keeps everything contained in .sugar/ directory - no clutter in your project root!
your-project/
โโโ src/ # Your project source
โโโ .sugar/ # Sugar-specific files (isolated)
โ โโโ config.yaml # Project-specific config
โ โโโ sugar.db # Project-specific database
โ โโโ sugar.log # Project-specific logs
โ โโโ context.json # Claude context
โโโ .gitignore # Just add: .sugar/
โโโ logs/errors/ # Your error logs (monitored)
Simple .gitignore: Just add .sugar/ to your .gitignore - that's it!
๐ Complete .gitignore template
๐ง Configuration
Auto-generated .sugar/config.yaml with sensible defaults:
sugar:
# Core Loop Settings
loop_interval: 300 # 5 minutes between cycles
max_concurrent_work: 3 # Execute multiple tasks per cycle
dry_run: true # Start in safe mode - change to false when ready
# Claude Code Integration
claude:
command: "/path/to/claude" # Auto-detected Claude CLI path
timeout: 1800 # 30 minutes max per task
context_file: ".sugar/context.json"
# Agent Integration (v1.2.0+)
use_structured_requests: true # Enable structured JSON communication
enable_agents: true # Enable Claude agent mode selection
agent_fallback: true # Fall back to basic Claude if agent fails
agent_selection: # Map work types to specific agents
bug_fix: "tech-lead" # Strategic analysis for bug fixes
feature: "general-purpose" # General development for features
refactor: "code-reviewer" # Code review expertise for refactoring
test: "general-purpose" # General development for tests
documentation: "general-purpose" # General development for docs
# available_agents: [] # Optional: specify which agents are available
# If empty, Sugar accepts any agent name
# Work Discovery
discovery:
error_logs:
enabled: true
paths: ["logs/errors/", "logs/feedback/", ".sugar/logs/"]
patterns: ["*.json", "*.log"]
max_age_hours: 24
github:
enabled: false # Set to true and configure to enable
repo: "" # e.g., "user/repository"
issue_labels: [] # No filtering - work on ALL open issues
workflow:
auto_close_issues: true
git_workflow: "direct_commit" # direct_commit|pull_request
code_quality:
enabled: true
root_path: "."
file_extensions: [".py", ".js", ".ts", ".jsx", ".tsx"]
excluded_dirs: ["node_modules", ".git", "__pycache__", "venv", ".venv", ".sugar"]
max_files_per_scan: 50
test_coverage:
enabled: true
root_path: "."
source_dirs: ["src", "lib", "app", "api", "server"]
test_dirs: ["tests", "test", "__tests__", "spec"]
# Storage
storage:
database: ".sugar/sugar.db" # Project-specific database
backup_interval: 3600 # 1 hour
# Safety
safety:
max_retries: 3
excluded_paths:
- "/System"
- "/usr/bin"
- "/etc"
- ".sugar"
# Logging
logging:
level: "INFO"
file: ".sugar/sugar.log" # Project-specific logs
๐ค Claude Agent Integration
Sugar v1.2.0+ includes advanced Claude agent integration with dynamic agent discovery!
Sugar intelligently selects the best Claude agent for each task based on work characteristics, and supports any agents you have configured locally - not just built-in ones.
๐ฏ Intelligent Agent Selection
Sugar automatically analyzes your work items and selects the optimal agent:
# High-priority security bug โ tech-lead agent
sugar add --type bug_fix --priority 5 --title "Critical auth vulnerability"
# Code refactoring โ code-reviewer agent
sugar add --type refactor --title "Clean up legacy payment code"
# Social media content โ social-media-growth-strategist agent
sugar add --type documentation --title "Create LinkedIn content for developer audience"
# Standard feature โ general-purpose agent
sugar add --type feature --title "Add user profile settings"
๐ง Agent Configuration
Configure agents in .sugar/config.yaml:
claude:
# Structured Request System
use_structured_requests: true
# Agent Selection System
enable_agents: true # Enable agent mode selection
agent_fallback: true # Fall back to basic Claude if agent fails
# Map work types to specific agents (built-in or custom)
agent_selection:
bug_fix: "tech-lead" # Built-in agent
feature: "my-frontend-specialist" # Your custom agent
refactor: "code-reviewer" # Built-in agent
test: "general-purpose" # Built-in agent
documentation: "technical-writer" # Your custom agent
# Dynamic Agent Discovery - specify your available agents
available_agents: [
"tech-lead", # Built-in agents
"code-reviewer",
"general-purpose",
"my-frontend-specialist", # Your custom agents
"technical-writer",
"database-expert",
"security-specialist"
]
# If available_agents is empty/unspecified, Sugar accepts any agent name
๐ Built-in Agent Types
Sugar includes intelligent selection for these built-in agents:
| Agent | Best For | Keywords |
|---|---|---|
| tech-lead | Strategic analysis, architecture, complex bugs, high-priority work | architecture, design, strategy, security, critical |
| code-reviewer | Code quality, refactoring, optimization, best practices | review, refactor, cleanup, optimize, code quality |
| social-media-growth-strategist | Content strategy, engagement, audience growth | social media, content, engagement, followers |
| general-purpose | Standard development work (features, tests, docs) | Default for most tasks |
| statusline-setup | Claude Code status line configuration | statusline, status line |
| output-style-setup | Claude Code output styling and themes | output style, styling, theme |
๐ Custom Agent Support
Sugar supports ANY agents you have configured locally! Examples:
claude:
agent_selection:
bug_fix: "my-security-expert" # Your custom security agent
feature: "frontend-guru" # Your custom frontend agent
refactor: "performance-wizard" # Your custom performance agent
database: "sql-specialist" # Your custom database agent
๐ง How Agent Selection Works
- User Configuration First: Checks your
agent_selectionmapping - Keyword Analysis: Uses intelligent keyword matching as fallback
- Availability Validation: Ensures selected agent is in your
available_agentslist - Graceful Fallback: Falls back to available alternatives if needed
- Quality Assessment: Tracks agent performance with 0.0-1.0 quality scores
๐ Agent Performance Tracking
Sugar provides detailed analytics for agent performance:
# View work with timing and agent information
sugar list
# ๐ 20 Tasks (16 pending โณ, 2 completed โ
, 1 active โก, 1 failed โ):
# โฑ๏ธ 45.2s | ๐ 2m 15s | ๐ค tech-lead | Critical auth fix
sugar view TASK_ID
# Shows: agent used, quality score, confidence level, execution time
๐ Fallback Strategy
Sugar uses a robust multi-layer fallback system:
- Selected Agent (from configuration or keyword analysis)
- Basic Claude (if agent fails)
- Legacy Mode (if structured requests fail)
This ensures your work never fails due to agent issues.
โ๏ธ Migration from v1.1.x
Existing Sugar installations automatically get agent support with zero breaking changes:
- All existing configurations continue working unchanged
- Agents are opt-in - set
enable_agents: falseto disable - Without agent configuration, Sugar uses intelligent defaults
๐ Command Reference
Task Management
# Add tasks with different types and priorities
sugar add "Task title" [--type TYPE] [--priority 1-5] [--urgent] [--description DESC]
# Types: bug_fix, feature, test, refactor, documentation
# Priority: 1 (low) to 5 (urgent)
# List tasks
sugar list [--status STATUS] [--type TYPE] [--limit N]
# View specific task details
sugar view TASK_ID
# Update existing task
sugar update TASK_ID [--title TITLE] [--description DESC] [--priority 1-5] [--type TYPE] [--status STATUS]
# Remove task
sugar remove TASK_ID
# Check system status
sugar status
System Operation
# Initialize Sugar in current directory
sugar init [--project-dir PATH]
# Run autonomous loop
sugar run [--dry-run] [--once] [--validate]
# Validate configuration
sugar run --validate
๐ Multi-Project Usage
Run Sugar across multiple projects simultaneously:
# Project A
cd /path/to/project-a
sugar init && sugar run &
# Project B
cd /path/to/project-b
sugar init && sugar run &
# Project C
cd /path/to/project-c
sugar init && sugar run &
Each project operates independently with isolated:
- Configuration and database
- Work queues and execution
- Discovery and learning
๐ก๏ธ Safety Features
- Dry run mode - Simulates execution without making changes (default)
- Path exclusions - Prevents system file modifications
- Project isolation - Uses
.sugar/directory to avoid conflicts - Timeout handling - Prevents runaway processes
- Auto-detection - Finds Claude CLI automatically
- Graceful shutdown - Handles interrupts cleanly
๐พ Storage & Context
Sugar maintains project-specific data isolation:
- Project Database:
.sugar/sugar.dbstores all task data, execution history, and learning - Context Management:
.sugar/context.jsonpreserves Claude Code session context - Automated Backups: Regular database backups with configurable intervals
- Isolated Logs: Project-specific logging in
.sugar/sugar.log
Each Sugar instance is completely isolated - you can run multiple projects simultaneously without interference.
๐ Work Input Methods
Sugar accepts work from multiple sources:
๐ Manual CLI Input
Direct task management via command line:
sugar add "Implement user registration" --type feature --priority 4
sugar add "Fix authentication bug" --type bug_fix --urgent
sugar add "Add API tests" --type test --priority 3
๐ค Autonomous Discovery
Sugar automatically finds work from:
Error Logs
Monitors specified directories for error files:
discovery:
error_logs:
paths: ["logs/errors/", "app/logs/"]
patterns: ["*.json", "*.log"]
Code Quality Analysis
Scans source code for improvements:
discovery:
code_quality:
file_extensions: [".py", ".js", ".ts"]
excluded_dirs: ["node_modules", "venv"]
Test Coverage Analysis
Identifies missing tests:
discovery:
test_coverage:
source_dirs: ["src", "lib"]
test_dirs: ["tests", "spec"]
GitHub Integration (Optional)
Monitors repository issues and PRs:
discovery:
github:
enabled: true
repo: "owner/repository"
token: "ghp_your_token"
๐ Monitoring
Per-Project Monitoring
Each project has its own isolated Sugar instance. Commands are project-specific:
# Check status for current project
sugar status
# Monitor logs for current project
tail -f .sugar/sugar.log
# List recent work for current project (shows status summary)
sugar list --status completed --limit 10
# Background operation for current project
nohup sugar run > sugar-autonomous.log 2>&1 &
Multi-Project Monitoring
To monitor Sugar across multiple projects, you need to check each project directory:
# Example script to check all projects
for project in ~/projects/*; do
if [ -d "$project/.sugar" ]; then
echo "๐ Project: $(basename $project)"
cd "$project"
sugar status | grep -E "(Total Tasks|Pending|Active|Completed)"
echo
fi
done
๐๏ธ Advanced Usage
Custom Error Integration
Configure Sugar to monitor your application's error logs:
discovery:
error_logs:
paths:
- "logs/errors/"
- "monitoring/alerts/"
- "var/log/myapp/"
Team Workflow
- Each developer runs Sugar locally
- Share configuration templates (without tokens)
- Different priorities for different team members
- GitHub integration prevents duplicate work
Production Deployment
- Test thoroughly in staging environments
- Monitor resource usage and performance
- Set appropriate concurrency and timeout limits
- Ensure rollback procedures are in place
๐จ Troubleshooting
Common Issues
Claude CLI not found:
# First, check if Claude CLI is installed
claude --version
# If not installed, install it:
npm install -g @anthropic-ai/claude-code-cli
# If installed but not found by Sugar, edit .sugar/config.yaml:
claude:
command: "/full/path/to/claude" # Specify exact path
No work discovered:
# Check paths exist
ls -la logs/errors/
# Validate configuration
sugar run --validate
# Test with sample error
echo '{"error": "test"}' > logs/errors/test.json
Tasks not executing:
# Check dry_run setting
cat .sugar/config.yaml | grep dry_run
# Monitor logs
tail -f .sugar/sugar.log
# Test single cycle
sugar run --once
๐ Documentation
- Complete Documentation Hub - All Sugar documentation
- Quick Start Guide - Get up and running in 5 minutes
- Local Development Setup - Install and test Sugar locally (before PyPI)
- GitHub Integration - Connect Sugar to GitHub issues and PRs
- Installation Guide - Comprehensive installation and usage
- CLI Reference - Complete command reference
- Contributing Guide - How to contribute to Sugar
๐ฏ Use Cases
Individual Developer
- Continuous bug fixing from error logs
- Automated test creation for uncovered code
- Documentation updates when code changes
- Code quality improvements during idle time
Development Team
- Shared work discovery across team projects
- Automated issue processing from GitHub
- Continuous integration of feedback loops
- 24/7 development progress across multiple repos
Product Teams
- Autonomous handling of user feedback
- Automated response to monitoring alerts
- Continuous improvement of code quality metrics
- Proactive maintenance and technical debt reduction
๐ฎ Roadmap
- โ Phase 1: Core loop, error discovery, basic execution
- โ Phase 2: Smart discovery (GitHub, code quality, test coverage)
- โ Phase 3: Learning and adaptation system
- ๐ง Phase 4: PyPI package distribution
- ๐ Phase 5: Enhanced integrations (Slack, Jira, monitoring systems)
- ๐ Phase 6: Team coordination and conflict resolution
๐ค Contributing
- Test changes with
--dry-runand--once - Validate configuration with
--validate - Check logs in
.sugar/sugar.log - Follow existing code patterns
- Update documentation for new features
โ๏ธ Legal and Disclaimers
Terms of Service
By using Sugar, you agree to our Terms of Service and Disclaimer, which includes:
- No Warranty: Software provided "AS IS" without warranties of any kind
- Limitation of Liability: No responsibility for code damage, data loss, or system issues
- User Responsibility: Users must review all AI-generated code before use
- Security: Never use on production systems without proper testing and safeguards
Trademark Notice
Sugar is an independent third-party tool. "Claude," "Claude Code," and related marks are trademarks of Anthropic, Inc. Sugar is not affiliated with, endorsed by, or sponsored by Anthropic, Inc.
Risk Acknowledgment
- AI-generated code may contain errors or security vulnerabilities
- Always review and test generated code in safe environments
- Maintain proper backups of your projects
- Use appropriate security measures for your development environment
๐ License
MIT License with additional disclaimers - see LICENSE and TERMS.md for complete details.
Sugar v1.7.0 - Built for Claude Code CLI autonomous development across any project or codebase.
Transform any project into an autonomous development environment with just sugar init.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sugarai-1.7.0.tar.gz.
File metadata
- Download URL: sugarai-1.7.0.tar.gz
- Upload date:
- Size: 96.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ad4b80bbd78d2fc13ee9ad820149479a6ee87d20c85a6f4f116c1005d33914a
|
|
| MD5 |
8a35f5855733709d0977b01a2323144f
|
|
| BLAKE2b-256 |
91cb271213834824af925241dc0f51defdd26c06e1a46f28cb0f6dd207ab0482
|
Provenance
The following attestation bundles were made for sugarai-1.7.0.tar.gz:
Publisher:
release.yml on cdnsteve/sugar
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sugarai-1.7.0.tar.gz -
Subject digest:
2ad4b80bbd78d2fc13ee9ad820149479a6ee87d20c85a6f4f116c1005d33914a - Sigstore transparency entry: 430286655
- Sigstore integration time:
-
Permalink:
cdnsteve/sugar@7835fa162e3bf92073f8f4a19143404903ceae3d -
Branch / Tag:
refs/tags/v1.7.0 - Owner: https://github.com/cdnsteve
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7835fa162e3bf92073f8f4a19143404903ceae3d -
Trigger Event:
push
-
Statement type:
File details
Details for the file sugarai-1.7.0-py3-none-any.whl.
File metadata
- Download URL: sugarai-1.7.0-py3-none-any.whl
- Upload date:
- Size: 89.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c898f28ca8242efff16b2dc43394de0ae743c49a813e53f0bca283ddced65cb9
|
|
| MD5 |
5b36ed0d764c8ab2622e1416924b0499
|
|
| BLAKE2b-256 |
eac37a2fb7f62bab1ebd268cce02c7669b35222312585770f566b41812f051b2
|
Provenance
The following attestation bundles were made for sugarai-1.7.0-py3-none-any.whl:
Publisher:
release.yml on cdnsteve/sugar
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sugarai-1.7.0-py3-none-any.whl -
Subject digest:
c898f28ca8242efff16b2dc43394de0ae743c49a813e53f0bca283ddced65cb9 - Sigstore transparency entry: 430286677
- Sigstore integration time:
-
Permalink:
cdnsteve/sugar@7835fa162e3bf92073f8f4a19143404903ceae3d -
Branch / Tag:
refs/tags/v1.7.0 - Owner: https://github.com/cdnsteve
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7835fa162e3bf92073f8f4a19143404903ceae3d -
Trigger Event:
push
-
Statement type: