This page is the book's one place for version facts: which releases of the command-line tool and the Rust SDK exist, which virtual-machine generations each one runs, and what each generation added. Other chapters link here instead of repeating them.
captain build compiles a program to a .capb artifact: bytecode for the
Captain virtual machine. The virtual machine's instruction set grows over
time, and each step is a numbered generation. An artifact records the
generation it needs, and a tool runs it only if it runs that generation. So
the question "will this program run there?" comes down to two numbers: the
generation the artifact needs, and the newest generation the tool runs.
Release facts
This section holds every statement on this page that depends on a particular release. If a release changes, correct it here; the rest of the page describes rules that do not change with releases.
The toolchain in this book. The examples are checked with the captain
command-line tool built from the source this book is published with. It
reports itself as captain 0.7.0+build-N, and it runs generations 1 to 8.
Generation 8 is still in development; only the examples of
Writing JSON
use it.
Captain releases. From Captain 0.7.0, the first release to carry
generation 8, Captain is released as one composite: the release has its own
version, and names the exact version of each component it is made of, the
command-line tool, Mate, Bosun, Gate, the Rust SDK, the standard library and
the runtime crates. A release promises that every one of them that runs
Captain runs every generation its command-line tool compiles to.
captain --help names the release a tool belongs to. Before 0.7.0, the
command-line tool's releases stood for Captain's.
Generation 7 is released with the Rust SDK 0.7.0. It was cut on
2026-11-20. It brings exact decimal division and rounding: / on decimals
and quantities is exact or fails with CAP-RUN-INEXACT, digits are dropped
only where the program names a scale and a rounding mode
(x scale: 2 rounding: #HalfEven, a divide: b scale: 2 rounding: #HalfUp),
and integers convert exactly with as: (n as: Decimal, n as: i64).
See Division and rounding.
| Release | Runs VM generations | Notes |
|---|---|---|
| Rust SDK 0.5.0 | 1 and 2 | pure profile |
| Rust SDK 0.6.0 | 1 to 4 | adds generations 3 and 4, and Octets values |
| Rust SDK 0.7.0 | 1 to 7 | adds generations 5, 6 and 7 in one step; entries take lists, records and options (InputValue::List, Record, Some, None), and results come back with field names (OutputValue::Record, Some, None, Variant) |
captain CLI 0.5.0 |
1 to 5 | |
captain CLI 0.6.0, published |
1 to 6 | no published command-line release runs generation 7 yet |
captain CLI built from this book's source |
1 to 8 | the tool the examples are checked with; generation 8 is in development |
The command-line tool is published as the package @frogfish/captain.
Releases 0.5.0 and 0.6.0 were published for macOS on Apple silicon
(aarch64-apple-darwin); 0.4.0 and earlier also for Linux on x86-64
(x86_64-unknown-linux-gnu).
The SDK's pure profile runs the code of every generation it admits, but no effects: generation 7's local-machine effects stay outside it. An SDK run record names the semantics it was produced under, by the first SDK release that ran that range of generations (DR-0017): an artifact needing generation 2 or less is named by 0.5.0, 3 or 4 by 0.6.0, and 5 to 7 by 0.7.0. So records retained from 0.5.0 and 0.6.0 verify and replay unchanged under 0.7.0. See Embedding Captain in Rust.
The bytecode format is version 1 in every release.
| Generation | Decision records | Status |
|---|---|---|
| 1 | the first frozen instruction set | released |
| 2 | DR-0013 | released; the compiler's floor |
| 3 | DR-0015 | released |
| 4 | DR-0016 | released |
| 5 | DR-0018 | released (CLI 0.5.0; SDK 0.7.0) |
| 6 | DR-0019 | released (CLI 0.6.0; SDK 0.7.0) |
| 7 | DR-0020 to DR-0032, DR-0034 | released with SDK 0.7.0 |
A program that uses a generation-7 operation, which includes any division of
decimals or quantities, any scale:rounding:, and n as: Decimal or
n as: i64, runs on the SDK 0.7.0 and on the command-line tool built from
this source, and is refused by the published 0.6.0 command-line tool.
What a generation is
A generation is a fixed set of operations with a fixed meaning: the opcodes, the table of built-in operations (builtins), and the native effects the virtual machine provides. Generation 3, for example, is generation 2 plus eighteen builtins for everyday text and lists and three local file effects.
Every artifact records one generation number in its header. captain inspect
shows it as vm N:
module Book::Total.
export total a: Decimal b: Decimal -> Decimal [
ret a + b.
].$ captain build total.capt -o total.capb
built total.capb ([..] bytes, sha256 [..])
$ captain inspect total.capb
package Book::Total 0.0.0
sha256 [..]
compiler [..]vm 2 stripped
exports
total a: Decimal b: Decimal -> Decimal (pure)
entry points
total a:b: a=<Decimal> b=<Decimal>
pools: [..]The generation is separate from the bytecode format version, which says
how the bytes of a .capb file are laid out. Every generation so far uses
format 1; a new generation adds operations without changing the layout.
The compiler records the lowest generation a program needs
The compiler does not stamp every artifact with the newest generation it knows. It records the lowest one that has every operation the program uses. A program that uses nothing newer records generation 2, the floor; using one newer operation raises it to that operation's generation. The program above adds two decimals and records 2. This one rounds a quotient, which is a generation-7 operation, and records 7:
module Book::Share.
export share amount: Decimal ways: Decimal -> Decimal [
ret amount divide: ways scale: 2 rounding: #HalfEven.
].$ captain build share.capt -o share.capb
built share.capb ([..] bytes, sha256 [..])
$ captain inspect share.capb
package Book::Share 0.0.0
sha256 [..]
compiler [..]vm 7 stripped
...
$ captain run share.capb share amount=10.00 ways=3
run log: share.runlog
3.33
$ head -2 share.runlog
capb [..]
vm 7The run log records the generation too, next to the artifact's digest.
Recording the lowest generation is what lets an artifact run on as many virtual machines as possible. A program that needs nothing new still runs on a machine that has never heard of the newest generation, and a program that uses no new operation builds to the same bytes with a newer compiler. A newer operation raises the requirement only for the programs that use it.
These programs each use one operation from a different generation:
module Book::Greet.
export greet name: Text -> Text [
ret "Hello, " append: name.
].module Book::Fingerprint.
export fingerprint text: Text -> Text [
digest := ((Octets fromUtf8: text) sha256).
ret (digest hex).
].module Book::Config.
use Std::Json.
export struct Settings { name: Text, retries: i32 }.
export retries text: Text -> i32 [
parsed := Json decodeStrict: text as: Settings maxBytes: 4KiB maxDepth: 4 maxEntries: 16 maxNodes: 64.
parsed ifOk: [ :s | ret (s retries) ] ifFail: [ :e | ret 0 ].
ret 0.
].module Book::Letters.
export letters text: Text -> i32 [
ret ((text characters) count).
].captain inspect also reads source directly:
$ captain inspect greet.capt | grep vm
compiler [..]vm 3 stripped
$ captain inspect fingerprint.capt | grep vm
compiler [..]vm 4 stripped
$ captain inspect config.capt | grep vm
compiler [..]vm 5 stripped
$ captain inspect letters.capt | grep vm
compiler [..]vm 6 strippedappend: is generation 3, octets and SHA-256 are 4, strict bounded JSON is
5, and characters is 6.
The verifier refuses what an artifact doesn't declare
Before any code runs, the virtual machine verifies the artifact (spec 06 §9). Three of its checks are about generations:
- An artifact that declares a generation newer than this virtual machine
has is refused:
artifact requires VM version 8 (this VM is 7). - An artifact that calls a builtin from a newer generation than it declares
is refused:
builtin `decimal_divide_rounded` needs VM version 7, but the artifact declares 4. - An artifact that names one of the generation-7 native effects while
declaring less is refused:
effect requires VM version 7.
The compiler never produces such an artifact. The checks are there for artifacts that were damaged, edited, or produced by something else, so that the declared generation can be trusted: a host that only runs generations it has qualified can decide from the header alone.
The Rust SDK makes that decision when it loads an artifact. One that needs
a newer generation than the SDK runs is refused with CAP-SDK-VERIFY:
the artifact needs VM generation N; this SDK runs generation M.
A released generation never changes meaning
A released generation is never dropped and never changes what it means (DR-0017). A change that would alter the result of an existing artifact, its instruction count, or the outcome of a run is a new generation, recorded only by the artifacts that use it.
The rule exists because Captain's evidence depends on it. A run log or an SDK run record is replayed by running the same artifact again and comparing. If a newer release ran an old artifact differently, every retained record would stop verifying, including accepted evidence that cannot be produced again. With the rule, a newer release runs an old artifact exactly as the release that built it did, and the SDK's run records name the semantics they ran under rather than the release that produced them.
Some changes the rule has shaped:
Optionfields in JSON. Decoding JSON into a struct with anOptionfield fills it in only for artifacts that declare generation 4 or later; an older artifact keeps its old behaviour, and its runs replay unchanged.- Larger file digests.
observeFileDigestkeeps its 64 MiB ceiling. Raising it in place would have changed what admitted programs may do, so the 1 GiB form is a separate generation-7 effect,observeFileSHA256.
What each generation added
The builtin numbers are the indices in the builtin table, spec 06
Appendix A.2; captain-bytecode holds the same table in code.
Generation 1
The first frozen instruction set: stack and local opcodes, records, lists
and shapes, the arithmetic and comparison families for i32, i64,
decimals and quantities, jumps, calls, ret, effects, fail and trap,
and builtins 0 to 9 (splitting text, Text from:, list count, at: and
push:, integer and tag parsing, Json decode:as: into a named type,
per: on money, and Secret named:).
Generation 2
Staging, for planning and frontiers
(DR-0013): the stage,
frontier and parallel opcodes, which carry a block across a frontier or
fan it out over a list; each code unit's list of captured values and its
effectful bit, which the planner uses; and the manifest's list of dormant
declarations and per-entry grant demands. No artifact built today declares
less than 2.
Generation 3
Everyday text and lists
(DR-0015):
builtins 10 to 27. Text gains contains:, occurrencesOf:, replace:with:,
replaceOnce:with:, startsWith:, endsWith:, append:, size,
trimmed, lines and isEmpty; lists gain includes:, join:, at:put:,
sorted, distinct and isEmpty; and booleans not. The local file effects
writeFileText path:content:replacing:, createFileText path:content: and
listDirectory path:maxEntries: also need generation 3.
Generation 4
Octets, digests and text order
(DR-0016):
builtins 28 to 37. Octets fromHex: and fromUtf8:, hex, append:,
count, sha256, equality on octets, the unsigned encoders
Octets fromU8: to fromU64: and leb128:, and ordering of texts by code
point. Json decode:as: into a type that can reach an Option field records
generation 4, because it decodes those fields.
Generation 5
Strict JSON and file digests
(DR-0018):
builtin 38, Json decodeStrict:as:maxBytes:maxDepth:maxEntries:maxNodes:,
which refuses duplicate names and enforces explicit limits; the built-in
JsonTextObject target (a JSON object of text values, in source order) for
that decoder, and for Json decode:as: into any type that reaches it; and
the local-machine observation
observeFileDigest root:relativePath:maxBytes:, up to 64 MiB.
Generation 6
Characters and JSON targets
(DR-0019):
builtin 39, (text characters), one Unicode scalar per item; and ordinary
Json decode:as: into scalar and applied target types such as
List[Text]. Decoding into a named type keeps its earlier generation.
Generation 7
Generation 7 collects everything added after the 0.6.0 command-line tool (DR-0020 to DR-0032, and DR-0034):
- builtins 40 to 43 for octets:
utf8Lossy,at:,sliceFrom:to:andlatin1; - builtins 44 to 47 for JSON and foreign numbers:
Json members:...,Json reencodeEcma:...,EcmaNumber divide:by:andEcmaNumber fixed:digits:; - builtins 48 to 53 for exact decimals: exact
/on decimals and on quantities, anddivide:scale:rounding:andscale:rounding:on both. See Division and rounding; - builtins 54 and 55 for exact conversions:
n as: Decimal(ani32ori64, at scale 0) andn as: i64(ani32).as:to the value's own type compiles to nothing and needs no generation; - native local-machine effects:
observeFileSHA256(up to 1 GiB),readFileOctets,observeProcessandobserveProcessLiveness, bounded byte streams (openByteStream,readByteStream,hashByteStream,closeByteStream),observePath, and the mutationscreateFileOctets,createDirectories,createTemporaryDirectory,copyFile,linkFile,movePath,removeTree,setPathModeandsetPathTimes.
None of these adds an opcode or changes the bytecode format.
Generation 8 (in development)
Generation 8 is not cut: no SDK release runs it, and the Rust SDK 0.7.0 refuses an artifact that needs it. It adds:
- writing JSON, builtins 82 to 88:
#{…}literals,Json encode:,Json object:,Json nullable:andJson text:indent:maxBytes:(DR-0036). See Writing JSON;
As with every generation, only a program that uses one of these, or names one of their types where a value crosses into or out of it, needs it. A JSON document never crosses an entry or an effect in generation 8, so run records and the SDK's values are unchanged by it.
The rest of DR-0037 needs no generation at all. Conditionals that give
values compile to jumps, and collect:, select:, reject:, detect: and
inject:into: to a small pure unit that loops with the list operations
every generation has. A program that uses them records the generation it
would without them, and runs on the SDK 0.7.0:
module Book::Lengths.
export lengths text: Text -> Text [
sizes := (text splitOn: " ") collect: [ :w | Text from: (w size) ].
ret sizes join: ",".
].module Book::Ordered.
export ordered text: Text -> Text [
ret ((text splitOn: " ") sortedBy: [ :w | (w size) ]) join: " ".
].$ captain inspect lengths.capt | grep vm
compiler [..]vm 3 stripped
$ captain inspect ordered.capt | grep vm
compiler [..]vm 8 strippedlengths needs generation 3 for size and join:, as it would with
forEach: and push:; ordered needs 8 for sortedBy:.