agentic-media-pipeline-notes.md 4.68 KB

Agentic Media Pipeline Notes

4-Agent Pipeline Architecture

WeChat Group Messages
        ↓
News Collector (Agent 1)
        ↓
Structured Articles + Discussions
        ↓
News Editor / Kimi 2.6 (Agent 2)
        ↓
Daily JSON + Markdown Report
        ↓
Layout Planner (Agent 3)
        ↓
Layout JSON
        ↓
GPT Image 2 (Agent 4)
        ↓
Victorian Newspaper Infographic

Script: scripts/agentic_media_pipeline.py

Known Issues

  1. sqlite3 binary not available in Termux

    • The script uses subprocess.run(['sqlite3', ...]) which fails on Termux
    • Fix: Use mcp_android_phone_query_wechat tool instead, or query via Python sqlite3 module if EnMicroMsg.db is accessible
    • Alternative: Use query_wechat MCP tool with SQL queries
  2. Kimi 2.6 timeout

    • simple_chat() with 120s timeout may fail for large inputs
    • Fix: Increase timeout to 180s, or batch process articles in smaller chunks
  3. GPT Image 2 prompt length

    • Very long prompts with all article content may exceed token limits
    • Fix: Truncate article summaries to 50 chars each, limit to 6 articles max

Working Example (Manual Execution)

Since the automated script has issues, the pipeline can be executed manually:

Step 1: Collect Messages

# Use MCP tool: query_wechat with SQL
SELECT msgId, type, isSend, talker, content, createTime 
FROM message 
WHERE talker = '54655425669@chatroom' 
AND createTime >= 1782230400000 
ORDER BY createTime DESC 
LIMIT 50;

Step 2: Extract Articles (Python)

import re
# Parse XML content from type=49 messages
# Extract title, url, description

Step 3: Generate Structured JSON

# Manually create or use Kimi if available
daily_json = {
    "date": "2026-06-24",
    "headline": "AI Agent化浪潮...",
    "news": [...],
    "quotes": [...],
    "trend": {...}
}

Step 4: Generate Image

# Use generate_image.py with GPT Image 2
python3 ~/.hermes/skills/image-generation/scripts/generate_image.py \
  "Victorian newspaper poster..." \
  --output /sdcard/WeChatDigest/infographic.png \
  --model "GPT Image 2"

GPT Image 2 Victorian Newspaper Prompt Template (Content-Only)

CRITICAL RULE: Only include content that actually exists in the source data. Do NOT add fictional sections.

What NOT to include (user explicitly corrected these as fictional):

  • Dates like "1880" (not in actual data)
  • "International News" (not in actual data)
  • "Editorial" (not in actual data)
  • "Advertisement" (not in actual data)
  • "Testimony" (not in actual data)
  • "Market Briefing" (not in actual data)
  • Any section not present in the actual WeChat messages/articles

What TO include (only actual content from data):

  • Masthead: "AI AGI 日报"
  • Actual date from data (e.g., "2026-06-24")
  • Headline derived from actual content analysis
  • Hero Story (from actual article summaries)
  • News Articles (actual articles from WeChat)
  • Key Quotes (actual quotes from discussions)
  • Trend Analysis (derived from actual content)
Create a front-page Victorian newspaper poster.

CRITICAL RULES:
- ONLY use the content provided below
- DO NOT add fictional sections like "1880", "International News", "Editorial", "Advertisement", "Testimony", "Market Briefing"
- ONLY include sections that have actual content

Style:
1880 Victorian newspaper
19th century financial times
The Economist cover
engraving illustration
woodcut etching
vintage printing press
old yellow paper
aged newspaper texture
ink engraving
black and white line art

Content (ONLY use this, do not add fictional content):

Masthead: "AI AGI 日报"
Date: "{date}"
Headline: "{headline}"

Hero Story:
Title: {hero_title}
Summary: {hero_summary}

News Articles:
{news_items}

Key Quotes:
{quotes}

Trend Analysis:
Title: {trend_title}
Summary: {trend_summary}

Layout:
- Large masthead "AI AGI 日报" on top
- Main headline in Chinese
- Hero story section with title and summary
- News articles in columns
- Key quotes section
- Trend analysis section

Main Illustration:
server rack shaking hands with printing press
engraving style
US dollar bill engraving
extremely detailed line work
woodcut illustration
banknote etching
centerpiece illustration

Mood:
historical
authoritative
intellectual
industrial revolution

Color:
sepia paper
black ink only

Aspect ratio: 1:1

Fusion Style Composition

  • 40% New York Times 1900s front page
  • 30% The Economist special edition
  • 20% US dollar bill engraving style
  • 10% Steampunk

Key Illustration (Soul of the Image)

server rack and industrial printing machine
shaking hands
engraving style
US dollar bill engraving
extremely detailed line work
woodcut illustration
banknote etching
centerpiece illustration