[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6EJRGM8C6J5TP6VJS1X8JQC":3,"skill-same:01M6EJRGM8C6J5TP6VJS1X8JQC":63},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":29,"linkOnly":30,"markdownContent":31,"markdownBody":32,"frontMatter":33,"refName":34,"commitSha":35,"skillDirectory":36,"forksCount":37,"repositoryHtmlUrl":38,"repositoryHomepageUrl":39,"ownerHtmlUrl":40,"ownerBlogUrl":6,"ownerDescription":41,"updatedAt":42,"install":43,"resources":56},"01M6EJRGM8C6J5TP6VJS1X8JQC","ai-chapter-consolidate",null,"Use AI to merge individual page HTML files into a unified chapter document. Creates continuous document format for improved reading experience and semantic consistency.","ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",67,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Faiskillstore\u002Fmarketplace\u002Fabejitsu\u002Fai-chapter-consolidate\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28],"consolidate","ai chapter consolidate","merge","format","page","use","html","files","document","semantic","2026-11-10 10:12:30",false,"---\nname: ai-chapter-consolidate\ndescription: Use AI to merge individual page HTML files into a unified chapter document. Creates continuous document format for improved reading experience and semantic consistency.\n---\n\n# AI Chapter Consolidate Skill\n\n## Purpose\n\nThis skill uses AI to **intelligently merge individual page HTML files** into a single, continuous chapter document. Rather than simple concatenation, the AI:\n\n- Removes duplicate headers\u002Ffooters from continuation pages\n- Ensures consistent heading hierarchy across pages\n- Maintains semantic structure throughout\n- Preserves all content without loss or repetition\n- Creates smooth content flow (no page breaks)\n\nThe result is a **unified chapter document** in the continuous format (single `page-container`, single `page-content`).\n\n## What to Do\n\n1. **Collect all page HTML files for chapter**\n   - Gather `04_page_XX.html` files for all pages in chapter\n   - Verify all files exist and are valid\n   - Sort by page number (ascending)\n\n2. **Extract content from each page**\n   - Load each HTML file\n   - Extract main content from `\u003Cmain class=\"page-content\">`\n   - Preserve semantic classes and structure\n\n3. **Prepare consolidation inputs for AI**\n   - Page 1: Full content including chapter header\n   - Pages 2+: Extract content sections, remove chapter header\u002Fnav\n   - Preserve all text and structure\n   - Note any special sections (exhibits, tables, etc.)\n\n4. **Invoke AI consolidation**\n   - Send all page contents to Claude\n   - Request merging into single continuous document\n   - Specify structural requirements\n   - Request heading hierarchy normalization\n\n5. **Process AI output**\n   - Extract consolidated HTML from response\n   - Verify structure integrity\n   - Ensure all pages represented\n   - Check heading hierarchy\n\n6. **Save consolidated document**\n   - Save to: `output\u002Fchapter_XX\u002Fchapter_artifacts\u002Fchapter_XX.html`\n   - Create metadata\u002Flog file\n   - Calculate statistics\n\n## Input Files\n\n**Per-page HTML files** (validated by previous gate):\n- `output\u002Fchapter_XX\u002Fpage_artifacts\u002Fpage_16\u002F04_page_16.html` (Chapter opening)\n- `output\u002Fchapter_XX\u002Fpage_artifacts\u002Fpage_17\u002F04_page_17.html` (Continuation)\n- `output\u002Fchapter_XX\u002Fpage_artifacts\u002Fpage_18\u002F04_page_18.html` (Continuation)\n- ... (all pages in chapter)\n\n**Chapter metadata** (from analysis):\n- Page range (first and last page of chapter)\n- Chapter number\n- Chapter title\n- Expected page count\n\n## AI Consolidation Prompt\n\nThe prompt sent to Claude:\n\n```\nYou are merging individual page HTML documents into a single, continuous chapter.\n\nINPUT PAGES:\n\nPage 1 (Opening - include chapter header):\n[HTML content from page 1]\n\nPage 2 (Continuation):\n[HTML content from page 2]\n\nPage 3 (Continuation):\n[HTML content from page 3]\n\n... (all pages)\n\nTASK:\nMerge these pages into a single HTML document that reads as one continuous chapter.\n\nREQUIREMENTS:\n\n1. Structure:\n   - Create single \u003Cdiv class=\"page-container\"> wrapping everything\n   - Create single \u003Cmain class=\"page-content\"> for all content\n   - Remove page-break indicators or comments\n   - Create truly continuous document (no paginated elements)\n\n2. Chapter Header:\n   - Keep chapter header from Page 1 (chapter number, title)\n   - Remove chapter headers\u002Ftitles from continuation pages\n   - Keep section navigation if present on Page 1\n   - Remove duplicate navigation from other pages\n\n3. Content Preservation:\n   - Include ALL text content from all pages\n   - Preserve exact wording (no paraphrasing)\n   - Maintain all lists, paragraphs, tables\n   - Include all semantic classes\n   - Keep all HTML structure\n\n4. Heading Hierarchy:\n   - Normalize heading levels across merged pages\n   - Page 1 h1 = Chapter title (stays as h1)\n   - First section in each page = h2 (main sections)\n   - Sub-sections = h3 or h4 as needed\n   - Ensure no hierarchy jumps (h1 → h3 without h2)\n   - Number consecutive headings logically\n\n5. Content Flow:\n   - Remove page-specific headers\u002Ffooters\n   - Merge seamlessly so content flows naturally\n   - No artificial breaks or transitions\n   - Paragraphs continue logically\n   - Lists maintain coherence\n\n6. Exhibits and Images:\n   - Preserve all tables and figures\n   - Keep exhibit titles and captions\n   - Include all images with proper paths\n   - Maintain table of contents if present\n\n7. CSS Classes:\n   - Preserve all semantic classes (section-heading, paragraph, etc.)\n   - Keep consistent class usage throughout\n   - Ensure classes match chapter opening page style\n   - Do not add or remove classes\n\n8. Metadata:\n   - Include title tag: \"Chapter N: Title - Pages X-Y\"\n   - Keep meta charset and viewport\n   - Link stylesheet: \u003Clink rel=\"stylesheet\" href=\"..\u002F..\u002Fstyles\u002Fmain.css\">\n\nOUTPUT:\n\nReturn ONLY a single, valid HTML5 document:\n\n```html\n\u003C!DOCTYPE html>\n\u003Chtml lang=\"en\">\n\u003Chead>\n    \u003Cmeta charset=\"UTF-8\">\n    \u003Cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    \u003Ctitle>Chapter [N]: [Title] - Pages [X-Y]\u003C\u002Ftitle>\n    \u003Clink rel=\"stylesheet\" href=\"..\u002F..\u002Fstyles\u002Fmain.css\">\n\u003C\u002Fhead>\n\u003Cbody>\n    \u003Cdiv class=\"page-container\">\n        \u003Cmain class=\"page-content\">\n            \u003C!-- All content from all pages, merged seamlessly -->\n        \u003C\u002Fmain>\n    \u003C\u002Fdiv>\n\u003C\u002Fbody>\n\u003C\u002Fhtml>\n```\n\nVALIDATION:\n- Single HTML5 document\n- All pages represented\n- No page breaks or transitions\n- Proper heading hierarchy\n- All text preserved\n```\n\n## Page Content Extraction Logic\n\nBefore sending to AI, extract content strategically:\n\n### Page 1 (Opening):\n- **Include**: Entire page HTML content\n- **Reason**: Contains chapter header, navigation, first section\n- **Preserve**: All elements (header, nav, dividers, content)\n\n### Pages 2-N (Continuation):\n- **Extract**: Only content after chapter header\n- **Skip**: Chapter number, chapter title, section navigation\n- **Preserve**: Section headings, paragraphs, lists, exhibits\n- **Include**: All semantic content sections\n\n### Example extraction:\n```html\n\u003C!-- Page 1: Keep everything -->\n\u003Cdiv class=\"chapter-header\">\n    \u003Cspan class=\"chapter-number\">2\u003C\u002Fspan>\n    \u003Ch1 class=\"chapter-title\">Rights in Real Estate\u003C\u002Fh1>\n\u003C\u002Fdiv>\n\u003Cnav class=\"section-navigation\">...\u003C\u002Fnav>\n\u003Ch2 class=\"section-heading\">REAL PROPERTY RIGHTS\u003C\u002Fh2>\n\u003Cp class=\"paragraph\">...\u003C\u002Fp>\n\n\u003C!-- Page 2: Skip header, keep content -->\n\u003C!-- \u003Cdiv class=\"chapter-header\">...\u003C\u002Fdiv> SKIPPED -->\n\u003C!-- \u003Cnav class=\"section-navigation\">...\u003C\u002Fnav> SKIPPED -->\n\u003Ch4 class=\"subsection-heading\">Physical characteristics.\u003C\u002Fh4>\n\u003Cp class=\"paragraph\">...\u003C\u002Fp>\n\u003Cul class=\"bullet-list\">...\u003C\u002Ful>\n\n\u003C!-- Page 3: Continue same pattern -->\n\u003Ch4 class=\"subsection-heading\">Interdependence.\u003C\u002Fh4>\n\u003Cp class=\"paragraph\">...\u003C\u002Fp>\n```\n\n## Output File\n\n### Consolidated Chapter HTML\n**Path**: `output\u002Fchapter_XX\u002Fchapter_artifacts\u002Fchapter_XX.html`\n\n**Structure**:\n```\n\u003C!DOCTYPE html>\n\u003Chtml lang=\"en\">\n\u003Chead>\n    \u003Cmeta charset=\"UTF-8\">\n    \u003Cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    \u003Ctitle>Chapter 2: Rights in Real Estate - Pages 16-29\u003C\u002Ftitle>\n    \u003Clink rel=\"stylesheet\" href=\"..\u002F..\u002Fstyles\u002Fmain.css\">\n\u003C\u002Fhead>\n\u003Cbody>\n    \u003Cdiv class=\"page-container\">\n        \u003Cmain class=\"page-content\">\n            \u003C!-- Chapter header (from page 1) -->\n            \u003Cdiv class=\"chapter-header\">...\u003C\u002Fdiv>\n            \u003Cnav class=\"section-navigation\">...\u003C\u002Fnav>\n            \u003Chr class=\"section-divider\">\n\n            \u003C!-- Page 1 content -->\n            \u003Ch2 class=\"section-heading\">REAL PROPERTY RIGHTS\u003C\u002Fh2>\n            \u003Cp class=\"paragraph\">...\u003C\u002Fp>\n\n            \u003C!-- Page 2 content (seamlessly merged) -->\n            \u003Ch4 class=\"subsection-heading\">Physical characteristics.\u003C\u002Fh4>\n            \u003Cp class=\"paragraph\">...\u003C\u002Fp>\n            \u003Cul class=\"bullet-list\">...\u003C\u002Ful>\n\n            \u003C!-- Page 3 content (continuing flow) -->\n            \u003Ch4 class=\"subsection-heading\">Interdependence.\u003C\u002Fh4>\n            \u003Cp class=\"paragraph\">...\u003C\u002Fp>\n\n            \u003C!-- ... more content from remaining pages ... -->\n\n            \u003C!-- Final page content -->\n            \u003Ch2 class=\"section-heading\">REGULATIONS AND LICENSING\u003C\u002Fh2>\n            \u003Cp class=\"paragraph\">...\u003C\u002Fp>\n        \u003C\u002Fmain>\n    \u003C\u002Fdiv>\n\u003C\u002Fbody>\n\u003C\u002Fhtml>\n```\n\n### Consolidation Log\n**Path**: `output\u002Fchapter_XX\u002Fchapter_artifacts\u002Fconsolidation_log.json`\n\n```json\n{\n  \"chapter\": 2,\n  \"title\": \"Rights in Real Estate\",\n  \"book_pages\": \"16-29\",\n  \"pdf_indices\": \"15-28\",\n  \"consolidated_at\": \"2025-11-08T14:35:00Z\",\n  \"pages_merged\": 14,\n  \"pages_included\": [\n    {\n      \"page\": 16,\n      \"book_page\": 17,\n      \"status\": \"opening_chapter\",\n      \"content_type\": \"header_navigation_content\"\n    },\n    {\n      \"page\": 17,\n      \"book_page\": 18,\n      \"status\": \"continuation\",\n      \"content_type\": \"subsections_paragraphs\"\n    },\n    {\n      \"page\": 18,\n      \"book_page\": 19,\n      \"status\": \"continuation\",\n      \"content_type\": \"subsections_paragraphs_list\"\n    }\n    \u002F\u002F ... all pages\n  ],\n  \"content_statistics\": {\n    \"total_headings\": {\n      \"h1\": 1,\n      \"h2\": 4,\n      \"h3\": 0,\n      \"h4\": 12\n    },\n    \"total_paragraphs\": 156,\n    \"total_lists\": 12,\n    \"total_list_items\": 42,\n    \"total_tables\": 3,\n    \"total_images\": 5,\n    \"total_words\": 12547\n  },\n  \"ai_model\": \"claude-3-5-sonnet-20241022\",\n  \"consolidation_notes\": \"Successfully merged 14 pages into continuous format\"\n}\n```\n\n## Implementation\n\nExecute consolidation via Python wrapper:\n\n```bash\ncd Calypso\u002Ftools\n\n# Run consolidation\npython3 consolidate_chapter.py \\\n  --chapter 2 \\\n  --pages 15-28 \\\n  --output \"..\u002Foutput\" \\\n  --mapping \"..\u002Fanalysis\u002Fpage_mapping.json\"\n\n# Or invoke directly via Claude API:\n# The orchestrator sends the AI prompt with all page contents\n```\n\n## Quality Checks\n\nBefore passing to next gate:\n\n1. **File created**\n   - [ ] `chapter_XX.html` exists\n   - [ ] File is valid HTML (parseable)\n   - [ ] File size reasonable (> 50KB typical)\n\n2. **Structure validated**\n   - [ ] Single `\u003Cdiv class=\"page-container\">`\n   - [ ] Single `\u003Cmain class=\"page-content\">`\n   - [ ] All tags properly closed\n   - [ ] No duplicate content\n\n3. **Content completeness**\n   - [ ] All pages represented\n   - [ ] No missing sections\n   - [ ] Paragraph\u002Fheading counts reasonable\n   - [ ] All text content present\n\n4. **Heading hierarchy**\n   - [ ] Starts with h1 (chapter title)\n   - [ ] h1 count = 1\n   - [ ] h2 = major sections\n   - [ ] h3\u002Fh4 = subsections\n   - [ ] No hierarchy jumps\n\n5. **Metadata logged**\n   - [ ] Consolidation timestamp recorded\n   - [ ] Pages merged count documented\n   - [ ] Content statistics calculated\n   - [ ] Log file saved\n\n## Success Criteria\n\n✓ All pages merged into single document\n✓ Chapter header preserved from page 1\n✓ Duplicate headers removed from continuation pages\n✓ Content flows naturally (continuous format)\n✓ Heading hierarchy is correct\n✓ All text content preserved\n✓ Semantic classes maintained\n✓ Ready for semantic validation\n\n## Error Handling\n\n**If page HTML is incomplete**:\n- Note in consolidation log\n- Include whatever content is available\n- Proceed to validation (validation will catch issues)\n\n**If heading hierarchy is ambiguous**:\n- AI makes best judgment\n- Semantic validation gate will refine if needed\n- Document decision in log\n\n**If content appears duplicated**:\n- AI deduplicates automatically\n- Verify word count is reasonable\n- Log any unusual content patterns\n\n## Next Steps\n\nOnce consolidation completes:\n1. **Quality Gate 2** (semantic-validate) checks semantic structure\n2. **Skill 5** (quality-report-generate) generates final report\n3. **Quality Gate 3** (visual-accuracy-check) validates appearance\n\n## Design Notes\n\n- This skill is **AI-powered** (uses probabilistic consolidation)\n- Relies on AI's understanding of document structure\n- Produces continuous format (no page breaks)\n- Merges intelligently (not just concatenation)\n- Output will be refined by validation gates\n\n## Testing\n\nTo test consolidation on Chapter 2:\n\n```bash\n# Input: 14 individual page HTML files (pages 16-29)\n# Process: AI merges into single continuous chapter\n# Output: chapter_02.html (single, unified document)\n\n# Verify:\n# - File size is sum of all pages\n# - Content flows logically\n# - Heading hierarchy makes sense\n# - No duplicate sections\n```\n","# AI Chapter Consolidate Skill\n\n## Purpose\n\nThis skill uses AI to **intelligently merge individual page HTML files** into a single, continuous chapter document. Rather than simple concatenation, the AI:\n\n- Removes duplicate headers\u002Ffooters from continuation pages\n- Ensures consistent heading hierarchy across pages\n- Maintains semantic structure throughout\n- Preserves all content without loss or repetition\n- Creates smooth content flow (no page breaks)\n\nThe result is a **unified chapter document** in the continuous format (single `page-container`, single `page-content`).\n\n## What to Do\n\n1. **Collect all page HTML files for chapter**\n   - Gather `04_page_XX.html` files for all pages in chapter\n   - Verify all files exist and are valid\n   - Sort by page number (ascending)\n\n2. **Extract content from each page**\n   - Load each HTML file\n   - Extract main content from `\u003Cmain class=\"page-content\">`\n   - Preserve semantic classes and structure\n\n3. **Prepare consolidation inputs for AI**\n   - Page 1: Full content including chapter header\n   - Pages 2+: Extract content sections, remove chapter header\u002Fnav\n   - Preserve all text and structure\n   - Note any special sections (exhibits, tables, etc.)\n\n4. **Invoke AI consolidation**\n   - Send all page contents to Claude\n   - Request merging into single continuous document\n   - Specify structural requirements\n   - Request heading hierarchy normalization\n\n5. **Process AI output**\n   - Extract consolidated HTML from response\n   - Verify structure integrity\n   - Ensure all pages represented\n   - Check heading hierarchy\n\n6. **Save consolidated document**\n   - Save to: `output\u002Fchapter_XX\u002Fchapter_artifacts\u002Fchapter_XX.html`\n   - Create metadata\u002Flog file\n   - Calculate statistics\n\n## Input Files\n\n**Per-page HTML files** (validated by previous gate):\n- `output\u002Fchapter_XX\u002Fpage_artifacts\u002Fpage_16\u002F04_page_16.html` (Chapter opening)\n- `output\u002Fchapter_XX\u002Fpage_artifacts\u002Fpage_17\u002F04_page_17.html` (Continuation)\n- `output\u002Fchapter_XX\u002Fpage_artifacts\u002Fpage_18\u002F04_page_18.html` (Continuation)\n- ... (all pages in chapter)\n\n**Chapter metadata** (from analysis):\n- Page range (first and last page of chapter)\n- Chapter number\n- Chapter title\n- Expected page count\n\n## AI Consolidation Prompt\n\nThe prompt sent to Claude:\n\n```\nYou are merging individual page HTML documents into a single, continuous chapter.\n\nINPUT PAGES:\n\nPage 1 (Opening - include chapter header):\n[HTML content from page 1]\n\nPage 2 (Continuation):\n[HTML content from page 2]\n\nPage 3 (Continuation):\n[HTML content from page 3]\n\n... (all pages)\n\nTASK:\nMerge these pages into a single HTML document that reads as one continuous chapter.\n\nREQUIREMENTS:\n\n1. Structure:\n   - Create single \u003Cdiv class=\"page-container\"> wrapping everything\n   - Create single \u003Cmain class=\"page-content\"> for all content\n   - Remove page-break indicators or comments\n   - Create truly continuous document (no paginated elements)\n\n2. Chapter Header:\n   - Keep chapter header from Page 1 (chapter number, title)\n   - Remove chapter headers\u002Ftitles from continuation pages\n   - Keep section navigation if present on Page 1\n   - Remove duplicate navigation from other pages\n\n3. Content Preservation:\n   - Include ALL text content from all pages\n   - Preserve exact wording (no paraphrasing)\n   - Maintain all lists, paragraphs, tables\n   - Include all semantic classes\n   - Keep all HTML structure\n\n4. Heading Hierarchy:\n   - Normalize heading levels across merged pages\n   - Page 1 h1 = Chapter title (stays as h1)\n   - First section in each page = h2 (main sections)\n   - Sub-sections = h3 or h4 as needed\n   - Ensure no hierarchy jumps (h1 → h3 without h2)\n   - Number consecutive headings logically\n\n5. Content Flow:\n   - Remove page-specific headers\u002Ffooters\n   - Merge seamlessly so content flows naturally\n   - No artificial breaks or transitions\n   - Paragraphs continue logically\n   - Lists maintain coherence\n\n6. Exhibits and Images:\n   - Preserve all tables and figures\n   - Keep exhibit titles and captions\n   - Include all images with proper paths\n   - Maintain table of contents if present\n\n7. CSS Classes:\n   - Preserve all semantic classes (section-heading, paragraph, etc.)\n   - Keep consistent class usage throughout\n   - Ensure classes match chapter opening page style\n   - Do not add or remove classes\n\n8. Metadata:\n   - Include title tag: \"Chapter N: Title - Pages X-Y\"\n   - Keep meta charset and viewport\n   - Link stylesheet: \u003Clink rel=\"stylesheet\" href=\"..\u002F..\u002Fstyles\u002Fmain.css\">\n\nOUTPUT:\n\nReturn ONLY a single, valid HTML5 document:\n\n```html\n\u003C!DOCTYPE html>\n\u003Chtml lang=\"en\">\n\u003Chead>\n    \u003Cmeta charset=\"UTF-8\">\n    \u003Cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    \u003Ctitle>Chapter [N]: [Title] - Pages [X-Y]\u003C\u002Ftitle>\n    \u003Clink rel=\"stylesheet\" href=\"..\u002F..\u002Fstyles\u002Fmain.css\">\n\u003C\u002Fhead>\n\u003Cbody>\n    \u003Cdiv class=\"page-container\">\n        \u003Cmain class=\"page-content\">\n            \u003C!-- All content from all pages, merged seamlessly -->\n        \u003C\u002Fmain>\n    \u003C\u002Fdiv>\n\u003C\u002Fbody>\n\u003C\u002Fhtml>\n```\n\nVALIDATION:\n- Single HTML5 document\n- All pages represented\n- No page breaks or transitions\n- Proper heading hierarchy\n- All text preserved\n```\n\n## Page Content Extraction Logic\n\nBefore sending to AI, extract content strategically:\n\n### Page 1 (Opening):\n- **Include**: Entire page HTML content\n- **Reason**: Contains chapter header, navigation, first section\n- **Preserve**: All elements (header, nav, dividers, content)\n\n### Pages 2-N (Continuation):\n- **Extract**: Only content after chapter header\n- **Skip**: Chapter number, chapter title, section navigation\n- **Preserve**: Section headings, paragraphs, lists, exhibits\n- **Include**: All semantic content sections\n\n### Example extraction:\n```html\n\u003C!-- Page 1: Keep everything -->\n\u003Cdiv class=\"chapter-header\">\n    \u003Cspan class=\"chapter-number\">2\u003C\u002Fspan>\n    \u003Ch1 class=\"chapter-title\">Rights in Real Estate\u003C\u002Fh1>\n\u003C\u002Fdiv>\n\u003Cnav class=\"section-navigation\">...\u003C\u002Fnav>\n\u003Ch2 class=\"section-heading\">REAL PROPERTY RIGHTS\u003C\u002Fh2>\n\u003Cp class=\"paragraph\">...\u003C\u002Fp>\n\n\u003C!-- Page 2: Skip header, keep content -->\n\u003C!-- \u003Cdiv class=\"chapter-header\">...\u003C\u002Fdiv> SKIPPED -->\n\u003C!-- \u003Cnav class=\"section-navigation\">...\u003C\u002Fnav> SKIPPED -->\n\u003Ch4 class=\"subsection-heading\">Physical characteristics.\u003C\u002Fh4>\n\u003Cp class=\"paragraph\">...\u003C\u002Fp>\n\u003Cul class=\"bullet-list\">...\u003C\u002Ful>\n\n\u003C!-- Page 3: Continue same pattern -->\n\u003Ch4 class=\"subsection-heading\">Interdependence.\u003C\u002Fh4>\n\u003Cp class=\"paragraph\">...\u003C\u002Fp>\n```\n\n## Output File\n\n### Consolidated Chapter HTML\n**Path**: `output\u002Fchapter_XX\u002Fchapter_artifacts\u002Fchapter_XX.html`\n\n**Structure**:\n```\n\u003C!DOCTYPE html>\n\u003Chtml lang=\"en\">\n\u003Chead>\n    \u003Cmeta charset=\"UTF-8\">\n    \u003Cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    \u003Ctitle>Chapter 2: Rights in Real Estate - Pages 16-29\u003C\u002Ftitle>\n    \u003Clink rel=\"stylesheet\" href=\"..\u002F..\u002Fstyles\u002Fmain.css\">\n\u003C\u002Fhead>\n\u003Cbody>\n    \u003Cdiv class=\"page-container\">\n        \u003Cmain class=\"page-content\">\n            \u003C!-- Chapter header (from page 1) -->\n            \u003Cdiv class=\"chapter-header\">...\u003C\u002Fdiv>\n            \u003Cnav class=\"section-navigation\">...\u003C\u002Fnav>\n            \u003Chr class=\"section-divider\">\n\n            \u003C!-- Page 1 content -->\n            \u003Ch2 class=\"section-heading\">REAL PROPERTY RIGHTS\u003C\u002Fh2>\n            \u003Cp class=\"paragraph\">...\u003C\u002Fp>\n\n            \u003C!-- Page 2 content (seamlessly merged) -->\n            \u003Ch4 class=\"subsection-heading\">Physical characteristics.\u003C\u002Fh4>\n            \u003Cp class=\"paragraph\">...\u003C\u002Fp>\n            \u003Cul class=\"bullet-list\">...\u003C\u002Ful>\n\n            \u003C!-- Page 3 content (continuing flow) -->\n            \u003Ch4 class=\"subsection-heading\">Interdependence.\u003C\u002Fh4>\n            \u003Cp class=\"paragraph\">...\u003C\u002Fp>\n\n            \u003C!-- ... more content from remaining pages ... -->\n\n            \u003C!-- Final page content -->\n            \u003Ch2 class=\"section-heading\">REGULATIONS AND LICENSING\u003C\u002Fh2>\n            \u003Cp class=\"paragraph\">...\u003C\u002Fp>\n        \u003C\u002Fmain>\n    \u003C\u002Fdiv>\n\u003C\u002Fbody>\n\u003C\u002Fhtml>\n```\n\n### Consolidation Log\n**Path**: `output\u002Fchapter_XX\u002Fchapter_artifacts\u002Fconsolidation_log.json`\n\n```json\n{\n  \"chapter\": 2,\n  \"title\": \"Rights in Real Estate\",\n  \"book_pages\": \"16-29\",\n  \"pdf_indices\": \"15-28\",\n  \"consolidated_at\": \"2025-11-08T14:35:00Z\",\n  \"pages_merged\": 14,\n  \"pages_included\": [\n    {\n      \"page\": 16,\n      \"book_page\": 17,\n      \"status\": \"opening_chapter\",\n      \"content_type\": \"header_navigation_content\"\n    },\n    {\n      \"page\": 17,\n      \"book_page\": 18,\n      \"status\": \"continuation\",\n      \"content_type\": \"subsections_paragraphs\"\n    },\n    {\n      \"page\": 18,\n      \"book_page\": 19,\n      \"status\": \"continuation\",\n      \"content_type\": \"subsections_paragraphs_list\"\n    }\n    \u002F\u002F ... all pages\n  ],\n  \"content_statistics\": {\n    \"total_headings\": {\n      \"h1\": 1,\n      \"h2\": 4,\n      \"h3\": 0,\n      \"h4\": 12\n    },\n    \"total_paragraphs\": 156,\n    \"total_lists\": 12,\n    \"total_list_items\": 42,\n    \"total_tables\": 3,\n    \"total_images\": 5,\n    \"total_words\": 12547\n  },\n  \"ai_model\": \"claude-3-5-sonnet-20241022\",\n  \"consolidation_notes\": \"Successfully merged 14 pages into continuous format\"\n}\n```\n\n## Implementation\n\nExecute consolidation via Python wrapper:\n\n```bash\ncd Calypso\u002Ftools\n\n# Run consolidation\npython3 consolidate_chapter.py \\\n  --chapter 2 \\\n  --pages 15-28 \\\n  --output \"..\u002Foutput\" \\\n  --mapping \"..\u002Fanalysis\u002Fpage_mapping.json\"\n\n# Or invoke directly via Claude API:\n# The orchestrator sends the AI prompt with all page contents\n```\n\n## Quality Checks\n\nBefore passing to next gate:\n\n1. **File created**\n   - [ ] `chapter_XX.html` exists\n   - [ ] File is valid HTML (parseable)\n   - [ ] File size reasonable (> 50KB typical)\n\n2. **Structure validated**\n   - [ ] Single `\u003Cdiv class=\"page-container\">`\n   - [ ] Single `\u003Cmain class=\"page-content\">`\n   - [ ] All tags properly closed\n   - [ ] No duplicate content\n\n3. **Content completeness**\n   - [ ] All pages represented\n   - [ ] No missing sections\n   - [ ] Paragraph\u002Fheading counts reasonable\n   - [ ] All text content present\n\n4. **Heading hierarchy**\n   - [ ] Starts with h1 (chapter title)\n   - [ ] h1 count = 1\n   - [ ] h2 = major sections\n   - [ ] h3\u002Fh4 = subsections\n   - [ ] No hierarchy jumps\n\n5. **Metadata logged**\n   - [ ] Consolidation timestamp recorded\n   - [ ] Pages merged count documented\n   - [ ] Content statistics calculated\n   - [ ] Log file saved\n\n## Success Criteria\n\n✓ All pages merged into single document\n✓ Chapter header preserved from page 1\n✓ Duplicate headers removed from continuation pages\n✓ Content flows naturally (continuous format)\n✓ Heading hierarchy is correct\n✓ All text content preserved\n✓ Semantic classes maintained\n✓ Ready for semantic validation\n\n## Error Handling\n\n**If page HTML is incomplete**:\n- Note in consolidation log\n- Include whatever content is available\n- Proceed to validation (validation will catch issues)\n\n**If heading hierarchy is ambiguous**:\n- AI makes best judgment\n- Semantic validation gate will refine if needed\n- Document decision in log\n\n**If content appears duplicated**:\n- AI deduplicates automatically\n- Verify word count is reasonable\n- Log any unusual content patterns\n\n## Next Steps\n\nOnce consolidation completes:\n1. **Quality Gate 2** (semantic-validate) checks semantic structure\n2. **Skill 5** (quality-report-generate) generates final report\n3. **Quality Gate 3** (visual-accuracy-check) validates appearance\n\n## Design Notes\n\n- This skill is **AI-powered** (uses probabilistic consolidation)\n- Relies on AI's understanding of document structure\n- Produces continuous format (no page breaks)\n- Merges intelligently (not just concatenation)\n- Output will be refined by validation gates\n\n## Testing\n\nTo test consolidation on Chapter 2:\n\n```bash\n# Input: 14 individual page HTML files (pages 16-29)\n# Process: AI merges into single continuous chapter\n# Output: chapter_02.html (single, unified document)\n\n# Verify:\n# - File size is sum of all pages\n# - Content flows logically\n# - Heading hierarchy makes sense\n# - No duplicate sections\n```\n",{"name":5,"description":7},"main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002Faiskillstore\u002Fmarketplace\u002Fabejitsu\u002Fai-chapter-consolidate",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":8,"skillName":5,"commands":44,"prompt":54,"zipAvailable":55},[45,48,51],{"tool":46,"command":47},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill ai-chapter-consolidate",{"tool":49,"command":50},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill ai-chapter-consolidate",{"tool":52,"command":53},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill ai-chapter-consolidate","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Faiskillstore\u002Fmarketplace\u002Fabejitsu\u002Fai-chapter-consolidate\u002FSKILL.md",true,[57],{"path":58,"resourceType":59,"resourceTypeDesc":60,"sizeBytes":61,"sourceHtmlUrl":62},"skill-report.json","REFERENCE","参考文档",9343,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Faiskillstore\u002Fmarketplace\u002Fabejitsu\u002Fai-chapter-consolidate\u002Fskill-report.json",[64,73,82,91,97,103],{"skillNo":65,"name":66,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":29},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[],[70,71,72],"model","model hierarchy","model hierarchy skill",{"skillNo":74,"name":75,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":29},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[],[79,80,81],"MCP","zoom","zoom mcp",{"skillNo":83,"name":84,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":29},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[88,89,90,80],"sdk","zoom apps sdk","apps",{"skillNo":92,"name":93,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":29},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[93],{"skillNo":98,"name":99,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":100,"categories":101,"keywords":102,"publishedAt":29},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[],[99],{"skillNo":104,"name":105,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":106,"categories":107,"keywords":108,"publishedAt":29},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[105]]