tokensaver

Configuration

Environment variable
TOKENSAVER_MAX_CHARSDefault page size (default 20000)
TOKENSAVER_CHROMEPath to a Chrome/Chromium-family browser
TOKENSAVER_LOGdebug, info (default) or warn; logs go to stderr — one line per tool call with sizes and timings
TOKENSAVER_TELEMETRY1 to opt in to anonymous usage telemetry (default off — nothing is sent)
TOKENSAVER_TELEMETRY_ENDPOINTCollector URL; telemetry stays off (silently) if this is unset, since this repo runs no collector of its own

Freshness

A plain read/read_json always fetches the URL again (the page or API you are developing may have just changed). Follow-up calls — page=2, section=, outline= — reuse the result for up to 10 minutes, in memory only, so page numbers stay stable and big PDFs aren't re-parsed. Local files are re-read whenever they change.

Telemetry

Off by default, and off unless both telemetry variables above are set. When enabled, each read/read_json call reports which tool ran, a coarse source kind (html, pdf, …, json, dir), success or a closed-set error category, duration and output size — never a URL, file path, error text, or document content — tagged with a random install ID stored under your OS config dir (not derived from your machine or username). Sending is async and never delays a tool call; a slow or unreachable collector just drops the events.

Next: Security notes.