{"skill":{"slug":"story-generator","displayName":"An automated script generator for creating viral videos.","summary":"Story generation pipeline skill. Supports multi-episode continuous generation, graph management, AI quality check + human confirmation dual control mechanism...","description":"---\nname: story-pipeline\ndescription: Story generation pipeline skill. Supports multi-episode continuous generation, graph management, AI quality check + human confirmation dual control mechanism. Automatically manages relationships between characters, scenes, and hooks.\n---\n\n# Story Generation Pipeline Skill\n\n## Features\n\nThis skill implements a complete story generation pipeline:\n\n1. **Continuous Episode Generation** - Automatically generates next episode based on previous content\n2. **Graph Management** - Storage and querying of character, scene, and hook relationships\n3. **Dual Confirmation Control** - AI quality check followed by human confirmation\n4. **State Persistence** - Supports pause, resume, and multiple parallel stories\n\n---\n\n## Core Workflow\n\n```\n┌──────────────┐    ┌──────────────┐    ┌──────────────┐    ┌──────────────────┐\n│ Generate Ep N│ -> │ AI Review    │ -> │ Graph Storage│ -> │ Wait Human Confirm│\n└──────────────┘    └──────────────┘    └──────────────┘    └──────────────────┘\n       │                   │                   │                      │\n       ▼                   ▼                   ▼                      ▼\n  Query Graph         Pass/Retry        Store Relations        Continue/Modify/End\n```\n\n---\n\n## Usage\n\n### Start New Pipeline\n\n```\nUser: Start a new story pipeline, theme: Chinese girl comeback, target episodes: 10\n```\n\n### Continue Pipeline\n\n```\nUser: Continue story pipeline [pipeline_id]\n```\n\n### User Confirmation Actions\n\n```\nUser: Approved, continue to next episode\nUser: Modify: [specific feedback]\nUser: Pause\nUser: End\n```\n\n---\n\n## Dual Confirmation Control Mechanism\n\n### Layer 1: AI Quality Check\n\nAfter each episode is generated, AI automatically checks:\n\n| Check Item | Description |\n|------------|-------------|\n| Plot Coherence | Natural connection with previous episode |\n| Character Consistency | Character behavior matches established traits |\n| Hook Handling | Reasonable addition/closure of hooks |\n| Pacing Control | Appropriate plot progression speed |\n| Emotional Curve | Reasonable emotional ups and downs |\n\n**Scoring Standard:** 0-10 points, below 7 triggers retry (max 3 times)\n\n### Layer 2: Human Confirmation\n\nAfter AI review passes, display preview and wait for user confirmation:\n\n```\n📋 Episode N Preview\n━━━━━━━━━━━━━━━━━━━━━━━━\n【Plot Summary】\n...\n\n✅ AI Score: 8.5/10\n✅ Hook Status: 1 new, 1 closed\n\nPlease select:\n1️⃣ Approved, continue to next episode\n2️⃣ Needs modification (please specify)\n3️⃣ Pause\n4️⃣ End\n━━━━━━━━━━━━━━━━━━━━━━━━\n```\n\n---\n\n## Graph Management\n\n### Graph Query\n\nBefore generating episode N, query episode N-1's graph:\n\n```python\ngraph_manager.query_graph(pipeline_id, episode=N-1)\n```\n\nReturns:\n- Complete content of previous episode\n- Character list and their statuses\n- Unclosed hooks\n- Key scenes\n- Relationship network\n\n### Graph Storage\n\nAfter user confirmation, store current episode's complete content:\n\n```python\ngraph_manager.save_graph(pipeline_id, episode=N, content)\n```\n\nStores: Complete generation result of the episode (not split into elements)\n\n---\n\n## State Management\n\n### State File: `data/pipeline_state.json`\n\n```json\n{\n  \"pipelines\": {\n    \"pipeline_2026-03-05-001\": {\n      \"theme\": \"Chinese girl comeback\",\n      \"target_episodes\": 10,\n      \"current_episode\": 3,\n      \"status\": \"waiting_user_confirm\",\n      \"created_at\": \"2026-03-05T15:00:00\",\n      \"updated_at\": \"2026-03-05T15:30:00\",\n      \"ai_review\": {\n        \"score\": 8.5,\n        \"checks\": {...}\n      },\n      \"last_output\": {\n        \"episode\": 3,\n        \"summary\": \"...\",\n        \"content\": \"Complete content...\"\n      }\n    }\n  }\n}\n```\n\n### Status Types\n\n| Status | Description |\n|--------|-------------|\n| `generating` | Currently generating |\n| `ai_reviewing` | AI review in progress |\n| `waiting_user_confirm` | Waiting for human confirmation |\n| `paused` | Paused |\n| `completed` | Completed |\n| `error` | Error state |\n\n---\n\n## Script Description\n\n### pipeline.py - Main Control Loop\n\n- Initialize pipeline\n- Coordinate modules\n- Handle user commands\n- Manage loop state\n\n### ai_reviewer.py - AI Quality Check\n\n- Execute quality scoring\n- Generate review report\n- Determine pass/fail\n\n### episode_generator.py - Episode Generation\n\n- Generate new episode based on graph context\n- Handle hook continuation and closure\n- Handle retry logic\n\n### graph_manager.py - Graph Management\n\n- Graph query (call remote API)\n- Graph storage (call remote API)\n- Local cache management\n\n---\n\n## API Description\n\n### Graph API\n\n\n**Query API:**\n```json\n{\n  \"action\": \"query\",\n  \"pipeline_id\": \"pipeline_2026-03-05-001\",\n  \"episode\": 2\n}\n```\n\n**Storage API:**\n```json\n{\n  \"action\": \"save\",\n  \"pipeline_id\": \"pipeline_2026-03-05-001\",\n  \"episode\": 3,\n  \"content\": \"Complete generation content for episode 3...\"\n}\n```\n\n---\n\n## Episode Generation Logic\n\n### First Episode Generation\n\nBased on user-provided theme and goals, generate:\n- Main character settings\n- Initial scenes\n- Core conflict\n- Open hooks\n\n### Subsequent Episode Generation\n\nBased on graph query results:\n1. Read previous episode content and unclosed hooks\n2. Continue main plot line\n3. Handle hooks (continue/close/add)\n4. Advance character growth arc\n5. Adjust emotional curve\n\n### Finale Generation\n\nWhen target episodes reached or user requests end:\n- Close all remaining hooks\n- Complete character growth arcs\n- Generate conclusive ending\n\n---\n\n## Important Notes\n\n1. **Retry Mechanism** - Max 3 retries when AI review fails\n2. **Pause/Resume** - Can resume via pipeline_id after pause\n3. **Multiple Pipelines** - Supports running multiple different-themed pipelines simultaneously\n4. **Graph Consistency** - Ensure correct character and hook relationships\n5. **Hook Management** - Track creation and closure status of each hook\n\n---\n\n## Complete Workflow\n\n### Step 1: Create Pipeline\n\n```\nUser: Start a new pipeline, theme: Cultivation boy, target 20 episodes\n\nAI: OK, creating pipeline pipeline_20260305160000\n    Theme: Cultivation boy\n    Target: 20 episodes\n    Style: Realistic cinematic\n    \n    Status: Initialized, ready to generate episode 1\n```\n\n### Step 2: Generate Episode\n\nAI calls `start_generation(pipeline_id)` to get generation prompt, then generates episode content based on the prompt.\n\n### Step 3: Submit AI Review\n\nAI calls `submit_episode(pipeline_id, episode, content)` to submit generated content, then executes AI review.\n\n### Step 4: Process Review Result\n\nAI calls `process_ai_review(pipeline_id, episode, ai_result, content)` to process review results.\n\nIf review fails (score < 7), automatically retry (max 3 times).\n\n### Step 5: Wait User Confirmation\n\nAfter review passes, display preview and wait for user confirmation:\n\n```\n📋 Episode 1 Preview\n━━━━━━━━━━━━━━━━━━━━━━━━\n【Cultivation Journey Begins】\n\nYoung Li Yun discovers a mysterious jade pendant in the mountains,\n从此踏上修仙之路...\n\n✅ AI Score: 9.0/10\n✅ New Hook: H-001 Origin of mysterious jade pendant\n\n━━━━━━━━━━━━━━━━━━━━━━━━\n\nPlease select:\n1️⃣ Approved, continue to next episode\n2️⃣ Needs modification (please specify)\n3️⃣ Pause\n4️⃣ End\n```\n\n### Step 6: Process User Confirmation\n\nAfter user confirms, AI calls `user_confirm(pipeline_id, action, note)`:\n\n- **approve**: Store graph, prepare next episode\n- **modify**: Regenerate based on feedback\n- **pause**: Pause pipeline\n- **end**: End pipeline\n\n### Step 7: Loop Generation\n\nRepeat steps 2-6 until target episodes reached or user ends.\n\n---\n\n## API Reference\n\n### Create Pipeline\n```python\ncreate_pipeline(theme: str, target_episodes: int, style: str = \"realistic cinematic\")\n# Returns: {\"success\": True, \"pipeline_id\": \"...\", \"message\": \"...\"}\n```\n\n### Start Generation\n```python\nstart_generation(pipeline_id: str)\n# Returns: {\"success\": True, \"episode\": N, \"prompt\": \"generation prompt\"}\n```\n\n### Submit Episode\n```python\nsubmit_episode(pipeline_id: str, episode: int, content: str)\n# Returns: {\"success\": True, \"review_prompt\": \"review prompt\"}\n```\n\n### Process AI Review\n```python\nprocess_ai_review(pipeline_id: str, episode: int, ai_result: str, content: str)\n# Returns: {\"success\": True, \"passed\": True/False, ...}\n```\n\n### User Confirm\n```python\nuser_confirm(pipeline_id: str, action: str, note: str = None)\n# action: \"approve\" / \"modify\" / \"pause\" / \"end\"\n# Returns: {\"success\": True, \"status\": \"...\", ...}\n```\n\n### Get Status\n```python\nget_status(pipeline_id: str)\n# Returns: Current pipeline status info\n```\n\n### List Pipelines\n```python\nlist_pipelines()\n# Returns: List of all pipelines\n```\n\n### Resume Pipeline\n```python\nresume_pipeline(pipeline_id: str)\n# Returns: Resume result\n```\n\n---\n\n## Example Dialogue\n\n```\nUser: Start a new pipeline, theme: Cultivation boy, target 20 episodes\n\nAI: OK, creating pipeline pipeline_20260305160000\n    Generating episode 1...\n    \n    📋 Episode 1 Preview\n    ━━━━━━━━━━━━━━━━━━\n    【Cultivation Journey Begins】\n    Young Li Yun discovers a mysterious jade pendant in the mountains...\n    \n    ✅ AI Score: 9.0/10\n    ✅ New Hook: H-001 Origin of mysterious jade pendant\n    \n    Please confirm: Approve/Modify/Pause/End\n    \nUser: Approved\n\nAI: Storing graph...\n    Starting generation of episode 2...\n```\n\n---\n\n## Important Notes\n\n1. **Retry Mechanism**: Max 3 retries when AI review fails\n2. **State Persistence**: All states saved in `data/pipeline_state.json`\n3. **Graph Storage**: Stored via remote API, requires network connection\n4. **Pause/Resume**: Can resume via `resume_pipeline` after pause\n5. **Multiple Pipelines**: Supports running multiple different-themed pipelines simultaneously","tags":{"latest":"1.0.1"},"stats":{"comments":0,"downloads":696,"installsAllTime":3,"installsCurrent":3,"stars":0,"versions":2},"createdAt":1772782911193,"updatedAt":1778491748674},"latestVersion":{"version":"1.0.1","createdAt":1772783508249,"changelog":"story-generator v1.0.1\n\n- Updated the episode review template (templates/review_template.md) for improved clarity or presentation.\n- No changes to code logic or core functionality in this version.","license":null},"metadata":null,"owner":{"handle":"hexidyg","userId":"s17drvcjx45ykk2tprdzc4h79n83kjp2","displayName":"hexidyg","image":"https://avatars.githubusercontent.com/u/254915923?v=4"},"moderation":{"isSuspicious":false,"isMalwareBlocked":false,"verdict":"clean","reasonCodes":["review.llm_review"],"summary":"Review: review.llm_review","engineVersion":"v2.4.24","updatedAt":1780089778691}}