# Geschäftsprozesse & Use Cases Block 4/a

In diesem Kapitel werden die Use Cases eingerichtet und Business Processes entwickelt und eingerichtet. Mit Funktionstest's.

# Use Case 1 – Marktanalyse-Assistent (Semiconductor/Capacitor)



# Use Case 2 – MyFlexTraining (Fitness-Plattform mit KI)



# Use Case 3 – Excel/OnlyOffice KI-Integration



# Use Case 4 – Sprachgesteuerter Workflow (Whisper → n8n → AnythingLLM)



# Use Case 5 – Automatisierte Dokumentenverarbeitung (Paperless → KI → Ablage)



# Use Case 6 CRM-System Programmiert im KI-Programmer / Master-Arbeit

<span style="color: #1f3864;"><span style="font-family: Arial, serif;"><span style="font-size: 300%;">**KI-CRM**</span></span></span>

<span style="color: #2e74b5;"><span style="font-family: Arial, serif;"><span style="font-size: x-large;">Programmierstudio Setup-Dokumentation</span></span></span>

<span style="color: #666666;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">KI-gestütztes CRM-System für Exista AG</span></span></span>

<table cellpadding="5" cellspacing="0" id="bkmrk-autor-thomas-sch%C3%BCtz-" width="400"><colgroup><col width="149"></col> <col width="229"></col> </colgroup><tbody><tr valign="top"><td bgcolor="#ebf3fb" width="149"><span style="font-family: Arial, serif;"><span style="font-size: small;">**Autor**</span></span>

</td><td width="229"><span style="font-family: Arial, serif;"><span style="font-size: small;">Thomas Schütz</span></span>

</td></tr><tr></tr><tr valign="top"><td bgcolor="#ebf3fb" width="149"><span style="font-family: Arial, serif;"><span style="font-size: small;">**Unternehmen**</span></span>

</td><td width="229"></td></tr><tr></tr><tr valign="top"><td bgcolor="#ebf3fb" width="149"><span style="font-family: Arial, serif;"><span style="font-size: small;">**Datum**</span></span>

</td><td width="229"><span style="font-family: Arial, serif;"><span style="font-size: small;">27. März 2026</span></span>

</td></tr><tr></tr><tr valign="top"><td bgcolor="#ebf3fb" width="149"><span style="font-family: Arial, serif;"><span style="font-size: small;">**Version**</span></span>

</td><td width="229"><span style="font-family: Arial, serif;"><span style="font-size: small;">1.0</span></span>

</td></tr><tr></tr><tr valign="top"><td bgcolor="#ebf3fb" width="149"><span style="font-family: Arial, serif;"><span style="font-size: small;">**Stack**</span></span>

</td><td width="229"><span style="font-family: Arial, serif;"><span style="font-size: small;">Vue.js 3 · Express · Sequelize · MariaDB · Docker</span></span>

</td></tr></tbody></table>

# <span style="color: #1f3864;"><span style="font-family: Arial, serif;"><span style="font-size: large;">**1. Einleitung und Zielsetzung**</span></span></span>

<span style="font-family: Arial, serif;"><span style="font-size: small;">Das vorliegende Dokument beschreibt die Konzeption, Entscheidungsfindung und technische Implementierung eines KI-gestützten Programmierstudios, das als Entwicklungsumgebung für das KI-CRM-System der Exista AG dient. Es dokumentiert alle relevanten Designentscheidungen, aufgetretene Probleme sowie deren Lösungsansätze — insbesondere für den Einsatz von Claude Code als KI-Coding-Assistenten innerhalb einer containerisierten Infrastruktur.</span></span>

## <span style="color: #2e74b5;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**1.1 Ausgangslage**</span></span></span>

<span style="font-family: Arial, serif;"><span style="font-size: small;">Die Exista AG, ein Schweizer Elektronikhändler mit Sitz in Mönchaltdorf, benötigte eine moderne CRM-Lösung, die über das bestehende Ragic-System hinausgeht. Ziel war die Entwicklung eines massgeschneiderten, KI-gestützten CRM-Systems, das folgende Anforderungen erfüllt:</span></span>

- <span style="font-family: Arial, serif;"><span style="font-size: small;">Integration von KI-Funktionen (lokale LLMs via Ollama, Claude API)</span></span>
- <span style="font-family: Arial, serif;"><span style="font-size: small;">Volle Kontrolle über Datenhaltung und Prozesse</span></span>
- <span style="font-family: Arial, serif;"><span style="font-size: small;">Moderner Web-Stack mit Vue.js 3 Frontend</span></span>
- <span style="font-family: Arial, serif;"><span style="font-size: small;">Reproduzierbare, containerisierte Entwicklungsumgebung</span></span>
- <span style="font-family: Arial, serif;"><span style="font-size: small;">KI-Coding-Assistent direkt in der Entwicklungsumgebung integriert</span></span>

## <span style="color: #2e74b5;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**1.2 Zielsetzung des Programmierstudios**</span></span></span>

<span style="font-family: Arial, serif;"><span style="font-size: small;">Das Programmierstudio hat folgende Kernziele:</span></span>

1. <span style="font-family: Arial, serif;"><span style="font-size: small;">Bereitstellung einer browserbasierten Entwicklungsumgebung (VS Code im Browser) via code-server</span></span>
2. <span style="font-family: Arial, serif;"><span style="font-size: small;">Integration von Claude Code als KI-Coding-Assistenten für autonome Code-Generierung</span></span>
3. <span style="font-family: Arial, serif;"><span style="font-size: small;">Sicherstellung der Reproduzierbarkeit durch Docker-Containerisierung</span></span>
4. <span style="font-family: Arial, serif;"><span style="font-size: small;">Ermöglichung des Remote-Zugriffs über IP und Port</span></span>
5. <span style="font-family: Arial, serif;"><span style="font-size: small;">Schutz des bestehenden Codes durch Git-Versionierung und definierte Arbeitsregeln</span></span>

# <span style="color: #1f3864;"><span style="font-family: Arial, serif;"><span style="font-size: large;">**2. Systemarchitektur**</span></span></span>

## <span style="color: #2e74b5;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**2.1 Gesamtübersicht**</span></span></span>

<span style="font-family: Arial, serif;"><span style="font-size: small;">Das System besteht aus drei Schichten, die über Docker Compose orchestriert werden:</span></span>

<table cellpadding="5" cellspacing="0" id="bkmrk-schicht-komponente-b" width="602"><colgroup><col width="156"></col> <col width="223"></col> <col width="191"></col> </colgroup><tbody><tr valign="top"><td bgcolor="#1f3864" width="156"><span style="color: #ffffff;"><span style="font-family: Arial, serif;"><span style="font-size: small;">**Schicht**</span></span></span>

</td><td bgcolor="#1f3864" width="223"><span style="color: #ffffff;"><span style="font-family: Arial, serif;"><span style="font-size: small;">**Komponente**</span></span></span>

</td><td bgcolor="#1f3864" width="191"><span style="color: #ffffff;"><span style="font-family: Arial, serif;"><span style="font-size: small;">**Beschreibung**</span></span></span>

</td></tr><tr></tr><tr valign="top"><td bgcolor="#ffffff" width="156"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">Entwicklungsumgebung</span></span></span>

</td><td bgcolor="#ffffff" width="223"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">code-server (Port 7000)</span></span></span>

</td><td bgcolor="#ffffff" width="191"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">VS Code im Browser — zugänglich über IP:7000</span></span></span>

</td></tr><tr></tr><tr valign="top"><td bgcolor="#f5f5f5" width="156"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">KI-Assistent</span></span></span>

</td><td bgcolor="#f5f5f5" width="223"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">Claude Code v2.1.72</span></span></span>

</td><td bgcolor="#f5f5f5" width="191"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">Autonomer Coding-Assistent, läuft im code-server Container</span></span></span>

</td></tr><tr></tr><tr valign="top"><td bgcolor="#ffffff" width="156"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">CRM-Applikation</span></span></span>

</td><td bgcolor="#ffffff" width="223"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">Vue.js 3 Frontend (Port 8090)</span></span></span>

</td><td bgcolor="#ffffff" width="191"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">Produktive CRM-Oberfläche</span></span></span>

</td></tr><tr></tr><tr valign="top"><td bgcolor="#f5f5f5" width="156"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">CRM-Applikation</span></span></span>

</td><td bgcolor="#f5f5f5" width="223"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">Express/Sequelize Backend</span></span></span>

</td><td bgcolor="#f5f5f5" width="191"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">REST-API, Datenbankzugriff</span></span></span>

</td></tr><tr></tr><tr valign="top"><td bgcolor="#ffffff" width="156"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">Datenbank</span></span></span>

</td><td bgcolor="#ffffff" width="223"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">MariaDB 10.11 (crm\_mariadb)</span></span></span>

</td><td bgcolor="#ffffff" width="191"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">Persistente Datenhaltung, Datenbankname: crm\_semitron</span></span></span>

</td></tr><tr></tr><tr valign="top"><td bgcolor="#f5f5f5" width="156"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">KI-Infrastruktur</span></span></span>

</td><td bgcolor="#f5f5f5" width="223"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">Ollama + RTX 5090</span></span></span>

</td><td bgcolor="#f5f5f5" width="191"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">Lokale LLM-Inferenz auf dem Host-System</span></span></span>

</td></tr></tbody></table>

## <span style="color: #2e74b5;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**2.2 Netzwerk-Topologie**</span></span></span>

<span style="font-family: Arial, serif;"><span style="font-size: small;">Alle Container kommunizieren über ein internes Docker-Netzwerk. Der Zugriff von aussen erfolgt ausschliesslich über definierte Port-Mappings:</span></span>

<table cellpadding="5" cellspacing="0" id="bkmrk-port-%28extern%29-dienst" width="602"><colgroup><col width="189"></col> <col width="391"></col> </colgroup><tbody><tr valign="top"><td bgcolor="#2e74b5" width="189"><span style="color: #ffffff;"><span style="font-family: Arial, serif;"><span style="font-size: small;">**Port (extern)**</span></span></span>

</td><td bgcolor="#2e74b5" width="391"><span style="color: #ffffff;"><span style="font-family: Arial, serif;"><span style="font-size: small;">**Dienst / Beschreibung**</span></span></span>

</td></tr><tr></tr><tr valign="top"><td bgcolor="#f2f7fc" width="189"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">7000</span></span></span>

</td><td bgcolor="#ffffff" width="391"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">code-server — Browserbasierte IDE (Programmierstudio)</span></span></span>

</td></tr><tr></tr><tr valign="top"><td bgcolor="#f2f7fc" width="189"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">7777</span></span></span>

</td><td bgcolor="#ffffff" width="391"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">CRM Live-Vorschau (Entwicklungsmodus)</span></span></span>

</td></tr><tr></tr><tr valign="top"><td bgcolor="#f2f7fc" width="189"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">8090</span></span></span>

</td><td bgcolor="#ffffff" width="391"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">KI-CRM Produktivumgebung (Vue.js Frontend + Backend)</span></span></span>

</td></tr><tr></tr><tr valign="top"><td bgcolor="#f2f7fc" width="189"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">3306 / intern</span></span></span>

</td><td bgcolor="#ffffff" width="391"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">MariaDB Datenbankserver (crm\_mariadb)</span></span></span>

</td></tr><tr></tr><tr valign="top"><td bgcolor="#f2f7fc" width="189"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">11434 / Host</span></span></span>

</td><td bgcolor="#ffffff" width="391"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">Ollama LLM-Server auf dem Host-System</span></span></span>

</td></tr></tbody></table>

## <span style="color: #2e74b5;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**2.3 Verzeichnisstruktur**</span></span></span>

<span style="font-family: Arial, serif;"><span style="font-size: small;">Die Projektstruktur auf dem Host-System (Pop!\_OS Linux, Hostname: vitruvian):</span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">~/0\_docker/7000\_progstudio/</span></span></span>

<span style="color: #c0392b;">├── <span style="font-family: Courier New, serif;"><span style="font-size: small;">docker-compose.yml # Container-Orchestrierung</span></span></span>

<span style="color: #c0392b;">├── <span style="font-family: Courier New, serif;"><span style="font-size: small;">env # Umgebungsvariablen (API-Keys, Secrets)</span></span></span>

<span style="color: #c0392b;">├── <span style="font-family: Courier New, serif;"><span style="font-size: small;">ki-crm/ # CRM-Projektverzeichnis (gemountet)</span></span></span>

<span style="color: #c0392b;">│ ├── <span style="font-family: Courier New, serif;"><span style="font-size: small;">backend/ # Express + Sequelize API</span></span></span>

<span style="color: #c0392b;">│ │ └── <span style="font-family: Courier New, serif;"><span style="font-size: small;">src/</span></span></span>

<span style="color: #c0392b;">│ │ ├── <span style="font-family: Courier New, serif;"><span style="font-size: small;">routes/ # 20 Route-Dateien (~95% fertig)</span></span></span>

<span style="color: #c0392b;">│ │ └── <span style="font-family: Courier New, serif;"><span style="font-size: small;">models/ # 23 Sequelize-Models</span></span></span>

<span style="color: #c0392b;">│ ├── <span style="font-family: Courier New, serif;"><span style="font-size: small;">frontend/ # Vue.js 3 SPA</span></span></span>

<span style="color: #c0392b;">│ │ └── <span style="font-family: Courier New, serif;"><span style="font-size: small;">src/</span></span></span>

<span style="color: #c0392b;">│ │ ├── <span style="font-family: Courier New, serif;"><span style="font-size: small;">views/ # Alle View-Komponenten</span></span></span>

<span style="color: #c0392b;">│ │ └── <span style="font-family: Courier New, serif;"><span style="font-size: small;">components/ # Wiederverwendbare Komponenten</span></span></span>

<span style="color: #c0392b;">│ ├── <span style="font-family: Courier New, serif;"><span style="font-size: small;">CLAUDE.md # Regeln für Claude Code</span></span></span>

<span style="color: #c0392b;">│ └── <span style="font-family: Courier New, serif;"><span style="font-size: small;">\*.json # Spezifikationsdateien</span></span></span>

<span style="color: #c0392b;">└── <span style="font-family: Courier New, serif;"><span style="font-size: small;">node\_modules/ # NPM-Abhängigkeiten</span></span></span>

# <span style="color: #1f3864;"><span style="font-family: Arial, serif;"><span style="font-size: large;">**3. Entscheidungsfindung**</span></span></span>

## <span style="color: #2e74b5;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**3.1 Wahl der Entwicklungsumgebung: Docker vs. Native Installation**</span></span></span>

<span style="font-family: Arial, serif;"><span style="font-size: small;">Eine zentrale Entscheidung war die Wahl zwischen einer nativen Installation auf dem Host-System (Pop!\_OS) und einer containerisierten Lösung via Docker.</span></span>

<table cellpadding="5" cellspacing="0" id="bkmrk-kriterium-native-ins" width="602"><colgroup><col width="189"></col> <col width="191"></col> <col width="190"></col> </colgroup><tbody><tr valign="top"><td bgcolor="#1f3864" width="189"><span style="color: #ffffff;"><span style="font-family: Arial, serif;"><span style="font-size: small;">**Kriterium**</span></span></span>

</td><td bgcolor="#1f3864" width="191"><span style="color: #ffffff;"><span style="font-family: Arial, serif;"><span style="font-size: small;">**Native Installation**</span></span></span>

</td><td bgcolor="#1f3864" width="190"><span style="color: #ffffff;"><span style="font-family: Arial, serif;"><span style="font-size: small;">**Docker (gewählt)**</span></span></span>

</td></tr><tr></tr><tr valign="top"><td bgcolor="#ffffff" width="189"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">Sicherheit</span></span></span>

</td><td bgcolor="#ffffff" width="191"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">Riskant: KI kann Systemdateien gefährden</span></span></span>

</td><td bgcolor="#ffffff" width="190"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">Exzellent: Container isoliert alle Operationen</span></span></span>

</td></tr><tr></tr><tr valign="top"><td bgcolor="#f5f5f5" width="189"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">Reproduzierbarkeit</span></span></span>

</td><td bgcolor="#f5f5f5" width="191"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">Fragil: System-Updates können Projekt brechen</span></span></span>

</td><td bgcolor="#f5f5f5" width="190"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">Stabil: Umgebung eingefroren im Image</span></span></span>

</td></tr><tr></tr><tr valign="top"><td bgcolor="#ffffff" width="189"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">Datenbank-Integration</span></span></span>

</td><td bgcolor="#ffffff" width="191"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">Manuelle Verwaltung nötig</span></span></span>

</td><td bgcolor="#ffffff" width="190"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">Einfach: Direktes Netzwerk zwischen Containern</span></span></span>

</td></tr><tr></tr><tr valign="top"><td bgcolor="#f5f5f5" width="189"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">Node.js-Version</span></span></span>

</td><td bgcolor="#f5f5f5" width="191"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">Host hatte nur v12 (zu alt)</span></span></span>

</td><td bgcolor="#f5f5f5" width="190"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">Container bietet Node v20 (kompatibel)</span></span></span>

</td></tr><tr></tr><tr valign="top"><td bgcolor="#ffffff" width="189"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">Remote-Zugriff</span></span></span>

</td><td bgcolor="#ffffff" width="191"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">Komplexe SSH-Konfiguration nötig</span></span></span>

</td><td bgcolor="#ffffff" width="190"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">Einfach: Zugriff via IP:Port im Browser</span></span></span>

</td></tr><tr></tr><tr valign="top"><td bgcolor="#f5f5f5" width="189"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">Rollback</span></span></span>

</td><td bgcolor="#f5f5f5" width="191"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">Aufwendig</span></span></span>

</td><td bgcolor="#f5f5f5" width="190"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">Einfach: Container löschen und neu starten</span></span></span>

</td></tr></tbody></table>

<table cellpadding="8" cellspacing="0" id="bkmrk-entscheidung%3A-docker" width="602"><colgroup><col width="584"></col> </colgroup><tbody><tr><td bgcolor="#e8f5e9" valign="top" width="584"><span style="color: #1f3864;"><span style="font-family: Arial, serif;"><span style="font-size: small;">**Entscheidung: Docker**</span></span></span>

<span style="font-family: Arial, serif;"><span style="font-size: small;">Docker wurde gewählt, weil die Isolation die autonome Arbeitsweise von Claude Code ermöglicht (sudo-Rechte im Container ohne Gefährdung des Host-Systems), und weil die Reproduzierbarkeit für eine langfristige CRM-Entwicklung entscheidend ist.</span></span>

</td></tr></tbody></table>

## <span style="color: #2e74b5;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**3.2 Wahl des Basis-Images: code-server**</span></span></span>

<span style="font-family: Arial, serif;"><span style="font-size: small;">Für das Programmierstudio wurde das offizielle code-server Image (codercom/code-server:latest) gewählt. Dies ermöglicht:</span></span>

- <span style="font-family: Arial, serif;"><span style="font-size: small;">Vollständiger VS Code im Browser — ohne lokale Desktop-Applikation</span></span>
- <span style="font-family: Arial, serif;"><span style="font-size: small;">Zugriff von jedem Gerät über die IP-Adresse des Entwicklungsrechners</span></span>
- <span style="font-family: Arial, serif;"><span style="font-size: small;">Integriertes Terminal für Claude Code direkt in der IDE</span></span>
- <span style="font-family: Arial, serif;"><span style="font-size: small;">Datei-Explorer, Syntax-Highlighting, Git-Integration im Browser</span></span>

<table cellpadding="8" cellspacing="0" id="bkmrk-abgegrenzte-alternat" style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Oxygen, Ubuntu, Roboto, Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif; font-size: 14px;" width="602"><colgroup><col width="584"></col></colgroup><tbody><tr><td bgcolor="#fff3e0" valign="top" width="584"><span style="color: #1f3864;"><span style="font-family: Arial, serif;"><span style="font-size: small;">**Abgegrenzte Alternative: Claude Desktop App**</span></span></span>

<span style="font-family: Arial, serif;"><span style="font-size: small;">Die offizielle Claude Desktop App wurde als Alternative evaluiert, aber verworfen. Electron-Anwendungen lassen sich nicht sinnvoll in Docker containerisieren (GUI-Ausgabe erfordert X11-Forwarding, was instabil und langsam ist). Das code-server + Claude Code CLI Setup ist für Produktivarbeit deutlich besser geeignet.</span></span>

</td></tr></tbody></table>

## <span style="color: #2e74b5;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**3.3 Wahl des KI-Coding-Assistenten: Claude Code**</span></span></span>

<span style="font-family: Arial, serif;"><span style="font-size: small;">Claude Code wurde gegenüber alternativen KI-Assistenten (GitHub Copilot, Cursor, Continue.dev) aus folgenden Gründen bevorzugt:</span></span>

- <span style="font-family: Arial, serif;"><span style="font-size: small;">Autonome Arbeitsweise: Claude Code kann komplexe Aufgaben über mehrere Schritte hinweg selbstständig bearbeiten</span></span>
- <span style="font-family: Arial, serif;"><span style="font-size: small;">Dateioperationen: Direkte Lese-/Schreibzugriffe auf das Projektverzeichnis</span></span>
- <span style="font-family: Arial, serif;"><span style="font-size: small;">Kontext-Dokument (CLAUDE.md): Projektregeln werden automatisch bei jeder Session geladen</span></span>
- <span style="font-family: Arial, serif;"><span style="font-size: small;">API-Key-Integration: Nahtlose Authentifizierung über Umgebungsvariable ANTHROPIC\_API\_KEY</span></span>
- <span style="font-family: Arial, serif;"><span style="font-size: small;">Schweizer Datenschutz: Kein Code wird auf externen Servern zwischengespeichert</span></span>

# <span style="color: #1f3864;"><span style="font-family: Arial, serif;"><span style="font-size: large;">**4. Docker Setup — Vollständige Konfiguration**</span></span></span>

## <span style="color: #2e74b5;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**4.1 docker-compose.yml**</span></span></span>

<span style="font-family: Arial, serif;"><span style="font-size: small;">Die finale, produktive docker-compose.yml für das Programmierstudio:</span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">services:</span></span></span>

<span style="color: #c0392b;"> <span style="font-family: Courier New, serif;"><span style="font-size: small;">crm-studio:</span></span></span>

<span style="color: #c0392b;"> <span style="font-family: Courier New, serif;"><span style="font-size: small;">image: codercom/code-server:latest</span></span></span>

<span style="color: #c0392b;"> <span style="font-family: Courier New, serif;"><span style="font-size: small;">container\_name: crm\_web\_studio\_7000</span></span></span>

<span style="color: #c0392b;"> <span style="font-family: Courier New, serif;"><span style="font-size: small;">ports:</span></span></span>

<span style="color: #c0392b;"> <span style="font-family: Courier New, serif;"><span style="font-size: small;">- "7000:8080" # Programmierstudio (VS Code im Browser)</span></span></span>

<span style="color: #c0392b;"> <span style="font-family: Courier New, serif;"><span style="font-size: small;">- "7777:3000" # CRM Live-Vorschau</span></span></span>

<span style="color: #c0392b;"> <span style="font-family: Courier New, serif;"><span style="font-size: small;">volumes:</span></span></span>

<span style="color: #c0392b;"> <span style="font-family: Courier New, serif;"><span style="font-size: small;">- .:/home/coder/project # Projektordner gemountet</span></span></span>

<span style="color: #c0392b;"> <span style="font-family: Courier New, serif;"><span style="font-size: small;">env\_file:</span></span></span>

<span style="color: #c0392b;"> <span style="font-family: Courier New, serif;"><span style="font-size: small;">- env # Umgebungsvariablen laden</span></span></span>

<span style="color: #c0392b;"> <span style="font-family: Courier New, serif;"><span style="font-size: small;">extra\_hosts:</span></span></span>

<span style="color: #c0392b;"> <span style="font-family: Courier New, serif;"><span style="font-size: small;">- "host.docker.internal:host-gateway" # Linux-Fix für Ollama</span></span></span>

<span style="color: #c0392b;"> <span style="font-family: Courier New, serif;"><span style="font-size: small;">- "localhost:127.0.0.1" # OAuth-Fix für Claude Code</span></span></span>

<span style="color: #c0392b;"> <span style="font-family: Courier New, serif;"><span style="font-size: small;">restart: always</span></span></span>

<span style="color: #c0392b;"> <span style="font-family: Courier New, serif;"><span style="font-size: small;">command:</span></span></span>

<span style="color: #c0392b;"> <span style="font-family: Courier New, serif;"><span style="font-size: small;">\["--auth", "none", "--bind-addr", "0.0.0.0:8080",</span></span></span>

<span style="color: #c0392b;"> <span style="font-family: Courier New, serif;"><span style="font-size: small;">"/home/coder/project"\]",</span></span></span>

<span style="color: #c0392b;"> <span style="font-family: Courier New, serif;"><span style="font-size: small;">db:</span></span></span>

<span style="color: #c0392b;"> <span style="font-family: Courier New, serif;"><span style="font-size: small;">image: postgres:15</span></span></span>

<span style="color: #c0392b;"> <span style="font-family: Courier New, serif;"><span style="font-size: small;">container\_name: crm\_postgres</span></span></span>

<span style="color: #c0392b;"> <span style="font-family: Courier New, serif;"><span style="font-size: small;">environment:</span></span></span>

<span style="color: #c0392b;"> <span style="font-family: Courier New, serif;"><span style="font-size: small;">POSTGRES\_USER: user</span></span></span>

<span style="color: #c0392b;"> <span style="font-family: Courier New, serif;"><span style="font-size: small;">POSTGRES\_PASSWORD: ${DB\_PASSWORD}</span></span></span>

<span style="color: #c0392b;"> <span style="font-family: Courier New, serif;"><span style="font-size: small;">POSTGRES\_DB: crm\_db</span></span></span>

<span style="color: #c0392b;"> <span style="font-family: Courier New, serif;"><span style="font-size: small;">ports:</span></span></span>

<span style="color: #c0392b;"> <span style="font-family: Courier New, serif;"><span style="font-size: small;">- "5432:5432"</span></span></span>

## <span style="color: #2e74b5;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**4.2 Umgebungsvariablen (env-Datei)**</span></span></span>

<span style="font-family: Arial, serif;"><span style="font-size: small;">Die env-Datei enthält alle sensitiven Konfigurationswerte:</span></span>

<table cellpadding="5" cellspacing="0" id="bkmrk-variable-beschreibun" width="602"><colgroup><col width="189"></col> <col width="391"></col> </colgroup><tbody><tr valign="top"><td bgcolor="#2e74b5" width="189"><span style="color: #ffffff;"><span style="font-family: Arial, serif;"><span style="font-size: small;">**Variable**</span></span></span>

</td><td bgcolor="#2e74b5" width="391"><span style="color: #ffffff;"><span style="font-family: Arial, serif;"><span style="font-size: small;">**Beschreibung**</span></span></span>

</td></tr><tr></tr><tr valign="top"><td bgcolor="#f2f7fc" width="189"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">ANTHROPIC\_API\_KEY</span></span></span>

</td><td bgcolor="#ffffff" width="391"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">API-Key für Claude Code (von console.anthropic.com)</span></span></span>

</td></tr><tr></tr><tr valign="top"><td bgcolor="#f2f7fc" width="189"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">OLLAMA\_URL</span></span></span>

</td><td bgcolor="#ffffff" width="391"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">URL des lokalen Ollama-Servers: http://host.docker.internal:11434</span></span></span>

</td></tr><tr></tr><tr valign="top"><td bgcolor="#f2f7fc" width="189"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">DB\_PASSWORD</span></span></span>

</td><td bgcolor="#ffffff" width="391"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">Passwort für die Datenbank (nie im Code hardcodieren)</span></span></span>

</td></tr><tr></tr><tr valign="top"><td bgcolor="#f2f7fc" width="189"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">JWT\_SECRET</span></span></span>

</td><td bgcolor="#ffffff" width="391"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">Geheimschlüssel für JWT-Token-Authentifizierung</span></span></span>

</td></tr><tr></tr><tr valign="top"><td bgcolor="#f2f7fc" width="189"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">DEFAULT\_PROVIDER</span></span></span>

</td><td bgcolor="#ffffff" width="391"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">Standard-KI-Provider beim Start: 'claude' oder 'ollama'</span></span></span>

</td></tr></tbody></table>

<table cellpadding="8" cellspacing="0" id="bkmrk-sicherheitshinweis-d" width="602"><colgroup><col width="584"></col> </colgroup><tbody><tr><td bgcolor="#ffebee" valign="top" width="584"><span style="color: #1f3864;"><span style="font-family: Arial, serif;"><span style="font-size: small;">**Sicherheitshinweis**</span></span></span>

<span style="font-family: Arial, serif;"><span style="font-size: small;">Die env-Datei darf niemals in ein Git-Repository eingecheckt werden. Sie ist in der .gitignore des Projekts ausgeschlossen. API-Keys sollten regelmässig rotiert werden.</span></span>

</td></tr></tbody></table>

# <span style="color: #1f3864;"><span style="font-family: Arial, serif;"><span style="font-size: large;">**5. Installationsschritte — Step by Step**</span></span></span>

## <span style="color: #2e74b5;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**5.1 Voraussetzungen**</span></span></span>

<span style="font-family: Arial, serif;"><span style="font-size: small;">Folgende Komponenten müssen auf dem Host-System vorhanden sein:</span></span>

- <span style="font-family: Arial, serif;"><span style="font-size: small;">Pop!\_OS 24.04 LTS (Ubuntu-basiert) oder kompatibles Linux-System</span></span>
- <span style="font-family: Arial, serif;"><span style="font-size: small;">Docker Engine v5.x (docker compose version zeigt die installierte Version)</span></span>
- <span style="font-family: Arial, serif;"><span style="font-size: small;">Docker Compose Plugin (in Docker Engine v5 bereits integriert)</span></span>
- <span style="font-family: Arial, serif;"><span style="font-size: small;">Git (für Versionsverwaltung des CRM-Codes)</span></span>
- <span style="font-family: Arial, serif;"><span style="font-size: small;">Moderner Browser (Firefox, Chrome oder Edge) für den Zugriff auf das Studio</span></span>

## <span style="color: #2e74b5;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**5.2 Schritt-für-Schritt-Installation**</span></span></span>

### <span style="color: #404040;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**Schritt 1: Projektverzeichnis vorbereiten**</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">\# Verzeichnisstruktur anlegen</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">mkdir -p ~/0\_docker/7000\_progstudio/ki-crm</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">cd ~/0\_docker/7000\_progstudio</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">\# Spezifikationsdateien in ki-crm/ ablegen:</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">\# 01\_crm\_master.json, 02\_crm\_sprint1.json, ...</span></span></span>

### <span style="color: #404040;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**Schritt 2: Konfigurationsdateien erstellen**</span></span></span>

<span style="font-family: Arial, serif;"><span style="font-size: small;">docker-compose.yml und env-Datei gemäss Kapitel 4 erstellen.</span></span>

### <span style="color: #404040;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**Schritt 3: Container starten**</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">cd ~/0\_docker/7000\_progstudio</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">docker compose up -d</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">\# Status prüfen:</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">docker ps</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">\# Erwartete Ausgabe: beide Container mit Status 'Up'</span></span></span>

### <span style="color: #404040;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**Schritt 4: Programmierstudio im Browser öffnen**</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">\# Lokaler Zugriff:</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">http://localhost:7000</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">\# Netzwerkzugriff (andere Geräte im LAN):</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">http://192.168.0.16:7000</span></span></span>

### <span style="color: #404040;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**Schritt 5: Node.js im Container installieren**</span></span></span>

<span style="font-family: Arial, serif;"><span style="font-size: small;">Das code-server Basis-Image enthält kein Node.js. Einmalige Installation im Browser-Terminal:</span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">\# Im Browser-Terminal (code-server):</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">sudo apt update</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">sudo apt install -y curl</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">curl -fsSL https://deb.nodesource.com/setup\_20.x | sudo -E bash -</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">sudo apt install -y nodejs</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">\# Version prüfen (muss &gt;= v18 sein):</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">node -v # Erwartet: v20.x</span></span></span>

### <span style="color: #404040;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**Schritt 6: Claude Code installieren**</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">\# Im Browser-Terminal:</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">sudo npm install -g @anthropic-ai/claude-code</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">\# Installation prüfen:</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">claude --version # Erwartet: Claude Code v2.1.72</span></span></span>

### <span style="color: #404040;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**Schritt 7: Git-Versionierung einrichten**</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">\# Im Browser-Terminal:</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">cd ~/project/ki-crm</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">git init</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">git add .</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">git commit -m "Initialer Commit — KI-CRM Setup"</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">\# Vor jeder Entwicklungssession sichern:</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">git add . &amp;&amp; git commit -m "vor session $(date +%Y%m%d\_%H%M)"</span></span></span>

### <span style="color: #404040;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**Schritt 8: CLAUDE.md anlegen**</span></span></span>

<span style="font-family: Arial, serif;"><span style="font-size: small;">Die CLAUDE.md wird von Claude Code automatisch bei jeder Session gelesen. Sie enthält alle Projektregeln (siehe Kapitel 7).</span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">\# In Claude Code eingeben:</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">\# claude &gt; Erstelle eine CLAUDE.md im Ordner ki-crm</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">\# mit allen Projektregeln aus dem Kontext-Dokument.</span></span></span>

# <span style="color: #1f3864;"><span style="font-family: Arial, serif;"><span style="font-size: large;">**6. Aufgetretene Probleme und Lösungsansätze**</span></span></span>

<span style="font-family: Arial, serif;"><span style="font-size: small;">Dieser Abschnitt dokumentiert alle wesentlichen Probleme, die während der Einrichtung aufgetreten sind, sowie die erarbeiteten Lösungen.</span></span>

## <span style="color: #2e74b5;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**Problem 1: OAuth-Fehler beim Claude Code Login**</span></span></span>

<table cellpadding="8" cellspacing="0" id="bkmrk-fehlermeldung-oauth-" width="602"><colgroup><col width="584"></col> </colgroup><tbody><tr><td bgcolor="#ffebee" valign="top" width="584"><span style="color: #1f3864;"><span style="font-family: Arial, serif;"><span style="font-size: small;">**Fehlermeldung**</span></span></span>

<span style="font-family: Arial, serif;"><span style="font-size: small;">OAuth error: Failed to start OAuth callback server: getaddrinfo ENOTFOUND localhost</span></span>

</td></tr></tbody></table>

### <span style="color: #404040;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**Ursache**</span></span></span>

<span style="font-family: Arial, serif;"><span style="font-size: small;">Docker-Container unter Linux kennen 'localhost' standardmässig nicht als eigene Adresse. Claude Code versucht beim OAuth-Login einen lokalen Webserver zu starten, der auf 'localhost' lauscht — was im Container fehlschlägt.</span></span>

### <span style="color: #404040;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**Lösungsansatz**</span></span></span>

<span style="font-family: Arial, serif;"><span style="font-size: small;">Zwei Massnahmen wurden kombiniert:</span></span>

6. <span style="font-family: Arial, serif;"><span style="font-size: small;">extra\_hosts in docker-compose.yml: Der Container erhält einen expliziten /etc/hosts-Eintrag für localhost → 127.0.0.1</span></span>
7. <span style="font-family: Arial, serif;"><span style="font-size: small;">Authentifizierung via ANTHROPIC\_API\_KEY Umgebungsvariable: Claude Code erkennt den Key automatisch und überspringt den OAuth-Browser-Flow</span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">\# docker-compose.yml — Lösung:</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">extra\_hosts:</span></span></span>

<span style="color: #c0392b;"> <span style="font-family: Courier New, serif;"><span style="font-size: small;">- "localhost:127.0.0.1"</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">\# env-Datei:</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">ANTHROPIC\_API\_KEY=sk-ant-api03-...</span></span></span>

## <span style="color: #2e74b5;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**Problem 2: Container startet nicht (Restarting-Loop)**</span></span></span>

<table cellpadding="8" cellspacing="0" id="bkmrk-fehlermeldung-contai" width="602"><colgroup><col width="584"></col> </colgroup><tbody><tr><td bgcolor="#ffebee" valign="top" width="584"><span style="color: #1f3864;"><span style="font-family: Arial, serif;"><span style="font-size: small;">**Fehlermeldung**</span></span></span>

<span style="font-family: Arial, serif;"><span style="font-size: small;">Container STATUS: Restarting (1) docker logs: error Unknown option -c</span></span>

</td></tr></tbody></table>

### <span style="color: #404040;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**Ursache**</span></span></span>

<span style="font-family: Arial, serif;"><span style="font-size: small;">Das code-server Image hat einen eigenen internen Entrypoint (/usr/bin/entrypoint). Wird im docker-compose.yml ein komplexer Shell-Befehl mit 'sh -c ...' übergeben, interpretiert der interne Entrypoint die Option '-c' als unbekannte code-server Option — was sofort zum Absturz führt.</span></span>

### <span style="color: #404040;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**Lösungsansatz**</span></span></span>

<span style="font-family: Arial, serif;"><span style="font-size: small;">Der command-Schlüssel in docker-compose.yml wurde auf reine code-server Argumente reduziert. Die Installation von Claude Code erfolgt separat, manuell im Browser-Terminal:</span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">\# FALSCH — verursacht den Fehler:</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">command: sh -c "npm install -g @anthropic-ai/claude-code &amp;&amp;</span></span></span>

<span style="color: #c0392b;"> <span style="font-family: Courier New, serif;"><span style="font-size: small;">code-server --auth none /home/coder/project"</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">\# KORREKT — nur code-server Argumente:</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">command: \["--auth", "none", "--bind-addr",</span></span></span>

<span style="color: #c0392b;"> <span style="font-family: Courier New, serif;"><span style="font-size: small;">"0.0.0.0:8080", "/home/coder/project"\]</span></span></span>

## <span style="color: #2e74b5;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**Problem 3: npm nicht gefunden (command not found)**</span></span></span>

<table cellpadding="8" cellspacing="0" id="bkmrk-fehlermeldung-coder%40" width="602"><colgroup><col width="584"></col> </colgroup><tbody><tr><td bgcolor="#ffebee" valign="top" width="584"><span style="color: #1f3864;"><span style="font-family: Arial, serif;"><span style="font-size: small;">**Fehlermeldung**</span></span></span>

<span style="font-family: Arial, serif;"><span style="font-size: small;">coder@container:~$ npm install -g @anthropic-ai/claude-code bash: npm: command not found</span></span>

</td></tr></tbody></table>

### <span style="color: #404040;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**Ursache**</span></span></span>

<span style="font-family: Arial, serif;"><span style="font-size: small;">Das code-server Basis-Image (codercom/code-server:latest) enthält kein Node.js. Es ist eine minimale Debian-Umgebung, die nur VS Code selbst enthält.</span></span>

### <span style="color: #404040;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**Lösungsansatz**</span></span></span>

<span style="font-family: Arial, serif;"><span style="font-size: small;">Node.js v20 wurde manuell über den offiziellen NodeSource-Installer im Container-Terminal installiert. Dies muss nur einmalig durchgeführt werden (der Container-Zustand bleibt erhalten solange docker compose down nicht ausgeführt wird):</span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">sudo apt update &amp;&amp; sudo apt install -y curl</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">curl -fsSL https://deb.nodesource.com/setup\_20.x | sudo -E bash -</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">sudo apt install -y nodejs</span></span></span>

## <span style="color: #2e74b5;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**Problem 4: sudo npm — command not found**</span></span></span>

<table cellpadding="8" cellspacing="0" id="bkmrk-fehlermeldung-sudo-e" width="602"><colgroup><col width="584"></col> </colgroup><tbody><tr><td bgcolor="#ffebee" valign="top" width="584"><span style="color: #1f3864;"><span style="font-family: Arial, serif;"><span style="font-size: small;">**Fehlermeldung**</span></span></span>

<span style="font-family: Arial, serif;"><span style="font-size: small;">sudo env 'PATH=$PATH' npm install -g @anthropic-ai/claude-code env: 'npm': No such file or directory</span></span>

</td></tr></tbody></table>

### <span style="color: #404040;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**Ursache**</span></span></span>

<span style="font-family: Arial, serif;"><span style="font-size: small;">In Docker-Containern 'vergisst' sudo den Pfad zu Programmen, die für den normalen User installiert wurden. Der Befehl 'sudo env PATH=...' scheitert, weil npm auch nach Pfadangabe nicht gefunden wird — es war noch nicht installiert.</span></span>

### <span style="color: #404040;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**Lösungsansatz**</span></span></span>

<span style="font-family: Arial, serif;"><span style="font-size: small;">Node.js v20 zuerst installieren (Problem 3), dann funktioniert sudo npm problemlos. Die Reihenfolge der Installation ist entscheidend.</span></span>

## <span style="color: #2e74b5;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**Problem 5: Node.js Version zu alt auf Host-System**</span></span></span>

<table cellpadding="8" cellspacing="0" id="bkmrk-fehlermeldung-npm-wa" width="602"><colgroup><col width="584"></col> </colgroup><tbody><tr><td bgcolor="#ffebee" valign="top" width="584"><span style="color: #1f3864;"><span style="font-family: Arial, serif;"><span style="font-size: small;">**Fehlermeldung**</span></span></span>

<span style="font-family: Arial, serif;"><span style="font-size: small;">npm WARN EBADENGINE Unsupported engine required: { node: '&gt;=18.0.0' }, current: { node: 'v12.22.9' }</span></span>

</td></tr></tbody></table>

### <span style="color: #404040;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**Ursache**</span></span></span>

<span style="font-family: Arial, serif;"><span style="font-size: small;">Claude Code benötigt mindestens Node.js v18. Das Host-System (Pop!\_OS) hatte noch die Systemversion v12 aus den Ubuntu-Quellen installiert. Da npm auf dem Host ausgeführt wurde statt im Container, kam es zu diesem Versionskonflikt.</span></span>

### <span style="color: #404040;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**Lösungsansatz**</span></span></span>

<span style="font-family: Arial, serif;"><span style="font-size: small;">Konsequente Trennung: Alle Entwicklungstools (Node.js, npm, Claude Code) werden ausschliesslich im Docker-Container installiert. Das Host-System wird nicht modifiziert. Dies ist einer der Hauptvorteile der containerisierten Entwicklungsumgebung.</span></span>

## <span style="color: #2e74b5;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**Problem 6: Copy-Paste im Browser-Terminal nicht möglich**</span></span></span>

### <span style="color: #404040;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**Ursache**</span></span></span>

<span style="font-family: Arial, serif;"><span style="font-size: small;">Moderne Browser blockieren aus Sicherheitsgründen den Zugriff auf die Zwischenablage, wenn eine Webseite über eine unverschlüsselte HTTP-Verbindung geladen wird (kein HTTPS). Da das Studio intern über HTTP läuft, verweigert der Browser das Einfügen.</span></span>

### <span style="color: #404040;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**Lösungsansätze**</span></span></span>

8. <span style="font-family: Arial, serif;"><span style="font-size: small;">Tastenkombination: Strg + Shift + V statt Strg + V im Terminal-Bereich</span></span>
9. <span style="font-family: Arial, serif;"><span style="font-size: small;">Browser-Berechtigung: Schloss-Icon in der Adresszeile → Zwischenablage auf 'Erlauben' stellen</span></span>
10. <span style="font-family: Arial, serif;"><span style="font-size: small;">Rechtsklick: Im code-server Terminal erscheint ein eigenes Kontextmenü mit 'Paste'</span></span>
11. <span style="font-family: Arial, serif;"><span style="font-size: small;">Workaround: Befehlstext in eine Datei schreiben (befehl.txt), Claude Code dann anweisen diese zu lesen</span></span>

## <span style="color: #2e74b5;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**Problem 7: Ständige Bestätigungen bei Claude Code**</span></span></span>

### <span style="color: #404040;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**Ursache**</span></span></span>

<span style="font-family: Arial, serif;"><span style="font-size: small;">Claude Code fragt standardmässig vor jedem Bash-Befehl nach Bestätigung — insbesondere bei kombinierten Befehlen mit &amp;&amp; oder ||. Das unterbricht den Arbeitsfluss erheblich.</span></span>

### <span style="color: #404040;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**Lösungsansatz**</span></span></span>

<span style="font-family: Arial, serif;"><span style="font-size: small;">Beim Start von Claude Code die Option 'Yes, allow all edits during this session' (Shift+Tab) wählen. Dies genehmigt alle Dateioperationen für die aktuelle Session, ohne bei jedem Schritt nachzufragen. Zwischen Sessions bleibt Git als Sicherheitsnetz:</span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">\# Vor jeder Session sichern:</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">git add . &amp;&amp; git commit -m "vor session $(date +%Y%m%d\_%H%M)"</span></span></span>

# <span style="color: #1f3864;"><span style="font-family: Arial, serif;"><span style="font-size: large;">**7. CLAUDE.md — Projektregeln für Claude Code**</span></span></span>

<span style="font-family: Arial, serif;"><span style="font-size: small;">Die CLAUDE.md ist das zentrale Steuerungsdokument für Claude Code. Sie wird automatisch bei jeder Session gelesen und definiert verbindliche Regeln für die KI-gestützte Entwicklung.</span></span>

## <span style="color: #2e74b5;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**7.1 Zweck der CLAUDE.md**</span></span></span>

<span style="font-family: Arial, serif;"><span style="font-size: small;">Claude Code besitzt kein persistentes Gedächtnis zwischen Sessions. Die CLAUDE.md dient als session-übergreifendes Kontext-Dokument, das sicherstellt, dass:</span></span>

- <span style="font-family: Arial, serif;"><span style="font-size: small;">Keine bestehenden, funktionierenden Dateien unbeabsichtigt überschrieben werden</span></span>
- <span style="font-family: Arial, serif;"><span style="font-size: small;">Projektspezifische Konventionen (Feldnamen, Enums, Associations) korrekt angewendet werden</span></span>
- <span style="font-family: Arial, serif;"><span style="font-size: small;">CSS-Variablen statt hardcodierter Farben verwendet werden</span></span>
- <span style="font-family: Arial, serif;"><span style="font-size: small;">Datenbankmigrationen sicher (IF NOT EXISTS) durchgeführt werden</span></span>

## <span style="color: #2e74b5;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**7.2 Inhalt der CLAUDE.md (Auszug)**</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">\# CLAUDE.md — KI-CRM Projektregeln</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">\## Stack</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">Vue.js 3 + Express + Sequelize + MariaDB + Docker</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">Pfad: ~/0\_docker/7000\_progstudio/ki-crm/</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">\## Kritische Regeln</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">1. Vor JEDER Änderung: git add . &amp;&amp; git commit -m 'vor ...'</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">2. Nur explizit genannte Dateien ändern!</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">3. NIEMALS hardcodierte dunkle Farben (#1e1e2e, #000, #333)</span></span></span>

<span style="color: #c0392b;"> → <span style="font-family: Courier New, serif;"><span style="font-size: small;">Immer CSS-Variablen: var(--color-background-primary)</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">4. Migrations immer mit IF NOT EXISTS</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">5. Deploy-Befehl immer mit --env-file ../.env</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">\## Gesperrte Dateien (nie anfassen)</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">- router/index.js</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">- models/index.js</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">- app.js</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">\## DB-Feldnamen (kritisch)</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">- kontakte.mobile (NICHT mobil!)</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">- angebote.geloescht (tinyint)</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">\## Wichtige Association</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">Projekt.hasMany(Angebot, { as: 'angebote\_projekt' }) ← WICHTIG!</span></span></span>

# <span style="color: #1f3864;"><span style="font-family: Arial, serif;"><span style="font-size: large;">**8. Betrieb und Wartung**</span></span></span>

## <span style="color: #2e74b5;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**8.1 Täglicher Arbeitsablauf**</span></span></span>

12. <span style="font-family: Arial, serif;"><span style="font-size: small;">Browser öffnen → http://localhost:7000 oder http://192.168.0.16:7000</span></span>
13. <span style="font-family: Arial, serif;"><span style="font-size: small;">Im Browser-Terminal: cd ~/project/ki-crm</span></span>
14. <span style="font-family: Arial, serif;"><span style="font-size: small;">Git-Sicherung: git add . &amp;&amp; git commit -m 'vor session YYYYMMDD\_HHMM'</span></span>
15. <span style="font-family: Arial, serif;"><span style="font-size: small;">Claude Code starten: claude</span></span>
16. <span style="font-family: Arial, serif;"><span style="font-size: small;">Kontext-Dokument einfügen (aktueller Stand des Projekts)</span></span>
17. <span style="font-family: Arial, serif;"><span style="font-size: small;">Entwicklungsaufgabe definieren und starten</span></span>

## <span style="color: #2e74b5;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**8.2 Container-Management**</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">\# Container starten:</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">cd ~/0\_docker/7000\_progstudio &amp;&amp; docker compose up -d</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">\# Status prüfen:</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">docker ps</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">\# Container stoppen (Zustand bleibt erhalten):</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">docker compose stop</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">\# Container vollständig entfernen (Code bleibt durch Volume erhalten):</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">docker compose down</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">\# Logs anzeigen (bei Problemen):</span></span></span>

<span style="color: #c0392b;"><span style="font-family: Courier New, serif;"><span style="font-size: small;">docker logs crm\_web\_studio\_7000</span></span></span>

## <span style="color: #2e74b5;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**8.3 Offene Entwicklungspunkte (Stand 27.03.2026)**</span></span></span>

<table cellpadding="5" cellspacing="0" id="bkmrk-priorit%C3%A4t-feature-be" width="602"><colgroup><col width="156"></col> <col width="223"></col> <col width="191"></col> </colgroup><tbody><tr valign="top"><td bgcolor="#1f3864" width="156"><span style="color: #ffffff;"><span style="font-family: Arial, serif;"><span style="font-size: small;">**Priorität**</span></span></span>

</td><td bgcolor="#1f3864" width="223"><span style="color: #ffffff;"><span style="font-family: Arial, serif;"><span style="font-size: small;">**Feature**</span></span></span>

</td><td bgcolor="#1f3864" width="191"><span style="color: #ffffff;"><span style="font-family: Arial, serif;"><span style="font-size: small;">**Beschreibung**</span></span></span>

</td></tr><tr></tr><tr valign="top"><td bgcolor="#ffffff" width="156"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">1 — Hoch</span></span></span>

</td><td bgcolor="#ffffff" width="223"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">Backup-Funktion</span></span></span>

</td><td bgcolor="#ffffff" width="191"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">DB + Uploads als ZIP, tägl. Auto-Backup, Download in Einstellungen</span></span></span>

</td></tr><tr></tr><tr valign="top"><td bgcolor="#f5f5f5" width="156"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">2 — Mittel</span></span></span>

</td><td bgcolor="#f5f5f5" width="223"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">Fokus-KD Fix</span></span></span>

</td><td bgcolor="#f5f5f5" width="191"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">Firma- und Hersteller-Spalten werden leer angezeigt (Anzeigefehler)</span></span></span>

</td></tr><tr></tr><tr valign="top"><td bgcolor="#ffffff" width="156"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">3 — Mittel</span></span></span>

</td><td bgcolor="#ffffff" width="223"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">Server-Deployment</span></span></span>

</td><td bgcolor="#ffffff" width="191"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">Deployment auf Produktivserver vorbereiten</span></span></span>

</td></tr><tr></tr><tr valign="top"><td bgcolor="#f5f5f5" width="156"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">4 — Niedrig</span></span></span>

</td><td bgcolor="#f5f5f5" width="223"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">KI-Prompts</span></span></span>

</td><td bgcolor="#f5f5f5" width="191"><span style="color: #000000;"><span style="font-family: Arial, serif;"><span style="font-size: small;">KI-Prompts in Einstellungen weiter nachführen und optimieren</span></span></span>

</td></tr></tbody></table>

# <span style="color: #1f3864;"><span style="font-family: Arial, serif;"><span style="font-size: large;">**9. Fazit und Erkenntnisse**</span></span></span>

<span style="font-family: Arial, serif;"><span style="font-size: small;">Die Einrichtung des KI-CRM Programmierstudios hat gezeigt, dass die Kombination aus containerisierter Entwicklungsumgebung (Docker + code-server) und einem autonomen KI-Coding-Assistenten (Claude Code) ein mächtiges Entwicklungsparadigma darstellt.</span></span>

## <span style="color: #2e74b5;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**9.1 Wichtigste Erkenntnisse**</span></span></span>

- <span style="font-family: Arial, serif;"><span style="font-size: small;">Docker-Isolation ist essentiell: Claude Code benötigt sudo-Rechte für viele Operationen. Im Container kann er diese gefahrlos nutzen, ohne das Host-System zu gefährden.</span></span>
- <span style="font-family: Arial, serif;"><span style="font-size: small;">Node.js-Version ist kritisch: Claude Code benötigt &gt;= v18. Das Host-System und der Container sind strikt zu trennen.</span></span>
- <span style="font-family: Arial, serif;"><span style="font-size: small;">CLAUDE.md als Gedächtnis: Da Claude Code kein persistentes Gedächtnis hat, ist die CLAUDE.md das wichtigste Instrument für konsistente, regelkonforme Entwicklung über Sessions hinweg.</span></span>
- <span style="font-family: Arial, serif;"><span style="font-size: small;">Git als Sicherheitsnetz: Vor jeder Änderung committen schützt vor unbeabsichtigten Überschreibungen durch die KI.</span></span>
- <span style="font-family: Arial, serif;"><span style="font-size: small;">Schrittweise Aufgaben: Claude Code liefert bessere Ergebnisse bei klar abgegrenzten Einzelaufgaben als bei grossen, vagen Anforderungen.</span></span>

## <span style="color: #2e74b5;"><span style="font-family: Arial, serif;"><span style="font-size: medium;">**9.2 Empfehlungen für den Produktiveinsatz**</span></span></span>

18. <span style="font-family: Arial, serif;"><span style="font-size: small;">HTTPS für das Programmierstudio einrichten (Nginx Reverse Proxy mit Let's Encrypt)</span></span>
19. <span style="font-family: Arial, serif;"><span style="font-size: small;">Passwortschutz für code-server aktivieren (--auth password)</span></span>
20. <span style="font-family: Arial, serif;"><span style="font-size: small;">Tägliches automatisches Backup der Datenbank und des Projektverzeichnisses</span></span>
21. <span style="font-family: Arial, serif;"><span style="font-size: small;">API-Key-Rotation: Anthropic API-Keys regelmässig erneuern</span></span>
22. <span style="font-family: Arial, serif;"><span style="font-size: small;">Git-Remote: Code zusätzlich auf einem Remote-Repository sichern (GitHub, GitLab)</span></span>

<span style="color: #999999;"><span style="font-family: Arial, serif;"><span style="font-size: small;">*Dokument erstellt am 27. März 2026 | Thomas Schütz | Exista AG | Masterarbeit — Vertraulich*</span></span></span>

# Use Case 6.1 — KI-CRM Agenten mit OpenClaw

## Übersicht

Das KI-CRM der Exista AG lässt sich nahtlos mit OpenClaw als KI-Agent-Plattform integrieren. OpenClaw dient als intelligenter Layer zwischen dem CRM und verschiedenen Kanälen (E-Mail, Telefon, Browser-Automatisierung).

## Architektur

```
KI-CRM (capcalc.kistudent.synology.me)
   │
   │ /local-api/ (X-API-Key, IP-Filter)
   ▼
OpenClaw Agent
   │
   ├─► E-Mail-Drafts erstellen
   ├─► Telefonlisten abfragen
   ├─► Kontaktinformationen abrufen
   └─► Überfällige Aktionen melden
```

## Integration über /local-api/

OpenClaw greift über den lokal verfügbaren API-Endpunkt auf das CRM zu:

- **Endpoint:** `http://192.168.0.82:8090/local-api/`
- **Authentifizierung:** `X-API-Key` Header (68-Zeichen Key, DB-gespeichert)
- **IP-Beschränkung:** nur 192.168.x.x / 172.16.x.x (nginx allow rules)

## Use Cases

### E-Mail-Automatisierung
- Automatische E-Mail-Checks periodisch
- Drafts basierend auf CRM-Daten erstellen
- Antworten mit Kundendokumentation anreichern

### Telefonlisten & Terminverwaltung
- Überfällige Aktionen abrufen mit Kontakt und Telefon
- Telefonnummern direkt aus CRM
- Potential-Chiffre für Priorisierung

### Kontakt-Pflege
- Kontakte automatisch aktualisieren
- Fehlende Telefonnummern erfassen
- Firmendaten abgleichen

## Sicherheit

Siehe Unterkapitel: [6.1.1 KI-CRM Sicherheitskonzept mit OpenClaw](#)

---

*Erstellt: 26.05.2026 | Thomas Schütz | Exista AG*

# 6.1.1 KI-CRM Sicherheitskonzept mit OpenClaw

# KI-CRM — Sicherheitskonzept & Entscheidungsmatrix

**Stand:** 26.05.2026 | **Thomas Schütz, Exista AG**  
**Modul:** Master of Local AI Manager — Studiendokumentation

---

## 1. Ausgangslage

Das KI-CRM ist ein selbst gehostetes CRM-System auf Basis von Vue.js 3 / Node.js / MariaDB / Docker, das über das Internet erreichbar ist. Da das System Kundendaten (Firmen, Kontakte, Projekte, Umsätze) verwaltet, ist ein durchdachtes Sicherheitskonzept unabdingbar.

## 2. Netzwerkarchitektur

```
Internet
 │
 │ (nur Port 80/443 offen)
 ▼
Firewall
 │
 │ HTTPS (SSL-Termination)
 ▼
Synology Reverse Proxy
│ - Let's Encrypt Zertifikat
│ - capcalc.kistudent.synology.me → Port 8090
 │
 │ HTTP (intern)
 ▼
crm_nginx (Docker)
│ - Security Headers
│ - robots.txt
│ - IP-Beschränkung /local-api/
 │
 ├──► Frontend (Vue.js 3 / Vite)
 │
 └──► Backend (Node.js / Express)
 │
 ├──► MariaDB (crm_semitron)
 └──► Redis (Session-Cache)
```

**Prinzip:** SSL-Termination erfolgt am Eingang (Synology Reverse Proxy). Intern kommunizieren alle Container über HTTP — kein Double-SSL, kein Konfigurationskonflikt.

## 3. Entscheidungsmatrix Sicherheitsmassnahmen

### 3.1 Netzwerk & Transport

| Massnahme | Priorität | Status | Beschreibung |
|---|---|---|---|
| HTTPS / SSL-Termination | 🔴 Hoch | ✅ Erledigt | Synology Reverse Proxy mit Let's Encrypt |
| Firewall Port-Beschränkung | 🔴 Hoch | ✅ Erledigt | Nur Port 80/443 nach aussen, VPN für Admin-Zugang |
| Security Headers | 🔴 Hoch | ✅ Erledigt | X-Frame-Options: SAMEORIGIN, X-Content-Type-Options: nosniff, Referrer-Policy |
| robots.txt | 🟡 Mittel | ✅ Erledigt | Suchmaschinen blockiert (Disallow: /) |

### 3.2 Authentifizierung & Autorisierung

| Massnahme | Priorität | Status | Beschreibung |
|---|---|---|---|
| JWT Authentication | 🔴 Hoch | ✅ Erledigt | Alle API-Endpoints geschützt, Token-Schlüssel: `crm_token` im localStorage |
| TOTP 2FA | 🔴 Hoch | ✅ Erledigt | Aktivierbar pro User in den Einstellungen (TOTP-kompatibel) |
| Vue Router Auth-Guard | 🔴 Hoch | ✅ Erledigt | `router.beforeEach` — alle Routen ausser `/login` prüfen JWT |
| Rate Limiting Login | 🔴 Hoch | ⬜ Offen | Max. 5 Versuche pro IP / 15 Min → Brute-Force-Schutz |

### 3.3 API-Sicherheit

| Massnahme | Priorität | Status | Beschreibung |
|---|---|---|---|
| Local API IP-Beschränkung | 🔴 Hoch | ✅ Erledigt | nginx: `allow 192.168.0.0/16; allow 172.16.0.0/12; deny all` |
| Local API Key Auth | 🔴 Hoch | ✅ Erledigt | `X-API-Key` Header, 68-Zeichen zufälliger Key, in DB gespeichert |
| Soft-Delete | 🟡 Mittel | ✅ Erledigt | `geloescht=1` statt physisch löschen — Datenverlust ausgeschlossen |
| /api/* JWT-Pflicht | 🔴 Hoch | ✅ Erledigt | Alle Endpoints ausser `/auth/login` und `/einstellungen/public` |

### 3.4 Optionale Erweiterungen

| Massnahme | Priorität | Status | Beschreibung |
|---|---|---|---|
| Cloudflare WAF | 🟡 Mittel | ⬜ Optional | DDoS-Schutz, Bot-Filter, WAF — kostenlos für privaten Einsatz |
| Fail2Ban | 🟡 Mittel | ⬜ Optional | IP-Sperre auf OS-Ebene nach Fehlversuchen |
| Demo-Instanz | 🟢 Tief | ⬜ Geplant | Separate Instanz (Port 8091) für Security-Tests vor Go-Live |
| Session-Timeout | 🟢 Tief | ⬜ Optional | Automatischer Logout nach Inaktivität |

## 4. Sicherheitsbewertung

### Aktuelle Stärken

- Firewall beschränkt Angriffsfläche auf Port 80/443
- HTTPS verhindert Man-in-the-Middle-Angriffe
- JWT + TOTP bieten starke Authentifizierung
- Local API nur intern erreichbar — kein externer Zugriff auf Rohdaten
- Security Headers verhindern Clickjacking und MIME-Sniffing
- Soft-Delete verhindert versehentlichen Datenverlust

### Bekannte Schwachstellen (zu beheben)

- Kein Rate Limiting auf Login-Endpoint (Brute-Force möglich)
- Kein WAF-Schutz vor bekannten Angriffsvektoren
- Container laufen möglicherweise als root (zu prüfen)

### Risikobewertung

| Risiko | Wahrscheinlichkeit | Auswirkung | Massnahme |
|---|---|---|---|
| Brute-Force Login | Mittel | Hoch | Rate Limiting (prio 1) |
| DDoS-Angriff | Tief | Mittel | Cloudflare (prio 2) |
| SQL-Injection | Tief | Hoch | Sequelize ORM (bereits aktiv) |
| XSS | Tief | Mittel | Content-Security-Policy (ausbaufähig) |
| Container-Escape | Sehr tief | Hoch | Container nicht als root |
| Datenleak via API | Tief | Hoch | JWT + Local API IP-Filter (aktiv) |

## 5. Priorisierung nächste Schritte

### Priorität 1 (sofort)
└── Rate Limiting auf `POST /api/v1/auth/login`
 → max. 5 Versuche / IP / 15 Minuten
 → `express-rate-limit` Middleware

### Priorität 2 (kurzfristig)
└── Cloudflare vor Synology schalten
 → DNS auf Cloudflare delegieren
 → WAF + DDoS-Schutz kostenlos

### Priorität 3 (vor Go-Live)
└── Demo-Instanz aufsetzen (`crm.kistudent.synology.me`)
 → Security-Scan mit OWASP ZAP
 → Penetrationstest

### Priorität 4 (langfristig)
└── Fail2Ban auf Synology
└── Content-Security-Policy verschärfen
└── Session-Timeout implementieren

## 6. Deployment-Varianten

### Variante A: Synology NAS (aktuell)
Synology DS923+ → Docker Compose → KI-CRM Stack  
Zugang: `capcalc.kistudent.synology.me` (HTTPS via Reverse Proxy)  
**Vorteil:** Einfach, kostengünstig, bereits produktiv

### Variante B: Kunden-Deployment (geplant)
Kunde's Server → Docker Compose + `.env.example` → KI-CRM Stack  
Zugang: eigene Domain + Caddy (automatisches Let's Encrypt)  
**Vorteil:** Portierbar, selbsterklärend, HTTPS automatisch

### Variante C: Mit OpenClaw (optional)
KI-CRM Stack + OpenClaw Agent (separat)  
OpenClaw greift via `/local-api/` mit `X-API-Key` auf CRM zu  
**Vorteil:** KI-Automatisierung, E-Mail-Drafts, Telefonlisten

## 7. Technischer Stack

| Komponente | Technologie | Version |
|---|---|---|
| Frontend | Vue.js 3 + Vite | 3.x |
| Backend | Node.js + Express | 18.x |
| Datenbank | MariaDB | 10.11 |
| Cache | Redis | 7-alpine |
| Proxy | Nginx | alpine |
| Container | Docker Compose | — |
| KI lokal | Ollama (qwen2.5:14b) | — |
| KI Cloud | Anthropic Claude | claude-sonnet-4-6-st |
| STT | Whisper (via Speaches) | — |
| Hardware | Pop!_OS, RTX 5090 32GB | — |

---

*Dokument erstellt im Rahmen des Studiums: Master of Local AI Manager*  
*Autor: Thomas Schütz | Baden | 26.05.2026*

# Use Case 7 – IMAP Gateway v3 (Self-hosted Webmail mit KI)

# Use Case 7 – IMAP Gateway v3

## Beschreibung

Self-hosted Webmail-Applikation mit integriertem KI-Assistenten, gebaut auf FastAPI/Python (Backend) und Vue.js-artigem Vanilla-JS (Frontend), deployed als Docker-Container auf dem Synology NAS (192.168.0.82, Port 4000).

## Ziel &amp; Nutzen

Zentraler E-Mail-Client für alle IMAP-Konten mit KI-Unterstützung direkt im Browser – ohne Abhängigkeit von Cloud-Diensten. Alle Daten bleiben lokal.

## Technischer Stack

- **Backend:** Python 3.12, FastAPI, imaplib, smtplib, SQLite
- **Frontend:** Vanilla JS, Bootstrap 5, Quill.js (WYSIWYG Editor)
- **Deployment:** Docker Compose auf Synology NAS DS923+
- **Port:** 4000 (intern), via Nginx Proxy Manager erreichbar
- **Daten:** SQLite-Datenbank für Einstellungen, Accounts, Chat-Verlauf

## Features

- Multi-Account IMAP/SMTP Unterstützung (unbegrenzte Konten)
- Unified Inbox – alle Posteingänge in einer Übersicht
- HTML-Mail Rendering via iframe (srcdoc)
- Mail-Popup mit Doppelklick – Vollansicht mit KI-Panel
- KI-Assistent (Anthropic Claude API) – Zusammenfassen, Antworten, Analysieren, Übersetzen
- Anhang-Download und Anhang-Upload beim Senden
- Paperless-ngx Integration – Dokumente direkt aus Mail archivieren
- Druckfunktion mit sauberem Print-Layout
- Mail-Archiv mit Volltextsuche (FTS5)
- Draft-Verwaltung, Sent/Trash Sync
- 2-Faktor-Authentifizierung (TOTP)
- Login-gesicherter Zugang (Session-basiert)
- Navigations-Links (Quick Access zu internen Tools)
- Dark Mode Interface

## KI-Integration

- **Modell:** Claude Sonnet (Anthropic API)
- **Funktionen:** Mail zusammenfassen, Antwort generieren, Ton analysieren, To-dos extrahieren, übersetzen
- **Kontext:** Betreff + Mailtext wird als Kontext mitgegeben
- **Chat-Verlauf:** Gesprächsverlauf pro Session gespeichert

## Paperless-ngx Integration

- Konfiguration über Dashboard (URL + API Token)
- Einzelne Anhänge oder komplette Mail als .eml hochladen
- Multipart-Upload direkt an Paperless API

## Deployment

```
Pfad: /volume1/docker/ki_mail/
Docker Image: ki_mail-imap-gateway
Port: 4000
Daten-Volume: ki_mail_imap_gateway_data
Restart: always
```

## Entwicklung

- **Entwickelt mit:** Claude AI (Anthropic) als Coding-Assistent
- **Entwicklungszeit:** ca. 3 Monate (iterativ)
- **Versionierung:** v1 → v2 → v3 (aktuell)
- **Wichtigste Fixes v3:** HTML-Rendering (srcdoc), Anhang-Upload, Paperless-Integration, Mail-Popup, Login als Startseite

## Lessons Learned

- iframe sandbox + allow-same-origin + allow-scripts zusammen unsicher – srcdoc ist die sauberste Lösung
- Docker Image-Cache muss explizit gelöscht werden bei Updates (--rmi all)
- Multipart-Upload zu Paperless benötigt korrektes CRLF-Format
- Template-Strings in JS nie mit Regex-Patterns mischen

# Use Case 8 - AnythingLLM Websuche mit SearXNG

## Beschreibung

Integration von SearXNG als lokale Suchmaschine in AnythingLLM fur Echtzeit-Websuche - vollstandig self-hosted.

## Stack

- AnythingLLM v1.10.0 - Port 100
- SearXNG - Port 1000
- Ollama - Port 8000
- Synology NAS DS923+

## Problem 1: SearXNG keine Ergebnisse

Alle Suchmaschinen in settings.yml waren deaktiviert.

```
docker restart librechat-searxng
curl -s http://192.168.0.82:1000/search?q=bitcoin+price&format=json | python3 -c "import sys,json; d=json.load(sys.stdin); print(d[number_of_results])"
```

## Problem 2: web-browsing Plugin Bug

AnythingLLM 1.10.0 Bug: web-browsing gibt \[object Object\] zuruck. Fix via SQLite:

```
DB=/volume1/docker/anythingllm/storage/anythingllm.db
cp $DB ${DB}.backup
sqlite3 $DB UPDATE plugins SET enabled=0 WHERE name=web-browsing
docker restart anythingllm
```

## Problem 3: Docker Netzwerk-Isolation

AnythingLLM und SearXNG in verschiedenen Netzen.

```
docker network connect librechat_app-net anythingllm
```

## Problem 4: Falsches Volume Mount

Richtig: /volume1/docker/anythingllm/storage:/app/server/storage

## Lessons Learned

- SearXNG Engines muessen explizit aktiviert werden
- Websuche muss an zwei Stellen konfiguriert werden
- web-browsing Bug in v1.10.0 via SQLite fixen
- Volume Mounts immer absoluter Pfad

# Use Case 9 - KI Programmierstudio v3 (Self-hosted Coding Assistant)

# Use Case 9 - KI Programmierstudio v3

## Beschreibung

Self-hosted KI-gestuetztes Entwicklungstool das Claude API mit einem autonomen Coding-Assistenten kombiniert. Laeuft auf dem lokalen Linux-PC (192.168.0.16, Port 7777) als Docker-Container.

## Ziel und Nutzen

Ein vollstaendiges KI-Programmierstudio direkt im Browser - ohne Cloud-Abhaengigkeit ausser der Claude API. Der Watchdog-Modus ermoeglicht autonomes Arbeiten: Claude loest Aufgaben selbststaendig in einer Loop ohne manuelle Eingriffe.

## Technischer Stack

- Backend: Node.js Express (Port 3002)
- Frontend: Single-file HTML (kein Build-Schritt)
- Proxy: Nginx (Port 7777)
- KI: Anthropic Claude API (claude-sonnet-4-6)
- Deployment: Docker Compose, 3 Services
- Server: Linux PC 192.168.0.16

## Kernfeatures

- Streaming-Chat mit Claude via SSE (letzte 10 Messages als Kontext)
- File-Upload JSON/MD/TXT/YAML - wird automatisch in System-Prompt injiziert
- Automatische Code-Extraktion aus Antworten via FILE: path Bloecke
- Status-Dokument-Tracking mit Symbolen fuer erledigt/offen/geplant
- Watchdog - autonome Loop die selbststaendig Prompts sendet
- ZIP-Export aller generierten Dateien
- Projekt-Verwaltung (mehrere Projekte parallel)
- Code-Server Integration (VS Code im Browser, Port 7000)

## KI-Integration

- Modell: claude-sonnet-4-6 (Anthropic API)
- Streaming: Server-Sent Events fuer Echtzeit-Output
- Kontext: Letzte 10 Messages + hochgeladene Dokumente
- Watchdog: Autonome Coding-Loop ohne Benutzereingriff
- Code-Extraktion: Automatisches Speichern generierter Dateien

## Arbeitsweise

Das Studio wird in zwei Tools aufgeteilt: Claude.ai fuer Architektur, Debugging und Prompt-Erstellung, und das KI Programmierstudio (Claude Code) fuer die eigentliche Code-Ausfuehrung. Wichtige Regeln fuer Claude Code:

- Vor jeder Aenderung: git add und git commit
- Nur explizit genannte Dateien aendern
- Niemals hardcodierte dunkle Farben verwenden
- Migrations immer mit IF NOT EXISTS
- Deploy immer mit --env-file Flag

## Deployment docker-compose.yml

```
version: 3.8
services:
  studio-api:
    build: ./studio-api
    container_name: ki_studio_api
    restart: always
    ports:
      - 3002:3002
    environment:
      - ANTHROPIC_API_KEY=your-key-here
    volumes:
      - ./projects:/app/projects
  studio-ui:
    build: ./studio-ui
    container_name: ki_studio_ui
    restart: always
    ports:
      - 3001:80
  nginx:
    image: nginx:alpine
    container_name: ki_studio_nginx
    restart: always
    ports:
      - 7777:80
    volumes:
      - ./nginx/nginx.conf:/etc/nginx/nginx.conf
    depends_on:
      - studio-api
      - studio-ui
```

## Verwendete Projekte

- ki-crm - CRM System fuer Exista AG (Hauptprojekt)
- imap-gateway - IMAP Gateway v3
- myflex-training - Fitness Plattform

## Lessons Learned

- Watchdog kann unkontrolliert viele API-Calls machen - immer mit Limit konfigurieren
- Scope-Kontrolle kritisch: Claude Code aendert gerne Dateien ausserhalb des Scopes
- Git als Sicherheitsnetz vor jeder Aenderung unbedingt noetig
- Single-file HTML Frontend ideal fuer schnelle Iteration ohne Build-Schritt
- SSE-Streaming deutlich besser als Polling fuer langen Code-Output

# Use Case 10 Programmierstudio mit Trennung Intelligenz / Coder Lokal

In diesem UseCase geht es um die Automatisierung des Synchfiles. Wichtig um die Intelligenz und den Coder zu synchronisieren. Um maximale Datensicherheit zu garantieren, ohne selbst programmieren zu müssen. Das Ziel ist es, die letzten 2 % Fehlerquote zu eliminieren, indem wir nicht blind einer KI vertrauen, sondern als Projektmanager ("Human-in-the-Loop") die Kontrolle behalten. Wir orchestrieren die Modelle (DeepSeek-R1 und Qwen2.5 VL 70b) so, dass sie sich gegenseitig kontrollieren und die fertigen Lösungswege zur Freigabe vorlegen.

### Die Umsetzung (Das "Maker-Checker"-System)

Du hast eine Architektur gebaut, die reine Ausführung und tiefes logisches Denken strikt trennt, und alles über eine nahtlose Dateisynchronisation verbindet:

- **Zwei spezialisierte KIs:** Eine KI agiert im `code-server` als "Coder" (schreibt den Code und den Status). DeepSeek-R1 agiert in `AnythingLLM` als "Architekt" (analysiert Fehler und schreibt die Prompts für den Coder).
- **Der gemeinsame Ordner (Bind Mount):** Über dein Pop!\_OS-System teilst du den Projektordner via Docker mit beiden Containern. Das Herzstück ist das `syncfile.md`, in dem der Coder seinen aktuellen Status hinterlegt.
- **Das Echtzeit-Plugin:** Um die schwerfällige Vektordatenbank von AnythingLLM zu umgehen, nutzt du ein eigens generiertes Node.js-Plugin ("Live-Sync-Reader"). Das erlaubt dem Agenten, das Syncfile in Millisekunden direkt von der Festplatte zu lesen.
- **Der automatisierte Loop:** In AnythingLLM stellst du den Workspace auf "Agent" und hinterlegst einen Masterprompt. Wenn du beim Debuggen einen Fehler findest, reicht eine kurze Frage im Chat. Der Agent liest über das Plugin live den neuesten Code-Status und liefert dir sofort den perfekten Befehl, den du dem Coder zur Korrektur übergibst.

<div _ngcontent-ng-c2575315576="" class="code-block ng-tns-c2575315576-128 ng-animate-disabled ng-trigger ng-trigger-codeBlockRevealAnimation" data-hveid="0" data-ved="0CAAQhtANahgKEwiJ0t-Z0uuVAxUAAAAAHQAAAAAQgwQ" decode-data-ved="1" id="bkmrk-markdown" jslog="223238;track:impression,attention;BardVeMetadataKey:[["r_8cb1e03cc3481e8c","c_2696a49c711e2d18",null,"rc_aafd8a93bd0b3651",null,null,"de",null,1,null,null,1,0]]"><div _ngcontent-ng-c2575315576="" class="formatted-code-block-internal-container ng-tns-c2575315576-128"><div _ngcontent-ng-c2575315576="" class="animated-opacity ng-tns-c2575315576-128"><div _ngcontent-ng-c2575315576="" class="code-block-decoration header-formatted gds-emphasized-body-m ng-tns-c2575315576-128 ng-star-inserted"><span class="ng-tns-c2575315576-128">Markdown</span><div _ngcontent-ng-c2575315576="" class="buttons ng-tns-c2575315576-128 ng-star-inserted"><button aria-label="Code herunterladen" class="mdc-icon-button mat-mdc-icon-button mat-mdc-button-base mat-badge mat-unthemed mat-badge-overlap mat-badge-above mat-badge-after mat-badge-small mat-badge-hidden ng-star-inserted"></button><button aria-label="Code kopieren" class="mdc-icon-button mat-mdc-icon-button mat-mdc-button-base mat-badge mat-unthemed mat-badge-overlap mat-badge-above mat-badge-after mat-badge-small mat-badge-hidden ng-star-inserted"></button></div></div></div></div></div>```
# Dokumentation: Lokaler KI-Architekt Workflow (Maker-Checker)

Dieses Dokument beschreibt das Setup eines "Maker-Checker"-Workflows für die KI-gestützte Softwareentwicklung. Die Architektur trennt die ausführende KI (den Coder) strikt von der planenden KI (dem Architekten) und nutzt ein gemeinsames lokales Dateisystem (Syncfile) zur Kommunikation.

## 🛠 System-Umgebung
* **Betriebssystem:** Pop!_OS (Linux)
* **Hardware:** NVIDIA RTX6000 (98GB VRAM - Desktop Version)
* **KI-Modelle:** DeepSeek-R1 (Logik/Architektur) & Qwen2.5 VL 70b (Vision/Coding)
* **Tools:** Docker, code-server (IDE), AnythingLLM (KI-Workspace)

---

## 1. Ordnerstruktur & Docker-Mounts

Um Probleme mit Vektor-Datenbank-Aktualisierungen zu vermeiden, nutzen wir ein zentrales Projektverzeichnis auf dem Host-System, das als Bind-Mount in beide Docker-Container (code-server und AnythingLLM) gereicht wird.

**Lokale Struktur auf dem Host:**
```text
/home/thomas/projects/
├── ki_crm/                  <-- Projekt 1
│   ├── app.py
│   └── syncfile.md          <-- Das geteilte Status-Dokument
└── neues_projekt/           <-- Projekt 2
    ├── index.html
    └── syncfile.md

```

<div _ngcontent-ng-c2575315576="" class="code-block ng-tns-c2575315576-128 ng-animate-disabled ng-trigger ng-trigger-codeBlockRevealAnimation" data-hveid="0" data-ved="0CAAQhtANahgKEwiJ0t-Z0uuVAxUAAAAAHQAAAAAQgwQ" decode-data-ved="1" id="bkmrk-" jslog="223238;track:impression,attention;BardVeMetadataKey:[["r_8cb1e03cc3481e8c","c_2696a49c711e2d18",null,"rc_aafd8a93bd0b3651",null,null,"de",null,1,null,null,1,0]]"><div _ngcontent-ng-c2575315576="" class="formatted-code-block-internal-container ng-tns-c2575315576-128"><div _ngcontent-ng-c2575315576="" class="animated-opacity ng-tns-c2575315576-128"></div></div></div>**Docker-Compose Einbindung (Auszug):** Beide Container erhalten Lese-/Schreibzugriff auf diesen Hauptordner.

<div _ngcontent-ng-c2575315576="" class="code-block ng-tns-c2575315576-129 ng-animate-disabled ng-trigger ng-trigger-codeBlockRevealAnimation" data-hveid="0" data-ved="0CAAQhtANahgKEwiJ0t-Z0uuVAxUAAAAAHQAAAAAQhAQ" decode-data-ved="1" id="bkmrk-yaml" jslog="223238;track:impression,attention;BardVeMetadataKey:[["r_8cb1e03cc3481e8c","c_2696a49c711e2d18",null,"rc_aafd8a93bd0b3651",null,null,"de",null,1,null,null,1,0]]"><div _ngcontent-ng-c2575315576="" class="formatted-code-block-internal-container ng-tns-c2575315576-129"><div _ngcontent-ng-c2575315576="" class="animated-opacity ng-tns-c2575315576-129"><div _ngcontent-ng-c2575315576="" class="code-block-decoration header-formatted gds-emphasized-body-m ng-tns-c2575315576-129 ng-star-inserted"><span class="ng-tns-c2575315576-129">YAML</span><div _ngcontent-ng-c2575315576="" class="buttons ng-tns-c2575315576-129 ng-star-inserted"><button aria-label="Code herunterladen" class="mdc-icon-button mat-mdc-icon-button mat-mdc-button-base mat-badge mat-unthemed mat-badge-overlap mat-badge-above mat-badge-after mat-badge-small mat-badge-hidden ng-star-inserted"></button><button aria-label="Code kopieren" class="mdc-icon-button mat-mdc-icon-button mat-mdc-button-base mat-badge mat-unthemed mat-badge-overlap mat-badge-above mat-badge-after mat-badge-small mat-badge-hidden ng-star-inserted"></button></div></div></div></div></div>```
# In code-server
volumes:
  - /home/thomas/projects:/config/workspace 

# In AnythingLLM
volumes:
  - /home/thomas/projects:/app/server/storage/documents/live_projekte 

```

<div _ngcontent-ng-c2575315576="" class="code-block ng-tns-c2575315576-129 ng-animate-disabled ng-trigger ng-trigger-codeBlockRevealAnimation" data-hveid="0" data-ved="0CAAQhtANahgKEwiJ0t-Z0uuVAxUAAAAAHQAAAAAQhAQ" decode-data-ved="1" id="bkmrk--2" jslog="223238;track:impression,attention;BardVeMetadataKey:[["r_8cb1e03cc3481e8c","c_2696a49c711e2d18",null,"rc_aafd8a93bd0b3651",null,null,"de",null,1,null,null,1,0]]"><div _ngcontent-ng-c2575315576="" class="formatted-code-block-internal-container ng-tns-c2575315576-129"><div _ngcontent-ng-c2575315576="" class="animated-opacity ng-tns-c2575315576-129"></div></div></div>## 2. AnythingLLM Plugin: Der "Live-Sync-Reader"

Da das native Embedding von AnythingLLM bei jedem Code-Save das System überlasten würde (oder im Auto-Watch zu langsam ist), nutzen wir einen **Custom Agent Skill**. Dieser liest das Syncfile in Echtzeit direkt von der SSD, vorbei an der Vektordatenbank.

### 2.1 Plugin erstellen

Das Plugin wird von der Code-KI generiert. Der verwendete Prompt lautet:

> **Rolle:** Du bist ein erfahrener Node.js-Entwickler und baust ein Custom Agent Skill Plugin für das System AnythingLLM. **Aufgabe:** Schreibe den Code für ein lokales File-Reader-Plugin. Dieses Plugin soll es dem AnythingLLM-Agenten ermöglichen, eine Textdatei in Echtzeit direkt von der Festplatte des Docker-Containers auszulesen und den Inhalt als reinen Text in den Chat-Kontext zurückzugeben. **Spezifikationen:** Erstelle eine `plugin.json` (Name: "Live Syncfile Reader", Argument `filepath` als String) und eine `index.js`, die per `fs.readFileSync(filepath, 'utf8')` den Text ausliest und Fehler mit einem `try...catch`-Block abfängt. Gib nur den Code aus.

### 2.2 Plugin installieren

1. Navigiere auf dem Host in den gemounteten Storage-Ordner von AnythingLLM: `storage/plugins/agent-skills/`
2. Erstelle den Ordner `live-sync-reader`.
3. Speichere die generierte `plugin.json` und `index.js` in diesem Ordner.
4. Starte den AnythingLLM-Container neu: `docker compose restart anythingllm`.

## 3. Workspace-Konfiguration (Pro Projekt)

Für jedes neue Projekt wird in AnythingLLM ein eigener Workspace erstellt (z.B. "KI-CRM"). Um den Workflow zu automatisieren, müssen zwei Einstellungen im Workspace vorgenommen werden:

### A. Default Chat Mode anpassen

Unter den Workspace-Einstellungen wird der Standard-Chat-Modus von *Chat* auf **Agent** gestellt. Dadurch entfällt die Notwendigkeit, Befehle manuell mit `@agent` zu beginnen.

### B. System Prompt definieren

Der folgende Masterprompt wird in den Workspace-Einstellungen hinterlegt, um den Agenten zu zwingen, bei jeder Anfrage zuerst den Live-Reader zu nutzen:

> "Du bist der KI-Architekt für dieses Projekt. Bevor du meine Anfragen beantwortest, nutzt du immer zwingend den Live-Sync-Reader-Skill, um das aktuelle Statusfile (`/app/server/storage/documents/live_projekte/[PROJEKTNAME]/syncfile.md`) in Echtzeit auszulesen. Erst danach analysierst du das Problem, beantwortest meine Frage und generierst den Korrektur-Prompt für den Coder." *(Hinweis: `[PROJEKTNAME]` durch den tatsächlichen Ordnernamen ersetzen).*

## 4. Der tägliche Workflow (Human-in-the-Loop)

1. **Der Coder arbeitet:** Der Coder (ausführende KI) schreibt Programmcode im `code-server` und dokumentiert den aktuellen Status/Fehler im `syncfile.md` innerhalb des Projektordners.
2. **Der Mensch steuert:** Beim Debuggen wird ein Logikfehler entdeckt. Der Mensch wechselt in den AnythingLLM Workspace des Projekts.
3. **Der Architekt analysiert:** Der Mensch fragt im AnythingLLM-Chat: *"Schau dir den Fehler in Zeile 40 an."*
4. **Vollautomatische Ausführung:**
    
    
    - AnythingLLM triggert (dank Default-Agent-Modus) sofort den Agenten.
    - Der Agent befolgt den System-Prompt und führt das Live-Reader-Plugin aus.
    - Das Plugin liest die Millisekunden zuvor gespeicherte `syncfile.md` ein.
    - DeepSeek-R1 analysiert den taufrischen Code-Status und liefert dem Menschen den perfekten, logisch geprüften Prompt.
5. **Der Loop schließt sich:** Der Mensch kopiert den Vorschlag des Architekten und übergibt ihn als neuen Befehl an den Coder im `code-server`.
    
    ## 5. Referenzen &amp; Weiterführende Links
    
    **Basis-Infrastruktur &amp; IDE**
    
    
    - **code-server:** [Offizielles GitHub-Repository](https://github.com/coder/code-server) | [Dokumentation &amp; Setup](https://coder.com/docs/code-server)
    - **Docker &amp; Volumes:** [Offizielle Referenz zu Docker Bind Mounts](https://docs.docker.com/storage/bind-mounts/)
    - **Betriebssystem:** [Pop!\_OS by System76](https://pop.system76.com/)
    
    **KI-Workspace &amp; Orchestrierung**
    
    
    - **AnythingLLM:** [Offizielle Website](https://anythingllm.com/) | [GitHub-Repository](https://github.com/Mintplex-Labs/anything-llm)
    - **AnythingLLM Agent Skills:** [Dokumentation zur Plugin-Entwicklung](https://www.google.com/search?q=https://github.com/Mintplex-Labs/anything-llm/tree/master/server/storage/plugins/agent-skills) *(Referenz für die Struktur der plugin.json und index.js)*
    
    **Eingesetzte lokale KI-Modelle**
    
    
    - **DeepSeek-R1 (Architektur, Logik &amp; Prompt-Generierung):** [DeepSeek-R1 Release &amp; Specs (GitHub)](https://github.com/deepseek-ai/DeepSeek-R1)
    - **Qwen2.5 VL 70b (Vision &amp; Coder-Ausführung):** [Qwen2.5-VL Dokumentation (GitHub)](https://github.com/QwenLM/Qwen2.5-VL)
    
    **Technischer Hintergrund für das Live-Sync-Plugin**
    
    
    - **Node.js File System (fs):** [Offizielle API-Dokumentation zu fs.readFileSync](https://www.google.com/search?q=https://nodejs.org/api/fs.html%23fsreadfilesyncpath-options) *(Wichtig für die Auslese-Logik des Custom Skills)*

# Prozessbeschreibung & Workflow-Diagramme (je Use Case)



# Applikationsauswahl & Begründung



# Funktionsnachweis je Use Case (Screenshots, Outputs, Logs)



# Lessons Learned & Optimierungspotenziale



# Use Case 11 KI-DB Setup

## Inhalt

<div class="toc" id="bkmrk-01-architektur-%C3%9Cbers"><div class="toc-grid">[<span class="num">01</span> Architektur-Übersicht](file:///home/vitruvian/Downloads/ki-db-handbuch.html#architektur) [<span class="num">02</span> Voraussetzungen](file:///home/vitruvian/Downloads/ki-db-handbuch.html#voraussetzungen) [<span class="num">03</span> Installation](file:///home/vitruvian/Downloads/ki-db-handbuch.html#installation) [<span class="num">04</span> AnythingLLM Konfiguration](file:///home/vitruvian/Downloads/ki-db-handbuch.html#konfiguration) [<span class="num">05</span> Auto-Sync (Ordner → Workspace)](file:///home/vitruvian/Downloads/ki-db-handbuch.html#auto-sync) [<span class="num">06</span> Projekte einbinden](file:///home/vitruvian/Downloads/ki-db-handbuch.html#projekte) [<span class="num">07</span> Workspace-Prompts](file:///home/vitruvian/Downloads/ki-db-handbuch.html#prompts) [<span class="num">08</span> Tests und Verifikation](file:///home/vitruvian/Downloads/ki-db-handbuch.html#tests) [<span class="num">09</span> Troubleshooting](file:///home/vitruvian/Downloads/ki-db-handbuch.html#troubleshooting) [<span class="num">10</span> Wissensbasis für Claude](file:///home/vitruvian/Downloads/ki-db-handbuch.html#wissensbasis) [<span class="num">11</span> Arbeitsworkflow](file:///home/vitruvian/Downloads/ki-db-handbuch.html#workflow) [<span class="num">12</span> Port- und Service-Referenz](file:///home/vitruvian/Downloads/ki-db-handbuch.html#referenz)</div></div><section id="bkmrk-01-architektur-%C3%9Cbers-1">## <span class="section-num">01</span> Architektur-Übersicht

KI-DB ist eine universelle RAG-Infrastruktur (Retrieval-Augmented Generation). Ordner mit Dateien werden automatisch in durchsuchbare, KI-verfügbare Wissens-Workspaces verwandelt.

[![image.png](https://bookstack.kistudent.synology.me/uploads/images/gallery/2026-08/scaled-1680-/huiimage.png)](https://bookstack.kistudent.synology.me/uploads/images/gallery/2026-08/huiimage.png)

### Embedding-Pipeline

<div class="flow-row"><div class="flow-box">Datei (PDF, Code, MD)</div><span class="flow-arrow">→</span><div class="flow-box">bge-m3 (1024 Dim.)</div><span class="flow-arrow">→</span><div class="flow-box">Weaviate (Vektoren)</div><span class="flow-arrow">→</span><div class="flow-box">Semantische Suche</div><span class="flow-arrow">→</span><div class="flow-box">LLM antwortet</div></div></section><section id="bkmrk-02-voraussetzungen-k">## <span class="section-num">02</span> Voraussetzungen

<table><tbody><tr><th>Komponente</th><th>Anforderung</th><th>Dev-PC Status</th></tr><tr><td>Docker + Compose</td><td>Docker 20.x+, Compose v2</td><td class="check">✅ Installiert</td></tr><tr><td>GPU (für Embeddings)</td><td>NVIDIA GPU mit CUDA</td><td class="check">✅ RTX PRO 6000 (96 GB)</td></tr><tr><td>vLLM</td><td>Port 8001, qwen3.6-27b</td><td class="check">✅ Läuft</td></tr><tr><td>bge-m3</td><td>Port 8003, Embedding-Modell</td><td class="check">✅ Läuft</td></tr><tr><td>Speicherplatz</td><td>~20 GB für Weaviate + Postgres + Dokumente</td><td class="check">✅ 1.8 TB NVMe</td></tr></tbody></table>

</section><section id="bkmrk-03-installation-1-pr">## <span class="section-num">03</span> Installation

<div class="step"><div class="step-num">1</div><div class="step-content">  
</div></div>**Projektordner erstellen**

```
mkdir -p ~/0_docker/3001_kidb
cd ~/0_docker/3001_kidb
```

<div class="step"><div class="step-num">2</div><div class="step-content">  
</div></div>**.env Datei erstellen**

```
# --- PostgreSQL ---
POSTGRES_USER=kidb_user
POSTGRES_PASSWORD=KiDb2026!
POSTGRES_DB=kidb

# --- AnythingLLM ---
ANYTHING_LLM_PORT=3001
ANYTHING_LLM_API_KEY=          # Nach Erststart generieren!

# --- Ports ---
WEAVIATE_PORT=8085
REDIS_PORT=6379

# --- LLM (extern auf Dev-PC) ---
LLM_BASE_URL=http://192.168.0.16:8001/v1
LLM_MODEL=qwen3.6-27b

# --- Embedding (extern auf Dev-PC) ---
EMBEDDING_BASE_URL=http://192.168.0.16:8003/v1
EMBEDDING_MODEL=bge-m3

# --- Pfade ---
PROJEKTE_DIR=./projekte
```

<div class="step"><div class="step-num">3</div><div class="step-content">  
</div></div>**Setup ausführen und Stack starten**

```
chmod +x setup.sh
./setup.sh
```

Oder manuell:

```
mkdir -p projekte/programmierung projekte/wissen-ki projekte/wissen-el-kompo
docker compose up -d --build
```

<div class="step"><div class="step-num">4</div><div class="step-content">  
</div></div>**AnythingLLM Ersteinrichtung**

Öffne `http://192.168.0.16:3001`, erstelle den Admin-Account.

<div class="card warning"><div class="card-label">Wichtig: JWT_SECRET</div></div>AnythingLLM benötigt ein `JWT_SECRET` in der `docker-compose.yml` unter dem AnythingLLM-Service. Ohne dieses schlägt der Login mit einem 500-Fehler fehl. Generiere es mit:

```
docker exec -w /app/server kidb-anythingllm \
  node -e 'console.log(require("crypto").randomBytes(32).toString("hex"))'
```

Den generierten Key in die `docker-compose.yml` unter `environment:` eintragen:

```
JWT_SECRET: "dein_generierter_key"
```

</section><section id="bkmrk-04-anythingllm-konfi">## <span class="section-num">04</span> AnythingLLM Konfiguration

### KI-Anbieter → LLM

<div class="card"><table><tbody><tr><th>Einstellung</th><th>Wert</th></tr><tr><td>Provider</td><td>Generic OpenAI</td></tr><tr><td>Base URL</td><td>`http://192.168.0.16:8001/v1`</td></tr><tr><td>Chat Model</td><td>`qwen3.6-27b`</td></tr><tr><td>Model context window</td><td>**32768**</td></tr><tr><td>Max Tokens</td><td>**8192**</td></tr></tbody></table>

</div>⚠ Context window = Input-Grösse, Max Tokens = Antwort-Länge. Nicht vertauschen!

### KI-Anbieter → Einbettung

<div class="card"><table><tbody><tr><th>Einstellung</th><th>Wert</th></tr><tr><td>Provider</td><td>Generic OpenAI</td></tr><tr><td>Base URL</td><td>`http://192.168.0.16:8003/v1`</td></tr><tr><td>Model</td><td>`bge-m3`</td></tr><tr><td>Max embedding chunk length</td><td>**8192**</td></tr></tbody></table>

</div><div class="card danger"><div class="card-label">Häufiger Fehler</div></div>LLM und Embedding verwenden **verschiedene Ports**! Port 8001 = Chat (Qwen), Port 8003 = Embedding (bge-m3). Wenn der gleiche Port für beides eingestellt ist, funktioniert entweder Chat oder Embedding nicht.

### Textsplitting &amp; Chunking

<div class="card"><table><tbody><tr><th>Einstellung</th><th>Wert</th><th>Warum</th></tr><tr><td>Textchunk-Grösse</td><td>**8192**</td><td>Ganze Vue-Dateien passen in einen Chunk</td></tr><tr><td>Textchunk-Überlappung</td><td>**200**</td><td>Funktionen an Grenzen gehen nicht verloren</td></tr></tbody></table>

</div>### Agentenfähigkeiten

<table><tbody><tr><th>Feature</th><th>Empfehlung</th></tr><tr><td>RAG &amp; long-term memory</td><td class="check">✅ On</td></tr><tr><td>Web Search</td><td class="check">✅ On (SearXNG: http://192.168.0.16:8888)</td></tr><tr><td>SQL Connector</td><td class="check">✅ On</td></tr><tr><td>Generate &amp; save files</td><td class="check">✅ On</td></tr></tbody></table>

### API-Key generieren

Unter **Werkzeuge → Entwickler-API** den API-Key generieren und in die `.env` bei `ANYTHING_LLM_API_KEY=` eintragen. Dann: `docker compose restart sync`

</section><section id="bkmrk-05-auto-sync-v3-%28ord">## <span class="section-num">05</span> Auto-Sync v3 (Ordner → Workspace)

Der Sync-Container überwacht den `projekte/`-Ordner mit Linux-Kernel-Events (`inotifywait`). Kein Polling, reagiert in Sekunden. Version 3 löst das Duplikat-Problem: geänderte Dateien werden zuerst gelöscht, dann neu embedded.

### Sync v3 Features

<div class="card success"><div class="card-label">Neu in v3</div><table><tbody><tr><th>Feature</th><th>v2 (alt)</th><th>v3 (aktuell)</th></tr><tr><td>Fingerprint</td><td>Dateigrösse + mtime</td><td>**SHA-256** (erkennt jede Änderung)</td></tr><tr><td>Datei geändert</td><td>Neue Version dazu (Duplikate!)</td><td>**Delete-before-Update** (alte Vektoren gelöscht)</td></tr><tr><td>Datei gelöscht</td><td>Geister-Chunks bleiben</td><td>**Lösch-Erkennung** (Vektoren aufgeräumt)</td></tr><tr><td>Sync-Start</td><td>Nur neue Dateien</td><td>**Reconciliation** (verwaiste Einträge bereinigt)</td></tr></tbody></table>

</div>### Was passiert automatisch

<table><tbody><tr><th>Ereignis</th><th>Aktion</th><th>Log-Symbol</th></tr><tr><td>Neuer Ordner in `projekte/`</td><td>AnythingLLM Workspace wird erstellt, alle Dateien hochgeladen</td><td>✅</td></tr><tr><td>Neue Datei in bestehendem Ordner</td><td>SHA-256 berechnet, Datei hochgeladen und embedded</td><td>📄 → ✅</td></tr><tr><td>Datei geändert (anderer SHA-256)</td><td>Alte Version in AnythingLLM gelöscht, neue hochgeladen</td><td>♻️ → 🗑️ → ✅</td></tr><tr><td>Datei gelöscht</td><td>Aus AnythingLLM-Workspace entfernt, Weaviate-Vektoren gelöscht</td><td>🗑️</td></tr><tr><td>Unveränderte Datei (gleicher SHA-256)</td><td>Wird übersprungen</td><td>—</td></tr><tr><td>Sync-Start (Reconciliation)</td><td>State ↔ Dateisystem abgleich, verwaiste Einträge entfernt</td><td>🧹</td></tr></tbody></table>

<div class="card"><div class="card-label">Verifiziert</div></div>Das Delete-before-Update wurde live getestet: Beim Löschen eines Dokuments über die AnythingLLM-API werden die Weaviate-Vektoren automatisch mitgelöscht (verifiziert: 661 → 660 Objekte). Der Sync v3 kann sich auf die AnythingLLM-API verlassen — kein direkter Weaviate-Zugriff nötig.

### Neues Projekt anlegen

```
mkdir projekte/thermisches-management
cp ~/Dokumente/thermal-specs/* projekte/thermisches-management/
# → Sync erkennt es automatisch, Workspace wird erstellt
```

### Unterstützte Dateiformate

PDF, TXT, MD, DOCX, XLSX, CSV, PPTX, Python, JavaScript, TypeScript, Vue, HTML, CSS, JSON, YAML, SQL, C/C++, Java, Rust, Go, Shell-Scripts, Config-Dateien, und mehr.

</section><section id="bkmrk-06-projekte-einbinde">## <span class="section-num">06</span> Projekte einbinden

### Code-Projekte (z.B. KI-CRM)

<div class="card warning"><div class="card-label">Nie 1:1 kopieren!</div></div>Ohne Filter würden tausende irrelevante Dateien (node\_modules, .git) die Wissensbasis verwässern.

```
rsync -av --progress \
  --exclude='node_modules' \
  --exclude='.git' \
  --exclude='dist' \
  --exclude='build' \
  --exclude='.env' \
  --exclude='*.log' \
  --exclude='package-lock.json' \
  --exclude='yarn.lock' \
  ~/0_docker/7000_progstudio/ki-crm/ \
  ~/0_docker/3001_kidb/projekte/ki-crm/
```

### Workspace-Struktur

```
projekte/
├── programmierung/      → Übergreifend: Golden Rules, Patterns
├── ki-crm/              → CRM-Quellcode (eigener Workspace)
├── ki-mail/             → Mail-Client-Quellcode
├── wissen-ki/           → KI-Fachwissen
└── wissen-el-kompo/     → Elektronik, Datenblätter
```

Top-Level-Ordner = Workspace. Unterordner gehören zum gleichen Workspace.

</section><section id="bkmrk-07-workspace-prompts">## <span class="section-num">07</span> Workspace-Prompts

Jeder Workspace bekommt einen eigenen System-Prompt. Einstellbar unter Workspace → Chat-Einstellungen → Prompt.

### Programmierung / KI-CRM

```
Du bist der technische Architekt für Programmier-Projekte 
(Vue.js 3 / Node.js / MariaDB / Docker).

DEINE ROLLE:
Du analysierst den bestehenden Code und die Dokumentation. 
Du schreibst KEINEN Code selbst. Deine Ausgabe ist immer ein 
fertiger, kopierbarer Prompt für Claude Code (code-server).

GOLDEN RULES (in jedem Prompt enthalten):
1. git add . && git commit vor jeder Änderung
2. Nur genannte Dateien ändern
3. Geschützte Dateien NIE ohne Anweisung
4. Keine hardcodierten Farben
5. Migrations mit IF NOT EXISTS
6. Stopp-Punkte nach jedem Schritt

Antworte auf Deutsch. Temperatur: 0.3. Datum: {date}
```

### Wissen El-Kompo

```
Du bist ein Experte für elektronische Komponenten, 
Leistungselektronik und thermisches Management. 
Antworte auf Deutsch, technisch präzise, mit Bezug 
auf die verfügbaren Datenblätter und Dokumente.
```

### Ablehnungsantwort (alle Workspaces)

```
Zu dieser Frage habe ich keine relevanten Informationen 
in diesem Workspace gefunden.
```

</section><section id="bkmrk-08-tests-und-verifik">## <span class="section-num">08</span> Tests und Verifikation

### 1. bge-m3 Embedding-Endpoint prüfen

```
curl -s http://192.168.0.16:8003/v1/embeddings \
  -H "Content-Type: application/json" \
  -d '{"input":"Testtext","model":"bge-m3"}' | python3 -c "
import sys,json
d=json.load(sys.stdin)
e=d.get('data',[{}])[0].get('embedding',[])
print(f'Dimensionen: {len(e)}')
print(f'Erste 5 Werte: {e[:5]}')
"
```

<div class="card success"><div class="card-label">Erwartetes Ergebnis</div></div>`Dimensionen: 1024` und Zahlenwerte → bge-m3 läuft.

### 2. Weaviate — Objekte prüfen

```
curl -s 'http://192.168.0.16:8085/v1/objects?limit=1' \
  | python3 -m json.tool | head -5
```

<div class="card success"><div class="card-label">Erwartetes Ergebnis</div></div>`"objects": [{"class": "KiCrm", ...}]` → Vektoren gespeichert.

### 3. Weaviate Schema prüfen

```
curl -s http://192.168.0.16:8085/v1/schema \
  | python3 -m json.tool | head -10
```

### 4. AnythingLLM Logs

```
docker logs kidb-anythingllm 2>&1 | grep -i "weaviate\|embed" | tail -20
```

### 5. Sync v3 — Delete-before-Update testen

<div class="step"><div class="step-num">1</div><div class="step-content">  
</div></div>**Test-Ordner anlegen (neuer Workspace):**

```
mkdir -p ~/0_docker/3001_kidb/projekte/sync-test
```

Warten, dann: `docker logs kidb-sync --tail 5` → muss "Neuer Projektordner: sync-test" zeigen.

<div class="step"><div class="step-num">2</div><div class="step-content">  
</div></div>**Neue Datei wird embedded:**

```
echo "Die Funktion calculatePrice berechnet den Preis." \
  > ~/0_docker/3001_kidb/projekte/sync-test/test-datei.md
```

Log: `📄 Neu: test-datei.md` → `✅ test-datei.md (1 Chunks)`

<div class="step"><div class="step-num">3</div><div class="step-content">  
</div></div>**Geänderte Datei — Delete-before-Update:**

```
echo "Die Funktion wurde erweitert um Mengenrabatte." \
  > ~/0_docker/3001_kidb/projekte/sync-test/test-datei.md
```

Log: `♻️ Aktualisiere: test-datei.md` → `🗑️ Entfernt: ...` → `✅ test-datei.md (1 Chunks)`

<div class="step"><div class="step-content"><div class="card success"><div class="card-label">Erwartetes Ergebnis</div></div></div></div>Alte Version wird gelöscht, neue Version hochgeladen. Weaviate-Objektzahl bleibt gleich (kein Duplikat).

<div class="step"><div class="step-num">4</div><div class="step-content">  
</div></div>**Gelöschte Datei wird aus Weaviate entfernt:**

```
rm ~/0_docker/3001_kidb/projekte/sync-test/test-datei.md
```

Log: `🗑️ Entfernt: ...` → `🗑️ Aus State entfernt: test-datei.md`

<div class="step"><div class="step-num">5</div><div class="step-content">  
</div></div>**Weaviate-Objekte zählen (vor/nach jedem Schritt):**

```
python3 -c "
import requests
total = 0
after = None
while True:
    url = 'http://192.168.0.16:8085/v1/objects?limit=100&class=SyncTest'
    if after: url += f'&after={after}'
    r = requests.get(url).json()
    objs = r.get('objects', [])
    if not objs: break
    total += len(objs)
    after = objs[-1]['id']
print(f'Objekte: {total}')
"
```

Aufräumen nach dem Test:

```
rm -rf ~/0_docker/3001_kidb/projekte/sync-test
```

### 6. Inhaltlicher Test (der wichtigste!)

Workspace auf **Abfrage-Modus** schalten (Chat-Einstellungen → Abfrage statt Chat). Dann drei Fragen:

<div class="step"><div class="step-num">A</div><div class="step-content">  
</div></div>**Einzeldatei-Tiefe:**

```
Was macht die Funktion exportDocx in MeetingDetail.vue?
```

Muss konkreten Code referenzieren (TipTap, docx-Bibliothek, Bild-Auth).

<div class="step"><div class="step-num">B</div><div class="step-content">  
</div></div>**Cross-File-Suche:**

```
Welche Dateien verwenden die docx-Bibliothek?
```

Muss mehrere Dateien identifizieren oder korrekt eingrenzen.

<div class="step"><div class="step-num">C</div><div class="step-content">  
</div></div>**Backend-Endpunkte:**

```
Welche API-Endpunkte gibt es für Besuchsberichte?
```

Muss Endpunkte mit Pfaden und Parametern aus der Doku finden.

</section><section id="bkmrk-09-troubleshooting-l">## <span class="section-num">09</span> Troubleshooting

### Login schlägt fehl (500 Internal Server Error)

**Ursache:** `JWT_SECRET` nicht gesetzt.

**Diagnose:** `docker logs kidb-anythingllm | grep JWT`

**Fix:** JWT\_SECRET in docker-compose.yml setzen, Stack neu starten.

### Chat gibt 404 zurück

**Ursache:** LLM-Provider auf Embedding-Port (8003) statt Chat-Port (8001) gesetzt.

**Fix:** KI-Anbieter → LLM → Base URL auf `http://192.168.0.16:8001/v1` ändern.

### Weaviate ist leer nach Provider-Wechsel

**Ursache:** Embedding-Provider gewechselt → alte Vektoren inkompatibel, automatisch gelöscht.

**Fix:** Dokumente im Workspace neu hochladen und embedden.

### Sync erstellt keine Workspaces

**Ursache:** API-Key fehlt in `.env`.

**Fix:** In AnythingLLM unter Werkzeuge → Entwickler-API Key generieren, in `.env` eintragen, `docker compose restart sync`.

### Passwort vergessen

Reset via Prisma im Container:

```
docker exec -w /app/server kidb-anythingllm node -e '
const{PrismaClient}=require("@prisma/client");
const b=require("bcryptjs");
const p=new PrismaClient();
const hash=b.hashSync("NeuesPasswort!",10);
p.users.update({where:{id:1},data:{password:hash}})
.then(()=>{console.log("Reset OK");p.$disconnect()})
'
```

</section><section id="bkmrk-10-wissensbasis-f%C3%BCr-">## <span class="section-num">10</span> Wissensbasis für Claude

Um Claude via AnythingLLM API denselben Kontext zu geben, den Chat-Claude hat, werden Wissensdokumente in `projekte/programmierung/` abgelegt:

<table><tbody><tr><th>Datei</th><th>Inhalt</th></tr><tr><td>`CLAUDE.md`</td><td>Golden Rules, Deploy-Flow, Prompt-Format</td></tr><tr><td>`infrastruktur.md`</td><td>Dev-PC, Synology, Ports, Backup, Security</td></tr><tr><td>`architektur-crm.md`</td><td>CRM-Stack, Module, KI-Integration, Roadmap</td></tr><tr><td>`architektur-ki-mail.md`</td><td>Mail-Stack, Phasen 1–5, KI-Layer</td></tr><tr><td>`architektur-ki-db.md`</td><td>Wissensdatenbank-Setup, Embedding-Pipeline</td></tr><tr><td>`lessons-learned.md`</td><td>20+ Bugs die Zeit gekostet haben</td></tr></tbody></table>

</section><section id="bkmrk-11-arbeitsworkflow-a">## <span class="section-num">11</span> Arbeitsworkflow

<div class="flow-row"><div class="flow-box">AnythingLLM  
<small>Qwen · kostenlos</small></div><span class="flow-arrow">→</span><div class="flow-box">Chat-Claude  
<small>Architekt · Abo</small></div><span class="flow-arrow">→</span><div class="flow-box">Claude Code  
<small>Sonnet · API</small></div><span class="flow-arrow">→</span><div class="flow-box">Thomas  
<small>Tester</small></div></div><table><tbody><tr><th>Rolle</th><th>Tool</th><th>Modell</th><th>Kosten</th></tr><tr><td>Wissensbasis durchsuchen</td><td>AnythingLLM</td><td>Qwen (lokal)</td><td>kostenlos</td></tr><tr><td>Architektur-Hint</td><td>AnythingLLM</td><td>Qwen (lokal)</td><td>kostenlos</td></tr><tr><td>Prompt verfeinern</td><td>Chat-Claude (claude.ai)</td><td>Opus / Sonnet</td><td>Abo</td></tr><tr><td>Code implementieren</td><td>Claude Code (code-server)</td><td>Sonnet via API</td><td>API-Kosten</td></tr><tr><td>Testen &amp; Freigeben</td><td>Browser / Terminal</td><td>—</td><td>—</td></tr></tbody></table>

<div class="card success"><div class="card-label">Kernprinzip</div></div>AnythingLLM findet den Code und gibt Kontext. Claude Code liest Dateien direkt und vollständig vom Dateisystem. AnythingLLM muss den Code nicht vollständig sehen — es muss wissen **wo** der relevante Code ist und **was** zu tun ist.

</section><section id="bkmrk-12-port--und-service">## <span class="section-num">12</span> Port- und Service-Referenz

### KI-DB Stack

<table><tbody><tr><th>Service</th><th>Container</th><th>Port</th><th>URL</th></tr><tr><td>AnythingLLM</td><td>kidb-anythingllm</td><td>3001</td><td>http://192.168.0.16:3001</td></tr><tr><td>Weaviate</td><td>kidb-weaviate</td><td>8085</td><td>http://192.168.0.16:8085</td></tr><tr><td>PostgreSQL</td><td>kidb-postgres</td><td>5433</td><td>192.168.0.16:5433</td></tr><tr><td>Redis</td><td>kidb-redis</td><td>6379</td><td>192.168.0.16:6379</td></tr><tr><td>code-server</td><td>kidb-codeserver</td><td>7001</td><td>http://192.168.0.16:7001</td></tr><tr><td>Auto-Sync</td><td>kidb-sync</td><td>—</td><td>intern</td></tr></tbody></table>

### Externe KI-Services (Dev-PC)

<table><tbody><tr><th>Service</th><th>Port</th><th>Modell</th><th>Zweck</th></tr><tr><td>vLLM</td><td>8001</td><td>qwen3.6-27b</td><td>Chat / Analyse</td></tr><tr><td>bge-m3</td><td>8003</td><td>bge-m3</td><td>Embeddings (1024 Dim.)</td></tr><tr><td>Speaches</td><td>8010</td><td>Whisper Large</td><td>Speech-to-Text</td></tr></tbody></table>

</section><div class="container" id="bkmrk-01%C2%A0architektur-%C3%9Cbers"></div>