Skip to content

flowforge run

flowforge run is the binary equivalent of dispatching a slash command from inside Claude Code. It locates the project root, resolves the command identifier to a markdown file under commands/flowforge/, extracts the bash blocks from that file, and executes them in a child shell. The entire FlowForge slash-command catalog is available through this single subcommand.

Terminal window
flowforge run <command> [args...]

<command> is required. Additional positional arguments are forwarded to the command body as a space-joined value of the ARGUMENTS environment variable.

flowforge run replaces the legacy run_ff_command.sh helper. It walks up from the current directory to find the FlowForge project root, identified by either a .flowforge/ directory or a commands/flowforge/ directory. From that root it converts the colon-separated command id to a relative path under commands/ and reads the corresponding markdown file:

Command idResolved path
flowforge:session:startcommands/flowforge/session/start.md
flowforge:dev:statuscommands/flowforge/dev/status.md
flowforge:helpcommands/flowforge/help.md

In FlowForge’s own repository every command lives under commands/flowforge/, so the flowforge:-qualified form is what actually resolves. Other projects that consume FlowForge may install commands under different top-level namespaces.

Inside the markdown file, the binary scans for fenced code blocks beginning with the literal line ```bash and ending with ```. Every line strictly between those fences is concatenated into a single bash script; everything else (prose, headings, non-bash code blocks) is ignored. Execution is performed by spawning bash -c <script> with the project root as the working directory and os.Stdin, os.Stdout, and os.Stderr wired through. The full parent environment is inherited and ARGUMENTS is appended.

This means slash commands written for Claude Code work unchanged from the binary, and the binary in turn is the recommended way to script FlowForge workflows from CI, makefiles, and shell aliases.

The path is sanitized before use: flowforge run ../escape is rejected because the cleaned path would not begin with the commands directory. Four legacy command forms are intercepted with a migration message: startsession and its flowforge:-qualified variant flowforge:startsession both redirect to flowforge run flowforge:session:start, and endday and flowforge:endday both redirect to flowforge run flowforge:session:end.

PositionNameRequiredDescription
1commandyesColon-separated command id (flowforge:session:start, flowforge:dev:checkrules, flowforge:agent:manage). Mapped to a markdown file relative to the project’s commands/ directory.
2..Nargs...noTrailing positional arguments. Joined with single spaces and exported as ARGUMENTS to the child bash.

None at the subcommand level. Cobra’s standard --help flag is available.

VariableDirectionPurpose
ARGUMENTSexported to childSpace-joined trailing arguments. Slash commands typically read this with ${ARGUMENTS:-} and use it for ticket ids, options, and the ?/help argument convention.
DEBUGinheritedMany slash commands switch to set -x when DEBUG=1. Pass it through with DEBUG=1 flowforge run ....
TMUXinheritedSlash commands that delegate to tmux features check this.

The full parent environment is inherited; the binary appends but does not strip variables.

Start a tracked session for ticket 14:

Terminal window
flowforge run flowforge:session:start 14

The trailing 14 becomes ARGUMENTS=14 in the child shell, which the command body reads to identify the ticket.

Show the project status:

Terminal window
flowforge run flowforge:dev:status

Show project status with debug tracing:

Terminal window
DEBUG=1 flowforge run flowforge:dev:status

Check a single FlowForge rule rather than the full sweep:

Terminal window
flowforge run flowforge:dev:checkrules 3

Inspect what flowforge run does by passing the help convention through:

Terminal window
flowforge run flowforge:session:start ?

Most FlowForge commands respond to ? or help as the first argument by printing a usage block and exiting 0.

flowforge run propagates the exit code of the child bash. If the command file cannot be located, the path is unsafe, or extraction yields no bash content, the binary exits non-zero with a descriptive error before invoking bash.

CodeMeaning
0The script ran to completion with status 0.
1Project root not found, command file missing, path traversal attempted, or no bash code blocks present.
OtherForwarded from the child bash via os.Exit(exitErr.ExitCode()).

flowforge worker is a hidden internal subcommand invoked by the TUI controller when it spawns a new tmux window. It is not intended for direct user invocation; it is documented here for completeness even though it is hidden from flowforge --help output (Hidden: true in cmd_worker.go).

Terminal window
flowforge worker

The worker validates the TMUX environment variable, prints FlowForge worker ready to stdout, and exits. Future versions implement the full worker event loop. Running flowforge worker outside tmux fails with not inside a tmux session (TMUX env var is not set). There are no flags or arguments. End-users should always go through flowforge tui.