Automated alerting for new PubMed papers matching your research interests. Detects only new papers by tracking previously seen PMIDs.
Built for cron-based monitoring β zero external dependencies, pure Python 3 stdlib.
# Run all watched queries, report new papers
python pubmed_watcher.py watch
# First run initializes with 5 default longevity/biotech queriespython pubmed_watcher.py watch # Default: last 7 days
python pubmed_watcher.py watch --days 14 # Look back 14 days
python pubmed_watcher.py watch --json # Machine-readable JSON
python pubmed_watcher.py watch --markdown # Telegram-ready markdown
python pubmed_watcher.py watch --days 3 --markdown # Combine flagsHow it works:
- Runs each configured query against PubMed E-utilities
- Filters out papers already in
seen.json - Reports only NEW papers
- Saves newly seen PMIDs to
seen.json
python pubmed_watcher.py add "CRISPR aging therapy"
python pubmed_watcher.py add "rapamycin longevity clinical trial"python pubmed_watcher.py listOutput:
π Watched Queries (5)
[1] epigenetic reprogramming aging longevity
Added: 2026-02-17
[2] immunosenescence aging immune system
Added: 2026-02-17
...
python pubmed_watcher.py remove 3python pubmed_watcher.py history # Last 20 runs
python pubmed_watcher.py history --limit 5 # Last 5 runspython pubmed_watcher.py reset-seen # Backs up to seen.bak.json firstπ 12 new papers found across 5 queries (last 7 days)
βββ π "epigenetic reprogramming aging longevity" β 3 new βββ
π Epigenetic reprogramming reverses age-associated...
π€ Zhang W β¦ Bhatt DL
π° Nature Aging β’ 2026 Feb
π https://pubmed.ncbi.nlm.nih.gov/12345678/
Telegram-ready formatting with bold titles and inline links.
Full structured output for piping to other tools:
[
{
"query": "epigenetic reprogramming aging longevity",
"query_id": 1,
"new_papers": [
{
"pmid": "12345678",
"title": "...",
"authors": ["First Author", "Last Author"],
"journal": "Nature Aging",
"date": "2026 Feb",
"doi": "10.1038/...",
"url": "https://pubmed.ncbi.nlm.nih.gov/12345678/"
}
]
}
]| File | Purpose |
|---|---|
config.json |
Watched queries and their IDs |
seen.json |
All previously seen PMIDs (prevents re-alerting) |
history.json |
Log of past watch runs with counts |
All state is stored in the same directory as the script. Safe to version-control config.json; the others are ephemeral.
On first run, these queries are pre-configured:
- epigenetic reprogramming aging longevity
- immunosenescence aging immune system
- senolytics senescent cells therapy
- AI drug discovery clinical trial
- biological age clock methylation
# Run daily at 8 AM, pipe markdown to a notification script
0 8 * * * cd /path/to/pubmed-watcher && python3 pubmed_watcher.py watch --markdown >> /tmp/pubmed-alerts.md 2>&1Or integrate directly with OpenClaw cron for Telegram delivery.
- API: NCBI E-utilities (esearch + efetch)
- Rate limiting: 0.5s delay between API calls (NCBI-friendly)
- Dependencies: None β pure Python 3.9+ stdlib
- Retry: 3 attempts with backoff on network errors
- Date filter: Uses
edat(Entrez date) for reliable recency filtering
Internal tool. No license required.