Skip to content

160-tool MCP server for real-time global intelligence from free public APIs: markets, liquidity, prediction markets, SEC filings, conflict, military, aircraft-cohort early warning, migration and border flows, cyber, climate, news and more. Dated observation history, 29 research prompts, cited briefs, geofences, SSE dashboard. MIT, no paid API keys.

Merge fix/maritime-honesty e4f0216: maritime and fleet honesty, second review round

Phoenix Agent (mac-studio)982d652370cb
diff --cc CHANGELOG.md
index 6cd1132,75024cd..27721b3
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -672,134 -73,52 +699,172 @@@ source here, and no proxy is substitute
- `intel_fleet_report` turned a failed component into `{}`, so with all
three down it read `LOW_ACTIVITY` with no marker. A component that raises
or reports an error is now named in `unavailable_components` and
- `data_gaps` and the report is degraded; with all three down it also
- carries `error` and `reason` (`fleet_components_unavailable`). Component
- `data_gaps` are passed on.
+ `data_gaps` and the report is degraded; so is a vessel snapshot whose NGA
+ feed is stale, which is no longer scored. With all three unavailable the
+ report carries `error` and `reason` (`fleet_components_unavailable`),
+ `readiness_level` `UNKNOWN` and `readiness_score` null. With some
+ missing, `readiness_lower_bound` is true and `data_gaps` says what the
+ score leaves out and how high it can still reach (each component adds at
+ most 30 of 90). Component `data_gaps` are passed on.
+ - `intel_military_flights` with adsb.lol and OpenSky both down returned
+ zero aircraft, told apart from an empty sky only by `source: "none"`.
+ Those keys stay, and the response now also carries `error`, `degraded`
+ and `reason` (`military_flights_unavailable`).
+ - `intel_theater_posture` turned a theater that no flight source answered
+ for (adsb.lol and OpenSky both failed) into zero aircraft, so a full
+ outage read as an empty sky, and as `LOW_ACTIVITY` with no error in the
+ fleet report. Each theater now names its `source`; unanswered ones are
+ listed in `unavailable_theaters` and `data_gaps` and the response is
+ degraded, with `error` and `reason` (`military_flights_unavailable`)
+ when none answered. Only a complete posture is cached.
+ `intel_military_surge` turns a posture error into its own error and
+ skips regions whose theater had no source (`unchecked_regions`) instead
+ of recording zeros in their baselines.
+
+ ### Fixed: report maritime section
+ - The PDF/HTML report read `vessels` and `snapshot` for its maritime
+ section, keys the vessel snapshot never emits, so every report said "No
+ maritime data". It now shows the nine waterways' statuses, a STALE note
+ for a frozen feed, the outage error, and the first data gaps.
### Tests
- - Failing-first regression tests for all three, built on live NGA records
- captured 2026-10-17.
+ - Failing-first regression tests built on live NGA records captured
+ 2026-10-17, and `test_maritime_honesty.py` and `test_fleet_honesty.py`
+ for the second review round: each finding test fails on the previous
+ branch head and passes now, and five tests kill the mutants that survived
+ the first round (radius boundary, malformed DMS, notation order,
+ staleness boundary, two components down).
+
+ ### Still open
+ - The dashboard's nav-warnings table and fleet panel do not yet read
+ `feed_stale`, `stale`, `unknown`, `readiness_lower_bound` or `UNKNOWN`,
+ and the collector counts error results as successful collections.
+ - Strategic posture and temporal anomalies still read a posture outage as
+ zero activity; posture now marks it, but they do not check.
+ - A naval warning that cannot be placed leaves every waterway's status
+ unchanged; it is named only in `unplaced_naval_warnings` and
+ `data_gaps`.
+### Added: AOI escalation news and convergence components
+- `intel_aoi_escalation` now scores the news and convergence components it
+ used to report as null (ROADMAP Phase 23).
+- News: the rise in the area's share of all GDELT coverage over the last 7
+ days against the 7 days before, for the reverse-geocoded settlement and
+ county (the query the AOI brief already uses, sent as `timelinevolraw`).
+ Expected articles = prior share x current GDELT volume; change_pct =
+ 100 x (current - expected) / max(expected, 20); component =
+ min(20, 0.2 x max(0, change_pct)). Shares rather than raw counts because
+ GDELT's own intake has multi-day outages (measured 2026-10-17 for
+ Pittsburgh: no data for 16 of 85 days), which raw counts would read as a
+ surge on recovery; a comparison where one week monitored under half the
+ other's volume is refused as a data gap. An area that cannot be
+ geocoded is not scored, rather than searched by the AOI's name.
+- Convergence: `analysis/convergence.py`, unmodified, over the
+ earthquakes, military flights, ACLED events and wildfires inside the
+ AOI's exact shape (circle, polygon or corridor, through the same
+ `filter_by_aoi` scoping as the brief). With an input missing, a
+ convergent cell is reported as a lower bound; no cell at all is null,
+ because quiet cannot be told from missing.
+- New response keys; existing keys keep their meaning. `computed_from`
+ names the components the score was computed from, and
+ `zero_filled_components` the ones among them that are a 0 only because
+ the military or ACLED fetch failed (`score_hotspot` takes no null for
+ those, unchanged); `news_signal` (query, both windows' counts and
+ shares, change), `news_scoping` and `convergence_signal` (cells, events
+ per domain, inputs used, failed or partial) carry the working. A failed
+ news or convergence input makes that component null in `components`,
+ listed in `unavailable_components` and explained in `data_gaps`, never
+ a 0.
+
+### Changed
+- The escalation also fetches earthquakes and wildfires (convergence
+ inputs) and one GDELT timeline, in parallel with ACLED and military
+ flights; their failures are named in `data_gaps`. The brief, the change
+ sweep and the escalation now share one AOI scoping helper.
+- `test_aoi.py` stubs every network-bound source by default: its older
+ escalation tests stub only ACLED and military flights and would
+ otherwise reach Nominatim, GDELT, USGS and FIRMS live.
+
+### Added: border crossings (flows)
+- `intel_us_border_encounters`: U.S. CBP encounters per calendar month
+ (Border Patrol Title 8 apprehensions, Field Operations Title 8
+ inadmissibles, Title 42 expulsions), read from the newest CSV on CBP's
+ public dataset page, which spans four fiscal years (October 2022 to
+ August 2026 when written). Nationwide or one land border region, all
+ components or USBP / OFO, optionally one citizenship as CBP names it;
+ with the latest month against the same month a year earlier, fiscal-year
+ totals (the year in progress compared with the same months of the prior
+ year, only when every one is published), breakdowns by component,
+ encounter type and demographic, and the top citizenships with CBP's
+ OTHER bucket reported apart and never ranked. CBP's fiscal months are
+ mapped to calendar months (FY2026 October is October 2025).
+- `intel_uk_small_boat_arrivals`: Home Office daily and weekly counts of
+ migrants and boats detected crossing the English Channel in small boats,
+ with uncontrolled landings and the weekly migrants and events prevented
+ by French authorities; month and year sums of the daily rows, and the
+ year to date against the same span a year earlier. Read through the
+ GOV.UK Content API and the published ODS time series, parsed with the
+ standard library (zipfile + ElementTree, no new dependency). The
+ publisher's numbered notes are quoted from the file on every refresh.
+- Both are flows (events per period), stated in every response with units,
+ date semantics and the publisher's caveats, and kept apart from the
+ UNHCR and World Bank year-end stocks. Neither file has a person
+ identifier, so neither counts unique people (said in each response as a
+ tool note, not as the publisher's words).
+- An outage is a degraded error with no figures; a failed refresh serves
+ the last good copy marked `stale` with its age. A '-' in the UK file is
+ null, never 0; a CBP month with no rows inside the file's coverage is 0,
+ because CBP lists only non-zero cells, and months outside it are never
+ invented. Weekly UK totals are checked against their seven days and any
+ mismatch is named in `data_gaps`.
+- Requests use an identifying User-Agent, two per refresh (the listing,
+ then the file), cached 12 h (CBP) and 3 h (UK). Paths that robots.txt
+ disallows are never requested; a newer-looking CBP file at such a path
+ is named in `data_gaps` instead.
+- Frontex is not built: its only data file is an XLSX under `/assets/`,
+ which its robots.txt disallows (measured 2026-10-17, see ROADMAP Phase 28).
+- Tools 139 -> 141.
+
+### Added: Kalshi and cross-venue prediction markets
+- `intel_kalshi_markets`: Kalshi open markets from its public market-data
+ API (no account, no key), ranked by 24h then lifetime volume. Prices are
+ YES implied probabilities (bid/ask midpoint when the book is two-sided,
+ else the last trade, with the basis named); Kalshi's raw dollar quotes
+ are kept. Filter by category (the category's highest-volume series) or
+ series ticker. The response names the events it scanned and whether the
+ scan was complete: Kalshi lists more than 8,000 open events, furthest
+ close date first.
+- `intel_prediction_compare`: the same event on Kalshi and Polymarket side
+ by side. Matching is deterministic: quantities (with their direction,
+ so "more than 25 bps" is not "25 bps"), years, end dates, negation and
+ the outcome side must all agree, and each pair carries a
+ `match_confidence` and its reasons. Below the threshold (default 0.6) a
+ pair is not a match. Returns the price gap per pair, the closest
+ rejected pairs with the reason, and unmatched counts per venue.
+- `intel_prediction_settled`: recently settled markets on both venues with
+ the outcome and the YES price at fixed offsets before close (default 24h
+ and 168h) from each venue's price-history endpoint, and a Brier score per
+ venue and offset with sample size, distinct events, selection and
+ exclusions stated. A venue whose price history cannot be read is not
+ scored. The two samples are different markets, and the response says so.
+- Every number these three tools take has a stated range in its input
+ schema: at most 25 Kalshi series or pages per scan, 2,000 Polymarket
+ markets, 500 results, 100 settled markets per venue, and 10 offsets of
+ at most 8,760 hours, so one call cannot fan out into an unbounded number
+ of upstream requests. The MCP server refuses a value outside its range;
+ the source functions clamp counts again for the CLI and other callers,
+ and refuse a value that is not a number before any request.
+- CLI: `intel kalshi`, `intel prediction-compare`, `intel prediction-settled`.
+- Collector: `kalshi_markets` and `prediction_compare` (Economics
+ category) join the `prediction` domain. Sources 55 -> 57. Tools 139 -> 142.
+
+### Fixed: prediction markets outage read as "no markets"
+- `intel_prediction_markets` returned `{"markets": [], "count": 0}` with no
+ marker when Polymarket was down, the same shape as a quiet market. It now
+ adds `error` and `degraded: true` on an outage or an unexpected response,
+ and `stale: true` when the list came from an expired cache entry. Keys,
+ parameters and the tool name are unchanged.
+
## 0.11.0 - 2026-10-12
Cross-border migration (MCP tools, CLI, collector and a dashboard
diff --cc ROADMAP.md
index 7a1604c,dcdf2d0..9bb9996
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@@ -650,11 -598,10 +650,11 @@@ fail-quietly bugs below were fixed in t
| UNHCR outage returned all-zero global totals with no error/degraded key ("zero refugees worldwide") | `sources/displacement.py` | fail-reads-as-success | :white_check_mark: Fixed (#22) |
| A climate zone whose fetch failed was silently omitted; full outage yielded `{"zones": {}}` with no marker | `sources/climate.py` | silent degradation | :white_check_mark: Fixed (#23) |
| "Resolved: Major outage" classified as an active critical incident; a dead provider feed still listed as checked | `sources/service_status.py` | misclassification | :white_check_mark: Fixed (#24) |
- | Naval warnings apply to all 9 waterways identically (no proximity/NAVAREA filter); `total_nearby` computed but never emitted | `sources/intelligence.py` vessel snapshot | precision | :white_check_mark: Fixed (Unreleased): a warning counts only at waterways within 300 km of a position it states, or, when it states none, by single-NAVAREA area code (4, 12); the rule is in `matching_rule`, naval warnings no rule can place are in `unplaced_naval_warnings`; `total_nearby` emitted; an NGA outage reads `unknown`, not `clear` |
+ | Naval warnings apply to all 9 waterways identically (no proximity/NAVAREA filter); `total_nearby` computed but never emitted | `sources/intelligence.py` vessel snapshot | precision | :white_check_mark: Fixed (Unreleased): a warning counts only at waterways within 300 km of a position its full text states; one that states no readable position counts nowhere (crediting positionless NAVAREA IV and XII warnings to Panama was measured wrong 5 of 5 times on the live feed and rejected) and, if naval, is listed in `unplaced_naval_warnings` with a reason; the rule is in `matching_rule`; `total_nearby` emitted; an NGA outage reads `unknown` and a frozen feed `stale`, not `clear` or a current threat level. Open: an unplaced naval warning leaves waterway statuses unchanged and is named only in `data_gaps` |
| Country/company/leader entity matching was substring-based ("usa" inside "thousand", "hamas" inside "Bahamas") | `analysis/entities.py` | false positives | :white_check_mark: Fixed in 0.5.0 (word-boundary alternations, measured faster) |
| Category keywords matched substrings ("airstrike" bumped severity via "strike"; "denied" fired "ied") | `analysis/classifier.py` | false positives | :white_check_mark: Fixed in 0.5.0 (boundary-anchored stems, per-keyword overrides) |
- | Silent-empty degradation without a marker on RSS/API failure | `sources/prediction.py` (documented as intended), `sources/maritime.py`, `sources/news.py` RSS path, `sources/fleet.py` `_safe` wrapper | silent degradation | :yellow_circle: `sources/news.py` RSS path fixed 2026-10-17 (every call reports `feeds_attempted` / `feeds_ok` / `feeds_failed` / `feeds_stale`; no feed answering live is `error` + `degraded` + `reason: all_feeds_failed`, including the warm-cache case where failed feeds came back as expired copies and counted as healthy; failing-first regression tests). Since the 2026-10-17 review: fewer than half of the feeds answering live is `degraded` + `reason: partial_feeds_failed` with no error (measured that day: 95 of 119 answered, the rest permanent 404 / 403 / 410 plus one timeout), passed through by trending keywords, situations, top stories and the dossier; links are kept only when http(s) and titles are capped at 500 characters. `maritime.py` and `fleet.py` fixed (Unreleased): outages carry `error`/`degraded`/`reason` and `data_gaps`, failed fleet components are named in `unavailable_components`, and nav warnings flag a feed whose newest warning is over 14 days old (NGA's API holds nothing issued after 10 May 2024, measured 2026-10-17). `sources/prediction.py` fixed, unreleased: an outage or unexpected response adds `error` + `degraded`, an expired-cache serve adds `stale`; keys unchanged; regression tests written failing-first (3 failed on the old module). The fetcher's stale fallback marks only dict payloads, so other text and XML sources can serve expired copies unmarked |
-| Silent-empty degradation without a marker on RSS/API failure | `sources/prediction.py` (documented as intended), `sources/maritime.py`, `sources/news.py` RSS path, `sources/fleet.py` `_safe` wrapper, `sources/military.py` military flights and theater posture | silent degradation | :yellow_circle: `maritime.py`, `fleet.py`, military flights and theater posture fixed (Unreleased): outages carry `error`/`degraded`/`reason` and `data_gaps`; failed or stale fleet components are named in `unavailable_components`, and fleet readiness reads `UNKNOWN` with none available and is marked a lower bound with some missing; military flights with both sources down carries `error`/`degraded`/`reason` (no `data_gaps`) beside `source: "none"`; posture names the theaters no flight source answered for; nav warnings flag (`feed_stale`) a feed whose newest warning is over 14 days old (NGA's API holds nothing issued after 10 May 2024, measured 2026-10-17). Open: `prediction.py` and `news.py` are not covered; the dashboard and collector do not yet read the new markers; strategic posture and temporal anomalies still read a posture outage as zero activity |
++| Silent-empty degradation without a marker on RSS/API failure | `sources/prediction.py` (documented as intended), `sources/maritime.py`, `sources/news.py` RSS path, `sources/fleet.py` `_safe` wrapper, `sources/military.py` military flights and theater posture | silent degradation | :yellow_circle: `sources/news.py` RSS path fixed 2026-10-17 (every call reports `feeds_attempted` / `feeds_ok` / `feeds_failed` / `feeds_stale`; no feed answering live is `error` + `degraded` + `reason: all_feeds_failed`, including the warm-cache case where failed feeds came back as expired copies and counted as healthy; failing-first regression tests). Since the 2026-10-17 review: fewer than half of the feeds answering live is `degraded` + `reason: partial_feeds_failed` with no error (measured that day: 95 of 119 answered, the rest permanent 404 / 403 / 410 plus one timeout), passed through by trending keywords, situations, top stories and the dossier; links are kept only when http(s) and titles are capped at 500 characters. `maritime.py`, `fleet.py`, military flights and theater posture fixed (Unreleased): outages carry `error`/`degraded`/`reason` and `data_gaps`; failed or stale fleet components are named in `unavailable_components`, and fleet readiness reads `UNKNOWN` with none available and is marked a lower bound with some missing; military flights with both sources down carries `error`/`degraded`/`reason` (no `data_gaps`) beside `source: "none"`; posture names the theaters no flight source answered for; nav warnings flag (`feed_stale`) a feed whose newest warning is over 14 days old (NGA's API holds nothing issued after 10 May 2024, measured 2026-10-17). `sources/prediction.py` fixed, unreleased: an outage or unexpected response adds `error` + `degraded`, an expired-cache serve adds `stale`; keys unchanged; regression tests written failing-first (3 failed on the old module). The fetcher's stale fallback marks only dict payloads, so other text and XML sources can serve expired copies unmarked Open: the dashboard and collector do not yet read the new markers; strategic posture and temporal anomalies still read a posture outage as zero activity |
+| Country dossier news was always empty with no marker, for every country: it asked the feed for `category="all"` (not a category, so `fetch_news_feed` answered with an error dict), read `articles` / `source` while the feed emits `items` / `feed_name`, and checked only its own `_error`, never the feed's `error`. Also, 28 of the 50 accepted codes have no headline keywords, so their search could never match | `analysis/dossier.py` news section | fail-reads-as-success | :white_check_mark: Fixed 2026-10-17, unreleased (reads every feed; a feed error or outage passes through as `error` / `degraded` / `reason` with `mention_count: null` and a data gap; failed and stale feeds named; keywordless countries report "mentions not searched"; `intel dossier` prints `News: not measured`; failing-first tests drive the real `fetch_news_feed` output). Since the 2026-10-17 review: headlines match on whole words (the substring test counted "Tirana" as Iran and "Indiana" as India), four compound names are removed first, and the section reports `matching_items`, `mention_count_capped`, `items_searched` and `searched_span` |
| 33 CLI commands rendered upstream errors as healthy empty states | `cli.py` | fail-reads-as-success | :white_check_mark: Fixed in 0.6.0 (shared bail-on-error path; 43 failing-first tests) |
| Rich markup swallowed lowercase bracketed values and let remote titles inject markup | `cli.py` | output corruption | :white_check_mark: Fixed in 0.6.0 (per-site escaping; injection test) |
| Remote data inside Rich TABLE cells was not markup-escaped | `cli.py` | output corruption | :white_check_mark: Fixed in 0.6.0 (`_cell` Text-wrapping convention, 11 injection tests; error styles unified across all 53 commands) |