This example builds a team project assistant that lives in your Discord server. It shows the middle tier of Heypi complexity—more realistic than the Telegram example but much leaner than the Slack DevOps one. The agent tracks project notes and status updates in a local Markdown file, streams replies back to Discord as they generate, and routes any status-change request through an approval gate before writing anything permanent.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/hunvreus/heypi/llms.txt
Use this file to discover all available pages before exploring further.
What’s Included
Streaming Replies
Responses stream token-by-token into Discord as the model generates them, keeping the conversation feel snappy.
Approval-Gated Status
set_project_status requires explicit approval before appending to the notes file; the approval card shows Project, Status, and Reason.Project Notes
project_note appends timestamped notes to state/project-notes.md instantly, no approval needed.TypeBox Schemas
All three custom tools use
@sinclair/typebox for parameter validation—the same pattern you’d use in production.Setup
Set environment variables
Edit Leave the allowlists empty to accept every event Discord delivers. Set comma-separated IDs to restrict which guilds, channels, or users may trigger the agent.
examples/discord-project/.env:Enable Message Content Intent
In the Discord Developer Portal, open your application and go to Bot → Privileged Gateway Intents. Enable Message Content Intent. Without it, the bot cannot read message text.
Invite the bot to your server
Generate an invite URL and check your token:Then invite with the required scopes:Use
pnpm heypi discord channels or pnpm heypi discord observe to find IDs for HEYPI_DISCORD_GUILDS, HEYPI_DISCORD_CHANNELS, and HEYPI_APPROVERS.Configuration
streaming: true enables token-by-token streaming into Discord. approval.expiresInMs sets a 10-minute window for pending approvals before they expire automatically.
Custom Tools
All three tools are defined inline inindex.ts using tool() from @hunvreus/heypi and TypeBox parameter schemas.
project_note — Append a Note (No Approval)
Appends a timestamped note to state/project-notes.md. Runs immediately with no confirmation step:
set_project_status — Status Update (Approval Required)
Appends a status change to state/project-notes.md but only after an approver confirms the details. The confirm function builds the approval card:
The
confirm function returning an object (not false) is what triggers the approval gate. Heypi surfaces the message and details fields as a structured card in Discord. The agent does not ask for confirmation in chat—the platform adapter handles the interaction.read_project_notes — Read Saved Notes
Returns the full contents of state/project-notes.md, or a friendly message if no notes have been saved yet:
Agent Folder
SOUL.md sets a one-line persona: “You are direct, practical, and careful with team project state.”
AGENTS.md tells the agent to call project_note when asked to record a note, call set_project_status with the project, new status, and a short reason when asked to change status, and never ask the user to confirm in chat—the app handles the gate for the concrete update.
Try It Out
HEYPI_APPROVERS is empty, or only listed user IDs if set) must click Approve before the status is written.