From claude-sentinel
Deploy Claude Sentinel on a VPS — install the persistent Telegram gateway, set up systemd services, configure cron jobs for memory compaction, create the bot identity, and build the required directory structure. Use when the user asks to "install sentinel", "deploy telegram gateway", "set up persistent sessions", "install claude-sentinel", "configure telegram bot on VPS", "set up crons for telegram", "create bot identity", or wants to make their Claude Code Telegram bot persistent.
How this skill is triggered — by the user, by Claude, or both
Slash command
/claude-sentinel:deploy-sentinelThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Installs the Claude Sentinel persistent gateway on the current machine. Creates all
Installs the Claude Sentinel persistent gateway on the current machine. Creates all required directories, configuration files, systemd services, cron jobs, and bot identity.
Prerequisites (verify before proceeding):
claude auth status → loggedIn: true)bun --version)loginctl show-user $(whoami) | grep Linger)If any prerequisite is missing, direct the user to run /sentinel:vps-setup first.
Arguments passed: $ARGUMENTS
Walk through all steps below in order. Verify each step before moving on. Ask the user for required input (tokens, bot name, etc.) when needed.
status — check deployment healthls ~/.claude/channels/telegram/gateway.tssystemctl --user is-active telegram-gateway.servicesystemctl --user list-timers | grep compactls ~/.claude/channels/telegram/identity.mdls ~/.claude/channels/telegram/session-compact.mdsqlite3 ~/.claude/channels/telegram/history.db "SELECT COUNT(*) FROM messages"restart — restart the gatewaysystemctl --user restart telegram-gateway.service
journalctl --user -u telegram-gateway.service --no-pager -n 10
compact — run memory compaction nowsystemctl --user start telegram-compact.service
journalctl --user -u telegram-compact.service --no-pager -n 20
logs — show recent gateway logsjournalctl --user -u telegram-gateway.service --no-pager -n 30
mkdir -p ~/.claude/channels/telegram/inbox
mkdir -p ~/.claude/channels/telegram/approved
mkdir -p ~/.claude/channels/telegram/crons
mkdir -p ~/.config/systemd/user
git clone https://github.com/southlab-ai/claude-sentinel.git /tmp/claude-sentinel
cp /tmp/claude-sentinel/src/gateway.ts ~/.claude/channels/telegram/gateway.ts
cp /tmp/claude-sentinel/src/compact-job.ts ~/.claude/channels/telegram/compact-job.ts
If git is not available or the clone fails, offer to create the files directly by writing their contents (read from the plugin's bundled copies if available, or direct the user to download manually).
Ask the user for their Telegram bot token. If they already ran
/sentinel:configure <token>, read it from .env instead of asking again.
Create both env files:
~/.claude/channels/telegram/.env:
TELEGRAM_BOT_TOKEN=<token>
~/.claude/channels/telegram/gateway.env:
TELEGRAM_BOT_TOKEN=<token>
Ask if they have an OpenAI API key for voice message transcription (optional).
If yes, add OPENAI_API_KEY=<key> to .env.
Set permissions:
chmod 600 ~/.claude/channels/telegram/.env
chmod 600 ~/.claude/channels/telegram/gateway.env
Ask the user for their Telegram user ID. If they don't know it, tell them to message @userinfobot on Telegram.
Create ~/.claude/channels/telegram/access.json:
{
"dmPolicy": "allowlist",
"allowFrom": ["<user_telegram_id>"],
"groups": {},
"pending": {}
}
Note: Use allowlist by default (not pairing) since we're setting up from
scratch and know the user's ID. This is the secure default.
Ask the user:
Create ~/.claude/channels/telegram/identity.md with their choices:
# Identity
I am a personal assistant running inside Claude Code on my user's VPS.
**Name:** <bot_name>
**Emoji:** <emoji>
## Operating principles
- **Act, don't delegate.** When a dedicated tool exists for an action, use it
directly instead of asking the user to run commands. If I can do it, I do it.
- **Subagents for complex tasks.** For tasks requiring depth or professional
quality, use subagents with Opus model. The base model (Sonnet) is for quick
responses and simple tasks.
Explain to the user: this file is injected as a system prompt on every session start. They can edit it anytime to change the bot's behavior.
Download and install the three service files:
~/.config/systemd/user/telegram-gateway.service:
[Unit]
Description=Claude Telegram Gateway
After=network-online.target
[Service]
Type=simple
WorkingDirectory=/home/<user>
ExecStart=/usr/local/bin/bun run /home/<user>/.claude/channels/telegram/gateway.ts
Restart=always
RestartSec=5
KillMode=control-group
KillSignal=SIGTERM
TimeoutStopSec=10
Environment=HOME=/home/<user>
Environment=PATH=/usr/local/bin:/home/<user>/.local/bin:/home/<user>/.bun/bin:/usr/bin:/bin
EnvironmentFile=/home/<user>/.claude/channels/telegram/gateway.env
[Install]
WantedBy=default.target
~/.config/systemd/user/telegram-compact.service:
[Unit]
Description=Claude Telegram Memory Compact
[Service]
Type=oneshot
WorkingDirectory=/home/<user>
ExecStart=/usr/local/bin/bun run /home/<user>/.claude/channels/telegram/compact-job.ts
Environment=HOME=/home/<user>
Environment=PATH=/usr/local/bin:/home/<user>/.local/bin:/home/<user>/.bun/bin:/usr/bin:/bin
~/.config/systemd/user/telegram-compact.timer:
[Unit]
Description=Compact Telegram memory twice daily
[Timer]
OnCalendar=*-*-* 08,20:00:00
Persistent=true
[Install]
WantedBy=timers.target
Replace <user> with the actual username (result of whoami).
Ask the user if they want to customize the compact schedule (default: 8am and 8pm UTC).
systemctl --user daemon-reload
systemctl --user enable --now telegram-gateway.service
systemctl --user enable --now telegram-compact.timer
Run these checks and report results:
Gateway running:
systemctl --user is-active telegram-gateway.service
Gateway logs:
journalctl --user -u telegram-gateway.service --no-pager -n 5
Should show: [gateway] Telegram Gateway started (persistent mode)
Compact timer scheduled:
systemctl --user list-timers | grep compact
All files in place:
ls -la ~/.claude/channels/telegram/gateway.ts
ls -la ~/.claude/channels/telegram/compact-job.ts
ls -la ~/.claude/channels/telegram/.env
ls -la ~/.claude/channels/telegram/identity.md
ls -la ~/.claude/channels/telegram/access.json
Tell the user: "Send a message to your bot on Telegram. You should see it in the logs within a few seconds."
After successful deployment, tell the user:
Quick reference:
/sentinel:deploy status/sentinel:deploy logs/sentinel:deploy restart/sentinel:deploy compactnano ~/.claude/channels/telegram/identity.md (takes effect on next session)/sentinel:access to manage who can reach the botHow the memory system works:
history.dbsession-compact.md~/.claude/projects/-home-claude/memory/How the persistent session works:
--resume + full context--fallback-model automatically tries an alternate$(whoami) or $HOME to determine paths — don't assume username is claudenpx claudepluginhub southlab-ai/claude-plugin-marketplace --plugin claude-sentinelSets up Telegram/Discord channels for remote Claude Code access. Enables sending commands from phone via messaging apps with --auto flag and FORGE_OUTPUT=json protocol.
Provides CLI for Telegram Bot API using bot tokens: authenticate, send messages, read chats, get info, manage multi-bot setups. For CI/CD and server-side messaging automation.
Guides setting up external messaging channels (WhatsApp, Telegram, Discord, iMessage) for Claude Code agents via plugins. Useful for enabling communication outside the CLI.