Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Enterprise-grade research with multi-source synthesis, citation tracking, and verification. 8-phase pipeline with auto-continuation.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
reference/continuation.md
1# Auto-Continuation Protocol23## When to Use45Trigger auto-continuation when report exceeds 18,000 words in single run.67---89## Strategy Overview10111. Generate sections 1-10 (stay under 18K words)122. Save continuation state file with context preservation133. Spawn continuation agent via Task tool144. Continuation agent: Reads state -> Generates next batch -> Spawns next if needed155. Chain continues recursively until complete1617---1819## Continuation State File2021**Location:** `~/.claude/research_output/continuation_state_[report_id].json`2223```json24{25"version": "3.0.0",26"report_id": "[unique_id]",27"file_path": "[absolute_path_to_report.md]",28"mode": "[quick|standard|deep|ultradeep]",2930"progress": {31"sections_completed": ["list of section IDs"],32"total_planned_sections": 15,33"word_count_so_far": 12000,34"continuation_count": 135},3637"artifacts": {38"sources_path": "[folder]/sources.jsonl",39"evidence_path": "[folder]/evidence.jsonl",40"claims_path": "[folder]/claims.jsonl",41"run_manifest_path": "[folder]/run_manifest.json"42},4344"research_context": {45"research_question": "[original question]",46"key_themes": ["theme1", "theme2"],47"main_findings_summary": [48"Finding 1: [100-word summary]",49"Finding 2: [100-word summary]"50],51"narrative_arc": "middle"52},5354"quality_metrics": {55"avg_words_per_finding": 1500,56"citation_density": 5.2,57"prose_vs_bullets_ratio": "85% prose",58"writing_style": "technical-precise-data-driven"59},6061"next_sections": [62{"id": 11, "type": "finding", "title": "Finding X", "target_words": 1500},63{"id": 12, "type": "synthesis", "title": "Synthesis", "target_words": 1000}64]65}66```6768---6970## Spawning Continuation Agent7172Use Task tool:7374```75Task(76subagent_type="general-purpose",77description="Continue deep-research report generation",78prompt="""79CONTINUATION TASK: Continue existing deep-research report.8081CRITICAL INSTRUCTIONS:821. Read continuation state: ~/.claude/research_output/continuation_state_[report_id].json832. Read existing report: [file_path from state]843. Read LAST 3 completed sections for flow/style854. Load research context: themes, narrative arc, writing style865. Load source registry from state.artifacts.sources_path — use stable source_ids, assign display numbers via citation_manager.py876. Maintain quality metrics (avg words, citation density, prose ratio)8889YOUR TASK:90Generate next batch (stay under 18,000 words):91[List next_sections from state]9293Use Write/Edit to append to: [file_path]9495QUALITY GATES:96- Words per section: Within +/-20% of avg_words_per_finding97- Citation density: Match +/-0.5 per 1K words98- Prose ratio: Maintain >=80%99- Theme alignment: Section ties to key_themes100101After generating:102- If more sections remain: Update state, spawn next agent103- If final sections: Generate bibliography, verify report, cleanup state104"""105)106```107108---109110## Continuation Agent Quality Protocol111112### Context Loading (CRITICAL)1131141. Read continuation_state.json -> Load ALL context1152. Read existing report file -> Review last 3 sections1163. Extract patterns:117- Sentence structure complexity118- Technical terminology used119- Citation placement patterns120- Paragraph transition style121122### Pre-Generation Checklist123124- [ ] Loaded research context (themes, question, narrative arc)125- [ ] Reviewed previous sections for flow126- [ ] Loaded source registry from artifacts (stable source_ids, not citation numbers)127- [ ] Loaded quality targets (words, density, style)128- [ ] Understand narrative position (beginning/middle/end)129130### Per-Section Generation1311321. Generate section content1332. Quality checks:134- Word count within +/-20%135- Citation density matches136- Prose ratio >=80%137- Theme connection verified138- Style consistent1393. If ANY fails: Regenerate1404. If passes: Write to file, update state141142### Handoff Decision143144Calculate: Current words + remaining sections x avg_words_per_section145- If total < 18K: Generate all + finish146- If total > 18K: Generate partial, update state, spawn next agent147148### Final Agent Responsibilities149150- Generate final content sections151- Generate COMPLETE bibliography from state.citations.bibliography_entries152- Read entire assembled report153- Run validation: `python scripts/validate_report.py --report [path]`154- Delete continuation_state.json (cleanup)155- Report complete to user156157---158159## User Communication160161After spawning continuation:162```163Report Generation: Part 1 Complete (N sections, X words)164Auto-continuing via spawned agent...165Next batch: [section list]166Progress: [X%] complete167```168