Perch — Server Intelligence Skill
Perch is a self-hosted intelligence layer that watches, diagnoses, and (within strict bounds) heals Linux servers managed by RunCloud — or any plain Ubuntu/Debian/AlmaLinux box. It runs as an MCP server, an HTTP API, and a Telegram bot. The brain (SQLite) accumulates per-server, per-webapp knowledge over time.
This skill teaches Claude how to use Perch correctly and safely.
Identity
- What it is: Server intelligence layer. Reads everything, learns over time, talks to you in plain English.
- What it isn't: SaaS, monitoring dashboard, or runtime dependency. No vendor lock-in. Free forever.
- How it talks: Telegram, Slack, Claude Code MCP, HTTP API, CLI — same intelligence, multiple surfaces.
- Where data lives:
~/.perch/brain.db (SQLite, on the user's server) and ~/.perch/vault.json (AES-256-GCM encrypted credentials). Nothing leaves the box unless the user explicitly configures a webhook.
Architecture
You (Claude Code / Telegram / Slack / HTTP)
↓
PERCH CORE
├── brain.ts SQLite KB (servers, webapps, problems, plugins, knowledge, actions_log)
├── gateway.ts Friendly alert formatter (multi-channel)
├── ssh-enhanced.ts SSH with TOFU host verification + WP-CLI helper
├── vault.ts AES-256-GCM credential vault
└── redact.ts Centralized privacy redactor (16 patterns)
↓
MODULES
├── wordpress/ db, plugins, security, backup, images, perf, errors
├── api/server.ts HTTP wrapper for external integration
└── monitor.sh 14-rule cron automation engine
/perch_* MCP Tool Catalog
Server (RunCloud API)
list_servers, get_server, get_server_stats, get_server_health
control_service, clean_server_disk, get_server_logs
update_ssh_settings, update_server_autoupdate
- 130+ more — see
src/index.ts
Server (SSH)
ssh_run_command — arbitrary SSH (validate inputs)
ssh_server_status, ssh_smart_fix, ssh_restart_service
ssh_kill_orphans, ssh_disk_cleanup, ssh_check_ports
ssh_wp_cli, ssh_artisan, ssh_tail_log
WordPress
perch_wp_db_audit — autoload, transients, orphans, fragmentation
perch_wp_db_clean — drop expired transients/sessions (idempotent)
perch_wp_plugins — list + Wordfence Intelligence vulnerability scan
perch_wp_plugin_update, perch_wp_plugin_deactivate (logs to undo)
perch_wp_security — 12-check hardening audit
perch_wp_backup — backup health
perch_wp_images_scan, perch_wp_images_optimize
perch_wp_perf — performance snapshot
perch_wp_errors — diagnose PHP fatals + white screens
Vault
perch_vault_put, perch_vault_get, perch_vault_list, perch_vault_delete
Brain & Intelligence
perch_brain — KB summary
perch_webapp_history — per-webapp problem history
perch_brain_search — FTS5 search across all problems
perch_actions_log — recent destructive actions
perch_undo — reverse the last destructive action
perch_multi_server_dashboard — one-shot all-server status
perch_self_update — pull latest, rebuild, restart
RunCloud Gotchas (CRITICAL — get these right)
| Wrong |
Right (RunCloud) |
nginx |
nginx-rc |
nginx.service |
nginx-rc.service |
/etc/nginx/ |
/etc/nginx-rc/ |
php8.x-fpm |
php8x-fpm-rc |
/etc/nginx/conf.d/ (overwritten) |
/etc/nginx-rc/extra.d/ (custom-safe) |
/var/log/nginx/error.log |
/var/log/nginx-rc/error.log |
/var/www/ |
/home/{appuser}/webapps/{appname}/ |
www-data |
each webapp's own system user |
Never edit /etc/nginx-rc/conf.d/ — RunCloud regenerates these and your changes vanish. Use /etc/nginx-rc/extra.d/ for custom blocks.
PHP-FPM logs: /home/{user}/logs/php_error.log per webapp.
Safety Policy (READ THIS BEFORE EVERY DESTRUCTIVE TOOL CALL)
Auto-allowed (no confirm needed)
- Restart crashed
nginx-rc, php*-fpm-rc, MySQL/MariaDB
- Kill orphan processes (PPID=1)
- Truncate (not delete) log files >50MB
- SSL renewal when <7 days remain
- Clear expired WordPress transients (WP-CLI built-in safe op)
- Clear
/tmp PHP sessions older than 24h
Confirm-required (always ask first)
- Plugin deactivation (
perch_wp_plugin_deactivate)
- Plugin updates
- WP core update
- Database table changes (OPTIMIZE/REPAIR)
- File deletions
- Nginx config edits beyond reload
- Service stops without restart
- Reboot
Never auto, ever
- Backup restoration
- DELETE/UPDATE on user data tables
rm outside /tmp
- User account changes
- Hetzner-level shutdown / rebuild
Master Key Handling
PERCH_MASTER_KEY (env var) is the only thing protecting the credential vault. Rules:
- Never echo the key in MCP responses, logs, or alerts.
- Never save the key to brain.db or any file Perch creates (it lives only in
~/.perch/.env mode 0600, sourced by systemd EnvironmentFile).
- If the user asks "what's my master key?" — refuse and direct them to their password manager /
~/.perch/.env.
- Vault rotation requires the OLD key as input — see
npm run vault rotate -- --old-key=....
Common Workflows
"Why is mysite.com white-screening?"
perch_wp_errors with domain → returns root cause + suggested fix
- If
fixableByPerch: true and user confirms → perch_wp_plugin_deactivate
perch_wp_errors again to verify the fatal cleared
- Tell user what was disabled and why
"Audit all my WP sites"
list_servers → for each server, list_webapps
- For each WP webapp:
perch_wp_db_audit, perch_wp_security, perch_wp_plugins
- Summarize per-site, surface critical issues first
"Rotate my RunCloud API key"
perch_vault_get with runcloud:apikey (current value, redact in summary)
- User generates new key in RunCloud panel
perch_vault_put with the new value
- Verify with
ping tool (returns pong if auth works)
"Update Perch and tell me what changed"
perch_self_update with dryRun: true first (returns commit count + changelog)
- Show user the changelog, ask to proceed
perch_self_update (real) if confirmed
"What do you know about disk-full incidents?"
perch_brain_search with query "disk full"
- Group by server / by month
- If patterns emerge ("happens after weekly backup"), surface that
Anti-Patterns (Claude must NEVER)
- ❌ Echo
PERCH_MASTER_KEY, vault values, or wp-config DB_PASSWORD into chat output
- ❌ Modify
/etc/nginx-rc/conf.d/ files
- ❌ Run
perch_wp_plugin_deactivate without explicit user confirmation
- ❌ Run any
*delete* tool without dry-run first
- ❌ Hard-code RunCloud paths assuming Ubuntu nginx defaults — always use the RunCloud variants
- ❌ Tell the user "I'll just restart nginx" without first checking
nginx -t config validity
- ❌ Stuff entire DB query results into chat — use
perch_brain_search summaries
- ❌ Ignore the safety whitelist/blacklist — defer to docs/safety.md when uncertain
When to Trigger This Skill
Auto-load when the user mentions any of:
- "perch", "/perch_X", "the perch tool"
- "runcloud", "nginx-rc", "RunCloud server"
- "site is down", "white screen", "500 error" (and they own the server)
- "audit my WordPress site", "check plugin vulnerabilities", "wp_options bloat"
- "ssh into [host I own]", "restart nginx-rc / php-fpm"
- "perch.adityaarsharma.com" or "github.com/adityaarsharma/perch"
Source of Truth
The repo at https://github.com/adityaarsharma/perch is canonical. When this skill conflicts with the repo, the repo wins. Specifically read:
README.md — vision + comparison + connectors
docs/install.md — install paths
docs/automation.md — 14 cron rules + thresholds
docs/safety.md — auto/confirm/never policy (verbatim authority)
docs/master-key.md — encryption key lifecycle
docs/runcloud.md — RunCloud-specific operational reference
src/index.ts — authoritative tool list (tools array)
Installation
# Drop this skill where Claude Code looks for skills
mkdir -p ~/.claude/skills/perch
cp /path/to/perch/skills/perch/SKILL.md ~/.claude/skills/perch/SKILL.md
# Restart Claude Code
Skill version 1.0 — generated April 2026 from the live Perch codebase.
1---
2name: perch
3description: Server intelligence layer for RunCloud-managed Linux servers. Use when the user mentions Perch, /perch_*, RunCloud, nginx-rc, server intelligence, server diagnosis, WordPress site auditing, plugin vulnerability scanning, or any time they want to investigate, monitor, or heal a server they own.
4when_to_use: User says "perch", "/perch_X", "runcloud", "nginx-rc", "audit my site", "site is white-screening", "what's wrong with the server", or any server-debugging request on a host they manage.
5when_not_to_use: Tasks that target servers Perch is not connected to. Pure local development. Anything that requires modifying public/shared infrastructure without explicit confirmation.
6metadata:
7 source: https://skillmd.com/skills/aibot88/perch
8---
9
10# Perch — Server Intelligence Skill
11
12Perch is a self-hosted intelligence layer that watches, diagnoses, and (within strict bounds) heals Linux servers managed by RunCloud — or any plain Ubuntu/Debian/AlmaLinux box. It runs as an MCP server, an HTTP API, and a Telegram bot. The brain (SQLite) accumulates per-server, per-webapp knowledge over time.
13
14This skill teaches Claude how to use Perch correctly and safely.
15
16## Identity
17
18- **What it is**: Server intelligence layer. Reads everything, learns over time, talks to you in plain English.
19- **What it isn't**: SaaS, monitoring dashboard, or runtime dependency. No vendor lock-in. Free forever.
20- **How it talks**: Telegram, Slack, Claude Code MCP, HTTP API, CLI — same intelligence, multiple surfaces.
21- **Where data lives**: `~/.perch/brain.db` (SQLite, on the user's server) and `~/.perch/vault.json` (AES-256-GCM encrypted credentials). Nothing leaves the box unless the user explicitly configures a webhook.
22
23## Architecture
24
25```
26You (Claude Code / Telegram / Slack / HTTP)
27 ↓
28PERCH CORE
29 ├── brain.ts SQLite KB (servers, webapps, problems, plugins, knowledge, actions_log)
30 ├── gateway.ts Friendly alert formatter (multi-channel)
31 ├── ssh-enhanced.ts SSH with TOFU host verification + WP-CLI helper
32 ├── vault.ts AES-256-GCM credential vault
33 └── redact.ts Centralized privacy redactor (16 patterns)
34 ↓
35MODULES
36 ├── wordpress/ db, plugins, security, backup, images, perf, errors
37 ├── api/server.ts HTTP wrapper for external integration
38 └── monitor.sh 14-rule cron automation engine
39```
40
41## /perch_* MCP Tool Catalog
42
43### Server (RunCloud API)
44- `list_servers`, `get_server`, `get_server_stats`, `get_server_health`
45- `control_service`, `clean_server_disk`, `get_server_logs`
46- `update_ssh_settings`, `update_server_autoupdate`
47- 130+ more — see `src/index.ts`
48
49### Server (SSH)
50- `ssh_run_command` — arbitrary SSH (validate inputs)
51- `ssh_server_status`, `ssh_smart_fix`, `ssh_restart_service`
52- `ssh_kill_orphans`, `ssh_disk_cleanup`, `ssh_check_ports`
53- `ssh_wp_cli`, `ssh_artisan`, `ssh_tail_log`
54
55### WordPress
56- `perch_wp_db_audit` — autoload, transients, orphans, fragmentation
57- `perch_wp_db_clean` — drop expired transients/sessions (idempotent)
58- `perch_wp_plugins` — list + Wordfence Intelligence vulnerability scan
59- `perch_wp_plugin_update`, `perch_wp_plugin_deactivate` (logs to undo)
60- `perch_wp_security` — 12-check hardening audit
61- `perch_wp_backup` — backup health
62- `perch_wp_images_scan`, `perch_wp_images_optimize`
63- `perch_wp_perf` — performance snapshot
64- `perch_wp_errors` — diagnose PHP fatals + white screens
65
66### Vault
67- `perch_vault_put`, `perch_vault_get`, `perch_vault_list`, `perch_vault_delete`
68
69### Brain & Intelligence
70- `perch_brain` — KB summary
71- `perch_webapp_history` — per-webapp problem history
72- `perch_brain_search` — FTS5 search across all problems
73- `perch_actions_log` — recent destructive actions
74- `perch_undo` — reverse the last destructive action
75- `perch_multi_server_dashboard` — one-shot all-server status
76- `perch_self_update` — pull latest, rebuild, restart
77
78## RunCloud Gotchas (CRITICAL — get these right)
79
80| Wrong | Right (RunCloud) |
81|---|---|
82| `nginx` | `nginx-rc` |
83| `nginx.service` | `nginx-rc.service` |
84| `/etc/nginx/` | `/etc/nginx-rc/` |
85| `php8.x-fpm` | `php8x-fpm-rc` |
86| `/etc/nginx/conf.d/` (overwritten) | `/etc/nginx-rc/extra.d/` (custom-safe) |
87| `/var/log/nginx/error.log` | `/var/log/nginx-rc/error.log` |
88| `/var/www/` | `/home/{appuser}/webapps/{appname}/` |
89| `www-data` | each webapp's own system user |
90
91**Never** edit `/etc/nginx-rc/conf.d/` — RunCloud regenerates these and your changes vanish. Use `/etc/nginx-rc/extra.d/` for custom blocks.
92
93PHP-FPM logs: `/home/{user}/logs/php_error.log` per webapp.
94
95## Safety Policy (READ THIS BEFORE EVERY DESTRUCTIVE TOOL CALL)
96
97### Auto-allowed (no confirm needed)
98- Restart crashed `nginx-rc`, `php*-fpm-rc`, MySQL/MariaDB
99- Kill orphan processes (PPID=1)
100- Truncate (not delete) log files >50MB
101- SSL renewal when <7 days remain
102- Clear expired WordPress transients (WP-CLI built-in safe op)
103- Clear `/tmp` PHP sessions older than 24h
104
105### Confirm-required (always ask first)
106- Plugin deactivation (`perch_wp_plugin_deactivate`)
107- Plugin updates
108- WP core update
109- Database table changes (OPTIMIZE/REPAIR)
110- File deletions
111- Nginx config edits beyond reload
112- Service stops without restart
113- Reboot
114
115### Never auto, ever
116- Backup restoration
117- DELETE/UPDATE on user data tables
118- `rm` outside `/tmp`
119- User account changes
120- Hetzner-level shutdown / rebuild
121
122## Master Key Handling
123
124`PERCH_MASTER_KEY` (env var) is the only thing protecting the credential vault. Rules:
125
126- **Never** echo the key in MCP responses, logs, or alerts.
127- **Never** save the key to brain.db or any file Perch creates (it lives only in `~/.perch/.env` mode 0600, sourced by systemd EnvironmentFile).
128- If the user asks "what's my master key?" — refuse and direct them to their password manager / `~/.perch/.env`.
129- Vault rotation requires the OLD key as input — see `npm run vault rotate -- --old-key=...`.
130
131## Common Workflows
132
133### "Why is mysite.com white-screening?"
1341. `perch_wp_errors` with domain → returns root cause + suggested fix
1352. If `fixableByPerch: true` and user confirms → `perch_wp_plugin_deactivate`
1363. `perch_wp_errors` again to verify the fatal cleared
1374. Tell user what was disabled and why
138
139### "Audit all my WP sites"
1401. `list_servers` → for each server, `list_webapps`
1412. For each WP webapp: `perch_wp_db_audit`, `perch_wp_security`, `perch_wp_plugins`
1423. Summarize per-site, surface critical issues first
143
144### "Rotate my RunCloud API key"
1451. `perch_vault_get` with `runcloud:apikey` (current value, redact in summary)
1462. User generates new key in RunCloud panel
1473. `perch_vault_put` with the new value
1484. Verify with `ping` tool (returns pong if auth works)
149
150### "Update Perch and tell me what changed"
1511. `perch_self_update` with `dryRun: true` first (returns commit count + changelog)
1522. Show user the changelog, ask to proceed
1533. `perch_self_update` (real) if confirmed
154
155### "What do you know about disk-full incidents?"
1561. `perch_brain_search` with query "disk full"
1572. Group by server / by month
1583. If patterns emerge ("happens after weekly backup"), surface that
159
160## Anti-Patterns (Claude must NEVER)
161
162- ❌ Echo `PERCH_MASTER_KEY`, vault values, or wp-config DB_PASSWORD into chat output
163- ❌ Modify `/etc/nginx-rc/conf.d/` files
164- ❌ Run `perch_wp_plugin_deactivate` without explicit user confirmation
165- ❌ Run any `*delete*` tool without dry-run first
166- ❌ Hard-code RunCloud paths assuming Ubuntu nginx defaults — always use the RunCloud variants
167- ❌ Tell the user "I'll just restart nginx" without first checking `nginx -t` config validity
168- ❌ Stuff entire DB query results into chat — use `perch_brain_search` summaries
169- ❌ Ignore the safety whitelist/blacklist — defer to docs/safety.md when uncertain
170
171## When to Trigger This Skill
172
173Auto-load when the user mentions any of:
174- "perch", "/perch_X", "the perch tool"
175- "runcloud", "nginx-rc", "RunCloud server"
176- "site is down", "white screen", "500 error" (and they own the server)
177- "audit my WordPress site", "check plugin vulnerabilities", "wp_options bloat"
178- "ssh into [host I own]", "restart nginx-rc / php-fpm"
179- "perch.adityaarsharma.com" or "github.com/adityaarsharma/perch"
180
181## Source of Truth
182
183The repo at `https://github.com/adityaarsharma/perch` is canonical. When this skill conflicts with the repo, the repo wins. Specifically read:
184
185- `README.md` — vision + comparison + connectors
186- `docs/install.md` — install paths
187- `docs/automation.md` — 14 cron rules + thresholds
188- `docs/safety.md` — auto/confirm/never policy (verbatim authority)
189- `docs/master-key.md` — encryption key lifecycle
190- `docs/runcloud.md` — RunCloud-specific operational reference
191- `src/index.ts` — authoritative tool list (`tools` array)
192
193## Installation
194
195```bash
196# Drop this skill where Claude Code looks for skills
197mkdir -p ~/.claude/skills/perch
198cp /path/to/perch/skills/perch/SKILL.md ~/.claude/skills/perch/SKILL.md
199# Restart Claude Code
200```
201
202---
203
204*Skill version 1.0 — generated April 2026 from the live Perch codebase.*