Skip to content

CLI commands

All commands take a workflow reference as their directory argument: a filesystem path, or a bare name resolved against <cwd>/darkf/<name> first, then <darkf>/workflows/<name>.

darkf/ (no dot) is where your own workflow config lives — commit it. .darkf/ (dot-prefixed) is a different directory entirely: darkf’s own runtime/run-storage, gitignore it wholesale.

darkf render <dir>

Prints the workflow’s mermaid stateDiagram-v2 to stdout. Never executes anything.

darkf run <dir> [message]

Runs the workflow in-process, blocking until it finishes. message overrides the workflow module’s own input export, becoming { output: { message } } for the first dispatch. Prints each dispatch’s event, the final status, and the journal path. Writes .darkf/last-run.mmd.

darkf start <dir> [message]

Launches the workflow as a detached worker (survives the launching process exiting) and returns immediately. Prints {"runId", "pid"} as JSON. Exits 1 if the worker dies during its own startup.

darkf status [--run <runId>]

Reads the journal for the given run and prints a digest: current node, visit counts, any crash reason, elapsed/runtime. While a node is waiting out a provider usage limit, the digest also carries a warn: usage limit — probe N/48, next attempt in Xm line. Without --run, resolves to whichever run is currently cached as running — once a run has finished, pass its id explicitly (exit 7, “nothing to monitor”, names the most recent finished run as a hint if omitted).

Exit codeMeaning
0succeeded
1crashed
2orphaned — worker PID gone, journal has no terminal marker
3running
4no such run for the given --run
5ambiguous — multiple runs cached as running; pass --run
7nothing to monitor

darkf monitor [--run <runId>] [--window <seconds>] [--once]

Tails the journal, printing each new transition as it’s written, until the run finishes, --window elapses (default 30s), or --once is set. While a node waits out a provider usage limit, the wait line re-prints each time the probe count advances. Returns 6 (“still running”) if the window elapses or --once is passed without the run finishing; otherwise the same exit codes as status.

darkf report [--run <runId>]

Prints a full dispatch timeline (state, duration, outcome per step), visit counts, crash reasons, and a token/cost summary if any agent dispatch wrote a usage sidecar. Works on any resolvable run, finished or not — but, like status, needs --run <runId> once that run is no longer cached as running.

darkf doctor

Environment checks, no target argument: the claude/opencode binaries are on PATH, the current working directory isn’t inside the darkf checkout itself, and it’s inside a git repo (every run’s artifacts live under .darkf/ in whatever directory you invoke from — this catches running from somewhere that isn’t actually a project). Also reports the state of the bundled darkf-* skills for every known harness (claude, opencode, codex, gemini, cursor): ok, missing, or differs for a present harness, harness not present for an absent one. Writes nothing — fixing skill drift is always darkf setup. Exits 0 if every check passes, 1 otherwise.

darkf validate <ref>

Workflow checks, no environment: the workflow resolves, workflow.ts loads, it exports workflow and (if needed) agentRunner, and the state graph structure validates. Exits 0 if every check passes, 1 otherwise.

darkf setup

Installs the bundled darkf-* skills (darkf-usage, darkf-writing-workflows) into every detected skill host’s skills dir (claude, opencode, codex, gemini, cursor — detected by its skills dir existing or its binary being on PATH, creating the dir when needed). Writes only inside the darkf-* namespace: a missing copy is installed, a stale one is replaced, so the installed dir always mirrors what the package ships — local edits to a darkf-* skill do not survive a setup. Foreign skill dirs are never touched. Re-running a converged setup is a no-op. Takes no flags. Exits 0 on success, 1 if a copy failed.

darkf workflows

Lists every workflow darkf can resolve by bare name, from both <cwd>/darkf/ and the darkf package’s own workflows/, tagged workspace or built-in.