This guide covers logging, diagnostics, state files, and workflows for debugging the Democritus daemon.
Democritus uses the tracing crate for structured logging. Control log output with the RUST_LOG environment variable.
# Default (info level)
./target/release/daemon daemon --config config.toml
# Debug — shows routing decisions, peer connections, decomposition details
RUST_LOG=debug ./target/release/daemon daemon --config config.toml
# Trace — extremely verbose, shows every packet and internal state change
RUST_LOG=trace ./target/release/daemon daemon --config config.toml
# Module-specific logging
RUST_LOG=daemon::p2p=debug,daemon::coordinator=trace ./target/release/daemon daemon --config config.tomlWindows (PowerShell):
$env:RUST_LOG = "debug"
.\target\release\daemon.exe daemon --config config.toml| Filter | What it shows |
|---|---|
daemon::p2p=debug |
Peer connections, DHT queries, Gossipsub events |
daemon::coordinator=debug |
Task routing, expert selection, MoA aggregation |
daemon::decomposition=debug |
Intent classification, complexity scoring, task DAG |
daemon::inference=debug |
Model loading, token generation, context management |
daemon::reputation=debug |
Trust score changes, PoI audit results |
daemon::embedding=debug |
Vector generation, LSH quantization, cosine similarity |
daemon::api=debug |
REST request/response handling |
daemon::grpc=debug |
gRPC service calls |
daemon::ws=debug |
WebSocket connections and messages |
daemon::ledger=debug |
Credit transactions, balance changes |
daemon::sanitizer=debug |
Input/output sanitization decisions |
libp2p=debug |
Low-level libp2p networking events |
When running as a service or sidecar, logs go to:
daemon_stdout.log— Standard output (info/debug/trace messages)daemon_stderr.log— Standard error (warnings and errors)
curl http://127.0.0.1:8080/v1/health | python -m json.toolResponse fields:
| Field | Meaning |
|---|---|
overall_healthy |
true if all subsystems are operational |
p2p_status.routing_table_size |
Number of peers in the Kademlia routing table |
p2p_status.warm_connections_count |
Number of active QUIC connections |
p2p_status.private_swarm_enabled |
Whether PSK is configured |
ledger_status.ledger_entries_count |
Number of tracked peer accounts |
ledger_status.credit_ledger_healthy |
Whether the credit system is operational |
hardware_status.gpu_detected |
Whether a GPU was found |
hardware_status.vram_total_bytes |
Total GPU VRAM (0 if no GPU) |
hardware_status.system_memory_total_bytes |
Total system RAM |
./target/release/daemon daemon --config config.toml --healthRuns a deep diagnostic probe and outputs a detailed report covering P2P, ledger, hardware, and model status.
The state_dir (default: ./state) contains persistent state files:
Stores the per-peer reputation table:
{
"12D3KooW...": {
"peer_id": "12D3KooW...",
"successful_inferences": 42,
"failed_inferences": 2,
"poi_pass": 10,
"poi_fail": 0,
"last_seen": "2026-06-01T12:00:00Z",
"avg_tokens_per_sec": 15.3,
"avg_latency_ms": 250.0,
"is_blacklisted": false
}
}Key fields to check:
- High
failed_inferences→ peer may be unreliable is_blacklisted: true→ peer's reputation dropped below 0.3- Low
avg_tokens_per_sec→ peer has slow hardware
Stores the credit ledger:
{
"12D3KooW...": {
"credit_balance": 98.5,
"total_earned_credits": 45.0,
"total_spent_credits": 46.5,
"total_served_tokens": 450,
"total_queried_tokens": 465
}
}Key fields to check:
- Negative
credit_balancenear-50→ peer may be blocked from querying total_earned_credits == 0→ peer is only consuming, not contributing
Run the built-in benchmark suite to baseline performance:
./target/release/daemon benchmark --iterations 100Measures:
- Embedding generation — ONNX model inference latency
- SHA-256 hashing — Used for DHT keys and model verification
- JSON serialization — Message encoding/decoding speed
- LSH bitmask matching — Hamming distance calculation
- Ed25519 signing — Token packet signature generation
Reports P50, P95, P99 latencies for each operation.
- Check peer count:
curl http://127.0.0.1:8080/v1/peers | python -m json.tool - If
0peers, check bootstrap nodes in config - Enable P2P debug logging:
RUST_LOG=daemon::p2p=debug - Look for
Kademlia: GetProvidersevents — if no providers found, increasemax_hamming_radius - Check that your expert
descriptionis specific enough for LSH routing
- Check which expert(s) handled the query (visible in streaming responses via
expert_peer_id) - Verify the expert's
descriptionmatches the query domain - Check the aggregation strategy used —
RUST_LOG=daemon::coordinator=debug - Try querying with
temperature: 0.0for deterministic output - Run the query directly against your local model (bypass swarm routing) to compare
- Check
state/reputation.jsonfor the peer'spoi_failcount - If PoI audits are failing, the peer may be:
- Running a different model than advertised
- Using non-deterministic settings (temperature > 0) during audits
- Experiencing hardware errors producing inconsistent outputs
- Enable reputation logging:
RUST_LOG=daemon::reputation=debug
- Run benchmarks:
./target/release/daemon benchmark --iterations 50 - Check if the model is loaded: look for "Model loaded" in logs
- Verify backend setting:
cpuuses all available cores;cudaoffloads to GPU - Check
max_context— larger contexts use more memory and are slower - Monitor system resources during inference (CPU, RAM, VRAM usage)
The Tauri GUI has its own debug tools:
- DevTools: Right-click in the app window → "Inspect Element" to open browser DevTools
- Console: Check the browser console for Svelte errors and IPC failures
- Backend logs: The sidecar daemon logs are available in the GUI's Dashboard
- gRPC connection: The GUI connects to the daemon via gRPC on port 50051 — check that port is available
Related:
- Troubleshooting — Common issues and fixes
- Configuration — Full config reference
- Architecture — System internals