The wetware kernel (pid0) provides two runtime modes, selected
automatically based on whether standard input is a terminal.
When ww run detects a TTY on stdin it sets WW_TTY=1 in the guest
environment. The kernel starts a Clojure-inspired Lisp REPL:
/ ❯ (perform host :id)
"00240801122025c7ea..."
/ ❯ (perform executor :echo "hello")
"hello"
/ ❯ (exit)
Every expression is an S-expression. Effects use the perform form:
the first argument is the capability, the second is a keyword naming
the method, and the rest are arguments:
(perform capability :method [args...])
Strings are double-quoted. Symbols are bare words. Comments start with
; and run to end of line.
| Method | Example | Description |
|---|---|---|
id |
(perform host :id) |
Peer ID (hex-encoded) |
addrs |
(perform host :addrs) |
Listen multiaddrs |
peers |
(perform host :peers) |
Connected peers with addresses |
connect |
(perform host :connect "/ip4/1.2.3.4/tcp/2025/p2p/12D3...") |
Dial a peer |
| Method | Example | Description |
|---|---|---|
echo |
(perform executor :echo "hello") |
Diagnostic echo (round-trips through RPC) |
| Method | Example | Description |
|---|---|---|
cat |
(perform ipfs :cat "/ipfs/QmFoo...") |
Fetch IPFS content (UTF-8 or byte count) |
ls |
(perform ipfs :ls "/ipfs/QmFoo...") |
List directory entries |
IPFS methods pipeline through the UnixFS sub-API of the
Ipfs.Client capability on the session.
| Command | Description |
|---|---|
(cd "<path>") |
Change working directory |
(help) |
Print available capabilities and methods |
(exit) |
Terminate the kernel |
Any command that is not a known capability or built-in triggers a PATH
lookup. The kernel scans each directory in PATH (default: /bin) for
two candidates in order:
<dir>/<cmd>.wasm— flat single-file binary<dir>/<cmd>/main.wasm— image-style nested binary
The first match wins. The bytes are passed to executor.runBytes().
Standard output is captured and printed; the exit code is reported on error.
/ ❯ (my-tool "arg1" "arg2")
This looks for /bin/my-tool.wasm or /bin/my-tool/main.wasm in the
image filesystem. The nested form lets a command be a full FHS image
directory with its own boot/, etc/, etc.
When stdin is not a terminal, the kernel enters daemon mode:
- Grafts onto the host membrane and obtains a session
- Logs a JSON readiness message to stderr:
{"event":"ready","peer_id":"0024080112..."} - Blocks on stdin until the host closes it (signaling shutdown)
- All stdin data is discarded; no interactive input is processed