The AI Sentiment Agent: Scoring World Cup Heartbreak
How Claude analyzes fan grief every 30 minutes, signs the scores, and pushes them directly on-chain.
The most unusual part of Elegy isn't the bonding curve or the oracle. It's the AI agent that decides how much each fanbase is suffering.
How It Works
Every 30 minutes, the Elegy backend calls Claude for each of the 48 qualified teams. The prompt asks Claude to score pre-tournament anxiety and, once the World Cup starts, real match grief.
The agent considers:
- Historical World Cup trauma (England's penalties, Brazil's 7-1)
- Fan expectations vs realistic chances
- Host nation pressure (USA, Canada, Mexico)
- Recent match results and controversial moments
- Fanbase volatility and cultural significance of football
The response is a JSON object with a score (0-100) and a one-sentence reasoning.
The Signing Process
Claude returns a score. The backend signs it with a dedicated ECDSA signer key using ethers.solidityPackedKeccak256. The signed payload is submitted to the SentimentOracle contract on X Layer.
The oracle verifies the signature on-chain. If the signature doesn't match the registered signer address, the update is rejected. This means only the Elegy agent can push scores — nobody can manipulate them without the private key.
Pre-Tournament Scoring
Right now, with the World Cup not yet started, the agent scores pre-tournament anxiety. Some examples:
- Brazil (88) — "Massive expectations, 7-1 trauma lingers, Pentacampeão pressure"
- England (78) — "Decades of penalty heartbreak, It's Coming Home mentality"
- Mexico (78) — "Host nation pressure plus historic Round of 16 curse"
- New Zealand (28) — "Small football nation, low expectations, just happy to qualify"
The variance is real. The agent understands football culture.
When Matches Start
From June 11, the agent also polls football-data.org for live match results. When a match finishes, the losing team's sentiment is immediately re-scored and pushed on-chain within minutes. Grief spikes are automatic.