Skip to content

Extension Points

Commander is designed to be extended at every layer.

Plugin System (19 Hook Points)

HookWhen It Fires
beforeLLMCallBefore every LLM request
afterLLMCallAfter every LLM request
beforeToolCallBefore every tool execution
afterToolCallAfter every tool execution
onAgentCompleteAgent run finished
onErrorRun failed

Hooks can block, modify, or observe the execution.

Extension Interfaces

Custom LLM Provider

typescript
class MyProvider implements LLMProvider {
  async call(messages: Message[], options: CallOptions): Promise<LLMResponse> {
    // Your implementation
  }
}
runtime.registerProvider('my-provider', new MyProvider());

Custom Tool

typescript
class MyTool implements Tool {
  name = 'my-tool';
  async execute(ctx: ToolContext, args: any): Promise<ToolResult> {
    // Your implementation
  }
}
runtime.registerTool('my-tool', new MyTool());

Custom Topology

Add a new case in topologyRouter.ts to define a new orchestration pattern.

Channel Adapter

typescript
class TelegramAdapter implements ChannelAdapter {
  // Telegram integration
}

Plugin

typescript
class MyPlugin implements CommanderPlugin {
  hooks = {
    beforeLLMCall: async (params) => { /* modify params */ },
    afterToolCall: async (result) => { /* observe result */ },
  };
}
getHookManager().register(new MyPlugin());

Meta-Learner

Commander includes a self-evolution system based on Thompson Sampling + Reflexion:

  • Tracks which strategies work best over time
  • Automatically adjusts topology selection
  • Learns from failures and successes across runs

MIT Licensed — Built for multi-agent orchestration.