Repository navigation
Phase 5: answers as data, check_text, faithfulness benchmark, MCP facts tools - #39
Conversation
…tools (phase 5) - firms_client.facts: area, place, event, seen as JSON-ready dicts with window, product, sources, licence (NASA FIRMS; ESA WorldCover CC BY 4.0 when the land was read) and notes. Nothing read is measured: false with null counts, never 0. - firms_client.check: check_text (English and Italian numbers, percentages as shares, dates as parts), numbers, figures, at. - MCP: fires_in_area, event_facts, trust_at, detection_odds, check_answer, area_digest(land_cover=True) (#19). - benchmarks/faithful.json: nine questions on the benchmark crops, a faithful and a faulty hand answer each; score --check in CI and make faithful. check_text alone catches 13 of the 21 faults. - llms-full.txt on the site, skills/firms-client/SKILL.md with the traps. Part of #26. Closes #19. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VFEUmXwmaxtB7PF8sSP1d4
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cb06a18037
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| with _land(land_cover) as land: | ||
| return facts.event(events[0], places=gazetteer, land=land, source=product) |
There was a problem hiding this comment.
Move blocking WorldCover reads off the MCP event loop
When land_cover=True (the default here) and tiles are read from the public bucket, facts.event() synchronously opens raster datasets and reads a window for each detection through classify_burning(). Calling it directly from this async handler blocks the MCP event loop throughout those network reads, preventing other requests and cancellations from being processed during a large event. WorldCover explicitly documents that its reads are blocking, and the existing CLI offloads equivalent work with asyncio.to_thread. Offload the land-cover context and computation together; the new land-cover paths in fires_in_area, trust_at, and area_digest need the same treatment.
Useful? React with 👍 / 👎.
| _EN = re.compile(r"(?<![\w.,])(\d{1,3}(?:,\d{3})+(?:\.\d+)?|\d+(?:\.\d+)?)(?:st|nd|rd|th)?(?!\w)") | ||
| _IT = re.compile(r"(?<![\w.,])(\d{1,3}(?:\.\d{3})+(?:,\d+)?|\d+(?:,\d+)?)(?:°|ª|º)?(?!\w)") |
There was a problem hiding this comment.
Recognize fractional numbers without a leading zero
When an answer writes a score or share as .95, the English pattern silently skips the entire number: it requires a digit before the decimal point and prevents a match immediately after a period. Consequently, check_text('Reliability is .95', {}) returns [], and the MCP check_answer tool reports the unsupported number as faithful. The Italian pattern similarly skips ,95. Recognize these fractional forms as complete numeric tokens so they are checked against the facts rather than omitted.
Useful? React with 👍 / 👎.
Phase 5 of #26: the AI layer. Closes #19.
What
firms_client.facts:area,place,event,seenreturn answers as JSON-ready dicts. Every number sits next to itswindow,product,sources,licence(the NASA FIRMS acknowledgement, plus the ESA WorldCover CC BY 4.0 credit when the land was read) andnotes(not measured, not an alert, presence-only). Nothing read (rows=None, a place with no mask and no land) ismeasured: falsewith null numbers, never 0. Pure, no network.check_text(firms_client.check): the numbers of a text, English or Italian, that no figure of the facts gives, to the decimals written; percentages as shares, dates as parts, numbers of the question allowed.fires_in_area,event_facts(bulletin facts for the largest event, with your places),trust_at,detection_odds,check_answer, andarea_digest(..., land_cover=True)(MCP: expose land cover and bulletin facts as tools #19). The guide tells the agent to say "not measured" for nulls and to pass its text tocheck_answer.benchmarks/faithful.json: nine questions (five English, four Italian) on the benchmark crops: trust at the Taranto steelworks and on cropland at Aragona, the empty Tyrrhenian, Palermo 2023, Montiferru 2021, San Luca and Irsina events with WorldCover, detection odds, and a year not published. Each has a faithful and a faulty hand answer, with every number labelled.score --checkruns in CI (make faithful) and fails if a hand answer does not score as expected or the facts change.llms.txtsection,llms-full.txtbuilt bymake docs,skills/firms-client/SKILL.mdwith ten traps, README section, CHANGELOG.Measured
Every fault in the faulty answers is caught by the scorer.
check_textalone, with no labels, catches 13 of the 21; the 8 it misses are numbers that exist in the facts but are said of the wrong one (318 fires when 318 are the detections). That is why the guide tells the agent to reread them.Not in this PR
ask/labelwith a real model: it is paid, so it waits for a yes. The commands are infaithful.py.Checks
make check(200 passed, coverage 99%),make test-core,make bench(34 of 41, no change),make faithful,make docs.🤖 Generated with Claude Code
https://claude.ai/code/session_01VFEUmXwmaxtB7PF8sSP1d4