Simulation Engine
How Twitter, Reddit, and a Polymarket prediction market run in lockstep with belief updates and sliding-window memory.
Twitter, Reddit, and a Polymarket-style prediction market run simultaneously every round via asyncio.gather.
Lockstep platform loop
+---------------------------------------------+
| Round memory (sliding window) |
| old: compacted . prev: full . now: live |
+--+--------------+--------------+------------+
+--v------+ +----v----+ +------v--------+
| Twitter | | Reddit | | Polymarket |
| posts | | comments| | AMM trades |
+--+------+ +----+----+ +------+--------+
+--v--------------v--------------v------------+
| Market-media bridge (prices <-> posts) |
+--+------------------------------------------+
+--v------------------------------------------+
| Belief state (per agent) |
| stance[-1,+1] . confidence[0,1] . trust |
+---------------------------------------------+- Three platforms, one round (
#engine-three-platforms-one-round): Twitter and Reddit produce posts, replies, and reactions while Polymarket runs a constant-product AMM over an LLM-framed binary question. - Market-media bridge (
#engine-market-media-bridge): Traders see top social posts in their prompt; social agents see live market odds in theirs. - Belief states (
#engine-belief-states): Each agent tracks a topicstancein[-1, +1],confidencein[0, 1], and pairwise agent trust, updated every round. - Sliding-window memory (
#engine-sliding-window-memory): Older rounds compact asynchronously in the background while the previous round stays full-detail and the current round streams live. - Per-round frame API (
#engine-per-round-frame-api):GET /api/simulation/<id>/frame/<round>returns actions, active agents, market prices, and belief snapshots for replay scrubbers and CLI inspection.