first commit

This commit is contained in:
2026-04-06 15:28:27 -05:00
commit 026419736d
4 changed files with 678 additions and 0 deletions

View File

@@ -0,0 +1,251 @@
---
name: manuscript-analysis
description: Use when analyzing manuscript chapters for repeated phrases, continuity errors, and story craft quality. Invoke with book number and chapter range, e.g. /manuscript-analysis 1 1-5
---
# Manuscript Analysis
Multi-agent pipeline for analyzing manuscript chapters. Invoke with book number and chapter range: `/manuscript-analysis 1 1-5`
## On Invoke
Parse args: first arg = book number (`BOOK`), second arg = chapter range (`XX-YY`). If missing, ask the user.
Set `XX` = start chapter (zero-padded), `YY` = end chapter (zero-padded).
### Validate
1. For each chapter in range, verify `chapters/book{BOOK}/ch{NN}-final.md` exists
2. If any are missing, report which and stop
3. Create `notes/analysis/` directory if it doesn't exist
### File Naming
All output files use: `notes/analysis/book{BOOK}-{type}-ch{XX}-{YY}.md`
Where `{XX}` and `{YY}` are zero-padded to 2 digits (e.g., `ch01-05`, `ch16-21`).
---
## Phase 1: Phrase Analysis
Run two agents **sequentially** (1B depends on 1A's output).
### Agent 1A — Phrase Indexer
Dispatch via Agent tool with `subagent_type: "general-purpose"`:
```
prompt: |
You are a phrase indexer for a manuscript analysis pipeline. Your job is to find repeated phrases across chapter files.
**Target chapters:** Read these files fully:
{list each chapters/book{BOOK}/ch{NN}-final.md in the range XX to YY}
**Task:**
1. Read all target chapter files
2. Extract candidate phrases: multi-word expressions (2-4 words) that appear 3 or more times within the target range. Also flag distinctive single words used excessively (adverbs, specific adjectives — not common words like "the", "was", "had", "said").
3. For EACH candidate phrase, use the Grep tool to count occurrences across ALL chapter files in chapters/book{BOOK}/ (not just the target range). Use: Grep with pattern="{phrase}" path="chapters/book{BOOK}/" output_mode="count"
4. Record results in a markdown table with columns: Phrase | Count in Ch {XX}-{YY} | Count in Full Book | Chapters Found In
5. Sort by full-book count descending
6. Write the complete index to: notes/analysis/book{BOOK}-phrase-index-ch{XX}-{YY}.md
**Important:**
- Use Grep for counting — do NOT try to load all chapters into context
- Include both the target-range count and the full-book count
- Skip extremely common phrases ("he said", "I was", "it was") — focus on distinctive repeated expressions
- Include a header noting the date, book number, and chapter range analyzed
Do NOT use the Agent tool. Do all work directly. Write only research output, no code.
```
### Agent 1B — Phrase Analyst
After Agent 1A completes, dispatch:
```
prompt: |
You are a literary editor analyzing a fantasy manuscript for phrase repetition patterns.
**Read these files:**
- Target chapters: {list each chapters/book{BOOK}/ch{NN}-final.md in the range XX to YY}
- Phrase index: notes/analysis/book{BOOK}-phrase-index-ch{XX}-{YY}.md (from prior analysis)
- Voice guidelines: CLAUDE.md (sections 5 and 11 — Phelan's voice and style guide)
**Task:**
1. Read the target chapters with a literary editor's eye
2. Using the phrase index as a starting point, analyze:
- **Structural repetition**: Repeated sentence structures, paragraph openings, or narrative beats (not just repeated words)
- **Crutch phrases**: Transitions, beats, or narration patterns that appear to be authorial habit rather than character voice
- **Overused transitions**: Words/phrases used to connect scenes or ideas that have become repetitive
3. Distinguish between:
- **Intentional voice patterns**: Phelan's established mannerisms per CLAUDE.md (dry observations, ADD tangents, precise cataloguing) — these are FEATURES, not bugs
- **Authorial habits**: Repetition that doesn't serve the voice or narrative
- **Intentional callbacks**: Phrases repeated deliberately for thematic or narrative effect
4. For each finding, provide: the phrase/pattern, example quotes with chapter references, frequency assessment, and whether it's voice vs. habit
5. Write the complete analysis to: notes/analysis/book{BOOK}-phrase-analysis-ch{XX}-{YY}.md
**Format the output as:**
- Header with date, book, chapter range
- Section 1: Crutch Phrases & Overused Expressions (highest priority)
- Section 2: Structural Repetition Patterns
- Section 3: Overused Transitions
- Section 4: Intentional Voice Patterns (noted but not flagged as problems)
- Section 5: Effective Callbacks & Deliberate Repetition
Do NOT use the Agent tool. Do all work directly. Write only research output, no code.
```
---
## Phase 2: Continuity Check
Determine agent count: if `(YY - XX + 1) > 7`, split into two agents (2A handles first half of range, 2B handles second half). Otherwise, use one agent.
### Agent 2A — Continuity Checker
Dispatch via Agent tool with `subagent_type: "general-purpose"`:
```
prompt: |
You are a continuity editor for a fantasy manuscript. Your job is to find inconsistencies, timeline errors, and contradictions.
**Read these files:**
- Target chapters: {list each chapters/book{BOOK}/ch{NN}-final.md in the assigned range}
- Story summary: world/story-summary-book{BOOK}.md
- Timeline: world/timeline-book{BOOK}.md
- Exploits log: world/magic/exploits-log.md
- Magic rules: world/magic/runic-flow-rules.md
- Economy: world/economy.md
- All files in characters/ (use Glob to find them, then read relevant ones)
- All files in world/locations/ (use Glob to find them, then read relevant ones)
**Check for:**
1. **Timeline consistency**: Do bell references, day-of-week mentions, and elapsed time match the timeline file? Flag any mismatches with specific quotes.
2. **Character consistency**: Are names spelled consistently? Do characters know things they shouldn't (or forget things they should know)? Do physical descriptions match character files?
3. **World-building facts**: Do currency amounts match economy.md? Do location descriptions match location files? Does magic usage follow runic-flow rules?
4. **Plot threads**: Are threads from earlier chapters (per story summary) picked up appropriately? Are there dangling threads that seem forgotten?
5. **Internal contradictions**: Do facts within the target range contradict each other? (e.g., a character described as tall in ch3 and short in ch5)
**For each finding, provide:**
- Category (Timeline / Character / World / Plot Thread / Internal)
- Severity (Critical = plot hole or major contradiction, Important = notable inconsistency, Minor = nitpick)
- The specific text with chapter and approximate location
- What it contradicts (with reference to the source file)
- Suggested resolution
**Write the complete report to:** notes/analysis/book{BOOK}-continuity-ch{XX}-{YY}.md
**Format:**
- Header with date, book, chapter range
- Summary of findings by severity
- Detailed findings grouped by category
- Each finding numbered for easy reference
Do NOT use the Agent tool. Do all work directly. Write only research output, no code.
```
If the range was split, Agent 2B gets an identical prompt but with its half of the chapter range. After both complete, the orchestrator merges their outputs into a single `book{BOOK}-continuity-ch{XX}-{YY}.md` file.
---
## Phase 3: Story Craft
### Agent 3A — Story Craft Analyst
Dispatch via Agent tool with `subagent_type: "general-purpose"`:
```
prompt: |
You are a developmental editor analyzing a fantasy manuscript for story craft quality.
**Read these files:**
- Target chapters: {list each chapters/book{BOOK}/ch{NN}-final.md in the range XX to YY}
- Story summary: world/story-summary-book{BOOK}.md
- Book outline: outline/book{BOOK}-outline.md
- Master instructions: CLAUDE.md (full file — contains voice guide, style rules, character bible)
- Book-specific instructions: chapters/book{BOOK}/CLAUDE.md
**Analyze the following 8 categories:**
1. **Premise & Conflict**: Is the central conflict clear and advancing across these chapters? Are stakes escalating appropriately? Does each chapter have its own mini-conflict that serves the larger arc?
2. **Character Arcs**: Is Phelan's growth visible (even if incremental)? Are supporting cast members serving their narrative functions as defined in CLAUDE.md? Are character motivations clear and consistent?
3. **Foreshadowing**: Are seeds being planted for future payoffs? Are setups subtle enough to avoid telegraphing? Are earlier setups (from story summary) being paid off in these chapters?
4. **POV Consistency**: Does every paragraph sound like Phelan? Are there slips into omniscient narration? Does Phelan observe/deduce information rather than magically knowing it?
5. **Pacing**: How are action/investigation/quiet beats distributed? Are there stretches that drag or rush? Does chapter length vary appropriately with content?
6. **World-Building Integration**: Is world detail woven into action and observation, or dumped as exposition? Does the world feel lived-in?
7. **The Noise Convention**: Are parenthetical tangents (*like this*) at the right frequency (4-6 per chapter establishing, 3-5 ongoing)? Are they doing narrative work (revealing character, advancing plot, providing humor) rather than just being decorative?
8. **What's Working Well**: Specific callouts of strong passages, effective techniques, great character moments, and well-executed craft. Be specific with quotes.
**For each category, provide:**
- Overall assessment for the chapter range
- Specific examples with chapter references and quotes
- Suggestions where applicable
**Write the complete analysis to:** notes/analysis/book{BOOK}-storycraft-ch{XX}-{YY}.md
**Format:**
- Header with date, book, chapter range
- Executive summary (2-3 sentences)
- One section per analysis category (numbered 1-8)
- Each section: assessment, examples, suggestions
Do NOT use the Agent tool. Do all work directly. Write only research output, no code.
```
---
## Phase 4: Aggregation
The orchestrator (you, the main session) performs this phase directly. Do NOT dispatch a subagent.
1. Read all intermediate reports:
- `notes/analysis/book{BOOK}-phrase-index-ch{XX}-{YY}.md`
- `notes/analysis/book{BOOK}-phrase-analysis-ch{XX}-{YY}.md`
- `notes/analysis/book{BOOK}-continuity-ch{XX}-{YY}.md`
- `notes/analysis/book{BOOK}-storycraft-ch{XX}-{YY}.md`
2. Write a consolidated report to `notes/analysis/book{BOOK}-analysis-ch{XX}-{YY}.md` with:
**Format:**
```
# Manuscript Analysis: Book {BOOK}, Chapters {XX}{YY}
**Date:** {today}
**Chapters analyzed:** {count}
**Analysis phases:** Phrase Analysis, Continuity, Story Craft
## Summary
- Critical issues: {count}
- Important issues: {count}
- Suggestions: {count}
## Critical Issues
{items from all reports rated Critical — plot holes, major continuity breaks, significant voice failures}
## Important Issues
{items rated Important — repeated phrases needing attention, notable inconsistencies, craft improvements}
## Suggestions
{lower-priority items — minor repetition, style polish, optional improvements}
## What's Working Well
{positive findings from story craft report}
## Detailed Reports
See individual analysis files for full details:
- Phrase index: book{BOOK}-phrase-index-ch{XX}-{YY}.md
- Phrase analysis: book{BOOK}-phrase-analysis-ch{XX}-{YY}.md
- Continuity: book{BOOK}-continuity-ch{XX}-{YY}.md
- Story craft: book{BOOK}-storycraft-ch{XX}-{YY}.md
```
3. Deduplicate: if multiple agents flagged the same issue, consolidate into one entry and note which analyses found it.
4. Present a brief summary to the user with the consolidated report path and top findings.