Skip to content

Audit — October 2026

Measured on 3 October 2026 against commit 4d70394 (main after #200, version 0.5.0). Every number below comes from a command in the appendix; re-run them on a later commit before quoting them.

1. Summary

  1. The package is logbook/ (there is no src/ layout): 131 Python files, 57,227 lines, 20,331 of them in logbook/adapters/.
  2. logbook/cli.py is 5,709 lines, imports 61 package modules at module level, and import logbook.cli loads 77 of the package's 131 modules before any command runs.
  3. logbook --help lists 46 top-level commands in 119 lines.
  4. 66 modules sit under logbook/adapters/; the BUILT_IN tuple names 58; pyproject.toml registers 25 entry points, every one a duplicate of a BUILT_IN name.
  5. 31 profile strings appear in the package: 27 line profiles and 4 package manifests. 21 line profiles are read by a reader, rollup, derive or page; 6 are written and read by nothing but show or search; commitment/v1 and commitment-close/v1 are neither written nor read.
  6. RFC number 0025 names two different documents; RFC 0028 is one file under two names; 22 of the 27 RFCs in rfcs/ are not on the docs site, and the site build has 48 broken links.
  7. The README names 17 commands and 14 profiles; all exist. 28 of the 46 top-level commands are not named in the README.
  8. The suite collects 2,853 tests in 141 files (50,594 lines); 7 are stress, 7 slow; 21 Hypothesis properties; 587 readouterr() calls; 8 whole-output equality assertions; 22 monkeypatches of underscore-prefixed names.
  9. No test loads a model: judge, describe, transcribe and promises --judge are tested through an injected importer and a FakeEngine.
  10. The runtime dependency is ijson (5 adapter modules) plus tzdata on Windows; encrypted and share are the same extra; judge and describe install nothing off Apple silicon.

2. Size and shape

2.1 The package

Measure Value
Python files under logbook/ 131 (63 outside adapters/, 68 inside)
Lines, all .py under logbook/ 57,227
Lines under logbook/adapters/ 20,331
Lines in logbook/cli.py 5,709
.py files under tests/ 149 (141 test_*.py, 8 helpers)
Lines under tests/ 50,594
Pages under docs/ 78 .md entries, 17 of them symlinks to root files or rfcs/

The ten largest files:

Lines File
5,709 logbook/cli.py
1,528 logbook/demo.py
1,168 logbook/demo_life.py
1,061 logbook/vault.py
1,005 logbook/rollup.py
974 logbook/stays.py
945 logbook/flights.py
941 logbook/promises.py
912 logbook/day.py
866 logbook/print_page.py

2.2 cli.py

  • 33 module-level import statements; 0 function-level imports.
  • 61 package modules imported directly: 54 siblings through one from . import (...), plus .adapters, .adapters.takeout, .chain, .export, .index, .resolve, .store.
  • import logbook.cli loads 218 modules not loaded before it, 77 of them logbook.* (the 61 above and their imports, among them 14 adapter modules), before argument parsing.
  • import logbook alone loads one module: logbook/__init__.py holds __version__ and FORMAT and nothing else.
  • 68 add_parser calls build the tree: 46 top-level commands, and the parser reports 23 verbs under 11 of them (assets, attach, circle, inbox, people, places, promises, questions, repair, share, tasks); derive, import, rollup take a positional with fixed choices; add, backup, describe, export, infer, transcribe dispatch on a free positional inside their handler.

2.3 Commands

logbook --help is 119 lines and lists 46 top-level commands:

init add sync import-backup inbox attach infer transcribe describe retract
search show people person day digest questions days year trip stats derive
places rollup trips ledger keepers promises tasks serve mcp demo index verify
setup doctor export import sources assets repair share receive circle migrate backup

2.4 Adapters

Measure Value
Modules under logbook/adapters/ (without __init__.py) 66
Names in adapters.BUILT_IN 58
Entry points in [project.entry-points."logbook.adapters"] 25
Adapters all_adapters() returns 58 (49 file adapters, 9 live)

On disk but not in BUILT_IN (8): health_export, keyed_archive, myfitnesspal_export, phone, takeout.places, takeout.times, withings_export are helpers with no run; takeout.calendar defines NAME, sniff and run and is reachable only because ics sniffs the same files (its docstring says so).

In BUILT_IN but not an entry point (33): adsb ais apple_reminders apple_wallet beeper copilot dawarich dawarich_live easypark gcal imessage_live immich ios_calls line passages splitwise takeout.access_log takeout.activity takeout.chat takeout.chrome takeout.contacts takeout.home takeout.keep takeout.location takeout.maps takeout.meet takeout.pay takeout.photos takeout.tasks takeout.youtube twitter weather wispr_flow.

Entry points not in BUILT_IN: none. Every entry point names a module BUILT_IN already imports; all_adapters() loads each of those 25 twice and drops the second by (kind, NAME).

2.5 Profiles

31 distinct name/vN strings appear in logbook/. Four are package manifests, not line profiles: crossing-package/v1 (crossing.py), day-package/v1 (export.py), trip-bundle/v1 (trip_bundle.py), shared-page/v1 (share.py). The other 27 are written as payload.schema of a line.

Written, by whom (27 line profiles):

Profile Written by
browse/v1 pocket, safari, takeout.activity, takeout.chrome, demo
call/v1 ios_calls, takeout.meet, demo
crossing/v1 crossing.py (every export crossing, export vault, export trip-bundle, share)
event/v1 apple_wallet, ics, ios_calendar, screentime (kind app-use), takeout.access_log, takeout.home, takeout.pay, demo
flight/v1 flights.py (add flight, infer flights)
health-sample/v1 apple_health, myfitnesspal, myfitnesspal_export, withings, withings_export, demo
highlight/v1 apple_books, takeout.maps, demo
keeper/v1 keepers.py (infer keepers)
listen/v1 apple_music, apple_podcasts, shazam, spotify, demo
location/v1 adsb, ais, dawarich, passages, takeout.location, demo
mail/v1 mail, demo
message/v1 beeper, imessage, line, takeout.chat, twitter, whatsapp, demo
migration/v1 store.py (migrate)
note/v1 granola, ios_notes, takeout.keep, cli.py (add a sentence), describe.py, mcp_server.py, setup.py, demo
photo/v1 apple_photos, immich, takeout.photos, demo
received/v1 trip_bundle.py (import trip-bundle)
resolution/v1 ios_contacts, takeout.contacts, whatsapp_contacts, people_merge.py, demo
retraction/v1 store.py (retract), repair.py
story/v1 story.py (add story)
task/v1 apple_reminders, takeout.tasks, promises.py, taskdone.py, demo
transaction/v1 copilot, splitwise, takeout.pay, ledger.py, demo
transcript/v1 transcript, wispr_flow, story.py, demo
trip/v1 easypark, passages, sbb, demo
trip-share/v1 trip_bundle.py (export trip-bundle writes trip.json; import trip-bundle appends it as a page line)
voice-memo/v1 voice_memos, demo
watch/v1 takeout.youtube, demo
weather/v1 weather.py (sync weather)

Read, by whom. A profile counts as read when a module other than the show renderer in cli.py and the search index selects lines of its kind and builds something from them (a Day, a rollup, a derived line, a page). 21 line profiles qualify:

Profile Read by
call/v1 day.py; stays.EVIDENCE
event/v1 day.py, digest.py, flights.py, people.py, rollup.py (attention, kind app-use); stays.EVIDENCE
flight/v1 trips.py, rollup.py (flights), trip_bundle.py
health-sample/v1 health.py, rollup.py, day.py, days.py, year.py, print_page.py, trip_page.py, repair.py
keeper/v1 day.py, describe.py, print_page.py, trip_page.py, year.py
listen/v1 listen_rollup.py (rollup listen)
location/v1 reading.py and stays.py through Index.locations, flights.py
mail/v1 day.py, taskdone.py
message/v1 day.py; stays.EVIDENCE
note/v1 day.py, people.py, promises.py, setup.py; stays.EVIDENCE
photo/v1 day.py, people.py, pages.py, keepers.py, print_page.py, trip_bundle.py
received/v1 trip_bundle.shares, called by trip_page.py
resolution/v1 people.py, people_merge.py, resolve.py, crossing.py, digest.py, promises.py, questions.py, reading.py
retraction/v1 every reader, through Index.retractions
story/v1 day.py, days.py
task/v1 promises.py, taskdone.py
transaction/v1 ledger.py (rollup money), taskdone.py, trip_page.py
transcript/v1 day.py, people.py, promises.py, story.py; stays.EVIDENCE
trip-share/v1 trip_bundle.shares, called by trip_page.py
voice-memo/v1 transcribe.py
weather/v1 trips.py, year.py

Written but never read (6 line profiles): browse/v1, watch/v1, trip/v1, highlight/v1, crossing/v1, migration/v1. The first four are rendered by show and indexed by search; crossing/v1 is rendered by show only; migration/v1 is appended by migrate and read by nothing. Counting the 4 package manifests with them makes 10.

Neither written nor read (2): commitment/v1 and commitment-close/v1. They appear in rfcs/0007-commitment-v1.md, in the tier table of SPEC.md (§4) and in docs/promises.md; no string commitment occurs in logbook/.

2.6 RFCs

Measure Value
Numbered RFC files in rfcs/ 27 (0001–0026, 0028; no 0027)
Entries in docs/rfcs/ 8: 5 symlinks into rfcs/, 3 regular files
Regular files only in docs/rfcs/ 0027-reflection.md, rfc-0025-shared-page-bundle.md, bench-encryption-2026-10.md
Numbers that name two different documents 1: 0025 (rfcs/0025-trip-bundle-v1.md, trip-bundle/v1; docs/rfcs/rfc-0025-shared-page-bundle.md, shared-page/v1)
Files reachable under two names 1: docs/rfcs/0028-story.md is a symlink to rfcs/0028-story-v1.md
RFCs in rfcs/ absent from the docs site 22 (0003–0025 except as above)

mkdocs.yml lists 7 RFC pages. rfcs/README.md links to all 27 plus the two under docs/rfcs/; built as a site page, 26 of its links point outside the site.

2.7 Tests

Measure Value
Collected 2,853 (pytest --collect-only)
Deselected by -m "not stress" 7
def test_ definitions 2,401 (parametrization makes up the rest)
@pytest.mark.slow 7, in test_fuzz_readers.py, test_stress.py, test_year.py
@pytest.mark.stress 7, all in test_stress.py
Files importing Hypothesis 16; @given properties: 21
readouterr() calls 587
Substring assertions on captured output (assert ... in out) 862
Whole-output equality: == """ 0
Whole-output equality: .output == 0
Whole-output equality: .stdout == 6
Whole-output equality: out == "..." 2
monkeypatch.setattr(<module>, "_name", ...) 22
Files running the CLI through subprocess.run 26

Wall clock. time uv run pytest --durations=15 -q -m "not stress" -p no:cacheprovider, one worker (the addopts in pyproject.toml add --dist loadfile, which is inert without -n), on this run's Linux container:

Measure Value
Wall clock 13 min 12 s (real 13m12.158s, user 12m24.013s)
Outcomes 2,839 passed, 7 skipped (slow, LOGBOOK_SLOW unset), 7 deselected (stress)
Exit code 0

The fifteen slowest phases:

Seconds Phase Test
447.51 call tests/test_demo_years.py::test_the_long_trips
14.70 setup tests/test_demo_years.py::test_the_life_verifies_and_holds_every_profile
9.46 call tests/test_demo_years.py::test_nothing_in_it_is_real
8.54 call tests/test_demo_years.py::test_the_life_verifies_and_holds_every_profile
3.48 call tests/test_dawarich_live.py::test_any_page_yields_only_lines_valid_against_the_schema_and_rfc_0001
2.58 call tests/test_show.py::test_show_piped_into_head_exits_0_with_nothing_on_stderr
2.24 call tests/test_demo_years.py::test_trips_in_an_early_and_a_late_year
2.00 call tests/test_granola.py::test_a_connection_failure_is_retried_once
1.93 call tests/test_weather.py::test_day_year_and_trips_show_the_weather_without_the_network
1.59 call tests/test_demo_years.py::test_health_only_from_the_year_the_watch_appears
1.57 setup tests/test_demo_years.py::test_childhood_is_sparse_and_told_by_others
1.47 call tests/test_serve.py::test_no_page_references_a_url_outside_itself
1.46 call tests/test_whatsapp.py::test_cli_add_reports_lines_skips_and_media
1.46 call tests/test_migrate.py::test_cli_verify_and_add_refuse_then_migrate_then_verify
1.45 call tests/test_imessage.py::test_any_message_store_yields_only_valid_lines

One test, test_the_long_trips, takes 447.5 s of the 792 s wall clock (56%) and carries no slow mark; the other 2,838 passing tests take 344 s together, 0.12 s each on average.

2.8 Dependencies

Runtime: ijson>=3.3; tzdata on Windows. ijson is imported by 5 modules, all adapters: adapters/dawarich.py, adapters/spotify.py, adapters/takeout/activity.py, adapters/takeout/location.py, adapters/takeout/youtube.py. Nothing outside adapters/ imports it, and 61 of the 66 adapter modules do not.

Extras, as pyproject.toml declares them and as uv export --extra <name> resolves them from uv.lock (every platform marker included; ijson and tzdata are in every count):

Extra Declared Packages resolved Platform
encrypted cryptography>=42 5 all
share cryptography>=42 5 all
ais websockets>=13 3 all
mcp mcp>=2 32 all
judge mlx-lm>=0.20 36 Apple silicon only; installs nothing elsewhere
transcribe mlx-whisper>=0.4 or faster-whisper>=1.0 45 mlx-whisper on Apple silicon, faster-whisper (with torch, ctranslate2, onnxruntime) elsewhere
describe mlx-vlm>=0.1.20, pillow-heif>=0.18 58 Apple silicon only; installs nothing elsewhere

encrypted and share resolve to the same packages. judge, describe and transcribe share mlx, mlx-metal, huggingface-hub, tokenizers, numpy on Apple silicon.

3. What is unused or dead

  • commitment/v1 and commitment-close/v1 (RFC 0007): specified, listed in SPEC.md §4 and docs/promises.md, never written, never read. promises writes task/v1 instead.
  • migration/v1: written once per migrate, read by no module.
  • crossing/v1: written by every export and share, read back by nothing but show.
  • browse/v1, watch/v1, trip/v1, highlight/v1: written by 4, 1, 3 and 2 adapters respectively, read by show and search only. No Day, rollup, page or derive consumes them.
  • The 25 entry points in pyproject.toml: each names a module BUILT_IN already loads; all_adapters() imports them a second time and discards the duplicates.
  • logbook/adapters/takeout/calendar.py: a complete adapter (NAME, sniff, run) in no registry; add Takeout/Calendar reaches the same files through ics.
  • logbook demo and logbook demo --years: demo.py and demo_life.py are 2,696 lines (4.7% of the package), imported by cli.py at module level for every command.
  • 22 RFCs under rfcs/ are not in mkdocs.yml; the site links to them and the links are broken.

4. What disagrees with itself

  • Two adapter registries. BUILT_IN (58) and the entry points (25) register the same modules by different names (apple-books vs apple_books); 33 adapters are in one and not the other; docs/adapters/README.md describes third-party adapters registering the entry point, which is the only purpose the group serves.
  • screentime writes kind app-use with schema event/v1; every other writer of event/v1 writes kind event. rollup attention selects by screentime.KIND, so the lines are read; day.py's event selection does not see them.
  • RFC 0025 is two documents: rfcs/0025-trip-bundle-v1.md (trip-bundle/v1, trip-share/v1, received/v1; 119 lines, dated 2026-10-03) and docs/rfcs/rfc-0025-shared-page-bundle.md (shared-page/v1; 217 lines, dated 2026-10-02). rfcs/README.md links both under the same number.
  • RFC 0028 is one file with two names: rfcs/0028-story-v1.md and the symlink docs/rfcs/0028-story.md; mkdocs.yml names it "0028 story/v1 (draft, unfinished)".
  • RFC 0027 exists only under docs/rfcs/; the sequence in rfcs/ skips it.
  • rfcs/README.md calls commitment/v1 a seed profile and links its RFC; the code has no writer and no reader.
  • SPEC.md §4 places commitment/v1 and commitment-close/v1 in the tier table beside profiles the code writes.
  • README vs code. Every command the README names exists: 17 top-level names in backticks, 50 two-word forms (export vault, backup restore, infer keepers, add story, rollup money, …), all dispatched in cli.py. Every profile the README names (14) is written by the code. The README does not name 28 of the 46 top-level commands: assets circle days describe digest import import-backup index infer keepers ledger migrate people person questions receive repair retract rollup search share show stats tasks transcribe trip trips verify year (several appear in two-word forms or without the logbook prefix). The README's live-source table names 5 of the 9 live adapters; adsb, ais and weather appear in command examples, apple-podcasts nowhere.
  • The docs site builds with 48 warnings, every one a link to a file outside docs/: 26 from rfcs/README.md, 15 from index.md, 6 from CHANGELOG.md, 1 from CONTRIBUTING.md. mkdocs build --strict fails; .github/workflows/docs.yml deploys without --strict.
  • Pre-commit excludes docs/rfcs/*.md from the whitespace hooks because the files are symlinks; three of them are regular files.

5. Tests: what the suite guards and what it only pins

What it guards:

  • The envelope and the chain: conformance/sample-logbook with conformance/expected.json is verified in CI by logbook verify --expect, and tests/test_jcs.py pins RFC 8785 hashing.
  • Adapters against drift: 21 Hypothesis properties in 16 files generate exports and assert every yielded line validates; test_fuzz_readers.py carries 3 of the 7 slow marks.
  • No network on the default path: tests/test_no_network.py and the socket guards in conftest.py, test_describe.py, test_promise_judge.py, test_transcribe.py, test_ais.py, test_gcal.py, test_serve.py, test_mcp.py.
  • The CLI end to end: 26 files run logbook through subprocess.run.

What it only pins:

  • Console text. 587 readouterr() calls and 862 substring assertions on captured output check wording, column layout and phrases from cli.SKIP_PHRASES. A rename of a command or a rewording of a line fails tests without any line of the record changing. Whole-output equality is rare (8 assertions), so the pinning is by phrase, not by screen.
  • Private names. 22 monkeypatch.setattr calls target underscore-prefixed attributes (_together, _finite, …); those tests bind the suite to the current factoring of the module.
  • The model commands. test_promise_judge.py (16 tests), test_describe.py (19) and test_transcribe.py (20) pass a fake importer or a FakeEngine into judge.py, describe.py and transcribe.py; no test imports mlx_lm, mlx_vlm, mlx_whisper or faster_whisper, and tests/test_mcp.py is the only importorskip. The suite proves the plumbing around a model, never a model's answer.
  • Markers. slow tests run only with LOGBOOK_SLOW=1 (CI: push to main and nightly, not pull requests); stress never runs in CI. A pull request therefore runs 2,839 of the 2,853 collected tests and skips 7; the one test that takes 56% of the wall clock, test_demo_years.py::test_the_long_trips, has no mark and runs on every pull request.

6. Dependencies

  • One runtime dependency, ijson, carried by 5 of 66 adapter modules; the other 126 modules of the package need the standard library only. A core without adapters has no third-party dependency.
  • Two extras are one: encrypted and share both declare cryptography>=42 and resolve identically.
  • Three extras are Apple-silicon-only in effect: judge and describe install nothing on any other platform and the commands exit 2 with an install line; transcribe falls back to faster-whisper, which pulls torch (45 packages).
  • mcp pulls 32 packages (pydantic, starlette, uvicorn, jsonschema, …) for one command, logbook mcp.
  • The dev group installs pytest, pytest-xdist, pytest-cov, hypothesis, ruff, mypy, pre-commit; mkdocs-material and pymdown-extensions are not in the lockfile and the docs workflow fetches them with uvx.

7. The three decisions

Recorded as the owner gave them on 3 October 2026.

Decision 1 — Commands: 46 top-level commands become 22. Every old name stays as a hidden alias that prints one line naming the new command. Help fits on one screen.

Decision 2 — Profiles: the profiles read by readers are frozen for v1.0 (expected 18); profiles written but never read are parked (expected 10): their adapters keep writing them, their schemas are marked "parked, may change", nothing is frozen about them. commitment/v1 and commitment-close/v1, neither written nor read, are deleted. trip/v1 is renamed journey/v1 with a reader-side alias for existing records. The freeze is specified in its own RFC.

Decision 3 — Packaging: one package, openlogbook, with three tiers inside it — core (format, record, verify, the frozen profiles' readers), contrib (adapters, exports, derived readers), labs (model-touching and experimental commands). Old import paths keep working through shims for one minor version. No split into two distributions before v1.0.

Measured against the expected counts

Set Expected Measured (§2.5) Difference
Read by readers (to freeze) 18 21 3 more: voice-memo/v1 (read only by transcribe, a labs command), received/v1 and trip-share/v1 (read only by the shared section of trip <id>). Without those three the set is the expected 18.
Written, never read (to park) 10 6 line profiles; 10 with the 4 package manifests The 6: browse/v1, watch/v1, trip/v1, highlight/v1, crossing/v1, migration/v1. The manifests crossing-package/v1, day-package/v1, trip-bundle/v1, shared-page/v1 are formats of a folder, not of a line; the freeze RFC has to say whether they are in scope.
Neither written nor read (to delete) 2 2 none

The counts differ from the expectation on the first two rows. The 21 and the 6 are what the commands in the appendix return; the freeze RFC must name its 18 and its 10 explicitly and decide the fate of the five profiles that fall between the two definitions (voice-memo/v1, received/v1, trip-share/v1, crossing/v1, migration/v1).

Two facts the decisions rest on, checked: the distribution is already named openlogbook (pyproject.toml line 2; the import package is logbook); trip/v1 is written by easypark, sbb, passages and demo and read by no reader, so the rename to journey/v1 touches 4 writers, the show renderer, search.KINDS, RFC 0020 and the README.

8. Order of work

  1. Hygiene first, because every later step is measured against a baseline without duplicates: delete the 25 entry points or BUILT_IN (one registry); move the three regular files out of docs/rfcs/ or the 22 missing RFCs into mkdocs.yml; renumber one of the two 0025s; make mkdocs build --strict pass and run it in CI; remove commitment/v1 and commitment-close/v1 from SPEC.md §4, rfcs/README.md and docs/promises.md and mark RFC 0007 withdrawn. No behaviour changes; no changelog line a user needs.
  2. One package, three tiers (Decision 3), because the command and profile work must land in the tier it belongs to: logbook/core, logbook/contrib, logbook/labs, with shims at the old paths. The import graph in §2.2 is the checklist: cli.py must stop importing 61 modules at module level or every tier loads for every command.
  3. Commands (Decision 1), because it depends on the tiers: 46 become 22, old names become hidden aliases, and the 862 substring assertions on console output in §2.7 tell which tests pin the old wording.
  4. Property tests for the frozen readers, because the freeze needs a guard that does not depend on console phrases: one Hypothesis property per frozen profile asserting that any valid line is read without error and that Day is a function of the lines alone, alongside the 21 properties that already cover adapters.
  5. The freeze RFC (Decision 2) last, because it names the 18 and the 10 from the tiers and the readers as they stand after steps 2–4, renames trip/v1 to journey/v1, and is the one document the v1.0 tag points at.

9. Appendix: commands used

Run from the repository root at commit 4d70394, Python 3.12, uv sync --group dev done.

# §2.1 size
find logbook -name '*.py' | wc -l
find logbook -name '*.py' -not -path '*/adapters/*' | wc -l
find logbook -name '*.py' | xargs wc -l | tail -1
find logbook/adapters -name '*.py' | xargs wc -l | tail -1
find logbook -name '*.py' | xargs wc -l | sort -rn | sed -n '2,11p'
wc -l logbook/cli.py
ls tests/test_*.py | wc -l; ls tests/*.py | wc -l
find tests -name '*.py' | xargs wc -l | tail -1
find docs -name '*.md' | wc -l; find docs -type l | wc -l

# §2.2 cli.py imports
uv run python - <<'PY'
import ast, sys
tree = ast.parse(open("logbook/cli.py").read())
top = [n for n in tree.body if isinstance(n, (ast.Import, ast.ImportFrom))]
nested = [n for n in ast.walk(tree) if isinstance(n, (ast.Import, ast.ImportFrom)) and n not in top]
sib = [a.name for n in top if isinstance(n, ast.ImportFrom) and n.level == 1 and n.module is None for a in n.names]
print(len(top), "module-level import statements;", len(nested), "nested;", len(sib), "names from '.'")
before = set(sys.modules); import logbook.cli
new = set(sys.modules) - before
print(len(new), "modules loaded;", len([m for m in new if m.startswith("logbook")]), "logbook.*")
PY
uv run python -c "import sys; b=set(sys.modules); import logbook; print(len([m for m in set(sys.modules)-b if m.startswith('logbook')]))"
grep -c '\.add_parser(' logbook/cli.py

# §2.3 commands
uv run logbook --help | wc -l
uv run logbook --help | sed -n '2p' | tr -d ' {}.' | tr ',' '\n' | grep -c .

# §2.4 adapters
find logbook/adapters -name '*.py' ! -name '__init__.py' | wc -l
uv run python - <<'PY'
import tomllib, pathlib
from logbook import adapters as a
built = set(a.BUILT_IN)
eps = tomllib.load(open("pyproject.toml", "rb"))["project"]["entry-points"]["logbook.adapters"]
ep = {v.removeprefix("logbook.adapters.") for v in eps.values()}
disk = {".".join(f.with_suffix("").parts[2:]) for f in pathlib.Path("logbook/adapters").rglob("*.py") if f.name != "__init__.py"}
print(len(disk), len(built), len(eps), len(a.all_adapters()), len(a.live_adapters()))
print("disk-not-BUILT_IN", sorted(disk - built)); print("ep-not-BUILT_IN", sorted(ep - built)); print("BUILT_IN-not-ep", sorted(built - ep))
PY

# §2.5 profiles: every profile string, per file; writers are the files holding SCHEMA constants or
# "schema": literals; readers are selections by kind (by_kind, of_kind, evidence, kind ==, X.KIND,
# Index.locations/resolutions/retractions) in modules outside adapters/, cli.py's show renderer and search.py
grep -rhoE '"[a-z][a-z-]*/v[0-9]+"' logbook --include='*.py' | tr -d '"' | sort | uniq -c | sort -rn
grep -rnoE '"[a-z][a-z-]*/v[0-9]+"' logbook --include='*.py' | tr -d '"' | awk -F: '{print $1, $3}' | sort -u
grep -rnE '^[A-Z_]*(KIND|SCHEMA|PROFILE)[A-Z_]* *= *"[^"]+"' logbook --include='*.py'
grep -rnE 'by_kind\(|of_kind\(|evidence\(|\.locations\(|\.resolutions\(|\.retractions\(|\.KIND\b|kind *(==|!=|in) *"' logbook --include='*.py' | grep -v 'logbook/adapters/'
sed -n '2895,2930p' logbook/cli.py          # the show renderer's kind chain
sed -n '48,62p' logbook/search.py           # search.KINDS
grep -rn 'commitment' --include='*.py' --include='*.md' --include='*.json' . | grep -v '^./.venv' | grep -v CHANGELOG

# §2.6 RFCs
ls rfcs | wc -l; ls docs/rfcs | wc -l; find docs/rfcs -type l
ls rfcs docs/rfcs | grep -oE '[0-9]{4}' | sort | uniq -c | awk '$1>1'
grep -n 'rfcs/' mkdocs.yml
uvx --with mkdocs-material --with pymdown-extensions mkdocs build --strict -d /tmp/site 2>&1 | grep -c WARNING
uvx --with mkdocs-material --with pymdown-extensions mkdocs build --strict -d /tmp/site 2>&1 | grep -oE "Doc file '[^']+'" | sort | uniq -c

# §4 README vs code
grep -oE '`logbook [a-z][a-z-]*' README.md | sed 's/`logbook //' | sort -u          # compare with the 46 names
grep -oE '\blogbook [a-z][a-z-]+ [a-z][a-z-]+\b' README.md | sort -u                  # two-word forms; check each in cli.py
grep -oE '`?[a-z][a-z-]*/v[0-9]`?' README.md | tr -d '`' | sort | uniq -c             # ai/v1 is a URL, not a profile
grep -oE '^\| `[a-z-]+` \|' README.md | tr -d '`| ' | sort -u                           # the live-source table

# §2.7 tests
uv run pytest --collect-only -q -o addopts="" | tail -1
uv run pytest --collect-only -q -o addopts="" -m "not stress" | tail -1
grep -rhoE '^\s*(async )?def test_[a-zA-Z0-9_]+' tests | wc -l
grep -rn 'pytest.mark.slow' tests | wc -l; grep -rn 'pytest.mark.stress' tests | wc -l
grep -rln 'hypothesis' tests | wc -l; grep -rn '@given' tests | wc -l
grep -rn 'readouterr()' tests | wc -l
grep -rnE 'assert .* in (out|err|res\.stdout|r\.stdout|result\.stdout|text)\b' tests | wc -l
grep -rn -- '== """' tests | wc -l; grep -rn -- '\.output ==' tests | wc -l
grep -rn -- '\.stdout ==' tests | wc -l; grep -rnE -- '\bout == "' tests | wc -l
grep -rnE 'monkeypatch\.(setattr|setitem|delattr)\([^,]+, *"_[A-Za-z]' tests | wc -l
grep -rln 'subprocess.run' tests | wc -l
time uv run pytest --durations=15 -q -m "not stress" -p no:cacheprovider

# §5 model-touching commands
grep -rn 'importorskip\|^import mlx\|^from mlx\|faster_whisper' tests
grep -cE '^\s*def test_' tests/test_promise_judge.py tests/test_describe.py tests/test_transcribe.py
grep -c 'importer=' tests/test_promise_judge.py tests/test_describe.py tests/test_transcribe.py
grep -n 'import_module\|module = "' logbook/judge.py logbook/describe.py logbook/transcribe.py

# §2.8 / §6 dependencies
grep -rln 'import ijson\|from ijson' logbook scripts tests
for e in encrypted share ais transcribe judge describe mcp; do
  echo "$e $(uv export --extra $e --no-hashes --no-dev --no-emit-project --frozen | grep -vE '^(#|-e|\.)' | wc -l)"
done
uv export --extra encrypted --no-hashes --no-dev --no-emit-project --frozen | diff - <(uv export --extra share --no-hashes --no-dev --no-emit-project --frozen) && echo same