# Save shareable HTML brief This reference file is loaded by the main `SKILL.md` when the user asked for an HTML brief (either explicitly via `--emit=html` / `--emit:html` / `--html`, or in natural language - "give me a shareable HTML brief", "for Slack", "for Notion", "export as HTML", etc.). The detection happens in `SKILL.md` so that the common no-HTML path stays short; the implementation lives here. The contract: the synthesis still appears in chat as the primary output. The HTML is an additional artifact saved to disk for sharing. Both happen in the same turn. ## When to fire this flow - After you have already emitted the full chat response: badge, "What I learned:" (or comparison title), bold-lead-in paragraphs with citations, KEY PATTERNS list, engine footer pass-through, invitation block. - BEFORE the WAIT FOR USER'S RESPONSE pause. - ONLY if the user asked. Do NOT save HTML when the user didn't ask for it. ## How to fire it ```bash # 1. Write your synthesis prose VERBATIM to a temp file. The synthesis is the # "What I learned:" prose label, the bold-lead-in paragraphs with their # inline citations as you wrote them in chat, and the "KEY PATTERNS from # the research:" numbered list. Do NOT include the badge or the engine # footer in the temp file - the engine adds those when it renders the HTML. # Use the EXACT text you just wrote in chat. Do not paraphrase, do not # summarize, do not reorder. The HTML must read identically to the chat # response in voice and citations. SYNTHESIS_FILE="/tmp/last30days-synthesis-${CLAUDE_SESSION_ID}.md" cat > "$SYNTHESIS_FILE" <<'SYNTHESIS_EOF' What I learned: **{First headline}** - {body with [name](url) inline citations} **{Second headline}** - {body} **{Third headline}** - {body} KEY PATTERNS from the research: 1. {pattern} - per [@handle](url) 2. {pattern} - per [r/sub](url) 3. {pattern} - per [@handle](url) SYNTHESIS_EOF # 2. Convert the synthesis to a self-contained HTML file via the engine. # The engine reuses the cache from your earlier engine run (same topic # + plan), so this second invocation is typically <1s on cache hit. SLUG=$(echo "$TOPIC" | tr '[:upper:]' '[:lower:]' | tr -cs 'a-z0-9' '-' | sed 's/^-//;s/-$//') HTML_PATH="${LAST30DAYS_MEMORY_DIR}/${SLUG}-brief.html" "${LAST30DAYS_PYTHON}" "${SKILL_ROOT}/scripts/last30days.py" "${TOPIC}" \ --emit=html \ --synthesis-file "$SYNTHESIS_FILE" \ > "$HTML_PATH" # 3. Append ONE line to your already-emitted chat response, after the # invitation block. Use a paperclip emoji as a visible signal that an # artifact was produced: echo "๐ Shareable brief saved to $HTML_PATH" ``` ## What ends up in the HTML file The engine's `--emit=html` renderer combines: - The badge (`๐ last30days vX.Y.Z ยท synced YYYY-MM-DD`) at the top - A single inline metadata line (`{date range} ยท {active sources}`) below the badge - Your synthesis verbatim, with prose labels promoted to `