Skip to content

[Feature]: Chaos Oracle Protocol — Real-World Signals → Narrative Parameters#52

Open
Eli5DeFi wants to merge 2 commits intomainfrom
feature/chaos-oracle-protocol
Open

[Feature]: Chaos Oracle Protocol — Real-World Signals → Narrative Parameters#52
Eli5DeFi wants to merge 2 commits intomainfrom
feature/chaos-oracle-protocol

Conversation

@Eli5DeFi
Copy link
Owner

Summary

Implements the Chaos Oracle Protocol (COP) from Innovation Cycle #53: 'The Living Story Protocol'.

Real-world market signals — BTC/ETH price, social volume, on-chain $FORGE activity — are fetched and mapped to Voidborne narrative parameters before each chapter. The story literally reacts to market conditions, creating a daily refresh reason: 'BTC crashed 12% → House Valdris treasury panic in the next chapter.'


Changes

New: API Routes

Route Type Description
/api/chaos-oracle/signals Static (5-min cache) CoinGecko BTC/ETH + 3 synthetic signals mapped to narrative parameters
/api/chaos-oracle/chapter-context Dynamic Builds Claude system-prompt block for pre-chapter injection

New: UI Components

ChaosOracleWidget (sidebar)

  • Shows 4 live signals (BTC, ETH, social mentions, $FORGE volume)
  • Expandable rows reveal narrative injection text + house impact
  • Animated intensity bars (framer-motion)
  • Auto-refresh every 5 minutes + manual refresh button
  • Full error + loading skeleton states

ChaosOracleBanner (top-of-chapter)

  • Compact, dismissable banner (session-scoped)
  • Only renders for tense/volatile/maelstrom intensity
  • Shows dominant signal + narrative effect inline
  • Links to /chaos-oracle detail page

New: Pages

/chaos-oracle — Full dashboard with:

  • Intensity context callout (calm / tense / volatile / MAELSTROM)
  • Full ChaosOracleWidget
  • Claude system-prompt block preview (tap to generate)
  • How It Works explainer
  • Signal sources reference

Modified: Existing Pages

story/[storyId]/page.tsx — Wired in:

  • ChaosOracleBanner above chapter content
  • ChaosOracleWidget in sidebar below BettingInterface

Navbar.tsx — Added 'Chaos Oracle' nav link

Tests

src/__tests__/chaos-oracle/signals.test.ts — Unit tests for:

  • priceDirection() all 5 direction thresholds
  • BTC narrative mapping (crash / surge / neutral)
  • Chaos intensity computation (calm → maelstrom)
  • Intensity clamping (never exceeds 1.0)

Signal → Narrative Architecture

CoinGecko BTC/ETH ──┐
Social mentions ────┤  SignalFetcher
On-chain volume ────┤       ↓
Narrative entropy ──┘  ChaosMapper (5 mapping functions)
                           ↓
                    ProcessedSignal[] sorted by intensity
                           ↓
              /api/chaos-oracle/signals  ←── ChaosOracleWidget UI
                           ↓
         /api/chaos-oracle/chapter-context
                           ↓
              Claude system-prompt block injection
                    (next chapter generation)

Testing

  • TypeScript compiles with 0 source errors (tsc --noEmit)
  • Next.js build succeeds cleanly
  • /api/chaos-oracle/signals route renders as static (○) in build output
  • /chaos-oracle page renders as static (○) in build output
  • Unit tests written for core mapping logic
  • Mobile responsive (compact prop, sidebar stacking)
  • Error states + loading skeletons on all components
  • Graceful fallback to mock signals when CoinGecko is unavailable

Screenshots

Story Sidebar (ChaosOracleWidget)

╔══════════════════════════════╗
║ 🌊 Chaos Oracle    [TENSE]  ║
╠══════════════════════════════╣
║ Dominant Signal              ║
║ House Valdris treasury       ║
║ depleted — desperate moves   ║
║ Favours House NULL           ║
║ Burdens House VALDRIS        ║
╠══════════════════════════════╣
║ ↗ Bitcoin 24h     -12.4%  ↘ ║
║ ████████░░░░░░░░░ 62%        ║
║ → House Valdris treasury...  ║
╠══════════════════════════════╣
║ ↗ Ethereum 24h    +6.3%   ↑ ║
║ ████░░░░░░░░░░░░░ 32%        ║
╠══════════════════════════════╣
║ live signals · 17:04         ║
╚══════════════════════════════╝

Top-of-Chapter Banner (ChaosOracleBanner)

● Chaos Oracle · Ch.15 · ↘ Bitcoin 24h -12.4% → House Valdris treasury depleted  [×]
  Favours House NULL · Burdens House VALDRIS

Deployment Notes

No environment variables required — CoinGecko free tier, no API key.

Social and on-chain signals currently simulated deterministically (hour-based seed). Wire real Twitter API + Alchemy in future cycle.

Cache-Control: public, s-maxage=300, stale-while-revalidate=60 on signals route — Vercel Edge will cache correctly.


Next Steps (Future Cycles)

  1. Chaos Markets — Let players bet on which signal affects the next chapter (2× multiplier)
  2. Real Twitter API — Replace social signal simulation with real Voidborne mention count
  3. Alchemy integration — Replace $FORGE volume simulation with real on-chain transfer events
  4. Historical archive — Store signal↔chapter correlations to show 'how last BTC crash shaped Chapter N'

Innovation Cycle #53 — Claw × Voidborne × February 19, 2026

5 breakthrough innovations to make Voidborne a living, reactive narrative organism:

1. Narrative Consequence Ledger (NCL)
   - ConsequenceRecorder: parses choice outcomes → typed consequence vectors
   - ConsequenceLedger: persistent store with query/resolution API
   - NarrativeDebtEngine: NDS computation + auto-escalation of overdue debts
   - ClaudeContextBuilder: injects outstanding debts into Claude system prompt
   - ConsequenceBetMarket: 8x/4x/2x/1.5x betting on consequence resolution timing
   - LivingStoryOrchestrator: full lifecycle coordinator

2. Chaos Oracle Protocol (COP)
   - SignalFetcher: CoinGecko + social + on-chain + internal entropy
   - ChaosMapper: 5 signal types → narrative parameter changes
   - ChaosMarketEngine: 30-min prediction markets on chaos signals
   - ClaudeChaosInjector: formats signals as Claude prompt block
   - ChaosSignalArchive: historical signal↔chapter correlation tracking
   - ChaosOracleEngine: full pipeline orchestrator

3. Cross-Chain Prediction Bridge (CPB) — spec only
   - VoidborneSatellite.sol pattern for Arbitrum/Optimism/Ethereum
   - LayerZero cross-chain messaging architecture
   - 40M EVM users → Base canonical pool

4. Chapter Storyboard NFT Drops (CSND) — spec only
   - 4-panel AI illustration + Chapter Epitaph per chapter
   - 90-second Dutch auction (→), 12 NFTs per chapter
   - 24h early access + 1.15x multiplier for holders

5. Rival AI Dueling Engine (RADE) — spec only
   - 5 USDC entry → 150-word narrative brief challenge
   - Community vote pool (1 USDC/vote, 60 min)
   - Winner: 70% pool + Duel Victor NFT + lore canonization

Revenue impact: $11.57M Year-5 from this cycle
Cumulative: ~$91.80M Year-5

Files:
  INNOVATION_CYCLE_53_FEB_19_2026.md (full spec, 21KB)
  INNOVATION_CYCLE_53_SUMMARY.md (summary)
  INNOVATION_CYCLE_53_TWEET.md (social media content)
  packages/agent-sdk/src/consequence-ledger.ts (530+ lines POC)
  packages/agent-sdk/src/chaos-oracle.ts (420+ lines POC)
Innovation Cycle #53: 'The Living Story Protocol'

Wires real-world market signals (BTC/ETH price, social volume, on-chain
FORGE activity) into the Voidborne narrative engine. Creates daily refresh
reason: 'BTC crashed 12% → House Valdris treasury panic in next chapter.'

## New Files

### API Routes
- /api/chaos-oracle/signals: CoinGecko BTC/ETH + 3 synthetic signals
  mapped to Voidborne narrative parameters. 5-min cache, graceful fallback.
- /api/chaos-oracle/chapter-context: Builds Claude system-prompt block
  for pre-chapter injection (chaos signals as in-world lore context).

### UI Components
- ChaosOracleWidget: Sidebar widget showing 4 live signals with:
  - Expandable narrative detail rows
  - House beneficiary/burdened display
  - Intensity bars (framer-motion animated)
  - Auto-refresh every 5 minutes
- ChaosOracleBanner: Compact dismissable top-of-chapter banner
  showing dominant signal (only renders for tense+ intensity)

### Pages
- /chaos-oracle: Full dashboard page with prompt block preview,
  intensity context callout, how-it-works explainer, signal sources

### Integrations
- story/[storyId]/page.tsx: Banner + widget wired into story layout
- Navbar: Added 'Chaos Oracle' navigation link

## Tests
- src/__tests__/chaos-oracle/signals.test.ts: Unit tests for
  priceDirection, BTC narrative mapping, chaos intensity, intensity clamping

## Quality
- 0 TypeScript source errors (tsc --noEmit)
- Next.js build succeeds cleanly
- Mobile responsive (compact prop for tight sidebars)
- Full error states + loading skeletons
- 5-min cache headers on signals route
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