{
  "entry_points": [
    "app/main.py: FastAPI application startup and route registration (proxy + dashboard)",
    "app/proxy.py: /v1/chat/completions endpoint handling incoming LLM requests",
    "Dashboard routes: Web UI endpoints registered in main.py for viewing reports and previews"
  ],
  "data_flow": [
    "1. Client sends request to /v1/chat/completions (handled by proxy.py)",
    "2. proxy.py extracts metadata and passes it to store.py for SQLite insertion",
    "3. proxy.py forwards the request to the upstream llama.cpp server",
    "4. Upstream processes and returns the LLM response",
    "5. proxy.py passes response through redaction.py to sanitize secrets before preview/storage",
    "6. Sanitized/full data is persisted to SQLite via store.py",
    "7. reports.py queries SQLite to aggregate metrics for the dashboard",
    "8. Dashboard UI serves aggregated stats and redacted previews to the user"
  ],
  "risks": [
    "SQLite Concurrency & Performance: store.py uses SQLite which may bottleneck under high request throughput due to locking; requires WAL mode and connection pooling",
    "Secret Redaction Reliability: redaction.py likely relies on pattern matching; risk of false negatives (data leakage) or false positives (prompt corruption)",
    "Upstream Dependency & Timeouts: proxy.py forwards to llama.cpp without mentioned circuit breaking or timeout handling, risking request hangs and resource exhaustion",
    "Data Privacy & Retention: Storing raw LLM prompts/responses in SQLite may violate privacy policies; lacks explicit retention or encryption controls",
    "Dashboard Data Exposure: reports.py aggregates data without mentioned access controls; risk of exposing sensitive metadata or prompts to unauthorized users",
    "SQL Injection/Unsafe Queries: If store.py uses raw string interpolation instead of parameterized queries or an ORM, it introduces injection vulnerabilities"
  ]
}