From 82e9d9f469a8e4285f8dfec7ea5a598d40bae60f Mon Sep 17 00:00:00 2001 From: chrischristiansen-glitch Date: Wed, 27 May 2026 20:24:26 +0200 Subject: [PATCH] =?UTF-8?q?docs:=20korrigert=20arkitektur=20=E2=80=94=20Co?= =?UTF-8?q?stGuard=20er=20OPAX-modul,=20ikke=20separat=20produkt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MASTERPLAN.md | 218 ++++++++++++++++++++++---------------------------- 1 file changed, 95 insertions(+), 123 deletions(-) diff --git a/MASTERPLAN.md b/MASTERPLAN.md index 0986780..118451d 100644 --- a/MASTERPLAN.md +++ b/MASTERPLAN.md @@ -1,50 +1,57 @@ # VAUCO MASTERPLAN — Chris Christiansen -**Sist oppdatert: 2026-05-27 20:xx CEST** -**Status: ✅ FASE A KOMPLETT | ✅ FASE B KOMPLETT | ✅ ML-1 live | ✅ CG1+CG2 live | ✅ OAuth live | CG3 neste** +**Sist oppdatert: 2026-05-27 20:30 CEST** +**Status: ✅ FASE A | ✅ FASE B | ✅ ML-1 | ✅ CG1+CG2 live | ✅ OAuth live | CG3 neste** + +> **Les dette først:** Autoritativ arkitektur er `vauco-os/VAUCO_OS_DOMAIN_ARCHITECTURE.md`. +> Ikke overstyr beslutninger som allerede er dokumentert der. --- -## KONTEKST — Hva vi bygger +## ARKITEKTUR-HIERARKI (autoritetivt) -To parallelle spor: +``` +Vauco AS (935 989 779) +├── Vauco OS ← internt operativsystem (kun Chris) +│ ├── os.vauco.no ← LIVE PROD +│ ├── oss.vauco.no ← STAGING (nåværende arbeidsområde) +│ ├── Jason (autonom agent) +│ ├── Vauco OS Hub (orchestrator) +│ └── Cloud Console ← salgsmoduler bygges herfra +│ └── CostGuard ← modul #1 (use case + første salgbar modul) +│ costguard.oss.vauco.no ← nåværende +│ costguard.os.vauco.no ← når live +│ +└── Threadstone ← separat SaaS-produkt til kunder + threadstone.vauco.no + app.threadstone.vauco.no +``` -1. **OPAX** — AI-drevet operativsystem for deg selv (intern cockpit, `opax.vauco.no`). - Medioteq og andre kunder onboardes via OPAX/Terraform — **du styrer det selv innenfra OPAX, ikke her.** +**CostGuard er et use case som beviste OPAX-arkitekturen.** +Det bygges simultant med OPAX som modul #1 i Cloud Console. +Medioteq og fremtidige kunder onboardes av deg selv via OPAX innenfra — ikke her. -2. **CostGuard** — Salgbart produkt. AI-drevet GCP-kostnadsovervåking som selges til andre bedrifter. - Stack: Dialogflow CX → OSVauco Cloud Run → Cloud Billing API → Gemini 2.5 Flash - Pris å drifte: ~$32-45/mnd. Salgspris: $99-299/mnd pr. kunde. - **Dette er fokus nå.** +--- + +## REPO-OVERSIKT -**Repo-oversikt:** | Repo | Hva det er | |---|---| | `OSVauco` | Kjerne: Cloud Run agent, GCP-scripts, ml/, auth/ | -| `vauco-gemini-tui-bridge` | Din TUI-cockpit | -| `vauco-os` | Arkitektur og kundedok | -| `vauco-bootstrap` | Terraform-modul for kunde-provisjonering (Fase C) | +| `vauco-gemini-tui-bridge` | TUI-cockpit (langt arbeid → bruk Gemini TUI) | +| `vauco-os` | Arkitektur og kundedok (authoritative) | +| `vauco-bootstrap` | Terraform-modul for kunde-provisjonering | | `deep-dream` | Strategisk visjon — aldri deploy herfra | --- ## AGENT-IDENTITET -| Identitet | E-post | Rolle | Formål | -|---|---|---|---| -| Eier / admin | `chris.christiansen@vauco.no` | `billing.admin` + `billing.viewer` | Full kontroll | -| Agent (OPAX) | `jason.vauger@vauco.no` | `billing.viewer` | Hente og rapportere kostnadsdata autonomt | -| Fremtidig gruppe | `billing@vauco.no` | `billing.viewer` (Fase C) | Delt innboks for team og kunder | - ---- - -## DNS / DOMENE-ARKITEKTUR - -| Domene | Type | Teknologi | Fase | -|---|---|---|---| -| `opax.vauco.no` | Intern cockpit (kun Chris) | CNAME → Cloud Run | ✅ Live | -| `costguard.vauco.no` | CostGuard salgsdemo | CNAME → Cloud Run /static/ | CG3 neste | -| `kunde1.vauco.no` / kundedomener | Kunde-instanser | LB + IAP (Terraform) | Fase C | +| Identitet | E-post | Rolle | +|---|---|---| +| Eier / admin | `chris.christiansen@vauco.no` | `billing.admin` + `billing.viewer` | +| Agent (OPAX) | `jason.vauger@vauco.no` | `billing.viewer` | +| Fremtidig gruppe | `billing@vauco.no` | `billing.viewer` (Fase C) | --- @@ -59,50 +66,39 @@ To parallelle spor: | `GET /health` | ✅ | Health check | | `POST /run` | ✅ | Agent (light/heavy) | | `POST /run/dag` | ✅ | Parallell DAG | -| `GET /billing/summary?client_id=X` | ✅ | Kostnad per tjeneste siste 30d | -| `GET /billing/forecast?client_id=X` | ✅ | Prognose basert på 7d snitt | -| `GET /billing/anomalies?client_id=X` | ✅ | Anomali-deteksjon + Pub/Sub | -| `GET /auth/login?client_id=X` | ✅ | Start OAuth2-flow for klient | -| `GET /auth/callback` | ✅ | Google redirect → lagrer token | +| `GET /billing/summary` | ✅ | Kostnad per tjeneste siste 30d | +| `GET /billing/forecast` | ✅ | Prognose 7d snitt | +| `GET /billing/anomalies` | ✅ | Anomali-deteksjon + Pub/Sub | +| `GET /auth/login?client_id=X` | ✅ | Start OAuth2-flow | +| `GET /auth/callback` | ✅ | Google redirect → token | | `GET /static/billing-dashboard.html` | ✅ | Billing dashboard UI | -| `GET /state` | ✅ | Agent state snapshot | +| `GET /state` | ✅ | Agent state | | `GET /telemetry/history` | ✅ | Telemetri | -**OAuth credentials (Vauco OS Web App):** +**OAuth (Vauco OS Web App):** - Client ID: `357036551735-ka7t2fv9ue2jp01bs826hpdctlvispuo.apps.googleusercontent.com` - Redirect URI: `https://osvauco-agent-357036551735.europe-west1.run.app/auth/callback` -- Secrets i Secret Manager: `OAUTH_CLIENT_ID`, `OAUTH_CLIENT_SECRET` +- Secrets: `OAUTH_CLIENT_ID`, `OAUTH_CLIENT_SECRET` (Secret Manager) -**BigQuery billing export:** -- Dataset: `propane-will-491900-m5:billing_export` -- Tabell: ikke ankommet ennå (aktivert 2026-05-27, forventet innen 24t) -- Når tabell dukker opp: sett `BILLING_TABLE` env-var i Cloud Run +**BigQuery:** `propane-will-491900-m5:billing_export` — tabell ventes innen 24t fra 2026-05-27 --- -## FASE CG — CostGuard ← AKTIV SPRINT +## FASE CG — CostGuard (OPAX modul #1) ← AKTIV ``` -[x] CG1 — Billing API-integrasjon - ml/billing_agent.py: GET /billing/summary, /forecast - BQ-spørring klar, venter på billing_export-tabell (i morgen) +[x] CG1 — ml/billing_agent.py: /billing/summary, /forecast +[x] CG2 — ml/anomaly_detector.py: anomali → Pub/Sub +[x] AUTH — OAuth2 flow live -[x] CG2 — Anomali-deteksjon - ml/anomaly_detector.py: forbruk > 2x 7d-snitt → Pub/Sub - -[x] AUTH — OAuth2 klient-onboarding - auth/oauth_flow.py + auth/token_store.py - /auth/login + /auth/callback live i main.py - Token lagres per client_id i Secret Manager - -[ ] CG3 — CostGuard landingsside - costguard.vauco.no: "Koble til GCP"-knapp → /auth/login - Dialogflow Messenger embed (Jason-v1 FAQ, DX1-DX3 ferdig) - Billing dashboard embed (/static/billing-dashboard.html ferdig) - CNAME costguard.vauco.no → Cloud Run - -[ ] CG4 — Onboard første kunde via vauco-bootstrap Terraform-modul +[ ] CG3 — costguard.oss.vauco.no landingsside + static/costguard.html i OSVauco-repo + "Koble til GCP" → /auth/login + Billing dashboard embed + CNAME costguard.oss.vauco.no → Cloud Run + (promoveres til costguard.os.vauco.no når klar) +[ ] CG4 — Første ekstern kunde via vauco-bootstrap [ ] CG5 — Salgsdemo klar ``` @@ -111,23 +107,20 @@ To parallelle spor: ## FASE A — ✅ KOMPLETT ``` -[x] A1-A9 — Alle ferdig. Se tidligere historikk. -[x] SMOKE — scripts/smoke-test.sh: 10/10 ✅ (2026-05-26 01:45 CEST) -RAG corpus: projects/357036551735/locations/europe-west1/ragCorpora/6917529027641081856 -Memory Engine: projects/357036551735/locations/us-central1/reasoningEngines/2260229219579592704 +[x] A1-A9 + SMOKE 10/10 ✅ (2026-05-26 01:45 CEST) +RAG: projects/357036551735/locations/europe-west1/ragCorpora/6917529027641081856 +Memory: projects/357036551735/locations/us-central1/reasoningEngines/2260229219579592704 ``` --- -## FASE A2 — Dialogflow CX FAQ-agent +## FASE A2 — Dialogflow CX (Jason-v1 FAQ) ``` -[x] DX1 — Agent: OSVauco FAQ, us-central1, propane-will-491900-m5 -[x] DX2 — Data Store: threadstone-faq-store, 39 Q&A-par -[x] DX3 — Norsk systemprompt, fungerer -[x] DX4 — Parkert til C4 (Medioteq) — Cloud Run URL: https://osvauco-agent-zjbqp3prqq-uc.a.run.app -[ ] DX5 — Publiser via Dialogflow Messenger (trigger: CG3) -[ ] DX6 — Budsjett-alert Dialogflow CX +[x] DX1-DX3 — Agent live, Data Store, norsk systemprompt +[x] DX4 — Parkert (Cloud Run-webhook til C4) +[ ] DX5 — Dialogflow Messenger (trigger: CG3) +[ ] DX6 — Budsjett-alert [ ] DX7 — Voice-kanal (trigger: etter DX5) [ ] B6 — Eksporter Dialogflow CX til versjonskontroll ``` @@ -147,50 +140,38 @@ Memory Engine: projects/357036551735/locations/us-central1/reasoningEngines/2260 ## FASE B — ✅ KOMPLETT ``` -[x] B1 — Cloud Run live -[x] B2 — GitHub PAT i Secret Manager -[x] B3 — Cloud Build 2nd gen (trigger: osvauco-agent-deploy) -[x] B4 — GitHub App webhook -[x] B5 — Cost guard 500 NOK/mnd + GCS ML-telemetri -[x] B1-IAP — opax.vauco.no CNAME live -[ ] B6 — Eksporter Dialogflow CX (se DX-lista) +[x] B1-B5, B1-IAP (opax.vauco.no CNAME live) +[ ] B6 — Dialogflow CX versjonskontroll (se DX-lista) ``` --- -## FASE C — Kunde-onboarding (Medioteq og videre) +## FASE C — Kunde-onboarding -> **NB: Medioteq og fremtidige kunder onboardes av deg selv via OPAX innenfra.** -> Dette er ikke en oppgave for ekstern assistanse. Terraform-modulen er klar. +> Medioteq og fremtidige kunder håndteres av deg selv via OPAX. ``` -[x] C1 — vauco-bootstrap Terraform-modul klar (validate: PASS) -[x] C2 — vauco-os kundeflate + CUSTOMER_API.md +[x] C1 — vauco-bootstrap Terraform-modul (validate: PASS) +[x] C2 — CUSTOMER_API.md [x] C3 — billing@vauco.no Google Group -[ ] C4 — Medioteq: HITL-møte → velg project_id → terraform apply - C4.1: project_id + billing_account_id (HITL-gate) - C4.2: Auth (Google login → vurder BankID sluttfase) +[ ] C4 — Medioteq: HITL-møte → project_id → terraform apply ``` --- ## INFRASTRUKTUR -| Script | Rolle | Status | -|--------|-------|--------| -| `00-authcheck.sh` | Verifiser gcloud-innlogging | Klar | -| `01-setupenv.sh` | Aktiver APIs, SA, IAM, budsjetter, Pub/Sub | Klar | -| `02-deploy.sh` | IAP-deploy på eget domene | Klar | -| `03-teardown.sh` | Riv ned Cloud Run (kjør hver kveld) | Klar | -| `04-observability-setup.sh` | Cloud Monitoring + alerting | Klar | -| `05-cloudrun-deploy.sh` | ADK-agent til Cloud Run | Klar | -| `06-cicd-setup.sh` | GitHub → Cloud Build 2nd gen | Klar | -| `07-rag-setup.sh` | RAG Engine corpus + fallback | Klar | -| `08-memorybank-setup.sh` | Memory Bank + auto-install | Klar | -| `09-cost-check.sh` | Kostnadsoversikt + Artifact Registry | Klar | -| `10-cost-guard.sh` | Cloud Function auto-teardown + GCS telemetri sink | Klar | -| `11-billing-iam-hardening.sh` | Billing IAM hardening | Klar | -| `scripts/smoke-test.sh` | 10-case røyktest | Klar | +| Script | Rolle | +|--------|-------| +| `00-authcheck.sh` | Verifiser innlogging | +| `01-setupenv.sh` | APIs, SA, IAM, Pub/Sub | +| `03-teardown.sh` | Riv ned Cloud Run (kjør hver kveld) | +| `04-observability-setup.sh` | Cloud Monitoring | +| `07-rag-setup.sh` | RAG corpus | +| `08-memorybank-setup.sh` | Memory Bank | +| `10-cost-guard.sh` | Auto-teardown + GCS telemetri | +| `11-billing-iam-hardening.sh` | IAM hardening | +| `scripts/smoke-test.sh` | 10-case røyktest | --- @@ -199,16 +180,8 @@ Memory Engine: projects/357036551735/locations/us-central1/reasoningEngines/2260 | ID | Hva | Status | |---|---|---| | OQ-01 | Memory Bank — ingen gcloud CLI | Python SDK only | -| OQ-02 | RAG Engine regional availability | Auto-fallback til us-east1 | -| OQ-03 | CMEK ikke for RAG Engine | VPC-SC only | -| OQ-04 | Cloud Build GitHub OAuth | **LØST** — 2nd gen | -| OQ-05 | gcloud alpha monitoring ustabil | Fallback til true | -| OQ-06 | Memory Bank auto-discovery | Eksplisitt env var | -| OQ-11 | Dialogflow CX Data Store norsk indeksering | Teste nb-NO i DX2 | -| OQ-12 | gemini-2.0-flash ikke tilgjengelig | **LØST** — gemini-2.5-flash/pro + LOCATION=global | -| OQ-13 | ML-telemetri /tmp/ flyktig | **LØST** — B5: GCS sink | -| OQ-14 | LB vs CNAME | **LØST** — CNAME intern, LB Terraform for kunder | -| OQ-15 | billing_export BQ-tabell ikke ankommet | Venter — aktivert 2026-05-27 | +| OQ-02 | RAG regional | Auto-fallback us-east1 | +| OQ-15 | billing_export BQ-tabell | Venter — aktivert 2026-05-27 | --- @@ -216,24 +189,23 @@ Memory Engine: projects/357036551735/locations/us-central1/reasoningEngines/2260 | Scenario | Kostnad/mnd | |---|---| -| Bare deg (dev, teardown daglig) | ~$25-75 | -| Dev + Dialogflow CX FAQ (10k req) | ~$145-195 | -| 1 betalende kunde (lett prod) | ~$115-280 | -| Medioteq-type (klinisk, compliance) | ~$220-350 | +| Dev (teardown daglig) | ~$25-75 | +| Dev + Dialogflow CX (10k req) | ~$145-195 | +| 1 betalende kunde | ~$115-280 | -Breakeven: 1 kunde til $300-500/mnd dekker alle kostnader. +Breakeven: 1 kunde à $300-500/mnd. --- -## LLM-RUTINGSSTRATEGI +## LLM-RUTING -| Modell | Pris (per 1M) | Bruksområde | -|---|---|---| -| `gemini-2.5-flash` | $0.30 / $2.50 | light — alle enkle kall | -| `gemini-2.5-pro` | $1.25 / $10.00 | heavy — reasoning, compliance | +| Modell | Bruksområde | +|---|---| +| `gemini-2.5-flash` | light — alle enkle kall | +| `gemini-2.5-pro` | heavy — reasoning, compliance | -Autoriserte heavy-brukere: `opax`, `admin` +`LOCATION=global` | Autoriserte heavy: `opax`, `admin` --- -*OSVauco-NMTMD-GCOS | propane-will-491900-m5 | global (modell) / europe-west1 (infra)* +*OSVauco | propane-will-491900-m5 | europe-west1*