{
  "entry_points": [
    "app/main.py: FastAPI application startup and route registration",
    "/v1/chat/completions: OpenAI-compatible chat endpoint (dispatched to proxy.py)",
    "Dashboard/Report routes: HTTP endpoints registered in main.py, backed by reports.py"
  ],
  "data_flow": [
    "Client -> main.py -> proxy.py (receives chat request)",
    "proxy.py -> store.py (writes run/request metadata to SQLite)",
    "proxy.py -> upstream llama.cpp (forwards request, awaits response)",
    "proxy.py -> Client (returns upstream response)",
    "Dashboard/Report queries -> reports.py -> store.py (reads aggregated stats from SQLite)",
    "Data destined for previews/reports -> redaction.py (sanitizes secrets before rendering)"
  ],
  "risks": [
    "SQLite contention & durability: Concurrent writes from proxy.py and reads from reports.py on a single SQLite file risk locking, I/O bottlenecks, or corruption under load.",
    "Premature state persistence: Metadata is recorded before upstream validation; failed, cancelled, or timed-out requests will still generate database records.",
    "Redaction bypasses: Pattern-based secret removal in redaction.py is inherently fragile, prone to false negatives, false positives, and performance degradation on large payloads.",
    "Unvalidated proxy forwarding: proxy.py forwards directly to llama.cpp without apparent input sanitization, rate limiting, or authentication, risking resource exhaustion or prompt injection.",
    "Tight coupling & single DB: store.py and reports.py share the same SQLite backend, creating read/write blocking and limiting horizontal scalability."
  ]
}