# HiveGrid 2.0 — Master-Milestone-Index Diese Datei ist der vollständige Plan für die Phase-1-Umsetzung des HiveGrid-2.0-Pflichtenhefts (`_bmad-output/pflichtenheft/`). **Gesamt:** 176 Milestones, gegliedert in zwei Querschnitt-Blöcke (Bauprinzipien + UI-Hot-Swap-Architektur) plus 7 Pflichtenheft-Blöcke. Jeder Milestone hat ein eigenes Verzeichnis mit `PLAN.md`. Die Slice- und Task-Planung pro Milestone übernimmt der ToolController auf Basis dieser Dateien. ## Vorbedingungen (außerhalb dieses Plans) - **EU-Sterilisation der Boilerplate** — Anthropic/OpenAI/Google-Auth raus, Mistral/Scaleway/AlephAlpha rein, TOTP+Magic-Link rein. - **RR7-Migration der Boilerplate zu Ende** — Root-Runtime → `apps/web`, hybrider Status auflösen. - **`AGENTS.md` im Repo-Root** — zentrale Regel-Datei für AI-Agents (Layer-Grenzen, Anti-Patterns, Import-Regeln). Wird mit M001 angelegt. Erst danach beginnt die aktive Modul-Umsetzung. ## Querschnitt-Hülle Teil 1: Bauprinzipien als Code (M001-M011) | ID | Titel | Bauprinzip | |---|---|---| | M001 | Audit-Log default | A.6 | | M002 | Klartext-Diagnostik | A.1 | | M003 | i18n-Pflicht-Wiring | A.4 | | M004 | Tenant-Scope-Wrapper + Owner-Check | A.5 Teil 1 | | M005 | URL-Tampering Hardening + Mass-Action-Schutz | A.5 Teil 2 | | M006 | Feature-Flag-Engine (Code-Layer) | A.7 | | M007 | Idempotenz-Wrapper für BullMQ | A.8 | | M008 | Apps-Engine: Adapter-Interface + State-Machine | A.2 Teil 1 | | M009 | Apps-Engine: Setup-Wizard + Sync-Log | A.2 Teil 2 | | M010 | Apps-Engine: Probe-Scheduler + Webhook-Sturm-Schutz | A.2 Teil 3 + A.16 | | M011 | Notification-Service-Layer | — | ## Querschnitt-Hülle Teil 2: UI-Hot-Swap-Architektur (M012-M017) | ID | Titel | Zweck | |---|---|---| | M012 | Workspace-Topologie (`view-models`, `ui-hivegrid`, `ui-subframe`) | Drei getrennte Pakete + ESLint-Boundary-Rules | | M013 | View-Model-Konvention | Daten-Shape-Regeln + Zod-Schemas + lint-erzwungen | | M014 | Action-Callback-Contract | Standard-Shape für UI→Server-Aktionen | | M015 | Subframe-Adapter-Layer | Brücke Subframe-Output → HiveGrid-Pages | | M016 | Visual-Regression-Gate | Playwright Screenshot-Diff in CI | | M017 | Hot-Swap-Drill | Synthetischer UI-Lib-Tausch in CI | ## Block 1 — Plattform-Fundament ### M27 Anmeldung/Mandanten/Rollen | ID | Titel | |---|---| | M018 | Mandanten-Anlage | | M019 | Mandanten-Trennung Hardening | | M020 | Email/Passwort-Auth + HIBP + Brute-Force | | M021 | Magic-Link + Sitzungs-Verwaltung | | M022 | TOTP-2FA + Notfall-Codes | | M023 | Rollen-Engine + 6 SHK-Standard-Rollen + Gruppen | | M024 | Mitarbeiter-Einladung/Deaktivierung | | M025 | Konto-Löschung (User + Admin) | | M026 | Mandanten-Lebenszyklus | | M027 | API-Keys + Tarif-Feature-Gates | ### M30 Mehrsprachigkeit | ID | Titel | |---|---| | M028 | User/Tenant Sprach-Settings + Auflösungs-Reihenfolge | | M029 | Sprach-Wechsler + Fallback-Hinweise | ### M31 Branding | ID | Titel | |---|---| | M030 | Hell/Dunkel-Modus + Capacitor-Status-Bar | ### M32 Feature-Flag Admin-UI | ID | Titel | |---|---| | M031 | Schalter-Definition + Lifecycle | | M032 | Filter-Editor + Einzel-Ausnahme-Editor | | M033 | Massen-Funktionen + Statistik + Audit-Historie | ### M37 Plattform-Admin | ID | Titel | |---|---| | M034 | Plattform-Admin-Auth (admin.) | | M035 | Plattform-Admin-Dashboard | | M036 | Mandanten-Verwaltung | | M037 | Stellvertreter-Anmeldung | | M038 | Mandanten-Mitarbeiter-Verwaltung | | M039 | Plattform-Admin-Konten + Rollen | | M040 | Interne Lead-Pipeline + Promote-to-Tenant | | M041 | System-Health + Audit-Anzeige + Datenschutz + Support | ## Block 2 — CRM-Kern ### M1 CRM | ID | Titel | |---|---| | M042 | Kontakt-Stammdaten | | M043 | Firma-Stammdaten + Hierarchie | | M044 | Schlagwörter + Custom-Felder | | M045 | Aktivitäts-Stream | | M046 | Listen + Segmente + DSGVO-Felder | ### M2 Lead-Inbox | ID | Titel | |---|---| | M047 | Lead-Inbox-Schema + Quellen-Adapter | | M048 | Lead-Routing pro Quelle [N4] | | M049 | Auto-Verkaufsfall-Anlage | | M050 | Spam/Duplikat-Erkennung | | M051 | Lead-Status-Pipeline + Verlust-Gründe | ### M23 Dateien | ID | Titel | |---|---| | M052 | Datei-Upload (Anti-Virus + Format-Whitelist) | | M053 | Speicher-Backend (S3 auf Scaleway) | | M054 | Permissions + Sharing + Versionierung | | M055 | Datei-Suche + Tagging + Archivierung | ### M24 Globale Suche | ID | Titel | |---|---| | M056 | Such-Index (Postgres FTS / Meilisearch) | | M057 | Permission-aware Search | | M058 | Such-UI + Saved-Searches | ## Block 3 — Vertrieb & Auftrag ### M3 Sales-Pipeline | ID | Titel | |---|---| | M059 | Pipeline-Konfiguration + SHK-Standard-Pipeline | | M060 | Verkaufsfall-CRUD + Pflichtfeld Vertriebler [N6] | | M061 | Kanban-UI + Drag&Drop | | M062 | Verlust/Gewinn-Gründe [N8] | | M063 | Auto-Auftragsprojekt [N7] + Setter-Closer [N17] | | M064 | Pipeline-Reporting + KWP-Sync | ### M4 Auftragspipeline | ID | Titel | |---|---| | M065 | Auftragspipeline-Konfiguration | | M066 | Auftrag-CRUD + KWP-Dokumenten-Archiv [N5] | | M067 | Plantafel mit Tagen-Granularität [N10] | | M068 | Mitglieder-Mgmt + Rollen pro Auftrag | | M069 | Abnahme-Workflow + Mängel-Liste | | M070 | Material-Listen + Lager-Anbindung | ### M26 Aufgaben | ID | Titel | |---|---| | M071 | Aufgaben-CRUD + Zuweisung | | M072 | Aufgaben-Listen pro Modul | | M073 | Erinnerungen + Push + Email | | M074 | Aufgaben-Sync mit ERP [N11] | ## Block 4 — USP-Säulen ### M17 Automation-Engine | ID | Titel | |---|---| | M075 | Automation-Schema + Auslöser-Registry | | M076 | Aktion-Registry + Steuerungs-Bausteine | | M077 | Bedingungen | | M078 | Visueller Editor (xyflow) | | M079 | Test-Lauf + Schwellenwert-Vorschau | | M080 | 24h-Undo-Fenster + Reversibilität | | M081 | Schleifen-Schutz + Webhook-Sturm + Anomalie | | M082 | Klartext-Logs + Re-Run + Trigger-Volumen-Metering | ### M18 KI-Layer | ID | Titel | |---|---| | M083 | EU-Provider-Layer (Mistral/Scaleway/AlephAlpha) | | M084 | Multi-Provider-Fallback + 30-Min-Health-Window | | M085 | Promptfoo-Eval-Suite mit Injection-Vektoren in CI | | M086 | KI-Sprach-zu-Automation | | M087 | RAG-Layer + Aktions-Grenze | | M088 | Token-Limits + Pay-as-you-go [N13] | ### M19 KWP-Integration | ID | Titel | |---|---| | M089 | KWP-API-Connector (REST/OAuth über Apps-Engine) | | M090 | KWP-API Connection-Health | | M091 | KWP-Push-Queue + Replay (Cloud-Outbox) | | M092 | KWP-API-Contract-Sentinel | | M093 | Konflikt-Auflösung „KWP gewinnt" [N14] | | M094 | Bidirektionale Plantafel-Sync [N10] | | M095 | Dokumenten-Archiv-Sync KWP→HiveGrid [N5] | > **Re-Cut 2026-06-04:** KWP bekommt eine offizielle API → Architektur von 3 auf 2 Komponenten, `kwpsync.exe` entfällt. Verbindlich: `docs/milestones/M19-KWP-API-RECUT.md`. ## Block 5 — Kommunikation ### M9 Email-Inbox | ID | Titel | |---|---| | M096 | Gmail-OAuth-Integration via Apps-Engine | | M097 | Email-Sync + Inbox-UI + Threading | | M098 | Email-Versand + Vorlagen | | M099 | Email-Tracking + Bounces | ### M10 Email-Marketing | ID | Titel | |---|---| | M100 | Marketing-Email-Editor | | M101 | Segmente + Empfänger-Auswahl | | M102 | Versand-Engine + DKIM/SPF | | M103 | A/B-Tests + Reporting | | M104 | Unsubscribe + Bounce-Handling | ### M12 Telefonie [N16] | ID | Titel | |---|---| | M105 | HalloPetra-Adapter | | M106 | AirCall-Adapter | | M107 | Anruf-Eingang + CRM-Verknüpfung | | M108 | Anruf-Ausgang + Click-to-Call | | M109 | Voicemail + Anruf-Notizen + Aufgaben-Auto | ### M13 Team-Chat | ID | Titel | |---|---| | M110 | Channel-Modell + Permissions | | M111 | Direkt-Nachrichten + Threading | | M112 | Datei/Foto-Anhänge | | M113 | Modul-Verknüpfungen | | M114 | Mentions + Push + Lese-Bestätigungen | ### M22 Notifications-Center (Service-Layer in M011) | ID | Titel | |---|---| | M115 | Notification-Center + Lese-Status | | M116 | User-Settings (Kanal + Stille Stunden) | | M117 | Kategorien + Bündelung | ### M25 Calendar-Sync | ID | Titel | |---|---| | M118 | Google-Calendar-Adapter | | M119 | Termin-Sync (bi-direktional) | | M120 | Termin-Display + Modul-Verknüpfung | ## Block 6 — Spezialfälle & Außenseite ### M5 Form-Builder | ID | Titel | |---|---| | M121 | Form-Editor | | M122 | Form-Veröffentlichung | | M123 | Submission-Eingang + CRM-Verknüpfung | | M124 | Conditional-Display (kein Branching) | | M125 | Rate-Limit + Captcha + DSGVO | ### M6 Booking | ID | Titel | |---|---| | M126 | Buchungs-Seite + Time-Slot-Engine | | M127 | Verfügbarkeits-Berechnung | | M128 | Bestätigungs-Flow | | M129 | Stornierung + No-Show-Tracking | ### M7 Angebot+Signatur | ID | Titel | |---|---| | M130 | Angebots-Erstellung | | M131 | PandaDoc/DocuSign-Integration | | M132 | Status-Tracking + Verkaufsfall-Verknüpfung | ### M14 HR-Hub | ID | Titel | |---|---| | M133 | Mitarbeiter-Stammdaten | | M134 | Dokumente-Bereich | | M135 | Urlaubs-Anträge | | M136 | Krankmeldungen | | M137 | Mitarbeiter-Kommunikation | | M138 | Onboarding-Drittanbieter [N18] | | M139 | HR-Berichte + Lohn-Export | | M140 | Mitarbeiter-Selbstbedienung | ### M15 Customer-Portal | ID | Titel | |---|---| | M141 | Customer-Portal-Auth | | M142 | Projekt-Sicht für Endkunde | | M143 | Datei-Upload durch Endkunde | | M144 | Subunternehmer-Zugang [N19] | | M145 | Skalierungs-Sicht [N19] | | M146 | Pro-Kunde-Lebensdauer-Mgmt [N19] | ### M20 GF-Dashboard | ID | Titel | |---|---| | M147 | Dashboard-Layout + Widget-Engine | | M148 | Standard-Widgets | | M149 | Custom-Widgets | | M150 | Export + Report-Versand | ## Block 7 — Compliance & Plattform-Außenseite ### M21 Audit-Log Anzeige | ID | Titel | |---|---| | M151 | Audit-Log-Anzeige + Filter + Volltext | | M152 | Audit-Export + Aufbewahrungs-Mgmt | ### M28 Subscriptions | ID | Titel | |---|---| | M153 | Stripe-Integration | | M154 | Plan-Engine + Seat-Modell | | M155 | Trial + Read-Only-Downgrade | | M156 | Trigger-Volumen-Metering [N13] | ### M29 Onboarding | ID | Titel | |---|---| | M157 | Onboarding-Wizard-Framework | | M158 | SHK-Standard-Daten-Provisionierung | | M159 | Branchen-Templates deklarativ (A.3) | | M160 | Test-Daten + Demo-Modus | ### M34 Public-API | ID | Titel | |---|---| | M161 | OpenAPI-Spec + Read-API | | M162 | API-Key-Auth + Rate-Limit | | M163 | Webhooks (signiert) | ### M35 DSGVO | ID | Titel | |---|---| | M164 | Daten-Export | | M165 | Lösch-Workflow + Anonymisierung | | M166 | Auskunfts-Workflow | ### M36 Mobile-App | ID | Titel | |---|---| | M167 | Capacitor-Setup + Build-Pipeline | | M168 | Native-Push + Status-Bar | | M169 | Mobile-First-Routes | | M170 | Offline-First für Foto-Upload | | M171 | App-Store-Compliance | ### M38 Help-Center | ID | Titel | |---|---| | M172 | Hilfe-Artikel-Mgmt | | M173 | Hilfe-Suche + Kontextuelle Hinweise | ### M39 Help-Desk | ID | Titel | |---|---| | M174 | Support-Ticket-Eingang | | M175 | Self-Service-Knöpfe | ### Doku | ID | Titel | |---|---| | M176 | Anti-Liste + Change-Request-Workflow als Repo-Doku (A.9) | ## Bewusst NICHT in Phase 1 (Anti-Liste) - M8 Rechnungs-UI (geparkt nach KWP-GF-Termin) - M16 Knowledge Base / Wiki - M33b Community-App-Marketplace - M33c Template-Marketplace - M40 CMS / Sites / Blog (komplett ausgeschlossen) - WhatsApp-Inbox, Unified Inbox [N15] (Phase 2) - Apple-Login, Google-OAuth, Microsoft-Anmeldung - GraphQL-API - Schreibendes Public-API - Hardware-Sicherheits-Schlüssel (FIDO2/WebAuthn) - IP-Whitelisting, SAML/SSO - Custom-Subdomain pro Mandant (außer Enterprise Phase 2) - Branding-White-Label, Custom-Fonts (Phase 2) - Sub-Workflows / Loops in Automation-Engine - Custom-JS-Expressions in Automation-Conditions - Eigene Buchhaltungs-Adapter (LexOffice, sevDesk, FastBill, Datev) - Andere ERPs (Taifun, TopKontor, Streit V.1) - Sipgate-Telefonie, sonstige Telefonie-Anbieter - Service-Modul (Wartung/Service als eigene Pipeline) — Phase 2 [N9] - HiveMind als autonomer Agent - NFC, Bluetooth, advanced native Mobile-Features - Versionierung von Angeboten Vollständige Begründungen siehe `_bmad-output/pflichtenheft/02-vision.md` Kapitel V.3. ## Architektur-Entscheidungen (kommen aus Party-Mode-Diskussion 2026-05-10) - **Designer-Workflow:** Subframe → Code-Output → User → AI-Agent → Integration. Subframe ist der Component-Catalog (kein separates Storybook). - **Daten-Fluss:** Synchron im Loader. Server bereitet View-Model auf, UI-Component bekommt fertiges VM als Prop. - **Agent-Regeln:** Eine zentrale `AGENTS.md` im Repo-Root. Pro Modul keine Sonder-Regeln, außer ausdrücklich nötig. - **Layer-Trennung (lint-erzwungen):** - `app/routes/**` → Loaders/Actions, baut View-Models, importiert `packages/ui-hivegrid`. Keine direkten Prisma-Calls. - `app/domain/**` → Domain-Logik, Prisma, BullMQ. Importiert NIE React oder UI. - `packages/view-models/**` → reine Funktionen (domain → VM). Kein React, kein Prisma. - `packages/ui-hivegrid/**` → Library-Adapter. Kennt weder Prisma noch Routen noch Auth. - `packages/ui-subframe/**` → Subframe-Output unangefasst. Wird NIE direkt von Routes importiert.