Curation v2 step 2: Claude Opus 5 editor, the Brief, per-provider budgets

- AnthropicBackend (Messages API, cached system block, output_config.effort,
  server-side fallbacks, refusal surfaced as an error); Llms { bulk, editor }
  with editor_or_bulk(); PriceTable-based UsageMeter per provider.
- [anthropic], [editorial], deepseek.max_concurrent_requests and
  curation.max_article_count config; startup logs resolved providers.
- Budget day is the UTC date of started_at, preloaded from
  runs.provider_costs_json; finish_run writes provider_costs_json and
  config_json. Stage A batches run concurrently with per-batch budget checks.
- Editor prompt with one-line "why" per pick; no minimum lineup size;
  --max-articles is a ceiling; top-up branch deleted; why stored on picks and
  issue_articles.why and rendered in chapters and In this issue.
- Summaries on the editor client (3k-token input, concurrency 4, bulk then
  excerpt fallback); "The Brief" replaces From the Editor; section intros gone.
- Colophon carries per-provider costs and models.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A1rCLQeKBgnBo3oTgHuTMe
This commit is contained in:
2026-09-02 03:56:14 +00:00
co-authored by Claude Fable 5.1
parent 3a9f4b99e0
commit 57efbb49b4
30 changed files with 2539 additions and 1079 deletions
+27 -2
View File
@@ -4,6 +4,7 @@
# Nested keys use a double underscore in env vars, e.g.
# DAILY_EPUB_MINIFLUX__API_KEY=...
# DAILY_EPUB_DEEPSEEK__API_KEY=...
# DAILY_EPUB_ANTHROPIC__API_KEY=...
# DAILY_EPUB_SERVER__HMAC_SECRET=...
# DAILY_EPUB_LOOKBACK_HOURS=30
@@ -13,7 +14,7 @@ target_article_count = 20
prefilter_keep = 120
retention_days = 21 # EPUBs, by age
xtc_retention_count = 5 # XTC issues, by count (~80-100 MB each)
max_daily_usd = 2.0
max_daily_usd = 2.0 # DeepSeek ceiling per UTC day; [anthropic] has its own
world_briefing = true
# SQLite database file. Parent directories are created on demand.
@@ -36,14 +37,34 @@ base_url = "https://api.deepseek.com/v1"
model = "deepseek-v4-flash" # DeepSeek-V4-Flash-0731 (confirmed 2026-08-15)
# api_key via DAILY_EPUB_DEEPSEEK__API_KEY env
score_batch_size = 12
max_concurrent_requests = 4 # stage-A batches in flight at once
score_temperature = 0.3
editorial_temperature = 0.8
editorial_temperature = 0.8 # used only when DeepSeek is the fallback editor
# USD per 1M tokens, used for the cost guardrail.
price_input_per_mtok = 0.14
price_cached_input_per_mtok = 0.0028
price_output_per_mtok = 0.28
# Claude is the editor: selection, summaries, The Brief and the weekly profile
# rebuild. Every call degrades to DeepSeek when the key is missing, the daily
# ceiling is hit, or the API refuses/fails. Server-side refusal fallback
# (`fallbacks = "default"`) is always on. Set a spend limit in the Anthropic
# dashboard too: `max_daily_usd` is a runaway guard, not accounting.
[anthropic]
enabled = true
base_url = "https://api.anthropic.com"
model = "claude-opus-5"
# api_key via DAILY_EPUB_ANTHROPIC__API_KEY env
effort = "high" # low | medium | high | xhigh | max
price_input_per_mtok = 5.0
price_cache_write_per_mtok = 6.25
price_cache_read_per_mtok = 0.5
price_output_per_mtok = 25.0
max_daily_usd = 3.0
max_concurrent_requests = 4
[curation]
max_article_count = 28 # hard ceiling; there is no minimum (§13)
always_include_feeds = [] # miniflux feed ids or site urls
blocked_domains = []
# Extra paywalled hosts, merged with the built-in list (nytimes, wsj, ft, …).
@@ -66,6 +87,10 @@ good_value = 0.35
not_for_me_value = -1.0
verdicts_in_prompt = 60
[editorial]
summary_model = "editor" # editor (Claude) | bulk (DeepSeek)
summary_input_tokens = 3000 # article text offered per summary
[publish]
# Where both EPUB editions land, and what the OPDS feed lists. BookOrbit is
# optional — it just watches this folder if you run it.