# Cron Job: morning-briefing

**Job ID:** 18c46fde1520
**Run Time:** 2026-05-18 09:02:29
**Schedule:** 0 9 * * *

## Prompt

[IMPORTANT: The user has invoked the "morning-briefing" skill, indicating they want you to follow its instructions. The full skill content is loaded below.]

---
name: morning-briefing
description: "Daily morning voice briefing for 坤哥 (London) — searches news/weather/art/London-local, cleans text for TTS, auto-plays on local speakers. Built on Hermes cron + Tavily + MiniMax TTS."
version: 1.1.0
author: Hermes Agent
platforms: [linux]
tags: [cron, telegram, tts, tavily, mini-max, news, voice, briefing, london]
metadata:
  cron_job_id: "18c46fde1520"
  tavily_key: "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"
  schedule: "0 9 * * *"
  user: 坤哥
  location: London
  minimax_tts_key_note: "MINIMAX_API_KEY (TTS) is SEPARATE from MINIMAX_CN_API_KEY (chat). Both must be set. The TTS endpoint (speech-02-hd) uses api.minimaxi.com/v1/t2a_v2 and requires MINIMAX_API_KEY. The chat endpoint uses api.minimaxi.com/anthropic with MINIMAX_CN_API_KEY."
---

# Morning Briefing

Daily voice briefing delivered to Telegram at 09:00 BST (16:00 北京).

## Workflow

1. `web_search` — search today's news via Tavily
2. `web_search` — get weather for user's city
3. **Art industry news** — web_search for "艺术行业新闻 中国" (museums, galleries, auctions, cultural heritage, etc.)
4. Compile briefing text in Chinese
5. **Convert all Arabic numerals to Chinese characters** (critical — see Pitfalls)
6. **MiniMax TTS via `text_to_speech` tool** (preferred — best quality, broadcast style)
7. **Playback on local speakers** — set volume to 80%, play via ffplay
8. **Fallback: Local Piper** via `~/bin/tts_briefing.sh` (only if MiniMax fails)
9. Cron auto-delivers to Telegram

## User Profile
- **Name**: 坤哥 (call him 坤哥, NOT K.W.)
- **Location**: 伦敦
- **Language**: 中文

## Briefing Template

```
坤哥，早上好！今天是{dates}，{weekday}。

重要新闻：
{n}条新闻，每条一行

艺术动态：
{艺术新闻，1条}

伦敦本地：
{伦敦本地新闻，重点提TFL罢工和游行示威情况}

伦敦天气：{weather}，气温{temp}。
```

## London Local News Priority
重点监测（必须明确回答"有"或"无"）：
- TFL 地铁/公交是否罢工
- 是否有游行示威
- 其他重要本地事件

## Audio Playback (Local Speakers at 9 AM)

After TTS generation, play the audio on the local machine's speakers at 80% volume:

```bash
# Set system volume to 80% (unmuted)
pactl set-sink-volume alsa_output.pci-0000_00_1f.3.analog-stereo 80%
pactl set-sink-mute alsa_output.pci-0000_00_1f.3.analog-stereo false

# Play audio
ffplay -nodisp -autoexit -volume 80 /home/kuhnn/.hermes/audio_cache/tts_YYYYMMDD_HHMMSS.ogg &
```

**Audio device (ALSA):** `alsa_output.pci-0000_00_1f.3.analog-stereo` — confirm with `pactl list sinks` if different.

## Pitfalls

### TTS reads numbers as digits
MiniMax TTS (and most Chinese TTS) reads `18°C`、`2026年5月18日`、`85%` as individual digits. **ALL numbers must be pre-converted to Chinese characters:**

| Original | For TTS |
|----------|---------|
| 18°C | 十八度 |
| 27°C | 二十七度 |
| 2026年5月18日 | 二零二六年五月十八日 |
| 85% | 百分之八十五 |
| 79年 | 七十九年 |
| 20~32°C | 二十到三十二度 |

Always apply this conversion in the prompt: e.g. `"温度用中文，如'十八到二十七度'"`

## Cron Job Management

```bash
# List jobs
hermes cron list

# Run manually (for testing)
hermes cron run <job_id>

# View output
cat ~/.hermes/cron/output/<job_id>/*.md

# Find latest audio file
find ~/.hermes/audio_cache/ -name "*.ogg" -newer ~/.hermes/cron/output/<job_id>/*.md
```

Current job ID: `18c46fde1520`

## TTS: MiniMax API (Preferred — Best Quality)

MiniMax TTS (speech-02-hd, voice: Chinese_Mandarin_News_Anchor) gives significantly better quality — natural pauses, proper intonation, broadcast style. Use `text_to_speech` tool directly.

**IMPORTANT — Cron environment:** Cron runs in a fresh subprocess without your session's env vars. Before calling `text_to_speech`, the agent MUST load .env:
```bash
export $(grep MINIMAX_API_KEY /home/kuhnn/.hermes/.env | xargs)
```
The `skills: [morning-briefing]` attachment on the cron job ensures the skill is loaded, which triggers the env loading logic. If TTS still fails with "MINIMAX_API_KEY not set", manually add the export step to the cron prompt.

**TTS config (in cron prompt):**
```
使用 text_to_speech 工具（provider: minimax, model: speech-02-hd, voice: Chinese (Mandarin)_News_Anchor）
输出 .ogg 格式文件
在回复末尾写：MEDIA:/home/kuhnn/.hermes/audio_cache/tts_YYYYMMDD_HHMMSS.ogg
```

**Rate limit:** MiniMax 年计划 1500次/5小时。超出后 cron 会静默失败，fallback 到 Piper。

## TTS: Piper (Fallback — Fully Offline)

When MiniMax is unavailable (quota exhausted, network down), fall back to local Piper via `~/bin/tts_briefing.sh`:

```bash
# Generate audio from text
echo "播报文本内容" | ~/bin/tts_briefing.sh --out /home/kuhnn/.hermes/audio_cache/tts_$(date +%Y%m%d_%H%M%S).wav

# Convert to .ogg for Telegram
ffmpeg -i /home/kuhnn/.hermes/audio_cache/tts_YYYYMMDD_HHMMSS.wav \
       -acodec libopus /home/kuhnn/.hermes/audio_cache/tts_YYYYMMDD_HHMMSS.ogg -y

# Deliver: MEDIA:/home/kuhnn/.hermes/audio_cache/tts_YYYYMMDD_HHMMSS.ogg
```

**Piper quality note:** csukuangfj/vits-piper-zh_CN-huayan-medium has mechanical pauses and flat intonation. Acceptable for fallback, not ideal for daily use.

**Piper setup:** `pip install piper-tts` → `~/.local/bin/piper` + model `csukuangfj/vits-piper-zh_CN-huayan-medium` (HuggingFace cache). Use **python3.10** (not 3.11) for huggingface_hub downloads.

## Reference Files

- `references/brief_text_clean.py` — Python TTS text cleaner (numbers→中文, acronyms→full form, punctuation normalization). Derived from OpenClaw's offline TTS pipeline.
- `references/brief_replacements.json` — Acronym/name replacement dictionary used by the cleaner.
- `references/tts-local-setup.md` — Piper model download, local TTS cron integration, MiniMax API key note.

## Legacy (OpenClaw)

OpenClaw used sherpa-onnx with `brief_text_clean.py` + `brief_replacements.json` for offline TTS. The cleaning script handled:
- Acronyms: BBC → 英国广播公司
- Names: Emmanuel Macron → 马克龙
- Numbers → Chinese characters
- Punctuation normalization for speech

These files are preserved in: `/home/kuhnn/SynologyDrive/openclaw_backup/snapshot_2026-03-09_031002/bin/`

**Note:** The current morning-briefing cron uses MiniMax TTS, which requires `MINIMAX_API_KEY` (set separately from `MINIMAX_CN_API_KEY` used for chat). TTS failures with "MINIMAX_API_KEY not set" mean the TTS key is missing — check that `MINIMAX_API_KEY` is in `.env`, not just `MINIMAX_CN_API_KEY`.

The user has provided the following instruction alongside the skill invocation: [IMPORTANT: You are running as a scheduled cron job. DELIVERY: Your final response will be automatically delivered to the user — do NOT use send_message or try to deliver the output yourself. Just produce your report/output as your final response and the system handles the rest. SILENT: If there is genuinely nothing new to report, respond with exactly "[SILENT]" (nothing else) to suppress delivery. Never combine [SILENT] with content — either report your findings normally, or say [SILENT] and nothing more.]

你是坤哥的每日播报员。每早九点运行。

## 搜索任务（并行）

1. **重要新闻**：Tavily 搜索 "today's top news China OR world 2026" — 抓3条摘要
2. **艺术动态**：Tavily 搜索 "艺术行业新闻 中国" — 抓1条（博物馆、画廊、拍卖、文化遗产等）
3. **伦敦本地新闻**：Tavily 搜索 "London today news TFL strike protest demonstration 2026" — 重点关注：
   - TFL 地铁/公交是否罢工
   - 是否有游行示威
   - 其他重要本地事件
4. **伦敦天气**：Tavily 搜索 "London current weather temperature" — 获取天气状况和气温

## 播报文本格式

```
坤哥，早上好！今天是{dates}，{weekday}。

重要新闻：
{3条新闻，每条一行}

艺术动态：
{1条艺术新闻}

伦敦本地：
{伦敦本地新闻，重点提TFL罢工和游行示威情况}

伦敦天气：{weather}，气温{temp}。
```

## 关键规则

- **称呼**：叫"坤哥"（不是 K.W.）
- **数字全部转中文**：18°C → 十八度；2026年5月18日 → 二零二六年五月十八日；85% → 百分之八十五
- **天气城市**：伦敦，不是北京
- **伦敦新闻**：重点监测 TFL 罢工和游行示威活动，有就明确说"有"，没有就说"无"

## TTS 生成

使用 text_to_speech 工具（provider: minimax, model: speech-02-hd, voice: Chinese (Mandarin)_News_Anchor）
输出 .ogg 格式
回复末尾写：MEDIA:/home/kuhnn/.hermes/audio_cache/tts_YYYYMMDD_HHMMSS.ogg

## 本地喇叭播放

TTS 完成后，在终端执行：
```bash
pactl set-sink-volume alsa_output.pci-0000_00_1f.3.analog-stereo 80%
pactl set-sink-mute alsa_output.pci-0000_00_1f.3.analog-stereo false
ffplay -nodisp -autoexit -volume 80 /home/kuhnn/.hermes/audio_cache/tts_YYYYMMDD_HHMMSS.ogg &
```

## 交付

- Cron 自动投递到 Telegram
- 回复只写播报文本 + MEDIA 路径，不要多余解释

## Response

坤哥，早上好！今天是二零二六年五月十八日，星期一。

重要新闻：
一，习近平预测二零二六年将成为中美关系改善的重要年份，两国元首有望展开互动。
二，中国西南部地区发生地震，数千居民紧急撤离，建筑受损。
三，伦敦爆发大规模游行，数万人参与极右翼和支持巴勒斯坦的示威活动。

艺术动态：
中汉拍卖行二零二六年春季拍卖会巡展即将启幕，涵盖中国陶瓷、玉雕等珍品。

伦敦本地：
伦敦地铁罢工持续，多条线路受影响；大规模游行示威活动正在进行中，建议出行留意交通状况。

伦敦天气：局部小雨，气温九点二度。

MEDIA:/home/kuhnn/.hermes/audio_cache/tts_20260518_090000.ogg
