AGENTS.md@crates/wenlan-core · git:20260823.54c8a7e · 2026-08-23 · sha256 a63e7d9459f7bb35

AGENTS.md@crates/wenlan-core git:20260823.54c8a7eA

Immutable. This exact content is served forever at /api/v1/blob/a63e7d9459f7bb35.

# crates/wenlan-core

Applies under `crates/wenlan-core/`. The root `AGENTS.md` still applies, including the
framework-agnostic / no-Tauri-or-Axum-dependencies and no-RwLock-guard-across-`.await`
rules under "Repository invariants". Use `REFERENCE.md` only when a task needs the
detailed module map, database layout, feature-flag wiring, or historical measurement.

## Core invariants

- `MemoryDB` owns storage and holds its libSQL connection behind the established async
  mutex. Share the database through `Arc<MemoryDB>`.
- UI notifications go through `EventEmitter`; daemon code uses `NoopEmitter` and the app
  supplies its adapter.
- The durable write-time seam is the ambient slice lanes (`run_classification_enrichment_slice`,
  `run_structured_extract_slice`, `run_title_enrichment_slice`, `run_page_growth_slice`,
  `run_document_enrichment_slice`), indexed from `wenlan-server/src/scheduler/ambient.rs`.
  `ingest::run_canonical_enrichment` is the reconcile/eval route only — add new write-time
  behavior to the slice lane it belongs to, not there.
- A new channel must have an executable substrate/liveness check. Do not report a null
  experiment over an empty or stale substrate as product evidence.
- Retrieval feature defaults and experiment receipts live in `REFERENCE.md` and
  `src/retrieval/REFERENCE.md`, not in this instruction file.

## Eval seed + eval read: ONE route, ONE contract (no drift)

Re-seed scenario databases through `seed_scenario_dbs_complete`; individual `seed_*`
steps are its internals, not an operator runbook. `src/eval/seed_contract.rs` is the
shared producer/consumer liveness contract. When adding a write-time channel, wire its
seed step, expectation, consumer assertion, and focused unit test together.

Runner conventions and experiment methodology live in `src/eval/REFERENCE.md`. Fixture,
artifact, and citation rules live in `app/eval/REFERENCE.md`.