Skip to content

About

universal subscriber

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

universal-subscriber

coverage

Watch the information sources you care about, let an LLM read them for you, and keep what matters — twice:

  1. Daily digest. New articles and page changes are summarized (and translated into Chinese) by an LLM, filtered against your reader persona, and emailed to you once a day.
  2. Knowledge wiki. Everything that survives the relevance filter is archived with its full text, then compiled into a curated markdown wiki — concept pages that accumulate and cross-reference knowledge over time, instead of throwing it away after one email.

The wiki design follows Karpathy's llm-wiki pattern: raw sources are immutable, the LLM maintains the pages, and the bookkeeping (index, log, health checks) is done in plain code so it cannot drift.

Usage

uv run subscriber run --dry-run                       # fetch all sources, print the digest, don't send email
uv run subscriber run                                 # fetch, archive, and send via AgentMail
uv run subscriber run --source ethresear.ch --dry-run # run a single source

uv run subscriber wiki                                # compile archived sources into wiki pages
uv run subscriber wiki --limit 10                     # compile at most 10 sources this run
uv run subscriber wiki --lint                         # health check: broken links, orphan pages, backlog
uv run subscriber wiki --lint --fix                   # LLM-assisted broken-link repair, then the health check

uv run subscriber search "agent 沙箱"                  # search the wiki: pages first, sources as fallback
uv run subscriber search "沙箱逃逸" --mode semantic     # vector search, for wording that won't match literally
uv run subscriber search --setup                      # register/refresh the qmd index

On the first run: RSS sources take the newest max_items_per_source entries and mark the rest as read; page sources record a baseline snapshot and only report a summary once the page changes.

To bootstrap the wiki from each source's history (bypassing the seen-state), there is a one-off backfill script:

uv run python scripts/backfill.py --max-items 15      # newest 15 items per source

How the wiki works

wiki/
  sources/YYYY/MM/*.md   archived articles: frontmatter + summary + full text (immutable)
  pages/*.md             curated knowledge pages, cross-linked with [[wikilinks]]
  index.md               one line per page, grouped by category with tags, rebuilt from page frontmatter on every compile
  index/<category>.md    the same catalog sliced per category, so a reader loads one category instead of all of them
  log.md                 append-only ingest log

subscriber run archives every article that passes the persona filter into wiki/sources/ with compiled: false. The compile agent (agent/, built on pi) then works through pending sources one at a time: it browses the index by category, reads only the pages it intends to touch, and merges the new knowledge with incremental string-replace edits instead of full-page rewrites. When a source is too thin to judge (a bare link), it fetches the URL and reads the full text first; when nothing is worth keeping it says so and moves on. A deterministic verifier — not the model's own judgment — decides whether the result is acceptable (frontmatter shape, category set, link style, page size cap); violations are fed back for repair, and only a clean pass marks the source compiled: true.

cd agent && npm install --ignore-scripts   # once; needs Node >= 22.19
node src/main.ts --limit 5                 # compile up to 5 pending sources
node src/main.ts --dry-run                 # just show the backlog

The older single-shot compiler (subscriber wiki --limit N) still works and shares the same on-disk format; --lint / --fix remain the health-check tools for both.

Pages belong to one of a fixed set of categories and carry a few tags from a shared vocabulary; both live in the frontmatter and the index, which is how the planning step learns them. When writing a page, the LLM only sees the index slice of that page's own category, so cross-references stay within a category instead of linking everything to everything.

Wikilinks pointing at pages that do not exist yet are allowed on purpose — they mark concepts worth writing up later. subscriber wiki --lint --fix keeps this from getting out of hand: it has the LLM redirect near-miss names to existing pages, degrade links not worth a page to plain text, and keep the genuinely valuable ones (marked as unbuilt) within a fixed share of all links. The text replacements are applied by code; the LLM only rules on each link.

Searching the wiki

The index only carries a one-line description per page, so a question phrased in the reader's own words often matches no page name. subscriber search fills that gap on top of qmd, a local markdown search engine (npm i -g @tobilu/qmd).

pages/ and sources/ are indexed as two separate qmd collections, never one: the archive is several times the volume of the curated pages and restates the same material almost verbatim, so a single merged ranking buries the pages under raw source text. The search therefore escalates instead of merging — query the pages, and only when the best hit is weak (or with --deep) go down to the sources; a source hit is then reported through its pages: frontmatter, i.e. as "this evidence was compiled into page X", so the answer stays at the page level unless the source is still uncompiled backlog.

--mode keyword (BM25, the default) is literal: it matches only wording the wiki itself uses, so a question in your own words hits nothing at all — 成本治理 finds the page, the synonymous 控制花销 finds nothing. Rather than leaving that as a dead end, zero keyword hits trigger an automatic semantic retry (local embeddings, qmd embed once). Keyword answers in about a second, the retry adds a few. --mode semantic and --mode hybrid (LLM reranking, slow) are there for when you already know which one you want. The two daily units refresh the index after they touch content, so the search never lags behind the wiki.

The wiki also carries the search with it. skill/wiki-knowledge-base/wiki-search is a standalone python3 + qmd executable that ships inside the wiki directory, so an LLM handed nothing but the knowledge repo still gets the same escalation as one command — it locates the wiki relative to itself and re-points the qmd collections on every run, which matters because each fresh clone lands at a new absolute path.

The homepage of the published site has its own search box — a client-side filter over titles, tags, descriptions and page ledes, built as index.json at deploy time. No service, no request leaves the page.

Using the wiki elsewhere

The wiki is plain markdown with YAML frontmatter and [[wikilinks]], so it opens directly in Obsidian, and any LLM agent pointed at the directory can answer questions from it — read the relevant index/<category>.md first, then follow links. skill/wiki-knowledge-base/ packages that retrieval path (including the qmd escalation above) as a portable skill for any LLM handed such a repo. Since it is just files, syncing it elsewhere is a git push: keep the wiki directory in a private repo and you can attach the same knowledge base to whatever tool you use, on any machine, without running a server.

Run subscriber wiki --lint occasionally. It reports broken wikilinks, pages nothing links to, and how many sources are waiting to be compiled — the failure mode to watch for is pages silently going stale, not the compiler crashing.

Configuration

Copy the example files and fill in your own values:

cp .env.example .env
cp config.yaml.example config.yaml
cp prompts.yaml.example prompts.yaml
  • .env — DEEPSEEK_API_KEY, AGENTMAIL_API_KEY (required for sending mail; generate at https://agentmail.to).
  • config.yaml — LLM model, recipient email, list of sources (type: rss / page / browser / inbox; browser uses Obscura to render JS pages, selector can narrow what is watched). Optional wiki.dir overrides where the wiki lives (default wiki/).
  • prompts.yaml — all prompts: digest summarization, the reader persona, and the wiki compiler. The persona steers both what gets kept in the digest and what enters the wiki — off-topic entries are dropped (the model outputs SKIP).
  • data/state.db — SQLite state (already-seen items, page snapshots). Delete it to reset.

Adding a new source

Look for an RSS endpoint first — many sites have one without linking it: Substack /feed, Medium /feed/@user, Discourse forums /latest.rss, GitHub Pages blogs /index.xml or /feed/. Fall back to type: page only when there is no feed.

Scheduled runs

Three systemd user timers (no cron on this box; templates in scripts/systemd/, logs at data/run.log): subscriber.timer fetches and sends the digest at 08:00, subscriber-wiki.timer runs the compile agent at 02:30 — DeepSeek's off-peak window, which halves the token price — and subscriber-push.timer pushes the wiki repo at 09:00.

Fetching and compiling happen every day; publishing does not. scripts/push_wiki.sh fires daily but keeps its own due date in data/push_due: after a successful push it picks a random 1-3 day gap before the next one, so a few days of updates land in one commit. Nothing to commit means the window is not consumed and it retries the next day. scripts/push_wiki.sh --force pushes immediately and re-rolls the gap.

cp scripts/systemd/* ~/.config/systemd/user/ && systemctl --user daemon-reload
systemctl --user enable --now subscriber.timer subscriber-wiki.timer subscriber-push.timer
systemctl --user list-timers 'subscriber*'      # next run times
systemctl --user start subscriber-wiki.service  # trigger once manually

Testing

uv run pytest                           # run all tests
uv run pytest --cov --cov-report=term-missing  # with coverage report

All LLM and network calls are mocked in tests. The coverage badge is updated automatically by CI on each push to main.

Known limitations

  • rss / page fetching uses curl_cffi to mimic a Chrome TLS fingerprint, which gets past most anti-bot checks. Sites that require JS rendering or challenges need type: browser (depends on ~/.local/bin/obscura; on complex React pages Obscura's --dump text needs a selector to isolate the main content).
  • The backfill script cannot reconstruct history for browser sources (no article list in a rendered text dump), and its link heuristic for page sources only finds articles nested under the listing page's own path.
  • Wiki compilation is sequential; use --limit to spread a large backlog over several runs. The agent caps its own work per source (turn limit, page size cap), but token cost still varies with how many pages it decides to read.

About

universal subscriber

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages