okf stats
The bundle's shape at a glance.
When to use it
- First contact with an unknown bundle: is this 10 concepts or 400? The answer decides whether you read it whole or go through
okf indexprogressively. - To watch a bundle's shape over time: cross-links growing faster than concepts means densification, the reverse means sprawl.
- As the cheapest health snapshot before deciding whether a
okf lintpass is due.
How it works
stats prints the bundle rollups: concept, directory, concept-type, cross-link, and distinct-tag totals, plus per-type and per-directory breakdowns ordered by count. The human breakdown reads By dir, keyed by the whole directory path. It reproduces the browser server's Stats panel on the CLI, derived from the same data source as the other read views. It is an advisory read, always exit 0, and takes no filters: the whole bundle, one screen.
Try it
okf stats docs/
Stats - docs
concepts 37
dirs 6
concept types 5
cross-links 87
distinct tags 24
By type
Feature 14
Model 8
Guide 6
Decision 5
Concept 4
By dir
features 18
models 8
guides 4
decisions 3
ops 2
(root) 2
For a machine, okf stats docs/ --json emits { bundle, concepts, top_dirs, dirs, concept_types, cross_links, distinct_tags, by_type, by_top_dir, by_dir } as compact single-line JSON: top_dirs / by_top_dir are the first-segment rollup (the field renamed from area in 1.12.0), and dirs / by_dir are the full-path cut.
Pitfalls
- There are no filters here.
statssizes the whole bundle; for a per-directory or per-tag question, useokf catalog,okf tags, orokf typeswith their filters. - The counts cover concepts that parse. A file with invalid frontmatter is skipped and noted on stderr, so the totals can undercount a broken bundle. Run
okf validateto find the files the numbers left out. - Reserved files are not concepts.
index.mdandlog.mdnever appear in theconceptscount; if the total looks low next tols | wc -l, that gap is by design.