# Knotkit > Knotkit is a zero-dependency ESM TypeScript library of data structures, algorithms, probability distributions, and SciPy-checked statistical tests. Import the module you need from `knotkit/`. Structures come from factories, interchangeable layouts carry a serializable `kind`, and package errors carry documented codes. Constrained values are constructed once at the boundary, as `Probability.make(0.95)` does, and random sources, hashes, orderings, and clocks are arguments to the operations that require them. ## How to read these docs - `/modules/.md` is one module's page: a usage example, what it solves and does not, each layout and the rule for choosing it, every export with its cost, its error codes, and how to save and load it. - `/choosing.md` lists every task the modules solve, each linked to its module. - `/conventions.md` covers what every module shares: factories, `kind`, error codes, injected randomness, and `/wire` serialization. - `/reference/` holds every type and signature. `llms-small.txt` leaves it out. - The installed package carries the same facts offline: `node_modules/knotkit/capabilities.json` and `node_modules/knotkit//README.md`. ## Package facts - [Build and install from source](https://knotkit.jkomyno.dev/getting-started.md#install-from-source). Knotkit uses ESM and runs in browsers, Node.js 22.12+, and Bun. Use TypeScript 5.x or later with `moduleResolution` set to `bundler` or `nodenext`. - Import one module at a time from `knotkit/`. There is no root entrypoint. - Create structures with factory functions, choose layouts by `kind`, branch on `error.code`, and pass seeds, hashes, and orderings explicitly. ## Documentation Sets - [Abridged documentation](https://knotkit.jkomyno.dev/llms-small.txt): a compact version of the documentation for Knotkit, with non-essential content removed - [Complete documentation](https://knotkit.jkomyno.dev/llms-full.txt): the full documentation for Knotkit - [Collections](https://knotkit.jkomyno.dev/_llms-txt/collections.txt): module pages for knotkit/bitset, knotkit/cache, knotkit/deque, knotkit/disjoint-set, knotkit/frequency-table, knotkit/heap, knotkit/interval-index, knotkit/ordered-map, knotkit/rate-limit, knotkit/snapshot-set, knotkit/sorted-block, knotkit/sorted-merge - [Search and text](https://knotkit.jkomyno.dev/_llms-txt/search-and-text.txt): module pages for knotkit/inverted-index, knotkit/prefix-index, knotkit/term-index, knotkit/trie - [Graphs and optimization](https://knotkit.jkomyno.dev/_llms-txt/graphs-and-optimization.txt): module pages for knotkit/combinatorics, knotkit/e-graph, knotkit/evolution, knotkit/graph - [Randomness and statistics](https://knotkit.jkomyno.dev/_llms-txt/randomness-and-statistics.txt): module pages for knotkit/distance, knotkit/distribution, knotkit/hypothesis-test, knotkit/prng, knotkit/sampling, knotkit/scalar-sketch, knotkit/static-filter - [Serialization and utilities](https://knotkit.jkomyno.dev/_llms-txt/serialization-and-utilities.txt): module pages for knotkit/cas, knotkit/errors, knotkit/hash, knotkit/key-encoding, knotkit/wire ## Notes - The complete documentation includes all content from the official documentation - The content is automatically generated from the same source as the official documentation ## Optional - [Capability index (JSON)](https://github.com/jkomyno/knotkit/blob/main/packages/capabilities.json): what every module solves, its exports, and its layout rules - [Recorded benchmark timings (JSON)](https://github.com/jkomyno/knotkit/blob/main/evidence/benchmarks/results.json): the raw per-repeat timings behind every measured claim - [knotkit-select skill](https://github.com/jkomyno/knotkit/tree/main/skills/knotkit-select): a skill that picks the module and layout for a task