Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
8ce91bf
CONTINUITY: indicator-threshold + trend rules at the top of the queue
marcoloco23 Sep 27, 2026
363daeb
site: interactive MapLibre globe on landing + cases index, icon set, …
marcoloco23 Sep 27, 2026
5961df3
Merge branch 'feat/site-map-v3' into worktree-earth-watch-m3
marcoloco23 Sep 27, 2026
cd1dc04
runner: serve site.webmanifest as application/manifest+json
marcoloco23 Sep 27, 2026
a8416d8
watch: indicator_threshold + indicator_trend rules, indicators watchl…
marcoloco23 Sep 27, 2026
ca144ac
Merge branch 'watch/indicator-rules' into worktree-earth-watch-m3
marcoloco23 Sep 27, 2026
6931b8a
weather slice: weather_now + storms tools, weather_extreme@1.0, weath…
marcoloco23 Sep 27, 2026
84a82a7
Merge branch 'worktree-agent-a5f5f4b304bc1f077' into worktree-earth-w…
marcoloco23 Sep 27, 2026
65bf588
natural_value: land USE from Earth Engine — pasture is converted, not…
marcoloco23 Sep 27, 2026
aab8fca
Merge branch 'worktree-agent-ac2beb0ef19474646' into worktree-earth-w…
marcoloco23 Sep 27, 2026
2de194e
runner: include the weather watchlist in scheduled hand-written sweeps
marcoloco23 Sep 27, 2026
c3ec6b4
test: seven hand-written watchlists (weather added)
marcoloco23 Sep 27, 2026
725d947
CONTINUITY: 2026-09-27 state (map v3, indicator/weather rules live, E…
marcoloco23 Sep 27, 2026
f40bfa3
map: zoom-dependent keyless basemap (GIBS daily -> EOX Sentinel-2 mos…
marcoloco23 Sep 27, 2026
81866e9
deploy: ship GFW fishing, aisstream and Earth Engine credentials to S…
marcoloco23 Sep 27, 2026
358d6fc
watch: improvement@1.0 — good-news cases (forest recovery, flaring de…
marcoloco23 Sep 27, 2026
c195c50
improvement: NDVI confirmation opt-in (confirmWithNdvi, default off);…
marcoloco23 Sep 27, 2026
13bd358
Merge branch 'worktree-agent-a7df1eda8b98d75d8' into worktree-earth-w…
marcoloco23 Sep 27, 2026
9effed6
marine: GFW fishing_activity tool, mpa_fishing@1.0 rule, marine watch…
marcoloco23 Sep 27, 2026
a8d65f4
site: the map is the product — full-screen globe, floating panel with…
marcoloco23 Sep 27, 2026
757ce7e
Merge branch 'worktree-agent-aef6b1b9abddd3e8e' into worktree-earth-w…
marcoloco23 Sep 27, 2026
ea5239d
Merge marine watch (fishing/ships layers, mpa_fishing rule) with UI v…
marcoloco23 Sep 27, 2026
cf242ef
Merge branch 'worktree-earth-watch-m3' of https://github.com/marcoloc…
marcoloco23 Sep 27, 2026
e745ba2
Merge branch 'worktree-earth-watch-m3' of https://github.com/marcoloc…
marcoloco23 Sep 27, 2026
7a323e6
Replace the email reply channel with a public, model-screened reply wall
marcoloco23 Sep 27, 2026
e6d7a8e
WIP ui qa
marcoloco23 Sep 27, 2026
f1b5321
Merge worktree-earth-watch-m3 (reply wall)
marcoloco23 Sep 27, 2026
67bdc84
UI v4 QA pass: stable time bar, topics, panel scroll, blind spots, ma…
marcoloco23 Sep 27, 2026
e2d61ff
Merge branch 'worktree-earth-watch-m3' of https://github.com/marcoloc…
marcoloco23 Sep 27, 2026
ae9b5b6
CONTINUITY: 2026-09-27 afternoon state (site v4, marine, good-news, r…
marcoloco23 Sep 27, 2026
698a2e7
watch export: "In the news" per decided case (GDELT DOC 2.0, context …
marcoloco23 Sep 27, 2026
c4b5508
Merge worktree-earth-watch-m3 (replies wall + news section on case pa…
marcoloco23 Sep 27, 2026
b52b058
CONTINUITY: news section deployed but unproven (GDELT 429)
marcoloco23 Sep 27, 2026
c3777b4
Situation: daily level by rules + reviewed briefing (analyst), strip …
marcoloco23 Sep 27, 2026
d90c9fa
Situation: regional cluster counts only acute rules, 3 distinct AOIs …
marcoloco23 Sep 27, 2026
b2b0d8c
site: move the map toolbar down when the Situation strip is shown
marcoloco23 Sep 27, 2026
ead593a
CONTINUITY: Situation briefing live
marcoloco23 Sep 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ test → build on every push/PR.
| `CDSE_CLIENT_ID` / `CDSE_CLIENT_SECRET` | `eo_search`, `eo_render`, `eo_index`, `eo_compare` | Free Copernicus Data Space OAuth client |
| `FIRMS_MAP_KEY` | `fires_in` | Free NASA FIRMS map key |
| `GEE_SERVICE_ACCOUNT_JSON` / `GEE_PROJECT` | `gee_query` | Earth Engine service-account key (path or inline JSON) + EE-registered Cloud project — see `docs/research/2026-09-26_google-earth-engine.md` |
| `GFW_FISHING_TOKEN` | `fishing_activity`, rule `mpa_fishing`, `api/marine/fishing.json` | Global *Fishing* Watch API v3 token (non-commercial terms; not the Global *Forest* Watch `GFW_API_KEY`). Daily cap `EARTHDECK_MAX_GFW_FISHING_CALLS` (default 200) |
| `AISSTREAM_KEY` | `api/marine/ships.json` (export only) | aisstream.io websocket key — runner-side 20 s sample, aggregates only; never shipped to the browser |
| `EARTHDECK_MAX_GDELT_CALLS` | `watch export` "In the news" | GDELT DOC lookups per export (default 40; zero-key, paced ≤1 req/5.5 s, 12 h cache; `--no-news` disables) |
| `EARTHDECK_DASHBOARD_URL` | card push target | default `http://127.0.0.1:5005` |
| `EARTHDECK_DASHBOARD_PORT` | dashboard server | default `5005` |

Expand Down
69 changes: 66 additions & 3 deletions CONTINUITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,16 @@ reference is [CLAUDE.md](CLAUDE.md); the phase plan is [ROADMAP.md](ROADMAP.md).
$71/yr, refund refused by AWS, auto-renew OFF; Marc dislikes the name but uses it since
it's paid). The public name is the neutral **"Earth Watch"** (`src/site.config.ts`);
"Vital Earth" is a taken trademark. **The site is anonymous**: no owner name, email or
GitHub handle anywhere (test in `test/site-export.test.ts` fails on any); right of reply
has no channel yet (a forwarding mailbox on the domain is a follow-up). Do NOT register
GitHub handle anywhere (test in `test/site-export.test.ts` fails on any). Right of reply =
the **public reply wall** (2026-09-27; no email, nobody reads an inbox): `earthdeck-reply`
Lambda behind a Function URL (`POST /reply`, src/replies/intake.ts) → `replies/inbox/`;
the analyst's reviewer (Sonnet) screens ≤ 50/run → `replies/public/` (+ `commented` ledger
event, text hash only) or `replies/rejected/`; the export renders them + the form
(`--reply-url` = stack output ReplyUrl, set on the runner as EARTHDECK_REPLY_URL).
deploy.sh creates `/earthdeck/REPLY_SALT` once. LIVE since 2026-09-27 (end-to-end
tested: Marc's test reply accepted by the reviewer, then removed by hand = delete the
`replies/public/<case>/<id>.json` object + export; the export now deletes stale site
files under api/ and watch/). Do NOT register
or buy anything without showing Marc the exact item + price first. IPv6 is disabled on
CloudFront on purpose (AAAA-only resolver answers broke the fresh domain on IPv6-less
networks); Tailscale MagicDNS on Marc's Mac negative-cached the name for an hour.
Expand All @@ -52,6 +60,21 @@ reference is [CLAUDE.md](CLAUDE.md); the phase plan is [ROADMAP.md](ROADMAP.md).
(new stack + migrate state, or keep internal names); domain (registration only after
trademark check + Marc's explicit OK on the exact name + price); README/CLAUDE/VISION;
`checkpoint` signer name stays "earthdeck" unless the key is rotated. Do it in one PR.
2a. **2026-09-27 state**: interactive MapLibre globe on the public site (click-to-case, URL
share links, time scrubber + replay, Whole-Earth mode, offline search, GFW-alert and
before/after overlays, weather layers: clouds, satellite rain, wind, cyclone cones);
favicon/og/manifest set. New rules live on AWS: `indicator_threshold` (sea ice, marine
heatwave, rivers w/ seasonal gate, PM2.5, ENSO, M7+ quakes), `indicator_trend` (annual
LPI/RLI/fish/pH/tree-loss/MPA, one case per indicator-year), `weather_extreme` (heat,
cyclone cone via NHC+GDACS→EONET, extreme rain); watchlists `indicators.json` (30) and
`weather.json` (18) in the scheduled hand-written sweep. First real sweep opened 14 cases.
`natural_value` now uses MapBiomas (Brazil) / Dynamic World via **Earth Engine** (project
mystic-hull-373410, service account terrakeep-ee, key `~/.config/vital/gee-key.json`,
Community tier, non-commercial until 2028-03-27) — pasture = converted, São Félix
$1.98bn → $1.02bn/yr. **Keys added to .env** (not yet in SSM/Lambda): GEE_*, GFW_FISHING_TOKEN
(Global Fishing Watch, non-commercial), AISSTREAM_KEY — the GEE path on Lambda needs the key
content in SSM (deploy.sh + runner change) before forest findings get the MapBiomas note there.
Next queued: ships (aisstream) + fishing effort (GFW) as map layers and an MPA-fishing rule.
2b. **Scale-out state (2026-09-26 late)**: `earthdeck discover` generates 549 AOIs
(`watchlists/generated/`, 19 API calls, 53 s; re-run every ~14 days — doctor warns when
stale). Runner sweeps `all-generated` in 8 shards per 6-h window (13.5-min budget each),
Expand All @@ -62,7 +85,47 @@ reference is [CLAUDE.md](CLAUDE.md); the phase plan is [ROADMAP.md](ROADMAP.md).
when spent — detection always runs. TODO: measure Copernicus PU per `eo_compare`/S5P
call (free tier 10k PU/month) and set the cap from data. Name: **TerraKeep**, slogan
"Keeping Earth within its limits." — package/repo/stack rename still pending (3b).
3c. **Queued by Marc 2026-09-26 (in this order, one at a time — "take it slowly")**:
2c. **2026-09-27 afternoon state (all LIVE on vitalearth.io, branch `worktree-earth-watch-m3`,
432 tests)**: site v4 = full-screen globe + floating panel with modes Cases / Planet /
Live / Metrics / About (`web/src/site/{hub,panel}.ts`, `map/explore.ts`); click-to-case
stays in-map (`#case=<id>`, static case pages redirect JS readers, crawlers get the page);
Metrics from `src/watch/metrics.ts` → `api/metrics.json`; layer registry
(`web/src/layers/registry.ts`, every module in layers/ self-registers). Marine:
`fishing_activity` tool (GFW 4Wings, grouped only — never per-vessel), `mpa_fishing@1.0`
rule (effort inside the reserve's legal boundary), `watchlists/marine.json` (16 reserves,
50 tiles), runner export `api/marine/{fishing,ships}.json` (keys only on the runner).
First sweep: Phoenix Islands ×2 + Galápagos confirmed — both allow some licensed fishing,
watch the reviewer. `improvement@1.0` rule (forest_recovery, flaring_decline,
bleaching_relief ≥ NOAA Alert Level 1, air_quality_clean, fires_absent; NDVI confirmation
opt-in `confirmWithNdvi`), `watchlists/good-news.json`; topic "Good news" chip (also
flaring_stopped). VNF parser bug fixed (sci-notation inflated 2023 totals 10×). QA pass:
fixed-width replay/caption/chips, panel-internal scroll, indicator blind spots filtered to
the case's indicator, globe hit-test fix (nearest dot ≤ 12 px; `pnpm test:e2e`
Playwright), cluster zoom ≥ 1.5. SSM now has GFW_FISHING_TOKEN, AISSTREAM_KEY, GEE_*,
REPLY_SALT. "In the news" per case (GDELT DOC 2.0 keyword search, `src/clients/gdelt.ts`,
`src/watch/news.ts`, `api/news/<case>.json`, context not evidence, `--no-news` to disable)
is merged and deployed but UNPROVEN: GDELT answered 429 to the first call from Lambda and
from the worker's Mac, so no real case has headlines yet; it fails soft (one 429 stops the
export's lookups, cache 12 h). If it keeps failing or returns junk, add `--no-news` to the
runner's export args. **Situation briefing** (LIVE 2026-09-27): `src/watch/situation.ts`
computes level quiet/watch/urgent by fixed rules (TRUST.md "The daily Situation"; the
3-in-a-region rule counts only acute rules, never flaring/good news, 5° box, 3 distinct
AOIs); analyst job writes one Opus briefing/day reviewed by Sonnet (≈$0.10), stored as
`situation/<date>.json` beside the ledger (not in the Merkle tree), fallback = rules-only
text; export → `api/situation.json`; site strip above the map + top of Planet mode.
Today: Watch (sea ice both poles p10, 50 confirmations/7 d). Known nits: attribution bar
overlaps the Replay button in Planet mode when the ocean-heat layer is on; old situation
files may not be deleted from S3. Open with Marc: keep running after Mon 08:03 stop (session cron),
analyst cap 20, SNS email confirm, rotate aisstream key (was pasted in chat), hide Live
toggles whose data file is missing, old `assets/` bundles never deleted.
3c. **Queued by Marc 2026-09-26/27 (in this order, one at a time — "take it slowly")**:
-1. **Indicator-threshold rule** (2026-09-27, top of queue, in progress): one generic rule
`indicator_threshold@1` over the existing zero-key indicator tools — sea ice below
p10 (NSIDC), marine heatwave at a reef/coast point (OISST), river discharge > 2× mean
(GloFAS), PM2.5 > WHO for N days in watched cities (CAMS), ENSO phase declared (ONI),
M7+ quake in a watched region (USGS) — case type "threshold crossed", second signal =
persistence (next window) or a second dataset. Plus a **trend rule** for annual
indices (LPI, RLI, fish stocks, ocean pH): one case per year per indicator.
1. **Backtest harness** — `earthdeck backtest --event <file>`: replay rules with the clock
set to a past date for 8–10 documented events (2019 Amazon fires, 2020 Black Summer,
2023 Canada, 2023 Maui, Rumaila flaring 2024, São Félix 2025 loss, Permian methane
Expand Down
29 changes: 27 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ Then just ask: *"What's the state of the planet right now?"* · *"Is El Niño co
| `climate_history` | How a place's climate changed: ERA5 temperature/precip/wind, annual trend per decade | 1940→ |
| `air_quality` | PM2.5 / PM10 / O₃ / NO₂ / US AQI for any point (Copernicus CAMS), WHO-guideline flags | 48 h |
| `river_discharge` | Daily river flow at any point (GloFAS) — flood/drought signal vs the period mean | 1984→ |
| `weather_now` | Weather now + past week + 7-day forecast for any point (Open-Meteo): max/min, feels-like, rain, wind — each day's max vs the ERA5 1991–2020 normal, plus ERA5's own independent reading of the elapsed days | now ± 7 d |
| `storms` | Every active tropical cyclone: NOAA NHC/CPHC advisories (position, Saffir–Simpson category, forecast track + cone) and GDACS for the other basins, cross-checked with NASA EONET; optional bbox / min category | live |
| `earthdata_search` | Discover datasets across NASA's full Earth-science archive (~50k collections, CMR) by topic/bbox/time | catalog |
| `world_pulse` | Vital signs in three groups — civilization, life (Living Planet Index, Red List Index, fish stocks, protected areas, tree cover loss), planet (ocean pH, nitrogen, pesticides, water, plastic, ozone) — each improving/worsening/flat | per indicator |

Expand Down Expand Up @@ -171,13 +173,30 @@ primary signal, and marks it *confirmed* only when the rule's **independent seco
agrees (`forest_loss`: GFW alerts → NDVI drop in a Sentinel-2 median composite;
`fires_in_protected`: VIIRS cluster → EONET event or re-detection on a later pass;
`flaring`: night-time heat persisting ≥ N nights → a VNF annual flare site or a later pass).
`methane_anomaly` (tier 2): Sentinel-5P CH₄ anomaly vs 90 days → EMIT plume in the AOI).
`methane_anomaly` (tier 2): Sentinel-5P CH₄ anomaly vs 90 days → EMIT plume in the AOI;
`weather_extreme` (tier 0, `watchlists/weather.json`): heat over a city's bar for ≥ 2 days → ERA5 agrees or it
persists; a category ≥ 1 cyclone cone over a region → NASA EONET; ≥ 150 mm/day → GloFAS discharge ≥ 2× or persistence).
Two zero-key tier-1 rules widen the watch beyond forests and flares
(`watchlists/indicators.json`, 30 AOIs):

| Rule · `indicator` | Crosses the line when… | Confirmed by |
| --- | --- | --- |
| `indicator_threshold` · `sea_ice` | NSIDC daily extent (Arctic / Antarctic) is below the 1981–2010 p10 for the day | a later day still below p10 (revisit) |
| `indicator_threshold` · `marine_heatwave` | OISST at a reef/sea point is ≥ `minAnomalyC` (1.5 °C) above the same season of the last 10 years for ≥ `minDays` (5) | a later day still that warm (revisit) |
| `indicator_threshold` · `river_discharge` | GloFAS discharge ≥ `ratio` (2×) the 10-year mean (optionally also ≥ `minSeasonalRatio` × the same month) | an EONET flood within 200 km (provider), else a later day still high |
| `indicator_threshold` · `air_quality` | CAMS PM2.5 daily mean > the WHO 15 µg/m³ guideline for ≥ `minDays` (3) full days | a later full day still above (revisit) |
| `indicator_threshold` · `enso` | ONI meets NOAA's event definition (≥ 5 seasons beyond ±0.5 °C) — one global case per event | OISST at the Niño3.4 centre has the same-sign anomaly (method) |
| `indicator_threshold` · `quake` | USGS M ≥ `minMagnitude` (7.0) inside the AOI box | USGS marks it reviewed with `sig` ≥ `minSig` (600) — same provider (method) |
| `indicator_trend` | a new year's value of an annual world-pulse indicator (Living Planet Index, Red List Index, fish stocks, ocean pH, tree cover loss, marine protected areas) continues a worsening — or improving (tag `improvement`) — 10-year trend | the same value on a later read (method: data stability) |

`indicator_trend` runs one AOI per indicator (`wp-<name>`, `cooldownDays: 1`) and reads its
own earlier cases via `ledger_list`, so each indicator-year opens exactly one case, ever.
Every rule must declare its **blind spots** and keeps a **regional baseline** (the AOI vs
its neighbourhood ring — "did it stop, or did it move?"); every finding carries **context**
(ENSO phase, nearby EONET events). Watermarks make late or missed runs self-heal; failures
are recorded as coverage gaps, never silence. **Control AOIs** (expected quiet) measure our
own false-positive rate. Needs `GFW_API_KEY` + CDSE creds (forest) and `FIRMS_MAP_KEY`
(fires); pairs whose keys are missing are skipped, not failed.
(fires); pairs whose keys are missing are skipped, not failed. The indicator rules need no key.

**Triage from Claude** — `ledger_list`, `ledger_get`, `ledger_verify` (read) and
`ledger_advance`, `ledger_narrate`, `ledger_review`, `ledger_propose_attribution` (append)
Expand Down Expand Up @@ -386,6 +405,12 @@ Tests mock the network, so the whole suite runs with zero credentials — CI
- NOAA Coral Reef Watch CoralTemp v3.1 5 km products via CoastWatch / PacIOOS ERDDAP (free; credit NOAA CRW).
- Our World in Data (CC BY 4.0) for `world_pulse`; upstream producers and licences are listed per indicator.
- `natural_value`: CLMS Global Land Cover 2020, 10 m (© European Union, Copernicus Land Monitoring Service; DOI 10.2909/602507b2-96c7-47bb-b79d-7ba25e97d0a9; free and open, attribute and state modifications); ecosystem-service unit values from Costanza et al. (2014) and de Groot et al. (2012), organism values from Chami et al. (IMF) — cited per entry in the result.
- Weather: forecast data by [Open-Meteo.com](https://open-meteo.com/) (CC BY 4.0; ECMWF, DWD, NOAA models) with ERA5
(Copernicus Climate Change Service) normals; tropical cyclones from NOAA/NWS NHC & CPHC (U.S. public data,
[weather.gov/disclaimer](https://www.weather.gov/disclaimer)) and [GDACS](https://www.gdacs.org/) (UN OCHA / EC JRC,
provided as is); map overlays from NASA GIBS (VIIRS, GPM IMERG) and, on the local dashboard only,
[RainViewer](https://www.rainviewer.com/) radar (personal/educational use). Source catalogue with licences:
`docs/research/2026-09-27_live-data-sources.md`.
- Basemap & geocoding: NASA Blue Marble; OpenStreetMap Nominatim.
- Attribution: protected areas © OpenStreetMap contributors (ODbL) via Overpass; LandMark
Indigenous & community lands (CC BY-SA 4.0) via the GFW Data API; emissions from
Expand Down
37 changes: 37 additions & 0 deletions TRUST.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,43 @@ To name a responsible party (an operator, an owner):
a retraction, but they never publish or suppress a finding on their own. The evidence and
the rules above decide.

## The daily Situation — how the level is set

Once a day the site shows one level for the whole watch: **quiet**, **watch** or
**urgent**. The level is set by the fixed rules below, never by the AI. Each rule that
fires is listed under "Why this level", pointing at the cases or indicators behind it.

It is **urgent** if any of these is true:

- the El Niño / La Niña phase (NOAA's definition: five seasons in a row beyond ±0.5 °C)
was newly declared or changed this month, or an ENSO case was opened this month;
- an earthquake of magnitude 7 or more became a case in the last 48 hours;
- an extreme-heat or tropical-cyclone case was published in the last 48 hours;
- Arctic or Antarctic sea ice is below the lowest value ever recorded for that date;
- cases were confirmed within one day at three or more different watched places in the
same region (a 5° × 5° box). Only rules about something happening now count here: forest
loss, fires in protected land, extreme weather, methane, fishing inside marine reserves,
and the earthquake, marine-heatwave, river-flood and air-pollution indicators. Gas
flaring, flaring that stopped, and good-news cases never count toward urgent; they can
only raise the level to watch through the 7-day rule below.

It is **watch** if none of those holds but any of these does:

- at least one case was confirmed by a second, independent signal in the last 7 days;
- a world indicator just moved outside its usual range (above its 90th or below its 10th
percentile, when the reading before was inside);
- sea ice is in the lowest tenth of 1981–2010 for the date.

Otherwise it is **quiet**.

An AI then writes a short briefing from a fixed set of facts (the level and its reasons,
what changed since yesterday, new and good-news cases, the indicators, the false alarms we
caught). Every number in it must appear in those facts, it may not name people, and a
second, separate AI must accept it. If any of that fails, the site shows the rules' own
plain sentences instead. At most one AI briefing is written a day. The briefing is kept
next to the signed ledger for 30 days, not inside it: the ledger records only events on
individual cases.

## Changing these rules

Each publish entry names the policy it was made under. Changing the rules means a new
Expand Down
Loading
Loading