Petter Graff Architecture — 90-Day Roadmap
System Architecture — After Petter Graff Roadmap
Datum: 2026-02-23 | MC Tasks: #1840–#1852 | Testovi: 127/127 PASS
Dijagram: Kako sve komponente rade zajedno
┌─────────────────────────────────────────────────────────────────────┐
│ ALEM (CEO) │
│ │
│ localhost:3030 localhost:3030/decide │
│ ┌──────────────┐ ┌──────────────────┐ │
│ │ MC Dashboard │ │ Decision Queue │ ◄── Fullscreen │
│ │ (tasks, stats)│ │ (approve/reject) │ single-item UI │
│ └──────┬───────┘ └────────┬─────────┘ │
└──────────┼────────────────────────┼─────────────────────────────────┘
│ │
▼ ▼
┌──────────────────────────────────────────────────────────────────────┐
│ KNOWLEDGE GATEWAY │
│ knowledge-gateway.js │
│ │
│ ask("question") ──► Intent Classification ──┬── structured │
│ │── semantic │
│ │── operational │
│ └── docs │
│ │
│ ┌────────────┐ ┌─────────────────┐ ┌──────────┐ ┌───────────┐ │
│ │ facts.db │ │ Retrieval Orch. │ │ HiveMind │ │ BookStack │ │
│ │ contacts │ │ (RRF merge) │ │ + MC │ │ REST API │ │
│ │ leads │ │ 4 stores │ │ active │ │ search │ │
│ │ invoices │ │ semantic search │ │ intel │ │ │ │
│ └────────────┘ └─────────────────┘ └──────────┘ └───────────┘ │
└──────────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────────┐
│ PIPELINE ENGINE │
│ │
│ ┌─────────────────────────────────────────────────────────────┐ │
│ │ DAG Scheduler (dag-scheduler.js) │ │
│ │ │ │
│ │ lead ──► discovery ──► nda ──► proposal ──► contract │ │
│ │ │ │ │
│ │ ┌───────┴───────┐ │ │
│ │ ▼ ▼ │ │
│ │ setup design │ │
│ │ │ │ │ │
│ │ └───────┬───────┘ │ │
│ │ ▼ │ │
│ │ development ──► testing ──► ... │ │
│ └─────────────────────────────────────────────────────────────┘ │
│ │
│ ┌─────────────────┐ ┌────────────────────┐ │
│ │ Proposal Quality │ │ Lead Score │ │
│ │ Gate │ │ Feedback Loop │ │
│ │ • completeness │ │ • feature extract │ │
│ │ • pricing sanity │ │ • outcome tracking │ │
│ │ • tech stack │ │ • weight calc │ │
│ │ 28 tests ✓ │ │ 38 tests ✓ │ │
│ └─────────────────┘ └────────────────────┘ │
│ │
│ ┌─────────────────┐ ┌────────────────────┐ │
│ │ Retainer Auto- │ │ Saga Compensation │ │
│ │ Invoicer │ │ (saga.js) │ │
│ │ • monthly billing│ │ • step/compensate │ │
│ │ • auto-generate │ │ • durable mode │ │
│ │ • event notify │ │ • onboard-client │ │
│ └─────────────────┘ └────────────────────┘ │
└──────────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────────┐
│ INFRASTRUCTURE │
│ │
│ ┌───────────────────────────────────────────────────────────┐ │
│ │ 54 Daemons (daemon-registry.json) │ │
│ │ 23 active │ 31 scheduled │ P1: 16 │ P2: 27 │ │
│ └───────────────────────────────────────────────────────────┘ │
│ │
│ ┌─────────────────┐ ┌────────────────────┐ │
│ │ Back-Pressure │ │ Unified Telemetry │ │
│ │ Monitor │ │ (telemetry.js) │ │
│ │ • CPU > 80% │ │ • record/query │ │
│ │ • MEM > 85% │ │ • startTimer/end │ │
│ │ • queue > 100 │ │ • 30-day retention │ │
│ │ • isOverloaded() │ │ • telemetry.db │ │
│ │ 9 tests ✓ │ │ 27 tests ✓ │ │
│ └─────────────────┘ └────────────────────┘ │
│ │
│ ┌─────────────────┐ ┌────────────────────┐ │
│ │ DB Write Proxy │ │ Event Bus │ │
│ │ (db-proxy.js) │ │ (event-bus.js) │ │
│ │ • 100ms flush │ │ • emit/subscribe │ │
│ │ • 50-item batch │ │ • WAL mode │ │
│ │ • singleton │ │ • dead letter │ │
│ │ 8 tests ✓ │ │ • outbox relay │ │
│ └─────────────────┘ └────────────────────┘ │
└──────────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────────┐
│ BACKUP & DR │
│ │
│ ┌──────────────────────────────────────────────────────────────┐ │
│ │ 3-Layer Backup Strategy │ │
│ │ │ │
│ │ Layer 1: Local DB backup (daily 03:00) │ │
│ │ Layer 2: Offsite B2 (rclone, every 6h) ◄── NEW #1840 │ │
│ │ Layer 3: Mac Mini rsync (every 6h +3h) ◄── NEW #1851 │ │
│ │ │ │
│ │ ┌────────────┐ ┌────────────┐ ┌────────────────┐ │ │
│ │ │ Mac Studio │────►│ Backblaze │ │ Mac Mini │ │ │
│ │ │ (primary) │────►│ B2 Cloud │ │ (DR standby) │ │ │
│ │ │ │────►│ │ │ 15-min failover│ │ │
│ │ └────────────┘ └────────────┘ └────────────────┘ │ │
│ └──────────────────────────────────────────────────────────────┘ │
│ │
│ BCP: ~/system/ops/bcp-disaster-recovery.md │
│ Failover: ~/system/ops/mac-mini-failover.md │
└──────────────────────────────────────────────────────────────────────┘
Novi Moduli — Quick Reference
| Modul | Putanja | Svrha | Testovi |
|---|---|---|---|
| Knowledge Gateway | tools/knowledge-gateway.js | Unified ask() — 4 store-a (structured, semantic, operational, docs) | ✓ verified |
| DAG Scheduler | lib/dag-scheduler.js | Pipeline faze kao DAG umjesto linear array. Paralelno izvršavanje. | 17/17 |
| DB Write Proxy | lib/db-proxy.js | Write buffering za SQLite. 100ms flush, singleton po DB. | 8/8 |
| Telemetry | lib/telemetry.js | Unified event schema. record/query/stats. telemetry.db. | 27/27 |
| System Load Monitor | lib/system-load-monitor.js | isOverloaded() — CPU/MEM/queue back-pressure check. | 9/9 |
| Saga | lib/saga.js | Step/compensate pattern. Durable mode. Integrisan u onboard-client. | 8/8 |
| Proposal Quality Gate | tools/proposal-quality.js | 3 provjere prije CEO odluke: completeness, pricing, tech stack. | 28/28 |
| Lead Score Feedback | tools/lead-score-feedback.js | Outcome tracking + statistički weight calculation za lead scoring. | 38/38 |
| Retainer Invoicer | tools/retainer-invoicer.js | Auto-generisanje faktura za recurring contracts. | ✓ verified |
| Offsite Backup | daemons/offsite-backup.sh | rclone sync → Backblaze B2 svakih 6h. | ✓ script |
| DR Sync | daemons/dr-sync.sh | rsync → Mac Mini svakih 6h (+3h offset). | 36/36 |
| Daemon Registry | config/daemon-registry.json | Dokumentacija svih 54 daemona sa statusom i criticality. | ✓ complete |
| Decision Queue UI | tools/mc-dashboard.js /decide | Fullscreen approve/reject UI za Alema. | ✓ live |
Action Items za Alema
- Backblaze B2: Popuni credentials u
~/.config/rclone/rclone.conf(account ID + app key) - Mac Mini IP: Kreiraj
~/system/config/dr-sync.confsaMAC_MINI_HOST=192.168.68.XX - Decision Queue: Otvori
localhost:3030/decide— 99 pending decisions čeka review
Generisano: 2026-02-23 | MC #1840–#1852 | Architect: Petter Graff agent | Builder: John
No comments to display
No comments to display