Skip to main content

CLI

The ForkFlux CLI manages the API server, database migrations, roles, agents, API tokens, and jobs.

Use this page as a command reference when you need to operate ForkFlux manually. If you want the shortest path to a working demo, start with the Quickstart guide.

Running the CLI

Run the CLI without installing it into your current Python environment:

uvx --from forkflux forkflux --help

You can also install forkflux via pip into an environment and run:

forkflux --help

Server and setup commands

forkflux serve

Runs database migrations, then starts the ForkFlux API server.

uvx --from forkflux forkflux serve [OPTIONS]
OptionTypeDefaultDescription
--hostTEXT0.0.0.0Host interface for the API server to bind to.
--portINTEGER8000Port for the API server to listen on.

Examples:

uvx --from forkflux forkflux serve
uvx --from forkflux forkflux serve --host 127.0.0.1 --port 9000

Use this command when you want to run the API locally. MCP clients typically connect to the API base URL ending in /api/v1, for example http://127.0.0.1:8000/api/v1.

forkflux init

Initializes the database by applying migrations.

uvx --from forkflux forkflux init

Arguments: none.

Options: only --help.

Use this command before manually creating roles or agents when you do not want to start the API server yet.

SQLite database storage

When no DATABASE_URL environment variable or .env entry is set, ForkFlux uses SQLite with automatic path resolution:

PriorityPathDescription
1./.forkflux/forkflux.dbLocal database in the current working directory.
2Global data directoryPlatform-specific path (e.g. ~/Library/Application Support/forkflux/forkflux.db on macOS).

forkflux serve and forkflux init auto-detect the database: if a local database exists it is used, otherwise the global path is checked. If neither exists, a new database is created at the local path.

forkflux quickstart --scope influences database resolution when no explicit DATABASE_URL is set, but it does not unconditionally force a specific path for the user scope:

ScopeDatabase path
local (default) / project./.forkflux/forkflux.db
userAuto-detected: local path if it exists, otherwise global path if it exists, otherwise local path for a fresh install.

For local and project scopes the database is always created at the local path. For user scope the same auto-detection logic as serve and init applies (see above), so a fresh user-scope install creates the database at the local path, not the global path.

To use PostgreSQL or a custom SQLite path, set the DATABASE_URL environment variable. The scope option does not override an explicit DATABASE_URL.

forkflux quickstart

Initializes a demo environment with database migrations, example roles, example agents, workflow helpers, and MCP server registrations for supported local assistant CLIs.

uvx --from forkflux forkflux quickstart [OPTIONS]

Arguments: none.

OptionTypeDefaultDescription
--scope / -sCHOICElocalConfiguration scope for MCP server registrations and skill installations. Accepted values: local, project, user.

The --scope flag controls where the MCP server registration is stored, where workflow skills are installed, and influences SQLite database resolution (when no explicit DATABASE_URL is set):

ScopeMCP server configSkills installation pathDatabase path
localCurrent working directory only (private, not shared).Current directory (e.g. .agents/skills, .claude/skills)../.forkflux/forkflux.db
projectProject-level config, shared with repository collaborators.Current directory (e.g. .agents/skills, .claude/skills)../.forkflux/forkflux.db
userUser-level global config, available across all projects.Home directory (e.g. ~/.agents/skills, ~/.claude/skills).Auto-detected: local path if it exists, otherwise global path if it exists, otherwise local path for a fresh install.
note

Hermes does not support scoped skill installation. When Hermes is detected, skills are always installed to Hermes's default location regardless of the --scope value. The scope still applies to MCP server config and database path resolution for Hermes as shown above.

Examples:

uvx --from forkflux forkflux quickstart
uvx --from forkflux forkflux quickstart --scope user
uvx --from forkflux forkflux quickstart -s project

The command checks for supported assistant CLIs: Codex, Claude Code, OpenCode, and Hermes. At least two supported CLIs must be installed for the automated demo setup.

The quickstart flow creates:

ResourceValue
Roledeveloper / Developer
Roleqa / QA
Agentagent-1 with role developer
Agentagent-2 with role qa
caution

forkflux quickstart modifies local assistant CLI configuration and installs ForkFlux workflow helpers for supported tools. Use it for local demos and evaluation, not production setup.

forkflux stats

:::warning Deprecated

This command is deprecated. Use the ForkFlux dashboard or MCP tools instead.

:::

Shows a handoff metrics snapshot for a configurable time window.

Use this command to quickly assess delivery health, queue pressure, and latency trends without querying the database directly.

uvx --from forkflux forkflux stats [OPTIONS]

Arguments: none.

OptionTypeDefaultDescription
--window-hoursINTEGER24Metrics lookback window in hours. Must be at least 1.
--stuck-minutesINTEGER60Threshold (minutes) used to classify active jobs as stuck. Must be at least 1.
--verboseFLAGFalseShows legacy all-time status counters in an additional table.

Examples:

uvx --from forkflux forkflux stats
uvx --from forkflux forkflux stats --window-hours 72 --stuck-minutes 30 --verbose

The command prints rich tables with the following sections:

SectionWhat it shows
Pipeline HealthTotal jobs in the window, completion rate, failure rate, blocked rate, and number of active agents.
Workflow ImpactTotal handoffs and estimated cumulative time saved.
Latency (p50 / p90)Median and tail latencies for time-to-claim and time-to-resolution.
Active Queue SnapshotCurrent counts for published, in_progress, and blocked, plus stuck-job count.
Historical (All-time Status Counters)Added only with --verbose; total counters by job status across all time.

Operator notes:

  • The Published (waiting) row appends a bottleneck hint when one role dominates waiting jobs.
  • High stuck-job counts usually indicate assignment imbalance, blocked dependencies, or missing agent capacity.

Job commands

:::warning Deprecated

All job management CLI commands (forkflux job *) are deprecated. Use the ForkFlux dashboard or MCP tools instead.

:::

Job commands are grouped under forkflux job. A job is a structured handoff record with a lifecycle status, target role, context payload, and optional artifacts.

forkflux job change-status

Changes a job's lifecycle status on behalf of an agent.

uvx --from forkflux forkflux job change-status [OPTIONS] JOB_ID STATUS AGENT_ID
ArgumentTypeRequiredDescription
JOB_IDINTEGERYesNumeric job ID to update.
STATUSCHOICEYesNew status. Accepted values: published, in_progress, blocked, unblocked, completed, failed, cancelled.
AGENT_IDINTEGERYesNumeric ID of the agent performing the status change.
OptionTypeDefaultDescription
--failure-reasonTEXTnoneOptional explanation for failed work.
--blocked-reasonTEXTnoneOptional explanation for blocked work.
--unblock-reasonTEXTnoneOptional explanation for unblocked work.

Examples:

uvx --from forkflux forkflux job change-status 42 in_progress 2
uvx --from forkflux forkflux job change-status 42 completed 2
uvx --from forkflux forkflux job change-status 42 failed 2 --failure-reason "Acceptance tests are blocked by missing credentials."

Use lifecycle statuses according to the intended outcome:

StatusUse when
completedThe receiving agent completed the work and met the acceptance criteria.
failedThe receiving agent cannot complete the work because of an unrecoverable issue.
cancelledThe user or workflow explicitly abandoned the work.
blockedThe receiving agent cannot proceed temporarily due to an external dependency or environment issue. Use --blocked-reason to explain the blocker.
unblockedThe blocker has been resolved. Use --unblock-reason to explain what changed, then transition back to in_progress to resume execution.

Manual setup example

info

The role, agent, and job management commands referenced in this example are deprecated. Initialize the database with forkflux init, then create roles, agents, and tokens through the ForkFlux dashboard UI or MCP tools instead.

This sequence initializes ForkFlux and starts the API server:

uvx --from forkflux forkflux init
uvx --from forkflux forkflux serve