# Inkhaven 1.5.1 — Grounded Research (RESRCH-2, first cuts)

_1.5.0 gave the Research Assistant a verified Facts corpus. 1.5.1 makes that corpus **trustworthy** and
lets it stand on **real documents**: every fact now records where it came from, near-duplicates are
caught before they land, a speculative Note can be promoted to a Fact, and you can import your own
Markdown / text / PDF sources to ground the model on them. The first two cuts of the RESRCH-2 track._

_Plans: [RESRCH-2_TRACK.md](../PROPOSALS/RESRCH-2_TRACK.md) ·
[RESRCH-2.1_PLAN.md](../PROPOSALS/RESRCH-2.1_PLAN.md) ·
[RESRCH-2.2_PLAN.md](../PROPOSALS/RESRCH-2.2_PLAN.md)_

## The "trust" cut (RESRCH-2.1) — zero new crates

- **Provenance.** Every inserted fact records its origin in `.inkhaven/fact-sources.json` —
  `model` (with the originating research query), `manual`, `promoted`, or now `document` — surfaced in
  the confirmation overlay's `src:` line and by the new **`/sources`** command.
- **Near-duplicate guard.** Before a `/fact` commits, the Facts retriever checks the body; a hit at or
  above `research.dedup_warn_score` (0.92) **warns once** in the overlay (`⚠ similar to facts/…`) and a
  second `Ctrl+S` inserts anyway. It informs, never blocks.
- **`/promote [notes/path] [→ facts/path]`.** Turn a speculative **Note** into a verified **Fact** —
  re-runs the extraction + confirmation over the note's text into Facts (provenance `promoted`); with no
  argument, promotes the thread's most recent `/note`. Non-destructive.

## Document import (RESRCH-2.2 / R2-B) — one new crate (`pdf-extract`)

Ground the assistant on **your own sources**, not just the model's knowledge:

- **`/import <path>`** (and `inkhaven research --import <path>`) ingests a **Markdown / text / PDF**
  file: it chunks the text and embeds the chunks into the shared vector store as *research sources*.
  Those chunks are then retrieved alongside your Facts (cited `[source: name]`) to ground answers, and a
  `/fact` taken from a source-grounded answer records provenance **`document`**.
- **`/import`** (bare) lists imported sources; **`/forget <name>`** removes one (re-import refreshes).
- Imported sources are **project-global** (retrieved across threads); PDFs are text-extracted on import
  (no OCR — scanned PDFs yield little text). New `research.import_chunk_chars` (1500).

## Notes

- **One new runtime crate** — `pdf-extract` (PDF text extraction); the Markdown/text import path and the
  entire trust cut need none. No `facts.duckdb`, no new system books, no new `NodeKind`. New sidecars:
  `.inkhaven/fact-sources.json`, `.inkhaven/research-sources.json`.
- The RESRCH-2 keystone: provenance ships **first**, so the moment facts come from imported documents
  (or, next, the web), "where did this come from?" already has an answer. Web search & fetch (R2-C) is
  the next external-retrieval step; it slots into this same source-retrieval + provenance plumbing.
- Tutorial 103 expanded (provenance, `/promote`, `/sources`, `/import`). Tests 2,177 → 2,181.
