roadmap BUILT

40. Documentation as a system service: searchable, rendered, and installed by packages

Built. Phases 1 and 2 are built, with search ranked by document length, and phase 3's caretaker-narrowing increment is built too (DECISIONS §106 (take the terminal_sink_caretaker narrowing)). doc <page> renders at the prompt with no | wc in front of it, which is the milestone's own headline demonstration. There is no graphical viewer, by calef's word: "I don't need a graphical viewer." His quoted direction below never asked for one.

What exists: crates/documentation (a streaming markdown renderer, the byte layout of a search index, and the query that reads one, all pure and host-tested in tests/render.rs). Then components/src/mdr.rs, the viewer program, which the shell can spawn as Prog::Mdr, the store the image installs, apropos at the nife prompt, and script/apropos over the whole repository. The renderer was written against line_editor's contract rather than pulldown-cmark, which the block's own text anticipated as the alternative and which the crate's header records. In the phase records below, manual is the crate now called documentation and doc the program now called mdr.

In phase 2 the store is built on the host from the DOC_BUNDLES table (cargo xtask manual), installed into the filesystem image as doc/<bundle>/ with doc/bundles naming what is there, and searched from the prompt by apropos <word>, a shell builtin. The whole of it is gated by script/swish-check on both architectures: apropos capability names the pages, and the line after it grants wc exactly one of them. Search produces names, never capabilities, which is why it may be a builtin: a searching program would have to be handed the whole store to read every shard in it, which is more authority than the answer needs. See notes/documentation.md.

The same index is pointed at the repository as script/apropos, for the finding of milestone 117 (the stranger test). Where a tail stage's output goes when the shell cannot read it is decided as DECISIONS §106, from notes/tail-output-narrowing.md.

calef's direction, 2026-07-30. Markdown as the authored format, rendered for display rather than shown raw, searchable on the local machine, and installed by the package that owns it, so a component brings its documentation with it.

Why this belongs on a demonstrator's roadmap rather than being a nicety. The project's own argument is written in markdown: design/decisions/, thirty-plus notes, this roadmap. A nife that serves its own design notes, on itself, through a capability-confined viewer, is a better demonstration of milestone 23's component story than another synthetic test, and it costs the documentation nothing because it already exists.

Two constraints found while scoping, both real

  1. There is no directory iteration. readdir refuses in the std PAL and the §27 file contract has no such verb, so nothing can walk a tree looking for documents. Adding one is a decision, not a detail, and the capability model argues against it anyway: enumeration is authority. A viewer that can list a directory can discover what it was not given. So the design below indexes at package build time and ships the index, which sidesteps the missing verb and is the more honest shape. Unix reached the same answer for a different reason: apropos reads a prebuilt mandb because scanning was slow.
  2. There is no font rendering yet. There is now, since milestone 29 (a display terminal) on 2026-07-30. It has a bitmap font, a VT engine, and a display terminal that is a compositor client. A graphical documentation browser is therefore unblocked in principle struck 2026-08-26. Nobody asked for one, and this milestone's own headline demonstration renders at the prompt instead. See the Status block.

Reuse: take the parser, write the renderer

CommonMark is a fiddly specification with a large conformance suite, and parsing it is exactly the kind of work worth taking from someone else. Rendering to our terminal contract is ours and small. That split is the reuse judgment, and it is the same one milestone 32 made about RedoxFS.

Piece Option Judgment
Parse pulldown-cmark (pure Rust, CommonMark, event-stream API, few dependencies) Take it. The event stream is the right shape for a renderer that emits ANSI. Milestone 27's std is what makes this buildable at all.
Parse comrak (GFM: tables, strikethrough, footnotes) Consider later if GFM tables matter; more dependencies.
Render termimad, mdcat Do not take. Both sit on crossterm, which assumes a POSIX terminal (termios, ioctl). Porting that is more work than emitting ANSI against line_editor's contract, which we own and already speak (§21).
Search tantivy Too heavy. It assumes a filesystem and mmap.
Search A host-built inverted index shipped in the package Take this shape. Built by xtask where there are no constraints, merged by the viewer across installed packages.
UI ratatui Possible for a pager later; needs a backend against our terminal contract first.

Shape

Phasing

Prior art worth reading: man plus apropos plus mandb for the split between format, index and pager, which is the architecture this proposes minus the troff. Dash/Zeal docsets (a bundle with its own index) for the packaging shape. cargo doc's HTML output as the road not taken, since HTML would need a browser engine, which is a mountain with no thesis behind it.

Sequencing. Phase 1 wants milestone 31 phase 2 finished (per-file grants make doc <file> the demonstration it should be) and nothing else; it can precede the packaging work and be wired into it later. Effort: 1 lane estimated per phase, three phases, landed separately.

BUGS

Follow-on

Index row

the OS explains itself, on itself. Phases 1 and 2 built: crates/manual (now crates/documentation; a streaming renderer and an index layout a reader with one 4 KiB page can binary-search). Then doc (now mdr) at the prompt, and apropos as a builtin because search is enumeration and a searching program would need the whole store. 2026-08-18 fixed a renderer bug the corpus test structurally could not see (a fence inside a block quote never closed, so one quoted transcript misrendered every line after it). It fixed an index defect where the builder and the reader disagreed about what a word is (apropos fs_proto could not match a term the builder never wrote). It corrected three BUGS entries that described a system which no longer existed. And it pointed the same index at the repository as script/apropos, which is milestone 117's finding rather than a nicety. Three strangers reached neither notes/capabilities.md nor any design/decisions/ file. The terminal_sink_caretaker narrowing is decided and built (§106, 2026-08-22): doc <page> renders at the prompt. An unredirected tail stage's output now defaults to the same adapter 2> already uses; grant_plan::check_chain no longer refuses that shape, only the redirected one; and the shell's completion signal is DECISIONS §26's kernel exit-delivery on a fresh endpoint. Verified at the real prompt, both architectures: doc gate.txt prints hello world hello world with no | wc in front of it. Milestone 151 tracks the one known cost (the caretaker-hop display race) as a carried, accepted interim rather than a blocker. A graphical viewer, named as phase 3's other half through every revision, is struck 2026-08-26: traced to its origin, an unattributed sentence, and confirmed unrequested.