decisions DECIDED

273. The shell program becomes a directory of modules

Raised 2026-10-10 (UTC) as the cut that milestone 844 (the shell program is split along its seams) says is calef's call before a line moves. Written by lane milestone/844-the-shell-program-is-split-along-its-seams. (Section number provisional until the merge queue lands it.)

The ruling

calef ruled on 2026-10-11 at 07:23 (UTC), in the maintainer session, and the maintainer recorded it on PR #1914. Three blocking questions, three answers:

Question calef's words What it decides
Do the witness roles get their own module? "Couldn't we design a better implementation that the witnesses are individual programs and we run them all with scripts rather than a specific build?", then, on doing both, "Proceed with both" witness.rs holds them, as a temporary home. Pull request #1922 gives the shell a non-interactive script mode, turns the six witnesses into scripts the shipping shell runs, and deletes witness.rs and the role numbers.
Does components/ get its first program directory? "Yes, program directory" components/src/swish/, with main.rs as the crate root.
Do helpers that four or more modules use live in main.rs? "Agreed" main.rs is the program's shared vocabulary.

Every module name ships provisional. calef deferred them to a name-ratification pass.

Why the directory is the right layout beyond this file. calef noted with the second answer that swish will later move to its own repository, be packaged in basalt and be versioned with jig. A program that is a directory with main.rs and its modules beside it is the shape that extraction lifts whole: the directory becomes the new repository's src/, and nothing in it names a sibling program's file.

What the file was

components/src/swish.rs was 5,920 lines on main at 396187b0b and at 9532eeb53, 60 fewer than the block measured, all from the package builtin leaving in 7b9d12565. Every seam was between items, so this was a move.

The cut, as it landed

The program moved to components/src/swish/main.rs, with child modules beside it. components/Cargo.toml's [[bin]] path follows. Every module is a child of the crate root.

file holds lines
main.rs header, the capped heap and mod heap, clock, holdings, the role table and _start, interactive through run, and the helpers four or more modules share 1,090
navigation.rs Nav, the navigation builtins, ls's constants, pattern expansion 605
prompt.rs apropos, read_line, the shell editing its own line, Tab completion 406
running.rs argv pages, the words grant, run_image, the manifest note, dir_grant, spawn, draining, outcome 1,172
capabilities.rs caps, caps_image, the live generation table, bare 319
pipeline.rs the operators >, < and |, and the files the shell serves behind them 995
jobs.rs spawn_interruptible, watch, forcible, reclaim 328
witness.rs every witness role and its helpers, and the three witness-only Nav constructors and methods (rooted, rooted_twice, name_call) as a second impl Nav 1,130

No file is over 1,500. main.rs is the parent and is well under 3,000.

The proposal called the fifth module caps, after the builtin. It ships as capabilities, because calef ruled on 2026-10-06 (UTC) that an identifier does not abbreviate capability as cap, and script/lint counts a module name as one. The builtin keeps its name.

The shared helpers in main.rs are the ones this section listed. They are the status words (record, refused, failed, current, last) and the output helpers (print, stage, print_num, put_page, get_page). With them are the file-system window constants, PAGE, memory_region_split, delegate, and the window-disjointness assertion with SH_CLOCK_VA, the one window that exists only for it. Applying the rule calef agreed to, rather than the list, added three that four or more modules call. Two are expansion and echo, the wrappers over the swish crate, with the comment that describes them as a pair; the third is send_cap, delegate's one-line wrapper. That moved echo out of prompt, where the proposal's table put it.

crates/swish/src/lib.rs (3,850 lines) is outside this milestone, and milestone 884 (the shell logic crate is split along its seams) now covers it.

What the move cost beyond moving code

What it does not decide

No public crate API, wire format or system call changes. The role numbers system_tests passes at spawn do not move.