# Velith — AI-Native Book Publishing System

## Overview

Build books like software. 6-phase pipeline from blank page to published book, with quality gates at every stage. 16 skills, 7 agents, 8 genre systems.

```
Phase 0: Onboarding → Phase 1: Ideation → Phase 2: Outlining → Phase 3: Drafting → Phase 4: Editing → Phase 5: Publishing
```

## Pipeline Phases

### Phase 0: Onboarding
- Genre selection (fiction/non-fiction/technical/screenplay/poetry/game/academic/custom)
- Target audience definition, language selection
- Generate `STYLE.md` (voice, tone, conventions) and `PRD.md` (book requirements)
- Source material scan

### Phase 1: Ideation
- Market research, competing titles, concept distillation (elevator pitch)
- Unique value proposition, scope definition
- Save to `ideation.md`

### Phase 2: Outlining
- Full chapter outline with dependencies and cross-references
- Per-chapter specs: title, hook, key concepts, word target, difficulty
- Save to `outline.md`; `book-architect` validates structure

### Phase 3: Drafting
- Plan-Then-Execute: chapter-by-chapter generation
- Each chapter: outline context + previous chapter summary + style guide
- `scene-generator` decomposes into scenes (fiction only), `chapter-writer` generates, `continuity-editor` checks consistency
- Quality gate: line count, frontmatter, style compliance

### Phase 4: Editing
5-stage pipeline:
1. **Editorial Assessment** — macro structure, chapter order, pacing
2. **Developmental Edit** — flow, gaps, evidence quality
3. **Line Edit** — sentence-level clarity, word choice
4. **Copy Edit** — grammar, terminology, formatting
5. **Proofread** — final typos, cross-references

### Phase 5: Publishing
- Format conversion: EPUB, PDF, MOBI, TXT, Markdown (via Pandoc + Calibre)
- `cover-designer` generates cover concepts, `marketing-expert` creates launch strategy
- Metadata, title candidates, KDP checklist

## Project Structure

```
{project-dir}/
├── PRD.md              # Book requirements (Phase 0)
├── STYLE.md            # Voice, tone, conventions (Phase 0)
├── ideation.md         # Ideas, market research (Phase 1)
├── outline.md          # Full chapter outline (Phase 2)
├── drafts/             # Chapter drafts (Phase 3)
├── edits/              # Editing reports (Phase 4)
├── publish/            # Final outputs (Phase 5)
└── sources/            # Source material references
```

## Genre Conventions

| Genre | Key Patterns |
|-------|-------------|
| Fiction | Save the Cat! 15-beat, character bible (GMC), scene beats (RDD), POV consistency |
| Non-Fiction | Problem-solution, learner personas, evidence hierarchy, chapter hooks |
| Technical | Concept progression (novice→expert), code examples, diagrams, labs |
| Screenplay | 3-act + 8-sequence, dialogue subtext, A/B story, action lines |
| Poetry | Form types (sonnet/haiku/free verse), meter, imagery systems, collection arc |
| Game | Quest/event trees, branching dialogue, lore bible, flag system |
| Academic | IMRAD, lit review, argument chains, citation practices |
| Custom | Compose patterns from any genre via genre-creator |

## AI-Slop Detection

Flag these patterns in any draft:

- **Excessive modifiers:** revolutionary, game-changer, groundbreaking, seamless, robust
- **Repetitive transitions:** overuse of "however", "moreover", "furthermore"
- **Generic conclusions:** "in conclusion", "ultimately", "it's important to note"
- **Weak hedging:** "can be", "seems like", "arguably"
- **AI markers:** "delve", "tapestry", "landscape" (metaphorical), "nuanced", "plethora"
- **List overuse:** 5+ consecutive bullets without prose

## Quality Gates

| Phase | Gate | Evidence |
|-------|------|----------|
| 0 | Project initialized | PRD.md + STYLE.md exist |
| 1 | Concept validated | Elevator pitch + 3 competing titles |
| 2 | Outline complete | All chapters specified + cross-reference map |
| 3 | Drafts complete | All chapters meet word target + frontmatter |
| 4 | Editing complete | 5-stage passed + <5 issues remaining |
| 5 | Publish ready | EPUB/PDF generated + metadata complete |

## Design Principles

- **Plan-Then-Execute** — Outline first, validate, then write
- **Idempotent** — Skip completed chapters, resume from where you left off
- **Token Efficient** — Summary-based context, not full text
- **Genre-Aware** — Different structures, templates, and validation per genre
- **Quality Gated** — Each phase must pass criteria before proceeding
