Skip to content

feat: implement register_command() on plugin context #10495

@stephenschoettler

Description

@stephenschoettler

Summary

The plugin context (ctx) has no register_command() method, but it's referenced in tests and expected by plugins that want to provide slash commands.

tests/hermes_cli/test_plugins.py:608 has:

# NOTE: TestPluginCommands removed – register_command() was never implemented

Use Case

Context engine plugins (and other plugins) need a way to register slash commands for diagnostics and management. For example, hermes-lcm registers /lcm for status, health checks, and backup — but it silently falls back because the API doesn't exist:

register_command = getattr(ctx, "register_command", None)
if callable(register_command):
    register_command(
        "lcm",
        lambda raw_args: handle_lcm_command(raw_args, engine),
        description="LCM status and diagnostics",
    )

Proposed API

ctx.register_command(
    name: str,           # command name (e.g. "lcm")
    handler: Callable,   # fn(raw_args: str) -> str
    description: str,    # shown in /help
)

This follows the same pattern as ctx.register_context_engine() and ctx.register_tool() — extend the plugin context with a new registration method, wire it into the CLI/TUI command dispatcher.

Context

  • hermes-lcm has a working /lcm command implementation (command.py) with full test coverage, ready to go once this API lands
  • lossless-claw has a similar /lossless command surface in OpenClaw

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions