Skip to content

Operations & Data Layout ​

Graceful shutdown ​

SIGTERM / SIGINT trigger a drain, not an immediate exit:

  1. Stop accepting new connections (up to 1 s);
  2. Wait for in-progress agent runs to finish — they're writing reports; cutting them leaves half-finished state;
  3. Wait for request handlers to finish writing responses (clients get results, not a reset connection);
  4. Only abort what's still unfinished, and log it;
  5. Close databases, delete host.json.

The total budget is controlled by IFG_SHUTDOWN_GRACE_MS (default 8000). With systemd / launchd, set TimeoutStopSec a bit larger.

Data layout ​

text
~/.interviewforge/
├── system.db            # global: profiles / providers / capability_routes / mcp_servers / models / job_runs / audit …
├── shared.db            # shared KB: collections / documents / chunks / versions / ACL / audit
├── keys/
│   ├── master.key       # 0600, AES-256-GCM master key (encrypts provider keys)
│   └── report-signing.key # 0600, HMAC report signing
├── profiles/<id>/
│   ├── app.db           # business: sessions / events / runs / checkpoints / kb_* / resumes / memory_* …
│   └── lineage.db       # provenance: calls / claims / nodes / edges / payloads
├── models/<modelId>/    # model files (resumable downloads)
├── exports/             # background-exported CSV
├── inbox/               # per-profile inbox (configurable elsewhere)
├── shared-inbox/        # shared inbox
└── host.json            # port/token handshake, 0600
  • Isolation: per-profile directory & DBs; the API binds by profile token, and neither tools nor CLI can read across profiles.
  • Encryption: provider keys are v1.<iv>.<tag>.<ciphertext> (AES-256-GCM); the API returns only hasKey.
  • Integrity: report versions store SHA-256 and HMAC; ifg verify or GET /versions/:v/verify checks them.
  • Retention: default payload/debug 90 days, recordings 30 days, exports 30 days, snapshots permanent; a daily job cleans up.

View usage: GET /system/storage (UI: Settings → Data & Backup, or the dashboard "disk usage").

Connecting a real provider ​

  1. #/providers → provider card → update → paste key → save (encrypted at rest);
  2. Click "test": ok · xxx ms · sample means the key and network work;
  3. In "capability routes", point chat.fast / chat.strong at that provider;
  4. Back to #/dashboard, create a session to verify: the report should show real scores, #/lineage real calls.

When a key is set but the route still points at mock, the UI says so explicitly; click "switch to real provider" to change all three tiers at once. Adding a key without changing the route still yields mock-quality questions.

Provider permissions: private (admin key) is invisible and unusable to members; shared is available to all profiles. 429/5xx go through fetchWithRetry with exponential backoff respecting Retry-After (IFG_PROVIDER_RETRIES default 3).

Budget (two layers, both active) ​

LayerFieldBehavior
Per sessionsessionBudgetUsdKernel policy.assertBudget hard-stops by session costUsd
Profilebudget.usd (defaults to system costBudgetUsd)Once cumulative spend ≥ limit, start/answer/hint/rescore/coach/end all return 402 budget_exceeded

GET /usage returns budget{limit,spent,remaining,usedPct,exceeded,source}; a new interview hitting 402 jumps straight to settings. There's also IFG_MAX_CONCURRENT_SESSIONS limiting cross-session concurrency.

Security & identity ​

  • PIN brute-force protection: 5 consecutive failures lock a profile, with exponentially growing lockout (15 s → 5 min cap); during lockout even a correct PIN returns 429 pin_locked; a correct unlock resets the count, failures are audited.
  • Request ID: every response carries x-request-id (clients may pass their own via the same header); error bodies include requestId too — grep the logs to locate the whole request.
  • Per-request logging: off by default; IFG_LOG_REQUESTS=1 prints one line per request [req] <id> <method> <path> <status> <ms>; 4xx one line, 5xx with stack.

Backup / restore ​

ifg export packages the current profile; ifg import verifies then atomically replaces the whole directory. The package intentionally excludes keys/master.key, provider keys, and shared.db / system.db — to avoid "backup equals credential leak". After moving machines the Host auto-generates a new token-signing key and old device tokens expire (data unaffected; unlock with the PIN). See CLI Reference.

Performance baseline ​

pnpm perf (scripts/perf-report.mjs) opens a clean browser context per route, reads navigation and first-contentful-paint, and counts actual transferred bytes. Watch the trend, not a single absolute value (the same route can vary 200 ms between runs).

Server gzip compresses API JSON ~9.5× (/lineage/graph 2.1 MB → 224 KB per call); the graph endpoint returns at most 800 nodes by default (?limit= adjustable, cap 5000), with total and truncated so the page can label rather than silently truncate.

Troubleshooting ​

SymptomCauseFix
Questions all alikeNo key, or route still mockSet key + switch route
First question takes longPlanner call ~30 sSpecifying topics skips the planner; otherwise bounded by IFG_PLAN_DEADLINE_MS (default 12 s), falling back to a deterministic plan on timeout
Resume skills/projects empty after importPDF has no Markdown headingsModel structuring at import (merged, not overwritten); on failure check log [resume] structuring failed
Retrieval always hits the same fewDefault hash vectors + lexical fallbackInstall a vector model and reindex; read the retrieval pipeline measurements first
Report conclusions have no citationsModel gave no sources, or citation verification offEnable "entailment verification" at setup, or click "verify citations" on the report page
Some charts/tables emptyAPI shows empty state when there's no dataProduce real sessions/documents first (no demo data filled in)
Tests finish but process won't exitBackground question/session generation still runningConfirm Runtime.close() was called (engine.dispose() + timers unref()); if needed, ps to check background run status
Normal file size but empty readsDisk bad block (inode size remains)pnpm fs:health; restore per prompt git cat-file -p HEAD:<path> > <path>

Local-first · inference egresses on demand · fully traceable