Skip to main content

Gleam

PyPI

Gleam is Debian QA evidence-investigation infrastructure. It collects verifiable facts about Debian packages, keeps every observation in an append-only evidence store, and runs bounded, tool-calling investigations driven by a local model on top of that store. Upstream archaeology, tracing where an orphaned Debian package's development went, is the first built-in workflow. The report it produces is a proposal for human review: nothing is confirmed automatically and no action is ever executed.

Quick start

The CLI has eight modules: udd, bts, repology, check, investigate, searxng, help, and version. Install the Python dependencies (trafilatura for HTML body text, markdown-it-py for README markdown, verbatimeter for quote verification, pg8000 for the UDD database connection; everything else is the standard library), then try the offline commands:

cd /path/to/gleam
uv venv .venv && uv pip install -r requirements.txt    # or: uv sync

python -m gleam help                    # one-page overview of all eight modules
python -m gleam help investigate        # one module's self-contained help
python -m gleam version                 # print the gleam version
python -m gleam udd --list-datasets     # the 18-dataset catalog, no database contact
python -m gleam check --store runs      # validate an evidence store (read-only)

Examples that need a live backend (documented here, but they will not run offline):

# Requires network (queries the public UDD mirror)
python -m gleam udd --package wizznic --dataset sources --json
# Requires network (fetches a bug's discussion from bugs.debian.org)
python -m gleam bts --bug-id 1000000 --json
# Requires network (queries the Repology cross-distro version tracker)
python -m gleam repology --project ncdu --json
# Requires a local model endpoint and network (see docs/configuration.md)
python -m gleam investigate --package wizznic --store runs \
    --model my-model --model-base http://127.0.0.1:8000/v1

investigate rejects startup without a model name and endpoint (exit 2) before it creates any run directory.

The eight modules

udd

Query live package facts from the public read-only UDD mirror (postgresql://udd-mirror.debian.net/udd) through the built-in pg8000 driver, a pure-Python PostgreSQL wire-protocol client with no native library and no external database tools, running a fixed read-only template set per dataset. Runs are read-only and write nothing to disk.

Flags: --package NAME, --dataset NAME (repeatable), --release NAME, --limit N (1..50 per dataset), --dsn URL, --timeout SECONDS (query deadline: socket deadline plus a per-statement budget), --list-datasets, --json, --verbose, --env-file PATH.

Two modes. --list-datasets prints the 18-dataset catalog without touching the database. Query mode requires --package and at least one --dataset; the UDD data appears only then. An honest empty result (zero rows) is a success, truncation is reported as partial, and failures are reported as failures, never masked.

bts

Fetch one Debian BTS bug's complete public discussion. Flags: --bug-id ID (1..9999999, no leading zeros), --source auto|soap|mbox (default auto), --json, --verbose, --env-file PATH. The default path uses the documented SOAP machine interface first and falls back to the official mbox view only on transport-class errors and only when robots.txt explicitly allows it. Rate limits, unknown bugs, and budget exhaustion never fall back, and there is no bypass switch.

repology

Query the Repology cross-distro version tracker (default base https://repology.org) through the public fetcher safety layer (SSRF guards, DNS pinning, byte caps, timeouts, request budget). Flags: --project SLUG (version ladder for one project) or --search QUERY (resolve a name to project slugs; exactly one of the two is required, otherwise exit 2), --json, --verbose, --env-file PATH, plus the policy flags --repology-base, --repology-max-requests (default 6), --repology-min-interval (default 1.1s; the API terms require <=1 req/s), --repology-timeout (default 15s). HTTP 200 with an empty entry list is the honest "no such project" answer; failures are failures (unknown), never "no results". The client carries a tool-intrinsic robots.txt exemption for the host of its configured base: Repology's own API terms authorize programmatic access on that surface, so the tool is the specific permission; manual fetch_url visits of the same host stay governed by the operator exemption file. Read-only: never writes to disk.

check

Validate an evidence store for structural integrity. Flags: --store DIR (default runs), --run DIR, --json, --verbose, --env-file PATH. --store takes the store root, the directory whose children are run directories: a single run's own directory, or a directory that holds no runs, is rejected as a usage error (exit 2) instead of being misread as a store full of broken runs. --run DIR validates exactly one run directory instead (it must carry run.json or the run's evidence directories; a configured non-default --store cannot be combined with it). The scan is strictly read-only: nothing under the store is created, modified, or removed, and there is no repair function. An empty or missing store is a valid store with zero counts.

investigate

Run a bounded, tool-calling investigation of one package with a local model over an OpenAI-compatible endpoint. The model sees the investigation tools (fetch_url, search_web, github, fetch_bug, fetch_udd, read_evidence, repology, inspect_report_state, validate_report_draft, and finish_investigation), results come back by tool_call_id, and every tool executes serially through the same safety layer. There is zero prefetch: no UDD query runs before the loop starts, and the package name is only policy-validated. The final report is anti-forgery checked against the evidence actually exposed to the model: candidate URLs must come from cited observations, quotes must be verbatim substrings of returned text, GitHub repositories observed in search results or fetched-page links must be covered by a github call or a repository-page fetch before the report is accepted. The model can inspect that ledger and repeatedly validate revised drafts before final submission.

Flags, grouped:

  • Inherited query fields (same meaning as udd): --package, --dataset, --release, --limit, --dsn, --timeout.
  • Endpoints: --model NAME (required), --model-base URL (required), --model-api-key KEY (optional bearer token; unset = unauthenticated), --search-base URL (default http://127.0.0.1:8888), --github-api-base URL (default https://api.github.com), --repology-base URL (default https://repology.org), --store DIR (default runs).
  • Model policy: --model-max-tokens (default 8192, cap 65536), --model-timeout (default 120s, cap 600s), --search-timeout (default 10s, cap 60s).
  • Budgets: --max-rounds (default 48, cap 64), --max-tool-calls (default 48, cap 512; finish_investigation is never counted), --max-http-requests (default 52, one shared budget for fetch, robots, search reservations, BTS requests, GitHub client usage, and Repology requests), --max-body-chars (default 40000), --max-links (default 120), --max-context-chars (default 320000; overflow halves the longest tool results inside a legal JSON envelope with double disclosure), --udd-max-calls (default 6, cap 50), --udd-max-rows (default 200, cap 2000), --repology-max-requests (default 6, per-run cap), --repology-min-interval (default 1.1s; API terms require <=1 req/s), --repology-timeout (default 15s), --max-report-repairs (default 2).
  • Fetch policy: --fetch-max-bytes (default 300000), --fetch-timeout (default 15s), --fetch-max-redirects (default 3), --fetch-min-interval (default 1s per host), --robots-exempt-file (default robots-exempt.txt relative to the working directory; the operator-owned robots.txt exemption hostname list, GLEAM_ROBOTS_EXEMPT_FILE).
  • Tool toggles: --no-search-web, --no-github, --no-bts, --no-udd (fetching stays disabled, the dataset catalog stays available), --no-repology.
  • Output: --json, --verbose, --env-file PATH.

searxng

Manage the self-hosted SearXNG instance behind the search_web tool: one guarded, loopback-bound Docker deployment, addressed by exactly one action per invocation (--start, --stop, or --validate; any other combination is a usage error, exit 2). The only requirement is a working Docker CLI with daemon access, and only when search_web is used.

Flags: --image REF (default searxng/searxng:latest), --name NAME (default gleam-searxng), --port N (default 8888, 1..65535), --bind ADDRESS (default 127.0.0.1), --pull (force an image update before bring-up), --search-base URL (default http://127.0.0.1:8888; the same trusted base investigate uses, GLEAM_SEARCH_BASE), --json, --verbose, --env-file PATH. The module adds no .env key of its own and never writes a file anywhere.

Action Semantics
--validate Side-effect-free end-to-end probe: docker availability, the gleam-named container, its healthz endpoint, and one real search query through the same client investigate uses. PASS exits 0; FAIL and BLOCKER exit 1. It never starts anything.
--start Pre-validates first: an already-valid deployment is reused as-is (exit 0, no bring-up at all). Otherwise it brings the configured image up, pulling only when the image is missing (--pull forces an update) and refusing any image or same-named container that does not verify as SearXNG, then must pass the same probe before it reports success.
--stop Stops and removes only the gleam-named container: an absent container is a success no-op, an unreachable docker daemon is a failure (never a silent no-op), and a present container is stopped gracefully then removed, never force-removed. Unrelated containers are untouched.

Deployment shape: the official docker.io/searxng/searxng image, bound to 127.0.0.1:8888 by default, no host networking, no privileged mode, no docker socket mounted. The shipped searxng-settings.yml (package data under src/gleam/data/, mounted read-only at bring-up) enables the JSON format and disables the limiter for local-only use; its loopback-only secret_key is a deliberate public constant, replaced only if you ever expose the service beyond loopback.

help

Print the overview (gleam help) or one module's self-contained documentation (gleam help MODULE). The module name is a positional argument, not a flag. There are no -h/--help/--version builtins anywhere in gleam: unknown flags, unknown targets, and stray arguments are usage errors (exit 2).

version

Print one version line. The single source of truth is pyproject.toml; the installed package metadata and the source-tree file always agree. Any argument at all is a usage error (exit 2).

Documentation

Metadata

Release files for debian-gleam 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for debian-gleam 0.1.0
File Size Uploaded Provenance Actions
debian_gleam-0.1.0.tar.gz 355.9 kB With provenance Details for debian_gleam-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for debian-gleam 0.1.0
File Interpreter ABI Platform Actions
debian_gleam-0.1.0-py3-none-any.whl Python 3 none any Details for debian_gleam-0.1.0-py3-none-any.whl

Total release size: 590.8 kB

Release files / debian_gleam-0.1.0.tar.gz

Download URL debian_gleam-0.1.0.tar.gz
Size 355.9 kB
Tags Source
SHA-256 checksum
How to use checksums
9ecc781cb83549b32dc38d3bb7389b7c7fa2d1bd225304eb0a53549219ccf6e2
BLAKE2b-256 checksum
How to use checksums
ff9de4d3e54fc47b9084f197a9abe685d18a2f1b534da2f3f8d638cd6029a65c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Release files / debian_gleam-0.1.0-py3-none-any.whl

Download URL debian_gleam-0.1.0-py3-none-any.whl
Size 234.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4d1de26c61d5ebd1192121f87a6b39d55da89e11d25ff515d7763b97f7d8be8c
BLAKE2b-256 checksum
How to use checksums
a70186f0783c3fede1a6f9d8071fb4052b180ab1b63079ba7329863194da1b14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Security for debian-gleam 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for debian_gleam-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page