Repository navigation
TerraKeep: site v4 (map modes, metrics, in-map cases), marine + good-news rules, public reply wall, QA - #8
Merged
Merged
Conversation
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017KN8pr3M1ayKPTNRcNSc2D
…og card The static world image stays as the first paint; a lazy `explore` chunk (MapLibre 5.8 globe, GIBS Blue Marble + OSM labels via GIBS, OpenFreeMap fallback) upgrades it in place on hover/tap/focus or after idle. Layer toggles (status, case type), click-to-open card with list <-> map highlight, keyboard (arrows / Enter / Esc), time window + scrubber + replay that drive the stats strip, `#map:` share links (versioned, fail-closed, clamped), keyless search over watched places + coordinates, a Whole Earth mode that restores the previous view, and per-case GFW alert + HLS before/after overlays that degrade silently. The export writes api/map.json (src/watch/map-data.ts). Icons: favicon.ico (16/32/48) + favicon.svg, apple-touch-icon, icon-192/512, site.webmanifest, JSON-LD Organization.logo, and og.png with the wordmark and slogan (scripts/site-icons.mjs, one-off). The dashboard map reuses the globe + easing. Research: docs/research/2026-09-27_gods-eye-view-map.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017KN8pr3M1ayKPTNRcNSc2D
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017KN8pr3M1ayKPTNRcNSc2D
…ist (30 AOIs) Widen Earth Watch from forests/fires/flares to the zero-key indicators the repo already ingests. - indicator_threshold@1.0 (tier 1): one rule, params.indicator picks sea_ice (NSIDC < p10), marine_heatwave (OISST anomaly vs same season of the last 10 y), river_discharge (GloFAS ≥ 2× period mean, optional seasonal gate; EONET flood or persistence confirms), air_quality (CAMS PM2.5 > WHO 15 for ≥ 3 full days), enso (ONI event definition; Niño3.4 OISST confirms) and quake (USGS M ≥ 7; USGS reviewed + sig confirms, independence "method"). - indicator_trend@1.0 (tier 1): new annual world_pulse value continuing a worsening/improving 10-year trend → one case per indicator-year (one AOI per indicator, cooldownDays 1, ledger_list guard so a year never re-opens); confirmed by an unchanged later read (method). - Ledger contract: independence gains "method" (same provider, different check); JSON schema regenerated. - Tools: air_quality gains pastDays + pm25Daily (forecast hours excluded); USGS rows carry sig + status; world_pulse rows carry previous. - watchlists/indicators.json (30 AOIs), added to the runner's hand-written set. - Tests on fixtures recorded live 2026-09-27; README rows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017KN8pr3M1ayKPTNRcNSc2D
…er watchlist, map layers, source catalogue - weather_now: Open-Meteo forecast (past 7 d + 7-day) with each day's max vs the ERA5 1991-2020 normal (30 one-year windows, models=era5) and ERA5's own reading of elapsed days - storms: NHC/CPHC CurrentStorms + tropical MapServer (points, generalized cone) and GDACS for other basins, EONET severe-storm cross-check, GeoJSON for the map - weather_extreme@1.0 (tier 0): heat -> ERA5 or persistence; cyclone cone over AOI -> EONET; extreme rain -> GloFAS >= 2x or persistence; blind spots stated - watchlists/weather.json: 12 cities (per-climate thresholds) + 6 cyclone regions - web/src/layers/weather.ts: addLayer(map, spec) / mountLayerToggles for GIBS clouds, IMERG rain, RainViewer radar (local only), wind arrows, storm cones; wired into the dashboard - docs/research/2026-09-27_live-data-sources.md: God's Eye View + existing sources catalogue - watch.test: keyless rules may declare requires: [] Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017KN8pr3M1ayKPTNRcNSc2D
…atch-m3 # Conflicts: # README.md # src/watch/rules/index.ts # test/watch.test.ts # web/src/map.ts
… grassland With GEE configured, natural_value takes land cover from MapBiomas (bbox inside Brazil, Collection 10 / 2024, ≥90 % pixel coverage) or Dynamic World (6-month mode) before falling back to CLMS/CDSE and the latitude assumption. Pasture, crops, mosaic, urban, mining and bare land are "converted": excluded from the living value and reported as convertedHa (cropland/urban Costanza values shown as a separate reference only; pasture has no sourced ESV → 0). landCover now carries provider, class shares with use/biome/basis, naturalHa/convertedHa; blind spots are provider-specific (MapBiomas year lag, DW probabilistic and its grass class still including pasture). forest_loss: Brazil AOIs with GEE add "the watch area is X % converted land (MapBiomas 2024)" to context notes and watch_area_converted_pct to values; the lost area is still valued as forest. Without GEE the output is identical to before apart from landCover.provider (snapshot test). Live São Félix [-52.4,-6.9,-51.9,-6.4]: $1.98B/yr (CLMS) → $1.02B/yr (MapBiomas; 175,829 ha converted, 56 % pasture). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017KN8pr3M1ayKPTNRcNSc2D
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017KN8pr3M1ayKPTNRcNSc2D
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017KN8pr3M1ayKPTNRcNSc2D
…arth Engine, new keys) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017KN8pr3M1ayKPTNRcNSc2D
…aic + OpenFreeMap labels) Shared web/src/layers/basemap.ts for the public explorer and the dashboard map: - z0-9 NASA GIBS VIIRS SNPP true colour, last complete UTC day (public domain) - z6-8 crossfade to EOxCloudless 2025 (10 m, maxzoom 14, CC BY-NC-SA 4.0, EOX attribution verbatim) - OpenFreeMap place names + thin roads from z10 (OpenMapTiles, OSM ODbL); no full style fetched - corner caption per zoom so the mosaic is never read as today's image - basemaps() entries may set requiresKey; Esri World Imagery z14+ waits behind ARCGIS_API_KEY Sources footer lists EOX and OpenStreetMap/OpenFreeMap. Screenshots at z3/z9/z13. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017KN8pr3M1ayKPTNRcNSc2D
…SM (GEE key file stored as inline JSON) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017KN8pr3M1ayKPTNRcNSc2D
…cline, bleaching relief, clean air, fires absent) One tier-1 rule parameterised by params.kind, tag `improvement`, same evidence standard (detect + persistence/independent confirmation + blind spots). - forest_recovery: GFW alerts <= 30 % of the same window a year earlier and below the 25 km ring (windows end 14 d back for alert lag); confirm = next 30 d still low (revisit) or S2 median NDVI held year on year (sensor, CDSE confirmRequires) - flaring_decline: VNF annual BCM -30 % (1-transaction registry check first) and fewer NOAA-21 hot night detections than a year ago; confirm = next window - bleaching_relief: CRW BAA >= 1 in 90 d, now 0 for >= 14 d; confirm = later day - air_quality_clean: 7-day PM2.5 mean < WHO after 7 days above; confirm = later day - fires_absent: no NOAA-21 hot cluster this season where one burned last year, sensor alive within 100 km; confirm = next sweep still none Watchlists: good-news.json (4 reefs, 6 cities, 6 protected areas) + improvement pairs on amazon.json (4) and flaring.json (3); runner WATCHLISTS += good-news. Analyst: improvement-tagged findings form one round-robin group and lead round 1. Tools/clients: forest_alerts endDate, air_quality pastDays <= 16, flaring vnf.previous.bcmTotal, and parseVnfKml now reads scientific notation (the 2023 VNF file's 2.67e-05 BCM sites were read as 2.67 — 1604 vs 161 BCM global). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017KN8pr3M1ayKPTNRcNSc2D
… bleaching_relief minPeakLevel defaults to Alert Level 1 (3) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017KN8pr3M1ayKPTNRcNSc2D
…list, fishing/ship-density export + map layers
- src/clients/gfwfishing.ts: GFW 4Wings report client (always grouped by FLAG/GEARTYPE;
ungrouped reports return per-vessel rows), allow-list parser, attribution
- src/tools/marine.ts: fishing_activity (bbox or WDPA mpaId, clip box, aggregated only)
- quota: gfw_fishing provider (default 200/day, EARTHDECK_MAX_GFW_FISHING_CALLS)
- rules/mpaFishing.ts: tier 2; polygon-clipped hours per tile; confirm by inset/revisit
- watchlists/marine.json: 16 no-take/strict MPAs, 50 tiles <= 25 deg2; runner list + tests
- src/clients/ais.ts + watch/marine-export.ts: runner-side GFW grid and 20 s aisstream
density sample -> api/marine/{fishing,ships}.json (cached, key-gated, no identities)
- web/src/layers/marine.ts: heatmap + density layers, registerLayerGroup
- tests: live-recorded fixtures (AIS identities pseudonymised), privacy test
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017KN8pr3M1ayKPTNRcNSc2D
… five modes, cases open in place Landing: full-bleed MapLibre globe under a slim header, loading at once (static night image stays as the no-JS/slow fallback). Floating glass panel (bottom sheet with peek/half/full snaps on a phone) with Cases · Planet · Live · Metrics · About; the three numbers become chips on the map. Mode, panel, filters, metric, live layers and the open case live in the URL hash (#case=<id> for an open case). - Cases: status + topic filter chips (the legend), list from api/map.json; a click flies to the case, outlines it, turns on its overlay and shows the full case in the panel (its own server-rendered article); Back/Esc return. Case pages send JS readers into the map; crawlers/no-JS keep the page, now map-first (>=52vh). - Markers: GeoJSON clusters with per-status sums, colour by status, ring by topic, published larger, hover headline. Planet-wide cases (wp-*, sea ice, ENSO, half- globe boxes) are never markers — they live in Planet. - Planet: world-pulse sparklines + planet-wide cases; the map suggests ocean heat (GHRSST MUR anomaly). Live: toggles from a layer registry (web/src/layers/registry.ts; modules in web/src/layers register themselves) — weather (clouds, IMERG rain, wind, cyclone cones from api/storms.json) + climate. - Metrics: api/metrics.json (src/watch/metrics.ts) — totals, cases opened over time, top places, false-alarm rate per rule, stakes with the case ids behind each (click filters list + fits map). - weather.ts clouds: last complete GIBS day instead of today's black 'default'. Weight: landing HTML+CSS+JS ~57 KB gz before the map chunk (~280 KB gz). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017KN8pr3M1ayKPTNRcNSc2D
…4 and good-news rule Resolved WATCHLISTS/test pins and rules index by keeping both; marine.ts now self-registers with the site layer registry so "Oceans & ships" shows in Live. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017KN8pr3M1ayKPTNRcNSc2D
…o23/earthdeck into worktree-agent-a9f72738b324a8a68
…o23/earthdeck into worktree-agent-a7021f6dd5e55988e
- Intake: earthdeck-reply Lambda (same zip, dist/runner/reply-lambda.handler) behind a
Function URL (auth NONE, CORS = site origin, POST /reply). Text 20-2000 chars, HTML
stripped, no email/@handle/phone/URL, honeypot, role enum, case must be public
(replies/cases.json written by the export step), 5/day per salted IP hash; raw IP
never stored. Stored as replies/inbox/<caseId>/<ulid>.json.
- Review: the analyst screens up to 50 inbox replies per run with the reviewer model
(strict {accept, reason, flags} verdict, any flag rejects), inside the daily $ budget.
Accepted -> replies/public/ + new `commented` ledger event (text hash only; `replied`
still requires a notice). Rejected -> replies/rejected/ with the verdict.
- Show: export writes api/replies/<caseId>.json and renders replies + form mount under
every public case (panel + static page); form built by web/src/site/reply.ts.
- Remove email: header "Reply" link gone, copy rewritten; runner no longer forwards
--contact. deploy.sh creates /earthdeck/REPLY_SALT once.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017KN8pr3M1ayKPTNRcNSc2D
…rker hits, reply form, site prune - Replay/Copy link/number chips: fixed-width slots + tabular numerals, nothing shifts - Topics: mpa_fishing -> Oceans; improvement, flaring_stopped and improvement-tagged cases -> Good news; quake -> Earthquakes; tests fail on any rule/indicator mapping to Other (and in the export) - Panel: a wheel over the head/tabs scrolls the panel body, never the page - indicator_threshold: blind spots filtered to the case's indicator (rule side for new cases, render side for existing ledger entries) - Fishing heatmap: wider kernel + intensity at z<=3 - Map dots: screen-space picking (12 px) instead of MapLibre's globe hit-test, which shrank toward the limb; cluster click always zooms in visibly; Playwright e2e (pnpm test:e2e) - Reply form: "Someone else" preselected with an explicit prompt, reserved error line, aria-invalid, honest "reviewed a few times a day" message - Runner: export upload deletes stale api/ and watch/ objects (never ledger/, other prefixes, or assets/) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017KN8pr3M1ayKPTNRcNSc2D
…o23/earthdeck into worktree-agent-acc0bc32ff441c705
…eply wall, QA) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017KN8pr3M1ayKPTNRcNSc2D
…only) Headline links matched by place + rule topic, title-filtered for relevance, cached 12 h per case under <ledger>/news, paced 5.5 s, capped per export (EARTHDECK_MAX_GDELT_CALLS, default 40), stops on rate limit. Rendered on the case page (and thus the map panel) with a context-not-evidence note; api/news/<id>.json. Off by default in exportSite(); CLI on unless --no-news. Never fed to the analyst. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017KN8pr3M1ayKPTNRcNSc2D
…ges) Co-Authored-By: Claude Fable 5.1 <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 brief on the site - src/watch/situation.ts: level quiet/watch/urgent from fixed, tested criteria over the ledger (7 d) and ONI / NSIDC sea ice / world pulse; reasons point at case ids/indicators; dossier, rules-only fallback, storage in <ledger>/situation/<date>.json (30 days), kept outside the Merkle ledger (events need a findingId). - src/analyst/situation.ts: Opus drafts strict JSON, faithfulness + no-persons + known-id checks, Sonnet accepts/rejects; any failure → rules-only text. One model briefing per UTC day, skipped when the dossier hash is unchanged, spend counted in the analyst budget. CLI: --no-situation / --situation-only. - export: api/situation.json + api/situation/<date>.json (rejected drafts stripped); landing strip over the map, briefing at the top of Planet with "why this level", static copy below the fold. TRUST.md documents the criteria. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017KN8pr3M1ayKPTNRcNSc2D
…in a 5° box Flaring, flaring_stopped and improvement cases never make Urgent (they can still make Watch via the 7-day rule); chronic indicators (sea ice, ENSO) don't count either. TRUST.md and tests updated. Co-Authored-By: Claude Fable 5.1 <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
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017KN8pr3M1ayKPTNRcNSc2D
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Everything since PR #7, all live on https://vitalearth.io.
Site v4
#case=<id>), static case pages keep SEO and redirect JS readers.src/watch/metrics.ts→api/metrics.json): totals, cases/day, false-alarm rate per rule, what's at stake.pnpm test:e2e), cluster zoom ≥ 1.5, indicator blind spots filtered per indicator, topic chips (Good news, Oceans, Quakes — never "Other").Rules & data
indicator_threshold,indicator_trend,weather_extreme+ watchlists.mpa_fishing@1.0(GFW 4Wings, effort inside the reserve boundary; grouped only, never per-vessel) +fishing_activitytool +watchlists/marine.json.improvement@1.0(forest_recovery, flaring_decline, bleaching_relief, air_quality_clean, fires_absent) +watchlists/good-news.json; analyst rotation slot for good news.gee_query), MapBiomas/Dynamic World fornatural_value(pasture = converted).Public reply wall (replaces email replies)
earthdeck-replyLambda behind a Function URL: validation (length, no email/phone/URL, honeypot), 5/IP/day via salted hash, writesreplies/inbox/.replies/public/+commentedledger event (text hash only) orreplies/rejected/.api/andwatch/files.Infra
Tests: 432 offline + 1 e2e. Site stays anonymous (grep test).
🤖 Generated with Claude Code
https://claude.ai/code/session_017KN8pr3M1ayKPTNRcNSc2D