Skip to main content

nibs

Read a web page by its headings: list them, then print only the section you need.

An AI agent that reads a whole documentation page to answer one question puts tens of thousands of characters into its context, most of which it never uses. nibs lets it look at the page's headings first and then take just one section, in the page's own words.

$ nibs toc https://docs.python.org/3/library/argparse.html
82,019 chars, 57 headings
  1.     Navigation  (254)
  2. argparse — Parser for command-line options, arguments and subcommands¶  (81,665)
  3.   ArgumentParser objects¶  (19,217)
  4.     prog¶  (1,483)
  5.     usage¶  (893)
  ...
$ nibs find https://docs.python.org/3/library/argparse.html allow_abbrev --limit 2
## ArgumentParser objects¶
  class argparse.ArgumentParser(prog=None, usage=None, description=None, epilog=None, ...
  allow_abbrev - Allows long options to be abbreviated if the abbreviation is unambiguous (default: True)
[nibs: stopped at 2 matches; pass --limit]
$ nibs section https://docs.python.org/3/library/argparse.html 4

Install

pipx install nibs      # or: uv tool install nibs

Python 3.11 or later. No other dependencies.

Commands

nibs toc <url>                  # headings, numbered, with each section's size in characters
nibs section <url> <n|heading>  # one section, by its number in toc or by heading text
nibs find <url> <regex>         # matching lines, each under the heading it belongs to
nibs stats                      # characters printed so far, against reading each page whole
  • section prints at most 8,000 characters; --max changes that. A heading given as text matches exactly first, then as a case-insensitive substring.
  • find prints at most 30 lines; --limit changes that.

How a page is read

  • Only http and https URLs are read, also when a page redirects.
  • If the site serves Markdown, either at the URL itself or at the URL with .md added, nibs uses it. Many documentation sites do.
  • Otherwise nibs turns the HTML into headings, text and code blocks (from <pre>). It leaves out scripts, styles, navigation, sidebars, and the page's own header and footer; a header or footer inside an article is kept. A left-out element ends at its closing tag, or at the closing tag of an element around it: when a page leaves one unclosed, the text after it is kept. Text can get through the same way when a closing tag appears inside a left-out element that it does not belong to. Inside <pre>, only scripts, styles, <noscript> and <svg> are left out. Only heading tags become headings, and only <pre> becomes a code block: a line of text that would read as either (see below) gets a backslash in front.
  • Control characters in the page are removed before printing.
  • nibs does not run JavaScript. A page that builds its content in the browser comes back with little or no text; when no headings are found, nibs says so.
  • A fetched page is kept for 15 minutes in ~/.cache/nibs (or $XDG_CACHE_HOME/nibs), so toc, section and find on the same page fetch it once.

Headings and code blocks

nibs splits a page by its Markdown headings. It reads only what it needs for that, by this rule rather than all of CommonMark:

  • A heading is a line that starts with 1 to 6 # and a space.
  • A line that starts with three or more ` or ~ opens a code block, after any spaces. The block ends at a line of the same character, at least as long, with nothing after it. Headings inside a code block are not headings.
  • Nothing else is read as structure: not headings underlined with === or ---, not code indented by four spaces.

Using it from an agent

Tell the agent in its instructions, for example in CLAUDE.md or AGENTS.md:

To read documentation on the web, run `nibs toc <url>` to see the headings,
then `nibs section <url> <n>` for the part you need, or `nibs find <url> <regex>`.

The usage record

Each run adds one line to ~/.local/state/nibs/usage.jsonl (or $XDG_STATE_HOME/nibs/usage.jsonl): the time, the command, the URL, the page's size, how many characters were printed, how many headings the page has, and how it was read (md for the URL with .md added, html for HTML turned into text, text for any other answer, used as it came). nibs stats reads it. Set NIBS_LOG to another path to keep the record there. Nothing is sent anywhere.

License

MIT

Metadata

Release files for nibs 0.2.1

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

Source distribution (sdist)

Source distribution for nibs 0.2.1
File Size Uploaded Provenance Actions
nibs-0.2.1.tar.gz 20.2 kB With provenance Details for nibs-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nibs 0.2.1
File Interpreter ABI Platform Actions
nibs-0.2.1-py3-none-any.whl Python 3 none any Details for nibs-0.2.1-py3-none-any.whl

Total release size: 32.9 kB

Release files / nibs-0.2.1.tar.gz

Download URL nibs-0.2.1.tar.gz
Size 20.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d10c36c9e5d71d7243244727b565e87f39a8ebf9aef55fc8fd6bef6d49615670
BLAKE2b-256 checksum
How to use checksums
73c4ec0e18b2fc4c59a3d18c8ce82a240358b44c46c5bece8948fbc664b4deae
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 7, 2026.

Transparency log

Release files / nibs-0.2.1-py3-none-any.whl

Download URL nibs-0.2.1-py3-none-any.whl
Size 12.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9e1e36d53d85e769392c7fb1937b794a80a399d0cee06506b50c1388dd65e0b1
BLAKE2b-256 checksum
How to use checksums
ab8a9ed1c4a73b10be9e1ea4f7ed5b3c544ac7885c3342a83ce30ef2f3059537
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 7, 2026.

Transparency log

Security for nibs 0.2.1

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 nibs-0.2.1.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 7, 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.

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