{"_id":"@codefilabs/channel-routing","_rev":"2-3e1453260ed11c4a934882fb083e8878","name":"@codefilabs/channel-routing","dist-tags":{"latest":"0.2.0"},"versions":{"0.2.0":{"name":"@codefilabs/channel-routing","version":"0.2.0","keywords":["claude","tmux","telegram","ai","routing","sessions","channel"],"author":{"name":"CodefiLabs"},"license":"MIT","_id":"@codefilabs/channel-routing@0.2.0","maintainers":[{"name":"kevnk","email":"kevin@truefrontierapps.com"}],"homepage":"https://github.com/CodefiLabs/channel-routing","bugs":{"url":"https://github.com/CodefiLabs/channel-routing/issues"},"dist":{"shasum":"fc6d79fdcee35edd63e62808a6f99fc268d39d07","tarball":"https://registry.npmjs.org/@codefilabs/channel-routing/-/channel-routing-0.2.0.tgz","fileCount":22,"integrity":"sha512-x49nsfQSx9KTV4H44US6ubbthXYtKOr4aChfWQhRlGliy3uMen/tm9iU/djRdKt7auY/jUcCn7ZA+Q5RXo+j5g==","signatures":[{"sig":"MEYCIQDqcBhcnktSLrAFrZFF9pGUhieI11FkcNRpb7l7cNxA2gIhAODrQEXvOprs7bislzq2PatincXJry0RCbrWqU9cPagS","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":32438},"gitHead":"8d8d2d01f9bfa335b8936e58a4088275a35a6c37","_npmUser":{"name":"kevnk","email":"kevin@truefrontierapps.com"},"repository":{"url":"git+https://github.com/CodefiLabs/channel-routing.git","type":"git"},"_npmVersion":"11.5.2","description":"Route Telegram messages to multiple Claude Code tmux sessions with AI-powered semantic routing.","directories":{},"_nodeVersion":"24.7.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/channel-routing_0.2.0_1776101924940_0.9334821012018242","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Deprecated — this package is no longer maintained."}},"time":{"created":"2026-04-13T17:38:44.876Z","modified":"2026-05-14T18:09:29.558Z","0.2.0":"2026-04-13T17:38:45.072Z"},"bugs":{"url":"https://github.com/CodefiLabs/channel-routing/issues"},"author":{"name":"CodefiLabs"},"license":"MIT","homepage":"https://github.com/CodefiLabs/channel-routing","keywords":["claude","tmux","telegram","ai","routing","sessions","channel"],"repository":{"url":"git+https://github.com/CodefiLabs/channel-routing.git","type":"git"},"description":"Route Telegram messages to multiple Claude Code tmux sessions with AI-powered semantic routing.","maintainers":[{"name":"kevnk","email":"kevin@truefrontierapps.com"}],"readme":"# channel-routing\n\nA Claude Code plugin that routes Telegram messages to multiple parallel Claude Code sessions using AI-powered semantic routing.\n\nSend a message in Telegram. The router reads your intent, finds (or spawns) the right Claude Code session, and injects the message — no channel-picking required.\n\n## How It Works\n\n```\nTelegram message\n    |\n    v\nOrchestrator skill (AI routing decision)\n    |\n    +---> Existing session? --> /route to tmux pane\n    |\n    +---> New topic? ---------> /spawn new session\n    |\n    +---> Ambiguous? ---------> Ask user on Telegram\n    |\n    v\nChild session works, replies via /reply-back\n    |\n    v\nTelegram reply\n```\n\n1. **You send a message** in Telegram\n2. **The orchestrator** reads active sessions and recent message history, then decides: route to an existing session or spawn a new one\n3. **Child sessions** run as full interactive `claude` instances in tmux panes — same tools, plugins, and MCP servers you'd have at the terminal\n4. **Sessions reply** back to Telegram when they have results\n\n## Install\n\n```bash\n# Add the CodefiLabs marketplace\n/plugin marketplace add CodefiLabs/marketplace\n\n# Install the plugin\n/plugin install channel-routing@CodefiLabs/marketplace\n```\n\nRequires the official [Telegram channel plugin](https://github.com/anthropics/claude-plugins-official/tree/main/external_plugins/telegram) to be configured first.\n\n### Dependencies\n\n- `tmux`\n- `jq`\n- `curl`\n- `bash` 4.0+\n\n## Usage\n\n### Toggle routing mode\n\nFrom Telegram or the CLI:\n\n```\ncr on       # Start routing messages to sessions\ncr off      # Stop routing, messages go to this session\ncr status   # Show active/suspended sessions\n```\n\n### Commands\n\n| Command | Description |\n|---------|-------------|\n| `/cr on\\|off\\|status` | Toggle routing mode |\n| `/spawn <slug> [--cwd <path>] [--desc \"...\"] [--prompt \"...\"]` | Create a child session |\n| `/route <slug> <message>` | Send a message to a session |\n| `/wakeup <slug>` | Wake up a suspended session |\n| `/stop <slug>` | Stop a session |\n| `/sessions` | List all sessions |\n| `/reply-back <text>` | Send a response to Telegram (used by child sessions) |\n\n### Example\n\n```\nYou (Telegram): Fix the auth middleware in project-a\n  --> Router spawns session \"fix-auth-middleware\" in ~/Sites/codefi/project-a\n\nYou (Telegram): Also update the landing page copy\n  --> Router spawns session \"update-landing-page\" in ~/Sites/codefi/marketing\n\nYou (Telegram): Actually make the error message friendlier\n  --> Router routes to \"fix-auth-middleware\" (related to auth work)\n```\n\n## Architecture\n\n### Routing\n\nThe orchestrator skill uses semantic analysis to match messages to sessions:\n\n- **Strong match**: message mentions a project/topic an active session is working on\n- **Weak match**: same domain, recent activity\n- **No match**: clearly a new topic — spawn a new session\n- **Ambiguous**: ask the user on Telegram before routing\n\n### Sessions\n\nEach child session is a full `claude` CLI process in a tmux pane with:\n- `CR_SLUG` and `CR_CHAT_ID` environment variables for identity\n- A `SessionEnd` hook that logs suspension to the manifest\n- Access to all your plugins, MCP servers, and tools\n\n### State\n\nAll state lives in `~/.channel-routing/`:\n\n| File | Format | Purpose |\n|------|--------|---------|\n| `active` | Timestamp | Sentinel — exists when routing is on |\n| `manifest.jsonl` | JSONL | Session lifecycle events (spawn, route, suspend, resume) |\n| `messages.jsonl` | JSONL | All routed and replied messages |\n| `projects.json` | JSON | Saved project-name-to-path mappings |\n\n### Health checks\n\nA background verification script runs 30 seconds after each spawn/route to confirm the tmux pane is alive and not stuck on an error.\n\n## Plugin structure\n\n```\nchannel-routing/\n  .claude-plugin/plugin.json\n  commands/          # Slash command definitions\n  skills/\n    orchestrator/    # AI routing logic\n    reply-back/      # Child session reply capability\n  scripts/           # Bash implementations (cr-spawn, cr-route, etc.)\n  hooks/             # PostToolUse hook for message logging\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}