# Project export: GroundTruth

This document was generated by HackStack to give an AI agent context about a hackathon project. Sections are labeled with their provenance; content marked as truncated was cut to keep this document small.

## Project metadata

- Hackathon: OpenAI Build Week
- Tagline: Subsurface projects — geothermal, carbon storage, oil & gas — run on thousands of scattered technical reports. GroundTruth reads them all and becomes a dashboard + cited expert you can ask.
- Devpost: https://devpost.com/software/groundtruth-e297jz
- GitHub: https://github.com/zeyusuntt/oil-dashboard
- Video: https://www.youtube.com/embed/rG25rQtpXNc?enablejsapi=1&hl=en_US&rel=0&start=&version=3&wmode=transparent
- Team: 2 GitHub contributor(s) — Zeyu Sun (183 commits), Claude Fable 5 (52 commits)

## Devpost submission (written by the team)

### Inspiration

Oil and gas fields, CO₂ storage sites, and geothermal projects generate enormous volumes of technical knowledge. Yet this information remains fragmented across reports, spreadsheets, well logs, reservoir models, simulations, presentations, and 2D and 3D datasets. Much of this data is stored in proprietary formats that traditionally require expensive domain-specific software—and specialists trained to use it—to open, visualize, and analyze. Connecting everything can take technical teams days or weeks. We asked: What if a field could simply tell you what it knows?

### What it does

Field Brain transforms fragmented subsurface information into one living, decision-ready knowledge system. Users select a project's technical folders, and Field Brain: Interprets reports, tables, well data, presentations, models, and supported specialist engineering files Connects information across formats and technical disciplines Automatically generates a structured field dashboard Highlights development history, reservoir behavior, performance, risks, and opportunities Answers technical questions in natural language Links insights and answers to their supporting files for provenance and verification This gives engineers and decision-makers one coherent, traceable view of an asset—without requiring every user to purchase or master all the original domain applications.

### How we built it

We developed and tested Field Brain using Equinor's public Volve dataset. The system inventories the selected files, extracts technical information and source references, identifies relationships across documents and datasets, and uses GPT-5.6 to generate domain-specific insights. It then organizes those findings into an interactive dashboard and searchable field knowledge system. Codex served as a rigorous, cost-efficient engineering partner throughout the long-horizon build, supporting architecture, implementation, testing, error correction, and verification.

### Challenges we ran into

Our main challenges were connecting highly diverse data, interpreting domain-specific formats, and balancing automation with technical rigor. We also needed to reduce hallucination risk. In subsurface engineering, a convincing answer is not enough—it must be verifiable. We therefore built a provenance layer that connects findings to their supporting source files and helps users distinguish documented facts from AI-generated interpretations.

### Accomplishments we're proud of

We transformed hundreds of disconnected Volve files into a coherent, decision-oriented dashboard. We are especially proud that Field Brain can interpret information previously confined to specialist applications, connect knowledge across technical disciplines, and provide natural-language answers with traceable evidence.

### What we learned

We learned that frontier AI can do more than summarize individual documents. With the right architecture, it can connect information across disciplines and build a more complete understanding of a complex physical asset. We also learned that AI should not replace engineers or geoscientists. Its greatest value is making their data and accumulated expertise more accessible, connected, verifiable, and reusable.

### What's next

Next, we plan to expand support for additional engineering formats, strengthen uncertainty and provenance controls, and enable Field Brain to continuously update as new reports, models, and operational data arrive. Our longer-term vision is to build a persistent intelligence layer for oil and gas, CO₂ storage, geothermal energy, underground hydrogen storage, mining, and groundwater management. Every field remembers. Every engineer can ask what it knows.

## README (from the GitHub repository)

# Field Brain

**An auditable AI workspace for complex oilfield data. Every numeric answer is computed by
registered tools, linked to a receipt, and independently checked before it reaches the user.**

Built for **OpenAI Build Week 2026** in the **Work & Productivity** track.

Field Brain turns the Equinor Volve dataset into a persistent field workspace with an evidence
atlas, streamed analysis, field-scoped chat, source inspection, and replayable provenance. Volve is
the connected reference field; new fields can be created as honest empty workspaces until data is
attached.

## Why Field Brain

Traditional dashboards present values but rarely explain where they came from. General-purpose AI
can explain results fluently, but it may also invent values or lose the connection to the source.
Field Brain separates reasoning from computation:

- GPT-5.6 plans which registered tools to use, but does not author displayed numbers.
- The server executes read-only, schema-validated tools against processed field data.
- Every execution produces a receipt containing its operation, inputs, source, and result.
- An independent checker reruns the underlying operation before accepting a factual claim.
- The UI streams the plan, tool activity, verification result, answer, and provenance to the user.
- Unsupported questions are refused with answerable alternatives instead of guessed answers.

## Quick start

### Requirements

- Node.js 20 or newer
- npm 10 or newer
- Python is optional for the standard demo; it is required only for data re-extraction and the
  controlled RMS processing workflow

### Run the key-free demo

```bash
npm ci
npm run demo
```

Open [http://localhost:3000](http://localhost:3000).

`npm run demo` always uses deterministic planning, even if an ignored `.env` file contains an API
key. The questions, tool execution, receipts, checker, streaming UI, and replay system are real;
only the model planning step is replaced by committed Playbooks so the complete product remains
reproducible without API access.

## Judge walkthrough

The repository contains the processed Volve data products and a small RMS upload fixture. A judge
does not need the team Drive or an OpenAI API key.

1. Start the app with `npm run demo` and open `http://localhost:3000`.
2. Select **Add Field** and enter `Volve` as the field name.
3. Choose the folder `data/fixtures/rms-export/`.
4. Confirm that the picker reports **52 extractor inputs ready**, then select **Create Field**.
5. Open the Volve dashboard and select one of the verified example questions in the analyst.
6. Inspect the streamed activity, verdicts, and receipt drawer, or open a saved replay.

Chrome normally includes `Fault_model/.faultlist` when it reads the folder. If a browser reports
only **51 extractor inputs**, use the displayed fallback file picker to add
`data/fixtures/rms-export/Fault_model/.faultlist` separately.

## What the demo proves

- A 13-section Volve evidence atlas with maps, production history, simulation comparisons, RMS
  structure, waterflood analysis, risks, source evidence, and limitations
- 46 factual or interpretive claims connected to 25 execution receipts and 12 evidence records
- Four verified analysis journeys covering water cut, well performance, injection, and RMS geology
- One deliberately incorrect claim that the independent checker visibly rejects
- Progressive Server-Sent Events for planning, tool execution, verification, and cancellation
- Persistent field-scoped chats, replayable JSONL case files, saved analyses, and source inspection
- An honest empty state for fields that do not yet have a connected data product
- A controlled RMS upload flow with staging, deterministic extraction, review, and atomic publish

## Technology stack

| Layer | Technology |
|---|---|
| Languages | TypeScript, TSX, Python, SQL, YAML |
| Frontend | Next.js 15, React 19, Tailwind CSS 4 |
| Visualization | Apache ECharts, Leaflet, React Leaflet |
| Backend | Node.js, Express 4, native Server-Sent Events |
| OpenAI | GPT-5.6 through the streaming Responses API with strict JSON Schema output |
| Contracts and validation | Zod schemas shared across the browser, API, planner, tools, and tests |
| Analytical storage | DuckDB, Apache Parquet, JSON, JSONL |
| Data pipeline | pandas, PyArrow, PyMuPDF, resdata, NumPy, Matplotlib, Pillow |
| Search | MiniSearch over the committed evidence register |
| Testing | Vitest, Supertest, pytest, Playwright |
| Repository | npm workspaces monorepo |

## System architecture

```mermaid
flowchart LR
    U[Browser] -->|HTTP + SSE| W[Next.js application]
    W -->|same-origin BFF| A[Express API]
    A --> P{Planner mode}
    P -->|demo| M[Committed Playbook]
    P -->|live| G[GPT-5.6 Responses API]
    M --> R[Deterministic agent runner]
    G -->|strict Playbook JSON| R
    R --> T[Registered read-only tools]
    T --> D[(DuckDB / Parquet / Atlas JSON)]
    T --> L[Receipt ledger]
    R --> V[Independent checker]
    V -->|reruns tool operation| T
    L --> C[Replayable case file]
    R -->|normalized event stream| A
```

The model is outside the trusted computation boundary. It selects registered tools and presentation
structure; the runner owns execution, value resolution, receipt creation, verification, and the
final event stream.

## How GPT-5.6 is used

Live mode makes one streaming Responses API request per question. GPT-5.6 receives the user
question, bounded field context, and a strict Playbook schema. It can choose only registered tools
and schema-shaped arguments.

The live planner is deliberately constrained:

- no raw source files or filesystem paths are sent to the model;
- the model cannot submit SQL, code, panel data, or value overrides;
- displayed numeric values must resolve from server-side tool receipts;
- the returned plan is validated again with Zod before any tool executes;
- API, timeout, refusal, or schema failures become a visible safe refusal;
- `store: false` is used for the planning request;
- cancellation aborts the upstream request and prevents later tool execution.

To run the GPT-5.6 path:

```bash
cp .env.example .env
# Add OPENAI_API_KEY to .env
npm run dev:live
```

The configured default model is `gpt-5.6-sol`; `OPENAI_MODEL` can override it. Live mode requires a
non-empty API key and never silently falls back to deterministic planning.

## How Codex was used

Codex was the primary implementation environment and engineering control plane for the project.
The main session converted the product brief into six dependency-ordered workstreams, delegated
bounded implementation tasks to fresh `codex exec` agents, and accepted work only after rerunning
the relevant type, unit, browser, provenance, runtime, and live-model checks.

Codex performed the majority of repository implementation and verification, including:

- profiling the Volve source corpus and building deterministic extraction pipelines;
- designing shared Playbook, tool, receipt, claim, panel, and event contracts;
- implementing the receipted tool layer, agent runner, verifier, and streaming API;
- building the field workspace, evidence atlas, analyst chat, replay, and ingest interfaces;
- generating unit, API, browser, adversarial, accessibility, and visual-regression coverage;
- reviewing failures, correcting invalid assumptions, and running scoped repair loops;
- maintaining an auditable build log and release gates instead of accepting agent output on trust.

The human team retained the product and safety decisions: Volve as the reference field, refusal
over guessing, no model-authored numbers, mandatory receipts, independent re-derivation, and a
clear separation between deterministic demo mode and live GPT-5.6 planning.

Primary Codex build Session ID:

```text
019f73f9-17f5-77e2-a7b1-a150f4ede175
```

The corresponding engineering trail is recorded in [`BUILD_LOG.md`](BUILD_LOG.md) and the Git
history. In the Codex interface, `/status` displays the Session ID required by the B

[README truncated for size]

## Detected evidence (automated analysis)

Indexed codebase: 181 recognized source files, 1601 KB.
- CSS (language) — detected in the code
- Express (technology) — detected in the code
- Next.js (technology) — detected in the code
- Python (language) — detected in the code
- React (technology) — detected in the code
- Tailwind CSS (technology) — detected in the code
- TypeScript (language) — detected in the code
- Node.js (technology) — claimed on Devpost, not found in the code
- SQL (language) — claimed on Devpost, not found in the code
- AI coding agent: Claude Code — evidence: commit authorship or trailers

## Codebase structure (from repository index)

### Files (120 of 300)

```
.env.example
.gitignore
.mcp.json
apps/server/package.json
apps/server/playbooks/brain-build.json
apps/server/playbooks/q1-watercut.json
apps/server/playbooks/q2-topwells.json
apps/server/playbooks/q3-injection.json
apps/server/playbooks/q4-rms-hugin.json
apps/server/scripts/brainBuild.ts
apps/server/scripts/seed.ts
apps/server/src/agent/caseFile.ts
apps/server/src/agent/livePlan.ts
apps/server/src/agent/modelClient.ts
apps/server/src/agent/openaiClient.ts
apps/server/src/agent/runner.ts
apps/server/src/agent/verifier.ts
apps/server/src/api.ts
apps/server/src/atlasData.ts
apps/server/src/chat/threads.ts
apps/server/src/db.ts
apps/server/src/fieldFiles.ts
apps/server/src/fieldRegistry.ts
apps/server/src/index.ts
apps/server/src/ingest/changeSet.ts
apps/server/src/ingest/extract.ts
apps/server/src/ingest/runner.ts
apps/server/src/ingest/store.ts
apps/server/src/ingest/validate.ts
apps/server/src/ledger.ts
apps/server/src/pins.ts
apps/server/src/resolver.ts
apps/server/src/runtimeStore.ts
apps/server/src/semantic.ts
apps/server/src/tools/atlas.ts
apps/server/src/tools/index.ts
apps/server/src/tools/queryProduction.ts
apps/server/src/tools/querySim.ts
apps/server/src/tools/reports.ts
apps/server/test/api.test.ts
apps/server/test/atlasApi.test.ts
apps/server/test/atlasEvidence.test.ts
apps/server/test/atlasOrder.test.ts
apps/server/test/atlasSchema.test.ts
apps/server/test/atlasVersions.test.ts
apps/server/test/chatThreads.test.ts
apps/server/test/db.test.ts
apps/server/test/fieldFiles.test.ts
apps/server/test/fieldRegistry.test.ts
apps/server/test/fixtures/scale-caveat.json
apps/server/test/ingest-validation.test.ts
apps/server/test/ingest.test.ts
apps/server/test/ledger.test.ts
apps/server/test/livePlan.test.ts
apps/server/test/openaiClient.test.ts
apps/server/test/pins.test.ts
apps/server/test/resetDemoRuntimeScript.test.ts
apps/server/test/resolver.test.ts
apps/server/test/runner.test.ts
apps/server/test/seededCasefiles.test.ts
apps/server/test/setup.ts
apps/server/test/tools.test.ts
apps/server/test/verified.test.ts
apps/server/test/verifier.test.ts
apps/server/test/verifyAtlasScript.test.ts
apps/server/test/verifyRuntimeScript.test.ts
apps/server/tsconfig.json
apps/server/vitest.config.ts
apps/web/app/api/[...path]/route.ts
apps/web/app/api/ingest-jobs/[...path]/route.ts
apps/web/app/api/ingest-jobs/route.ts
apps/web/app/api/run/route.ts
apps/web/app/build-log/page.tsx
apps/web/app/fields/[slug]/files/page.tsx
apps/web/app/fields/[slug]/page.tsx
apps/web/app/globals.css
apps/web/app/layout.tsx
apps/web/app/page.tsx
apps/web/app/replay/[id]/page.tsx
apps/web/app/run/page.tsx
apps/web/components/ActivityTimeline.tsx
apps/web/components/AddDataDrawer.tsx
apps/web/components/AddFieldWizard.tsx
apps/web/components/AgentTree.tsx
apps/web/components/AnswerProse.tsx
apps/web/components/AtlasCharts.tsx
apps/web/components/AtlasEvidence.tsx
apps/web/components/AtlasFieldHero.tsx
apps/web/components/AtlasHome.tsx
apps/web/components/AtlasRenderer.tsx
apps/web/components/ChatDock.tsx
apps/web/components/ClaimLine.tsx
apps/web/components/FieldFilesView.tsx
apps/web/components/FieldWorkspace.tsx
apps/web/components/GpsFieldMap.tsx
apps/web/components/IngestActivity.tsx
apps/web/components/LeafletFieldMap.tsx
apps/web/components/PanelCard.tsx
apps/web/components/PinAnalysisDialog.tsx
apps/web/components/ReceiptDrawer.tsx
apps/web/components/RmsFolderPicker.tsx
apps/web/components/RunView.tsx
apps/web/components/SavedAnalyses.tsx
apps/web/components/TimeseriesChart.tsx
apps/web/components/WellCurveExplorer.tsx
apps/web/lib/apiOrigin.ts
apps/web/lib/chatEvents.ts
apps/web/lib/fieldRoutes.ts
apps/web/lib/rmsRequiredPaths.ts
apps/web/lib/runState.ts
apps/web/lib/useRunStream.ts
apps/web/next-env.d.ts
apps/web/next.config.ts
apps/web/package.json
apps/web/postcss.config.mjs
apps/web/test/addDataDrawer.test.ts
apps/web/test/addFieldWizard.test.tsx
apps/web/test/answerProse.test.ts
apps/web/test/atlasHero.test.tsx
apps/web/test/atlasInformationArchitecture.test.tsx
[180 more files omitted for size]
```

### Dependencies

- apps/server/package.json: @duckdb/node-api@1.5.4-r.1, @field-brain/shared@*, @types/express@^4.17.21, @types/node@^22.0.0, @types/supertest@^6.0.2, express@^4.21.0, minisearch@^7.1.0, supertest@^7.0.0, tsx@^4.19.0, typescript@^5.6.0, vitest@^3.0.0, yaml@^2.6.0, zod@^3.24.0
- apps/web/package.json: @field-brain/shared@*, @tailwindcss/postcss@^4.0.0, @types/leaflet@1.9.21, @types/node@^22.0.0, @types/react@^19.0.0, @types/react-dom@^19.0.0, echarts@^5.5.0, leaflet@1.9.4, next@^15.3.0, react@^19.0.0, react-dom@^19.0.0, react-leaflet@5.0.0, tailwindcss@^4.0.0, typescript@^5.6.0, vitest@^3.0.0
- package.json: @playwright/test@^1.61.1
- packages/shared/package.json: typescript@^5.6.0, vitest@^3.0.0, zod@^3.24.0

### Recent commits (newest first)

- docs: prepare Build Week submission guide
- fix: make judge workflow independent of team Drive
- test(e2e): regenerate visual-regression baselines for round-2 render + robust readiness
- fix(atlas): R6 — reference-exact strategy actions + risk evidence captions + RMS card sentences
- test(e2e): update stale e2e golds for R1-R5 behavior changes
- fix(chat): R5 — live analysis latest-line + expand; delete analysis left thinking-log column (bugs 1,2)
- fix(atlas): R4 — waterflood water-injection focus + reference-exact risk register (bugs 8,10)
- fix(atlas): R3 — hero verbatim + real GIS map + RMS 8-stat block + hydration fix (bugs 3,4,5)
- fix(atlas): R2 — reference-faithful section arrangements (bugs 6, 7, 13, evolution)
- fix(atlas): R1 — fluid density, responsive grid reflow, prominent section numbers (bugs 11,12)
- docs: fresh-clone demo reproduction runbook for Yi
- feat(demo): commit Volve RMS export upload bundle for fresh-clone reproducibility
- docs: add Yi's new bug set (changes-needed 1-13) + target screenshots
- docs: reference-fidelity fix plan (bugs 1-13) + acceptance standard
- fix(atlas): final integration certification — cross-goal fixes + baselines
- merge: G2 editorial hero + G5 chat UX (frontend track)
- feat(atlas): G3 Eclipse dynamic model — four maps + split well curves
- feat(atlas,chat): G2 editorial field hero + G5 in-layout chat UX
- feat(atlas): G4 evidence + risk professional content
- feat(fields): G6 left panel + demo lifecycle (prebuilt Volve reveal)

## Key source files (fetched from GitHub, selected and truncated for size)

### docs/DEMO-REPRODUCTION.md

```markdown
# Fresh-Clone Demo Reproduction (for Yi / any reviewer)

Goal: a person who `git clone`s this repo can run the exact demo — create the Volve
field live, upload the data, and reveal the dashboard — with **nothing from our
machines**. Verified 2026-07-20: every runtime artifact is committed; `drive/`,
`.venv`, and the Python pipeline are **build-time only** and are NOT needed to run
the demo.

## 0. Prerequisites
- Node 20+ and npm (no Python needed to *run* the demo).
- For the **live** demo only: an `OPENAI_API_KEY`.

## 1. Setup (one time)
```bash
git clone <repo> && cd oil-dashboard
npm install
cp .env.example .env          # then, for live mode, put your key in OPENAI_API_KEY
```

## 2. Start
- **Mock (deterministic, $0, always works):**
  ```bash
  npm run demo                 # → http://localhost:3000
  ```
- **Live (real model):**
  ```bash
  npm run dev:live             # loads .env, API :4000 + web :3000 → http://localhost:3000
  ```
First run builds the web app once (a few minutes); subsequent runs are fast.

## 3. The demo flow — create Volve live and reveal the dashboard
Volve is intentionally **not** preloaded (the committed field registry is empty).
You create it during the demo:

1. In the left sidebar, **Add a new field**. Name it exactly **`Volve`** (case-sensitive).
2. **Upload the data.** The known Volve inputs ship in the repo at:
   ```
   data/fixtures/rms-export/
   ```
   **Drag that `rms-export` folder onto the upload drop zone** (do not use “Browse folder”
   for the folder — see the `.faultlist` note below). You should see
   **“52 extractor inputs ready.”**
3. Create the field. You’ll see a short **reading-files** loading state, then the Volve
   dashboard reveals (the field binds to the committed atlas because the uploaded files
   byte-match the signed manifest).

### Why drag-drop, and the `.faultlist` gotcha
The bundle includes one hidden file, `Fault_model/.faultlist`, which is **required**
(52/52 must match). Browsers’ folder **Browse** dialog silently skips hidden dotfiles,
so you’d get only 51 and the reveal won’t bind. Two ways to succeed:
- **Recommended:** *drag* the `rms-export` folder onto the drop zone. The drag path uses
  the FileSystem API, which reads the dotfile — all 52 in one step.
- If you must use Browse: it will show 51 files and prompt **“Add .faultlist directly.”**
  Click it and pick `data/fixtures/rms-export/Fault_model/.faultlist` (in the macOS file
  dialog press **⌘⇧.** to reveal hidden files).

Junk files (`.DS_Store`, etc.) are ignored automatically — the picker only accepts the
recognized RMS inputs, so an extra file in the folder will not break the match.

## 4. Ask a verified question (live)
Open the field’s AI chat and ask e.g.
> “When did water break through at Volve, and how did water cut evolve?”

Every number in the answer is computed server-side from a receipt; a receipt panel opens
and an independent checker marks the verdict. If a live question stalls, the same
question answer
[truncated — 768 more characters]
```

### STATUS.md

```markdown
# STATUS — Goal R Demo Alignment + Submittable (2026-07-20)

## Goal R gate

**GREEN. Field Brain v0.6 is reproducible and submittable.** It now has one documented
and automated submission path: persistent sidebar → Add Field → honest empty dashboard → Volve
Dashboard → Volve-scoped chat with visible activity and a receipt → Volve Files → approved RMS
folder → deterministic review → publish → textual `NEW` RMS state → **Ask about this update** →
reload and reopen the two-turn Volve history without cross-field leakage.

The reset preflights both allowed cleanup roots before deletion. It removes only validated runtime
descendants (field overlay, threads, pins, ingest jobs, and versions), restores the committed
baseline pointer, and sweeps only generated `data/casefiles/chat-*` regular files from the validated
casefile directory. It refuses symlinks or unsupported targets, preserves an already-valid pointer
byte-for-byte, never deletes the five committed replay pairs, and leaves committed data, fixtures,
and `drive/` untouched. Six focused reset tests pass; two real consecutive resets left only
`data/runtime/current.json` and exactly the five seed pairs, and all 198 workspace tests passed.

The v0.6 rehearsal is a single serial test in the existing `living-ingest` Playwright project,
which explicitly sets `retries: 0`. Its final required `--repeat-each=2` run passed both complete
journeys in 9.1 s and 7.5 s (2 passed in 22.5 s) without restarting the product process. The README
and recording plan describe only this implemented workflow and retain an explicit, honest fallback
for nondeterministic live latency.

The first full-oracle attempt exposed the inherited staged-job handoff race as an ingest poll 404.
The runner now claims and advances a persisted staged job synchronously before the final upload
response returns; a stronger server assertion requires an immediate 200 in a runner-owned state.
No retry, timeout, pipeline stage, or assertion was weakened. After the repair, both consecutive
`verify:atlas` runs passed 26 shared, 159 server, 13 web, 20 pipeline, 37 nonvisual Chrome, and four
visual tests plus all nested data/UI oracles, with no retry output.

The final live smoke passed with `gpt-5.6-sol`: 13,908 total tokens (turns 6,555 and 7,353), planning
latency 50,969 ms and 64,563 ms, 116,054 ms end to end, 21 receipts, 15 checker calls, 15
independently verified verdicts, resolved follow-up context, and two persisted turns. Reset twice,
`verify:runtime`, both Atlas gates, the repeated rehearsal, live smoke, and `git diff --check` all
exit 0. Implementation commits: `ee7e581`, `8b09e6c`, `279e412`, and `cdb1e3d`.
**Blockers:** none.

---

# STATUS — Goal M Demo Reproducibility (2026-07-18)

## Goal M gate

**GREEN. The living demo resets safely, rehearses completely, and passes the release oracle twice
without a retry.** `scripts/reset-demo-runtime.mjs` accepts only the canonical `data/runtime`
directory, rejects symlinks and unsupported entri
[truncated — 23129 more characters]
```

### package.json

```
{
  "name": "field-brain",
  "private": true,
  "version": "0.1.0",
  "description": "Field Brain — auditable analyst agent for the Volve oilfield. Every number has a receipt.",
  "workspaces": [
    "packages/*",
    "apps/*"
  ],
  "scripts": {
    "test": "npm run test -ws --if-present",
    "dev": "node scripts/demo.mjs --dev",
    "demo": "node scripts/demo.mjs",
    "dev:live": "node scripts/demo.mjs --dev --live",
    "e2e": "playwright test --grep-invert @visual",
    "e2e:visual": "node scripts/run-atlas-visual.mjs",
    "build:atlas-baseline": "./.venv/bin/python pipeline/build_atlas_data.py --available-sources discovery-report,pud-report,production-history,eclipse-model,history-match-deck,external-reference,interpretive-synthesis,concept-state --out-dir data/atlas_baseline",
    "verify:atlas-data": "node scripts/verify-atlas-data.mjs",
    "verify:atlas-ui": "node scripts/verify-atlas-ui.mjs",
    "verify:atlas": "node scripts/verify-atlas.mjs",
    "verify:runtime": "node scripts/verify-runtime.mjs",
    "smoke:live": "node scripts/smoke-live.mjs"
  },
  "license": "MIT",
  "devDependencies": {
    "@playwright/test": "^1.61.1"
  }
}

```

### packages/shared/package.json

```
{
  "name": "@field-brain/shared",
  "version": "0.1.0",
  "private": true,
  "type": "module",
  "exports": {
    ".": "./src/index.ts",
    "./answer": "./src/answer.ts",
    "./schemas": "./src/schemas.ts"
  },
  "scripts": {
    "test": "vitest run"
  },
  "dependencies": {
    "zod": "^3.24.0"
  },
  "devDependencies": {
    "typescript": "^5.6.0",
    "vitest": "^3.0.0"
  }
}

```

### apps/web/package.json

```
{
  "name": "@field-brain/web",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "test": "vitest run",
    "typecheck": "tsc --noEmit"
  },
  "dependencies": {
    "@field-brain/shared": "*",
    "echarts": "^5.5.0",
    "leaflet": "1.9.4",
    "next": "^15.3.0",
    "react": "^19.0.0",
    "react-dom": "^19.0.0",
    "react-leaflet": "5.0.0"
  },
  "devDependencies": {
    "@tailwindcss/postcss": "^4.0.0",
    "@types/node": "^22.0.0",
    "@types/leaflet": "1.9.21",
    "@types/react": "^19.0.0",
    "@types/react-dom": "^19.0.0",
    "tailwindcss": "^4.0.0",
    "typescript": "^5.6.0",
    "vitest": "^3.0.0"
  }
}

```

### apps/server/package.json

```
{
  "name": "@field-brain/server",
  "version": "0.1.0",
  "private": true,
  "type": "module",
  "scripts": {
    "dev": "tsx watch src/index.ts",
    "start": "tsx src/index.ts",
    "brain-build": "tsx scripts/brainBuild.ts",
    "seed": "tsx scripts/seed.ts",
    "test": "vitest run",
    "typecheck": "tsc --noEmit"
  },
  "dependencies": {
    "@duckdb/node-api": "1.5.4-r.1",
    "@field-brain/shared": "*",
    "express": "^4.21.0",
    "minisearch": "^7.1.0",
    "yaml": "^2.6.0",
    "zod": "^3.24.0"
  },
  "devDependencies": {
    "@types/express": "^4.17.21",
    "@types/node": "^22.0.0",
    "@types/supertest": "^6.0.2",
    "supertest": "^7.0.0",
    "tsx": "^4.19.0",
    "typescript": "^5.6.0",
    "vitest": "^3.0.0"
  }
}

```

### packages/shared/src/index.ts

```typescript
export * from './types.js';
export * from './schemas.js';

```

### apps/web/app/page.tsx

```typescript
import { AtlasHome } from '../components/AtlasHome';

export default function Home() {
  return <AtlasHome />;
}

```

### apps/server/src/index.ts

```typescript
import { createApp, hydrateReceipts } from './api.js';

const PORT = Number(process.env['PORT'] ?? 4000);

const app = createApp();
const receiptCount = hydrateReceipts();

app.listen(PORT, () => {
  const mode = process.env['OPENAI_API_KEY'] && process.env['MODEL_MODE'] === 'live' ? 'live' : 'mock';
  console.log(`Field Brain server on :${PORT} — model mode: ${mode}, ${receiptCount} receipts hydrated`);
});

```

### apps/web/app/layout.tsx

```typescript
import type { Metadata } from 'next';
import { FieldWorkspace } from '../components/FieldWorkspace';
import { ChatDock } from '../components/ChatDock';
import 'leaflet/dist/leaflet.css';
import './globals.css';

export const metadata: Metadata = {
  title: 'Volve Living Evidence Atlas — Field Brain',
  description:
    'One field, one brain. An auditable analyst agent for the Volve oilfield — every number has a receipt.',
};

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <body className="min-h-screen">
        <FieldWorkspace footer={(
          <footer className="site-footer">
            Data: Equinor Volve dataset, used under the{' '}
            <a className="underline" href="https://www.equinor.com/energy/volve-data-sharing" target="_blank" rel="noreferrer">
              Equinor Open Data Licence
            </a>
            . Every displayed value is computed server-side from receipted queries — the model never types numbers.
          </footer>
        )}>
          {children}
        </FieldWorkspace>
        <ChatDock />
      </body>
    </html>
  );
}

```

[171 more indexed source files omitted to keep this export small. The full file list is in the Codebase structure section above.]