-
Notifications
You must be signed in to change notification settings - Fork 108
Description
Problem
When loading plugins via Plugin.load(), markdown files in the commands/ directory are loaded into plugin.commands but are not merged into the agent context as skills. Only files in the skills/ directory become part of the agent's context.
This means Claude Code format plugins that use commands/ (which is the standard location for slash commands) don't work correctly with OpenHands - the agent never receives the command instructions.
Current Behavior
In plugin.py:
_load_skills()loads fromskills/directory_load_commands()loads fromcommands/directory
In conversation_service.py (_merge_plugin_into_request):
- Only
plugin.skillsis merged into the agent context plugin.commandsis ignored
Example
Given a plugin structure:
city-weather/
├── .claude-plugin/
│ └── plugin.json
└── commands/
└── now.md # Weather command instructions
The now.md file is loaded but never added to the agent's skills, so the agent doesn't know how to handle weather requests using the plugin's instructions.
Proposed Solution
Treat markdown files in the commands/ directory as keyword-triggered skills using the Claude Code namespacing format:
- When loading commands from
commands/, convert them toSkillobjects - Set the skill's
triggerto aKeywordTriggerusing the format/<plugin-name>:<command-name> - Merge these command-based skills into the agent context alongside regular skills
Example Trigger Format
For a plugin named city-weather with a command now.md:
- Trigger keyword:
/city-weather:now - When user types
/city-weather:now Tokyo, the skill activates with$ARGUMENTS=Tokyo
Implementation Notes
- In
_load_commands()or a new helper, createSkillobjects fromCommandDefinition - Set
trigger = KeywordTrigger(keywords=["/<plugin-name>:<command-name>"]) - The skill content should include the command's markdown with
$ARGUMENTSplaceholder - In
_merge_plugin_into_request(), merge bothplugin.skillsand the converted commands, but don't duplicate loading of the items in the command directory.
Context
- Related to Plugin Directory feature (#12088 in OpenHands/OpenHands)
- Discovered while testing plugin loading via PR #12338 (app server) and PR feat(agent-server): Support plugin loading when starting conversations #1651 (SDK)
- Claude Code plugins use
commands/as the standard location for slash commands