Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save SoMaCoSF/4fc7a9a348f3f762d240e39bac00eeae to your computer and use it in GitHub Desktop.

Select an option

Save SoMaCoSF/4fc7a9a348f3f762d240e39bac00eeae to your computer and use it in GitHub Desktop.
SoMaCoSF Platform — Full Session Build Log (2026-05-06/07)
# SoMaCoSF Platform — Session Build Log
**somacosf.com | 2026-05-06 → 2026-05-07**
---
## What Was Built
### 1. Polymarket CLOB + Kalshi Execution Bridge (`62c1535`)
- `app/api/poly/execute` — CLOB order submission via Polymarket API
- `app/api/kalshi/execute` — Kalshi market order bridge
- Full execution plan doc in `docs/`
### 2. Commodity Dashboard (`ab44813`)
**`/commodities`** — live prices, PM drafts, lead-time map
- 20 real commodity tickers (crude, copper, wheat, LNG, uranium, etc.) via Yahoo Finance
- 11 Polymarket draft market cards with resolution criteria
- Supply chain lead-time heatmap
- GYST UUID v8 schema for each commodity signal
- `app/api/commodities/route.ts` — live fetch + static fallback
### 3. C-Suite Network + Showcase (`eb5aa34`, `594f08f`)
**`/showcase`** — animated visual overview (forum-shareable)
- Real executive network graph (SEC filings, insider connections)
- Live Yahoo Finance quotes for supply chain tickers
- SEC filing links, insider Form 4 feed
- EDGAR 8-K/10-K live scanner for datacenter capex
### 4. NextAuth OAuth + Codebook Expansion (`e18e19b`)
- GitHub/Google OAuth via NextAuth alongside cookie auth
- Codebook expanded: 1539+ GYST tokens
- Harvester drift detection (Hormuz pipeline)
- Knowledge inventory system
### 5. Pyth Hermes Price Feed + Signal Monitor (`dfeef70`)
**`/monitor`** — unified signal health dashboard
- `app/api/signals/pyth/route.ts` — Pyth Hermes WebSocket price feed
- Formula: `signal = clamp(0.5 + dev×5, 0, 1)` where dev = (spot−EMA)/EMA
- k=5 = 0.5/10% (derived, not arbitrary)
- Spike detection: |spot−EMA|/conf ≥ 2σ
- `app/api/monitor/route.ts` — channel health, live feed, open positions
- 15s polling, LCARS dark aesthetic
### 6. Command Center (`28b46ec`)
**`/command`** — local ops single pane of glass
- Service health pings (prod, localhost:4242, OpenClaw, Ollama, Vertex, CopyParty)
- Page navigator for all 38 routes grouped by section
- Cron manifest
- DB stats (signals 1h/24h/total)
- Live signal feed
### 7. GYST Math Proof + Test Harness (`8cdf5da`)
**Test suite: `tests/gyst/uuid-math.test.mjs`** — 61 tests, zero deps
- Full 128-bit layout verification: `type(12)+ns(12)+ts(24)+ver(4)+fractal(12)` high, `variant(2)+prov(4)+signal(16)+random(42)` low
- Round-trip: 7 fixtures (market/pyth/agent/max/min)
- Idempotence: 100-run loop, 9 mutation tests
- Pyth signal formula proofs, token compression math
**Meta-harness: `tests/gyst/harness-meta.test.mjs`** — 26 tests
- Proves the harness catches real bugs (not rubber-stamp)
- `flipBit()` + `setField()` helpers for surgical UUID corruption
- 9 content-addressing mutation tests
**`docs/GYST-IDENTITY-AS-INFRASTRUCTURE.md`** — full thesis doc
- Published: https://gist.github.com/SoMaCoSF/b32caf04b3a988acaaaa21a8c13ee153
### 8. Wins / Losses Invoice (`4fd8b5e` + `82ef992`)
**`/wins`** — real-time W/L invoice (live: somacosf.com/wins)
- Polls `/api/wins` every 15s, no cache
- Stats bar: W count, L count, win rate, total P&L, streak, open positions
- Left panel: POLY/KALSHI breakdown, YES/NO direction split, top-6 domain bars, streak history badges, best/worst trade
- Center: scrollable table of recent 50 resolved positions
- Right: SVG P&L sparkline with zero-line, open positions list
- `app/api/wins/route.ts`: LEFT JOIN predictions + uuid_registry, aggregate stats, pnl_curve
---
## Bugs Fixed This Session
| Bug | Fix |
|-----|-----|
| `encodeGystUUID` not exported | Import renamed to `encodeGYST` (actual function name) |
| Duplicate JSX `style` attribute | Merged into single style prop |
| Vercel crons blocked on Hobby plan | Removed `*/5` and `*/15` cron schedules from `vercel.json` — 8 days of failed deploys cleared |
| `/wins` returning HTTP 500 | `predictions` table has no `metadata` column — changed `p.metadata` to `NULL AS pred_meta`, falls back to `uuid_registry.metadata` |
| `useRef<T>()` strict TypeScript | `useRef<T | undefined>(undefined)` |
---
## Deploy State
- **Production**: https://somacosf.com — READY
- **Latest deploy**: `82ef992` — `vercel --prod` (manual, GitHub auto-deploy needs `rootDirectory: "somacosf-platform"` set in Vercel dashboard)
- **GitHub auto-deploy**: blocked because git repo root is `outputs/` not `somacosf-platform/` — fix: Vercel Dashboard → somacosf-platform → Settings → General → Root Directory → `somacosf-platform`
---
## Current Live Data (as of deploy)
```
wins: 0 losses: 1 open: 10 pnl: -$4.92
```
---
## File IDs
```
SOM-API-0090 app/api/signals/pyth/route.ts
SOM-API-0091 app/api/monitor/route.ts
SOM-API-0092 app/api/command/route.ts
SOM-API-0093 app/api/wins/route.ts
SOM-PAG-0060 app/monitor/page.tsx
SOM-PAG-0061 app/command/page.tsx
SOM-PAG-0062 app/wins/page.tsx
SOM-TST-0010 tests/gyst/uuid-math.test.mjs
SOM-TST-0011 tests/gyst/harness-meta.test.mjs
SOM-DOC-0020 docs/GYST-IDENTITY-AS-INFRASTRUCTURE.md
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment