Skip to content

Civic Climate Action: refocus on a Porto Alegre "one real move" + funder view#6

Open
carlosgraffi wants to merge 9 commits into
mainfrom
hackday/2026-06-11/civic-climate-action-claude
Open

Civic Climate Action: refocus on a Porto Alegre "one real move" + funder view#6
carlosgraffi wants to merge 9 commits into
mainfrom
hackday/2026-06-11/civic-climate-action-claude

Conversation

@carlosgraffi

Copy link
Copy Markdown
Contributor

Iterates on the merged Civic Climate Action project: cuts the sprawl down to one honest spine for a single pilot city (Porto Alegre) and builds out the funder story.

Resident flow

  • Two-tap intake (worry → appetite) → one concrete, real move with the actual local channel (working URL), a "Why this helps" explainer, and "what happens next".
  • AI toolkit, two tabs: a clean ready-to-send message (PT/EN), and a "Guide me" civic-coach chat (what / how / why) — both grounded only in real channels + orgs (no invented contacts).
  • "I care about this" signature (name + neighborhood, optional email) → personalizes the message, tracks Committed → Sent → Got a response, and issues a saveable receipt.
  • Real partner organizations as next steps — Volunteer / Attend / Back a campaign / Donate — web-verified for Porto Alegre (AGAPAN, Bike Anjo, Parceiros Voluntários, BrazilFoundation, …).

Engagement signal + funder view

  • Public commitment wall, most-backed-actions ranking, and a Leaflet map of engagement by neighborhood.
  • /funders page: the co-benefit / de-risk / readiness thesis + a live readout by climate priority (mapped to CCRA risk) and by neighborhood, who can deliver, and what it unlocks.
  • pledgeStore reworked to named, status-tracked signatures with consistent seeded baselines; new /api/wall and /api/funders; emails never exposed in any response.

Green AI

Open-weight Mistral Small on Scaleway's low-carbon grid, per-call EcoLogits energy/CO₂e tracking shown in-UI, with a templated fallback when the model is offline.

Removed

The old multi-city machinery (explorer, map picker, HIAP action prioritization, readiness score, funder-brief). Adds a /stories page, top nav, and DEMO_SCRIPT.md.

Notes

  • Scoped to Porto Alegre; partner-org links are real/verified, energy theme has a labelled empty state.
  • .data/pledges.json (runtime store) is gitignored; demo numbers include a clearly-labelled seeded baseline.

🤖 Generated with Claude Code

mfonsecaOEF and others added 9 commits June 13, 2026 10:55
Part A — per-city actions (baked, no backend):
- Bake CityCatalyst's HIAP library (155 actions, EN/ES/PT) via a committed
  fetch script (climateActions.generated.ts); we prioritize per city ourselves
  since the per-city ranking endpoints aren't populated in prod.
- prioritize.ts + hazardNormalize.ts: rank actions by matching each city's CCRA
  hazards (adaptation) and dominant GHGI sectors (mitigation), balanced 50/50,
  with sourceSignals traceability ("why this matters for <city>").
- CityActions/ActionCard render prioritized actions per selected city with an
  EN/ES/PT toggle; engagement.ts adds curated LATAM-first opportunities
  (needs_local_validation, adopting the parallel team's schema).

Part B — green/cheap LLM localizer + EcoLogits:
- llm-service/: FastAPI sidecar, OpenAI-compatible provider abstraction
  (Scaleway/GreenPT/Salamandra/Aya... env-only swap), EcoLogits carbon wrap,
  mock mode (no key) so the demo runs offline.
- api/localize route proxies to the sidecar with a built-in templated fallback;
  useLocalize + carbonContext + CarbonCounter show a per-session CO2 total.

Adding the route handler means the app now runs via next start (not a pure
static export); the data half stays static-compatible.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…-action-claude' into hackday/2026-06-11/civic-climate-action

# Conflicts:
#	events/2026-06-11-unlock-the-money/civic-climate-action/app/src/app/components/CityExplorer.tsx
… (live)

- Pilot cities (São Paulo, Porto Alegre) get the actions+AI experience; others
  show just the profile + stories (lib/pilots.ts gating).
- Restructure CityExplorer: full-width detail below the [list|map] row instead
  of the cramped right column; add a static at-a-glance profile headline
  (lib/profileHeadline.ts).
- Replace the 6-card grid with a master-detail: a slim selectable action list
  (ActionRow) + a prominent AiDevelopPanel. Single useLocalize, keyed per action;
  the LLM fires on a button, not on every card.
- Fold engagement into the AI panel as "where to engage" grounding: unified
  localSources.ts (Porto Alegre from the teammate's data, São Paulo curated);
  source names are passed to the LLM so steps cite real channels.
- Live LLM: wire Scaleway Mistral Small (via gitignored .env), stronger 4-6 step
  prompt, token-based EcoLogits estimate labeled "est." (Scaleway model isn't in
  EcoLogits' registry); built-in fallback retained.
- Responsive grid classes in globals.css. Remove unused ActionCard.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Per-city experience becomes a drafting/refine workspace instead of one-shot
suggestions:
- New /generate task API (next_steps · draft_proposal · evidence · pathways ·
  future_vision · refine) returning markdown; AiWorkspace renders lens tabs,
  caches per lens, and offers an iterative Refine bar + Copy.
- Futures Design "future vision" lens (Experiential Futures, grounded by a
  research workflow): a short hopeful "day in the life" with a First-ripple line.
- Examples lens is data-driven (matchStories) — no LLM.
- Grounding: cityFacts() passes the city's real numbers + real local channels to
  the model; prompts forbid invented stats/dates (caught + fixed a fabricated
  "100k trees by 2025"); strip stray ```markdown fences.
- Live Scaleway Mistral Small; carbon shown as a token-based estimate, labeled
  "(est.)" everywhere (EcoLogits can't measure the Scaleway model id).

Jargon cleanup: remove the "How it works" section + FlowDiagram; replace
user-facing CCRA/GHGI/HIAP/SEEG with global-standard names (emissions inventory,
climate-risk assessment, recommended climate actions).

Adversarial-review fixes: clear cached content on language switch (no stale
language), per-lens loading state (no cross-lens race / duplicate calls), reset
refine text on lens change, clipboard fallback, offline-refine note, markdown
overflow wrapping, guard non-OK API responses, honest carbon-counter label.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Futures Design lens (future_vision task) is no longer a sensory "day in the life"
vignette. Grounded in the Future Design + Futures Cone methodologies, it now
produces structured, data-backed foresight from the city's real numbers:
  - Where today's trends point (trajectory read from the city's risk/emissions)
  - A plausible future history to ~2050 (future-generations standpoint, with the
    necessary transitions and honest trade-offs)
  - Two futures side by side (probable vs preferable, + systemic ripple effects)
  - closing on the present trade-off future generations would thank us for
Qualitative trends only; the sole numbers are the provided city facts.

Scope the prototype to the Brazilian use-case cities: the explorer/map now shows
only São Paulo, Porto Alegre, Curitiba, Rio (pilots first; São Paulo default).
Other cities stay in `allCities` behind a one-line filter, easily re-enabled.
Worldwide success stories are kept as inspiration/examples. Footer copy updated.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…t metric

The hackday's "unlock the money / trust layer" test was answered only in copy.
This builds the surface end-to-end:

- Capture participation: a server-side pledge store (file-backed, seeded demo
  baseline, rate-guarded) + /api/pledge + /api/metrics; a "I'll act on this"
  button in the workspace, aggregated across visitors via a PledgeProvider.
- Civic Engagement Readiness: a transparent per-city index (engagementScore.ts)
  — resident commitments + the actions' stakeholder-engagement co-benefit (the
  HIAP signal funders score, finally surfaced) + local civic channels + proven
  precedent — shown as a "For funders" card with a no-black-box breakdown and a
  live tally that ticks up as residents pledge.
- Funder export: a static, fabrication-free Markdown one-pager (funderBrief.ts),
  downloadable.
- Footer "Why it pays" repointed to the metric.

Bundled trust fixes (so the numbers we show funders hold up):
- Stop feeding the overstated transport % to the LLM — cityFacts presents the
  dominant sector qualitatively with the partial-inventory caveat when set, and
  the caveat is threaded into the model context (cityContext.dataCaveat).
- "AI draft — verify before submitting" disclaimer under generated content.

Everything stays honest: index labeled a prototype over demo data; brief is
static (no LLM); pledge store is a demo single-process file (DB for production).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Refocus the app from a sprawling multi-city explorer into a single, honest
spine for one pilot city (Porto Alegre), and build out the funder story.

Resident flow:
- Two-tap intake (worry -> appetite) -> one concrete, real move with the
  actual local channel, a "Why this helps" explainer, and "what happens next"
- AI toolkit tabbed two ways: a clean ready-to-send message, and a "Guide me"
  civic-coach chat (what/how/why), both grounded in real channels + orgs
- "I care about this" signature (name + neighborhood, optional email) ->
  personalizes the message, tracks Committed -> Sent -> Got a response, and
  issues a saveable receipt
- Real partner organizations as next steps (volunteer / attend / campaign /
  donate), web-verified for Porto Alegre

Engagement signal + funder view:
- Public commitment wall, most-backed-actions ranking, and a Leaflet map of
  engagement by neighborhood
- /funders page: the co-benefit/de-risk/readiness thesis + a live readout by
  climate priority and neighborhood, who can deliver, and what it unlocks
- pledgeStore reworked to named, status-tracked signatures with consistent
  seeded baselines; new /api/wall and /api/funders; emails never exposed

Green AI: open-weight Mistral Small on Scaleway's low-carbon grid, per-call
EcoLogits energy/CO2e tracking, templated fallback when offline.

Removes the old multi-city machinery (explorer, map picker, HIAP action
prioritization, readiness score, funder-brief) and adds a /stories page,
top nav, and a demo script.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
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.

2 participants