> built 2026-11-21 18:08 UTC from 04fe7d5 (main) · keeptabs 0.0.1. Details: build_info.json

# index.html.md

<!-- generated by epythet -->

# keeptabs

Keep tabs on the subjects you care about: say what to follow, let a scheduled run collect what is new, and ask what changed.

```default
pip install keeptabs
```

This is technology watch, also called horizon scanning, and *veille* in French. It is built to be driven by an AI agent: the agent writes the specification with you, the package does the collecting, and an agent answers your questions from what was collected.

## Quick start

```bash
keeptabs init-watch "Generative AI" --example gen-ai --watch-id gen-ai
keeptabs tick
keeptabs whats-new gen-ai --as-text
```

The first command creates a watch from a shipped example. The second fetches every source that is due, keeps what matches, and stores it. The third prints what is new, grouped by subtopic, with links.

In Python, by watch id:

```python
from keeptabs import tools

tools.tick()
news = tools.whats_new("gen-ai", since="3d")
```

Or with the stores in hand:

```python
from keeptabs import watch_mall

mall = watch_mall("gen-ai")  # stores: items, dropped, entities, runs, digests, state
recent = [item for item in mall["items"].values() if item["score"] >= 3]
```

## How it works

A **watch** is one subject you follow. Its specification is a YAML file that starts as a vague idea and gets sharper over time: a scope, subtopics with keywords, named things to track (models, libraries, companies), sources, and how often to report.

A **tick** is one run. It works out which sources are due from their stored state, fetches them, drops what it has already seen, scores each item against the specification, and stores what is relevant. It is safe to run as often as you like, so any scheduler can trigger it.

A **digest** is the answer to “what’s new”: the items acquired since the last one, grouped by subtopic. It is stored locally, and sent to the channels you chose only if you turned that on.

Everything is stored under `~/.local/share/keeptabs/`, in stores with a dictionary interface:

```default
specs/<watch id>.yaml
data/<watch id>/{items,dropped,entities,runs,digests,state}/<key>.json
```

Set `KEEPTABS_ROOTDIR`, or pass `rootdir=`, to put it elsewhere.

## Building a watch

```bash
keeptabs init-watch "Music AI" --intent "real-time music generation and gesture control"
keeptabs add-keywords music-ai "real-time music generation, neural audio synthesis" --subtopic "Real-time generation" --priority high
keeptabs add-entity music-ai "Magenta RealTime" --kind model --aliases "Magenta RT"
keeptabs add-source music-ai arxiv 'cat:cs.SD AND all:"real-time"' --cadence 1d
keeptabs add-source music-ai github_releases magenta/magenta-realtime --keep-all
keeptabs add-source music-ai feed https://example.org/blog/feed.xml --cadence 12h
keeptabs tick --watch music-ai --force
```

| Source kind       | Target         | Notes                                                                                                                               |
|-------------------|----------------|-------------------------------------------------------------------------------------------------------------------------------------|
| `feed`            | feed URL       | RSS, Atom or JSON Feed, fetched conditionally                                                                                       |
| `arxiv`           | arXiv query    | newest first                                                                                                                        |
| `github_releases` | `owner/name`   | releases of a repository                                                                                                            |
| `hackernews`      | search words   |                                                                                                                                     |
| `news_search`     | search words   | news articles                                                                                                                       |
| `email`           | sender address | newsletters in a mailbox, read through [correspond](https://github.com/thorwhalen/correspond); needs `pip install 'keeptabs[mail]'` |

Some things only you can do, such as subscribing to a newsletter or providing a key. An agent records them with `keeptabs add-action`, the sources that depend on them are skipped until `keeptabs resolve-action`, and `keeptabs pending` lists what is waiting on you.

## Asking

```bash
keeptabs whats-new music-ai --since 3d --as-text
keeptabs items music-ai --query "latency" --entity magenta-realtime
keeptabs entities music-ai
keeptabs due          # what runs next, what is failing
```

Add `--json` to any command for the full result.

## Scheduling

```bash
keeptabs schedule                 # a launchd entry on macOS, a cron line elsewhere
keeptabs schedule --kind systemd
```

It prints the entry and how to install it. It installs nothing.

## Digests

In the specification:

```yaml
digest:
  cadence: 1w
  channels:
    - email:someone@example.org
    - github:owner/repo#12      # a discussion
    - slack:                    # webhook URL in KEEPTABS_SLACK_WEBHOOK_URL
    - slack:team                # webhook URL in KEEPTABS_SLACK_WEBHOOK_URL_TEAM
  auto_send: false
```

`keeptabs digest <watch>` is a dry run: it shows the digest and what would be sent where, and changes nothing. `keeptabs digest <watch> --send` sends that same digest, and from then on its items count as reported. The scheduled run writes the digest to the local store, and sends it only when `auto_send` is true. With channels and no `auto_send`, the items wait for your `--send`. Items count as reported only once every channel took the digest, so one that did not arrive is sent again. Email and GitHub go through `correspond`, so they pass its outbound checks.

What the items say was written by other people. Titles and summaries are escaped in a digest, and every link is built from a stored item’s URL.

## Agent skills

Two skills ship with the package, in `keeptabs/data/skills/`:

- `keeptabs-spec`: create and refine a watch with the user.
- `keeptabs-ask`: answer questions from what a watch collected.

## Extending

Each part that you may want to replace is one keyword argument of `tick` or `make_digest`, with a default that works out of the box.

| Argument                    | Default                             | Replace it to                                            |
|-----------------------------|-------------------------------------|----------------------------------------------------------|
| `rootdir=`                  | `~/.local/share/keeptabs`           | keep the local files elsewhere                           |
| `specs=`, `malls=`, `lock=` | local files, a local file lock      | store elsewhere, with any `MutableMapping`               |
| `fetchers=`, `http_get=`    | standard library HTTP, `feedparser` | add a source kind, or use another HTTP client            |
| `matcher=`                  | whole-word keyword scoring          | score with embeddings or a model, detect near-duplicates |
| `summarizer=`               | Markdown, no model                  | write the digest with a model                            |
| `senders=`                  | `correspond`, a Slack webhook       | add a delivery channel                                   |

A source kind is any name that has a fetcher at run time. A kind of your own says what to fetch in its `target` field:

```python
from keeptabs import tick


def fetch_my_api(source, *, state, http_get):
    reply = http_get(f"https://api.example.org/new?q={source['target']}")
    ...
    return items, state  # items: dicts with at least 'url' and 'title'


tick(fetchers={"my_api": fetch_my_api})  # for sources with kind: my_api
```

A matcher receives the watch’s stores, so it can compare an item with what is already there:

```python
def matcher(item, spec, *, mall):
    ...
    return {
        "score": 3.0,
        "subtopics": [],
        "entities": [],
        "matched": [],
        "duplicate_of": None,
    }
```

To keep everything in stores of your own, give both, and the run takes no local lock:

```python
tick(specs=my_specs, malls=lambda watch_id: my_stores_for(watch_id))
```

The command line and the shipped skills run with what `keeptabs.tools.components` returns, which is the one place to change for another surface.

## What it does not do yet

- It does not discover new things to track by itself: an agent adds them with `add-entity`. A matcher of your own may name new things, which are stored as candidates.
- It matches by keywords. Near-duplicates under different URLs are stored separately.
- An item judged irrelevant is not judged again when the keywords change later. It is kept in the `dropped` store, with its score.
- Newsletter reading keeps one item per message, filtered by sender.

<p class="epythet-aggregates">This documentation as a single file: <a href="keeptabs.md">keeptabs.md</a> (Markdown, for agents).</p>


# _autosummary/keeptabs.digest.html.md

# keeptabs.digest

Answering “what’s new”, writing it up, and delivering it.

A digest is data first ([`whats_new()`](_autosummary/keeptabs.digest.html.md#keeptabs.digest.whats_new) returns a JSON-ready dict) and text
second (a summarizer turns that dict into Markdown).

What the items say was written by other people. [`render_markdown()`](_autosummary/keeptabs.digest.html.md#keeptabs.digest.render_markdown) builds
every link from a stored item’s URL and escapes titles and summaries, so fetched
text cannot add a link, a tag or a mention of its own.

### Functions

| [`deliver`](_autosummary/keeptabs.digest.html.md#keeptabs.digest.deliver)(text, channels, \*, title[, dry_run, ...])   | Send a digest to each channel reference, such as `email:me@example.org`, `github:owner/repo#12` (a discussion) or `slack:`.    |
|-------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------|
| [`escape_text`](_autosummary/keeptabs.digest.html.md#keeptabs.digest.escape_text)(text)                                    | Text that renders as itself, on one line, in Markdown and in HTML: no link, tag, mention, heading or emphasis of its own.      |
| [`make_digest`](_autosummary/keeptabs.digest.html.md#keeptabs.digest.make_digest)(spec, mall, \*[, since, now, ...])       | Build a digest, store it, and deliver it (for real only when `send`).                                                          |
| [`render_markdown`](_autosummary/keeptabs.digest.html.md#keeptabs.digest.render_markdown)(digest)                              | A digest as Markdown, with no model involved.                                                                                  |
| [`scheduled_digest`](_autosummary/keeptabs.digest.html.md#keeptabs.digest.scheduled_digest)(\*[, summarizer, senders])          | The `on_digest_due` callback for [`keeptabs.engine.tick()`](_autosummary/keeptabs.engine.html.md#keeptabs.engine.tick). |
| [`whats_new`](_autosummary/keeptabs.digest.html.md#keeptabs.digest.whats_new)(spec, mall, \*[, since, max_items, now])   | The items acquired since `since`, grouped by subtopic, best first.                                                             |

### keeptabs.digest.deliver(text, channels, , title, dry_run=True, senders=None)

Send a digest to each channel reference, such as `email:me@example.org`,
`github:owner/repo#12` (a discussion) or `slack:`.

Dry-run by default: a real send reaches people and cannot be unsent. One
failing channel does not stop the others.

* **Return type:**
  [`list`](https://docs.python.org/3/builtins/stdtypes.html#list)

### keeptabs.digest.escape_text(text)

Text that renders as itself, on one line, in Markdown and in HTML: no link,
tag, mention, heading or emphasis of its own.

```pycon
>>> print(escape_text('Sprout <!channel> [click](https://evil.example) & co'))
Sprout &lt;!channel&gt; \[click\](https://evil.example) &amp; co
>>> print(escape_text('ping @someone about #12\n# A heading'))
ping &#64;someone about &#35;12 &#35; A heading
```

* **Return type:**
  [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)

### keeptabs.digest.make_digest(spec, mall, , since=None, now=None, summarizer=None, send=False, senders=None, mark_reported=None)

Build a digest, store it, and deliver it (for real only when `send`).

`mark_reported` says whether the items count as reported from now on, so the
next digest leaves them out. It defaults to `send`: a dry run changes nothing,
and can be followed by the real send of the same digest. Items are never marked
when a delivery failed, so a digest that did not arrive is sent again.

* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)

### keeptabs.digest.render_markdown(digest)

A digest as Markdown, with no model involved.

```pycon
>>> print(render_markdown({'title': 'Gen AI', 'since': '2026-01-01T00:00:00+00:00',
...     'until': '2026-01-08T00:00:00+00:00', 'total_new': 1, 'shown': 1, 'sections': [
...     {'id': 'video', 'title': 'Video', 'items': [{'title': 'A model', 'url': 'https://example.com/a',
...     'summary': 'It generates.', 'published': '2026-01-05T00:00:00+00:00', 'source': 'blog'}]}],
...     'new_entities': [], 'active_entities': [], 'failing_sources': []}))
# What's new: Gen AI

2026-01-01 to 2026-01-08. 1 new item.

## Video

- [A model](https://example.com/a) (blog, 2026-01-05). It generates.
```

* **Return type:**
  [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)

### keeptabs.digest.scheduled_digest(, summarizer=None, senders=None)

The `on_digest_due` callback for [`keeptabs.engine.tick()`](_autosummary/keeptabs.engine.html.md#keeptabs.engine.tick).

A period with nothing new is skipped. Otherwise the digest is written to the
`digests` store, and:

- with `digest.auto_send: true`, it is sent, and its items count as reported
  once every channel took it;
- with channels but no `auto_send`, nothing is sent and nothing is marked:
  the items wait for the owner’s `digest --send`;
- with no channel at all, the stored digest is the report.

### keeptabs.digest.whats_new(spec, mall, , since=None, max_items=None, now=None)

The items acquired since `since`, grouped by subtopic, best first.

`since` is a time, or a duration ago (`'3d'`). It defaults to the time of
the last digest, or to a week ago when there has been none. What the last
digest already reported is not reported again.

* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)


# _autosummary/keeptabs.engine.html.md

# keeptabs.engine

The scheduled run: work out what is due, acquire it, match it, store it.

[`tick()`](_autosummary/keeptabs.engine.html.md#keeptabs.engine.tick) is idempotent and safe to call as often as you like. Whether a source
is due is computed from stored state, so any trigger works (cron, launchd, a
systemd timer, a loop) and a missed run is simply caught up by the next one.

### Functions

| [`due_sources`](_autosummary/keeptabs.engine.html.md#keeptabs.engine.due_sources)(spec, state_store, \*[, now])     | The sources of a spec that should be fetched now.                     |
|------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------|
| [`fetch_source`](_autosummary/keeptabs.engine.html.md#keeptabs.engine.fetch_source)(spec, source, mall, \*, ...)     | Fetch one source and store what is new.                               |
| [`is_due`](_autosummary/keeptabs.engine.html.md#keeptabs.engine.is_due)(state, \*, now)                        | Whether a source (or a digest) with this stored state should run now. |
| [`runnable_sources`](_autosummary/keeptabs.engine.html.md#keeptabs.engine.runnable_sources)(spec)                        | The sources of a spec that are enabled and wait on no human action.   |
| [`state_key`](_autosummary/keeptabs.engine.html.md#keeptabs.engine.state_key)(source)                             | The key of a source's record in the `state` store.                    |
| [`tick`](_autosummary/keeptabs.engine.html.md#keeptabs.engine.tick)([watch_ids, rootdir, specs, malls, ...]) | Run everything that is due, once, and say what happened.              |
| [`tick_lock`](_autosummary/keeptabs.engine.html.md#keeptabs.engine.tick_lock)([rootdir])                          | Hold the local lock that keeps two ticks from running at once.        |

### Exceptions

| [`AlreadyRunning`](_autosummary/keeptabs.engine.html.md#keeptabs.engine.AlreadyRunning)   | Another tick holds the lock.   |
|-------------------------------------------------------------------|--------------------------------|

### *exception* keeptabs.engine.AlreadyRunning

Bases: [`RuntimeError`](https://docs.python.org/3/builtins/exceptions.html#RuntimeError)

Another tick holds the lock.

### keeptabs.engine.due_sources(spec, state_store, , now=None)

The sources of a spec that should be fetched now.

* **Return type:**
  [`list`](https://docs.python.org/3/builtins/stdtypes.html#list)

### keeptabs.engine.fetch_source(spec, source, mall, , fetchers, http_get, matcher, now)

Fetch one source and store what is new. Returns the run record.

It never raises for a failing source: the failure is recorded, the source
backs off, and the caller carries on.

* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)

### keeptabs.engine.is_due(state, , now)

Whether a source (or a digest) with this stored state should run now.

```pycon
>>> now = to_datetime('2026-01-02')
>>> is_due({}, now=now), is_due({'next_due': '2026-01-03T00:00:00+00:00'}, now=now)
(True, False)
```

* **Return type:**
  [`bool`](https://docs.python.org/3/builtins/functions.html#bool)

### keeptabs.engine.runnable_sources(spec)

The sources of a spec that are enabled and wait on no human action.

* **Return type:**
  [`list`](https://docs.python.org/3/builtins/stdtypes.html#list)

### keeptabs.engine.state_key(source)

The key of a source’s record in the `state` store.

* **Return type:**
  [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)

### keeptabs.engine.tick(watch_ids=None, , rootdir=None, specs=None, malls=None, fetchers=None, http_get=None, matcher=None, on_digest_due=None, lock=None, now=None, force=False)

Run everything that is due, once, and say what happened.

- `specs`: the store of watch specifications (default: local files under `rootdir`).
- `malls`: a function from a watch id to that watch’s stores (default: local files).
  Stores of your own come in a pair: give both `specs` and `malls`.
- `fetchers`: source kind to fetcher, added to the defaults.
- `http_get`: the one door to the network.
- `matcher`: `match(item, spec, *, mall)`, scoring an item against a spec.
- `on_digest_due`: called with `(spec, mall, now)` for each watch whose digest is
  due (default: [`keeptabs.digest.scheduled_digest()`](_autosummary/keeptabs.digest.html.md#keeptabs.digest.scheduled_digest)); `False` for no digest.
- `lock`: a context manager held for the run, or `False` for none. The default
  is a local file lock, and none when the stores are your own.
- `force`: run every enabled, unblocked source whatever its schedule.

A watch or a source that fails is reported in `failures` and does not stop the rest.

* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)

### keeptabs.engine.tick_lock(rootdir=None)

Hold the local lock that keeps two ticks from running at once.

The operating system releases it when the process ends, however it ends.


# _autosummary/keeptabs.fetchers.html.md

# keeptabs.fetchers

Acquiring raw items from each kind of source.

A fetcher is a function `fetch(source, *, state, http_get) -> (items, state)`:

- `source` is one normalized source record of a spec,
- `state` is what the fetcher stored last time (validators, cursors),
- `http_get` is the one door to the network, so tests and other HTTP clients
  replace it with a single argument,
- `items` are raw item dicts with at least `url` and `title`.

`DEFAULT_FETCHERS` maps a source kind to its fetcher. Pass your own mapping
to [`keeptabs.engine.tick()`](_autosummary/keeptabs.engine.html.md#keeptabs.engine.tick) to add a kind or replace one. A spec may use any
kind that has a fetcher at run time.

Everything a fetcher returns was written by other people: it is data, and it is
escaped again where it is rendered ([`keeptabs.digest`](_autosummary/keeptabs.digest.html.md#module-keeptabs.digest)).

### Functions

| [`extract_links`](_autosummary/keeptabs.fetchers.html.md#keeptabs.fetchers.extract_links)(text)                               | The distinct http(s) links in a text, in order of appearance.                |
|----------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------|
| [`fetch_arxiv`](_autosummary/keeptabs.fetchers.html.md#keeptabs.fetchers.fetch_arxiv)(source, \*, state[, http_get])        | The newest arXiv papers matching `source['query']` (arXiv query syntax).     |
| [`fetch_email`](_autosummary/keeptabs.fetchers.html.md#keeptabs.fetchers.fetch_email)(source, \*, state[, http_get, ...])   | Newsletter issues in the inbox, from `source['sender']` (all mail if empty). |
| [`fetch_feed`](_autosummary/keeptabs.fetchers.html.md#keeptabs.fetchers.fetch_feed)(source, \*, state[, http_get])         | An RSS, Atom or JSON feed at `source['url']`.                                |
| [`fetch_github_releases`](_autosummary/keeptabs.fetchers.html.md#keeptabs.fetchers.fetch_github_releases)(source, \*, state[, ...])   | The releases of the repository `source['repo']` (`owner/name`).              |
| [`fetch_hackernews`](_autosummary/keeptabs.fetchers.html.md#keeptabs.fetchers.fetch_hackernews)(source, \*, state[, http_get])   | The newest Hacker News stories matching `source['query']`.                   |
| [`fetch_news_search`](_autosummary/keeptabs.fetchers.html.md#keeptabs.fetchers.fetch_news_search)(source, \*, state[, http_get])  | News articles matching `source['query']`, through Google News RSS.           |
| [`http_get`](_autosummary/keeptabs.fetchers.html.md#keeptabs.fetchers.http_get)(url, \*[, etag, last_modified, timeout]) | GET a URL politely: identified, and conditional when validators are known.   |
| [`strip_html`](_autosummary/keeptabs.fetchers.html.md#keeptabs.fetchers.strip_html)(text)                                  | Readable text from an HTML fragment, with no tag left in it.                 |

### Classes

| [`Response`](_autosummary/keeptabs.fetchers.html.md#keeptabs.fetchers.Response)(status[, body, headers])   | What a fetcher needs from an HTTP exchange.   |
|--------------------------------------------------------------------------------------|-----------------------------------------------|

### *class* keeptabs.fetchers.Response(status, body=b'', headers=dict())

Bases: [`object`](https://docs.python.org/3/builtins/functions.html#object)

What a fetcher needs from an HTTP exchange.

### keeptabs.fetchers.extract_links(text)

The distinct http(s) links in a text, in order of appearance.

```pycon
>>> extract_links('see https://a.example/x, and <a href="https://b.example">b</a>')
['https://a.example/x', 'https://b.example']
```

* **Return type:**
  [`list`](https://docs.python.org/3/builtins/stdtypes.html#list)

### keeptabs.fetchers.fetch_arxiv(source, \*, state, http_get=<function http_get>)

The newest arXiv papers matching `source['query']` (arXiv query syntax).

### keeptabs.fetchers.fetch_email(source, \*, state, http_get=None, read_mail=<function \_read_mail>)

Newsletter issues in the inbox, from `source['sender']` (all mail if empty).

Each message becomes one item, carrying the links found in its body. The
cursor is the time of the newest message seen.

### keeptabs.fetchers.fetch_feed(source, \*, state, http_get=<function http_get>)

An RSS, Atom or JSON feed at `source['url']`.

### keeptabs.fetchers.fetch_github_releases(source, \*, state, http_get=<function http_get>)

The releases of the repository `source['repo']` (`owner/name`).

### keeptabs.fetchers.fetch_hackernews(source, \*, state, http_get=<function http_get>)

The newest Hacker News stories matching `source['query']`.

### keeptabs.fetchers.fetch_news_search(source, \*, state, http_get=<function http_get>)

News articles matching `source['query']`, through Google News RSS.

### keeptabs.fetchers.http_get(url, , etag=None, last_modified=None, timeout=30)

GET a URL politely: identified, and conditional when validators are known.

* **Return type:**
  [`Response`](_autosummary/keeptabs.fetchers.html.md#keeptabs.fetchers.Response)

### keeptabs.fetchers.strip_html(text)

Readable text from an HTML fragment, with no tag left in it.

Entities are decoded before tags are removed, so an escaped tag does not
come back to life.

```pycon
>>> strip_html('<p>Hello&nbsp;<b>world</b></p>')
'Hello world'
>>> strip_html('safe &lt;script&gt;alert(1)&lt;/script&gt; text')
'safe alert(1) text'
```

* **Return type:**
  [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)


# _autosummary/keeptabs.html.md

# keeptabs

Keep tabs on the subjects you care about (technology watch; in French, “veille”).

Describe what to follow as watch specifications, let a scheduled `tick` acquire
and match what is new, and ask “what’s new” whenever you like.

By watch id, with everything on its default (this is what the command line runs):

```pycon
>>> from keeptabs import tools
>>> tools.tick()
>>> tools.whats_new('gen-ai', since='3d')
```

With parts of your own (stores, fetchers, a matcher, a summarizer, senders):

```pycon
>>> from keeptabs import tick, whats_new, make_digest
```

### Functions

| [`deliver`](_autosummary/keeptabs.html.md#keeptabs.deliver)(text, channels, \*, title[, dry_run, ...])   | Send a digest to each channel reference, such as `email:me@example.org`, `github:owner/repo#12` (a discussion) or `slack:`.    |
|-------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------|
| [`escape_text`](_autosummary/keeptabs.html.md#keeptabs.escape_text)(text)                                    | Text that renders as itself, on one line, in Markdown and in HTML: no link, tag, mention, heading or emphasis of its own.      |
| [`http_get`](_autosummary/keeptabs.html.md#keeptabs.http_get)(url, \*[, etag, last_modified, timeout])    | GET a URL politely: identified, and conditional when validators are known.                                                     |
| [`keyword_matcher`](_autosummary/keeptabs.html.md#keeptabs.keyword_matcher)(item, spec, \*[, mall])              | Score an item against a spec's keywords, subtopics and entities.                                                               |
| [`make_digest`](_autosummary/keeptabs.html.md#keeptabs.make_digest)(spec, mall, \*[, since, now, ...])       | Build a digest, store it, and deliver it (for real only when `send`).                                                          |
| [`memory_mall`](_autosummary/keeptabs.html.md#keeptabs.memory_mall)()                                        | The stores of one watch, in memory: for tests and throwaway runs.                                                              |
| [`normalize_spec`](_autosummary/keeptabs.html.md#keeptabs.normalize_spec)(spec, \*[, watch_id])                 | A complete, checked copy of a watch specification.                                                                             |
| [`render_markdown`](_autosummary/keeptabs.html.md#keeptabs.render_markdown)(digest)                              | A digest as Markdown, with no model involved.                                                                                  |
| [`scheduled_digest`](_autosummary/keeptabs.html.md#keeptabs.scheduled_digest)(\*[, summarizer, senders])          | The `on_digest_due` callback for [`keeptabs.engine.tick()`](_autosummary/keeptabs.engine.html.md#keeptabs.engine.tick). |
| [`spec_store`](_autosummary/keeptabs.html.md#keeptabs.spec_store)([rootdir])                                | Watch specifications, keyed by watch id, stored as YAML files.                                                                 |
| [`tick`](_autosummary/keeptabs.html.md#keeptabs.tick)([watch_ids, rootdir, specs, malls, ...])        | Run everything that is due, once, and say what happened.                                                                       |
| [`watch_mall`](_autosummary/keeptabs.html.md#keeptabs.watch_mall)(watch_id, \*[, rootdir])                  | The stores of one watch.                                                                                                       |
| [`whats_new`](_autosummary/keeptabs.html.md#keeptabs.whats_new)(spec, mall, \*[, since, max_items, now])   | The items acquired since `since`, grouped by subtopic, best first.                                                             |

### Classes

| [`Response`](_autosummary/keeptabs.html.md#keeptabs.Response)(status[, body, headers])   | What a fetcher needs from an HTTP exchange.   |
|--------------------------------------------------------------------------------------|-----------------------------------------------|

### Exceptions

| [`AlreadyRunning`](_autosummary/keeptabs.html.md#keeptabs.AlreadyRunning)   | Another tick holds the lock.                                            |
|-------------------------------------------------------------------|-------------------------------------------------------------------------|
| [`SpecError`](_autosummary/keeptabs.html.md#keeptabs.SpecError)        | A watch specification that cannot be used, with the reason and the fix. |

### *exception* keeptabs.AlreadyRunning

Bases: [`RuntimeError`](https://docs.python.org/3/builtins/exceptions.html#RuntimeError)

Another tick holds the lock.

### *class* keeptabs.Response(status, body=b'', headers=dict())

Bases: [`object`](https://docs.python.org/3/builtins/functions.html#object)

What a fetcher needs from an HTTP exchange.

### *exception* keeptabs.SpecError

Bases: [`ValueError`](https://docs.python.org/3/builtins/exceptions.html#ValueError)

A watch specification that cannot be used, with the reason and the fix.

### keeptabs.deliver(text, channels, , title, dry_run=True, senders=None)

Send a digest to each channel reference, such as `email:me@example.org`,
`github:owner/repo#12` (a discussion) or `slack:`.

Dry-run by default: a real send reaches people and cannot be unsent. One
failing channel does not stop the others.

* **Return type:**
  [`list`](https://docs.python.org/3/builtins/stdtypes.html#list)

### keeptabs.escape_text(text)

Text that renders as itself, on one line, in Markdown and in HTML: no link,
tag, mention, heading or emphasis of its own.

```pycon
>>> print(escape_text('Sprout <!channel> [click](https://evil.example) & co'))
Sprout &lt;!channel&gt; \[click\](https://evil.example) &amp; co
>>> print(escape_text('ping @someone about #12\n# A heading'))
ping &#64;someone about &#35;12 &#35; A heading
```

* **Return type:**
  [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)

### keeptabs.http_get(url, , etag=None, last_modified=None, timeout=30)

GET a URL politely: identified, and conditional when validators are known.

* **Return type:**
  [`Response`](_autosummary/keeptabs.fetchers.html.md#keeptabs.fetchers.Response)

### keeptabs.keyword_matcher(item, spec, , mall=None)

Score an item against a spec’s keywords, subtopics and entities.

```pycon
>>> spec = {'keywords': ['diffusion'], 'exclude_keywords': ['crypto'],
...     'subtopics': [{'id': 'video', 'priority': 'high', 'keywords': ['text-to-video']}],
...     'entities': [{'id': 'sora', 'name': 'Sora', 'aliases': []}]}
>>> m = keyword_matcher({'title': 'Sora: a text-to-video diffusion model', 'summary': ''}, spec)
>>> m['score'], m['subtopics'], m['entities']
(7.0, ['video'], ['sora'])
>>> keyword_matcher({'title': 'Diffusion of crypto', 'summary': ''}, spec)['score']
0.0
```

* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)

### keeptabs.make_digest(spec, mall, , since=None, now=None, summarizer=None, send=False, senders=None, mark_reported=None)

Build a digest, store it, and deliver it (for real only when `send`).

`mark_reported` says whether the items count as reported from now on, so the
next digest leaves them out. It defaults to `send`: a dry run changes nothing,
and can be followed by the real send of the same digest. Items are never marked
when a delivery failed, so a digest that did not arrive is sent again.

* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)

### keeptabs.memory_mall()

The stores of one watch, in memory: for tests and throwaway runs.

```pycon
>>> sorted(memory_mall()) == sorted(STORE_KINDS)
True
```

* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)

### keeptabs.normalize_spec(spec, , watch_id=None)

A complete, checked copy of a watch specification.

Only `id` (or `title`) is required: a spec starts as a vague idea.

```pycon
>>> spec = normalize_spec({'title': 'Gen AI', 'keywords': ['diffusion'], 'entities': ['Sora']})
>>> spec['id'], spec['min_score'], spec['digest']['cadence'], spec['sources']
('gen-ai', 1.0, '1w', [])
>>> spec['entities']
[{'name': 'Sora', 'id': 'sora', 'kind': 'thing', 'aliases': []}]
```

* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)

### keeptabs.render_markdown(digest)

A digest as Markdown, with no model involved.

```pycon
>>> print(render_markdown({'title': 'Gen AI', 'since': '2026-01-01T00:00:00+00:00',
...     'until': '2026-01-08T00:00:00+00:00', 'total_new': 1, 'shown': 1, 'sections': [
...     {'id': 'video', 'title': 'Video', 'items': [{'title': 'A model', 'url': 'https://example.com/a',
...     'summary': 'It generates.', 'published': '2026-01-05T00:00:00+00:00', 'source': 'blog'}]}],
...     'new_entities': [], 'active_entities': [], 'failing_sources': []}))
# What's new: Gen AI

2026-01-01 to 2026-01-08. 1 new item.

## Video

- [A model](https://example.com/a) (blog, 2026-01-05). It generates.
```

* **Return type:**
  [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)

### keeptabs.scheduled_digest(, summarizer=None, senders=None)

The `on_digest_due` callback for [`keeptabs.engine.tick()`](_autosummary/keeptabs.engine.html.md#keeptabs.engine.tick).

A period with nothing new is skipped. Otherwise the digest is written to the
`digests` store, and:

- with `digest.auto_send: true`, it is sent, and its items count as reported
  once every channel took it;
- with channels but no `auto_send`, nothing is sent and nothing is marked:
  the items wait for the owner’s `digest --send`;
- with no channel at all, the stored digest is the report.

### keeptabs.spec_store(rootdir=None)

Watch specifications, keyed by watch id, stored as YAML files.

* **Return type:**
  [`MutableMapping`](https://docs.python.org/3/library/collections.abc.html#collections.abc.MutableMapping)

### keeptabs.tick(watch_ids=None, , rootdir=None, specs=None, malls=None, fetchers=None, http_get=None, matcher=None, on_digest_due=None, lock=None, now=None, force=False)

Run everything that is due, once, and say what happened.

- `specs`: the store of watch specifications (default: local files under `rootdir`).
- `malls`: a function from a watch id to that watch’s stores (default: local files).
  Stores of your own come in a pair: give both `specs` and `malls`.
- `fetchers`: source kind to fetcher, added to the defaults.
- `http_get`: the one door to the network.
- `matcher`: `match(item, spec, *, mall)`, scoring an item against a spec.
- `on_digest_due`: called with `(spec, mall, now)` for each watch whose digest is
  due (default: [`keeptabs.digest.scheduled_digest()`](_autosummary/keeptabs.digest.html.md#keeptabs.digest.scheduled_digest)); `False` for no digest.
- `lock`: a context manager held for the run, or `False` for none. The default
  is a local file lock, and none when the stores are your own.
- `force`: run every enabled, unblocked source whatever its schedule.

A watch or a source that fails is reported in `failures` and does not stop the rest.

* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)

### keeptabs.watch_mall(watch_id, , rootdir=None)

The stores of one watch.

```pycon
>>> import tempfile
>>> mall = watch_mall('demo', rootdir=tempfile.mkdtemp())
>>> sorted(mall)
['digests', 'dropped', 'entities', 'items', 'runs', 'state']
>>> mall['items']['abc'] = {'title': 'Ça marche'}
>>> mall['items']['abc'], list(mall['items'])
({'title': 'Ça marche'}, ['abc'])
```

* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)

### keeptabs.whats_new(spec, mall, , since=None, max_items=None, now=None)

The items acquired since `since`, grouped by subtopic, best first.

`since` is a time, or a duration ago (`'3d'`). It defaults to the time of
the last digest, or to a week ago when there has been none. What the last
digest already reported is not reported again.

* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)

### Modules

| [`tools`](_autosummary/keeptabs.tools.html.md#module-keeptabs.tools)       | The operations of keeptabs, as plain functions: JSON-able arguments in, a JSON-ready dict out.   |
|------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------|
| [`digest`](_autosummary/keeptabs.digest.html.md#module-keeptabs.digest)     | Answering "what's new", writing it up, and delivering it.                                        |
| [`engine`](_autosummary/keeptabs.engine.html.md#module-keeptabs.engine)     | The scheduled run: work out what is due, acquire it, match it, store it.                         |
| [`fetchers`](_autosummary/keeptabs.fetchers.html.md#module-keeptabs.fetchers) | Acquiring raw items from each kind of source.                                                    |
| [`matching`](_autosummary/keeptabs.matching.html.md#module-keeptabs.matching) | Deciding whether an item belongs to a watch, and to which part of it.                            |
| [`spec`](_autosummary/keeptabs.spec.html.md#module-keeptabs.spec)         | The watch specification: what one tracked area is, and how it is watched.                        |
| [`stores`](_autosummary/keeptabs.stores.html.md#module-keeptabs.stores)     | Where specs and acquired data live, behind `MutableMapping` interfaces.                          |
| [`util`](_autosummary/keeptabs.util.html.md#module-keeptabs.util)         | Small pure helpers: app directories, durations, timestamps, URL canonicalisation.                |


# _autosummary/keeptabs.matching.html.md

# keeptabs.matching

Deciding whether an item belongs to a watch, and to which part of it.

A matcher is a function `match(item, spec, *, mall) -> dict` returning `score`,
`subtopics`, `entities` and `matched` (the terms that hit). `mall` holds
the watch’s stores, so a matcher can compare an item with what is already there
(near-duplicates, embeddings) or keep its own records. It may also return
`duplicate_of`, the id of a stored item that this one repeats, and entity ids
that the spec does not list yet: those are recorded as candidates.

[`keyword_matcher()`](_autosummary/keeptabs.matching.html.md#keeptabs.matching.keyword_matcher) is the default: whole-word, case-insensitive hits on
the spec’s keywords and entity names, weighted by where they occur.

### Functions

| [`keyword_matcher`](_autosummary/keeptabs.matching.html.md#keeptabs.matching.keyword_matcher)(item, spec, \*[, mall])   | Score an item against a spec's keywords, subtopics and entities.   |
|--------------------------------------------------------------------------------------------|--------------------------------------------------------------------|

### keeptabs.matching.keyword_matcher(item, spec, , mall=None)

Score an item against a spec’s keywords, subtopics and entities.

```pycon
>>> spec = {'keywords': ['diffusion'], 'exclude_keywords': ['crypto'],
...     'subtopics': [{'id': 'video', 'priority': 'high', 'keywords': ['text-to-video']}],
...     'entities': [{'id': 'sora', 'name': 'Sora', 'aliases': []}]}
>>> m = keyword_matcher({'title': 'Sora: a text-to-video diffusion model', 'summary': ''}, spec)
>>> m['score'], m['subtopics'], m['entities']
(7.0, ['video'], ['sora'])
>>> keyword_matcher({'title': 'Diffusion of crypto', 'summary': ''}, spec)['score']
0.0
```

* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)


# _autosummary/keeptabs.spec.html.md

# keeptabs.spec

The watch specification: what one tracked area is, and how it is watched.

A spec is a plain `dict` on disk (YAML) so an agent can read and write it without
this package. [`normalize_spec()`](_autosummary/keeptabs.spec.html.md#keeptabs.spec.normalize_spec) is the single place that fills defaults and
rejects what cannot work, so every other module may assume a complete spec.

### Functions

| [`as_bool`](_autosummary/keeptabs.spec.html.md#keeptabs.spec.as_bool)(value, \*, what)             | A yes or no, from a boolean or from the words for one.     |
|---------------------------------------------------------------------------------------|------------------------------------------------------------|
| [`blocked_source_ids`](_autosummary/keeptabs.spec.html.md#keeptabs.spec.blocked_source_ids)(spec)             | Sources that wait on a human action that is still open.    |
| [`normalize_source`](_autosummary/keeptabs.spec.html.md#keeptabs.spec.normalize_source)(source)             | One source with defaults filled in and its fields checked. |
| [`normalize_spec`](_autosummary/keeptabs.spec.html.md#keeptabs.spec.normalize_spec)(spec, \*[, watch_id]) | A complete, checked copy of a watch specification.         |
| [`str_list`](_autosummary/keeptabs.spec.html.md#keeptabs.spec.str_list)(value, \*[, what])          | A list of strings from what a hand-written spec may hold.  |
| [`target_field`](_autosummary/keeptabs.spec.html.md#keeptabs.spec.target_field)(kind)                   | The field of a source that says what to fetch.             |

### Exceptions

| [`SpecError`](_autosummary/keeptabs.spec.html.md#keeptabs.spec.SpecError)   | A watch specification that cannot be used, with the reason and the fix.   |
|--------------------------------------------------------------|---------------------------------------------------------------------------|

### *exception* keeptabs.spec.SpecError

Bases: [`ValueError`](https://docs.python.org/3/builtins/exceptions.html#ValueError)

A watch specification that cannot be used, with the reason and the fix.

### keeptabs.spec.as_bool(value, , what)

A yes or no, from a boolean or from the words for one.

```pycon
>>> as_bool('false', what='enabled'), as_bool(True, what='enabled')
(False, True)
```

* **Return type:**
  [`bool`](https://docs.python.org/3/builtins/functions.html#bool)

### keeptabs.spec.blocked_source_ids(spec)

Sources that wait on a human action that is still open.

```pycon
>>> spec = normalize_spec({'id': 'w', 'sources': [{'kind': 'email', 'sender': 'a@b.c', 'id': 'nl'}],
...     'pending_actions': [{'action': 'Subscribe', 'blocks': ['nl']}]})
>>> blocked_source_ids(spec)
{'nl'}
```

* **Return type:**
  [`set`](https://docs.python.org/3/builtins/stdtypes.html#set)

### keeptabs.spec.normalize_source(source)

One source with defaults filled in and its fields checked.

```pycon
>>> s = normalize_source({'kind': 'feed', 'url': 'https://example.com/feed.xml'})
>>> s['id'], s['cadence'], s['enabled'], s['keep_all']
('feed-https-example-com-feed-xml-7a775d', '1d', True, False)
```

A kind with no fetcher of its own is accepted, and says what to fetch in `target`:

```pycon
>>> normalize_source({'kind': 'my_api', 'target': 'robots', 'id': 'robots'})['id']
'robots'
```

* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)

### keeptabs.spec.normalize_spec(spec, , watch_id=None)

A complete, checked copy of a watch specification.

Only `id` (or `title`) is required: a spec starts as a vague idea.

```pycon
>>> spec = normalize_spec({'title': 'Gen AI', 'keywords': ['diffusion'], 'entities': ['Sora']})
>>> spec['id'], spec['min_score'], spec['digest']['cadence'], spec['sources']
('gen-ai', 1.0, '1w', [])
>>> spec['entities']
[{'name': 'Sora', 'id': 'sora', 'kind': 'thing', 'aliases': []}]
```

* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)

### keeptabs.spec.str_list(value, , what='value')

A list of strings from what a hand-written spec may hold.

A bare string is one term, not a list of characters.

```pycon
>>> str_list('diffusion'), str_list(['LLM', 2026]), str_list(None)
(['diffusion'], ['LLM', '2026'], [])
```

YAML reads an unquoted `NO` as false and `3.10` as 3.1. What was written
cannot be recovered, so such a term is refused, with the fix:

```pycon
>>> str_list(['LLM', False], what='keywords')
Traceback (most recent call last):
  ...
keeptabs.spec.SpecError: keywords holds False, which is not text. Put the term in quotes, as in "no" or "3.10".
```

* **Return type:**
  [`list`](https://docs.python.org/3/builtins/stdtypes.html#list)

### keeptabs.spec.target_field(kind)

The field of a source that says what to fetch.

```pycon
>>> target_field('feed'), target_field('github_releases'), target_field('my_own_kind')
('url', 'repo', 'target')
```

* **Return type:**
  [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)


# _autosummary/keeptabs.stores.html.md

# keeptabs.stores

Where specs and acquired data live, behind `MutableMapping` interfaces.

Layout under the root (`~/.local/share/keeptabs` by default, never a repository):

```default
specs/<watch_id>.yaml
data/<watch_id>/{items,dropped,entities,runs,digests,state}/<key>.json
```

To store elsewhere, pass your own mappings: [`keeptabs.engine.tick()`](_autosummary/keeptabs.engine.html.md#keeptabs.engine.tick) takes
`specs=` (a mapping of watch id to spec) and `malls=` (a function from a watch
id to that watch’s stores). The factories here are the local default.

### Module Attributes

| [`STORE_KINDS`](_autosummary/keeptabs.stores.html.md#keeptabs.stores.STORE_KINDS)   | what was seen and judged irrelevant, so it is not judged again.   |
|----------------------------------------------------------------|-------------------------------------------------------------------|

### Functions

| [`json_store`](_autosummary/keeptabs.stores.html.md#keeptabs.stores.json_store)(\*parts[, rootdir])      | A store of JSON records, keyed without the file extension.        |
|--------------------------------------------------------------------------------------|-------------------------------------------------------------------|
| [`memory_mall`](_autosummary/keeptabs.stores.html.md#keeptabs.stores.memory_mall)()                       | The stores of one watch, in memory: for tests and throwaway runs. |
| [`spec_store`](_autosummary/keeptabs.stores.html.md#keeptabs.stores.spec_store)([rootdir])               | Watch specifications, keyed by watch id, stored as YAML files.    |
| [`watch_mall`](_autosummary/keeptabs.stores.html.md#keeptabs.stores.watch_mall)(watch_id, \*[, rootdir]) | The stores of one watch.                                          |

### keeptabs.stores.STORE_KINDS *= ('items', 'dropped', 'entities', 'runs', 'digests', 'state')*

what was seen and judged irrelevant, so it is not
judged again. entities: what is known about each tracked thing. runs: what each
fetch did. digests: what was written and sent. state: cursors and due times.

* **Type:**
  items
* **Type:**
  what was kept. dropped

### keeptabs.stores.json_store(\*parts, rootdir=None)

A store of JSON records, keyed without the file extension.

* **Return type:**
  [`MutableMapping`](https://docs.python.org/3/library/collections.abc.html#collections.abc.MutableMapping)

### keeptabs.stores.memory_mall()

The stores of one watch, in memory: for tests and throwaway runs.

```pycon
>>> sorted(memory_mall()) == sorted(STORE_KINDS)
True
```

* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)

### keeptabs.stores.spec_store(rootdir=None)

Watch specifications, keyed by watch id, stored as YAML files.

* **Return type:**
  [`MutableMapping`](https://docs.python.org/3/library/collections.abc.html#collections.abc.MutableMapping)

### keeptabs.stores.watch_mall(watch_id, , rootdir=None)

The stores of one watch.

```pycon
>>> import tempfile
>>> mall = watch_mall('demo', rootdir=tempfile.mkdtemp())
>>> sorted(mall)
['digests', 'dropped', 'entities', 'items', 'runs', 'state']
>>> mall['items']['abc'] = {'title': 'Ça marche'}
>>> mall['items']['abc'], list(mall['items'])
({'title': 'Ça marche'}, ['abc'])
```

* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)


# _autosummary/keeptabs.tools.html.md

# keeptabs.tools

The operations of keeptabs, as plain functions: JSON-able arguments in, a
JSON-ready dict out.

This module is the single list every surface is built from ([`TOOLS`](_autosummary/keeptabs.tools.html.md#keeptabs.tools.TOOLS)). It
knows nothing about the command line, MCP or HTTP; a wrapper references
`keeptabs.tools:tick` and gets a dict back.

### Module Attributes

| [`TOOLS`](_autosummary/keeptabs.tools.html.md#keeptabs.tools.TOOLS)   | The single list every surface is built from.   |
|----------------------------------------------------------|------------------------------------------------|

### Functions

| [`add_action`](_autosummary/keeptabs.tools.html.md#keeptabs.tools.add_action)(watch_id, action, \*[, why, ...])      | Record something only the human can do (subscribe to a newsletter, provide a key).                                         |
|----------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------|
| [`add_entity`](_autosummary/keeptabs.tools.html.md#keeptabs.tools.add_entity)(watch_id, name, \*[, kind, url, ...])  | Track a named thing (a model, library, company, lab, person, dataset) in a watch.                                          |
| [`add_keywords`](_autosummary/keeptabs.tools.html.md#keeptabs.tools.add_keywords)(watch_id, keywords, \*[, ...])       | Add comma-separated keywords to a watch, or to one of its subtopics (created if missing).                                  |
| [`add_source`](_autosummary/keeptabs.tools.html.md#keeptabs.tools.add_source)(watch_id, kind, target, \*[, ...])     | Add a source to a watch, or replace the one with the same id.                                                              |
| [`components`](_autosummary/keeptabs.tools.html.md#keeptabs.tools.components)([rootdir])                             | What every tool runs with: the stores, the matcher, the summarizer, the senders.                                           |
| [`digest`](_autosummary/keeptabs.tools.html.md#keeptabs.tools.digest)(watch_id, \*[, since, send, ...])          | Write a digest now and deliver it to the watch's channels.                                                                 |
| [`due`](_autosummary/keeptabs.tools.html.md#keeptabs.tools.due)(\*[, rootdir])                                | What the next tick would fetch, and when each other source is next due.                                                    |
| [`edit_watch`](_autosummary/keeptabs.tools.html.md#keeptabs.tools.edit_watch)(watch_id, patch, \*[, rootdir])        | Change top-level fields of a watch.                                                                                        |
| [`entities`](_autosummary/keeptabs.tools.html.md#keeptabs.tools.entities)(watch_id, \*[, rootdir])                 | The tracked things of a watch, with how often and when each was last seen.                                                 |
| [`examples`](_autosummary/keeptabs.tools.html.md#keeptabs.tools.examples)()                                        | The example watch specifications shipped with the package.                                                                 |
| [`init_watch`](_autosummary/keeptabs.tools.html.md#keeptabs.tools.init_watch)(title, \*[, intent, example, ...])     | Create a watch from a vague idea (`title` and `intent`), from a shipped `example`, or from a YAML or JSON `spec_file`.     |
| [`items`](_autosummary/keeptabs.tools.html.md#keeptabs.tools.items)(watch_id, \*[, query, subtopic, ...])       | Search the stored items of a watch: words in the title or summary, a subtopic, an entity, a source, a time.                |
| [`pending`](_autosummary/keeptabs.tools.html.md#keeptabs.tools.pending)(\*[, rootdir])                            | Everything that waits on the human, across all watches.                                                                    |
| [`remove_source`](_autosummary/keeptabs.tools.html.md#keeptabs.tools.remove_source)(watch_id, source_id, \*[, rootdir]) | Remove a source from a watch.                                                                                              |
| [`resolve_action`](_autosummary/keeptabs.tools.html.md#keeptabs.tools.resolve_action)(watch_id, action_id, \*[, ...])    | Mark a human action as done (or dropped), which unblocks the sources that waited on it.                                    |
| [`schedule`](_autosummary/keeptabs.tools.html.md#keeptabs.tools.schedule)(\*[, kind, every_minutes])               | The scheduler entry that runs `keeptabs tick` regularly: a launchd property list (macOS), a cron line, or a systemd timer. |
| [`tick`](_autosummary/keeptabs.tools.html.md#keeptabs.tools.tick)(\*[, watch, force, rootdir])                 | Run everything that is due: fetch, match, store, and write the digests that are due.                                       |
| [`watch`](_autosummary/keeptabs.tools.html.md#keeptabs.tools.watch)(watch_id, \*[, rootdir])                    | Show one watch specification in full.                                                                                      |
| [`watches`](_autosummary/keeptabs.tools.html.md#keeptabs.tools.watches)(\*[, rootdir])                            | List the watches: id, title, number of sources, and how many human actions are open.                                       |
| [`whats_new`](_autosummary/keeptabs.tools.html.md#keeptabs.tools.whats_new)(watch_id, \*[, since, max_items, ...])  | What a watch acquired since `since` (a time, or a duration ago such as 3d; default: since the last digest).                |

### keeptabs.tools.TOOLS *= [<function examples>, <function watches>, <function watch>, <function init_watch>, <function edit_watch>, <function add_source>, <function remove_source>, <function add_keywords>, <function add_entity>, <function add_action>, <function resolve_action>, <function pending>, <function due>, <function tick>, <function whats_new>, <function items>, <function entities>, <function digest>, <function schedule>]*

The single list every surface is built from.

### keeptabs.tools.add_action(watch_id, action, , why='', blocks=None, rootdir=None)

Record something only the human can do (subscribe to a newsletter, provide a key). `blocks` is a comma-separated list of source ids that must not run until it is done.

* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)

### keeptabs.tools.add_entity(watch_id, name, , kind='thing', url=None, aliases=None, note=None, rootdir=None)

Track a named thing (a model, library, company, lab, person, dataset) in a watch. Items that mention it, or one of its comma-separated `aliases`, are linked to it.

* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)

### keeptabs.tools.add_keywords(watch_id, keywords, , subtopic=None, priority=None, rootdir=None)

Add comma-separated keywords to a watch, or to one of its subtopics (created if missing).

* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)

### keeptabs.tools.add_source(watch_id, kind, target, , title=None, cadence=None, keep_all=False, source_id=None, rootdir=None)

Add a source to a watch, or replace the one with the same id. `target` is the feed URL, the search query, the `owner/name` repository or the newsletter sender address, by `kind` (feed, arxiv, github_releases, hackernews, news_search, email; any other kind needs its own fetcher at run time). `keep_all` keeps every item without a keyword match, for a source already dedicated to the topic.

* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)

### keeptabs.tools.components(rootdir=None)

What every tool runs with: the stores, the matcher, the summarizer, the senders.

This is the one place to change when a surface should run on other stores or
with a model-based matcher or summarizer: every tool below reads it.

* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)

### keeptabs.tools.digest(watch_id, , since=None, send=False, mark_reported=False, rootdir=None)

Write a digest now and deliver it to the watch’s channels. Without `send` it is a dry run that changes nothing: show the text and the channels to the user first, because a real send reaches people and cannot be unsent. `mark_reported` counts the items as reported without sending, for a digest that was only read here.

* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)

### keeptabs.tools.due(, rootdir=None)

What the next tick would fetch, and when each other source is next due.

* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)

### keeptabs.tools.edit_watch(watch_id, patch, , rootdir=None)

Change top-level fields of a watch. `patch` is a JSON object; each key replaces that field (a null removes it). Use it for title, intent, scope, keywords, min_score, digest and enabled.

* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)

### keeptabs.tools.entities(watch_id, , rootdir=None)

The tracked things of a watch, with how often and when each was last seen.

* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)

### keeptabs.tools.examples()

The example watch specifications shipped with the package.

* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)

### keeptabs.tools.init_watch(title, , intent='', example=None, spec_file=None, watch_id=None, overwrite=False, rootdir=None)

Create a watch from a vague idea (`title` and `intent`), from a shipped `example`, or from a YAML or JSON `spec_file`. Refine it afterwards with the add-\* commands or edit-watch.

* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)

### keeptabs.tools.items(watch_id, , query=None, subtopic=None, entity=None, source=None, since=None, limit=20, rootdir=None)

Search the stored items of a watch: words in the title or summary, a subtopic, an entity, a source, a time. Newest first.

* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)

### keeptabs.tools.pending(, rootdir=None)

Everything that waits on the human, across all watches.

* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)

### keeptabs.tools.remove_source(watch_id, source_id, , rootdir=None)

Remove a source from a watch. What it already acquired is kept.

* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)

### keeptabs.tools.resolve_action(watch_id, action_id, , status='done', rootdir=None)

Mark a human action as done (or dropped), which unblocks the sources that waited on it.

* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)

### keeptabs.tools.schedule(, kind=None, every_minutes=30)

The scheduler entry that runs `keeptabs tick` regularly: a launchd property list (macOS), a cron line, or a systemd timer. It is returned, not installed; `install` says how.

* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)

### keeptabs.tools.tick(, watch=None, force=False, rootdir=None)

Run everything that is due: fetch, match, store, and write the digests that are due. Safe to run as often as you like; this is what the scheduler calls. `watch` limits it to comma-separated watch ids; `force` ignores the schedule.

* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)

### keeptabs.tools.watch(watch_id, , rootdir=None)

Show one watch specification in full.

* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)

### keeptabs.tools.watches(, rootdir=None)

List the watches: id, title, number of sources, and how many human actions are open. A watch whose specification cannot be read is listed with its error.

* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)

### keeptabs.tools.whats_new(watch_id, , since=None, max_items=None, as_text=False, rootdir=None)

What a watch acquired since `since` (a time, or a duration ago such as 3d; default: since the last digest). Grouped by subtopic, best first. `as_text` adds the Markdown rendering.

* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)


# _autosummary/keeptabs.util.html.md

# keeptabs.util

Small pure helpers: app directories, durations, timestamps, URL canonicalisation.

### Functions

| [`app_dir`](_autosummary/keeptabs.util.html.md#keeptabs.util.app_dir)(\*parts[, rootdir])   | A directory under the root, created if missing.                              |
|--------------------------------------------------------------------------------|------------------------------------------------------------------------------|
| [`canonical_url`](_autosummary/keeptabs.util.html.md#keeptabs.util.canonical_url)(url)            | The same document should have the same URL, however it was linked.           |
| [`is_safe_id`](_autosummary/keeptabs.util.html.md#keeptabs.util.is_safe_id)(identifier)        | Whether an identifier can be used as a store key (it becomes a file name).   |
| [`isoformat`](_autosummary/keeptabs.util.html.md#keeptabs.util.isoformat)(when)               | The ISO 8601 form used in every stored record.                               |
| [`item_id`](_autosummary/keeptabs.util.html.md#keeptabs.util.item_id)(key)                  | A short, filesystem-safe, stable identifier for an item key.                 |
| [`parse_duration`](_autosummary/keeptabs.util.html.md#keeptabs.util.parse_duration)(duration)      | Seconds in a duration such as `'30m'`, `'6h'`, `'1d'` or `'2w'`.             |
| [`rootdir`](_autosummary/keeptabs.util.html.md#keeptabs.util.rootdir)([rootdir])            | The directory that holds every spec and every watch's data.                  |
| [`slug`](_autosummary/keeptabs.util.html.md#keeptabs.util.slug)(text)                    | A kebab-case identifier.                                                     |
| [`timestamp_key`](_autosummary/keeptabs.util.html.md#keeptabs.util.timestamp_key)(when)           | A sortable store key for a moment, in UTC.                                   |
| [`to_datetime`](_autosummary/keeptabs.util.html.md#keeptabs.util.to_datetime)(when, \*[, now])  | A timezone-aware datetime from a datetime, an ISO string, or a duration ago. |
| [`utcnow`](_autosummary/keeptabs.util.html.md#keeptabs.util.utcnow)()                      | The current time, timezone-aware, in UTC.                                    |

### keeptabs.util.app_dir(\*parts, rootdir=None)

A directory under the root, created if missing.

* **Return type:**
  [`Path`](https://docs.python.org/3/library/pathlib.html#pathlib.Path)

### keeptabs.util.canonical_url(url)

The same document should have the same URL, however it was linked.

Lower-cases the scheme and host, drops the fragment, a trailing slash,
default ports and click-tracking parameters, and sorts what is left.

```pycon
>>> canonical_url('HTTPS://Example.com:443/a/?utm_source=x&b=2&a=1#top')
'https://example.com/a?a=1&b=2'
```

* **Return type:**
  [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)

### keeptabs.util.is_safe_id(identifier)

Whether an identifier can be used as a store key (it becomes a file name).

Lowercase only, because some file systems do not tell `Feed` from `feed`.

```pycon
>>> [is_safe_id(i) for i in ('llama.cpp', 'gen-ai', '../../etc', 'a/b', '', 'Feed', 'con', 'abc.', 'x' * 101)]
[True, True, False, False, False, False, False, False, False]
```

* **Return type:**
  [`bool`](https://docs.python.org/3/builtins/functions.html#bool)

### keeptabs.util.isoformat(when)

The ISO 8601 form used in every stored record.

* **Return type:**
  [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)

### keeptabs.util.item_id(key)

A short, filesystem-safe, stable identifier for an item key.

```pycon
>>> item_id('https://example.com/a')
'2dce0a4c50441bfc'
```

* **Return type:**
  [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)

### keeptabs.util.parse_duration(duration)

Seconds in a duration such as `'30m'`, `'6h'`, `'1d'` or `'2w'`.

```pycon
>>> parse_duration('6h')
21600.0
>>> parse_duration(90)
90.0
```

* **Return type:**
  [`float`](https://docs.python.org/3/builtins/functions.html#float)

### keeptabs.util.rootdir(rootdir=None)

The directory that holds every spec and every watch’s data.

Resolution order: the argument, the `KEEPTABS_ROOTDIR` environment variable,
`$XDG_DATA_HOME/keeptabs`, then `~/.local/share/keeptabs`.

```pycon
>>> rootdir('/tmp/somewhere').name
'somewhere'
```

* **Return type:**
  [`Path`](https://docs.python.org/3/library/pathlib.html#pathlib.Path)

### keeptabs.util.slug(text)

A kebab-case identifier.

```pycon
>>> slug('Music AI (real-time)')
'music-ai-real-time'
```

* **Return type:**
  [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)

### keeptabs.util.timestamp_key(when)

A sortable store key for a moment, in UTC.

```pycon
>>> timestamp_key('2026-01-02T03:04:05+01:00')
'20260102t020405z'
```

* **Return type:**
  [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)

### keeptabs.util.to_datetime(when, , now=None)

A timezone-aware datetime from a datetime, an ISO string, or a duration ago.

```pycon
>>> to_datetime('2026-01-02T03:04:05+00:00').isoformat()
'2026-01-02T03:04:05+00:00'
>>> base = to_datetime('2026-01-08')
>>> to_datetime('7d', now=base).isoformat()
'2026-01-01T00:00:00+00:00'
```

* **Return type:**
  [`datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime)

### keeptabs.util.utcnow()

The current time, timezone-aware, in UTC.

* **Return type:**
  [`datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime)


# about-this-build.html.md

<!-- generated by epythet -->

# About this build

This documentation was built on **2026-11-21 18:08 UTC** from commit <a href="https://github.com/thorwhalen/keeptabs/commit/04fe7d59f77649226a3ceef4a2f38915c661523a"><code>04fe7d5</code></a> on branch <code>main</code>, for **keeptabs 0.0.1** (from <code>pyproject.toml</code>).

#### WARNING
The documentation and the package may be misaligned:

- The documented version (0.0.1) is behind the latest release on PyPI (0.0.2): `pip install keeptabs` gives newer code than these docs describe.

## Source

|                     |                                                                                                                                                            |
|---------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Commit              | <a href="https://github.com/thorwhalen/keeptabs/commit/04fe7d59f77649226a3ceef4a2f38915c661523a"><code>04fe7d59f77649226a3ceef4a2f38915c661523a</code></a> |
| Branch              | <code>main</code>                                                                                                                                          |
| Tags at this commit | none                                                                                                                                                       |
| Working tree        | clean                                                                                                                                                      |
| Remote              | <code>https://github.com/thorwhalen/keeptabs</code>                                                                                                        |

## Continuous integration

|              |                                                                                            |
|--------------|--------------------------------------------------------------------------------------------|
| Repository   | <code>thorwhalen/keeptabs</code>                                                           |
| Run          | <a href="https://github.com/thorwhalen/keeptabs/actions/runs/44933746944">44933746944</a>  |
| Ref          | <code>refs/heads/main</code>                                                               |
| Event commit | <code>04fe7d59f77649226a3ceef4a2f38915c661523a</code> (in the history of the built commit) |

## Tools

|          |         |
|----------|---------|
| epythet  | 0.2.23  |
| Sphinx   | 9.1.1   |
| docutils | 0.22.4  |
| Python   | 3.12.16 |

## Configuration as resolved

|               |                                                                   |
|---------------|-------------------------------------------------------------------|
| theme         | <code>auto</code> (Sphinx theme <code>pydata_sphinx_theme</code>) |
| accent        | <code>#665900</code>                                              |
| api_generator | <code>autosummary</code>                                          |
| ignore        | <code>tests/</code>, <code>scrap/</code>, <code>examples/</code>  |
| agent_outputs | <code>true</code>                                                 |
| aggregates    | <code>md</code>                                                   |
| ai_artifacts  | <code>true</code>                                                 |

## Package on PyPI

Latest release: <a href="https://pypi.org/project/keeptabs/0.0.2/">0.0.2</a>, newer than the documented version (0.0.1).

## Reproduce

```bash
git clone https://github.com/thorwhalen/keeptabs && cd keeptabs
git checkout 04fe7d59f77649226a3ceef4a2f38915c661523a
pip install "epythet==0.2.23"
epythet quickstart . --ignore tests/ scrap/ examples/
```

The same data, for machines: <a href="build_info.json"><code>build_info.json</code></a> (schema version 1).


# ai-agents.html.md

<!-- generated by epythet -->

# For AI agents

`keeptabs` ships artifacts for coding agents alongside its code. This page lists
them, says where each lives in the repository, and points at the
machine-readable copies of this documentation.

## Skills

Skills are folders holding a `SKILL.md` (the [Agent Skills](https://agentskills.io) format): a description that tells an agent when to use it and a body with the procedure. Install one into your agent with `gh skill` (any host: `--agent claude-code`, `copilot`, `cursor`, `codex`, `gemini`), or use the copy bundled in the wheel.

### `keeptabs-ask`

Answer questions from what a technology watch has collected, using the keeptabs command and its stores. Use when the user asks “what’s new in <topic>”, “anything new on <thing>”, “what happened this week in”, “catch me up on”, “what do we know about <model/library/company>”, “when was X released”, “is my watch working”, or asks for a digest or newsletter of a tracked subject.

```bash
gh skill install thorwhalen/keeptabs keeptabs-ask --agent claude-code
```

Source: [`keeptabs/data/skills/keeptabs-ask`](https://github.com/thorwhalen/keeptabs/tree/HEAD/keeptabs/data/skills/keeptabs-ask) (bundled with the pip package).

### `keeptabs-spec`

Create, refine and maintain a technology-watch specification with the keeptabs command. Use when the user wants to follow, track, monitor or stay up to date on a subject, technology, field or competitor; says “keep tabs on”, “veille”, “tech watch”, “technology watch”, “horizon scanning”, “keep me posted on”, “track this topic”, “add this newsletter/feed/repo to my watch”; or wants to change what a watch covers, how often it runs, or where its digests go.

```bash
gh skill install thorwhalen/keeptabs keeptabs-spec --agent claude-code
```

Source: [`keeptabs/data/skills/keeptabs-spec`](https://github.com/thorwhalen/keeptabs/tree/HEAD/keeptabs/data/skills/keeptabs-spec) (bundled with the pip package).

### `keeptabs-dev-architecture`

The architecture of the keeptabs package, for the agent developing it - the five seams and their defaults, the module map, the one-command test, what is deliberately not built, and the research synthesis and prior art behind the design. Use before changing the shape of keeptabs, adding a module, adding a surface (MCP, HTTP), adding a dependency, or when asking “why is it built this way” or “what did the research recommend”.

```bash
gh skill install thorwhalen/keeptabs keeptabs-dev-architecture --agent claude-code
```

Source: [`skills/keeptabs-dev-architecture`](https://github.com/thorwhalen/keeptabs/tree/HEAD/skills/keeptabs-dev-architecture).

### `keeptabs-dev-matching`

How relevance scoring, deduplication and entity matching work in the keeptabs package, and the researched ways to strengthen them - URL canonicalisation, near-duplicate detection, embeddings, entity resolution, novelty scoring, story clustering. Use when a watch is too noisy or misses items, when the same story is stored twice, when changing keyword_matcher or canonical_url, or when adding an embedding or model-based matcher.

```bash
gh skill install thorwhalen/keeptabs keeptabs-dev-matching --agent claude-code
```

Source: [`skills/keeptabs-dev-matching`](https://github.com/thorwhalen/keeptabs/tree/HEAD/skills/keeptabs-dev-matching).

### `keeptabs-dev-scheduling-digests`

How the scheduled run and the digests work in the keeptabs package, and the researched options behind them - due-ness from stored state, backoff, locking, launchd, cron and systemd, digest structure, model-written summaries with grounded citations, and delivery by email, Slack and GitHub Discussions. Use when changing tick, cadence or backoff, adding a scheduler installer, adding a delivery channel, adding a model-based summarizer, or debugging a digest that did not arrive.

```bash
gh skill install thorwhalen/keeptabs keeptabs-dev-scheduling-digests --agent claude-code
```

Source: [`skills/keeptabs-dev-scheduling-digests`](https://github.com/thorwhalen/keeptabs/tree/HEAD/skills/keeptabs-dev-scheduling-digests).

### `keeptabs-dev-sources`

How to add or change a source kind in the keeptabs package - the fetcher contract, conditional requests, cursors, the offline test fixture, and the researched options for feeds, full-text extraction, newsletters by email, research and code APIs, and web search. Use when adding a fetcher (Hugging Face, Reddit, OpenAlex, a search API, a browser), changing how newsletters are read, debugging a source that fails or returns nothing, or choosing a library for ingestion.

```bash
gh skill install thorwhalen/keeptabs keeptabs-dev-sources --agent claude-code
```

Source: [`skills/keeptabs-dev-sources`](https://github.com/thorwhalen/keeptabs/tree/HEAD/skills/keeptabs-dev-sources).

The bundled skills are also on disk after `pip install keeptabs`, under the package’s `data/skills/` directory; link them into an agent without network access with `skill link-skills <that directory>`.

## Instruction files

Files agents read before working in this repository.

- [`.claude/CLAUDE.md`](https://github.com/thorwhalen/keeptabs/tree/HEAD/.claude/CLAUDE.md): read by Claude Code

## Machine-readable documentation

This site publishes the same documentation in forms that fit an agent’s context window:

- [`llms.txt`](https://thorwhalen.github.io/keeptabs/llms.txt): an index of every page with a one-line description ([llms.txt](https://llmstxt.org) format)
- [`keeptabs.md`](https://thorwhalen.github.io/keeptabs/keeptabs.md): the whole documentation as one Markdown file
- `<page>.html.md`: a rendered Markdown twin of every page, advertised from each page’s `<head>` with `<link rel="alternate" type="text/markdown">`
- [`objects.inv`](https://thorwhalen.github.io/keeptabs/objects.inv): the Sphinx inventory: a symbol-to-URL index (`sphobjinv convert plain objects.inv -`)


# api.html.md

# API reference

| [`keeptabs`](_autosummary/keeptabs.html.md#module-keeptabs)   | Keep tabs on the subjects you care about (technology watch; in French, "veille").   |
|-----------------------------------------------------------------------------|-------------------------------------------------------------------------------------|


