--- name: synthesis description: Convert stored Tapestry artifacts into higher-level synthesis. Use when a user wants interpretation, consolidation, research notes, or analysis built on top of an already-ingested URL or note. argument-hint: [note-path-or-url] allowed-tools: Bash(*), Read, Glob, Grep, Write, Edit --- # Tapestry Synthesis Analyze a stored Tapestry artifact: **$ARGUMENTS** ## When to use this skill Use this skill when: - A user wants interpretation or analysis of already-ingested content - You need to consolidate multiple sources into research notes - The user asks for synthesis, insights, or higher-level understanding - You need to organize ingested content into the knowledge base hierarchy - The deterministic ingest is complete and model-based reasoning is needed ## Overview This skill is the workflow layer for model-eligible reasoning. Use it after deterministic ingest has already produced: 1. a capture JSON file 2. a normalized feed JSON file 3. a Markdown knowledge-base note 4. a structured handoff payload describing the recommended analysis The package runtime does not call any model APIs directly. This skill owns the interpretation step. This skill is also responsible for maintaining the book-like knowledge base under `knowledge-base/`. **Important**: The synthesis mode configuration controls when this skill should be invoked: - `auto`: Agent evaluates note accumulation and decides whether to merge (intelligent, load-based) - `manual`: Only runs when explicitly requested by user - `batch`: Runs after multiple ingests to process all at once - `deterministic`: Runs automatically after every single ingest (high overhead) See `config/tapestry.config.json` for current mode setting. ## Workflow 1. Identify the target: - if the user gave a stored note path, use it directly - if the user gave a URL and it has not been ingested yet, run `$tapestry-ingest` first 2. **IMPORTANT**: Change to the project root directory before running the script: ```bash cd /path/to/your/tapestry/project python synthesis/_scripts/load_context.py \ "$ARGUMENTS" ``` Or use the --project-root flag: ```bash python synthesis/_scripts/load_context.py \ --project-root /path/to/your/tapestry/project \ "$ARGUMENTS" ``` 3. Read the returned handoff payload carefully: - `digest` is the deterministic baseline - `analysis.skill`, `analysis.instructions`, and `analysis.deliverable` describe the intended workflow - `note_text`, `feed_payload`, and `capture_payload` are the factual source materials - **Identify the language** by reading the content naturally (title, body, comments) 4. Ensure the book hierarchy exists: ```bash cd /path/to/your/tapestry/project python synthesis/_scripts/bootstrap_kb.py ``` Or use the --project-root flag: ```bash python synthesis/_scripts/bootstrap_kb.py \ --project-root /path/to/your/tapestry/project ``` 5. Read the knowledge-base governance files: - `synthesis/_kb_rules/_shared-governance.md` - `synthesis/_kb_rules/topic-taxonomy.md` - `synthesis/_kb_rules/chapter-decision-rules.md` 6. **CRITICAL**: Read the existing knowledge base structure thoroughly: - Explore `knowledge-base/books/` to understand existing topics and chapters - Read relevant `index.md` files to understand chapter scope and content - Look for existing chapters where this content naturally fits 7. **Default to integration** - Decide in this priority order: 1. **FIRST CHOICE: Extend an existing chapter** - Integrate the new content into an existing chapter's narrative if it matches the chapter's central concept. Do NOT just append; weave it into the existing structure. 2. **SECOND CHOICE: Create a new chapter** - Only if the content introduces a distinct subdomain that doesn't fit existing chapters 3. **LAST RESORT: Restructure the topic tree** - Only if multiple chapters overlap heavily or the taxonomy has become incoherent 8. **IMPORTANT**: Identify the language of the source content by reading it, then write your synthesis in that same language. Do not translate unless explicitly requested. 9. When extending an existing chapter: - Read the full chapter content first - Identify where the new information fits thematically - Integrate it into the existing narrative structure (don't append at the end) - Update section headers if the new content shifts the conceptual balance - Maintain consistent voice and formatting 10. When creating a new chapter: - Ensure it represents a recurring domain, not a one-off article - Update the parent `index.md` to register the new chapter - Follow the chapter structure patterns from existing chapters 11. Return the synthesis clearly, grounded in the stored artifacts rather than vague recollection. ## Synthesis Quality Standards **IMPORTANT**: All synthesized content must go through this refinement process, regardless of the source crawler or content type. These standards ensure consistent, high-quality output across all ingested content. ### Language Preservation **CRITICAL**: The synthesis process MUST preserve the original language of the source content. - **Identify the language** by reading the source content (title, body, comments) in the handoff payload - **Write synthesis in the same language** as the source content - **Do NOT translate** content from one language to another unless explicitly requested by the user - If the source is in Chinese, write the synthesis in Chinese (including headers, descriptions, and analysis) - If the source is in English, write the synthesis in English (including headers, descriptions, and analysis) - Maintain language consistency throughout the entire knowledge base entry **How to identify language**: - Read the `note_text`, `feed_payload.body`, and `feed_payload.title` from the handoff - Naturally determine the primary language based on the content - Use that language for all synthesis output ### 1. Text Formatting and Cleanup **Add proper structure:** - Use clear hierarchical headers (H2 for main sections, H3 for subsections) - Add paragraph breaks for readability (no walls of text) - Separate distinct topics with appropriate headers - Use proper spacing after punctuation **Apply markdown formatting:** - `**bold**` for key terms and emphasis - `*italic*` for technical terms or foreign words - `` `code` `` for technical terms, commands, or code snippets - `> quotes` for important statements or definitions - `[links](url)` for all references and resources - Lists (bulleted or numbered) for enumerated items - **CRITICAL**: Always add a blank line before lists (both ordered and unordered) - Markdown requires a blank line before list items to render them as `