Skip to content

Latest commit

ย 

History

History
830 lines (630 loc) ยท 19.5 KB

File metadata and controls

830 lines (630 loc) ยท 19.5 KB

๐Ÿ—๏ธ Architecture - Code Cloud Agents

Detaillierte Systemarchitektur und Design-Dokumentation.


๐Ÿ“‹ Inhaltsverzeichnis


๐ŸŽฏ System Overview

Vision

Code Cloud Agents ist ein Supervised AI System, das AI-Agenten รผberwacht und bei kritischen Entscheidungen automatisch eingreift. Das System basiert auf dem STOP-Score Konzept: Jede Agent-Aktion wird bewertet (0-100), und ab einem kritischen Score (โ‰ฅ70) wird die Ausfรผhrung blockiert und eine Human Review angefordert.

Kernprinzipien

  1. Evidence-Based Verification: Keine Behauptung ohne Beweis
  2. STOP is Success: Bei Risiko ist STOP die richtige Entscheidung
  3. Cross-Layer Consistency: Frontend โ†” Backend โ†” Database Alignment
  4. Hard Enforcement: STOP-Entscheidungen sind BLOCKING, keine Umgehung mรถglich

๐Ÿงฉ Komponenten

High-Level Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                     WEB BROWSER                          โ”‚
โ”‚                   (React Dashboard)                      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                   โ”‚ HTTP/REST
                   โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                   EXPRESS SERVER                         โ”‚
โ”‚              (Node.js + TypeScript)                      โ”‚
โ”‚                                                           โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”         โ”‚
โ”‚  โ”‚  API       โ”‚  โ”‚  Auth      โ”‚  โ”‚  Middlewareโ”‚         โ”‚
โ”‚  โ”‚  Routes    โ”‚  โ”‚  Layer     โ”‚  โ”‚  Layer     โ”‚         โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜         โ”‚
โ”‚                                                           โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”         โ”‚
โ”‚  โ”‚  Task      โ”‚  โ”‚  Audit     โ”‚  โ”‚  Demo      โ”‚         โ”‚
โ”‚  โ”‚  Manager   โ”‚  โ”‚  Logger    โ”‚  โ”‚  System    โ”‚         โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜         โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                   โ”‚
       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
       โ”‚           โ”‚           โ”‚
       โ–ผ           โ–ผ           โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  SQLite    โ”‚ โ”‚  Queue     โ”‚ โ”‚ Enforcementโ”‚
โ”‚  Database  โ”‚ โ”‚  System    โ”‚ โ”‚  Gate      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Komponenten-Details

1. Frontend Layer

Technologie: React 18 + TypeScript + Vite

Verantwortlichkeiten:

  • User Interface fรผr Agent-Monitoring
  • Task-Management Dashboard
  • Audit-Log Visualisierung
  • Real-time Updates (via polling/WebSocket)
  • Admin Controls (Demo System, Enforcement Approvals)

Komponenten:

  • App.tsx: Main Application Component
  • AgentCard.tsx: Agent Status Display
  • TaskCard.tsx: Task Details Display
  • AuditLog.tsx: Audit Trail Viewer
  • EnforcementApproval.tsx: Human Review Interface

2. Backend Layer

Technologie: Node.js v20+ + Express + TypeScript

Verantwortlichkeiten:

  • REST API Endpoints
  • Business Logic Execution
  • Database Operations
  • Queue Management
  • Authentication & Authorization
  • STOP-Score Calculation
  • Enforcement Gate Logic

Module:

  • src/index.ts: Server Entry Point
  • src/api/*: REST API Routes
  • src/db/database.ts: Database Interface
  • src/audit/*: Audit & Enforcement Logic
  • src/queue/queue.ts: Queue System
  • src/demo/*: Demo Invite System

3. Database Layer

Technologie: SQLite (better-sqlite3)

Verantwortlichkeiten:

  • Persistent Data Storage
  • ACID Transactions
  • Indexing & Query Optimization
  • Audit Trail Storage

Schema:

  • tasks: Task management
  • audit_entries: Audit log
  • demo_invites: Invite codes
  • demo_users: Demo users

4. Queue System

Technologie: Redis (production) / In-Memory (development)

Verantwortlichkeiten:

  • Task Queue Management
  • Background Job Processing
  • Retry Logic
  • Dead Letter Queue

5. Enforcement Gate

Technologie: Custom TypeScript Module

Verantwortlichkeiten:

  • STOP-Score Calculation
  • Risk Assessment
  • Task Blocking
  • Human Approval Workflow

๐Ÿ—„๏ธ Datenmodell

Entity Relationship Diagram

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚      TASKS          โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ id (PK)             โ”‚
โ”‚ title               โ”‚
โ”‚ description         โ”‚
โ”‚ priority            โ”‚
โ”‚ status              โ”‚
โ”‚ assignee            โ”‚
โ”‚ created_at          โ”‚
โ”‚ updated_at          โ”‚
โ”‚ stop_score          โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
           โ”‚
           โ”‚ 1:N
           โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   AUDIT_ENTRIES     โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ id (PK)             โ”‚
โ”‚ task_id (FK)        โ”‚
โ”‚ decision            โ”‚
โ”‚ final_status        โ”‚
โ”‚ risk_level          โ”‚
โ”‚ stop_score          โ”‚
โ”‚ verified_artefacts  โ”‚
โ”‚ missing_invalid     โ”‚
โ”‚ required_action     โ”‚
โ”‚ created_at          โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   DEMO_INVITES      โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ id (PK)             โ”‚
โ”‚ code (UNIQUE)       โ”‚
โ”‚ created_by          โ”‚
โ”‚ max_redemptions     โ”‚
โ”‚ expires_at          โ”‚
โ”‚ created_at          โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
           โ”‚
           โ”‚ 1:N
           โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚    DEMO_USERS       โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ id (PK)             โ”‚
โ”‚ invite_id (FK)      โ”‚
โ”‚ username            โ”‚
โ”‚ password_hash       โ”‚
โ”‚ task_limit          โ”‚
โ”‚ tasks_created       โ”‚
โ”‚ created_at          โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Datentypen

Task

interface Task {
  id: string; // UUID
  title: string; // Max 200 chars
  description?: string; // Optional
  priority: "low" | "medium" | "high";
  status: "pending" | "in_progress" | "completed" | "stopped";
  assignee: string; // Agent name
  created_at: string; // ISO 8601
  updated_at?: string; // ISO 8601
  stop_score?: number; // 0-100
}

Audit Entry

interface AuditEntry {
  id: string; // UUID
  task_id?: string; // FK to tasks
  decision: "APPROVED" | "STOP_REQUIRED";
  final_status: "COMPLETE" | "COMPLETE_WITH_GAPS" | "STOP_REQUIRED";
  risk_level: "LOW" | "MEDIUM" | "HIGH" | "CRITICAL";
  stop_score: number; // 0-100
  verified_artefacts: string; // JSON array
  missing_invalid_parts: string; // JSON array
  required_next_action: string;
  created_at: string; // ISO 8601
}

๐Ÿ”Œ API Architecture

REST API Design

Base URL: http://localhost:3000

Principles:

  • RESTful Design
  • JSON Request/Response
  • HTTP Status Codes
  • Error Handling
  • Input Validation (Zod)

API Endpoints

Health & Info

GET  /api              โ†’ API Info
GET  /health           โ†’ Health Check

Tasks

POST /api/tasks        โ†’ Create Task
GET  /api/tasks        โ†’ List All Tasks
GET  /api/tasks/:id    โ†’ Get Task by ID
PUT  /api/tasks/:id    โ†’ Update Task

Audit

GET  /api/audit        โ†’ List Audit Entries
GET  /api/audit/:id    โ†’ Get Audit Entry

Enforcement

GET  /api/enforcement/blocked   โ†’ List Blocked Tasks
POST /api/enforcement/approve   โ†’ Approve Blocked Task
POST /api/enforcement/reject    โ†’ Reject Blocked Task

Demo System

POST /api/demo/invites          โ†’ Create Invite (Admin)
POST /api/demo/redeem           โ†’ Redeem Invite Code
GET  /api/demo/stats            โ†’ Demo Statistics
GET  /api/demo/users/:id        โ†’ User Usage Stats

Request/Response Format

Success Response:

{
  "success": true,
  "data": {
    "id": "abc123",
    "title": "Task Title"
  }
}

Error Response:

{
  "success": false,
  "error": "Invalid input data",
  "details": {
    "field": "title",
    "message": "Title is required"
  }
}

HTTP Status Codes

Code Meaning Usage
200 OK Successful GET/PUT
201 Created Successful POST
400 Bad Request Invalid input
401 Unauthorized Authentication required
403 Forbidden No permission
404 Not Found Resource not found
500 Internal Error Server error

๐ŸŽจ Frontend Architecture

Component Hierarchy

App.tsx
โ”œโ”€โ”€ Header
โ”‚   โ”œโ”€โ”€ Logo
โ”‚   โ””โ”€โ”€ Navigation
โ”œโ”€โ”€ Dashboard
โ”‚   โ”œโ”€โ”€ AgentStatus
โ”‚   โ”‚   โ”œโ”€โ”€ AgentCard[]
โ”‚   โ”‚   โ””โ”€โ”€ AgentStats
โ”‚   โ”œโ”€โ”€ TaskManager
โ”‚   โ”‚   โ”œโ”€โ”€ TaskList
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ TaskCard[]
โ”‚   โ”‚   โ””โ”€โ”€ CreateTaskForm
โ”‚   โ”œโ”€โ”€ AuditLog
โ”‚   โ”‚   โ”œโ”€โ”€ AuditTable
โ”‚   โ”‚   โ””โ”€โ”€ AuditFilters
โ”‚   โ””โ”€โ”€ EnforcementPanel
โ”‚       โ”œโ”€โ”€ BlockedTasks
โ”‚       โ””โ”€โ”€ ApprovalForm
โ””โ”€โ”€ Footer

State Management

Strategy: React Context + Hooks

Global State:

  • AgentContext: Agent status, capabilities
  • TaskContext: Task list, active task
  • AuditContext: Audit entries
  • EnforcementContext: Blocked tasks, approvals

Component State:

  • Local UI state (modals, forms, etc.)
  • Form inputs
  • Loading states

Data Fetching

Strategy: Custom Hooks + Fetch API

// Custom Hook Example
function useTasks() {
  const [tasks, setTasks] = useState<Task[]>([]);
  const [loading, setLoading] = useState(false);

  useEffect(() => {
    fetchTasks();
  }, []);

  async function fetchTasks() {
    setLoading(true);
    const res = await fetch("/api/tasks");
    const data = await res.json();
    setTasks(data.data);
    setLoading(false);
  }

  return { tasks, loading, refetch: fetchTasks };
}

๐ŸŽฏ STOP-Score System

Konzept

Der STOP-Score ist eine Risikobewertung (0-100), die bestimmt, ob eine Agent-Aktion fortgesetzt werden darf oder blockiert werden muss.

Score-Berechnung

const WEIGHTS = {
  PRICE_CLAIM: 25, // Preisbehauptung
  LEGAL_CLAIM: 30, // Rechtsbehauptung
  UNPROVEN_CLAIM: 20, // Unbewiesene Behauptung
  MISSING_EVIDENCE: 15, // Fehlende Evidenz
  IMPLEMENTATION_GAP: 10, // Implementierungslรผcke
  NO_VERIFICATION: 25, // Keine Verifikation
};

function computeStopScore(reasons: StopReason[]): ScoreResult {
  let score = 0;
  const uniqueReasons = [...new Set(reasons)];

  for (const reason of uniqueReasons) {
    score += WEIGHTS[reason] ?? 0;
  }

  return {
    score: Math.min(score, 100),
    stopRequired: score >= 70,
    reasons: uniqueReasons,
  };
}

Risk Levels

Score Level Action
0-19 LOW โœ… Proceed
20-44 MEDIUM โš ๏ธ Review Recommended
45-69 HIGH โš ๏ธ Approval Recommended
70-100 CRITICAL ๐Ÿ›‘ HARD STOP

STOP Reasons

Reason Score Description
PRICE_CLAIM 25 Unverified price statement
LEGAL_CLAIM 30 Unverified legal statement
UNPROVEN_CLAIM 20 Claim without evidence
MISSING_EVIDENCE 15 Expected artefacts missing
IMPLEMENTATION_GAP 10 Code incomplete
NO_VERIFICATION 25 No verification performed

๐Ÿ›ก๏ธ Enforcement Gate

HARD STOP Enforcement

Regel: Wenn STOP_SCORE โ‰ฅ 70, wird die Task SOFORT BLOCKIERT.

Ablauf:

  1. Agent sendet Task-Result
  2. System berechnet STOP-Score
  3. Wenn Score โ‰ฅ 70:
    • Task wird in blockedTasks Map gespeichert
    • Audit-Entry wird erstellt
    • Status โ†’ AWAITING_APPROVAL
    • Task kann NICHT fortgesetzt werden
  4. Human Review:
    • Admin รถffnet Enforcement Panel
    • Prรผft Grรผnde und Evidenz
    • Entscheidung: APPROVE oder REJECT
  5. Nach Approval:
    • Task wird entsperrt
    • Audit-Entry wird aktualisiert
    • Task kann fortgesetzt werden

Gate States

type GateStatus = "OPEN" | "BLOCKED" | "AWAITING_APPROVAL";

interface GateDecision {
  status: GateStatus;
  taskId: string;
  stopScore: number;
  reasons: StopReason[];
  blockedAt?: string;
  approvedBy?: string;
  approvedAt?: string;
}

Human Approval

Endpoint: POST /api/enforcement/approve

Request:

{
  "taskId": "abc123",
  "approvedBy": "admin@example.com",
  "reason": "Evidence verified manually"
}

Response:

{
  "success": true,
  "message": "Task approved, gate opened",
  "taskId": "abc123"
}

๐Ÿ”„ Data Flow

Task Creation Flow

1. User (Frontend)
   โ”‚
   โ””โ”€โ”€> POST /api/tasks
        โ”‚
        โ””โ”€โ”€> Express Handler
             โ”‚
             โ”œโ”€โ”€> Validate Input (Zod)
             โ”œโ”€โ”€> Create Task in DB
             โ”œโ”€โ”€> Add to Queue
             โ””โ”€โ”€> Return Task

2. Queue Worker
   โ”‚
   โ””โ”€โ”€> Process Task
        โ”‚
        โ”œโ”€โ”€> Execute Agent Logic
        โ”œโ”€โ”€> Collect Evidence
        โ””โ”€โ”€> Generate Result

3. Enforcement Gate
   โ”‚
   โ””โ”€โ”€> Evaluate Result
        โ”‚
        โ”œโ”€โ”€> Calculate STOP-Score
        โ”œโ”€โ”€> Check Reasons
        โ””โ”€โ”€> Decision:
             โ”‚
             โ”œโ”€โ”€> Score < 70: APPROVE
             โ”‚    โ””โ”€โ”€> Update Task Status
             โ”‚
             โ””โ”€โ”€> Score โ‰ฅ 70: BLOCK
                  โ”œโ”€โ”€> Add to blockedTasks
                  โ”œโ”€โ”€> Create Audit Entry
                  โ””โ”€โ”€> Await Human Review

Human Approval Flow

1. Admin (Frontend)
   โ”‚
   โ””โ”€โ”€> GET /api/enforcement/blocked
        โ”‚
        โ””โ”€โ”€> List of Blocked Tasks

2. Admin Reviews Task
   โ”‚
   โ”œโ”€โ”€> Verify Evidence
   โ”œโ”€โ”€> Assess Risk
   โ””โ”€โ”€> Decision

3. Admin Approves/Rejects
   โ”‚
   โ””โ”€โ”€> POST /api/enforcement/approve
        โ”‚
        โ””โ”€โ”€> Enforcement Gate
             โ”‚
             โ”œโ”€โ”€> Remove from blockedTasks
             โ”œโ”€โ”€> Update Audit Entry
             โ”œโ”€โ”€> Update Task Status
             โ””โ”€โ”€> Resume Task Processing

๐Ÿ” Security

Input Validation

Zod Schemas:

const TaskSchema = z.object({
  title: z.string().min(1).max(200),
  priority: z.enum(["low", "medium", "high"]),
  assignee: z.string().min(1),
});

Authentication

Status: ๐Ÿšง Coming Soon (Agent 2 Task)

Planned:

  • JWT-based authentication
  • Role-based access control (RBAC)
  • Admin vs User permissions
  • Session management

Rate Limiting

Status: ๐Ÿšง Coming Soon (Agent 2 Task)

Planned:

  • Express Rate Limiter
  • IP-based limiting
  • Endpoint-specific limits
  • DDoS protection

Audit Trail

All Actions Logged:

  • Task creation
  • Task updates
  • STOP decisions
  • Human approvals
  • API calls

Audit Log Retention: Unlimited (SQLite persistent)


๐Ÿš€ Deployment

Production Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚          NGINX (Reverse Proxy)       โ”‚
โ”‚       Port 80/443 (SSL/TLS)          โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
               โ”‚
               โ”œโ”€โ”€> Frontend (Static)
               โ”‚    /build/*
               โ”‚
               โ””โ”€โ”€> Backend (API)
                    /api/*, /health

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚          PM2 (Process Manager)       โ”‚
โ”‚     cloud-agents-backend             โ”‚
โ”‚     Node.js v20 + tsx/esm            โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
               โ”‚
               โ”œโ”€โ”€> SQLite Database
               โ”‚    /root/cloud-agents/data/
               โ”‚
               โ””โ”€โ”€> Logs
                    /root/cloud-agents/logs/

Infrastructure

Server:

  • IP: 178.156.178.70
  • OS: Ubuntu 24.04
  • CPU: 8 cores (Dedicated)
  • RAM: 30 GB
  • Disk: 226 GB

Stack:

  • Process Manager: PM2
  • Reverse Proxy: Nginx
  • Database: SQLite
  • Node.js: v20.19.6

Deployment Process

  1. Build Locally
  2. Push to Git
  3. SSH to Server
  4. Pull Changes
  5. Install Dependencies
  6. Build
  7. Restart PM2
  8. Health Check
  9. Backup Database

Details: Deployment Guide


๐Ÿ“Š Performance

Metrics

Target Metrics:

  • API Response Time: < 100ms (p95)
  • Database Query Time: < 10ms (p95)
  • Frontend Load Time: < 2s
  • Task Processing Time: < 5s

Monitoring:

  • PM2 Monit
  • Nginx Access Logs
  • SQLite Query Logs
  • Custom Performance Tracking

๐Ÿ”ฎ Future Architecture

Planned Enhancements:

  1. WebSocket Real-time (Agent 3)

    • Real-time task updates
    • Real-time chat
    • Connection recovery
  2. Integration APIs (Agent 3)

    • GitHub, Slack, Linear
    • Webhook handlers
    • Event processing
  3. Memory System (Agent 3)

    • Conversation history
    • Context tracking
    • Long-term memory
  4. Multi-Provider (Agent 3)

    • Provider fallback
    • Load balancing
    • Cost optimization

๐Ÿ“š Weitere Ressourcen


Erstellt: 2025-12-26 Version: 1.0

๐Ÿค– Generated with Claude Code Co-Authored-By: Claude Sonnet 4.5 noreply@anthropic.com