This example builds a Slack DevOps assistant that manages Linux and VPS hosts directly from your workspace. It demonstrates Heypi’s full feature set in a realistic ops context: SSH key onboarding, file-backed host inventory, command policy enforcement with approval gates, Markdown runbook search, and scheduled jobs for daily health checks and idle incident follow-up—all coordinated through a singleDocumentation 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.
createHeypi call.
What’s Included
SSH Host Tools
File-backed host inventory with SSH key generation, host facts refresh, and remote command execution via
host_exec.Runbook Search
A custom
runbook_search tool that scans Markdown runbooks under agent/runbooks/ for keyword matches.Approval Gates
systemctl, docker, apt, ufw, and firewall commands require human approval before running remotely.Admin UI
Local admin panel at
http://127.0.0.1:3000/admin with live job, thread, and approval state.Cron Health Check
A
daily-health-check job fires at 09:00 UTC every day and posts a summary to a configured Slack channel.Incident Heartbeat
An
idle-incident-follow-up heartbeat checks every 6 hours whether a quiet incident thread still needs attention.Setup
Set environment variables
Edit Leave the
examples/slack-devops/.env and fill in the required values:HEYPI_SLACK_* allowlists empty to accept every event Slack delivers. Set comma-separated IDs to restrict which teams, channels, or users may trigger the agent.Create your Slack app
You need two tokens:
SLACK_BOT_TOKEN— OAuth bot token from your Slack app’s OAuth & Permissions page.SLACK_APP_TOKEN— App-level token with theconnections:writescope, found under Basic Information → App-Level Tokens.
app_mentions:read, chat:write, channels:history, groups:history. Enable Socket Mode in your app settings.Verify your setup with:Optionally set a job channel
Run When this variable is set, the example registers two jobs (see Scheduled Jobs below). If it is unset, Heypi logs a warning and starts normally without any jobs.
pnpm heypi slack channels to find a channel ID, then set:Configuration
The corecreateHeypi call wires together the Slack adapter, custom tools, agent folder, approval policy, and scheduled jobs:
Custom Tools
createHostTools — SSH & Host Inspection
tools/host.ts exposes eight tools for the agent. All mutating or risky tools check the commandPolicy before executing:
| Tool | Description |
|---|---|
host_key_ensure | Creates a named Ed25519 keypair if missing; returns only the public key. |
host_key_public | Returns the public key for a named keypair. |
hosts_list | Lists all configured hosts from state/hosts.json. |
hosts_lookup | Finds a host by id, name, alias, or tag. |
hosts_upsert | Adds or updates a host; requires approval. |
hosts_remove | Removes a host from inventory; requires approval. |
host_facts_refresh | Probes each host over SSH and caches OS, disk, memory, ports, and more. |
host_exec | Runs a shell command on one or more hosts over SSH; risky commands require approval. |
createRunbookTools — Markdown Runbook Search
tools/runbook.ts exposes a single runbook_search tool that walks all .md files under agent/runbooks/ and returns matching lines:
AGENTS.md instructs it to search runbooks before suggesting remediation steps for any host, service, rollback, or disk issue.
createHostContext — Dynamic Host Inventory
createHostContext is a context provider that reads state/hosts.json and injects a brief host summary into the system prompt each turn. This lets the model recognize host IDs, tags, and aliases before choosing tools:
Agent Folder
SOUL.md defines the agent’s role (Slack DevOps assistant for configured Linux/VPS hosts) and hard safety constraints (never expose private key material, never modify agent source from chat).
AGENTS.md defines operating order: clarify → search runbooks → check cached facts → run safe diagnostics → propose minimal remediation → call the tool for risky actions (don’t ask in chat, the app handles the gate).
skills/incident-triage/SKILL.md provides a structured 5-step workflow: confirm scope, load runbook context, run safe diagnostics first, propose minimal remediation, close with a status summary.
Scheduled Jobs
WhenHEYPI_SLACK_JOB_CHANNEL is set, two jobs are registered:
daily-health-check— active cron job, fires at 09:00 UTC and posts toHEYPI_SLACK_JOB_CHANNEL. No external scheduler needed; Heypi runs it inside the Node process.idle-incident-follow-up— paused heartbeat job. When enabled, it checks every 6 hours whether the channel has been idle for at least 30 minutes, then prompts the agent to follow up on any quiet incident threads.
Jobs run inside the Heypi Node process. No external cron service (crontab, Kubernetes CronJob, etc.) is required.
Command Policy
ThecommandPolicy object controls which remote commands the agent can run without approval, which require approval, and which are always blocked:
Production HTTP Mode
For a production deployment behind a public HTTPS endpoint, switch from Socket Mode to HTTP mode using the commented-out block inindex.ts:
https://<host>/slack/slack/events. The admin panel shares the same HTTP listener and remains available at /admin.