---
name: project-wic-buildout-session-2026-05-25
description: "WIC major build-out session — features shipped, strategic \"honest grandeur\" + discovery direction, monetization plan, pending TODOs"
metadata: 
  node_type: memory
  type: project
  originSessionId: 5ce58531-1677-43dd-932d-12465f578bc0
---

2026-05-25 (cross-session). Large World Investment Center (`fc0web/world-investment-center`) build-out + strategic direction, plus rei-aios OctaTheoria integration. All work committed + pushed (both repos `## main...origin/main` in sync at session end).

## Features shipped (WIC, all pushed)
Sequence: `countries.ts` (195 master = 193 UN + 2 observers) → `currencies.ts` (142 distinct; **BGR→EUR** since Bulgaria adopted euro 2026-01-01, caught by ISO data) → `/countries` region-filter + 195 detail pages (World Bank GDP/pop/inflation + Markets) → `stock-indices.ts` (102 curated primary indices, obscure ones OMITTED not fabricated) + Stocks view → **50m** Natural Earth swap so microstates highlight → currency/stock map overlay (Display menu: click→highlight+code label, hover→panel) → inline country detail in bottom panel (no new tab) → `/correlations` (Spearman matrix + scatter + "question" framing, honest stats) → **Indicators choropleth** (9 World Bank indicators colour the whole map + legend + ranked list) → **Live Rates dock** (lazy-loaded TradingView Market Overview, display-only, anchored to map's lower-left) → UI: Layers above Indicators.
Commits: WIC `b5b0c99`/`716f264`/`e686a4f`/`ccc6a99`/`23fc86c`/`59b0bd5`/`91bab83`/`cff8de5`. rei-aios **STEP 1160** `aa084b62` = OctaTheoria 12th domain `wic-economy` ([[project_paper157...]] unrelated; see CLAUDE.md STEP 1160).

## Strategic direction (load-bearing — the "why")
- **"Honest grandeur"**: the wow/density must come from REAL objective data, never fake controls or implied profit. The IG-DEMO MT4 terminal (user's reference "理想") = build the ~30% that is *data display*, SKIP the ~70% that is *trading machinery* (orders/AutoTrading/grid/TP-SL/margin) — WIC does **no trading, no investment advice** (standing principle, [[project_wwd_to_wic_rename_2026-05-23]]).
- **WIC re-anchored to Rei's mission** = "全データの相関 × 統合 × 未知の探索" (correlation × integration × find the unknown). Part A = WIC `/correlations`; part B = feed WIC economy data into OctaTheoria (`wic-economy` domain, D-FUMT₈ 8-axis). User insight (correct): current 9 indicators are too few → genuine discovery needs MORE heterogeneous data breadth → broaden the data terminal FIRST. Honest caveat: more data also = more spurious correlations → keep the multiple-testing/causation discipline.
- **Moat** = the discovery layer on top (D-FUMT₈ / OctaTheoria cross-domain correlation + honest framing), NOT the terminal look (copyable; IG terminal is a free EA). "display → integration → discovery" two-stage = what IG terminal AND World Monitor both lack. (cf. [[feedback_wwd_strategic_moats_against_bigtech]])
- **Monetization** (user: "複雑なデータは有料化"): freemium — free objective layer (the hook) + paid deep analytics/exports/API. Keep no-advice even in paid tiers.

## Honest engineering facts
- World Bank API throttles rapid calls (intermittent 400/HTML) → **retry+backoff** in fetch scripts.
- CO2 per-capita via `country/all + mrnev` returns 0 rows → **omitted, not fabricated**.
- Choropleth uses **Spearman** rank correlation (robust to skew/outliers — right for cross-country data).
- **Do NOT run rei-aios `vite build` / full `dev:build`** ad-hoc: it would clean dist-renderer and wipe the `data/` mirrors → focused commits only; the auto site-rebuild cron handles dist-renderer. (rei-aios had ~590 pre-existing dirty data files = autonomous-cycle churn, NOT my work — left to the cron.)
- TradingView widget = lazy-loaded (privacy/perf) + **attribution mandatory** (ToS §4; removing it = ban/legal).

## PENDING TODOs
**1 + 2 + 3 all DONE 2026-05-25 (later session, did them in order):**
1. ✅ **ToS audit doc** — added 有料化可否 (paywall-OK) column to the 4 source tables + a dedicated "## 有料化可否 (Monetization / paywall ToS audit)" section in WIC `docs/free-market-data-apis.md`. ✓ paywall-OK = WIC analytics + World Bank + ECB/Frankfurter + Natural Earth + ISO; ✗ free-layer = TradingView + CoinGecko-Demo + Yahoo; everything else honestly marked 要確認 (treat as ✗ until per-source resale terms verified — did NOT fabricate verdicts). WIC commit `5d8d3c4`, pushed.
2. ✅ **Live Rates roadmap ① session-clock bar** — new `src/components/SessionClock.astro` wired into `LiveRates.astro` between head and body (outside lr-body so the TradingView widget reload doesn't wipe it). Sydney/Tokyo/London/NY, DST-aware live clocks via `Intl.DateTimeFormat` (no external data), approximate open/closed dots (forex local-hours convention, Mon–Fri, honest "approximate" framing). WIC commit `fe46827`, pushed, build OK (442 pages, session-clock in dist/index.html). Roadmap remaining: ② market-watch asset row → ③ reference-rate table → ④ TradingView embed (already shipped) → ⑤ OctaTheoria feed.
   - **Follow-ups (same session, user-confirmed working):** (a) **Pre-existing bug fix** — `loadWidget()` created the TradingView loader `<script>` but never appended it → widget rendered blank (only attribution showed). Fixed with `container.appendChild(s)` (commit `cbe8084`). (b) **Dock moved to top + draggable** (commit `1abb395`): default position now top (`left:130px; top:14px`, right of the 2D Flat button); pill + panel header are drag handles (pointer events + setPointerCapture so dragging works over the iframe), clamped inside the map area, drag-end click swallowed, touch-action:none. The `.lr-dock` now uses left/top (was left/bottom).
   - **② market-watch asset row DONE** (commit `769c25f`, user chose self-hosted/WIC-owned over a TradingView Ticker Tape via AskUserQuestion): `src/components/MarketWatch.astro` placed between SessionClock and lr-body. Live-ish crypto (CoinGecko `simple/price` + `include_24hr_change`, BTC/ETH/SOL/XRP/BNB, no key/CORS) + ECB daily-reference FX (Frankfurter, EUR-USD/USD-JPY/GBP-USD/USD-CHF/USD-CAD/AUD-USD; inverted pairs = 1/rate from USD base; change = day-over-day from a ~8-day timeseries). Lazy-load via IntersectionObserver on first open, crypto refresh 60s while visible, chips pre-created in stable order, fetch failure → "—" (no fabrication). Honest labels (crypto=24h, FX=ECB daily) + attribution.
   - **③ + ④ + ⑤ DONE → "荘厳 terminal" roadmap COMPLETE** (commit `98c7573`). The Live Rates body is now a **3-tab terminal**: **📈 Chart** = ④ existing TradingView embed (now mounts into `#lr-view-chart`, not the body); **💱 Rates** = ③ `RatesTable.astro` (12 ECB daily-reference pairs majors+crosses via Frankfurter, reference rate + day-over-day Δ, explicitly NOT bid/ask/tradeable); **🔭 Discovery** = ⑤ `Discovery.astro` — fetches the REAL OctaTheoria observation for crypto/fx/wic-economy from `https://rei-aios.pages.dev/api/octatheoria?domain=…` (CORS already `*` in `functions/api/octatheoria.ts` — verified, no rei-aios change needed) and renders the canonical D-FUMT₈ 8-axis `axisHistogram` + topAxis, links to the full `#/octatheoria` view. ⑤ honest framing: the streams already flow into OctaTheoria *in rei-aios*; WIC surfaces it (display→integration→discovery), does NOT re-derive the projection. All tabs lazy-load via IntersectionObserver; failures show "—"/"unavailable". Panel grown 440→480px (large 640px). OctaTheoria envelope shape: top keys `observations/axisHistogram/flowEdges/honestNote/source`; obs keys `id/domain/label/category/series/topAxis/latest/metadata/relations`.
3. ✅ **wic-economy viewer site-visible** — NO action needed: the auto site-rebuild cron already propagated STEP 1160 (rei-aios commit `7d2c9482 Auto: site rebuild ... STEP 1160`). Verified: bundle `app-D_LOeoD8.js` (committed + pushed, referenced by index.html) contains `wic-economy` + `🏦 WIC 経済`; live `GET /api/octatheoria?domain=wic-economy` → 200, 9 observations, disclaimers present. **Lesson confirmed: verify the cron output, do NOT run a manual full vite build (would wipe data mirrors).**

**Repo visibility**: `fc0web/world-investment-center` was created PUBLIC, made **PRIVATE on 2026-05-26** (`gh repo edit … --visibility private`) — reasoning: 🛰 Cockpit moat partly depends on source not being trivially copyable. (Shipped HTML/JS is still browser-visible; only repo source is hidden.) Star-value discussion: stars give WIC little direct benefit (it's an end-user product, not a dev library) — moat = execution/discovery layer, not source secrecy; staying private is fine.

**★★ DEPLOY TOPOLOGY (load-bearing — caused a "Live Rates disappeared" incident 2026-05-26):** there are TWO Cloudflare Pages projects (`wrangler pages project list`):
- **`world-investment-center`** → **world-investment-center.pages.dev = THE OFFICIAL URL**. **Git Provider: No (DIRECT-UPLOAD ONLY).** Git pushes do NOT update it. It only updates via `wrangler pages deploy dist --project-name=world-investment-center --branch=main`.
- **`world-wide-datacenter`** → world-wide-datacenter.pages.dev (old name). **Git Provider: Yes** — this is what the GitHub repo's auto-deploy actually targets. So every `git push` deployed to the OLD url, leaving the official url stale.
- **Incident:** official url was stuck 2 days old (no Live Rates / Cockpit) because all Live Rates/Cockpit pushes only auto-deployed to world-wide-datacenter. **Fix = `wrangler pages deploy dist --project-name=world-investment-center --branch=main`** (wrangler is authed as fc2webb@gmail.com; private repo does NOT block this). Verified: official url then had lr-pill/cockpit/market-watch/session-clock.
- **Standing rule until reconciled:** after committing WIC changes, ALSO run the wrangler deploy above, or the official URL won't update. (Cleaner long-term: connect the `world-investment-center` project to the git repo, or delete the redundant `world-wide-datacenter` project — user decision.)

**★ SINGLE-SOURCE HOME (2026-05-26, commit `02b2305`):** the EN home had silently diverged far ahead of the JA home (1456 vs 641 lines — JA was missing Live Rates, currency/stock overlay, indicators, inline detail). Root cause: `index.astro` (en) and `ja/index.astro` were duplicated page bodies, so features added to en never reached ja. **Fixed by extracting the whole dashboard (markup+script+style) into `src/components/DashboardHome.astro`** (props `{ lang: 'en'|'ja', i }`); both `index.astro` and `ja/index.astro` are now THIN WRAPPERS: `<Base lang=…><DashboardHome lang=… i={en|ja.json} /></Base>`. i18n via `src/i18n/{en,ja}.json` (verified key-identical 113/113). Hardcoded `'en'` format args → `lang`. **STANDING RULE: add home features to `DashboardHome.astro`, NOT to the wrappers — then they appear in every locale automatically.** (A few labels still hardcoded English — indicator names, vote/rei sourcesNote, realtime-panel placeholder — can be moved to i18n later; feature-parity was the priority.)

**★ Disclaimer tone = user-autonomy (2026-05-26, commit `a75c108`):** user noted that a preachy "you must NOT invest" tone backfires/alienates. Softened the footer (Base.astro, every page), disclaimer pages (EN+JA), and NoAdviceBanner to an **autonomy-respecting** framing — KEEPING all legal protections (no advice · objective only · no direct/intermediated trading here · operator doesn't invest, zero COI). New line: "whether you invest — or trade via external platforms such as TradingView / an FSA-registered broker — is your own free decision and responsibility." Added a generic **"📊 Open in TradingView ↗"** link in the Live Rates foot. **Research (verified via FSA + sources):** TradingView = a charting TOOL, not a broker → legal for Japanese to use, not FSA-regulated; the regulated line is the connected BROKER (only FSA-registered may serve JP residents). WIC's own risk = don't give advice + don't intermediate/solicit a specific broker (esp. paid affiliate → may need 金融商品仲介業 registration). A generic TradingView (tool) link is low-risk; broker-affiliate funnels need a lawyer. Sources incl. fsa.go.jp/ordinary/chuui/highrisk.html.

**★ DISPLAY commodity-production layers (2026-05-26, commit `b791034`):** the left "DISPLAY" section (💱 Currency / 📈 Stocks) now also has **generic commodity production layers** — 🥇 Gold (t) · 🥈 Silver (t) · 🟫 Copper (kt) · 🛢️ Crude Oil (kb/d) · ⛽ Natural Gas (bcm). All driven by `src/data/commodity-production.ts` (a `COMMODITIES` array: key/label/glyph/color/unit/unitLong/year/source/data{iso3→value}; approx public figures from USGS MCS 2025 / EIA / OPEC / Energy Institute, rounded, omitting unconfident countries — not fabricated). `DashboardHome.astro` renders the DISPLAY buttons + per-commodity `<ul id="{key}-filter-list">` + a `#commodity-data` JSON via loops; a single `showCommodity`/`.com-btn` handler does single-country map highlight + panel detail (like Stocks). **To add another commodity, just add an entry to COMMODITIES — no markup/JS changes.** (Earlier gold was briefly an INDICATOR; the user moved it to DISPLAY, and gold-production.ts was folded into commodity-production.ts. INDICATORS content is still being reconsidered by the user.) User intent: WIC heading toward broad objective production/stats data as the "data terminal".

**Standing constraints**: no trading on WIC · objective only · no investment advice · TradingView/CoinGecko-free = free public layer only (not behind paywall) · monetizable data = WIC's own analytics + World Bank (CC-BY) + ECB/Frankfurter + Natural Earth (PD) + ISO (PD).
