knowledge: PR-3 skim notices + bounded lead promotion #3

Merged
onibot merged 1 commits from feature/skim-pr3 into main 2026-10-20 16:24:59 +02:00
Owner

PR-3 of the skim (KNOWLEDGE.md §7) — notices to the loop + the bounded LLM promotion of ambiguous leads. Closes the three-PR design Emili approved.

What lands:

  • Skim notices: every knowledge row carries payload['skim'] — what the fetched articles contained beyond the answer (table identities, infobox quantities, links), goal-filtered. The machine renders them into the ROUTER context (seen in passing (E1): ...) and the run notes. A notice is a pointer, never evidence.
  • Bounded lead promotion (Emili's "deterministic + fallback amb LLM"): quantity tables matching no goal word were PR-2 leads; now one SkimPromoteSignature call per fetched page with leads decides over table IDENTITY lines (caption/headers/row count/quantities — never rows). The LLM proposes; fixed code disposes: entity-overlap check still applies, the named column must exist, ingestion is the same containment-checked _ingest_scalar_table as the deterministic harvest. No leads → zero calls.
  • Refactor: shared row ingestion + overlap counting; per-call reset of skim state; WikiTable import fixed (annotation referenced an unimported name).
  • find_quantities fixes: plain digits without thousands separators (1540 m3/s) now match; caption+header join with a space (m3/sRiver broke the unit boundary).

Verified live (real Wikipedia, scripted promote decision — the real LLM call is Emili's E2E): goal terms lacking 'flow' queue both Italy tables as leads; the promoted flow table ingests all 27 rivers containment-checked (Po 1540, Adige 235, Tiber 239 m3/s); promotion naming a missing column is refused.

Tests: 4 new (knowledge/tests/promote.py), suite 43/43. Builds on PR-1 (#1) and PR-2 (#2), both merged.

**PR-3 of the skim (KNOWLEDGE.md §7)** — notices to the loop + the bounded LLM promotion of ambiguous leads. Closes the three-PR design Emili approved. What lands: - **Skim notices**: every knowledge row carries `payload['skim']` — what the fetched articles contained beyond the answer (table identities, infobox quantities, links), goal-filtered. The machine renders them into the ROUTER context (`seen in passing (E1): ...`) and the run notes. A notice is a pointer, never evidence. - **Bounded lead promotion** (Emili's "deterministic + fallback amb LLM"): quantity tables matching no goal word were PR-2 leads; now one `SkimPromoteSignature` call per fetched page with leads decides over table IDENTITY lines (caption/headers/row count/quantities — never rows). The LLM proposes; fixed code disposes: entity-overlap check still applies, the named column must exist, ingestion is the same containment-checked `_ingest_scalar_table` as the deterministic harvest. No leads → zero calls. - **Refactor**: shared row ingestion + overlap counting; per-call reset of skim state; `WikiTable` import fixed (annotation referenced an unimported name). - **find_quantities fixes**: plain digits without thousands separators (`1540 m3/s`) now match; caption+header join with a space (`m3/sRiver` broke the unit boundary). Verified live (real Wikipedia, scripted promote decision — the real LLM call is Emili's E2E): goal terms lacking 'flow' queue both Italy tables as leads; the promoted flow table ingests all 27 rivers containment-checked (Po 1540, Adige 235, Tiber 239 m3/s); promotion naming a missing column is refused. Tests: 4 new (`knowledge/tests/promote.py`), suite 43/43. Builds on PR-1 (#1) and PR-2 (#2), both merged.
onibot added 1 commit 2026-10-20 16:24:56 +02:00
PR-1 made the skim SEE (surfaces + signals); PR-2 made it HARVEST
deterministically. PR-3 closes the loop (KNOWLEDGE.md §7):

- Skim notices: every knowledge answer's stats carry what the fetched
  articles contained beyond the answer (table identities, infobox
  quantities, link candidates, goal-filtered). The engine copies them
  into payload['skim']; the machine renders them to the ROUTER context
  ('seen in passing (E1): ...') and to the run notes — later steps know
  what exists and where it lives instead of re-searching blind. A notice
  is a pointer, never evidence: it answers nothing by itself.
- Bounded lead promotion (Emili's 'deterministic + LLM fallback'):
  quantity tables that match NO goal word are queued as leads (PR-2);
  now ONE dspy call (SkimPromoteSignature) decides over the tables'
  IDENTITY lines (caption/headers/rows/quantities — never the rows),
  per fetched page with leads, only when leads exist. The LLM proposes;
  fixed code disposes: a promoted table still passes the entity-overlap
  check (a world discharge table is refused for Po/Adige/Tiber), the
  named column must exist, and ingestion goes through the same
  containment-checked _ingest_scalar_table as the deterministic path.
- Refactor: row ingestion extracted to _ingest_scalar_table (shared by
  harvest + promotion); _entity_overlap_count shared; skim state
  (_skim_notices/_skim_leads/_current_goal_question) reset per call.
- find_quantities: fix plain-digit quantities ('1540 m3/s', '1000 m3/s')
  — the thousands-separator-only regex missed them, and caption+header
  now join with a space ('m3/sRiver' broke the unit boundary).

Live smoke (real Wikipedia, scripted decision): goal terms without
'flow' queue both Italy tables as leads; the promoted 'Flow at the
mouth' table ingests all 27 rivers (Po 1540, Adige 235, Tiber 239
m3/s) containment-checked; promotion of the length table with a
'Flow' column name is refused (column does not exist).

Tests: 4 new (knowledge/tests/promote.py); suite 43/43 green.
onibot merged commit ad9baf243b into main 2026-10-20 16:24:59 +02:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: onibot/floop#3