Skip to content

Claude Code Channel System Documentation

Complete technical analysis of remote Agent control via IM platforms


Documentation

01-channel-system.md — Channel System Architecture

A deep dive into the design and implementation of Claude Code's Channel system from a source code perspective, covering:

  • What is a Channel: Core concepts of IM integration, MCP protocol foundations
  • Architecture Overview: End-to-end message flow, component relationships
  • Message Protocol: Inbound notifications, XML wrapping, outbound tool calls
  • Six-Layer Access Control: Capability → Runtime gate → OAuth → Org policy → Session allowlist → Plugin approval
  • Permission Relay System: Remote tool execution approval, 5-letter request IDs, multi-source racing
  • Plugin Architecture: Channel manifest declarations, user config flow, scoped naming
  • UI Components: Terminal message rendering, status notices, developer warning dialogs
  • Security Design: XML injection prevention, marketplace verification, trust boundary analysis

Target audience: Developers, architects, and plugin authors interested in AI Agent IM integration architecture


Illustrations

All illustrations use dark background (#1a1a2e) with Anthropic brand copper-orange (#D97757) accent color.

ImageDescriptionDocument
01-channel-overview.pngChannel system architecture overviewArchitecture
02-message-flow.pngEnd-to-end message flow: IM → Agent → IMArchitecture
03-access-control.pngSix-layer access control gatesArchitecture
04-permission-relay.pngPermission relay system flowArchitecture

Quick Start

Users

  1. Read the Channel System Architecture
  2. Learn how to start IM integration with --channels
  3. Understand how different platforms (Telegram, Feishu, Discord) connect

Plugin Developers

  1. Read the Plugin Architecture section
  2. Understand the plugin.json Channel declaration format
  3. Implement the MCP Server notifications/claude/channel protocol
  4. Key source files:
    • src/services/mcp/channelNotification.ts — Core gating and message wrapping
    • src/services/mcp/channelPermissions.ts — Permission relay system
    • src/services/mcp/channelAllowlist.ts — Allowlist management
    • src/utils/plugins/mcpPluginIntegration.ts — Plugin MCP integration
    • src/utils/plugins/schemas.ts — Plugin manifest Channel schema

Core Concepts Reference

ConceptDescription
ChannelAn MCP Server declaring claude/channel capability that can push IM messages to the Agent
Channel EntryParsed --channels argument entry, either plugin or server kind
Channel GateSix-layer access control gate deciding whether to register notification handlers
Permission RelayMechanism for forwarding tool execution approval prompts to IM platforms
Channel PluginA plugin declaring channels field in its plugin.json
Scoped NamePlugin server name with scope prefix: plugin:{pluginName}:{serverName}
Short Request ID5-letter permission request identifier generated via FNV-1a hash
Channel Tag<channel> XML tag wrapping IM message content and metadata
Dev ChannelsChannels loaded via --dangerously-load-development-channels for local development
tengu_harborGrowthBook runtime feature flag controlling the Channel system master switch

Released under the MIT License.