Claude Code Plugin

Sugar has native Claude Code integration, allowing you to delegate work directly from your Claude Code sessions.

Installation

Install the Sugar plugin in Claude Code:

/plugin install roboticforce/sugar

Available Commands

/sugar-task

Create tasks with rich context directly from Claude Code:

/sugar-task "Fix authentication timeout" --type bug_fix --urgent

With rich context:

/sugar-task "User Dashboard Redesign" --json --description '{
  "priority": 5,
  "type": "feature",
  "context": "Complete overhaul of user dashboard",
  "technical_requirements": [
    "React 18 with TypeScript",
    "Responsive design",
    "Real-time data updates"
  ],
  "success_criteria": [
    "Dashboard loads in < 2 seconds",
    "Mobile responsive on all breakpoints"
  ]
}'

/sugar-status

Check Sugar's current status and queue:

/sugar-status

/sugar-run

Start Sugar's autonomous execution:

/sugar-run              # Start continuous execution
/sugar-run --once       # Run single cycle
/sugar-run --dry-run    # Safe mode - show what would be done

/sugar-review

Review and manage the task queue:

/sugar-review

/sugar-analyze

Analyze codebase for potential work:

/sugar-analyze          # Full analysis
/sugar-analyze --errors # Focus on error logs

Specialized Agents

Sugar includes specialized AI agents for different tasks:

Sugar Orchestrator

Primary coordination and workflow management:

  • Complex workflow orchestration
  • Multi-agent coordination
  • Quality assurance oversight

Task Planner

Strategic planning and task breakdown:

  • Requirements analysis
  • Task decomposition
  • Architecture planning

Quality Guardian

Code quality and testing enforcement:

  • Code quality review
  • Testing validation
  • Security auditing

Workflow Example

Delegate work while you continue coding:

# During a Claude Code session...

You: "I'm working on the checkout flow but found some test failures.
      Can you handle fixing those while I continue here?"

Claude: "I'll create a Sugar task for the test fixes."

/sugar-task "Fix checkout test failures" --type test --urgent

# Sugar picks up the task and works on it in the background
# You continue your work in Claude Code

# Later, check progress:
/sugar-status

MCP Server Integration

Sugar includes an MCP (Model Context Protocol) server for integration with Goose and other MCP-compatible clients:

# Option 1: Built-in Python MCP Server
# First install MCP dependencies:
pip install sugarai[mcp]

# Then start the server:
sugar mcp serve --port 8080

# Option 2: Configure in Claude Code MCP settings
{
  "mcpServers": {
    "sugar": {
      "command": "sugar",
      "args": ["mcp", "serve", "--port", "8080"]
    }
  }
}

Available MCP Tools:

  • analyze_issue - Analyze GitHub issues and return insights
  • search_codebase - Search for patterns in the codebase
  • validate_response - Validate AI-generated responses
  • find_similar_issues - Find related issues in GitHub

This enables:

  • Real-time task queue access
  • Direct task manipulation from prompts
  • System status monitoring
  • Seamless tool integration with Goose and other MCP clients

See CLI Reference for full command options.

Best Practices

When to Delegate

  • Bug fixes that aren't blocking your current work
  • Test writing for code you just completed
  • Documentation updates
  • Refactoring tasks in other parts of the codebase

Provide Context

The more context you provide, the better Sugar can execute:

/sugar-task "Fix memory leak" --json --description '{
  "context": "Memory grows unbounded in production after 24 hours",
  "suspected_cause": "Cache not being cleared properly",
  "files_to_check": ["src/cache.ts", "src/services/dataService.ts"],
  "success_criteria": ["Memory stable over 48 hours", "All existing tests pass"]
}'

Review Results

Always review Sugar's completed work:

/sugar-status
/sugar-review

Troubleshooting

Plugin Not Found

# Make sure to use the full path
/plugin install roboticforce/sugar

Sugar CLI Not Found

Ensure Sugar is installed and in your PATH:

pip install sugarai
which sugar

Tasks Not Executing

Check that Sugar is initialized in your project:

sugar init
sugar status