1---2name: hn-daily-23description: Generate and deliver a Hacker News daily report (Top-N) with article summaries and multi-view comment synthesis, in user-selected language, with optional file persistence and index update.4---5
6# HN Daily
7
8## Release Notes
9- v0.7.0: Add concurrent retry profile for schedule reliability (primary run + immediate retry + delayed retry) with idempotent completion checks to avoid timeout-caused misses.
10- v0.6.0: Brand rename for distribution as "HN Daily Brief" + full copy cleanup to English-only wording.
11- v0.5.1: Language cleanup for public distribution (English-first docs; localized markers still supported).
12- v0.5.0: First public release.
13
14## Parameters
15- `language`: output language (default: current user conversation language)
16- `topN`: number of items (default: 10)
17- `style`: `strict | lite` (default: strict)
18- `outputDir`: output directory (default: `/home/ubuntu/.openclaw/workspace/output/hn-daily/`)
19- `persist`: whether to save file + update index (default: true)
20- `reminderTime`: cron time in user timezone, or `off`
21
22## First-load behavior
23- On first load (or when user changes params), show effective params once and confirm.
24- Otherwise, reuse last confirmed params.
25
26## Mandatory execution order
271. Retry preflight check (required for retry jobs):
28 - If this run is a retry/compensation run, first check whether today's report already exists and is complete (at minimum includes `## Top 10`).
29 - If already complete, return `NO_REPLY` and stop (idempotent exit).
302. Always fetch fresh inputs for this run (required):
31 - Re-pull current HN Top-N items, article snippets, and comments at run time.
32 - Do not reuse previous report body as source input.
333. Collect materials via script (data collection only, never user-facing):
34 - `scripts/generate_hn_daily.py --style <style> --top <topN> --language <language> --outdir /tmp/hn-daily-draft --materials /tmp/hn-daily-draft/HN-materials.json`
35 - Script must only output `HN-materials.json` (no user-facing report body).
36 - Use `HN-materials.json` as the only source for final writing.
374. LLM generation (required, prompt-driven quality):
38 - Use a single strict prompt template to generate final report in selected `language`.
39 - All content quality constraints (summary depth, comment synthesis style, anti-template wording) must be enforced by prompt, not by script templates.
40 - No “summarize then translate”; generate directly in target language.
415. Re-check completion before send (required for retry jobs):
42 - If another concurrent run has already persisted a complete report, do not send duplicate content; return `NO_REPLY`.
436. Send full final report body to current chat.
447. If `persist=true`, write final report to `<outputDir>/HN-daily-YYYY-MM-DD.md` and update `<outputDir>/HN_DAILY_INDEX.md`.
45
46## Success criteria (strict)
47- `persist=false`: success = full report body delivered in chat.
48- `persist=true`: success = chat delivery + file write + index update.
49- Under concurrent retry profile: success can be achieved by primary run or any retry run; retries must skip if the report is already complete.
50- If any required condition fails, treat run as failed (do not claim completion).
51
52## Output rules
53- Send only report body to user (no receipts/status metadata).
54- Never send script draft markdown directly; user-facing report must come from LLM rewrite over materials JSON.
55- Output must use one language only: the selected `language` for the run (no bilingual/mixed-language output).
56- Real markdown newlines only; never output literal `\n` in user-visible content.
57- Top-N structure per item:
58 - Title
59 - Link
60 - HN link
61 - Heat
62 - Source summary
63 - Comment viewpoint synthesis
64
65## Length rules (by selected language)
66- Default hard rule: source summary must be >=300 chars in zh (>=200 words in en; equivalent depth for others).
67- Elastic exception: only when source content is genuinely short/information-limited, summary may be shorter than default target.
68- Comment viewpoint summary target: zh>=80 chars (equivalent depth for others), with the same short-source exception.
69- When exception is used, explicitly mark "source is short / info limited" (or equivalent in selected language), prioritize verifiable facts + discussion context + actionable implications, and keep concise but information-dense output.
70- Never inflate length with generic filler text.
71
72## Comment synthesis rules
73- Must be in selected `language`.
74- Multi-perspective (not binary pro/con).
75- Per item, output 5 comment viewpoints when available.
76- If username exists in source comment, it must be preserved in output.
77- Only use "insufficient comments" when no usable comments are available.
78- Summarize viewpoints; do not paste long raw quotes.
79
80## Scheduling rules (concurrent retry profile)
81- If `reminderTime != off`, create/update a **3-job retry ladder** automatically (no duplicates):
82 1) Primary run at `reminderTime` (e.g. `HN Daily 06:50`)
83 2) Immediate retry at `reminderTime + 1m` (e.g. `HN Daily 06:51 Retry`)
84 3) Delayed retry at `reminderTime + 15m` (e.g. `HN Daily 07:05 Retry`)
85- All retry jobs must be idempotent via completion checks (see Mandatory execution order step 1 and step 5).
86- Keep job names aligned with schedule and retry role.
87- Cron payload must be execution-oriented (not passive reminder).
88- Rationale: cron has no built-in on-failure callback; this retry ladder is the required equivalent for timeout/failure recovery.
89
90## Prompt template requirements (must include)
91- Generate directly in selected `language`.
92- Source summary length must meet selected-language threshold.
93- Each comment viewpoint summary must meet selected-language threshold.
94- Summaries must be article-specific and fact-based; avoid reusable boilerplate.
95- Comment section must synthesize viewpoints (not raw quote dumping), with usernames when available.
96
97## Pre-send quality gate (mandatory)
98- Validate final report before sending:
99 - zh summary default >=300 chars per item;
100 - zh comment viewpoint default >=80 chars per viewpoint.
101- Recommended command:
102 - `scripts/validate_report.py --report <final_report_path> --language <language>`
103- If an item/viewpoint is below default threshold, it must explicitly include a short-source marker (e.g. `source is short / info limited`).
104- If gate fails, rewrite and re-check; do not send failing report.
105
106## Guardrail
107- If prompt-driven LLM generation path is not available/validated, keep cron disabled until fixed.
108- If primary + both retries all fail on the same day, send a concise failure alert to the current chat with the first actionable error cause (do not silently drop the run).