A sci-fi writing workflow inspired by DeepMind's AI co-scientist.
This system uses competitive tournaments and AI debates to create science fiction grounded in research:
- Tournament competition generates multiple world-building scenarios
- Research-backed predictions create scientifically plausible futures through incremental steps
- Debate phases refine ideas through argumentation between different AI models
- Evolutionary refinement improves storylines, chapters, and prose through iterative competition
The result: rigorous research meets creative storytelling for scientifically-grounded sci-fi.
The system orchestrates a competitive tournament between AI models, with the Deep Sci-Fi Writer managing creative phases while Co-Scientist runs tournaments for idea generation and refinement. Research integration provides scientific accuracy through automated fact-gathering.
- Clone the repository and activate a virtual environment:
git clone https://github.com/nerdsane/deep-sci-fi.git
cd deep-sci-fi
uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate- Install dependencies:
uv pip install -e .- Set up your
.envfile with API keys:
cp .env.example .env
# Edit .env with your API keys- Launch the system with LangGraph server:
uvx --refresh --from "langgraph-cli[inmem]" --with-editable . --python 3.11 langgraph dev --allow-blockingUse this to open the Studio UI:
- 🚀 API: http://127.0.0.1:2024
- 🎨 Studio UI: https://smith.langchain.com/studio/?baseUrl=http://127.0.0.1:2024
- 📚 API Docs: http://127.0.0.1:2024/docs
Creates scientifically-grounded science fiction through competitive AI tournaments and research integration.
- Storyline Competition: Multiple AI models compete to create storyline concepts
- Research Integration: Automated fact-gathering for scientific accuracy
- World Building: Develops plausible future scenarios and technologies
- Chapter Development: Creates structured narrative with scientific explanations
Launch via LangGraph Studio, select "Deep Sci-Fi" graph, and enter your story concept. The system guides you through each stage with human-in-the-loop approval.
Model templates (in src/co_scientist/configuration.py):
- Creative Template: Optimized for narrative tasks (Claude Opus + O3)
- Reasoning Template: Optimized for research tasks (O3 + GPT-4o)
Competitive tournament workflow that generates and evolves ideas through AI debates and quality ranking.
- Tournament Competition: AI models compete to generate the best concepts
- Debate Phases: Different models argue for competing approaches
- Quality Ranking: Elo rating system tracks performance across competitions
- Evolutionary Refinement: Winning ideas are improved through iterative competition
- Meta-Analysis: Generate multiple research/creative directions
- Generation: Create detailed content for each direction
- Reflection: Quality assessment and critique
- Tournament: Head-to-head comparisons with debates
- Evolution: Refine and improve winning concepts
Templates automatically assign models per use case:
- Creative Template: For storylines, chapters (Claude Opus + Sonnet + O3)
- Reasoning Template: For research, analysis (O3 + GPT-4o + Sonnet)
Per-phase model override supported for advanced users.
deep-sci-fi/
├── src/ # Main source code
│ ├── co_scientist/ # Competitive tournament system
│ │ ├── phases/ # Tournament phases (debate, evolution, etc.)
│ │ ├── prompts/ # Phase-specific prompts
│ │ ├── utils/ # Model factory, LLM manager, output tools
│ │ └── configuration.py # Model templates and settings
│ ├── deep_sci_fi/ # Main writing workflow
│ │ ├── deep_sci_fi_writer.py # Core orchestration logic
│ │ └── prompts.py # Writing-specific prompts
│ └── open_deep_research/ # Research integration module
├── output/ # Generated content (timestamped folders)
├── examples/ # Usage examples and demos
└── langgraph.json # LangGraph configuration
All generated content is saved to timestamped folders in output/:
output/YYYY-MM-DD_HH-MM-SS/
├── 00_01a_storyline_competition_summary.md # Competition overview
├── 00_01b_storyline_competition_details.md # Detailed results
├── 01_storyline_option_1_full.md # Generated storylines
├── 02_world_scenario_full.md # World building
├── 03_first_chapter_full.md # Chapter content
├── elo_leaderboard.md # Quality rankings
└── tournament_*.md # Debate transcripts
src/co_scientist/configuration.py: Model templates, phase settingssrc/deep_sci_fi/deep_sci_fi_writer.py: Use case configurationslanggraph.json: Workflow definitions and API settings
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Uses Open Deep Research for automated web research and scientific fact-gathering
- Inspired by DeepMind's AI co-scientist tournament-based hypothesis evaluation system
