什么是 Sugar?
具备持久化任务队列与后台执行能力的自主式 AI 开发系统,可持续处理开发任务而不中断。
README
Sugar
Autonomous issue resolution for AI-assisted development.
<!-- mcp-name: io.github.cdnsteve/sugar -->Security scanners find vulnerabilities. Dependabot opens issues. Copilot flags problems. Sugar reads the issue, writes the fix, runs the tests, and opens the PR.
- Discovers - watches your GitHub repo for labeled issues (security, bug, dependabot)
- Resolves - reads each issue and implements a fix using Claude
- Verifies - runs your test suite and quality gates before committing
- Ships - opens a PR referencing the original issue, ready for your review
No issue left sitting in a backlog waiting for someone to have time.
How Sugar Compares
Most AI dev tools stop at the discovery layer:
GitHub Copilot CLI -> scan -> open issues
Snyk -> scan -> open issues
Dependabot -> scan -> open issues
Sugar is the resolution layer:
Labeled issue appears on GitHub
-> Sugar picks it up (label filter: "security", "dependabot", "bug")
-> AI agent reads the issue, analyzes the affected code
-> Fix implemented, tests run locally
-> PR opened - you review and merge
Configure which labels Sugar watches, point it at your repo, and run sugar run.
See workflow examples for security auto-fix, bug triage, test coverage, and more.
What Sugar Does
Sugar combines persistent memory with autonomous task execution:
- Project memory - Decisions, preferences, error patterns, and research stored per-project
- Global memory - Standards and guidelines shared across every project you work on
- GitHub integration - Watches for labeled issues and resolves them autonomously
- Semantic search - Retrieve relevant context by meaning, not just keywords
- MCP integration - Your AI agent reads and writes memory directly during sessions
- Task queue - Hand off work to run autonomously, powered by the same memory layer
Quick Start
# Install once, use in any project
pipx install sugarai
# Initialize in your project
cd ~/dev/my-app
sugar init
# Store what you know
sugar remember "We use async/await everywhere, never callbacks" --type preference
sugar remember "JWT tokens use RS256, expire in 15 min - see auth/tokens.py" --type decision
sugar remember "When tests fail with import errors, check __init__.py exports first" --type error_pattern
# Retrieve it later
sugar recall "authentication"
sugar recall "how do we handle async"
Your AI agent can also read and write memory directly - no copy-pasting required.
MCP Integration
Connect Sugar's memory to your AI agent so it can access project context automatically.
Claude Code - Memory server (primary):
claude mcp add sugar -- sugar mcp memory
Claude Code - Task server (optional):
claude mcp add sugar-tasks -- sugar mcp tasks
Once connected, Claude can call store_learning to save context mid-session and search_memories to pull relevant knowledge before starting work. The memory server works from any directory - global memory is always available even outside a Sugar project.
Other MCP clients (Goose, Claude Desktop):
# Goose
goose configure
# Select "Add Extension" -> "Command-line Extension"
# Name: sugar
# Command: sugar mcp memory
# OpenCode - one command setup
sugar opencode setup
Global Memory (New in 3.9)
Some knowledge belongs to you, not just one project. Coding standards, preferred patterns, security practices - these should follow you everywhere.
# Store a guideline that applies to all your projects
sugar remember "Always validate and sanitize user input before any DB query" \
--type guideline --global
sugar remember "Use conventional commits: feat/fix/chore/docs/test" \
--type guideline --global
# View your global guidelines
sugar recall "security" --global
sugar memories --global
# Search works project-first, but guidelines always surface
sugar recall "database queries"
# Returns: project-specific memories + relevant global guidelines
Global memory lives at ~/.sugar/memory.db. Project memory lives at .sugar/memory.db. When you search, project context wins - but guideline type memories from global always appear in results so your standards stay visible.
Via MCP, pass scope: "global" to store_learning to save cross-project knowledge directly from your AI session.
Memory types: decision, preference, file_context, error_pattern, research, outcome, guideline
Full docs: Memory System Guide
How Memory Works
Sugar uses two SQLite databases and a tiered search strategy.
Two stores:
- Project store (
.sugar/memory.db) - context specific to one project - Global store (
~/.sugar/memory.db) - knowledge that applies everywhere
Seven memory types, each with different retrieval behavior:
| Type | Purpose | TTL |
|---|---|---|
decision | Architecture and implementation choices | Never |
preference | How you like things done | Never |
file_context | What files and modules do | Never |
error_pattern | Bugs and their fixes | 90 days |
research | API docs, library findings | 60 days |
outcome | What worked, what didn't | 30 days |
guideline | Cross-project standards and best practices | Never |
Search strategy - project-first with reserved guideline slots:
- Search the project store first (local context always wins)
- Reserve slots for global guidelines (cross-project standards always surface)
- Fill remaining slots with other global results
- Deduplicate across both stores
This means a mature project's local context dominates results. A new project with no local memory gets global knowledge automatically. And your guidelines are always visible regardless.
Search engine: Semantic search via sentence-transformers (all-MiniLM-L6-v2, 384-dim vectors) with sqlite-vec. Falls back to SQLite FTS5 keyword search, then LIKE queries. No external API calls - everything runs locally.
# Install with semantic search (recommended)
pipx install 'sugarai[memory]'
# Works without it too - just uses keyword matching
pipx install sugarai
MCP tools available to your AI agent:
| Tool | What it does |
|---|---|
search_memory | Search both stores, returns results with scope labels |
store_learning | Save a memory (pass scope: "global" for cross-project) |
recall | Get formatted markdown context for a topic |
get_project_context | Full project summary including global guidelines |
list_recent_memories | Browse recent memories by type |
MCP resources:
sugar://project/context- project summarysugar://preferences- coding preferencessugar://global/guidelines- cross-project standards
Task Queue
The task queue lets you hand off work and let it run autonomously. It reads from the same memory store, so Sugar already knows your preferences and patterns before it starts.
# Add tasks
sugar add "Fix authentication timeout" --type bug_fix --urgent
sugar add "Add user profile settings" --type feature
# Start the autonomous loop
sugar run
Sugar picks up tasks, executes them with your configured AI agent, runs tests, commits working code, and moves to the next task. It runs until the queue is empty or you stop it.
Delegate from Claude Code mid-session:
/sugar-task "Fix login timeout" --type bug_fix --urgent
Advanced task options:
# Orchestrated execution (research -> plan -> implement -> review)
sugar add "Add OAuth authentication" --type feature --orchestrate
# Iterative mode - loops until tests pass
sugar add "Implement rate limiting" --ralph --max-iterations 10
# Check queue status
sugar list
sugar status
Full docs: Task Orchestration
Supported AI Tools
Works with any CLI-based AI coding agent:
| Agent | Memory MCP | Task MCP | Notes |
|---|---|---|---|
| Claude Code | Yes | Yes | Full support |
| OpenCode | Yes | Yes | sugar opencode setup |
| Goose | Yes | Yes | Via MCP |
| Aider | Via CLI | Via CLI | Manual recall |
Installation
Recommended: pipx - installs once, available everywhere, no venv conflicts:
pipx install sugarai
Upgrade / Uninstall:
pipx upgrade sugarai
pipx uninstall sugarai
pip (requires venv activation each session)
pip install sugarai
uv
uv pip install sugarai
With semantic search (recommended for memory):
pipx install 'sugarai[memory]'
With GitHub integration:
pipx install 'sugarai[github]'
All features:
pipx install 'sugarai[all]'
Sugar is project-local by default. Each project gets its own .sugar/ folder with its own database and config. Global memory lives at ~/.sugar/. Like git - one installation, per-project state.
Project Structure
~/.sugar/
└── memory.db # Global memory (guidelines, cross-project knowledge)
~/dev/my-app/
├── .sugar/
│ ├── sugar.db # Project memory + task queue
│ ├── config.yaml # Project settings
│ └── prompts/ # Custom agent prompts
└── src/
Recommended .gitignore:
.sugar/sugar.db
.sugar/sugar.log
.sugar/*.db-*
Commit .sugar/config.yaml and .sugar/prompts/ to share settings with your team.
Configuration
.sugar/config.yaml is created on sugar init:
sugar:
dry_run: false
loop_interval: 300
max_concurrent_work: 3
claude:
enable_agents: true
discovery:
github:
enabled: true
repo: "user/repository"
Documentation
- Quick Start
- Memory System
- CLI Reference
- Task Orchestration
- Goose Integration
- OpenCode Integration
- GitHub Integration
- Configuration Guide
- Troubleshooting
Requirements
- Python 3.11+
- A CLI-based AI agent: Claude Code, OpenCode, Aider, or similar
Contributing
Contributions welcome. See CONTRIBUTING.md.
git clone https://github.com/roboticforce/sugar.git
cd sugar
uv pip install -e ".[dev,test,github]"
pytest tests/ -v
License
Dual License: AGPL-3.0 + Commercial
- Open Source (AGPL-3.0): Free for open source and personal use
- Commercial License: For proprietary use - sugar.roboticforce.io/licensing
Sugar is provided "AS IS" without warranty. Review all AI-generated code before use.
常见问题
Sugar 是什么?
具备持久化任务队列与后台执行能力的自主式 AI 开发系统,可持续处理开发任务而不中断。
相关 Skills
技能工坊
by anthropics
覆盖 Skill 从创建到迭代优化全流程:起草能力、补测试提示、跑评测与基准方差分析,并持续改写内容和描述,提升效果与触发准确率。
✎ 技能工坊把技能从创建、迭代到评测串成闭环,方差分析加描述优化,特别适合把触发准确率打磨得更稳。
PPT处理
by anthropics
处理 .pptx 全流程:创建演示文稿、提取和解析幻灯片内容、批量修改现有文件,支持模板套用、合并拆分、备注评论与版式调整。
✎ 涉及PPTX的创建、解析、修改到合并拆分都能一站搞定,连备注、模板和评论也能处理,做演示文稿特别省心。
PDF处理
by anthropics
遇到 PDF 读写、文本表格提取、合并拆分、旋转加水印、表单填写或加解密时直接用它,也能提取图片、生成新 PDF,并把扫描件通过 OCR 变成可搜索文档。
✎ PDF杂活别再来回切工具了,文本表格提取、合并拆分到OCR识别一次搞定,连扫描件也能变可搜索。
相关 MCP Server
文件系统
编辑精选by Anthropic
Filesystem 是 MCP 官方参考服务器,让 LLM 安全读写本地文件系统。
✎ 这个服务器解决了让 Claude 直接操作本地文件的痛点,比如自动整理文档或生成代码文件。适合需要自动化文件处理的开发者,但注意它只是参考实现,生产环境需自行加固安全。
by wonderwhy-er
Desktop Commander 是让 AI 直接执行终端命令、管理文件和进程的 MCP 服务器。
✎ 这工具解决了 AI 无法直接操作本地环境的痛点,适合需要自动化脚本调试或文件批量处理的开发者。它能让你用自然语言指挥终端,但权限控制需谨慎,毕竟让 AI 执行 rm -rf 可不是闹着玩的。
EdgarTools
编辑精选by dgunning
EdgarTools 是无需 API 密钥即可解析 SEC EDGAR 财报的开源 Python 库。
✎ 这个工具解决了金融数据获取的痛点——直接让 AI 读取结构化财报,比如让 Claude 分析苹果的 10-K 文件。适合量化分析师或金融开发者快速构建数据管道。但注意,它依赖 SEC 网站稳定性,高峰期可能延迟。