pi-discord-bridge

Bridge Pi coding sessions to Discord — per-project channels, session threads, two-way control

Packages

Package details

extension

Install pi-discord-bridge from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-discord-bridge
Package
pi-discord-bridge
Version
1.0.1
Published
Jul 3, 2026
Downloads
223/mo · 9/wk
Author
notdezzi
License
MIT
Types
extension
Size
81.8 KB
Dependencies
1 dependency · 3 peers
Pi manifest JSON
{
  "extensions": [
    "./index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

Pi Discord Remote

A Pi extension that bridges your Pi coding sessions to Discord. Every project gets its own channel, every session gets its own thread — monitor, steer, and control Pi from Discord in real time.

Features

  • Per-project channels — a dedicated Discord channel is created for each project (named after the working directory), keeping your server organized
  • Session threads — each Pi session spawns a thread inside the project channel with a short, readable slug (pi-a1b2c)
  • Global config — set your .env once in ~/.pi/.env, works across all projects
  • Two-way control — send messages in Discord to steer Pi, or react with 🛑 to abort
  • Tool call streaming — optionally watch tool calls and results arrive live in Discord
  • Slash commands — register bridge commands as native Discord slash commands

Prerequisites

  • Pi
  • A Discord bot in your server with these permissions:
    • Send Messages
    • Read Message History
    • Create Public Threads
    • Manage Threads
    • Add Reactions
    • Manage Channels (needed for per-project channel creation)

Installation

npm (recommended)

Inside Pi, run:

/pi-install npm:pi-discord-bridge

Or manually add to ~/.pi/agent/settings.json:

{
  "packages": [
    "npm:pi-discord-bridge"
  ]
}

Local (from source)

cp -r pi-discord-bridge ~/.pi/agent/extensions/discord-bridge
cd ~/.pi/agent/extensions/discord-bridge && npm install

Then use "ext:discord-bridge" in settings.json instead.

Config

Either way, set up your environment:

cp .env.example ~/.pi/.env
# Edit ~/.pi/.env with your bot token, channel IDs, etc.

Restart Pi.

Configuration

All settings go in ~/.pi/.env. See .env.example for the full list.

Variable Default Description
PI_DISCORD_ENABLED false Master switch
PI_DISCORD_BOT_TOKEN Discord bot token
PI_DISCORD_USER_IDS Allowed Discord user IDs (comma-separated)
PI_DISCORD_CREATE_CHANNEL_PER_PROJECT true true = auto-create a channel per project (requires PI_DISCORD_GUILD_ID); false = send everything to PI_DISCORD_CHANNEL_ID
PI_DISCORD_CHANNEL_ID Target channel when CREATE_CHANNEL_PER_PROJECT=false
PI_DISCORD_GUILD_ID Guild for per-project channel creation (required when toggle is true)
PI_DISCORD_STREAM_MESSAGES false Live-edit messages as the assistant streams
PI_DISCORD_CREATE_THREAD_PER_SESSION true One thread per Pi session
PI_DISCORD_THREAD_NAME_PREFIX pi Thread name prefix
PI_DISCORD_RENDER_TOOL_CALLS true Show tool calls in Discord
PI_DISCORD_RENDER_TOOL_RESULTS true Show tool results in Discord
PI_DISCORD_RENDER_USER_INPUT true Echo user messages to Discord
PI_DISCORD_RENDER_REASONING false Show chain-of-thought

How it works

Server
├── #general              (your existing channel)
├── #my-app               (auto-created for ~/projects/my-app)
│   ├── pi-a1b2c          (session thread)
│   └── pi-f3d4e          (another session thread)
└── #api-server           (auto-created for ~/projects/api-server)
    └── pi-b7c8d          (session thread)

Each time you start Pi in a project directory, the extension:

  1. Creates (or reuses) a text channel named after the project directory
  2. Creates a session thread with a 5-character slug inside that channel
  3. Sends all assistant messages, tool calls, and results to that thread

Discord commands

Command Description
/session Current session and thread info
/abort Abort the current turn (or react 🛑)
/compact Trigger context compaction
/new [args] Start a new Pi session
/mute / /unmute Suppress/resume Discord output
/discord-status Full status and config dump
/discord-test [msg] Send a test message
/discord-reconnect Reconnect the bot

You can also just type naturally — messages are forwarded to Pi as input.

Pi commands

Command Description
/discord-status Connection status, channels, config
/discord-test [msg] Send a test message
/discord-reconnect Reconnect the bot
/discord-mute / /discord-unmute Mute/unmute Discord output
/discord-arm Arm in-process session replacement
/discord-launcher-status HTTP launcher info

License

MIT