Predicting the Future with Swarm Intelligence: A Deep Dive into MiroFish
DevBlog
Mar 24, 2026 · 4 min read · 36 views

Imagine being able to upload a news article, a policy draft, or even a classic novel, and instantly spawning thousands of digital humans to "live out" the consequences. This isn't a sci-fi premise; it’s MiroFish, the open-source AI engine that recently took GitHub by storm.
Built by 20-year-old developer Guo Hangjiang in just 10 days (using the "Vibe Coding" approach), MiroFish has attracted $4 million in investment from Shanda Group. It moves beyond traditional "math-equation" forecasting to simulate the messy, unpredictable social dynamics of the real world.
How MiroFish Works: The 5-Step Pipeline
MiroFish doesn't just predict; it rehearses. It treats the future as a "Digital Sand Table" where outcomes emerge from the interactions of individual agents.
1. Knowledge Graph Construction (GraphRAG)
You start by feeding MiroFish "seed material" (PDFs, news, or reports). Using GraphRAG, the system extracts entities—people, companies, events—and their relationships. Instead of seeing text as a flat bag of words, it builds a structured web of who influences whom.
2. Persona & Environment Generation
The engine automatically spawns hundreds or thousands of unique AI agents. Each agent is assigned:
A Personality: Varying levels of skepticism, optimism, or aggression.
A Memory: Powered by Zep Cloud (or Neo4j in offline forks), giving them "long-term" context.
A Stance: Initial opinions based on the seed data.
3. Dual-Platform Parallel Simulation
This is the "secret sauce." MiroFish runs simulations across two distinct virtual environments (e.g., one mimicking the fast-paced debate of Twitter and another the long-form discussion of Reddit). Powered by the OASIS engine from CAMEL-AI, these agents post, reply, argue, and shift their opinions in real-time.
4. Report Generation
After the "social evolution" settles, a ReportAgent analyzes the data. It interviews "focus groups" of agents and produces a comprehensive prediction report on sentiment shifts and likely outcomes.
5. Deep Interaction (The "God Mode")
You can step into the simulation. Want to know why a specific agent changed their mind? You can chat with them directly. Want to see what happens if the CEO resigns mid-crisis? Inject that variable and watch the digital world recalibrate.
How to Implement MiroFish
If you want to build your own "prediction lab," here is the high-level roadmap to getting MiroFish running.
Prerequisites
Hardware: 16GB+ RAM (32GB recommended for large simulations).
Environment: Python 3.11+, Node.js 18+.
API Keys: OpenAI (or compatible LLM endpoints like Groq/DashScope) and Zep Cloud for memory.
Step-by-Step Setup
Clone the Repo:
Bash
git clone https://github.com/666ghj/MiroFish.git cd MiroFishConfiguration:
Copy the
.env.examplefile and fill in your LLM API keys.Tip: If you want to run locally to save costs, look for the "MiroFish-Offline" fork which uses Ollama and Neo4j.
Deploy via Docker (Recommended):
Bash
docker-compose up -dAccess the UI:
Open
localhost:3000(or your configured port) to start your first simulation. Upload a document, set your "prediction goal," and let the agents run.
What Can You Build with MiroFish?
MiroFish isn't just a tool; it’s a foundation for a new category of "Simulation-as-a-Service" products.
1. Crisis PR & Brand "Stress-Testers"
Before a company releases a controversial statement or a new product, they can run a MiroFish simulation.
Product: A tool that predicts "Twitter Outrage" levels by simulating how different demographic groups (the agents) will react to specific phrasing.
2. Financial Sentiment Oracle
Traditional stock models look at numbers. A MiroFish-powered tool would look at behavior.
Product: A "Market Sentiment Sandbox" where you inject a Fed interest rate hike and watch how simulated retail investors vs. institutional "whales" influence each other's panic-selling or buying.
3. Policy Rehearsal for Governments
Drafting a new city zoning law or a tax policy?
Product: A digital "Town Hall" where thousands of agents representing local residents, business owners, and activists debate the policy, revealing hidden points of friction before the law is even proposed.
4. Narrative & Creative Discovery
The MiroFish team famously fed the first 80 chapters of Dream of the Red Chamber (a classic Chinese novel with a lost ending) into the engine. The agents "played out" their personalities to predict how the story would naturally conclude.
Product: A "Story Sandbox" for authors and screenwriters to test if their character's actions feel "organic" to a simulated audience.
Final Thoughts
MiroFish represents a shift from deterministic AI (if X, then Y) to emergent AI (let’s see what happens when X meets Y). While it is still in early v0.1.0 stages and can be expensive in terms of token usage, it provides a glimpse into a future where every major decision is "pre-played" in a digital world before it ever hits the real one.