Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

channel-management

БесплатноЗапускает вложенные скриптыНе проверен

Manage Claude Code --channels sessions (start/stop/status/health) via channel-manager.cjs and terminal-tracker.cjs.

oimiragieoот oimiragieo★ 48 звёзд на GitHub

Об этом скилле

Channel Management

Overview

This skill manages the full lifecycle of a Claude Code --channels session (Telegram bot, Discord bot, or any plugin-based channel integration). It wraps the CLI tools at .claude/tools/cli/channel-manager.cjs and .claude/tools/cli/terminal-tracker.cjs and provides a repeatable, observable workflow for:

  1. Starting a channel session in a new Windows Terminal tab
  2. Stopping a running channel session cleanly
  3. Checking status and PID liveness
  4. Health-checking the session via the terminal tracker

When to Invoke

Skill({ skill: 'channel-management' });

Invoke when:

  • CHANNEL_AUTO_START=true is set and session startup must be verified on agent boot
  • A user or cron job requests manual channel lifecycle management
  • A channel session appears to have crashed and needs restart
  • Diagnosing why Telegram/Discord messages are not being received
  • Inspecting or pruning orphaned channel PID entries

The Iron Law

NEVER start a channel session without checking isChannelRunning() first.
NEVER assume a tracked PID is alive without calling isPidAlive(pid).
NEVER restart after a crash without calling killOrphaned() to prune stale entries.

Workflow

Step 0: Read Memory Context (MANDATORY)

Before executing any lifecycle action, read memory to check for known issues:

node -e "const fs=require('fs');const p='.claude/context/memory/learnings.md';if(fs.existsSync(p))console.log(fs.readFileSync(p,'utf8').split(/\r?\n/).slice(0,80).join('\n'));"

Check .claude/context/memory/issues.md for any known channel startup problems:

node -e "const fs=require('fs');const p='.claude/context/memory/issues.md';if(fs.existsSync(p))console.log(fs.readFileSync(p,'utf8').split(/\r?\n/).slice(0,60).join('\n'));"

Step 1: Check isChannelRunning

Command:

node -e "
const { isChannelRunning, getChannelPid } = require('./.claude/tools/cli/channel-manager.cjs');
const running = isChannelRunning();
const pid = getChannelPid();
console.log(JSON.stringify({ running, pid }));
"

Expected output: {"running":false,"pid":null} (not running) or {"running":true,"pid":12345} (running)

Verify: Exit code 0 and valid JSON printed to stdout.

Decision gate:

  • running: true → Skip Step 2 (already running), proceed to Step 4 (health check)
  • running: false → Continue to Step 2

Step 2: Start Channel Session (if not running)

Pre-condition: Confirm TELEGRAM_BOT_TOKEN is set:

node -e "
require('dotenv').config({ path: '.env' });
const token = process.env.TELEGRAM_BOT_TOKEN;
console.log(token ? 'TOKEN_PRESENT' : 'TOKEN_MISSING');
"

If TOKEN_MISSING: Log to issues.md and abort — channel cannot start without credentials.

Start command:

node -e "
const { startChannel } = require('./.claude/tools/cli/channel-manager.cjs');
const result = startChannel();
console.log(JSON.stringify(result));
"

Expected output: {"ok":true,"pid":12345,"reason":"started"} on success, or {"ok":false,"pid":null,"reason":"TELEGRAM_BOT_TOKEN not set — skipped"} when token missing.

Verify: ok: true in JSON output. Exit code 0.

Step 3: Track PID

After a successful start, confirm the PID is registered in the tracker:

node -e "
const { listTracked } = require('./.claude/tools/cli/terminal-tracker.cjs');
const sessions = listTracked();
const channel = sessions.filter(s => s.purpose === 'channel-session');
console.log(JSON.stringify(channel, null, 2));
"

Expected output: Array containing at least one entry with "status": "active" and a numeric "pid".

Verify: Entry exists with status: "active".

Step 4: Health Check

Confirm the session is alive after startup (or as a standalone health probe):

node -e "
const { isChannelRunning, getChannelPid } = require('./.claude/tools/cli/channel-manager.cjs');
const { listTracked } = require('./.claude/tools/cli/terminal-tracker.cjs');
const running = isChannelRunning();
const pid = getChannelPid();
const tracked = listTracked().find(s => s.purpose === 'channel-session' && s.status === 'active');
console.log(JSON.stringify({
  health: running ? 'OK' : 'DEGRADED',
  pid,
  trackerEntry: tracked || null
}));
"

Expected output: {"health":"OK","pid":12345,"trackerEntry":{...}} when healthy.

Verify: health: "OK" in JSON. If health: "DEGRADED", proceed to Step 5 (restart).

Step 5: Stop Channel Session

Use when explicitly stopping the channel or before a clean restart:

node -e "
const { stopChannel } = require('./.claude/tools/cli/channel-manager.cjs');
const result = stopChannel();
console.log(JSON.stringify(result));
"

Expected output: {"ok":true,"reason":"stopped"} or {"ok":true,"reason":"not-running"}.

Verify: ok: true.

Step 6: Prune Orphaned Entries

After a crash or unexpected shutdown, clean up stale PID entries:

node
Полный SKILL.md на GitHub

Установить channel-management в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Read
Bash
TaskUpdate

Вложенные файлы

commands/channel-management.mdhooks/post-execute.cjshooks/pre-execute.cjsreferences/research-requirements.mdrules/channel-management.mdschemas/input.schema.jsonschemas/output.schema.jsonscripts/main.cjstemplates/implementation-template.md

FAQ

Что делает скилл channel-management?

Manage Claude Code --channels sessions (start/stop/status/health) via channel-manager.cjs and terminal-tracker.cjs.

Как установить скилл channel-management?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл channel-management запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить channel-management с