Sec Daily Digest
Generate a daily cybersecurity digest for researchers from CyberSecurityRSS OPML feeds and Twitter/X security KOL accounts.
Trigger command: /sec-digest.
When to Use
- - The user asks for a daily or latest cybersecurity digest.
- The user needs balanced AI + security coverage from RSS feeds.
- The user wants Twitter/X KOL security updates alongside RSS content.
- The task needs merged vulnerability events (CVE-first + non-CVE clustering).
- The user requests provider control (
openai|gemini|claude|ollama) or --dry-run.
When Not to Use
- - The user wants ad-hoc one-off article summaries (use direct summarization instead).
- The user expects arbitrary output language switching.
Quick Start
CODEBLOCK0
CLI Flags Reference
| Flag | Description | Default |
|---|
| INLINECODE3 | AI provider: INLINECODE4 | INLINECODE5 |
| INLINECODE6 |
OPML profile:
tiny\|full |
tiny |
|
--hours <n> | Time window in hours |
48 |
|
--mode <daily\|weekly> | Shortcut: daily=48h, weekly=168h | — |
|
--top-n <n> | Max articles to select |
20 |
|
--output <path> | Output markdown file path |
./output/sec-digest-YYYYMMDD.md |
|
--dry-run | Rule-based scoring only (no AI calls) | false |
|
--no-twitter | Disable Twitter/X KOL fetching | false |
|
--email <addr> | Send digest via
gog to address | — |
|
--enrich | Fetch full text for articles | false |
|
--help | Show help | — |
Quick Reference
- - Entrypoint: INLINECODE22
- Pipeline: INLINECODE23
- Config root: INLINECODE24
- Config file: INLINECODE25
- Sources file: INLINECODE26
- Health file: INLINECODE27
- Archive dir: INLINECODE28
- OPML cache (tiny): INLINECODE29
- OPML cache (full): INLINECODE30
Required Behavior
- 1. Always perform OPML remote update check before feed parsing.
- If OPML remote check fails, use local cache only when cache exists.
- If remote check fails and no local cache exists, fail fast (
No cached OPML available and remote update check failed.). - Provider defaults to
openai; explicit --provider overrides config. - Ranking uses balanced weights (Security + AI, default
0.5/0.5). - Output sections must include
AI发展, 安全动态, and 漏洞专报. - INLINECODE38 exists in config, but current implementation outputs fixed bilingual-style markdown; do not assume runtime language switching.
- Twitter KOL section (
🔐 Security KOL Updates) appears only when tweets are fetched. - Twitter fetch is silently skipped (no crash) when no credentials are present.
Twitter/X Configuration
Twitter KOL accounts are configured in ~/.sec-daily-digest/sources.yaml (auto-created on first run with 15 default security researchers).
Default KOL List
Taviso, GossiTheDog, SwiftOnSecurity, MalwareTechBlog, briankrebs, JohnLaTwC, and 9 others.
sources.yaml Format
CODEBLOCK1
Backend Selection
| Env Var Set | Backend Used |
|---|
| INLINECODE41 | twitterapi.io (preferred, 5 QPS) |
| INLINECODE42 only |
Official Twitter API v2 (5 concurrent) |
| Both | twitterapi.io |
| Neither | Twitter disabled (silent) |
|
TWITTER_API_BACKEND=official | Force official API |
Archive (Historical Dedup)
Articles seen in the past 7 days receive a −5 score penalty (not removed, just deprioritized). Archive files are stored in ~/.sec-daily-digest/archive/YYYY-MM-DD.json and automatically cleaned after 90 days.
Source Health Monitoring
Each run records fetch success/failure for every source. Sources failing >50% of checks (with ≥2 checks) appear in a ⚠️ Source Health Warnings section at the bottom of the digest. Health data lives in ~/.sec-daily-digest/health.json.
Email Delivery (gog)
The --email flag sends the digest via gogcli:
CODEBLOCK2
Log output:
CODEBLOCK3
Full Text Enrichment
INLINECODE49 fetches article full text before AI scoring (improves classification and summarization quality). Skips paywalled/social domains (Twitter, Reddit, GitHub, YouTube, NYT, Bloomberg, WSJ, FT).
cron Integration
CODEBLOCK4
Common Mistakes
- 1. Missing API key for selected provider (
OPENAI_API_KEY is required, GEMINI_API_KEY is required, ANTHROPIC_API_KEY is required). - Misreading fallback behavior: OPML fallback is cache-dependent, not unconditional.
- Forgetting
--dry-run when no provider credentials are available. - Expecting Twitter KOLs without setting
TWITTERAPI_IO_KEY or X_BEARER_TOKEN.
Success Signals
- 1. Logs include
[sec-digest] provider=..., [sec-digest] cache_fallback=true|false, [sec-digest] output=..., and [sec-digest] stats feeds=... articles=... recent=... selected=... vuln_events=... twitter_kols=.... - Output markdown contains the three required sections and vulnerability references.
- INLINECODE60 is written after each run.
- INLINECODE61 is updated after each run.
More Detail
For full installation and extended usage notes, see README.md and README.zh-CN.md.
Sec Daily Digest
为研究人员生成每日网络安全摘要,数据来源包括CyberSecurityRSS OPML订阅源和Twitter/X安全KOL账号。
触发命令:/sec-digest。
使用场景
- - 用户请求每日或最新的网络安全摘要。
- 用户需要从RSS订阅源获取AI与安全的平衡覆盖。
- 用户希望同时获取Twitter/X KOL安全动态与RSS内容。
- 任务需要合并漏洞事件(优先CVE + 非CVE聚类)。
- 用户指定提供商控制(openai|gemini|claude|ollama)或使用--dry-run。
不使用场景
- - 用户需要临时单篇文章摘要(应直接使用摘要功能)。
- 用户期望任意输出语言切换。
快速开始
bash
基础模式(仅RSS,无AI评分)
bun scripts/sec-digest.ts --dry-run --output ./output/digest.md
带AI评分 + Twitter KOL
TWITTERAPI
IOKEY=your-key bun scripts/sec-digest.ts \
--provider claude --opml tiny --hours 48 --output ./output/digest.md
周报模式(168小时窗口)
bun scripts/sec-digest.ts --mode weekly --provider openai --output ./output/weekly.md
带邮件发送(需要gog)
bun scripts/sec-digest.ts --provider claude --email me@example.com --output ./output/digest.md
带全文增强
bun scripts/sec-digest.ts --provider claude --enrich --output ./output/digest.md
CLI参数参考
| 参数 | 描述 | 默认值 |
|---|
| --provider <id> | AI提供商:openai\ | gemini\ | claude\ | ollama | openai |
| --opml <profile> |
OPML配置文件:tiny\|full | tiny |
| --hours
| 时间窗口(小时) | 48 |
| --mode | 快捷模式:daily=48h, weekly=168h | — |
| --top-n | 最多选择文章数 | 20 |
| --output | 输出Markdown文件路径 | ./output/sec-digest-YYYYMMDD.md |
| --dry-run | 仅基于规则评分(不调用AI) | false |
| --no-twitter | 禁用Twitter/X KOL获取 | false |
| --email | 通过gog发送摘要到指定地址 | — |
| --enrich | 获取文章全文 | false |
| --help | 显示帮助 | — |
快速参考
- - 入口点:scripts/sec-digest.ts
- 管道:src/pipeline/run.ts
- 配置根目录:~/.sec-daily-digest/
- 配置文件:~/.sec-daily-digest/config.yaml
- 源文件:~/.sec-daily-digest/sources.yaml
- 健康文件:~/.sec-daily-digest/health.json
- 归档目录:~/.sec-daily-digest/archive/
- OPML缓存(精简版):~/.sec-daily-digest/opml/tiny.opml
- OPML缓存(完整版):~/.sec-daily-digest/opml/CyberSecurityRSS.opml
必需行为
- 1. 在解析订阅源前始终执行OPML远程更新检查。
- 如果OPML远程检查失败,仅在缓存存在时使用本地缓存。
- 如果远程检查失败且无本地缓存,快速失败(无可用缓存OPML且远程更新检查失败)。
- 提供商默认为openai;显式--provider参数覆盖配置。
- 排序使用平衡权重(安全+AI,默认0.5/0.5)。
- 输出章节必须包含AI发展、安全动态和漏洞专报。
- output_language存在于配置中,但当前实现输出固定双语风格Markdown;不假设运行时语言切换。
- Twitter KOL章节(🔐 Security KOL Updates)仅在获取到推文时显示。
- 无凭据时静默跳过Twitter获取(不崩溃)。
Twitter/X配置
Twitter KOL账号在~/.sec-daily-digest/sources.yaml中配置(首次运行时自动创建,含15个默认安全研究员)。
默认KOL列表
Taviso, GossiTheDog, SwiftOnSecurity, MalwareTechBlog, briankrebs, JohnLaTwC等9人。
sources.yaml格式
yaml
sources:
- id: taviso
type: twitter
name: Tavis Ormandy / Google Project Zero
handle: taviso
enabled: true
priority: true
topics:
- security
# 禁用默认源:
- id: thegrugq
enabled: false
# 添加自定义源:
- id: myresearcher
type: twitter
name: My Researcher
handle: myresearcher
enabled: true
priority: false
topics:
- security
后端选择
| 设置的环境变量 | 使用的后端 |
|---|
| TWITTERAPIIOKEY | twitterapi.io(首选,5 QPS) |
| 仅XBEARERTOKEN |
官方Twitter API v2(5并发) |
| 两者都设置 | twitterapi.io |
| 两者都未设置 | Twitter禁用(静默) |
| TWITTERAPIBACKEND=official | 强制使用官方API |
归档(历史去重)
过去7天内已见过的文章获得−5分惩罚(不删除,仅降低优先级)。归档文件存储在~/.sec-daily-digest/archive/YYYY-MM-DD.json中,90天后自动清理。
源健康监控
每次运行记录每个源的获取成功/失败状态。失败率超过50%(且检查次数≥2)的源会在摘要底部的⚠️ 源健康警告章节中显示。健康数据存储在~/.sec-daily-digest/health.json中。
邮件发送(gog)
--email参数通过gogcli发送摘要:
bash
安装(macOS)
brew install steipete/tap/gogcli
gog auth login # 一次性OAuth设置
发送摘要
bun scripts/sec-digest.ts --provider claude \
--email me@example.com --output /tmp/digest.md
日志输出:
[sec-digest] email=sent to me@example.com
或
[sec-digest] email=failed: gog not found in PATH. Install: ...
全文增强
--enrich在AI评分前获取文章全文(提升分类和摘要质量)。跳过付费墙/社交域名(Twitter, Reddit, GitHub, YouTube, NYT, Bloomberg, WSJ, FT)。
cron集成
bash
每日07:00
0 7 * cd /path/to/sec-daily-digest && \
bun scripts/sec-digest.ts --mode daily --output ~/digests/sec-$(date +\%Y\%m\%d).md \
2>&1 | tee -a ~/.sec-daily-digest/cron.log
每周一08:00
0 8 1 cd /path/to/sec-daily-digest && \
bun scripts/sec-digest.ts --mode weekly --output ~/digests/weekly-$(date +\%Y\%m\%d).md \
2>&1 | tee -a ~/.sec-daily-digest/cron.log
常见错误
- 1. 所选提供商缺少API密钥(OPENAIAPIKEY is required, GEMINIAPIKEY is required, ANTHROPICAPIKEY is required)。
- 误解回退行为:OPML回退依赖于缓存,非无条件。
- 无提供商凭据时忘记使用--dry-run。
- 未设置TWITTERAPIIOKEY或XBEARERTOKEN却期望Twitter KOL。
成功信号
- 1. 日志包含[sec-digest] provider=...、[sec-digest] cachefallback=true|false、[sec-digest] output=...和[sec-digest] stats feeds=... articles=... recent=... selected=... vulnevents=... twitter_kols=...。
- 输出Markdown包含三个必需章节和漏洞引用。
- 每次运行后写入~/.sec-daily-digest/archive/YYYY-MM-DD.json。
- 每次运行后更新~/.sec-daily-digest/health.json。
更多