Skip to main content

Persistent memory for AI coding agents. Cross-session context, global knowledge, and autonomous task execution.

Project description

🍰 Sugar

Persistent memory for AI coding agents.

Sugar gives your AI agents memory that persists across sessions and projects. It remembers your decisions, patterns, and preferences so you stop re-explaining context every time you open a new session. The task queue builds on top of that memory layer to run work autonomously while you focus on other things.

What Sugar Does

Every AI coding session starts cold. You explain the same architectural decisions, re-describe the same error patterns, and re-establish the same preferences - over and over.

Sugar fixes that. It stores what matters and surfaces it when relevant:

  • Project memory - Decisions, preferences, error patterns, and research stored per-project
  • Global memory - Standards and guidelines shared across every project you work on
  • 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.8)

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/sugar.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

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
Other installation methods

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

Requirements

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


Sugar is provided "AS IS" without warranty. Review all AI-generated code before use.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sugarai-3.9.0.tar.gz (359.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sugarai-3.9.0-py3-none-any.whl (295.7 kB view details)

Uploaded Python 3

File details

Details for the file sugarai-3.9.0.tar.gz.

File metadata

  • Download URL: sugarai-3.9.0.tar.gz
  • Upload date:
  • Size: 359.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sugarai-3.9.0.tar.gz
Algorithm Hash digest
SHA256 1d32400d325860d49fa25f57d276294f5d291f1bea9a6d4bc22380a6ed10f365
MD5 103d8c15553e9d31e10168719e7c5d37
BLAKE2b-256 5a84e26c1b07d239867ba8bb46c64da466d413537c7811d638435946262638fc

See more details on using hashes here.

Provenance

The following attestation bundles were made for sugarai-3.9.0.tar.gz:

Publisher: release.yml on roboticforce/sugar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sugarai-3.9.0-py3-none-any.whl.

File metadata

  • Download URL: sugarai-3.9.0-py3-none-any.whl
  • Upload date:
  • Size: 295.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sugarai-3.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 73a934c4c94695223e26998ecab0db172b49293433954f9fb6c7738025dba836
MD5 401ef8f04e7a4a7c41cc9d501c49c788
BLAKE2b-256 16552b385fe5adc4922fce54a9cc875f5e6f6d3d23504f56edbf514a26251037

See more details on using hashes here.

Provenance

The following attestation bundles were made for sugarai-3.9.0-py3-none-any.whl:

Publisher: release.yml on roboticforce/sugar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page