# Debugging Guide

Debugging is an essential part of development. Kaizen AI provides tools and logs to help pinpoint and resolve issues quickly.

#### Log Analysis

* Use `logs/` directory or Docker stdout for system-wide logs
* Filter logs by service name or timestamp
* Enable debug mode via environment variable `DEBUG=true`

#### Error Codes

* `4xx`: Authentication, rate limits, invalid queries
* `5xx`: Internal errors or upstream failures
* Error responses include `code`, `message`, and `traceId` for debugging

#### Diagnostic Tools

* API Explorer: Test endpoints with live feedback
* DB Inspector: Validate schema integrity and data mapping
* Score Simulator: Replay past token events and score transitions

#### Performance Monitoring

* Integrated Prometheus/Grafana for real-time metrics
* Watch memory, CPU, and response times per endpoint

#### System Health Checks

* Internal `/status` endpoints for each service
* Cron-based heartbeat pings and uptime logs
