A local-first multi-agent app development platform, built on PenguinHarness
The CLI becomes a thin client of the server, and agents get a local control plane
- Date: 2026-08-25
- Type: feature
- Scope:
cli,server,core,web,docs - PR: #466
penguin run and penguin chat were rebuilt on the server API — the CLI now parses
arguments, sends HTTP/SSE requests, and renders the streamed OmniMessages, while the task
itself executes on the server. Everything the CLI creates shows up in the Web App and vice
versa, and a new command family lets agents inside PenguinHarness drive the harness through
the CLI: list sessions, send messages into them, follow logs, create agents, and query
costs and schedules. A CLI talking to the local machine's server needs no login.
The command surface
penguin run -m <msg> [--project-id] [--agent-id] [--workspace] [--model-id --provider]
[--approve] [--thinking] [--session <id>] [--background] [--timeout <dur>]
[--goal [budget]] [--json] [--server <url>]
penguin chat [--project-id] [--agent-id] [--workspace] [--model-id --provider] [--approve]
[--thinking] [--resume [id]] [--verbose] [--server]
penguin ls [--project-id] [--agent-id] [-a|--all] [--days <n>] [--json] [--server]
penguin input [session_id] [-m <text>] [--timeout <dur>] [--project-id] [--agent-id]
[--json] [--server]
penguin logs [session_id] [--tail <n>] [-f|--follow] [--timeout <dur>] [--project-id]
[--agent-id] [--json] [--server]
penguin agent ls|create ...
penguin project ls
penguin cost [--days <n>] [--from --to] [--by date|agent|model|session] ...
penguin schedule ls|add|update|rm ...
runcreates a session (or reuses--session— a full id or any unique fragment, such as the 8-hex tailpenguin lsprints), posts the task, renders the stream to the stats line, and exits 0 on completed (goal runs exit 0 only oncomplete).--backgroundreturns the session id immediately;--jsonprints a final{sessionId, status, text}.inputsteers a running session and starts a task on an idle one;logs -ffollows the live stream read-only.--project-id/--agent-iddefault toPENGUIN_PROJECT_ID/PENGUIN_AGENT_ID, thendefault_project/default_agent.
Connection and authentication
- Resolution order:
--server>PENGUIN_API_URL> a liveserver.lockat the data rootauto-start (a detached
node <cli> serverwithPORT=0, logging to<root>/logs/server-auto-<date>.log; the loser of a concurrent spawn race exits and both CLIs attach to the winner's lock). - The server mints a local API token every boot and writes it to
<root>/api-token(0600).authMiddlewareaccepts it asAuthorization: Bearer(constant-time compare) and authenticates the caller as the built-in admin — on SSE endpoints too. The CLI readsPENGUIN_API_TOKEN, else the file (loopback targets only; a 401 re-reads it once); a remote--serverwithoutPENGUIN_API_TOKENis refused with instructions. - The authorization model is deliberate: local filesystem access to the data root already
is admin authority — the
penguin server reset-admin-passwordrule. An earlier on-disk token was removed over exactly this property; that objection is reversed on purpose, because agents driving their own server through the CLI is the feature.
Control env injection
Server-driven sessions inject into every tool subprocess: PENGUIN_API_URL (the server's
own canonical base URL), PENGUIN_API_TOKEN (the current boot token),
PENGUIN_PROJECT_ID, PENGUIN_AGENT_ID, PENGUIN_SESSION_ID. The seam is
CreateAgentOptions.controlEnv, a policy getter mirroring proxyEnv: core binds it to
each Session's own coordinates and re-evaluates it at every spawn; injected entries
override vault entries of the same name; subagent sessions evaluate it with their own ids;
SDK/CLI-direct embedding without the option injects nothing.
Agent-side ergonomics
- Caller-context defaults: inside a harness agent (
PENGUIN_SESSION_IDpresent), a session created byrun/chatdefaults each unspecified field to the calling session's live values (GET /api/sessions/$PENGUIN_SESSION_ID) — Workspace, the model pair, approval mode and thinking level — the same inheritancerun_subagentapplies to spawned children. Per field: explicit flag > caller value > plain fallback; a failed lookup warns (dim) and falls back; outside an agent nothing changes. --timeout <duration>soft yield onrun(non-background),inputandlogs -f: wait up to the budget (30s/5m/2h, or bare seconds), then detach cleanly — exit 0, a dim still-running line with the session id (status: "running"under--json) — while the task keeps running server-side, mirroring the command tools' yield-window semantics. No flag = wait indefinitely.- Bare
penguin input <session>(no-m) polls: prints the session's most recent complete assistant text (an idempotent last-answer snapshot; thinking and tool output skipped), mirroringinput_subagent's empty-prompt semantics — nothing queued, nothing steered. A running session is waited on silently (bounded by--timeoutwhen given); still running at expiry prints the current latest text plus the still-running note. --timeout 0replacesinput --no-wait(the surface was unreleased): the one timeout knob covers "don't wait" — deliver, then return immediately with the still-running note ({sessionId, status: "running"}under--json);run --timeout 0behaves the same for symmetry, whilerun --backgroundstays the idiomatic fire-and-forget for new tasks (bare session id for scripts).penguin ls --days <n>: only sessions last active within the trailing n calendar days (today counts as day 1 —cost --dayssemantics); combines with-aand--json.penguin schedule add|update|rm <name>: a validated writer over the schedules API — the API writes the TOML file, which remains the single source of truth (the model-config/vault pattern), and API errors surface verbatim for synchronous validation. Target is--session-idXOR the new-session form;--start-at nowmeans the current instant. One deliberate divergence:adddefaults to enabled (--disabledopts out; the raw file's enabled=false default stays for hand edits);updateis read-modify-write;rmdeletes without prompting.- The session id is optional on
inputandlogs: omitted, it means the agent's most recent session — the defaultchat --resumealready carried, off the same newest-first listing — announced as a dim[latest]line on stderr, so the target is never ambiguous and--jsonon stdout stays parseable. Barepenguin logsis therefore "what just happened" and barepenguin inputis "what did my agent last say";--agent-idpicks whose. An agent with no session at all gets one line pointing atpenguin run/penguin chat, and a non-zero exit. - The
penguin-orchestrationskill tracks the surface: the shipped skill's command block and its session-targeting notes now carry the optional session id oninput/logsand the--agent-idthat picks whose (skill version 2).
Argument errors speak the interface language
A command typed wrong prints one localized line — missing argument, missing required
option, unknown option, mistyped command — followed by that command's own usage and a
pointer at its --help, in place of commander's raw English. Exit codes stay commander's.
The ExperimentalWarning: SQLite is an experimental feature that Node raises while the
CLI's module graph loads is filtered at the entry point, on the packaged binary and the
development run alike; every other warning still prints.
The CLI-session toggle is retired
Sessions created through the API now carry a client hint ("cli" from the CLI, default
"web"), stored on the existing column as provenance only — list endpoints stopped
filtering by client, and the cli=1 query parameter, the showCliSessions preference and
its settings toggle were removed. Legacy CLI-direct traces are adopted once per server
boot by a startup sweep; see
backward compatibility.