# Inkhaven 1.5.2 — The Web, Folders & Deterministic Facts (RESRCH-2/3)

_1.5.1 grounded the Research Assistant on your own documents. 1.5.2 widens where facts can come from —
**the live web** (with a safety posture you choose), **whole folders** of notes, and **deterministic
calculation** — while keeping the same source-retrieval + provenance plumbing and the trust ladder that
decides how hard each source is checked before it commits._

_Plans: [RESRCH-2.3_PLAN.md](../PROPOSALS/RESRCH-2.3_PLAN.md) ·
[RESRCH-3_TRACK.md](../PROPOSALS/RESRCH-3_TRACK.md)_

## Web search & fetch (RESRCH-2 / R2-C) — one new crate (`reqwest`)

Bring **live web sources** in, with an explicit pipeline choice:

- **`/web <query>`** (default) searches + fetches and **grounds an LLM answer** on the results, cited by
  URL. A **`/fact`** taken from that answer is **fact-checked before it commits** — a single-fact
  accuracy check runs in the confirmation overlay; `ACCURATE` inserts, `DUBIOUS` / `INACCURATE` shows the
  verdict and asks you to confirm again. Provenance is recorded as **`web`** with the source URL(s).
- **`/web --ingest <query>`** instead embeds the fetched pages directly as cited research sources (like
  `/import`, but from the web) — no LLM in the loop.
- Configurable providers: **Tavily** (API key) or your own **SearXNG** instance, via `research.web`.
  Set the default pipeline with `research.web.pipeline` (`chat` / `ingest`); `--chat` / `--ingest`
  override per call. Without a provider, `/web` reports it's unavailable — nothing breaks.

## Folder import (RESRCH-3 / R3-D, brought forward) — zero new crates

- **`/import <folder>`** (and `inkhaven research --import <folder>`) now imports a **whole directory**
  recursively: every `.md` / `.txt` / `.pdf` inside becomes a research source. Point it at an
  Obsidian-style vault or a folder of notes; the status line reports the file and chunk counts, and a
  re-import refreshes same-named sources. The single-file path is unchanged.

## Deterministic calculation — `/calc` (RESRCH-3 / R3-C) — zero new crates, zero network

- **`/calc <expr>`** evaluates a deterministic expression in the in-tree **Bund** VM, with a prelude of
  **physical constants** and **unit-conversion words**. The computation *is* its own proof: a `/fact`
  from a `/calc` result records provenance **`computed`** and **skips the fact-check gate** entirely —
  nothing can be fabricated.
- Conversions (`100 mi2km` → `160.9344`): distance, temperature, mass, speed, and astronomical units
  (`au`/`ly`/`pc`), plus `deg2rad` / `rad2deg`. Constants (SI base units): `calc.pi`, `calc.c`,
  `calc.grav`, `calc.gee`, `calc.au`, `calc.ly`, `calc.pc`, `calc.year`, … The full Bund stack language
  is available too (`/calc 3 4 + 5 *` → `35`).
- **Integer and float are interchangeable** in word arguments — `100` and `100.0` evaluate identically.

## Notes

- **One new runtime crate** — `reqwest` (HTTP for `/web`, rustls); folder import and `/calc` need none.
  `/calc` is backed by the already-present Bund VM (`rust_multistackvm`) plus a small constants/units
  prelude. New provenance origins: `web`, `computed`. New config block: `research.web`.
- The trust ladder now spans **deterministic** (`computed`, gate bypassed) → **document** → **web**
  (gated) → **model**, all on the same retrieval + provenance plumbing.
- Tutorial 103 expanded (`/web`, folder import, `/calc`); Ctrl+B h help overlay updated. Tests 2181 → 2186.
