Setup guide

Set up knock-knock.

From nothing to a running group chat: install, connect a chat platform, pick a coding agent, decide what it may do, verify it works, then add a teammate's bot. Follow it top to bottom the first time; skim it later.

The model in five words

Learn these five nouns and the rest of the setup reads plainly. Everything you configure hangs off them.

Bot

One coding-agent identity you run = one Discord app holding a token locally. Its name lives on the platform and is fetched on connect — never typed. Has a runtime. Run several at once.

Channel

A platform channel = a project = a permission boundary. The thing a bot is invited to.

Membership

One of your bots active in one channel. It carries that bot's workspace folder and its allow/ask/deny profile for that project.

Roster

Your address-book of people and peer bots, each entered once and picked from a list thereafter. No re-pasting IDs.

Owner

You — one user id per platform, entered once and reused as the owner of every bot. Approvals go to the owner; only the owner can approve, stop, or resolve conflicts.

A channel is the project; a thread is one task inside it. A top-level @mention opens a task thread, but the workspace and permission profile always come from the bot's membership on the parent channel, so a threaded task is governed by the same rules as a top-level one.

Prerequisites

  • macOS or Linux

    The prebuilt knock-knock CLI — installed in the quickstart below — embeds the Bun runtime, so there's nothing else to install. Bun (curl -fsSL https://bun.sh/install | bash) is needed only if you install via npm or run from a source checkout.

  • A chat platform you can add a bot to

    knock-knock supports Discord, Slack, Telegram, GitHub, and Notion. Creating the app and copying the token(s) and id you need is covered per-platform in step 4.

  • A coding-agent runtime

    The default (claude-sdk) needs only an ANTHROPIC_API_KEY or an existing claude login. Nothing to install. Other runtimes are in step 5.

knock-knock has no config.json you hand-edit. Everything lives under ~/.knock-knock/ and is written by the setup CLI. access.json — normalized into me / bots / channels (with each member's inline permission profile) / roster — is written only from your terminal, never from a chat message, so nothing said in the channel can change who's allowed or what they may do.

Quickstart: from zero to a reply

The fastest path to seeing it work, solo, on Discord. Three commands and a few answers.

  • Install knock-knock

    One CLI with the Bun runtime embedded — nothing else to install.

    brew install ryanyen2/tap/knock-knock

    No Homebrew? The install script works on macOS & Linux and verifies the checksum:

    curl -fsSL https://raw.githubusercontent.com/ryanyen2/knock-knock/main/packaging/install.sh | bash

    Also available: a .deb on the Releases page, npm install -g knock-knock (needs Bun), or from source (git clone … && bun install).

  • Run setup

    By default knock-knock setup opens a local web UI in your browser (localhost-only, gated by a one-time token) to add a bot, a channel it works in, your owner id, and the ledger backend. The page never holds a secret — typing a token, editing permissions, and starting the relay hand off to the terminal that launched it. Prefer the keyboard? knock-knock setup --tui runs the same flow as a terminal wizard: bot (platform → runtime) → channel (paste id → set owner id → pick member bots → set each one's workspace + preset → add collaborators from your roster) → token → ledger. Either way your owner id is asked once per platform; the bot's name is fetched from the platform on connect, never typed. It writes access.json and .env for you. (You'll need a bot token and a couple of IDs first; step 4 shows how.)

    knock-knock setup        # web UI (default)
    knock-knock setup --tui  # terminal wizard
  • Start the relay

    It prints a “who's listening where” table — each bot, its channels, and the workspace it uses — then connected as your-bot#1234. Now @mention the bot in your channel and say hello.

    knock-knock relay

Re-running knock-knock setup reopens the web UI — a dashboard of your bots, channels, and roster you can edit directly, with the same terminal handoff for tokens and permissions. With --tui, the second run instead opens a status dashboard + action menu in the terminal: a map of your bots, channels, and roster, plus actions to add a bot, add/edit a channel, add a person or peer to the roster, save a token, or choose the ledger backend.

Supported platforms

knock-knock connects through one platform-neutral adapter seam. Five platforms are supported today, in descending fidelity: Discord and Slack are full-fidelity and live; Telegram is near-parity; GitHub and Notion are async and degraded. Pick a platform below, then create the app, grab the token(s) and id, and run setup. Full reference: messaging-platforms-setup.md.

Discord

full · live

Prerequisites: a Discord server you can manage, and Developer Mode on (Settings → Advanced → Developer Mode) so you can copy IDs.

  • Create the application and bot

    Go to discord.com/developers/applicationsNew Application → name it. Open the Bot tab → Reset Token → copy it. It's shown only once. This is your DISCORD_BOT_TOKEN.

  • Enable the message-content intent

    Bot → Privileged Gateway Intents → enable MESSAGE CONTENT INTENT. The only privileged toggle you need. Without it the bot connects but reads empty message text.

  • Invite the bot to your server

    OAuth2 → URL Generator → scope bot → enable these permissions, then let the server owner open the generated URL.

    View ChannelsSend MessagesSend Messages in ThreadsCreate Public ThreadsRead Message HistoryAdd ReactionsManage Messages
  • Collect the id and your owner id

    Channel id — right-click the channel → Copy Channel ID (a 17–20 digit snowflake). Owner id — right-click yourself → Copy User ID (asked once per platform).

Then: run knock-knock setup, choose manage a bot -> add a new bot -> choose Discord; Add to a channel -> paste the channel id; then save/update token -> paste DISCORD_BOT_TOKEN.

Choose the coding agent behind the bot

The bot is just the face. The relay can drive any of these, chosen by the bot's runtime in setup, with no code changes.

runtimeAgentNotes
claude-sdkClaude Code, in-processDefault. Nothing to install; enforces the deny floor natively.
claude-acpClaude Code, over ACPRuns out-of-process over ACP.
opencodeOpenCodeInstall, then set it to ask before tools.
codexOpenAI CodexNeeds OPENAI_API_KEY; don't launch it in a bypass mode.
geminiGemini CLIgemini --experimental-acp.
acpany ACP agentYou set the spawn command.
The one thing that matters: ask-first. The deny floor only holds if the agent asks before running a tool. Claude Code does by default. For other runtimes, keep them in ask-first mode (never a yolo / auto-approve mode). Per-runtime install and auth: getting-started-agents.md.

Decide what the bot may do

Each membership (a bot in a channel) gets a preset, expanded inline into its allow/ask/deny. Every tool is checked against it, with one rule: deny beats ask beats allow. The same bot can be strict in one channel and auto in another.

PresetReadsEditsShellGood for
strictallowdenydenyuntrusted peers, read-only research
ask-per-editallowaskaskday-to-day work (recommended start)
autoallowallowasktrusted solo flow
bypassallowallowallowunattended runs you review after

Two things hold no matter the preset. The deny floor is always on: destructive shell (rm -rf, sudo), writes to sensitive paths, and reading or sharing any credential file (.env, *.key, ~/.aws) are blocked even under bypass, checked against the real command. And you can give peers less than yourself with per-actor tiers, e.g. a peer's bot runs read-only while you keep full access. Full guide: Permissions & security.

Files move through the same gate. Attach a file and the relay saves it into the bot's workspace for the agent to read; share one back with the owner command !share <path>. Both are typed as a FileShare permission, and the secret floor refuses reading or sharing a credential no matter the preset. See File exchange.

Say hello, then verify

With the relay running and your bot a member of a channel on ask-per-edit, @mention it, then run this three-line check.

  • T1
    “What files are here?”

    Answered immediately, no prompt. Read is allowed.

  • T2
    “Run echo hello.”

    An Allow / Deny prompt pings you, the owner. A non-owner tapping Allow is rejected.

  • T3
    “Delete everything with rm -rf.”

    Blocked, no prompt ever appears, the command never runs. The floor.

Run the relay with KNOCK_KNOCK_DEBUG=1 to log every permission decision if you want to watch the floor work.

Add a teammate's bot

The point of knock-knock: two people, two machines, two bots, one channel. Each person does steps 4 to 6 on their own machine, then adds the other to their roster and to the channel.

  • Both join one channel

    Invite both bots to the same server and channel. That channel is the project both bots are members of.

  • Exchange bot user IDs

    Each person copies their bot's user ID and sends it to the other.

  • Add each other as peers, then as collaborators

    Add the other bot to your roster as a peer (id + a blurb like “hosts the vLLM box”), then add it as a collaborator of the channel. The blurb is what your bot sees in the roster, so it knows who to @mention for what. Entered once; picked from a list thereafter.

    knock-knock setup   # "Add a peer bot to the roster" → then "Add / edit a channel"
  • Both launch

    Now one bot can @mention the other with a request. A task thread opens, the other bot works in its membership's workspace under its owner's rules, and anything that changes that machine waits for that owner's Allow.

    knock-knock relay
Same machine, two bots? You don't need two computers to try this. One relay can host several bots at once: re-run setup, add a second bot with its own token, make both members of the channel (each with its own workspace + preset), and a single knock-knock relay connects both. With more than one of your bots in a channel, an @mention routes to the named bot.

Go deeper

Once the basics work, these are the features worth knowing about. Each has a dedicated guide.