Skip to content

Comments

refactor(agents): replace built-in LangGraph agent with OpenCode binary + add plugin system#121

Open
amdmax wants to merge 8 commits intomainfrom
refactor/relocate-skills-module
Open

refactor(agents): replace built-in LangGraph agent with OpenCode binary + add plugin system#121
amdmax wants to merge 8 commits intomainfrom
refactor/relocate-skills-module

Conversation

@amdmax
Copy link
Collaborator

@amdmax amdmax commented Feb 3, 2026

Summary

  • Replace the built-in codemie-code LangGraph ReAct agent with a lightweight wrapper around the @codemieai/codemie-opencode binary via BaseAgentAdapter, reusing lifecycle hooks (beforeRun, enrichArgs, onSessionEnd) with agent-specific metrics (clientType: 'codemie-code')
  • Add a complete plugin system with marketplace integration, enabling skill sharing via plugins compatible with Claude Code's official plugin format
  • Harden plugin system with path traversal protection, improved logging, async parallelization, and type safety fixes

Key Changes

OpenCode Integration

  • codemie-code now delegates to @codemieai/codemie-opencode (v0.0.41) instead of running its own LangGraph agent
  • New codemie-opencode.plugin.ts with binary resolution, lifecycle hooks, and session metrics
  • CLI --task shortcut updated to use registry dispatch
  • Removed init command guard for the built-in agent

Plugin System

  • Core: PluginRegistry, PluginLoader, PluginDiscovery, PluginManifestParser for discovering/loading plugins from ~/.codemie/plugins/
  • Marketplace: MarketplaceClient, MarketplaceRegistry, PluginInstaller for GitHub-based plugin marketplaces (default: anthropics/claude-plugins-official)
  • CLI: codemie plugin commands — list, install, uninstall, update, search, info
  • Skills: Extended SkillDiscovery to load skills from installed plugins with namespaced /plugin:skill pattern

Testing

  • 95 unit tests across 6 new test files covering plugin validation, binary resolution, registry singleton, plugin classes, and lifecycle hooks

Test plan

  • Verify codemie CLI launches the OpenCode binary instead of the old LangGraph agent
  • Verify codemie plugin list/install/search commands work
  • Verify namespaced skill invocation (/plugin:skill) resolves correctly
  • Run npm test — all unit tests pass

Add a complete plugin system that enables skill sharing via plugins:

- Plugin discovery, loading, and registry (PluginRegistry, PluginLoader)
- Marketplace integration with Anthropic's claude-plugins-official repo
- Plugin CLI commands: list, install, uninstall, update, search, info
- Skill discovery from plugins with namespaced pattern support (/plugin:skill)
- Compatible with Claude Code's .claude-plugin/plugin.json format

The plugin system allows users to:
- Search and install plugins from the official Anthropic marketplace
- Discover skills from installed plugins automatically
- Use namespaced skill invocation (e.g., /example-plugin:example-skill)
- Manage plugins via `codemie plugin` CLI commands

Generated with AI

Co-Authored-By: AI/Run CodeMie <noreply@codemieai.com>
@amdmax amdmax force-pushed the refactor/relocate-skills-module branch from fc53203 to b99a4ca Compare February 3, 2026 18:22
Maksym Diabin and others added 4 commits February 10, 2026 16:33
…mprovements

- Add path traversal protection via validatePluginName and isPathWithinDirectory checks
- Replace silent catch blocks with logger.debug() for consistent error diagnostics
- Migrate console.error to logger.error in MarketplaceClient
- Fix broken dynamic import of exec.js with static import from processes.ts
- Improve type safety by replacing `as any` with proper ReadableStream type
- Add null check for response.body before Readable.fromWeb
- Parallelize dev plugin discovery with Promise.all instead of sequential await

Generated with AI

Co-Authored-By: AI/Run CodeMie <noreply@codemieai.com>
…binary wrapper

codemie-code now wraps the @codemieai/codemie-opencode binary via BaseAgentAdapter
instead of using the built-in LangGraph ReAct agent. Reuses lifecycle hooks from
CodemieOpenCodePluginMetadata (beforeRun, enrichArgs) with agent-specific onSessionEnd
for metrics (clientType: 'codemie-code'). Updates CLI --task shortcut to use registry
dispatch and removes init command guard for the built-in agent.

Generated with AI

Co-Authored-By: AI/Run CodeMie <codemie.ai@gmail.com>
Cover plugin validation, binary resolution, registry singleton, plugin
classes, and lifecycle hooks (beforeRun, enrichArgs, onSessionEnd) with
95 tests across 6 new test files.

Generated with AI

Co-Authored-By: AI/Run CodeMie <codemie.ai@gmail.com>
Generated with AI

Co-Authored-By: AI/Run CodeMie <codemie.ai@gmail.com>
@amdmax amdmax changed the title feat(cli): add plugin system with marketplace integration refactor(agents): replace built-in LangGraph agent with OpenCode binary + add plugin system Feb 19, 2026
Resolved conflict in src/cli/commands/hook.ts: kept both the
config parameter addition to sendSessionStartMetrics (from main)
and the syncSkillsToClaude call + function (from this branch).

Generated with AI

Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
@amdmax amdmax requested review from 8nevil8 and TarasSpashchenko and removed request for 8nevil8 February 19, 2026 17:10
Maksym Diabin and others added 2 commits February 19, 2026 18:21
Normalize path separators in isPathWithinDirectory mocks instead of
using naive startsWith comparison, which fails on Windows where
path.join() produces backslash paths.

Generated with AI

Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
DRY up duplicated path normalization logic into a single
mockIsPathWithin constant reused by both vi.mock factory and beforeEach.

Generated with AI

Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant