Skip to main content

AI workflows from the CLI

The CLI is built so the friction between “I have a question / a file / a diff” and “what would my agent say?” is one command. This page collects the patterns the day-to-day shows up needing.

Quick prompts: crewship ask

crewship ask is the lowest-friction path. Resolves an agent from --agent flag → CREWSHIP_DEFAULT_AGENT env var → default-agent config → interactive picker.
Without a default agent on a TTY, crewship ask opens a huh picker listing every agent in the workspace and offers to save the choice as the new default.

Stdin piping

Three patterns, in order of locality:
When stdin is auto-detected, the data is appended after the positional prompt under a --- stdin --- separator and capped at 64 KiB. @- overrides this — the prompt is read from stdin in full and no auto-append happens.

Auto-context flags

Composable flags inject extra blocks of context into any run / ask / retry invocation. Each block is fenced with --- <label> --- and capped at 64 KiB. Examples:

Preview without sending

--dry-run and --estimate both compose the full prompt (with all --with-*, stdin, paste context) and exit before any network round-trip. Useful for review, scripting, or planning a budget.
--dry-run skips authentication and agent resolution entirely — handy on a fresh shell or for scripting offline. --estimate does the same and adds a heuristic-based token count plus list-price cost across Sonnet 4.6, Opus 4.7, and Haiku 4.5.

Multi-agent comparison

crewship ask --agents v,e,p "prompt" runs the same prompt against multiple agents in parallel. Sends concurrently (one WS connection per agent), prints sequentially under labelled === <slug> === headers.
One agent failing does not abort the others — the use case is “ask N, see who got it right.” Errors are surfaced under their own slot.

Saving responses

--save <path> tees the agent’s text response to a file. The on-disk artefact is plain markdown — no ANSI escapes — so it can be committed, piped through pandoc, or read by another tool.
The terminal continues to render the response normally, including markdown ANSI styling on a TTY. Writes are atomic: the CLI writes to a tempfile in the target’s directory and renames into place only when the stream completes successfully. A Ctrl-C or stream error mid-run leaves the previous file (or no file) intact rather than half-overwritten.

Markdown rendering

Streamed agent output is line-buffered through a small markdown renderer that highlights headings, bold, italic, inline code, fenced blocks, lists, links, and block quotes — without ever waiting for a complete document. Inline span delimiters are line-scoped, so partial chunks arriving over the wire never produce broken output.

Recall + history

When you can’t remember what you ran, ask the journal:
crewship retry <run-id> re-runs a previous run (recovers the original prompt from the chat). Add --continue to append to the same chat instead of starting a new one. crewship copy-prompt <run-id> recovers the original prompt without running anything. Use it for tweak-and-rerun loops:
crewship explain <run-id> asks the default agent to summarize what happened in a run by feeding it the journal entries scoped to that run’s agent + start window. Useful for “why did this fail?” lookups without scanning logs by hand.

Live observation: crewship watch

crewship watch is the top-level alias for journal --follow — shorter to type for the most-common live-observation workflow.
Opens an SSE connection to /api/v1/journal/stream. Prints entries in the same format as the listing. Reconnects with bounded backoff (1 s → 30 s cap) and threads Last-Event-ID so a brief disconnect resumes without dropping or duplicating entries. Press Ctrl-C to exit.

Cost awareness

Single-screen view: total $, top spenders by scope, per-crew rollup, active subscription plans. For full-fidelity rollups by crew/agent/mission, see crewship paymaster.

Run forensics: inspect, explain, export

Three complementary windows on a past run:
inspect is a fast deterministic timeline (events, costs, tool calls, errors). explain adds an agent-written summary. export produces ./run-r_abc/ with prompt.md, response.md, messages.json, journal.json, timeline.txt, and run.json — one stop for handoffs or post-mortems.

Prompt library

A local, server-free knowledge base of reusable prompts kept in ~/.crewship/prompts/<name>.md:
Hybrid CLI/web workflow — jump from terminal to the right web page:

Auto-refresh: --watch

Several list-style commands accept --watch <duration> to redraw on a timer (Ctrl-C to exit):

Filtering with jq: --filter

Most JSON-emitting commands accept --filter '<jq-expr>' so you don’t need a shell pipe just to extract one field. jq must be installed; the filter is silently bypassed otherwise.

Interactive REPL: crewship shell

crewship shell opens an interactive REPL where each typed line is a prompt to the default agent. Slash-commands (/agent <slug>, /plan, /effort, /think, /quit, …) control session state, and @-prefixed tokens inline file content.
crewship shell drives the agent through prompts, not a raw shell inside its container. To observe a running container directly, use:

Health: doctor, lint, config validate

Tab completion for agent slugs

crewship run, crewship logs, and crewship agent get provide dynamic shell completion: tab on the agent argument fetches available slugs from the API. Set up shell completion once with crewship completion bash|zsh|fish|powershell.