Captain is a language for programs that are checked before they run: operations whose every effect is known, planned and approved before it happens, and calculations with exact numbers whose results can be audited later.
What it is
Captain's main author is, more and more, a machine. Coding agents write Captain programs, and people read them, review the plans they produce and approve those plans by their digest. So Captain favours what makes a program safe to approve without having written it: explicit rules, visible boundaries, one obvious way to write each thing, and a checker built to catch what a reviewer would miss.
It has two strengths, and both are first-class:
- Operations you can approve. Every effect a program can have is declared, and the
checker computes which effects each procedure can have.
captain planruns the program against a host that never acts, and renders every effect it would perform, with its arguments, as a plan. - Calculations you can audit. A pure entry has no effects at all. Its numbers are exact decimals, its result is deterministic, and the same inputs always give the same result, byte for byte, on every machine.
What it does
Operations
- Every effect is declared, and a program reaches the world only through its effects.
captain planrenders every effect a program would perform before any of them happens.- A plan has a digest. Approving it mints the grants that destructive steps demand, and running under the approval refuses if anything has changed.
- Every run writes a run log, and
captain replayre-executes the program against that log alone. - Secrets are supplied when a program runs, never written into it.
Infrastructure
- A program can make servers through a cloud provider's API and then set them up over SSH, in one language and one plan.
- Over SSH, a server needs
sshdand nothing of Captain. Only the effects cross to it; the program runs on your machine. parallelDo:runs one block per server, with results always in the order given.- An effect that destroys something demands a grant that only an approved plan can mint.
A command that might do anything,
execorshell, is marked in the plan as weaker than a typed effect, and needs--allow-execto run.
Calculations
- No floating point. A
Decimalkeeps every digit, and/is exact or fails. - Digits are dropped only where the program names a scale and a rounding mode.
- Quantities carry their units, so a percentage can't be added to a duration.
- A run record proves later which program, which inputs and which result.
The toolchain
- One command,
captain, holds the checker, the compiler, the inspector, the planner, the virtual machine, the run-log replayer and a language server for editors. captain buildcompiles source into one artifact, a.capbfile of bytecode and a manifest of what the program offers and needs. Builds are deterministic, so an artifact's SHA-256 identifies the program exactly.- The checker refuses a program with a stable diagnostic code and a suggested fix.
Where it runs
The captain command line runs programs on your machine, and over SSH on your servers.
Rust software can run pure Captain entries through the Captain SDK.
Other Frogfish systems run Captain programs too, each admitting the effects it supports and running them the same way, checked first:
- Mate: every command at its prompt is a Captain program.
- Fleet: the software it installs on servers is written in Captain.
- Forge build recipes, Bosun project tasks, and apps and workers on Gump.
What it is not
- Not a general-purpose systems language. No pointers, no threads, no foreign-function interface.
- Not dynamic. No open records, no values that skip the checker, no
eval. - Not floating point. Numbers are integers, exact decimals and quantities with units.
- Not a configuration format. A Captain program is code, with procedures, control flow and types.
Getting it
- Captain is the Gritpack package
@frogfish/captain, for Linux x86-64 and macOS arm64. - Released formats and VM generations are never dropped: a program built for an older generation keeps running.
- Official binaries are licensed by Frogfish LLC under the Frogfish Binary License 1.0.