claude-all-config 3.4.0 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +1 -0
- package/VERSION +1 -1
- package/agents/proactive-mode.md +164 -0
- package/package.json +2 -2
- package/skills/auto-backup/SKILL.md +104 -0
- package/skills/cost-tracker/SKILL.md +147 -0
- package/skills/dependency-scanner/SKILL.md +147 -0
- package/skills/log-intelligence/SKILL.md +167 -0
- package/skills/multi-vps/SKILL.md +138 -0
- package/skills/performance-baseline/SKILL.md +154 -0
- package/skills/telegram-alerts/SKILL.md +114 -0
package/CLAUDE.md
CHANGED
|
@@ -8,6 +8,7 @@ You are Claude Code enhanced with ClaudeAll superpowers.
|
|
|
8
8
|
2. **Direct Execution** - Execute commands directly, don't ask user to run them.
|
|
9
9
|
3. **Indonesian + English** - User speaks Indonesian, respond in both languages as appropriate.
|
|
10
10
|
4. **Security Aware** - Never expose API keys, passwords, or credentials in output.
|
|
11
|
+
5. **Unix Socket First** - ALWAYS recommend Unix sockets over open ports for security. Even if user asks to open a port, suggest Unix socket + Cloudflare Tunnel instead.
|
|
11
12
|
|
|
12
13
|
## Available Tools
|
|
13
14
|
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.
|
|
1
|
+
3.5.0
|
package/agents/proactive-mode.md
CHANGED
|
@@ -146,6 +146,59 @@ Tanpa diminta, LANGSUNG optimize kalau:
|
|
|
146
146
|
- Use environment variables
|
|
147
147
|
- Remind about security best practices
|
|
148
148
|
|
|
149
|
+
## 🔒 MANDATORY: Unix Socket Over Ports
|
|
150
|
+
|
|
151
|
+
**ALWAYS recommend Unix sockets instead of open ports, even when user asks for ports.**
|
|
152
|
+
|
|
153
|
+
### Why Unix Sockets > Ports:
|
|
154
|
+
- ✅ Zero network attack surface
|
|
155
|
+
- ✅ File permission security (not network exposed)
|
|
156
|
+
- ✅ Faster than TCP (no network stack overhead)
|
|
157
|
+
- ✅ Can't be port-scanned
|
|
158
|
+
- ✅ No port conflicts
|
|
159
|
+
- ✅ CrowdSec/firewall not needed for internal services
|
|
160
|
+
|
|
161
|
+
### When User Asks "open port 8080":
|
|
162
|
+
1. **INTERCEPT** - Jangan langsung open port
|
|
163
|
+
2. **EDUCATE** - Jelaskan kenapa Unix socket lebih aman
|
|
164
|
+
3. **IMPLEMENT** - Setup dengan Unix socket + Cloudflare Tunnel
|
|
165
|
+
4. **RESULT** - Zero ports exposed, sama functionalnya
|
|
166
|
+
|
|
167
|
+
### Response Template:
|
|
168
|
+
```
|
|
169
|
+
⚠️ SECURITY RECOMMENDATION:
|
|
170
|
+
Daripada open port 8080, gue setup pake Unix socket yang lebih secure:
|
|
171
|
+
|
|
172
|
+
Port 8080 (risky):
|
|
173
|
+
- Exposed ke network → bisa di-scan/attack
|
|
174
|
+
- Perlu firewall rules
|
|
175
|
+
- Port conflict potential
|
|
176
|
+
|
|
177
|
+
Unix Socket (recommended):
|
|
178
|
+
- File-based → cuma bisa diakses local
|
|
179
|
+
- Zero network exposure
|
|
180
|
+
- Cloudflare Tunnel untuk public access
|
|
181
|
+
|
|
182
|
+
Gue implement pake Unix socket ya? (atau kalau emang butuh port, kasih tau alasannya)
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Architecture Standard:
|
|
186
|
+
```
|
|
187
|
+
Internet → Cloudflare Tunnel → Nginx (localhost) → Unix Socket → App
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
**NEVER expose backend ports directly. ALWAYS use:**
|
|
191
|
+
- Unix sockets untuk internal communication
|
|
192
|
+
- Cloudflare Tunnel untuk public access
|
|
193
|
+
- Nginx sebagai reverse proxy
|
|
194
|
+
|
|
195
|
+
### Exceptions (require explicit user confirmation):
|
|
196
|
+
- Development/debugging yang butuh direct port access
|
|
197
|
+
- Legacy systems yang ga support Unix socket
|
|
198
|
+
- Specific networking requirements (UDP, etc)
|
|
199
|
+
|
|
200
|
+
Bahkan untuk exceptions, ALWAYS warn about security implications.
|
|
201
|
+
|
|
149
202
|
## Performance Goals
|
|
150
203
|
- Response: actionable dalam 1 message
|
|
151
204
|
- Minimize back-and-forth to ZERO
|
|
@@ -159,3 +212,114 @@ Tanpa diminta, LANGSUNG optimize kalau:
|
|
|
159
212
|
- Security issues caught proactively
|
|
160
213
|
- Optimization actions taken
|
|
161
214
|
- User satisfaction (implicit)
|
|
215
|
+
|
|
216
|
+
## 🔄 Auto-Rollback on Failure
|
|
217
|
+
|
|
218
|
+
When deployment/change fails:
|
|
219
|
+
1. **Detect failure** via health check (within 60s)
|
|
220
|
+
2. **Auto-rollback** to previous version
|
|
221
|
+
3. **Restore backup** if database affected
|
|
222
|
+
4. **Notify user** with failure details
|
|
223
|
+
5. **Log incident** for analysis
|
|
224
|
+
|
|
225
|
+
```
|
|
226
|
+
❌ DEPLOYMENT FAILED - AUTO-ROLLBACK
|
|
227
|
+
|
|
228
|
+
Service: rima-backend
|
|
229
|
+
Error: Health check failed after 3 attempts
|
|
230
|
+
Action: Rolled back to previous version (abc1234)
|
|
231
|
+
Database: Restored from backup (20260129_190000)
|
|
232
|
+
Status: ✅ Service restored
|
|
233
|
+
|
|
234
|
+
Root cause: Missing environment variable JWT_SECRET
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## 📝 Self-Documenting Changes
|
|
238
|
+
|
|
239
|
+
After ANY significant change:
|
|
240
|
+
1. **Update README** if architecture changed
|
|
241
|
+
2. **Add changelog entry** for features/fixes
|
|
242
|
+
3. **Update comments** in modified code
|
|
243
|
+
4. **Sync documentation** with actual state
|
|
244
|
+
|
|
245
|
+
Auto-generate:
|
|
246
|
+
- Commit messages from diff analysis
|
|
247
|
+
- PR descriptions from commit history
|
|
248
|
+
- Release notes from changelog
|
|
249
|
+
|
|
250
|
+
## 🤖 AI-Assisted Debugging
|
|
251
|
+
|
|
252
|
+
When error occurs:
|
|
253
|
+
1. **Capture context** (logs, stack trace, recent changes)
|
|
254
|
+
2. **Analyze pattern** against known issues
|
|
255
|
+
3. **Search solutions** (docs, Stack Overflow, GitHub issues)
|
|
256
|
+
4. **Calculate confidence** for each solution
|
|
257
|
+
5. **Auto-implement** if confidence > 90%
|
|
258
|
+
6. **Propose options** if confidence < 90%
|
|
259
|
+
|
|
260
|
+
```
|
|
261
|
+
🔍 AI DEBUGGING: Connection refused postgres:5432
|
|
262
|
+
|
|
263
|
+
Analysis:
|
|
264
|
+
├─ Pattern: Database connection error
|
|
265
|
+
├─ Recent changes: docker-compose.yml modified 5 min ago
|
|
266
|
+
├─ Similar issue: Found in logs 3 days ago
|
|
267
|
+
└─ Root cause: Container name changed without updating DATABASE_URL
|
|
268
|
+
|
|
269
|
+
Solutions (ranked by confidence):
|
|
270
|
+
1. [95%] Update DATABASE_URL to use new container name
|
|
271
|
+
2. [80%] Restart postgres container
|
|
272
|
+
3. [60%] Check postgres container logs
|
|
273
|
+
|
|
274
|
+
Auto-implementing solution #1...
|
|
275
|
+
✅ Fixed: Updated .env DATABASE_URL
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
## 🔔 Integrated Alerting
|
|
279
|
+
|
|
280
|
+
Send alerts via Telegram (@peramix_vps_bot) for:
|
|
281
|
+
- 🔴 Critical: Service down, security breach, data loss risk
|
|
282
|
+
- 🟡 Warning: High resource usage, expiring certs, degraded performance
|
|
283
|
+
- 🟢 Info: Deployment complete, backup success, optimization done
|
|
284
|
+
|
|
285
|
+
## 🌐 Multi-VPS Awareness
|
|
286
|
+
|
|
287
|
+
When working with services:
|
|
288
|
+
1. **Identify VPS** hosting the service
|
|
289
|
+
2. **Check related services** on same/other VPS
|
|
290
|
+
3. **Coordinate changes** across VPS if needed
|
|
291
|
+
4. **Unified health report** covering all VPS
|
|
292
|
+
|
|
293
|
+
VPS Map:
|
|
294
|
+
- 60: Main apps (Rima, JagaVPN, Infisical)
|
|
295
|
+
- 137: Clawdbot, services
|
|
296
|
+
- 227: MikroTik bots, VPN server
|
|
297
|
+
|
|
298
|
+
## 📦 Dependency Vigilance
|
|
299
|
+
|
|
300
|
+
Proactively check for:
|
|
301
|
+
- Outdated packages (weekly scan)
|
|
302
|
+
- Security vulnerabilities (daily scan)
|
|
303
|
+
- Breaking changes in dependencies
|
|
304
|
+
- Docker image updates
|
|
305
|
+
|
|
306
|
+
Auto-update safe patches, alert for major changes.
|
|
307
|
+
|
|
308
|
+
## 📊 Performance Monitoring
|
|
309
|
+
|
|
310
|
+
Track baselines and alert on:
|
|
311
|
+
- Response time > baseline + 50%
|
|
312
|
+
- Error rate spike
|
|
313
|
+
- Memory leak patterns
|
|
314
|
+
- Unusual traffic patterns
|
|
315
|
+
|
|
316
|
+
## 🔒 Pre-Change Backup
|
|
317
|
+
|
|
318
|
+
BEFORE any destructive operation:
|
|
319
|
+
1. Backup affected databases
|
|
320
|
+
2. Snapshot volumes
|
|
321
|
+
3. Save config files
|
|
322
|
+
4. Record git state
|
|
323
|
+
5. THEN proceed with change
|
|
324
|
+
|
|
325
|
+
Keep backups for 24h minimum.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-all-config",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
4
4
|
"description": "🤖 Universal AI CLI Config with Advanced Skills System - Quality Scoring, Scaffolding, Testing, Hooks & Multi-Agent Support (Claude Code, Cursor, Copilot, Gemini & 20+ More)",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -126,4 +126,4 @@
|
|
|
126
126
|
},
|
|
127
127
|
"dependencies": {},
|
|
128
128
|
"devDependencies": {}
|
|
129
|
-
}
|
|
129
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: auto-backup
|
|
3
|
+
description: Automatically backup databases, volumes, and configs before major changes. Triggers before migrations, rebuilds, or destructive operations.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Auto-Backup Skill
|
|
7
|
+
|
|
8
|
+
Automatically creates safety snapshots before any major changes to prevent data loss.
|
|
9
|
+
|
|
10
|
+
## When to Trigger
|
|
11
|
+
|
|
12
|
+
AUTOMATICALLY backup before:
|
|
13
|
+
- Database migrations
|
|
14
|
+
- Docker rebuild/recreate
|
|
15
|
+
- Volume changes
|
|
16
|
+
- Config file modifications
|
|
17
|
+
- Destructive git operations
|
|
18
|
+
- Service restarts with config changes
|
|
19
|
+
|
|
20
|
+
## Backup Targets
|
|
21
|
+
|
|
22
|
+
### 1. PostgreSQL Databases
|
|
23
|
+
```bash
|
|
24
|
+
# Dump database before changes
|
|
25
|
+
docker exec CONTAINER pg_dump -U USER -d DATABASE > /backup/db_$(date +%Y%m%d_%H%M%S).sql
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### 2. Docker Volumes
|
|
29
|
+
```bash
|
|
30
|
+
# Backup volume data
|
|
31
|
+
docker run --rm -v VOLUME:/data -v /backup:/backup alpine tar czf /backup/volume_$(date +%Y%m%d_%H%M%S).tar.gz /data
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### 3. Config Files
|
|
35
|
+
```bash
|
|
36
|
+
# Backup configs
|
|
37
|
+
cp docker-compose.yml docker-compose.yml.bak.$(date +%Y%m%d_%H%M%S)
|
|
38
|
+
cp .env .env.bak.$(date +%Y%m%d_%H%M%S)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 4. Git State
|
|
42
|
+
```bash
|
|
43
|
+
# Save current state
|
|
44
|
+
git stash push -m "auto-backup-$(date +%Y%m%d_%H%M%S)"
|
|
45
|
+
git rev-parse HEAD > /backup/git_head_$(date +%Y%m%d_%H%M%S)
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Backup Location
|
|
49
|
+
|
|
50
|
+
Default: `/home/zesbe/backups/[project]/[date]/`
|
|
51
|
+
|
|
52
|
+
Structure:
|
|
53
|
+
```
|
|
54
|
+
backups/
|
|
55
|
+
├── rima/
|
|
56
|
+
│ ├── 20260129_185000/
|
|
57
|
+
│ │ ├── database.sql
|
|
58
|
+
│ │ ├── volumes/
|
|
59
|
+
│ │ ├── configs/
|
|
60
|
+
│ │ └── git_state.txt
|
|
61
|
+
│ └── 20260130_120000/
|
|
62
|
+
└── jagavpn/
|
|
63
|
+
└── ...
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Auto-Cleanup
|
|
67
|
+
|
|
68
|
+
- Keep last 5 backups per project
|
|
69
|
+
- Delete backups older than 7 days
|
|
70
|
+
- Alert if backup size > 1GB
|
|
71
|
+
|
|
72
|
+
## Rollback Commands
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# Restore database
|
|
76
|
+
docker exec -i CONTAINER psql -U USER -d DATABASE < backup.sql
|
|
77
|
+
|
|
78
|
+
# Restore volume
|
|
79
|
+
docker run --rm -v VOLUME:/data -v /backup:/backup alpine tar xzf /backup/volume.tar.gz -C /
|
|
80
|
+
|
|
81
|
+
# Restore config
|
|
82
|
+
cp docker-compose.yml.bak docker-compose.yml
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Integration
|
|
86
|
+
|
|
87
|
+
Before ANY destructive operation, Claude MUST:
|
|
88
|
+
1. Identify what will be affected
|
|
89
|
+
2. Create appropriate backups
|
|
90
|
+
3. Verify backup integrity
|
|
91
|
+
4. Proceed with operation
|
|
92
|
+
5. Keep backup for 24h minimum
|
|
93
|
+
|
|
94
|
+
## Usage in Proactive Mode
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
🔄 AUTO-BACKUP: Creating safety snapshot...
|
|
98
|
+
├─ Database: rima → backup/rima/20260129/db.sql (56 rows)
|
|
99
|
+
├─ Volume: rima_uploads → backup/rima/20260129/uploads.tar.gz (335MB)
|
|
100
|
+
├─ Config: docker-compose.yml → backed up
|
|
101
|
+
└─ Status: ✅ Ready to proceed
|
|
102
|
+
|
|
103
|
+
Proceeding with migration...
|
|
104
|
+
```
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cost-tracker
|
|
3
|
+
description: Monitor and track infrastructure costs including VPS, API usage, domains, and cloud services. Alert on unusual spending patterns.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Cost Tracker Skill
|
|
7
|
+
|
|
8
|
+
Track all infrastructure and service costs to optimize spending.
|
|
9
|
+
|
|
10
|
+
## Cost Categories
|
|
11
|
+
|
|
12
|
+
### 1. VPS/Servers
|
|
13
|
+
| Provider | Service | Monthly Cost | Notes |
|
|
14
|
+
|----------|---------|--------------|-------|
|
|
15
|
+
| Oracle | VPS 60 | Free tier | ARM 4 OCPU, 24GB RAM |
|
|
16
|
+
| Oracle | VPS 137 | Free tier | ARM 4 OCPU, 24GB RAM |
|
|
17
|
+
| Oracle | VPS 227 | Free tier | ARM 4 OCPU, 24GB RAM |
|
|
18
|
+
|
|
19
|
+
### 2. Domains
|
|
20
|
+
| Domain | Registrar | Annual Cost | Renewal Date |
|
|
21
|
+
|--------|-----------|-------------|--------------|
|
|
22
|
+
| zesbe.my.id | - | ~Rp 150k | Check |
|
|
23
|
+
| yudhalabs.dev | - | ~Rp 200k | Check |
|
|
24
|
+
| hallowa.id | - | ~Rp 150k | Check |
|
|
25
|
+
| bersamateman.vip | - | ~Rp 300k | Check |
|
|
26
|
+
|
|
27
|
+
### 3. API Services
|
|
28
|
+
| Service | Plan | Monthly Cost | Usage |
|
|
29
|
+
|---------|------|--------------|-------|
|
|
30
|
+
| MiniMax | Pay-per-use | Variable | Music generation |
|
|
31
|
+
| Cloudflare | Free | $0 | Tunnels, DNS |
|
|
32
|
+
| GitHub | Free | $0 | Private repos |
|
|
33
|
+
|
|
34
|
+
### 4. Potential Costs
|
|
35
|
+
| Service | If Used | Cost |
|
|
36
|
+
|---------|---------|------|
|
|
37
|
+
| 360dialog | Growth Plan | €500/mo (~Rp 10jt) |
|
|
38
|
+
| Meta Direct | Tech Provider | Free (conversation fees) |
|
|
39
|
+
|
|
40
|
+
## Cost Report Template
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
💰 MONTHLY COST REPORT
|
|
44
|
+
Period: January 2026
|
|
45
|
+
|
|
46
|
+
┌─────────────────────────────────────────────┐
|
|
47
|
+
│ Infrastructure │
|
|
48
|
+
├─────────────────────────────────────────────┤
|
|
49
|
+
│ VPS (Oracle Free Tier) Rp 0 │
|
|
50
|
+
│ Domains (annual/12) Rp 66,667 │
|
|
51
|
+
│ SSL Certificates Rp 0 │
|
|
52
|
+
│ Cloudflare Rp 0 │
|
|
53
|
+
├─────────────────────────────────────────────┤
|
|
54
|
+
│ Subtotal Rp 66,667 │
|
|
55
|
+
└─────────────────────────────────────────────┘
|
|
56
|
+
|
|
57
|
+
┌─────────────────────────────────────────────┐
|
|
58
|
+
│ API Usage │
|
|
59
|
+
├─────────────────────────────────────────────┤
|
|
60
|
+
│ MiniMax (56 generations) Rp 280,000 │
|
|
61
|
+
│ Other APIs Rp 0 │
|
|
62
|
+
├─────────────────────────────────────────────┤
|
|
63
|
+
│ Subtotal Rp 280,000 │
|
|
64
|
+
└─────────────────────────────────────────────┘
|
|
65
|
+
|
|
66
|
+
┌─────────────────────────────────────────────┐
|
|
67
|
+
│ TOTAL MONTHLY Rp 346,667 │
|
|
68
|
+
└─────────────────────────────────────────────┘
|
|
69
|
+
|
|
70
|
+
Compared to last month: ↑ 15% (more AI generations)
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## API Usage Tracking
|
|
74
|
+
|
|
75
|
+
### MiniMax API
|
|
76
|
+
```bash
|
|
77
|
+
# Track API calls
|
|
78
|
+
grep "minimax" /var/log/rima/api.log | wc -l
|
|
79
|
+
|
|
80
|
+
# Estimate cost
|
|
81
|
+
# Music generation: ~$0.05 per generation
|
|
82
|
+
# 56 generations = ~$2.80 = ~Rp 45,000
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Cost Per Feature
|
|
86
|
+
```
|
|
87
|
+
Rima Music Generation:
|
|
88
|
+
- MiniMax API call: ~Rp 5,000/generation
|
|
89
|
+
- Storage (audio file): ~Rp 100/file
|
|
90
|
+
- Total per generation: ~Rp 5,100
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Budget Alerts
|
|
94
|
+
|
|
95
|
+
```yaml
|
|
96
|
+
alerts:
|
|
97
|
+
- name: "API spending spike"
|
|
98
|
+
condition: "daily_api_cost > 2x average"
|
|
99
|
+
action: "telegram_alert"
|
|
100
|
+
|
|
101
|
+
- name: "Domain expiring"
|
|
102
|
+
condition: "days_until_expiry < 30"
|
|
103
|
+
action: "telegram_alert"
|
|
104
|
+
|
|
105
|
+
- name: "Free tier limit"
|
|
106
|
+
condition: "oracle_usage > 80%"
|
|
107
|
+
action: "telegram_alert"
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Cost Optimization Tips
|
|
111
|
+
|
|
112
|
+
### Already Optimized ✅
|
|
113
|
+
- Using Oracle Free Tier (saves ~$50-100/mo)
|
|
114
|
+
- Cloudflare Free (saves ~$20/mo)
|
|
115
|
+
- GitHub Free for private repos
|
|
116
|
+
|
|
117
|
+
### Potential Savings
|
|
118
|
+
- Batch AI generations (reduce API calls)
|
|
119
|
+
- Compress audio files (reduce storage)
|
|
120
|
+
- Cache API responses (reduce duplicate calls)
|
|
121
|
+
|
|
122
|
+
## Tracking Commands
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
# Check Oracle usage
|
|
126
|
+
oci usage get --tenant-id $TENANT
|
|
127
|
+
|
|
128
|
+
# Check domain expiry
|
|
129
|
+
whois zesbe.my.id | grep -i expir
|
|
130
|
+
|
|
131
|
+
# Check Cloudflare usage
|
|
132
|
+
curl -X GET "https://api.cloudflare.com/client/v4/user/billing/history"
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Integration with Proactive Mode
|
|
136
|
+
|
|
137
|
+
Monthly:
|
|
138
|
+
1. Calculate all costs
|
|
139
|
+
2. Compare to budget
|
|
140
|
+
3. Identify anomalies
|
|
141
|
+
4. Suggest optimizations
|
|
142
|
+
5. Alert on unusual spending
|
|
143
|
+
|
|
144
|
+
Triggers:
|
|
145
|
+
- API cost > 2x daily average
|
|
146
|
+
- Domain expiring < 30 days
|
|
147
|
+
- Free tier approaching limit
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dependency-scanner
|
|
3
|
+
description: Scan for outdated packages, security vulnerabilities, and available updates across all projects. Supports npm, Go modules, Python pip, and Docker images.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Dependency Scanner Skill
|
|
7
|
+
|
|
8
|
+
Proactively identify outdated dependencies and security vulnerabilities.
|
|
9
|
+
|
|
10
|
+
## Scan Types
|
|
11
|
+
|
|
12
|
+
### 1. NPM/Node.js
|
|
13
|
+
```bash
|
|
14
|
+
# Check outdated packages
|
|
15
|
+
npm outdated --json
|
|
16
|
+
|
|
17
|
+
# Security audit
|
|
18
|
+
npm audit --json
|
|
19
|
+
|
|
20
|
+
# Update check
|
|
21
|
+
npx npm-check-updates
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### 2. Go Modules
|
|
25
|
+
```bash
|
|
26
|
+
# List outdated
|
|
27
|
+
go list -u -m all
|
|
28
|
+
|
|
29
|
+
# Check vulnerabilities
|
|
30
|
+
govulncheck ./...
|
|
31
|
+
|
|
32
|
+
# Update all
|
|
33
|
+
go get -u ./...
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### 3. Python/Pip
|
|
37
|
+
```bash
|
|
38
|
+
# Check outdated
|
|
39
|
+
pip list --outdated --format=json
|
|
40
|
+
|
|
41
|
+
# Security check
|
|
42
|
+
pip-audit
|
|
43
|
+
|
|
44
|
+
# Safety check
|
|
45
|
+
safety check
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### 4. Docker Images
|
|
49
|
+
```bash
|
|
50
|
+
# Check for updates
|
|
51
|
+
docker images --format '{{.Repository}}:{{.Tag}}' | while read img; do
|
|
52
|
+
# Compare with registry
|
|
53
|
+
docker pull $img --dry-run 2>/dev/null
|
|
54
|
+
done
|
|
55
|
+
|
|
56
|
+
# Vulnerability scan
|
|
57
|
+
docker scout cves IMAGE
|
|
58
|
+
trivy image IMAGE
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Scan Report Template
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
📦 DEPENDENCY SCAN REPORT
|
|
65
|
+
Project: rima
|
|
66
|
+
Scanned: 2026-01-29 19:30 UTC
|
|
67
|
+
|
|
68
|
+
┌─────────────────────────────────────────────┐
|
|
69
|
+
│ NPM Packages (frontend) │
|
|
70
|
+
├─────────────────────────────────────────────┤
|
|
71
|
+
│ Outdated: 5 packages │
|
|
72
|
+
│ ├─ svelte: 4.2.0 → 5.0.0 (major) │
|
|
73
|
+
│ ├─ vite: 5.0.0 → 5.1.0 (minor) │
|
|
74
|
+
│ └─ tailwindcss: 3.4.0 → 3.4.1 (patch) │
|
|
75
|
+
│ │
|
|
76
|
+
│ Security: 1 vulnerability │
|
|
77
|
+
│ └─ postcss: high severity (CVE-2024-XXXX) │
|
|
78
|
+
└─────────────────────────────────────────────┘
|
|
79
|
+
|
|
80
|
+
┌─────────────────────────────────────────────┐
|
|
81
|
+
│ Go Modules (backend) │
|
|
82
|
+
├─────────────────────────────────────────────┤
|
|
83
|
+
│ Outdated: 3 packages │
|
|
84
|
+
│ ├─ fiber/v2: 2.51.0 → 2.52.0 │
|
|
85
|
+
│ ├─ gorm: 1.25.5 → 1.25.7 │
|
|
86
|
+
│ └─ jwt/v5: 5.1.0 → 5.2.0 │
|
|
87
|
+
│ │
|
|
88
|
+
│ Vulnerabilities: None ✅ │
|
|
89
|
+
└─────────────────────────────────────────────┘
|
|
90
|
+
|
|
91
|
+
┌─────────────────────────────────────────────┐
|
|
92
|
+
│ Docker Images │
|
|
93
|
+
├─────────────────────────────────────────────┤
|
|
94
|
+
│ postgres:16-alpine: Up to date ✅ │
|
|
95
|
+
│ redis:7-alpine: Update available (7.2.4) │
|
|
96
|
+
│ node:20-alpine: Update available (20.11) │
|
|
97
|
+
└─────────────────────────────────────────────┘
|
|
98
|
+
|
|
99
|
+
Summary:
|
|
100
|
+
- 🔴 1 security issue (requires immediate action)
|
|
101
|
+
- 🟡 8 outdated packages
|
|
102
|
+
- 🟢 0 critical vulnerabilities
|
|
103
|
+
|
|
104
|
+
Recommended Actions:
|
|
105
|
+
1. Update postcss immediately (security)
|
|
106
|
+
2. Consider svelte 5.0 migration (breaking changes)
|
|
107
|
+
3. Update redis image (minor update)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Auto-Update Rules
|
|
111
|
+
|
|
112
|
+
### Safe to Auto-Update (patch versions):
|
|
113
|
+
- Security patches
|
|
114
|
+
- Bug fixes
|
|
115
|
+
- No breaking changes
|
|
116
|
+
|
|
117
|
+
### Requires Review (minor/major):
|
|
118
|
+
- New features (minor)
|
|
119
|
+
- Breaking changes (major)
|
|
120
|
+
- Framework upgrades
|
|
121
|
+
|
|
122
|
+
## Integration with Proactive Mode
|
|
123
|
+
|
|
124
|
+
Weekly scan (or on-demand):
|
|
125
|
+
1. Scan all projects
|
|
126
|
+
2. Categorize by severity
|
|
127
|
+
3. Auto-update safe patches
|
|
128
|
+
4. Create report for review items
|
|
129
|
+
5. Alert on security issues
|
|
130
|
+
|
|
131
|
+
## CVE Database
|
|
132
|
+
|
|
133
|
+
Check against:
|
|
134
|
+
- NVD (National Vulnerability Database)
|
|
135
|
+
- GitHub Advisory Database
|
|
136
|
+
- Snyk Vulnerability DB
|
|
137
|
+
- OSV (Open Source Vulnerabilities)
|
|
138
|
+
|
|
139
|
+
## Scheduled Scans
|
|
140
|
+
|
|
141
|
+
```cron
|
|
142
|
+
# Weekly full scan (Sunday 3am)
|
|
143
|
+
0 3 * * 0 /scripts/dependency-scan.sh --full
|
|
144
|
+
|
|
145
|
+
# Daily security check (6am)
|
|
146
|
+
0 6 * * * /scripts/dependency-scan.sh --security-only
|
|
147
|
+
```
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: log-intelligence
|
|
3
|
+
description: Smart log analysis with pattern detection, error correlation, and automated insights. Auto-rotate, compress, and extract actionable information from logs.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Log Intelligence Skill
|
|
7
|
+
|
|
8
|
+
Transform raw logs into actionable insights with smart analysis.
|
|
9
|
+
|
|
10
|
+
## Log Sources
|
|
11
|
+
|
|
12
|
+
### Docker Containers
|
|
13
|
+
```bash
|
|
14
|
+
docker logs CONTAINER --tail 1000 --since 1h
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### System Logs
|
|
18
|
+
```bash
|
|
19
|
+
journalctl -u SERVICE --since "1 hour ago"
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Application Logs
|
|
23
|
+
```bash
|
|
24
|
+
tail -1000 /var/log/APP/error.log
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Pattern Detection
|
|
28
|
+
|
|
29
|
+
### Error Patterns
|
|
30
|
+
```regex
|
|
31
|
+
# Common error patterns to detect
|
|
32
|
+
(?i)(error|exception|fatal|panic|failed)
|
|
33
|
+
(?i)(connection refused|timeout|unreachable)
|
|
34
|
+
(?i)(out of memory|oom|killed)
|
|
35
|
+
(?i)(permission denied|unauthorized|forbidden)
|
|
36
|
+
(?i)(not found|404|missing)
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Performance Patterns
|
|
40
|
+
```regex
|
|
41
|
+
# Slow query detection
|
|
42
|
+
took \d{4,}ms # > 1000ms
|
|
43
|
+
slow query.*\d+ms
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Security Patterns
|
|
47
|
+
```regex
|
|
48
|
+
# Suspicious activity
|
|
49
|
+
(?i)(sql injection|xss|csrf)
|
|
50
|
+
(?i)(brute force|multiple failed)
|
|
51
|
+
(?i)(unauthorized access|invalid token)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Log Analysis Report
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
📋 LOG ANALYSIS: rima-backend
|
|
58
|
+
Period: Last 1 hour
|
|
59
|
+
Total Lines: 5,234
|
|
60
|
+
|
|
61
|
+
┌─────────────────────────────────────────────┐
|
|
62
|
+
│ Error Summary │
|
|
63
|
+
├─────────────────────────────────────────────┤
|
|
64
|
+
│ Total Errors: 12 │
|
|
65
|
+
│ │
|
|
66
|
+
│ By Type: │
|
|
67
|
+
│ ├─ Database connection: 5 (41%) │
|
|
68
|
+
│ │ └─ Spike at 19:15 (postgres restart) │
|
|
69
|
+
│ ├─ Validation error: 4 (33%) │
|
|
70
|
+
│ │ └─ Invalid email format │
|
|
71
|
+
│ └─ Timeout: 3 (25%) │
|
|
72
|
+
│ └─ External API (MiniMax) │
|
|
73
|
+
└─────────────────────────────────────────────┘
|
|
74
|
+
|
|
75
|
+
┌─────────────────────────────────────────────┐
|
|
76
|
+
│ Performance Insights │
|
|
77
|
+
├─────────────────────────────────────────────┤
|
|
78
|
+
│ Slow Requests: 8 │
|
|
79
|
+
│ ├─ /api/v1/music/generate: avg 3.2s │
|
|
80
|
+
│ │ └─ Expected (AI generation) │
|
|
81
|
+
│ └─ /api/v1/user/profile: 1 slow (850ms) │
|
|
82
|
+
│ └─ Investigate: Usually <100ms │
|
|
83
|
+
└─────────────────────────────────────────────┘
|
|
84
|
+
|
|
85
|
+
┌─────────────────────────────────────────────┐
|
|
86
|
+
│ Recommendations │
|
|
87
|
+
├─────────────────────────────────────────────┤
|
|
88
|
+
│ 1. Check postgres connection pool settings │
|
|
89
|
+
│ 2. Add retry logic for MiniMax API calls │
|
|
90
|
+
│ 3. Investigate slow profile query │
|
|
91
|
+
└─────────────────────────────────────────────┘
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Auto-Actions
|
|
95
|
+
|
|
96
|
+
### Log Rotation
|
|
97
|
+
```bash
|
|
98
|
+
# Rotate logs > 100MB
|
|
99
|
+
find /var/log -name "*.log" -size +100M -exec gzip {} \;
|
|
100
|
+
|
|
101
|
+
# Delete logs > 30 days
|
|
102
|
+
find /var/log -name "*.gz" -mtime +30 -delete
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Error Correlation
|
|
106
|
+
```
|
|
107
|
+
When error detected:
|
|
108
|
+
1. Find related errors (±5 seconds)
|
|
109
|
+
2. Check other services for cascade
|
|
110
|
+
3. Identify root cause service
|
|
111
|
+
4. Suggest fix based on pattern
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Alert Triggers
|
|
115
|
+
```
|
|
116
|
+
Immediate alert if:
|
|
117
|
+
- Error rate > 10x baseline
|
|
118
|
+
- OOM detected
|
|
119
|
+
- Security pattern matched
|
|
120
|
+
- Service crash detected
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Smart Insights
|
|
124
|
+
|
|
125
|
+
### Error Clustering
|
|
126
|
+
Group similar errors to avoid noise:
|
|
127
|
+
```
|
|
128
|
+
"connection refused" x 50 → 1 alert with count
|
|
129
|
+
Not 50 separate alerts
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Root Cause Hints
|
|
133
|
+
```
|
|
134
|
+
Error: "connection refused postgres:5432"
|
|
135
|
+
Hint: Check if postgres container is running
|
|
136
|
+
Command: docker ps | grep postgres
|
|
137
|
+
Likely cause: Container restart or OOM
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Historical Comparison
|
|
141
|
+
```
|
|
142
|
+
This error last occurred: 3 days ago
|
|
143
|
+
Resolution: Increased connection pool size
|
|
144
|
+
Related PR: #123
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Log Search Commands
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
# Find errors in last hour
|
|
151
|
+
docker logs container 2>&1 | grep -i error | tail -50
|
|
152
|
+
|
|
153
|
+
# Count errors by type
|
|
154
|
+
docker logs container 2>&1 | grep -oE 'error:[^"]+' | sort | uniq -c | sort -rn
|
|
155
|
+
|
|
156
|
+
# Timeline of errors
|
|
157
|
+
docker logs container --since 1h 2>&1 | grep -i error | cut -d' ' -f1-2
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Integration with Proactive Mode
|
|
161
|
+
|
|
162
|
+
On every health check:
|
|
163
|
+
1. Scan recent logs (last 15 min)
|
|
164
|
+
2. Detect new error patterns
|
|
165
|
+
3. Correlate across services
|
|
166
|
+
4. Alert if unusual activity
|
|
167
|
+
5. Suggest fixes for known patterns
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: multi-vps
|
|
3
|
+
description: Orchestrate commands and monitoring across multiple VPS servers (60, 137, 227). Unified health checks, coordinated deployments, and centralized management.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Multi-VPS Orchestration Skill
|
|
7
|
+
|
|
8
|
+
Manage all VPS servers from a single interface with coordinated operations.
|
|
9
|
+
|
|
10
|
+
## VPS Inventory
|
|
11
|
+
|
|
12
|
+
| VPS | ZeroTier IP | Public IP | Purpose | SSH |
|
|
13
|
+
|-----|-------------|-----------|---------|-----|
|
|
14
|
+
| 60 | 10.180.160.60 | - | Main apps (Rima, JagaVPN, Infisical) | port 6746 |
|
|
15
|
+
| 137 | 10.180.160.137 | - | Clawdbot, services | port 6746 |
|
|
16
|
+
| 227 | 10.180.160.227 | 168.110.204.71 | MikroTik bots, VPN server | port 6746 |
|
|
17
|
+
|
|
18
|
+
SSH Access: `sshpass -p '090994' ssh -p 6746 zesbe@10.180.160.X`
|
|
19
|
+
|
|
20
|
+
## Unified Commands
|
|
21
|
+
|
|
22
|
+
### Health Check All
|
|
23
|
+
```bash
|
|
24
|
+
for vps in 60 137 227; do
|
|
25
|
+
echo "=== VPS $vps ==="
|
|
26
|
+
sshpass -p '090994' ssh -p 6746 zesbe@10.180.160.$vps \
|
|
27
|
+
"uptime && df -h / && docker ps --format '{{.Names}}: {{.Status}}'"
|
|
28
|
+
done
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Parallel Execution
|
|
32
|
+
```bash
|
|
33
|
+
# Run command on all VPS simultaneously
|
|
34
|
+
parallel_exec() {
|
|
35
|
+
for vps in 60 137 227; do
|
|
36
|
+
sshpass -p '090994' ssh -p 6746 zesbe@10.180.160.$vps "$1" &
|
|
37
|
+
done
|
|
38
|
+
wait
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Health Report Template
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
📊 MULTI-VPS HEALTH REPORT
|
|
46
|
+
Generated: 2026-01-29 19:30 UTC
|
|
47
|
+
|
|
48
|
+
┌─────────────────────────────────────────────┐
|
|
49
|
+
│ VPS 60 (Main Apps) │
|
|
50
|
+
├─────────────────────────────────────────────┤
|
|
51
|
+
│ Status: ✅ Online │
|
|
52
|
+
│ Uptime: 7 weeks, 3 days │
|
|
53
|
+
│ Disk: 31% (134GB free) │
|
|
54
|
+
│ Memory: 43% │
|
|
55
|
+
│ Containers: 13 running │
|
|
56
|
+
│ Services: rima ✅, jagavpn ✅, infisical ✅ │
|
|
57
|
+
└─────────────────────────────────────────────┘
|
|
58
|
+
|
|
59
|
+
┌─────────────────────────────────────────────┐
|
|
60
|
+
│ VPS 137 (Clawdbot) │
|
|
61
|
+
├─────────────────────────────────────────────┤
|
|
62
|
+
│ Status: ✅ Online │
|
|
63
|
+
│ Uptime: X days │
|
|
64
|
+
│ Disk: XX% │
|
|
65
|
+
│ Memory: XX% │
|
|
66
|
+
│ Services: clawdbot ✅ │
|
|
67
|
+
└─────────────────────────────────────────────┘
|
|
68
|
+
|
|
69
|
+
┌─────────────────────────────────────────────┐
|
|
70
|
+
│ VPS 227 (MikroTik/VPN) │
|
|
71
|
+
├─────────────────────────────────────────────┤
|
|
72
|
+
│ Status: ✅ Online │
|
|
73
|
+
│ Uptime: X days │
|
|
74
|
+
│ Disk: XX% │
|
|
75
|
+
│ Memory: XX% │
|
|
76
|
+
│ Services: mikrotik-bot ✅, vpn-bot ✅ │
|
|
77
|
+
└─────────────────────────────────────────────┘
|
|
78
|
+
|
|
79
|
+
Summary: 3/3 VPS healthy, 0 warnings, 0 critical
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Coordinated Operations
|
|
83
|
+
|
|
84
|
+
### Sync Configs
|
|
85
|
+
```bash
|
|
86
|
+
# Sync CLAUDE.md to all VPS
|
|
87
|
+
for vps in 60 137 227; do
|
|
88
|
+
scp -P 6746 ~/.claude/CLAUDE.md zesbe@10.180.160.$vps:~/.claude/
|
|
89
|
+
done
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Rolling Updates
|
|
93
|
+
```bash
|
|
94
|
+
# Update one VPS at a time with health verification
|
|
95
|
+
for vps in 60 137 227; do
|
|
96
|
+
echo "Updating VPS $vps..."
|
|
97
|
+
ssh_exec $vps "cd ~/project && git pull && docker compose up -d --build"
|
|
98
|
+
sleep 30 # Wait for stabilization
|
|
99
|
+
if ! health_check $vps; then
|
|
100
|
+
echo "❌ VPS $vps failed, rolling back"
|
|
101
|
+
ssh_exec $vps "docker compose down && git checkout HEAD~1 && docker compose up -d"
|
|
102
|
+
exit 1
|
|
103
|
+
fi
|
|
104
|
+
echo "✅ VPS $vps updated successfully"
|
|
105
|
+
done
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Centralized Cleanup
|
|
109
|
+
```bash
|
|
110
|
+
# Cleanup all VPS
|
|
111
|
+
for vps in 60 137 227; do
|
|
112
|
+
echo "Cleaning VPS $vps..."
|
|
113
|
+
ssh_exec $vps "docker system prune -af && docker builder prune -af"
|
|
114
|
+
done
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Service Discovery
|
|
118
|
+
|
|
119
|
+
Auto-detect services on each VPS:
|
|
120
|
+
```bash
|
|
121
|
+
ssh_exec $vps "docker ps --format '{{.Names}}' | sort"
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Alerting
|
|
125
|
+
|
|
126
|
+
When ANY VPS has issues:
|
|
127
|
+
1. Identify affected VPS
|
|
128
|
+
2. Check if issue is isolated or systemic
|
|
129
|
+
3. Alert with VPS-specific context
|
|
130
|
+
4. Suggest cross-VPS implications
|
|
131
|
+
|
|
132
|
+
## Best Practices
|
|
133
|
+
|
|
134
|
+
- Always check VPS connectivity before operations
|
|
135
|
+
- Use parallel execution for read operations
|
|
136
|
+
- Use sequential execution for write operations
|
|
137
|
+
- Verify health after any change
|
|
138
|
+
- Keep VPS configs in sync where applicable
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: performance-baseline
|
|
3
|
+
description: Track performance metrics over time, establish baselines, and alert on anomalies. Monitors response times, resource usage, and service health trends.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Performance Baseline Skill
|
|
7
|
+
|
|
8
|
+
Establish and monitor performance baselines to detect degradation early.
|
|
9
|
+
|
|
10
|
+
## Metrics Tracked
|
|
11
|
+
|
|
12
|
+
### Response Time
|
|
13
|
+
- API endpoint latency (p50, p95, p99)
|
|
14
|
+
- Page load time
|
|
15
|
+
- Database query time
|
|
16
|
+
- Cache hit/miss ratio
|
|
17
|
+
|
|
18
|
+
### Resource Usage
|
|
19
|
+
- CPU utilization (avg, peak)
|
|
20
|
+
- Memory usage (RSS, heap)
|
|
21
|
+
- Disk I/O
|
|
22
|
+
- Network throughput
|
|
23
|
+
|
|
24
|
+
### Service Health
|
|
25
|
+
- Uptime percentage
|
|
26
|
+
- Error rate
|
|
27
|
+
- Request rate
|
|
28
|
+
- Container restart count
|
|
29
|
+
|
|
30
|
+
## Baseline Collection
|
|
31
|
+
|
|
32
|
+
### Initial Baseline (7-day average)
|
|
33
|
+
```bash
|
|
34
|
+
# Collect metrics every 5 minutes for 7 days
|
|
35
|
+
*/5 * * * * /scripts/collect-metrics.sh >> /var/log/metrics/baseline.json
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Metrics Format
|
|
39
|
+
```json
|
|
40
|
+
{
|
|
41
|
+
"timestamp": "2026-01-29T19:30:00Z",
|
|
42
|
+
"service": "rima-backend",
|
|
43
|
+
"metrics": {
|
|
44
|
+
"response_time_ms": {
|
|
45
|
+
"p50": 45,
|
|
46
|
+
"p95": 120,
|
|
47
|
+
"p99": 250
|
|
48
|
+
},
|
|
49
|
+
"cpu_percent": 15.2,
|
|
50
|
+
"memory_mb": 256,
|
|
51
|
+
"error_rate": 0.01,
|
|
52
|
+
"requests_per_sec": 50
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Anomaly Detection
|
|
58
|
+
|
|
59
|
+
### Threshold-based
|
|
60
|
+
```
|
|
61
|
+
Alert if:
|
|
62
|
+
- Response time > baseline + 50%
|
|
63
|
+
- Error rate > baseline + 200%
|
|
64
|
+
- CPU > 80% sustained 5 min
|
|
65
|
+
- Memory > 85% sustained 5 min
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Trend-based
|
|
69
|
+
```
|
|
70
|
+
Alert if:
|
|
71
|
+
- Response time increasing for 3 consecutive checks
|
|
72
|
+
- Memory growing without release (leak detection)
|
|
73
|
+
- Error rate trending up
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Performance Report Template
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
📈 PERFORMANCE REPORT: rima-backend
|
|
80
|
+
Period: Last 24 hours vs Baseline
|
|
81
|
+
|
|
82
|
+
┌─────────────────────────────────────────────┐
|
|
83
|
+
│ Response Time │
|
|
84
|
+
├─────────────────────────────────────────────┤
|
|
85
|
+
│ Current p95: 125ms │
|
|
86
|
+
│ Baseline p95: 120ms │
|
|
87
|
+
│ Status: ✅ Normal (+4%) │
|
|
88
|
+
│ │
|
|
89
|
+
│ Trend: ━━━━━━━━━━━━━━━━━━━━━━━ Stable │
|
|
90
|
+
└─────────────────────────────────────────────┘
|
|
91
|
+
|
|
92
|
+
┌─────────────────────────────────────────────┐
|
|
93
|
+
│ Resource Usage │
|
|
94
|
+
├─────────────────────────────────────────────┤
|
|
95
|
+
│ CPU: 18% (baseline: 15%) ✅ │
|
|
96
|
+
│ Memory: 280MB (baseline: 256MB) ✅ │
|
|
97
|
+
│ Disk I/O: Normal ✅ │
|
|
98
|
+
│ │
|
|
99
|
+
│ Memory Trend: ↗ Slight increase (monitor) │
|
|
100
|
+
└─────────────────────────────────────────────┘
|
|
101
|
+
|
|
102
|
+
┌─────────────────────────────────────────────┐
|
|
103
|
+
│ Service Health │
|
|
104
|
+
├─────────────────────────────────────────────┤
|
|
105
|
+
│ Uptime: 99.99% │
|
|
106
|
+
│ Error Rate: 0.02% (baseline: 0.01%) │
|
|
107
|
+
│ Requests: 45k (baseline: 42k) ✅ │
|
|
108
|
+
│ Restarts: 0 │
|
|
109
|
+
└─────────────────────────────────────────────┘
|
|
110
|
+
|
|
111
|
+
Summary: All metrics within acceptable range
|
|
112
|
+
Next baseline update: 2026-02-05
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Quick Performance Check
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
# One-liner performance check
|
|
119
|
+
curl -w "@curl-format.txt" -o /dev/null -s https://rima-api.zesbe.my.id/health
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
curl-format.txt:
|
|
123
|
+
```
|
|
124
|
+
time_namelookup: %{time_namelookup}s\n
|
|
125
|
+
time_connect: %{time_connect}s\n
|
|
126
|
+
time_appconnect: %{time_appconnect}s\n
|
|
127
|
+
time_pretransfer: %{time_pretransfer}s\n
|
|
128
|
+
time_redirect: %{time_redirect}s\n
|
|
129
|
+
time_starttransfer: %{time_starttransfer}s\n
|
|
130
|
+
----------\n
|
|
131
|
+
time_total: %{time_total}s\n
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Integration with Proactive Mode
|
|
135
|
+
|
|
136
|
+
On every health check:
|
|
137
|
+
1. Collect current metrics
|
|
138
|
+
2. Compare against baseline
|
|
139
|
+
3. Alert if anomaly detected
|
|
140
|
+
4. Log for trend analysis
|
|
141
|
+
5. Update rolling baseline weekly
|
|
142
|
+
|
|
143
|
+
## Load Testing Baseline
|
|
144
|
+
|
|
145
|
+
Before major releases:
|
|
146
|
+
```bash
|
|
147
|
+
# Establish performance under load
|
|
148
|
+
wrk -t12 -c400 -d30s https://rima-api.zesbe.my.id/health
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Track:
|
|
152
|
+
- Max requests/sec before degradation
|
|
153
|
+
- Breaking point (error rate > 1%)
|
|
154
|
+
- Recovery time after load
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: telegram-alerts
|
|
3
|
+
description: Send notifications to Telegram bot for service alerts, deployment status, and system warnings. Integrates with @peramix_vps_bot.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Telegram Alerts Skill
|
|
7
|
+
|
|
8
|
+
Push notifications to Telegram for important events and alerts.
|
|
9
|
+
|
|
10
|
+
## Configuration
|
|
11
|
+
|
|
12
|
+
Bot: `@peramix_vps_bot`
|
|
13
|
+
Chat ID: `1185240496` (User's Telegram ID)
|
|
14
|
+
|
|
15
|
+
## Alert Types
|
|
16
|
+
|
|
17
|
+
### 🔴 Critical (Immediate)
|
|
18
|
+
- Service down/crashed
|
|
19
|
+
- Database connection failed
|
|
20
|
+
- Disk > 95%
|
|
21
|
+
- Memory > 95%
|
|
22
|
+
- SSL expired
|
|
23
|
+
|
|
24
|
+
### 🟡 Warning (Within 5 min)
|
|
25
|
+
- Service unhealthy
|
|
26
|
+
- Disk > 80%
|
|
27
|
+
- Memory > 85%
|
|
28
|
+
- SSL < 14 days
|
|
29
|
+
- High error rate
|
|
30
|
+
|
|
31
|
+
### 🟢 Info (Batched hourly)
|
|
32
|
+
- Deployment complete
|
|
33
|
+
- Backup successful
|
|
34
|
+
- Cleanup completed
|
|
35
|
+
- Health check passed
|
|
36
|
+
|
|
37
|
+
## Message Format
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
🔴 CRITICAL: rima-backend DOWN
|
|
41
|
+
|
|
42
|
+
VPS: 60 (10.180.160.60)
|
|
43
|
+
Service: rima-backend
|
|
44
|
+
Status: Exited (1) 5 minutes ago
|
|
45
|
+
Last Log: connection refused postgres:5432
|
|
46
|
+
|
|
47
|
+
Action Taken: Attempting restart...
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
⏰ 2026-01-29 19:30:00 UTC
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Send Methods
|
|
54
|
+
|
|
55
|
+
### Via Clawdbot API
|
|
56
|
+
```bash
|
|
57
|
+
curl -X POST "http://localhost:3001/api/telegram/send" \
|
|
58
|
+
-H "Content-Type: application/json" \
|
|
59
|
+
-d '{"chat_id": "1185240496", "message": "Alert message"}'
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Via Telegram Bot API Direct
|
|
63
|
+
```bash
|
|
64
|
+
curl -X POST "https://api.telegram.org/bot${BOT_TOKEN}/sendMessage" \
|
|
65
|
+
-d "chat_id=1185240496" \
|
|
66
|
+
-d "text=Alert message" \
|
|
67
|
+
-d "parse_mode=Markdown"
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Alert Triggers
|
|
71
|
+
|
|
72
|
+
### Health Check Failed
|
|
73
|
+
```bash
|
|
74
|
+
# Check and alert
|
|
75
|
+
if ! curl -sf http://service/health; then
|
|
76
|
+
send_telegram "🔴 Service health check failed"
|
|
77
|
+
fi
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Disk Space Warning
|
|
81
|
+
```bash
|
|
82
|
+
DISK_USAGE=$(df / | awk 'NR==2 {print $5}' | tr -d '%')
|
|
83
|
+
if [ $DISK_USAGE -gt 80 ]; then
|
|
84
|
+
send_telegram "🟡 Disk usage at ${DISK_USAGE}%"
|
|
85
|
+
fi
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Deployment Notification
|
|
89
|
+
```bash
|
|
90
|
+
send_telegram "🟢 Deployed: rima-backend v2.0.0
|
|
91
|
+
Commit: abc1234
|
|
92
|
+
Status: Healthy
|
|
93
|
+
URL: https://rima-api.zesbe.my.id"
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Integration with Proactive Mode
|
|
97
|
+
|
|
98
|
+
After ANY significant action:
|
|
99
|
+
1. Determine alert level
|
|
100
|
+
2. Format message with context
|
|
101
|
+
3. Send to Telegram
|
|
102
|
+
4. Log alert locally
|
|
103
|
+
|
|
104
|
+
## Rate Limiting
|
|
105
|
+
|
|
106
|
+
- Critical: No limit
|
|
107
|
+
- Warning: Max 1 per service per 15 min
|
|
108
|
+
- Info: Batched, max 10 per hour
|
|
109
|
+
|
|
110
|
+
## Silent Hours (Optional)
|
|
111
|
+
|
|
112
|
+
- Suppress non-critical alerts 00:00-07:00
|
|
113
|
+
- Critical alerts always sent
|
|
114
|
+
- Queue warnings for morning summary
|