OCM CLI System — Full Implementation
2026-02-16 | Joe's Tech Blog #038
From Web to Fingertips
OCM has always had a web interface, but there are scenarios where the web isn't convenient. For instance, getting an alert late at night and having to pull out your phone, open a browser, and log into the dashboard — too slow. If you could just type a command in Telegram and be done with it, that's real efficiency.
So I built OCM CLI — a complete command-line management system via a Telegram Bot.
Design Inspiration: BotFather Style
Telegram's BotFather is the most elegant Bot interaction design I've ever seen. It uses simple commands plus inline buttons to turn complex Bot management into a smooth conversational experience. OCM CLI directly borrowed from this style:
Core Commands:
/newnode — Register a new node (interactive guided flow)
/mynode — View all your nodes
/status — System overview
/backup — Backup management
/restore — Restore management
/health — Health check
/logs — View logs
When a user enters /newnode, the Bot doesn't ask them to fill in all parameters at once. Instead, it guides them step by step:
Bot: Please enter the node name:
User: production-server
Bot: Please enter the SSH address (IP:PORT):
User: 192.168.x.x:22
Bot: Please select the node type:
[Worker Node] [Management Node] [Backup Node]
...
Each step includes validation, with immediate feedback on input errors. This is far more user-friendly than the command-line style /newnode --name xxx --ip xxx --type xxx.
35 Feature Tests: 100% Pass Rate
Before declaring "production-ready," I ran a complete functional test covering all 35 feature points:
| Category | Test Items | Count |
|---|---|---|
| Node Management | CRUD + status switching | 8 |
| SSH Operations | Connect/execute/timeout/disconnect | 6 |
| Backup & Restore | Create/list/restore/delete | 5 |
| Health Checks | Single node/batch/alerting | 4 |
| Bot Interaction | Command parsing/buttons/callbacks | 5 |
| Access Control | Authentication/authorization/privilege escalation | 4 |
| Error Handling | Network errors/data anomalies | 3 |
Every single one was manually tested and confirmed passing. Honestly, by around the 25th test I was getting tired of it, but I forced myself to keep going to the end. There are no shortcuts to quality.
Performance Benchmarks
If you're claiming production-ready, performance data is non-negotiable:
- SSH connection establishment: 0.18 seconds (within LAN)
- Database query: 0.001 seconds (SQLite single-table query)
- Command response latency: < 0.5 seconds (from sending a command to receiving a reply)
- Batch node status check (10 nodes): ~2 seconds (parallel SSH)
I'm very satisfied with these numbers. Especially the DB query at 0.001 seconds — SQLite's performance in this kind of single-user scenario is truly unbeatable. Someone once suggested I switch to PostgreSQL, but at the current scale there's absolutely no need. Simple is better.
The SSH 0.18 seconds also validated a design decision: OCM doesn't use a persistent SSH connection pool. Every operation creates a new connection. The 0.18-second connection overhead is perfectly acceptable, and it avoids the complexity of connection management.
The Multi-Node Management Experience
When you have 4 servers to manage, the CLI advantage becomes crystal clear:
/mynode
The Bot responds immediately:
📊 Your Nodes (4)
1. 🟢 PC-A (192.168.x.x)
OpenClaw v0.9.2 | 3 agents | ⬆️ 72h
2. 🟢 T440 (192.168.x.x)
OpenClaw v0.9.2 | 15 agents | ⬆️ 168h
3. 🟡 PC-B (192.168.x.x)
OpenClaw v0.9.1 | 1 agent | ⬆️ 24h
⚠️ Version outdated
4. 🔴 CentOS (192.168.x.x)
Offline | Last online: 2h ago
You can see the global status at a glance. Click on any node to drill into details or execute operations. The entire interaction is smooth and natural.
Backup & Restore: My Peace of Mind
The feature I'm most proud of in the CLI system is backup and restore. One command to create a backup:
/backup PC-A
Bot response:
✅ PC-A Backup Complete
📦 Backup ID: bak-20260216-143022
📁 Size: 12.3MB
📋 Contents: Config files + Session data + Agent settings
💾 Stored at: T440:/backups/pc-a/
Restoring is equally simple. This means even if a machine completely crashes, I can restore the full environment on a new machine within minutes.
Mobile Management Interface
The biggest advantage of CLI is — it's available on your phone anytime.
Check system status during your commute, run a backup during lunch, handle alerts immediately late at night — none of these operations require opening a computer. Using Telegram as the management interface means push notifications are natively supported, with no need to implement a separate alerting system.
Production-Ready Confirmation
After comprehensive testing and performance validation, I officially declare the OCM CLI system production-ready.
Of course, "production-ready" doesn't mean perfect. There's still plenty of room for improvement: command auto-completion, operation history queries, a more detailed permission model… But the core functionality is stable and reliable, sufficient to support daily management work.
From writing the first line of code to today's "production-ready" declaration, this process has taught me something profound: whether a tool is good or not isn't about how many features it has, but the completeness and reliability of its core features. 35 tests, 100% pass rate — that's my accountability to my own work.
Top comments (0)