- No LLM credential is required for local startup
OPENAI_API_KEY: enables live Responses API mode automatically when presentOPENAI_MODEL: defaults togpt-5OPENAI_BASE_URL: optional OpenAI-compatible endpoint override; leave empty for native OpenAI Responses APIFIELDNOTES_USE_FAKE_LLM:1requests deterministic internal LLM stub when no API key is presentFIELDNOTES_RETRIEVAL_PROVIDER:bm25 | hybrid | vectorFIELDNOTES_EMBEDDINGS_PROVIDER:deterministicFIELDNOTES_EMBEDDING_MODEL: defaults tohash-v1FIELDNOTES_BM25_WEIGHTFIELDNOTES_VECTOR_WEIGHTFIELDNOTES_MAX_RETRIEVAL_CANDIDATESFIELDNOTES_MAX_CONTEXT_CHUNKSFIELDNOTES_MAX_CONTEXT_TOKENSFIELDNOTES_ENABLE_TRACINGFIELDNOTES_ENABLE_METRICSFIELDNOTES_VERBOSE_TRACINGVITE_API_BASE_URL: optional frontend override; leave empty for default local Vite proxy workflow
Startup validates:
- Responses API configuration
- Workspace registry write permission
- SQLite write access
- Sandbox availability
- Retrieval and embedding provider names
- Optional live Responses API probe in Phase 0 when
OPENAI_API_KEYis present
The backend loads project-root .env before validation. Existing shell variables take precedence over .env values.
Priority order:
OPENAI_API_KEYFIELDNOTES_USE_FAKE_LLM=1- automatic fallback to fake mode
Behavior:
OPENAI_API_KEYpresent: startup uses live OpenAI mode automaticallyOPENAI_BASE_URLempty: live mode uses native OpenAI Responses API transportOPENAI_BASE_URLset: live mode uses OpenAI-compatible Chat Completions transport against custom endpoint- no API key and
FIELDNOTES_USE_FAKE_LLM=1: startup uses fake mode - no API key and no fake flag: startup still succeeds and falls back to fake mode
Startup logs:
- live mode:
INFO: OpenAI API detected. Running in live mode. - explicit fake mode:
INFO: Running in fake LLM mode. - automatic fallback:
WARNING: No OPENAI_API_KEY detected.WARNING: Falling back to fake LLM mode.WARNING: Set OPENAI_API_KEY to enable live OpenAI responses.
- Location:
.fieldnotes_registry/workspaces.json - Backup:
.fieldnotes_registry/workspaces.backup.json - Corruption quarantine:
.fieldnotes_registry/workspaces.corrupt-YYYY-MM-DDTHHMMSSZ.json - Recovery behavior: malformed, truncated, empty, unreadable, or invalid registry files are quarantined when possible, replaced with a fresh empty registry, and logged as warnings
- Health diagnostic:
/healthincludesregistry_warningwhen automatic recovery occurred during current process lifetime
- Workspace database:
<workspace>/.fieldnotes/fieldnotes.db - Quarantine names:
fieldnotes.db.corrupt-YYYY-MM-DDTHHMMSSZ, plus matching-waland-shmsidecars when present - Integrity validation: each database open runs
PRAGMA integrity_check - Repair flow:
- checkpoint WAL
- reopen and re-run integrity check
- quarantine damaged files if still broken
- create replacement database
- rebuild from source files when available
- rehydrate file-backed artifact metadata from
.fieldnotes/artifacts/
- Health diagnostic:
/healthincludesstorage_warningafter repair or recreate events during current process lifetime
Phase 0 includes optional end-to-end live Responses API verification through scripts/exit_phase0.py.
- Enabled when
OPENAI_API_KEYis set - Uses configured
OPENAI_MODEL; no model name is hardcoded in probe - Sends one tiny prompt and expects strict JSON
{"status":"ok"} - Expected runtime: usually a few seconds
- Expected cost: minimal, single tiny request
- CI behavior: missing credentials reports
LIVE API ... SKIPPEDand does not fail - Why optional: most CI and offline setups should not require live billing credentials
- Windows: sandbox uses native Job Object limits for CPU time, memory, process count, and cleanup
- macOS / Linux: sandbox uses
resource.setrlimitfor CPU, memory, process count, and file descriptor caps - Paths with spaces and Unicode are supported