Files
clawd/memory/kb/tools/infrastructure.md
Echo b8edd0aa70 Optimizări cost 97%: session initialization, model routing, prompt caching
- Session Initialization Rule: Load ONLY SOUL.md, USER.md, IDENTITY.md, memory/YYYY-MM-DD.md
  * Skip MEMORY.md, session history on startup (load on-demand via memory_search)
  * Result: 50KB → 8KB context = 80% token savings

- Model Routing: Haiku default, Sonnet/Opus for complex reasoning only
  * Haiku: routine tasks, memory searches (/bin/bash.00025/1K tokens)
  * Sonnet/Opus: architecture, security, complex debugging

- Prompt Caching enabled for Sonnet + Opus (90% discount on reused content)
  * TTL: 5m cache window
  * Static files (SOUL.md, USER.md) cached automatically
  * Savings: 5KB prompt = $0.015 → $0.0015 per reused call

- Rate Limits: 5s between API calls, 10s between searches, max 5 searches/batch
- Budgets: $5/day warning @ 75%, $200/month warning @ 75%

Gateway config (~/.openclaw/clawdbot.json):
  * agents.defaults.model.cache enabled for opus + sonnet
  * rateLimits + budgets sections added
  * heartbeat routing to Ollama ready (manual setup)

Files updated:
  - AGENTS.md: Core optimization rules documented
  - memory/kb/tools/session-initialization.md: Detailed initialization strategy
  - ~/.openclaw/clawdbot.json: Model config + caching + rate limits + budgets
2026-02-05 14:41:11 +00:00

152 lines
5.0 KiB
Markdown

# Infrastructură (Proxmox + Docker)
## Servicii LLM/AI locale
| LXC | Serviciu | IP:Port | Utilizare |
|-----|----------|---------|-----------|
| flowise (104) | **Ollama** | 10.0.20.161:11434 | Embeddings (all-minilm), LLM local |
| flowise (104) | Flowise | 10.0.20.161:3000 | Flow builder |
| dokploy (103) | Dokploy | 10.0.20.? | Deployment platform |
**Modele Ollama disponibile:**
- `all-minilm` - embeddings rapid (45MB) ← **folosit pentru memory_search**
- `nomic-embed-text` - embeddings calitate (274MB)
- `llama3.2:3b-instruct-q8_0` - LLM conversație (3.4GB)
- `smollm:135m` - LLM mic rapid (91MB)
---
## Docker LXC (portainer)
- **Host:** 10.0.20.170 (LXC 100 pe pvemini)
- **User:** echo
- **SSH:** `ssh echo@10.0.20.170`
- **Portainer:** https://10.0.20.170:9443
- **Docker:** v28.3.3 + Compose v2.39.1
- **Resurse:** 1GB RAM, 20GB disk
- **Proiecte:** `/opt/docker/`
**Containere:**
| Container | Port | Status | Descriere |
|-----------|------|--------|-----------|
| portainer | 9443 | ✅ | Management Docker |
| nginx | 443, 8080 | ✅ | Reverse proxy |
| roa-efactura | 5003 | ⚠️ | E-Factura ANAF |
| pdf-qr-app | 5002 | ✅ | QR facturi |
| flask_app | 5001 | ✅ | ROA Flask |
| bt-web-automation | 5000, 8081 | ✅ | BT automation |
| pulse | 7655 | ✅ | Monitoring Proxmox |
| wol-manager | - | ✅ | Wake-on-LAN |
| rustdesk (hbbs+hbbr) | 21115-21119 | ✅ | Remote desktop server |
**Proiecte docker-compose:**
- `/opt/docker/docker-compose.yaml` - stack principal (nginx, flask, efactura, qr)
- `/opt/docker/wol/docker-compose.yml` - Wake-on-LAN
- `/opt/docker/qrinvoice/docker-compose.yml` - QR Invoice app
---
## Proxmox Cluster (3 noduri)
**User:** echo | **Acces:** doar din 10.0.20.173 (moltbot) | **Sudo:** qm, pct, pvesh
### pveelite (10.0.20.202)
- **Resurse:** 16GB RAM, 557GB disk
- **SSH:** `ssh echo@10.0.20.202`
- **Scripturi:** `/opt/scripts/`
- `oracle-backup-monitor-proxmox.sh` - zilnic 21:00, verifică backup Oracle
- `weekly-dr-test-proxmox.sh` - sâmbătă 06:00, test restore Oracle DR (VM 109)
| VMID | Tip | Nume | Status |
|------|-----|------|--------|
| 109 | VM | oracle-dr-windows | stopped |
| 101 | LXC | minecraft | stopped |
| 110 | LXC | moltbot | running |
| 301 | LXC | docker-portainer-template | stopped |
### pvemini (10.0.20.201)
- **Resurse:** 64GB RAM, 1.4TB disk
- **SSH:** `ssh echo@10.0.20.201`
- **Scripturi monitorizare:** `/opt/scripts/`
- `ha-monitor.sh` - status cluster HA
- `monitor-ssl-certificates.sh` - verifică SSL-uri zilnic
- `ups-shutdown-cluster.sh` - shutdown orchestrat la UPS critic
- `ups-monthly-test.sh` - test baterie UPS lunar (1 ale lunii)
- `ups-maintenance-shutdown.sh` - shutdown pentru mentenanță UPS
- `vm107-monitor.sh` - monitorizează VM 107
- **Emailuri automate:** backup, cluster status, UPS, restore Oracle (sâmbătă)
| Cron | Oră | Script/Job |
|------|-----|------------|
| Zilnic 00:00 | ha-monitor.sh | Status cluster HA |
| 1 ale lunii 00:00 | ups-monthly-test.sh | Test baterie UPS |
| Zilnic 02:00 | vzdump backup | VM 100,108,104,106,201,171 → storage "backup" |
| Zilnic 22:00 | vzdump backup | LXC 101,110 (moltbot) → backup-pvemini-nfs |
| VMID | Tip | Nume | Status |
|------|-----|------|--------|
| 201 | VM | roacentral | running |
| 300 | VM | Win11-Template | stopped |
| 302 | VM | oracle-test-302 | stopped |
| 100 | LXC | portainer | running |
| 103 | LXC | dokploy | running |
| 104 | LXC | flowise | running |
| 105 | LXC | test | stopped |
| 106 | LXC | gitea | running |
| 108 | LXC | central-oracle | running |
| 171 | LXC | claude-agent | running |
#### LXC 171 - claude-agent (Development Environment)
- **IP:** 10.0.20.171
- **Resurse:** 4 cores, 16GB RAM, 32GB disk
- **OS:** Ubuntu (unprivileged, nesting enabled)
- **Tailscale:** Da (acces remote)
**Servicii:**
- `code-server@claude` — VS Code în browser
- `ttyd` — Web Terminal
- `ssh` — acces direct
**Claude Code:**
- Instalat și configurat
- Git configurat pentru `gitea.romfast.ro`
- Mod interactiv: `claude` (în terminal)
- Mod programatic: `claude -p "task description"` — pentru sarcini automatizate
**Utilizare:**
```bash
# Acces SSH
ssh user@10.0.20.171
# Sau prin Proxmox
ssh echo@10.0.20.201 "sudo pct exec 171 -- bash"
# Claude Code - interactiv
claude
# Claude Code - task direct
claude -p "descrie sarcina aici"
```
### pve1 (10.0.20.200)
- **Resurse:** 32GB RAM, 1.3TB disk
- **SSH:** `ssh echo@10.0.20.200`
- **Status:** Gol (fără VM/LXC)
---
## Când acționez singur (fără să întreb)
- **Monitorizare:** Verific status VM/LXC, resurse, health checks
- **Diagnozare:** Citesc logs, verific configurări, identific probleme
- **Raportare:** Informez despre probleme descoperite
## Când întreb întâi
- **Start/Stop VM sau LXC** - pot avea dependențe
- **Modificări configurare** - network, storage, resurse
- **Creare/Ștergere** - orice operație distructivă
- **Acces în containere** (pct enter) pentru modificări
## Când alertez imediat
- Container/VM down neașteptat
- Disk >90% utilizare
- Serviciu unhealthy >1h
- Erori repetate în logs