6. Packages
Packages were built by humans for humans, to avoid rewriting what someone else already wrote. Agents change the economics: writing and maintaining code is cheap, and every incident in the 2024–26 supply-chain record was someone else’s code executing on your machine. Mo’s package system is designed from that premise.
Three shelves
- Bricks. The standard library and the platform. First-party, audited once, the only code in a Mo program that is not yours. The box is big on purpose: collections, strings, JSON, regex, time, HTTP client and server, crypto, TLS, compression, Unicode, and database drivers. The rule for what is a brick: if a bug in it is a security or data-loss event, it is first-party code.
- Kits. First-party features that install as source you own, the way Phoenix generates auth or shadcn installs a component: auth, sessions, background jobs, an admin surface. Vetted by the Mo team, copied into your repo, then yours to change. Agents make ownership cheap.
- Recipes. Community packages that share intent, not code. A recipe is the spec altitude of a module and nothing below it:
recipe RateLimiter
intent "Token bucket per client; refills from the clock; never blocks"
needs Clock
fn limiter(capacity: UInt32, refill: Duration) : Limiter
requires capacity > 0
end
fn allow?(l: Limiter, id: ClientId, now: Time) : (Limiter, Bool)
ensures result.0.tokens(id) <= l.capacity
end
test "refills at the declared rate" ... end
test "a burst beyond capacity is refused" ... end
test rejects "a limiter with no capacity" ... end
endYour agent implements the bodies in your repo from the bricks. mo check --recipe Module.Recipe file.mo checks the result against the recipe: the file exposes each of the recipe’s signatures with the same parameters, result, and requires, and at least its ensures, so its capabilities stay under needs; and the recipe’s tests and nevers pass when run against the file. A difference is MO0326. It is then your code, and no dependency exists.
Kits and recipes are one mechanism. A recipe may carry full reference bodies. When the publisher is first-party, the agent copies them, which keeps behavior identical across projects and saves tokens. When the publisher is the community, the bodies are examples and the agent regenerates. Either way the code is compiled and capability-checked as yours.
Source-code packages from outside remain allowed as the last resort. They show their computed capability manifest at install and live under the registry rules below.
The registry
Six layers, no new syntax:
- Language. No install scripts, macros, or build-time code. Capabilities are the permission system, and effects never hide in a value. Platforms are the entire trusted base: the lockfile records each platform’s native-code hash, and
morefuses an unaudited platform without a human’s--trust. - Identity. A package version is a set of declaration hashes, pinned in the lockfile. The registry serves bytes that must match, and every version goes into a transparency log. Source only, never binaries.
- Publishing. One central registry. A WebAuthn key is required; no token type can publish alone; CI publishes only through short-lived identity, with a second signer for widely used packages. Trust evidence is monotone across versions: the registry refuses a publish with weaker evidence than the last.
- Age gates. Versions younger than 3 days and names younger than 30 days are refused by default.
mo updatefalls back to the newest old-enough version. Overrides need a human, never an agent. - The install conversation.
mo addprints the computed manifest. A capability widening on update is a breaking change that pulls a human in, the same rule asnever. Four reputation signals served by the registry: known-malicious, similar name (namespace-aware), low use, new name. Every “ask the human” is a hard fail for an agent. - Offline and incident response. A signed revocation bloom filter checks plain rebuilds cheaply.
mo find-hashlists every package version containing a given declaration hash. No dependency bypasses the registry except an in-repo path.
Each check has a documented boundary (fail, warn, or opt-in) and a stable error code in the catalog (unassigned until the registry exists; errors.md carries one recipe code, MO0326, today).
The norm
Copy a function rather than add a dependency. Build your own rather than import. The stdlib and kits are the first choice, recipes the second, outside code the last. The goal is for software to rely less and less on the outside world.
Session 5 changes
Claude (session 5): the recipe example gained a limiter constructor with a requires, because a test rejects must trip a requires and the old “burst beyond capacity” test had none to trip. Found by the corpus.
Session 5, step 19: the check in the paragraph under the example is mo check --recipe, and a recipe may hold never blocks, after program 4 found that nothing held an implementation to its recipe, so its copies of the recipe’s tests could drift.