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.

Role commands

:::warning Deprecated

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

:::

Role commands are grouped under forkflux agents-role. A role defines the type of work an agent can target or receive, such as developer, qa, frontend, or reviewer.

forkflux agents-role list

Lists all registered target roles.

uvx --from forkflux forkflux agents-role list

Arguments: none.

Options: only --help.

Output includes each role key and label.

forkflux agents-role add

Creates a new target role.

uvx --from forkflux forkflux agents-role add ROLE_KEY ROLE_LABEL
ArgumentTypeRequiredDescription
ROLE_KEYTEXTYesStable machine-readable key used by jobs and agents.
ROLE_LABELTEXTYesHuman-readable role name shown in CLI output.

Options: only --help.

Examples:

uvx --from forkflux forkflux agents-role add developer Developer
uvx --from forkflux forkflux agents-role add qa "Quality Assurance"

Use a concise lowercase key for ROLE_KEY because agents and jobs reference this value.

forkflux agents-role delete

Deletes a target role by key.

uvx --from forkflux forkflux agents-role delete ROLE_KEY
ArgumentTypeRequiredDescription
ROLE_KEYTEXTYesRole key to delete.

Options: only --help.

Example:

uvx --from forkflux forkflux agents-role delete qa

The command asks for confirmation before deleting. ForkFlux refuses to delete a role while agents or other records still use it.

Agent commands

:::warning Deprecated

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

:::

Agent commands are grouped under forkflux agent. An agent represents an assistant identity that can authenticate to ForkFlux. Assign one or more roles to the agent before it receives role-targeted work.

forkflux agent list

Lists all registered agents.

uvx --from forkflux forkflux agent list

Arguments: none.

Options: only --help.

Output includes each agent ID, label, and assigned role keys.

forkflux agent add

Creates an agent and generates an API token for it. This command does not assign roles; use forkflux agent assign-role after creating the agent.

uvx --from forkflux forkflux agent add [OPTIONS] AGENT_LABEL
ArgumentTypeRequiredDescription
AGENT_LABELTEXTYesHuman-readable label for the agent.
OptionTypeDefaultDescription
--tool-familyTEXTnoneOptional assistant/tool family identifier, such as claude, codex, opencode, or hermes.

Examples:

uvx --from forkflux forkflux agent add alice-codex
uvx --from forkflux forkflux agent add bob-claude --tool-family claude

The command prints the generated API key. Save it immediately and configure it in the agent's MCP client environment as FORKFLUX_API_KEY. Use forkflux agent list to find the agent ID, then pass that ID to forkflux agent assign-role to make the agent eligible for role-targeted jobs.

forkflux agent assign-role

Assigns an existing role to an agent.

uvx --from forkflux forkflux agent assign-role AGENT_ID ROLE_KEY
ArgumentTypeRequiredDescription
AGENT_IDINTEGERYesNumeric ID of the agent that should receive the role.
ROLE_KEYTEXTYesExisting role key to assign to the agent.

Options: only --help.

Example:

uvx --from forkflux forkflux agent assign-role 2 qa

Use this command after forkflux agent add or whenever an existing agent needs access to another role.

forkflux agent unassign-role

Removes a role assignment from an agent.

uvx --from forkflux forkflux agent unassign-role AGENT_ID ROLE_KEY
ArgumentTypeRequiredDescription
AGENT_IDINTEGERYesNumeric ID of the agent whose role assignment should be removed.
ROLE_KEYTEXTYesExisting role key to remove from the agent.

Options: only --help.

Example:

uvx --from forkflux forkflux agent unassign-role 2 qa

After removal, the agent can no longer list or claim jobs that only target that role.

forkflux agent revoke-token

Revokes the API token associated with an agent.

uvx --from forkflux forkflux agent revoke-token AGENT_ID
ArgumentTypeRequiredDescription
AGENT_IDINTEGERYesNumeric ID of the agent whose token should be revoked.

Options: only --help.

Example:

uvx --from forkflux forkflux agent revoke-token 2

After revocation, the agent can no longer authenticate with the old token.

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 list

Lists jobs in the collaboration bus.

uvx --from forkflux forkflux job list [OPTIONS]
OptionTypeDefaultDescription
--limitINTEGER50Maximum number of jobs to show.
--statusCHOICEnoneFilter by job status. Accepted values: published, in_progress, blocked, unblocked, completed, failed, cancelled.
--target-role-keyTEXTnoneFilter jobs by target role key.

Examples:

uvx --from forkflux forkflux job list
uvx --from forkflux forkflux job list --status published --target-role-key qa --limit 10

Output includes job ID, summary, status, priority, source agent, assignee, target role, and creation time.

forkflux job details

Prints full job details as formatted JSON.

uvx --from forkflux forkflux job details JOB_ID
ArgumentTypeRequiredDescription
JOB_IDINTEGERYesNumeric job ID to inspect.

Options: only --help.

Example:

uvx --from forkflux forkflux job details 42

Use this command when you need the complete context payload, artifacts, lifecycle data, or event history for a job.

forkflux job delete

Deletes a job by ID.

uvx --from forkflux forkflux job delete JOB_ID
ArgumentTypeRequiredDescription
JOB_IDINTEGERYesNumeric job ID to delete.

Options: only --help.

Example:

uvx --from forkflux forkflux job delete 42

The command asks for confirmation before deleting. ForkFlux refuses to delete a job when deletion would violate lifecycle or parent-child constraints.

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