Skip to content

Earth Watch MVP: M2 live-verified, M3 (attribution, methane, flaring, ledger tools), dashboard redesign, life layer - #3

Merged
marcoloco23 merged 22 commits into
mainfrom
worktree-earth-watch-m3
Sep 26, 2026
Merged

marcoloco23 merged 22 commits into
mainfrom
worktree-earth-watch-m3

Conversation

@marcoloco23

Copy link
Copy Markdown
Owner

Earth Watch MVP — M2 live-verified, M3 shipped, dashboard redesigned, life layer

Everything here was verified against the real APIs with the local keys (the cloud session that built M1/M2 had no network). One orchestrator + six worker branches merged.

M2 — first real sweep (exit criterion)

  • watch --once over 8 AOIs → 8 candidates, 2 confirmed by NDVI (São Félix 232 ha / 90 d, Novo Progresso 727 ha); ledger verified.
  • Controls (Jaú, Salonga) fired at detect stage on ~15–19 ha of radar floodplain noise → thresholds raised to minHa 25 / minAlerts 300 (re-verified quiet); both recorded as false_positive with the reason in the ledger.
  • Three live bugs fixed: GFW byConfidence is nested (every created append was rejected; --dry-run now validates the event too), OWID ignores country= on 5/11 charts (filter by code + csvType=full fallback + column override — disaster deaths was reporting drought deaths), FIRMS caps dayRange at 5.

M3 — attribution + methane wedge (all live-verified)

  • protected_areas: Overpass (+ is_in for containing territories), LandMark and WDPA ids/stats via GFW — never geometry. São Félix → APA Triunfo do Xingu.
  • emitters: Climate TRACE v7 (no bbox filter → admins → sources → point filter). São Félix: 59 assets, 86 kt CO₂e, 3.2 kt CH₄.
  • methane_plumes + methane_anomaly@1.0: S5P CH₄ recent vs 90-day baseline via CDSE; EMIT public plume feed (stale since 2025-09-22); UNEP MARS gated; Carbon Mapper link-only.
  • flaring + flaring@1.0: FIRMS night-time persistence + EOG VNF annual sites (zero-key). Rumaila: 25 persistent clusters, 22 on VNF sites; confirmed live in a sweep.
  • ledger_* ×7 for Claude triage (any move into a public status is refused), doctor Watch section, schema/finding-event.v1.json (pnpm schema).

Dashboard

Design system + feed/Watch/case/verify pages, charts with hover, mobile at 390 px — docs/screenshots/ui-{before,after}-*.jpg. Emil Kowalski design skills vendored in .agents/skills.

Life layer

biodiversity, species, coral_bleaching + life indicators in world_pulse (details in PROGRESS.md).

Verify

pnpm install && pnpm build && pnpm test · node --env-file=.env dist/cli.js doctor · node --env-file=.env dist/cli.js dashboard → Watch tab shows the real cases. Handoff in CONTINUITY.md.

🤖 Generated with Claude Code

https://claude.ai/code/session_017KN8pr3M1ayKPTNRcNSc2D

marcoloco23 and others added 22 commits September 26, 2026 20:10
- forest_loss: flatten byConfidence into numeric evidence.values (live shape is
  nested; every `created` append was rejected by the schema, ledger stayed empty)
- kernel: --dry-run now validates the `created` event against the contract, so a dry
  run fails where the real run would
- owid: filter rows by entity code, fall back to csvType=full when the filtered CSV
  lacks the entity (OWID silently ignores country= on several charts), per-indicator
  column override (disaster deaths → total, not drought)
- scripts/probe-tool.mjs: call one MCP tool in-process
- design skills (emilkowalski/skill) under .agents/skills + .claude/skills

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017KN8pr3M1ayKPTNRcNSc2D
- forest_loss: flatten byConfidence into numeric evidence.values (live shape is
  nested; every `created` append was rejected by the schema, ledger stayed empty)
- kernel: --dry-run now validates the `created` event against the contract, so a dry
  run fails where the real run would
- owid: filter rows by entity code, fall back to csvType=full when the filtered CSV
  lacks the entity (OWID silently ignores country= on several charts), per-indicator
  column override (disaster deaths → total, not drought)
- scripts/probe-tool.mjs: call one MCP tool in-process
- design skills (emilkowalski/skill) under .agents/skills + .claude/skills

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017KN8pr3M1ayKPTNRcNSc2D
- src/tools/ledger.ts: ledger_list/get/verify (read) and ledger_advance/narrate/
  review/propose_attribution (append via Ledger + checkAppend). ledger_advance refuses
  any move into a PUBLIC_STATUS; writers never mint a key or create a ledger.
- Shared pushFindingCard in dashboard/push.ts (kernel now uses it too).
- doctor: Watch section — ledger size/verify, per-rule keys from RULES, watchlists,
  last sweep heartbeat (journal readHeartbeat). Exit 1 on failed verify/bad watchlist.
- schema/finding-event.v1.json (JSON Schema 2020-12) generated by z.toJSONSchema via
  `pnpm schema`; drift + zod-vs-Ajv verdict tests.
- 13 new offline tests (169 total).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017KN8pr3M1ayKPTNRcNSc2D
- flaring (tool #28): FIRMS VIIRS NOAA-20/21 night-time detections (daynight == N,
  FRP >= minFrp) over N days in <=5-day FIRMS chunks, leader-clustered to ~1 km,
  nights counted per local solar night; clusters lit >= minNights are persistent.
  Matched to the EOG VIIRS Nightfire ANNUAL flare summary (zero-key public KML,
  aggregate only; nightly VNF not used). VNF failure degrades to FIRMS-only + EOG link.
- flaring@1.0 (tier 2): primary = persistent night cluster; confirmation = VNF annual
  site match (provider) or a later FIRMS pass near the flagged cluster (revisit).
- watchlists/flaring.json: Rumaila, Bakken, Niger Delta.
- FireDetection gains daynight. Offline tests on fixtures recorded live 2026-09-26.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017KN8pr3M1ayKPTNRcNSc2D
…noise (first live sweep)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017KN8pr3M1ayKPTNRcNSc2D
…therwise); skills lockfile

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017KN8pr3M1ayKPTNRcNSc2D
…p client, schema and test

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017KN8pr3M1ayKPTNRcNSc2D
- methane_plumes: Sentinel-5P TROPOMI CH4 via CDSE Statistics (sentinel-5p-l2,
  band CH4, timeliness OFFL, minQa 50, ORBIT per-pixel mean) — one request returns
  the ~90-day baseline + recent window as equal buckets -> anomaly (delta ppb, z vs
  baseline variability, % valid) + provenance; NASA JPL EMIT plume complexes from the
  public MMGIS GeoJSON (public domain, cached per process). UNEP MARS reported
  unavailable (API needs authorization, downloads Cloudflare-challenged); Carbon
  Mapper link-only. Series card push, best-effort.
- CopernicusClient.statisticsSeries (multi-bucket stats, empty bucket = null).
- methane_anomaly@1.0 (tier 2): S5P anomaly >= minAnomalyPpb with minValidPct,
  100 km ring baseline, confirmed by an EMIT plume in the AOI (sensor); TODO hook
  for the emitters tool. watchlists/methane.json (Permian, Galkynysh, Hassi R'Mel).
- Offline tests with fixtures recorded live 2026-09-26 (167 green).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017KN8pr3M1ayKPTNRcNSc2D
…atch-m3

# Conflicts:
#	README.md
#	src/index.ts
#	src/watch/rules/index.ts
protected_areas: OSM Overpass (boundary=protected_area|national_park|
aboriginal_lands, ODbL, zero-key) + LandMark Indigenous & community lands
via the GFW Data API (CC BY-SA 4.0, when GFW_API_KEY is set). Tags/bounds
only, never geometry; centroids coarsened to 0.1 deg; containsAoiCentroid
via Overpass is_in / PostGIS ST_Intersects. The Overpass query pivots
is_in areas back to ways/relations, because a bbox filter misses huge
territories whose boundary lies outside the AOI (verified live, Kayapo).
WDPA deliberately not queried (licence; no zero-key path).

emitters: Climate TRACE pinned to /v7 (EARTHDECK_CLIMATETRACE_BASE).
v7 /sources ignores bbox, so bbox -> /admins level 2 -> /sources per
gadmId (co2e_100yr + ch4 merged by id); point sources filtered to the
bbox, gadm-aggregation rows returned separately as context.

Both reuse the events dashboard card; doctor probes both; README table.
18 new offline tests from real responses (174 total).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017KN8pr3M1ayKPTNRcNSc2D
… doctor count

WDPA rows (source "wdpa"): site id, name, designation, IUCN category,
reported area, coarse 0.1 deg centroid, containsAoiCentroid, Protected
Planet link; no geometry columns are ever selected. Skipped with a status
line when GFW_API_KEY is missing. Live: the Sao Felix do Xingu bbox now
returns APA Triunfo do Xingu (352203, IUCN V), which OSM and LandMark lack.
Doctor tool-count edit reverted (owned on the orchestrator branch); the two
probes stay. 3 new offline tests from the live response (177 total).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017KN8pr3M1ayKPTNRcNSc2D
…atch-m3

# Conflicts:
#	src/doctor.ts
#	src/index.ts
- styles.css: tokenized design system (surfaces, hairlines, text scale,
  single interaction accent, semantic case-status + card-type tones, type
  scale on Inter/JetBrains Mono, 4pt spacing, radii, elevation, focus
  rings, ease-out motion tokens); reduced-motion + contrast variants;
  mobile layout at 390px (map above, feed below, no horizontal overflow).
- Header: brand + live telemetry (SSE state pill, time since last card,
  ledger size/last activity as the sweep heartbeat).
- Feed: generic card chrome every type inherits (type dot + label, clock,
  2-line title, bbox footer with "Show on map", active-card edge tied to
  the map); sticky type-filter chips with counts; enter = fade + 6px
  (240ms ease-out, @starting-style), FLIP push-down of siblings, held
  scroll position + "N new" pill when reading mid-list, staggered reveal
  of the SSE replay burst; teaching empty state. No innerHTML with data.
- Charts: nice-tick gridlines + labels, zero line, labelled legend with
  latest value, dashed thresholds, end marker, area wash for one-signed
  series, crosshair tooltip; world-pulse tiles get sparklines.
- Watch: case list with status filters and ledger strip (root + copy),
  skeletons, case page with lifecycle stepper, evidence, context
  (baseline ring stat, ENSO, notes), blind spots, right of reply,
  history timeline, and a Verify panel (checkpoint, root, inclusion
  proof, `earthdeck ledger verify`); Escape returns to the list.
- Ship Emil Kowalski's design-engineering skills under .agents/skills
  (+ .claude/skills symlinks, skills-lock.json).
- Before/after screenshots in docs/screenshots/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017KN8pr3M1ayKPTNRcNSc2D
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017KN8pr3M1ayKPTNRcNSc2D
…/planet groups

- biodiversity (GBIF, zero-key): records by kingdom incl. Fungi, distinct/top species,
  IUCN-threatened species, licence facet, recent-record markers, and an explainable
  0-100 score (richness, density, threatened share, kingdom evenness) with a method
  block and blind spots - labelled sampling-effort dependent.
- species (GBIF + OpenTree TNRS): taxonomy breadcrumb, English name, IUCN category,
  occurrence counts worldwide / in a bbox, OTT id. Works for animals, plants, fungi.
- coral_bleaching (NOAA Coral Reef Watch NOAA_DHW via ERDDAP): DHW, SST anomaly,
  Bleaching Alert level, strided series + peak, optional box stats.
- world_pulse: 12 new live-verified OWID indicators (Living Planet Index, Red List
  Index, fish stocks, MPAs, tree cover loss, ocean pH, agri land, nitrogen, pesticides,
  freshwater, plastic, ODS), civilization/life/planet groups + groups param, per-
  indicator flatPct (pH is log-scale), parser support for daily/no-code charts.
- Dashboard: grouped world-pulse card, kingdom marker colours. Offline tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017KN8pr3M1ayKPTNRcNSc2D
…atch-m3

# Conflicts:
#	src/clients/owid.ts
#	src/index.ts
#	src/watch/kernel.ts
#	test/owid.test.ts
#	web/src/cards.ts
#	web/src/styles.css
@marcoloco23
marcoloco23 marked this pull request as ready for review September 26, 2026 18:36
@marcoloco23
marcoloco23 merged commit afd840f into main Sep 26, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant