channel

channel is a command for Claude Code from justhamade/triadjs. It costs 39 tokens per session (918 once invoked), scanned A, original, MIT.

A coding command for adding a WebSocket channel to a TriadJS router. WebSockets keep a live connection between a client and server so they can exchange messages in real time.

In plain words
What is it for?
Use it to create a channel file, define the messages clients send and servers emit, validate connections, manage connection changes, and add message handlers.
Why use it?
It removes the need to manually wire connection setup, message handlers, connection events, and shared channel state. It also checks that the project uses the required Fastify adapter.

Command for Claude Code

Written for Claude Code: $ARGUMENTS substitution.

Part of the triadjs plugin — 10 skills, 8 commands shipped together

Good fit Use it to create a channel file, define the messages clients send and servers emit, validate connections, manage connection changes, and add message handlers.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/justhamade/triadjs/channel
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/justhamade/triadjs

Made for: Claude Code.

Or install triadjs, the plugin that ships this one along with the rest of its 10 skills, 8 commands.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for channel

README.md
[![agentmods](https://agentmods.dev/badge/commands/justhamade/triadjs/channel/github.svg)](https://agentmods.dev/commands/justhamade/triadjs/channel)
Your own site
<a href="https://agentmods.dev/commands/justhamade/triadjs/channel"><img src="https://agentmods.dev/badge/commands/justhamade/triadjs/channel/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for channel

Your own site · 80×15
<a href="https://agentmods.dev/commands/justhamade/triadjs/channel"><img src="https://agentmods.dev/badge/commands/justhamade/triadjs/channel.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 39 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 918 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00039 $0.00918
Opus 5.5 $0.00016 $0.00367
Sonnet 5.5 $0.00008 $0.00184
Haiku 4.5 $0.00004 $0.00092

Measured 2mo ago against content hash 1e5ca1581b18, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

channel scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugin/commands/channel.md · 79 lines

How it starts

The opening of the file, as written. The whole thing — 79 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Load the triad-channel skill for the authoritative channel() signature and state typing rules. Load triad-behaviors for channel-specific assertion phrases.

Add a new WebSocket channel to the project based on the user's description ($ARGUMENTS).

Prerequisites

  1. Confirm the project uses @triadjs/fastify — Express and Hono adapters do NOT support channels. If the project is on a non-Fastify adapter, tell the user and stop.
  2. Install @fastify/websocket if not already present: npm install @fastify/websocket.

Steps

  1. Place the channel in src/channels/<name>.ts.

  2. Define the state interface and use the phantom witness pattern:

    interface ChatRoomState {
      userId: string;
      userName: string;
      roomId: string;
    }
    
    channel({
      state: {} as ChatRoomState, // phantom — value ignored, type used for ctx.state
      // ...
    });
    

    Without the witness, ctx.state is Record<string, any>.

  3. Declare clientMessages (what clients send) and serverMessages (what the server emits). Every clientMessages key must have a matching handlers[key] — missing or extra keys are compile errors.

  4. Implement onConnect — validate the handshake (via schemas or ctx.reject(code, msg)), seed ctx.state, optionally broadcast a join event.

  5. Implement onDisconnect — optionally broadcast a leave event. Don't throw.

  6. Implement per-message handlers — call repositories via ctx.services, then:

    • ctx.broadcast.eventName(payload) to send to everyone including the sender
    • ctx.broadcastOthers.eventName(payload) to exclude the sender
    • ctx.send.eventName(payload) to reply only to this client
  7. If the channel is browser-facing, use auth.strategy: 'first-message' — browsers cannot set custom headers on new WebSocket(). Declare an __auth client message and cast ctx.authPayload inside onConnect.

  8. Add channel behaviors:

    behaviors: [
      scenario('broadcasting a message reaches every client')
        .given('two connected clients')
        .setup(async () => ({ /* ... */ }))
        .when('alice sends a sendMessage')
        .then('all clients receive a message event')
        .and('bob receives a message with text "hello"'),
    ]
    

    Use channel-specific phrases from the triad-behaviors skill — <client> receives a <type> event, all clients receive..., connection is rejected with code N.

Read the full file on GitHub · 79 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2mo ago First seen · 79 lines · 39 tokens per session scan A 1e5ca1581b18

Subscribe to this mod's changes

channel is a command published in the GitHub repository justhamade/triadjs (24 stars, last pushed 6mo ago), licensed MIT. It adds 39 tokens to every session and 918 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

channel compared with commands from other repositories

channel next to 6 commands from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
channeljusthamade/triadjsCommand246mo agoMITA39Claude Code
initfcakyon/claude-codex-settingsCommand1.2ktodayApache-2.0A0Claude Code
http-serviceMadAppGang/magusCommand14todayMITA27Claude Code
buildAzure/ai-gatewayCommand511d agoMITA0Claude Code
api-contract-reviewMozurok/fhorja.devCommand1029d agoMITA64Claude Code
start-10-1minicoohei/ai-agent-campCommand3471mo agononeA2Claude Code
fastapimfmezger/ai_agent_dotfilesCommand73mo agoMITA84Claude Code, Gemini CLI