Case study · Personal tool · public code

Daily Claude Digest

Personal daily briefing: fail-soft fetchers, one Claude composition call, sent over Gmail, scheduled via GitHub Actions

PythonClaude APIGmail APIGitHub Actions
30-second version
Problem
Keeping up with Claude news, community signal and my own usage meant checking a dozen places by hand every morning.
Built
Fail-soft fetchers over 15+ sources feeding one Claude composition call whose system prompt is the digest spec, sent via Gmail.
Result
One daily briefing of up to 7 sections at 1 PM Philippine time; personal tool, not a production system.
Role
Sole engineer (personal tool)

The Problem

Keeping up with "all things Claude" (official Anthropic releases, the engineering blog, community signal on Reddit and Hacker News, plus my own usage and yesterday's commits) meant checking a dozen places by hand every morning, or just not keeping up. I wanted one high-signal HTML briefing in my inbox at 1 PM Philippines time: curated, never padded with filler, and never fabricated. The hard part isn't sending an email; it's that the sources are scattered, some are unreliable, and the thing doing the curating has to know when to stay quiet rather than invent content.

So the design makes Claude the curator and a scheduled job the trigger. The model reads whatever the fetchers managed to pull, selects what matters, and renders a sectioned digest. If a source is down, that section simply doesn't appear.

Architecture

A scheduled trigger fans out to a set of fail-soft fetchers, hands everything to Claude as one composition call, and sends the rendered HTML over Gmail. The whole digest structure lives in a system prompt, not in code.

rendering diagram…

fetch_sources.py runs four kinds of fetcher, an HTML scraper, the Reddit API, the HN Algolia API, and an X mirror, across three tiers of sources plus a personal tier (Anthropic Admin API usage stats, git log across four repos, and a local work log). Every fetcher returns [] on failure instead of raising, so one dead source degrades the digest rather than killing the run. compose_digest.py then makes a single claude-sonnet-4-6 call whose system prompt is the entire digest spec: seven sections, hard rules, and the visual design. It parses the JSON it returns into a subject + HTML body. send_email.py sends it via Gmail OAuth.

It is a personal tool, scheduled via GitHub Actions (a daily cron at 05:00 UTC, 1 PM Philippine time), with a local Python harness (test_locally.py) for --dry-run / --send development.

Key Decisions

  • Claude is the curator, not the cron. The runtime is just a trigger; all judgment about what's worth including lives in the model plus a 121-line system prompt. Iterating on the digest's shape is a prompt edit, not a code change.
  • Prompt-as-code. The seven sections, the "never fabricate / fail soft" rules, and the HTML design guidelines all live in prompts/daily_digest_prompt.md and config/email_design.md. The Python only fetches inputs and ships outputs.
  • Fail-soft everywhere. Fetchers catch their own HTTP errors and return empty; the prompt instructs Claude to omit any section with no data. The digest always sends, even if Reddit or HN is unreachable.
  • Sonnet by default, overridable. claude-sonnet-4-6 balances cost and latency for what is a composition task, not a reasoning one, and CLAUDE_DIGEST_MODEL lets local runs swap it.
  • Config over code. Sources (15+ URLs, tiered) and the 15-tip pool are YAML, each tip carrying a weight and provenance so selection is data-driven and editable without touching Python.

Code Samples

The composition call: the system prompt is the digest spec, concatenated with the visual design guide, and the model returns structured JSON.

client = Anthropic(api_key=api_key)
system_prompt = _load_prompt() + "\n\n# Visual design guidelines\n\n" + _load_design()
user_message = _build_user_message(
    target_date=target_date,
    fetched=fetched,
    tips_pool=tips_pool,
    used_tip_ids_recent=used_tip_ids_recent or [],
    usage_stats=usage_stats,
    git_summary=git_summary,
)
response = client.messages.create(
    model=model,
    max_tokens=MAX_TOKENS,
    system=system_prompt,
    messages=[{"role": "user", "content": user_message}],
)
return _parse_response(response.content[0].text if response.content else "")

Fail-soft fetching means any source that errors returns None and is skipped, never aborting the run:

def _http_get(url, *, timeout=DEFAULT_TIMEOUT, headers=None):
    """Fetch a URL with timeout and friendly user-agent. Returns None on any error."""
    try:
        h = {"User-Agent": USER_AGENT, "Accept": "text/html, application/json, */*"}
        if headers:
            h.update(headers)
        r = httpx.get(url, timeout=timeout, headers=h, follow_redirects=True)
        r.raise_for_status()
        return r
    except (httpx.TimeoutException, httpx.HTTPError) as e:
        logger.warning(f"GET {url} failed: {type(e).__name__}: {e}")
        return None

Metrics

These are verifiable facts about the system, not measured outcomes:

  • ~685 lines of core Python across 4 modules (fetch_sources 246, compose_digest 195, test_locally 174, send_email 70)
  • 8 direct dependencies (anthropic, httpx, pyyaml, python-dotenv, beautifulsoup4, google-api-python-client, google-auth-httplib2, google-auth-oauthlib)
  • 15+ source URLs across three tiers (6 official, 4 press, 3 community) plus a personal tier (Admin API + git log across 4 repos)
  • 15 curated tips in a weighted YAML pool
  • claude-sonnet-4-6, single composition call, 8192 max tokens
  • Up to 7 email sections (hero, what's new, community, tip of the day, usage, wins, things to know)
  • Cron 0 5 * * * UTC (1 PM Philippines time)

What I Learned

  • Put the judgment in the prompt, the plumbing in the code. Encoding the digest structure and the "never fabricate" rules as a system prompt made the whole thing tunable without redeploys. The Python never had to know what a "section" was.
  • Fail-soft beats correct-or-nothing for a daily artifact. A briefing that's 80% complete and always arrives is far more useful than one that's perfect when every source happens to be up. Returning [] instead of raising was the single most important reliability decision.
  • A hosted scheduler is the right home for a once-a-day job. Moving the trigger off my laptop and onto a GitHub Actions cron means the digest arrives whether or not my machine is on.

GitHub repo. A personal tool, scheduled via GitHub Actions. It is not a production system for anyone but me.