AI novel writing agent 🤖 Turns your idea into a complete first draft using Gemini. Features outlining, auto-writing, interactive AI editing, and CLI control. 📚✍️
# 📚 pulpgen: Your Ghostwriter in the Machine - An AI Novel Drafting Agent
---
**What is it?** `pulpgen` is a command-line tool that uses AI (Google Gemini) to automatically write a complete first-draft novel based on your idea/prompt. It handles outlining, chapter writing, and interactive AI-assisted editing.

---
## ⚡ Quick Start
1. **Install:** Requires Python 3.13+ and `uv`.
```bash
# Clone or download the code first
cd pulpgen
uv sync
```
2. **API Key:** Create a `.env` file in the `pulpgen` directory with `GEMINI_API_KEY=YOUR_KEY_HERE`
API Key can be created in Google AI Studio: https://aistudio.google.com/app/apikey
4.
```bash
# Example using a prompt file:
uv run python pulpgen.py --prompt your_idea.txt
# Or run without --prompt to enter idea interactively
```
5. **Run (Resume Project):**
```bash
uv run python pulpgen.py --resume path/to/your/project_folder
```
6. **Output:** Finds/creates a project folder (like `YYYYMMDD-slug-uuid`) containing XML state files and the final manuscript in `final.html`.
---
## Usage
Launch the `pulpgen` agent from your terminal within the project directory:
```bash
uv run python pulpgen.py [OPTIONS]
```
**Command-Line Options:**
* `--resume FOLDER_PATH`: Point to an existing project folder (e.g., `20240315-space-opera-saga-f3a4b1c9`) to continue a previously started job.
* `--prompt FILE_PATH`: Provide the path to a `.txt` file containing your book idea. This is only used when starting a *new* project (ignored if `--resume` is used).
## Project Files
`pulpgen` keeps its work organized in a dedicated project folder (e.g., `20240315-robot-romance-a1b2c3d4`):
* **`YYYYMMDD-slug-uuid/` (Project Folder):** The main case file, named with the date, a slugified title, and a unique ID.
* **`outline.xml`:** The initial blueprint. Contains metadata (title, synopsis, your idea), character profiles, and chapter summaries genGoogle's AI-powered research notebook that ingests your documents and becomes an expert on your content. Generates audio overviews, study guides, FAQs, and interactive discussions from uploaded sources.
Google DeepMind's experimental AI agent that can navigate websites, fill forms, and complete multi-step browser tasks autonomously. Uses Gemini's multimodal understanding to interact with web interfaces.
Google DeepMind's universal AI assistant prototype that can see, hear, and respond in real-time through your device camera and microphone. Demonstrates the future of multimodal AI interaction.
Google Cloud's enterprise platform for building, deploying, and managing AI agents powered by Gemini. Supports multi-agent orchestration, tool integration, and enterprise governance.
Gemini's agentic research capability that autonomously browses the web, synthesizes information from dozens of sources, and produces comprehensive research reports on any topic.
Interactive coding and content creation agent that generates, previews, and iterates on code, documents, and interactive applications in a side panel. Supports HTML/CSS/JS, Python, and more.