Skip to content

Repository files navigation

AI Agent Digest

CI Daily Digest Deploy Worker License: MIT

Your private AI research desk: discover, rank, synthesize, deliver—and answer follow-up questions.

每天早上 7 點台灣時間,把 AI agent / 手術 AI / 資安領域的重要消息整理成繁體中文 PDF,透過 LINE 推到你手機。收到後可以直接在 LINE 裡追問,Q&A agent 會根據文章原文回答。

不是單純的 RSS summarizer:同一套 pipeline 同時處理 relevance scoring、全文擷取、跨來源去重、PDF 排版、LINE delivery、feedback loop 與七天內的 grounded Q&A。

Pipeline

RSS feeds + arxiv author feeds + X tweets
  →  Haiku (relevance 1-5)  →  filter ≥ 3
  →  Sonnet (繁中 markdown)
  →  WeasyPrint (PDF, Noto CJK TC)
  →  Cloudflare R2 (PDF + markdown + 文章原文)
  →  LINE push (第一頁預覽圖 + PDF 連結)  →  你的手機
  →  LINE Q&A (追問 → Worker → Claude Sonnet → 回答)

LINE 收到兩則訊息:一張第一頁預覽圖(直接看),加一則 caption + PDF 連結(完整閱讀)。 收到後直接打字提問,agent 會根據最近 7 天的文章原文回答。

LINE Q&A Agent

在 LINE 聊天室直接傳文字訊息即可追問 digest 內容:

  1. 你傳訊息 → Worker 立刻回覆「思考中...」
  2. Worker 從 R2 載入最近 7 天的文章原文 + 摘要
  3. 呼叫 Claude Sonnet 回答
  4. LINE push 推送答案
  • 支援多輪追問(最多 10 輪)
  • 對話每天自動清除
  • 文章原文透過直接抓取 + Jina Reader API(JS 網站 fallback)取得

追蹤範圍

RSS feeds (feeds.yaml)

來源 類別
Anthropic Blog official
Simon Willison blog
Martin Fowler blog
Addy Osmani blog
Hugging Face Blog official
LangChain Blog official
HumanLayer blog
Hacker News (200+ pts) aggregator
arxiv cs.AI / cs.CL / cs.CV academic

Surgical AI 研究者 (arxiv author feeds)

研究者 機構 arxiv X
Nicolas Padoy CAMMA, Strasbourg
Nassir Navab CAMP, TUM @NassirNavab
Danail Stoyanov UCL @DanStoyanov
Lena Maier-Hein DKFZ @lena_maierhein
Qi Dou CUHK @QiDou_

X / Twitter (social.yaml)

AI 工程:@simonw @karpathy @mitchellh @swyx @addyosmani @hwchase17 @lateinteraction

Surgical AI:@NassirNavab @DanStoyanov @lena_maierhein @QiDou_

篩選規則 (prompts/relevance.md)

分數 收錄標準
5 (必收) AI agent 基建、Anthropic/Claude/MCP、手術 AI、上述 5 位研究者、頂尖 lab agent 論文
4 (強相關) 生產環境 AI 案例、醫療 AI、eval 框架、AI 資安、所有資安、深度 agent 工具文
3 (簡短提及) 泛 LLM 研究、開發工具、亞太醫療 AI、AI 醫療政策
1-2 (過濾) VC 新聞、leaderboard 比分、AI 炒作、crypto、生成藝術、入門教程

設定

Important

.env.example 只有 placeholder。API keys、LINE User ID、R2 credentials 與 Worker secrets 必須存放在 GitHub Actions secrets 或 wrangler secret,不可 commit 到 repo。

1. LINE Messaging API

  1. LINE Developers Console 建一個 Provider
  2. 建一個 Messaging API channel
  3. 在 channel 設定頁拿到 Channel access token(長效)
  4. 用手機加 bot 好友(掃 QR code)
  5. 拿你自己的 User ID:channel 設定頁 → Basic settings → Your user ID(U 開頭的字串)

2. Cloudflare R2

  1. Cloudflare Dashboard → R2 → 建一個 bucket
  2. 開啟 bucket 的 公開存取(Settings → Public access → 設定 custom domain 或用 *.r2.dev
  3. R2 → Manage R2 API Tokens → 建一個 token(Object Read & Write 權限)
  4. 記下:Endpoint URL、Access Key ID、Secret Access Key、Bucket name、公開 domain

3. Anthropic API key

console.anthropic.com 拿。

4. (Optional) X Bearer Token

只想跑 RSS 跳過這步。要開 X 整合:

  1. console.x.com 申請 developer account
  2. 拿 Bearer Token (AAAA... 開頭)

5. GitHub Secrets

Repo → Settings → Secrets and variables → Actions → New repository secret:

Name Value 必須
ANTHROPIC_API_KEY sk-ant-...
R2_ENDPOINT_URL https://<account_id>.r2.cloudflarestorage.com
R2_ACCESS_KEY_ID R2 API token
R2_SECRET_ACCESS_KEY R2 API secret
R2_BUCKET_NAME bucket 名稱
R2_PUBLIC_DOMAIN digest.example.compub-xxx.r2.dev
LINE_CHANNEL_ACCESS_TOKEN LINE channel token
LINE_USER_ID Uxxxx...
X_BEARER_TOKEN AAAA... optional

6. Cloudflare Worker

Worker 處理 LINE feedback + Q&A agent:

cd worker
wrangler secret put LINE_CHANNEL_SECRET
wrangler secret put LINE_CHANNEL_ACCESS_TOKEN
wrangler secret put ANTHROPIC_API_KEY
wrangler deploy

部署後把 Worker URL 設為 LINE Developers Console 的 Webhook URL。

7. 手動觸發

Repo → Actions → "Daily Digest" → Run workflow

第一份 digest 1-3 分鐘後進你 LINE。

Cron

.github/workflows/daily.yml

- cron: "0 23 * * *"

23:00 UTC = 07:00 台灣時間,每天發送。

校準 prompt

頭三天 output 不滿意的地方,改:

  • prompts/relevance.md:覺得「該選沒選 / 不該選卻選了」
  • prompts/digest.md:翻譯風格、保留英文 term 清單、格式

commit + push,下一輪自動生效。這是這個 project 唯一會花你時間的部分

改 source

  • feeds.yaml:RSS / arxiv feed 清單
  • social.yaml:X handle 清單

直接編輯,commit 即可。

預估成本

項目 每月
Anthropic API (Haiku 評分 + Sonnet 寫稿) ~$5
Anthropic API (Q&A agent, Sonnet) ~$2-5(視追問頻率)
X API (11 handles × ~5 tweets/day × $0.005) ~$8
LINE Messaging API $0 (免費額度 500 則/月)
Cloudflare R2 $0 (免費額度 10 GB)
Cloudflare Worker $0 (免費額度 100K req/天)
GitHub Actions (public repo) $0
Total ~$15-18/月

不開 X 就只 ~$7-10/月。

Dedup(去重複)

Pipeline 會在 R2 存一份 digests/seen.json,記錄已推送過的文章 fingerprint。 每次 fetch 後自動過濾重複,7 天後自動清理舊紀錄。--dry-run 模式不讀寫 dedup state。

Feedback(👍/👎)

LINE 訊息底部有 quick reply 按鈕(👍 實用 / 👎 不實用)。 按下後由 Cloudflare Worker 接收 postback,存到 R2 feedback/{date}.json。 Pipeline 每次執行會顯示近 7 天的 feedback 統計。

R2 儲存結構

Key 用途
digests/{date}.pdf 當天 digest PDF
digests/{date}.png 第一頁預覽圖
digests/{date}.md Digest markdown(Q&A context)
digests/{date}-sources.json 文章原文全文(Q&A context)
digests/seen.json Dedup fingerprints
feedback/{date}.json 使用者回饋
conversations/{userId}.json Q&A 對話歷史(每天清除)

結構

ai-digest/
├── digest.py              # 主 pipeline(fetch → dedup → score → write → deliver)
├── social.py              # X fetcher
├── feeds.yaml             # RSS + arxiv 清單
├── social.yaml            # X handle 清單
├── prompts/
│   ├── relevance.md       # Haiku 評分用 (英文)
│   └── digest.md          # Sonnet 寫稿用 (繁中規則)
├── worker/
│   ├── index.js           # Cloudflare Worker(feedback + Q&A agent)
│   └── wrangler.toml      # Worker 設定
├── tests/                 # pytest 測試
├── docs/adr/              # 架構決策紀錄 (ADR-0001 ~ 0005)
├── .github/workflows/
│   ├── daily.yml          # 每日 cron
│   └── ci.yml             # lint + test
├── .env                   # 本地 secrets (gitignored)
└── README.md

Privacy 與安全界線

  • Daily workflow 只從 GitHub Actions secrets 讀取 credentials。
  • LINE User ID 是 identifier,不應出現在 issue、log、README 或 sample config。
  • 若 R2 bucket 開啟 public access,請視公開 domain 上的 PDF/Markdown 為可被分享的內容。
  • Q&A context 與 conversation history 儲存在你自己的 R2;公開 repo 不包含任何 digest output。
  • 若你不需要 Q&A,可以只部署 daily digest,不部署 Cloudflare Worker。

License

MIT — see LICENSE.

About

A private AI research desk: discover, rank, synthesize, deliver, and answer follow-up questions.

Topics

Resources

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages