The pure profile runs Captain code and nothing else. The SDK's other profiles go the other way: they run one native program, and run no Captain code at all. They exist so that a host can start a process under the same discipline Captain applies to its own effects: a frozen request, an explicit admission, finite limits, a closed set of outcomes and a record that can be verified later.
This chapter is an overview. Each profile has its own contract, linked at the end, and those contracts are the authority on every detail.
What these profiles are not
They are not a sandbox, and they say so. Captain's API offers no shell, no
PATH lookup of its own, no inherited environment and no secret injection.
But the program it starts is an ordinary process: it can use the file
system, the network, credential files and sockets, with every authority of
the account the host runs as. The contracts list each dimension as
Enforced, Denied, Unsupported or Unenforced, and file-system,
network, memory and escaped-descendant containment are Unenforced. A
consumer that needs a hostile build contained needs a stronger isolation
contract, such as a Forge build (Forge).
captain.local-process/1: one exact executable
This profile runs one directly invoked native executable. A request names everything the process will get:
- an opaque caller binding, bytes the host uses to correlate the run with its own action; Captain keeps them exactly and never interprets them;
- the executable, by path and by the digest observed of its content;
- the arguments, as exact byte strings, with no quoting or splitting;
- an execution root, and a working directory relative to it (
.is the root itself); - an explicit, closed environment; nothing is inherited;
- stdin, which is closed in this version;
- limits: wall time, captured stdout and stderr bytes, and the record's size.
The request then passes through separate states, and only the last one starts anything:
ProcessProfile::load_verified
-> ProcessRequest
-> ProcessPlan frozen, identified; performs nothing
-> PreflightReport observes the host and the executable; spawns nothing
-> ProcessAdmission the host's policy decision; used once
-> ProcessExecution + run recordAdmission is the host's. A plan, a preflight report, an executable digest or a run record is not authority to run anything. The admission binds the exact plan, policy and preflight, has no public constructor, cannot be serialised for reuse, and is consumed by one attempt. Just before spawning, the SDK checks the executable's content again; a changed binary is refused.
The SDK's example,
examples/local_process_consumer.rs,
goes through every state. In outline:
let profile = ProcessProfile::load_verified()?;
// ... build `request` from the observed executable, root, arguments, environment and limits
let policy = HostProcessPolicy::for_exact_request(&request)?;
let plan = profile.plan(request, &policy)?;
let retained_plan = plan.verification_artifact().canonical_bytes().to_vec();
let preflight = profile.preflight(&plan, &policy)?;
let admission = preflight.admit(&profile, &plan, &policy)?;
let execution = execute_process(&profile, &plan, &admission, &CancellationToken::new());
let verification_artifact = ProcessVerificationArtifact::decode(&retained_plan)?;
verify_process_run_record_with_artifact(&verification_artifact, &execution.run_record)?;The example's own comment is the rule for agent-facing hosts: the policy object belongs to the host, and a tool offered to a language model must never let model output construct one. The contract (§14) requires any such projection to narrow authority to an admitted catalogue entry: an exact executable, an argument schema, a root, permitted environment values and limits.
Hosts
Two host adapters are qualified, each with its own identity:
- macOS 14 or newer on arm64, admitting native arm64 Mach-O images;
- Linux x86-64, kernel 7.0 or newer and glibc 2.39 or newer, admitting dynamically linked ELF64 x86-64 images.
Scripts and unknown executable formats are refused before spawn, so the operating system's fallback of running an unrecognised file through a shell can never happen. Windows is not supported.
Outcomes
Every attempt ends in exactly one of:
| Outcome | Means |
|---|---|
Completed |
the process ran and ended; its exit status and complete stdout and stderr are recorded. A non-zero exit is Completed: whether it was a success is the host's decision |
FailedBeforeStart |
the process never started, so nothing it would have done happened |
UnknownAfterStart |
it started, and its end is not fully known: a timeout, a cancellation, output over its limit, a lost wait. It records how far termination was confirmed and the output prefix, marked partial |
Rejected |
the request or the admission was refused: invalid, denied by policy, stale, a changed executable, an unsupported host |
An UnknownAfterStart attempt is never retried automatically: the process
may have changed something before it was stopped.
Verifying later
A host can keep plan.verification_artifact().canonical_bytes() and later
verify a run record against it with
verify_process_run_record_with_artifact, without rebuilding the plan. The
artifact's digest proves integrity, not origin: if the evidence could be
replaced, keep or authenticate its identity separately.
Developer commands: captain.command-resolution/1 and captain.local-process/2
Developer tools are rarely invoked by absolute path. cargo is found on a
PATH, and is often a link to another program. The command profiles make
that lookup explicit and checkable:
CommandResolutionRequest
-> ResolvedCommand checked; not authority
-> LocalProcessRequest v2
-> plan / preflight / admission
-> execution + run recordA CommandResolutionRequest holds the literal program token, a mode
(Absolute, WorkingDirectoryRelative or PathSearch), the exact PATH
bytes to search (frozen into the request, never read from the environment),
and the working directory. Resolution:
- tests
PATHentries in order, and stops at the first candidate that exists. If that candidate is a directory, a script, not executable or not a supported native image, resolution fails: it never falls through to a later entry; - follows symbolic links, recording each link and its exact target bytes, up to 32 links, refusing loops and dangling links;
- records the final native target and the digest of its bytes.
captain.local-process/2 runs the checked native target directly, with the
original token as argv[0], so a cargo that links to another program
still receives cargo as its name. Just before spawning, every recorded
fact is checked again; a change is refused and recorded as a
resolution mismatch.
captain.authenticated-command-evidence/1
This profile runs nothing. It turns a retained verification artifact and a command run record into one owned, typed projection of the facts a higher-level tool needs: who asked (the caller binding), what ran, how it exited, its stdout and stderr and whether they are complete, its limits, and the identities linking it all.
verify_authenticated_command_evidence(artifact, run-record bytes) -> AuthenticatedCommandEvidence"Authenticated" has a narrow meaning here: every fact was decoded from canonical bytes whose identities and references all check. It is not a digital signature, a trusted timestamp or proof of where the run happened, and it does not decide whether the command's result was good. Those judgements belong to whoever consumes the evidence.