feat: Add OpenCode integration for bidirectional AI agent communication#59
Merged
feat: Add OpenCode integration for bidirectional AI agent communication#59
Conversation
Implements full OpenCode integration as designed in the research phases: Phase 1 - MCP Task Server: - New sugar/mcp/task_server.py with 6 MCP tools for task management - Tools: sugar_add_task, sugar_list_tasks, sugar_view_task, etc. - CLI command: sugar mcp tasks Phase 2 - TypeScript OpenCode Plugin: - New packages/opencode-plugin/ with tools, hooks, and slash commands - 8 custom tools for Sugar task management - Session lifecycle hooks for memory injection Phase 3 - Python SDK Integration: - New sugar/integrations/opencode/ module - OpenCodeClient for HTTP communication with aiohttp - OpenCodeConfig with env and sugar.yaml support - Data models: Session, Message, Event, NotificationLevel Phase 4 - Memory Context Injection: - ContextInjector with multi-factor relevance scoring - LearningCapture for extracting learnings from sessions - Token budget management (2000 session, 800 prompt, 300 error) Execution Integration: - OpenCodeNotifier for fire-and-forget task notifications - Integrated into AgentSDKExecutor for task lifecycle events - Non-blocking notifications on start, complete, and fail CLI Commands: - sugar opencode status - Check integration status - sugar opencode test - Test server connection - sugar opencode notify - Send test notification Tests: 86 new tests (41 MCP + 45 OpenCode integration)
- Add Native AI Agent Integrations section at top - Add OpenCode Integration section with setup instructions - Update Features section to highlight integrations - Add tagline for v3.5 milestone release
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
Phase 1 - MCP Task Server
sugar/mcp/task_server.pywith tools:sugar_add_task,sugar_list_tasks,sugar_view_task,sugar_update_task,sugar_task_status,sugar_remove_tasksugar mcp tasksPhase 2 - TypeScript OpenCode Plugin
packages/opencode-plugin/packagePhase 3 - Python SDK Integration
sugar/integrations/opencode/moduleOpenCodeClient- async HTTP client with aiohttpOpenCodeConfig- configuration from env vars or sugar.yamlSession,Message,Event,NotificationLevelPhase 4 - Memory Context Injection
ContextInjectorwith multi-factor relevance scoring (semantic, recency, importance, frequency, type)LearningCapturefor extracting decisions, preferences, and error patternsExecution Integration
OpenCodeNotifierfor fire-and-forget task notificationsAgentSDKExecutorfor task lifecycle eventsCLI Commands
sugar opencode status- Check integration statussugar opencode test- Test server connectionsugar opencode notify- Send test notificationDependencies
opencodeoptional dependency group with aiohttpallgroup to include opencodeTest Plan
sugar opencode status)