AI Gateway Developers CLI reference

CLI reference

Commands and tool requirements depend on your installed CLI. Check each command's --help. See Release channels.

Start with Setup to connect a coding tool.

Getting help

Every command accepts --help.

forgebench --help
forgebench run --help

To check the installed version, run forgebench --version. See Release channels for the stable and preview channels. Guided setup and automatic-linking options described here depend on the installed version and deployment.

Setup

Run forgebench setup in a terminal to select tools, then choose session sync, model routing or MCP tools by number. Routing reuses a matching chat:write credential or offers browser authorization. If browser authorization fails or is declined, enter a key privately or leave it blank to skip routing. No --gateway flag or separate gateway command is needed.

Guided, opt-in setup. In a terminal with no flags, with any of --mcp, --dry-run, --fresh or --verify-inference, or with --url, --since, --funding or --paid-fallback-max-usd alone, it runs the guided journey in Setup. Passing any of --tool, --install-hooks, --sync-now, --gateway, --gateway-only, --opencode-gateway, --associate-sessions, --advanced, --no-preview, --key or --capture without a guided flag (--mcp, --dry-run, --fresh, --verify-inference) keeps the scripted path.

# Guided setup
forgebench setup

# Preview the changes without making them
forgebench setup --dry-run

# Ask about automatic sync and the first upload separately
forgebench setup --advanced

# Non-interactive: sign in first, then configure one tool and upload
forgebench login
forgebench setup --tool claude_code --since 30d --install-hooks --sync-now
FlagDescription
--tool claude_codeSelect a tool. Repeat it to select several. Required when setup is not run in an interactive terminal. Accepted values: claude_code, codex, cursor, antigravity, github_copilot, opencode.
--url https://app.forgebench.aiThe ForgeBench app URL for your environment. The guided flow asks for it on the first screen. Changing the URL clears saved selections and verification for the new URL; changing the workspace clears previous verification while keeping your selections. A URL that contains a username or password is refused with exit code 2 on every guided run, before anything changes.
--since 7dHistory to preview and upload once. Accepted values: 3d, 7d (default), 30d, 90d.
--keyEnter an API key privately and check it against the setup URL.
--opencode-gatewayConfigure OpenCode to use the ForgeBench gateway models available to you.
--associate-sessionsWith a guided flag, selects Sync coding sessions. Opt in to automatic sync and native usage setup. For Claude Code it also adds optional context hooks that never block a session.
--no-previewSkip the local preview.
--sync-nowUpload the selected tools after the preview. Requires a stored login.
--install-hooksWith a guided flag, selects Sync coding sessions. Enable automatic session-end sync for the selected tools. Antigravity has no session-end hook; use schedule for it.
--gatewayWith a guided flag, selects Use ForgeBench for model requests. Requires chat:write. Funding is api-only unless you also pass --funding, with --paid-fallback-max-usd for subscription-first.
--funding MODEGateway funding mode: api-only (default), subscription-only, or subscription-first. subscription-only and subscription-first require --gateway (exits with 2 without it); --funding api-only on its own is accepted and changes nothing. Subscription modes (subscription-only and subscription-first) are refused with exit code 2 for tools other than Claude Code and Codex.
--paid-fallback-max-usd USDPositive USD cap for paid fallback when --funding subscription-first is selected. Requires --gateway and --funding subscription-first (exits with 2 otherwise).
--gateway-profile PROFILEGateway routing profile name. Requires --gateway (exits with 2 without it).
--mcpConnect ForgeBench tools (the hosted MCP server) to the selected tools.
--dry-runPreview the guided setup changes and write nothing. Makes read-only requests with the saved gateway key for the routing policy and model list.
--freshDiscard saved guided-setup answers; installed setup is left alone.
--capture MODEApply local, otel, both, or off capture on this device for the selected supported tool. Requires reporting sign-in and respects workspace policy. Use --status to inspect the applied revision.
--gateway-onlyConfigure compatible tools for model requests without scanning sessions, installing reporting hooks, or uploading a report.
--resetRemove existing Forgebench tool configuration before setup, retaining reporting sign-in. Implies --fresh. Preview removal with forgebench reset --dry-run first.
--verify-inferenceSend one one-token model request to confirm routing works.
--advancedChoose automatic sync and upload separately instead of the single yes/no prompt.
--statusShow the selected tools and hook status, plus the guided-setup state when there is any.
--uninstallRemove the session-end hooks, clear the selected tools and, when hook uninstall succeeds, delete the saved guided-setup answers.

In the guided journey, preflight asks Apply these changes? [y/N] only when at least one row will apply; when everything selected is already set up, it prints Nothing to do: everything selected is already set up and skips the prompt. Deselecting an already-installed feature on a rerun leaves it installed and prints its exact removal command: forgebench hooks uninstall --tool <tool>, forgebench gateway remove --tool <tool> --forgebench-url <url>, or forgebench mcp remove --tool <tool> --scope user --forgebench-url <url>. When a step fails, Not completed: prints its fix command and lists the steps that remain applied. Next: prints the recovery command or console link. The link uses the workspace URL when its name is available.

First use: keeps configuration and delivery separate. Sync is verified from the server's per-tool upload count for the signed-in person; it does not identify the uploading device or CLI build. The optional inference test checks the gateway. It does not prove that a native client loaded its routing settings. Plain guided setup does not enable native OpenTelemetry; use the capture options in Setup.

The guided journey exits with:

Exit codeMeaning
0Every selected item was applied or is waiting for first use. Stopping at a prompt without changes also returns 0.
1A failure, an unsupported item, or a failed inference test.
2Invalid flags or selection.
3Not signed in, or no gateway key.
4Nothing selected.
5The service could not be reached.

Run

Parses local session logs, scores them, and optionally submits the result.

# First run: process all historical sessions and submit the result
forgebench run --all --push

# Daily check: local only, nothing submitted
forgebench run --since 24h
FlagDescription
--allProcess all historical sessions, not only recent ones. Use it on the first run.
--since 7dLimit processing to sessions active within this window, including a long-running session that started earlier. Accepts values such as 7d, 24h, and 2w.
--pushSubmit the result to Forgebench. Without this flag, the command only writes a local file.
--tool claude_codeRestrict processing to a single tool. Accepted values: claude_code, codex, cursor, antigravity, github_copilot, opencode.
--output path.jsonFile path to write the result to. Defaults to profile.json in the current directory.
--no-usageExclude token counts and collect only the working-style profile.
--no-repoSkip reading git history entirely.
--no-metaOmit per-session metadata, including repository and branch context. Those sessions cannot gain task links from that omitted context.
--machine-name office-macLabel this machine's usage with a name, so an administrator can identify the source.
--team platformTag this machine's usage with a team name.
--ai-analysis True|FalseWhether the written summary of working style is created as soon as the result is submitted. On by default. --ai-analysis False skips it, and a bare --ai-analysis means True.
--no-ai-analysisSkip the model-written working-style review after upload. It does not disable capture or change the cost of your coding tool's model calls.
--clear-cacheClear local capture state and pending uploads. Pending results can be lost; retry delivery before clearing them.
--project valueRestrict processing to one project, for scripted use. The value is a hash, not a folder name.

Login / logout

# Sign in through a browser (also available inside setup)
forgebench login

# On a remote machine without browser access, sign in with a key provided by an administrator
forgebench login --key

# Remove the stored key from this machine
forgebench logout
CommandDescription
loginSign in through a browser for the selected environment. --sso is also accepted.
login --keyEnter an API key privately, useful on SSH.
logoutRemove the stored key from this machine.

Reporting login does not authorize model requests. Gateway setup needs a key with chat:write. Guided setup can obtain gateway access through browser approval when your administrator has provided a key for gateway authorization. It saves that credential separately for the selected Forgebench URL. See Authorize model requests.

Recover missing usage

recover-usage repairs missing or incomplete managed OpenTelemetry usage for completed Claude Code and Codex sessions, using token counts available locally. It skips sessions already covered by telemetry and respects capture-policy windows. It does not recover prompts or code.

forgebench recover-usage --since 3d --tool claude_code
forgebench recover-usage --since 3d --tool codex

The default window is 3d. Use --url for your own deployment. The command reports recovered, already-reported, and ineligible sessions. If delivery fails, rerun it after connectivity returns.

Schedule

Runs run --all on a recurring interval.

# Run automatically once a day
forgebench schedule enable --interval daily

# Disable the schedule
forgebench schedule disable
CommandDescription
schedule enable --interval dailyEnable a recurring run. Accepted values: hourly, daily (default), weekly.
schedule disableDisable the recurring run.

Sync

The command the session-end hook runs. Run it yourself if the hook appears stuck.

forgebench sync --quiet
FlagDescription
--quietSuppress output. This is the flag the hook itself passes.
--tool claude_codeSync a single tool instead of everything the hook normally covers.
--foregroundRun in the current terminal instead of in the background. Useful for confirming the command works.

Recover usage

If Claude Code or Codex sessions show missing or incomplete token usage after switching to OpenTelemetry capture, recover-usage sends the exact token counts recorded on this machine for completed sessions. A session counts as complete five minutes after it ends. Session reports go to the normal sessions endpoint without usage, and token counts go only to the recovery endpoint.

# Repair the last three days (the default window)
forgebench recover-usage

# One tool, a longer window
forgebench recover-usage --tool codex --since 14d
FlagDescription
--since 3dWhich local sessions to consider, by when they started. Defaults to 3d.
--tool claude_codeLimit to claude_code or codex. Without it, both are checked.
--urlThe control plane to send to. Defaults to the one this CLI uses.

If the upload fails, the batch is kept on this machine. Run the command again once you're back online.

Hooks

Enables automatic reporting whenever a session ends. This is the recommended configuration, and the one Setup uses.

For Claude Code, hooks install installs the forgebench plugin from the seedlinglabs/forgebench-cli marketplace. Once the plugin is installed, enabled and configured, it replaces the session-start, session-end and skill-load hooks previously written to settings.json. The Stop hook from --on-stop and the optional context hooks stay in settings.json. The plugin needs Claude Code 2.1.292 or later on macOS or Linux. On an older or missing claude, hooks install writes the settings.json hooks and says so; run it again once a supported claude is on PATH to move to the plugin. Windows is not supported yet: hooks install refuses the Claude Code step before changing anything, prints why, and exits with 1. Existing Claude hooks and settings are left as they are, and other selected tools still install. If the plugin install fails, the settings.json hooks stay and the command prints the claude plugin commands to run by hand. If a marketplace named forgebench is already configured from another source, forgebench does not install from it. If the forgebench plugin was installed by someone else, hooks install never changes its options. When they already match, forgebench uses the plugin. Otherwise the settings.json hooks stay and the command prints the claude plugin configure ... --values-stdin command you can run to set it up yourself. If a failed install prints recovery commands for a plugin that already existed, they do not turn sync off. hooks status keeps showing the failure until a later run succeeds. The plugin stays enabled while either session sync or MCP is on. Claude Code's /mcp view lists the plugin even when MCP is not configured. It sends nothing to MCP until mcp_url is set. If the plugin was disabled inside Claude Code, run claude plugin enable forgebench@forgebench --scope user to re-enable it (and resume session sync when sync is on).

# Enable automatic reporting
forgebench hooks install

# Also report after every response, not only when a session ends
forgebench hooks install --on-stop

# Only one tool (repeat --tool to pick several)
forgebench hooks install --tool codex
forgebench hooks install --tool opencode

# Check whether the hook is enabled and when it last ran
forgebench hooks status

# Disable automatic reporting
forgebench hooks uninstall

# Disable it for one tool only
forgebench hooks uninstall --tool claude_code
CommandDescription
hooks installEnable automatic reporting for selected tools. OpenCode 2.x enables sync in the pinned @forgebench/opencode entry in opencode.json or opencode.jsonc. If the pinned version is unpublished or the registry is unreachable, the CLI keeps the existing idle-sync plugin and explains the fallback. OpenCode below 2.x installs nothing and the command says 2.x is required.
hooks install --on-stopAlso report after every response, not only when a session ends. Increases reporting frequency.
hooks install --tool codexEnable reporting for one tool only: claude_code, codex, cursor, github_copilot, or opencode. Repeat to pick several.
hooks install --print-managedPrint the configuration for MDM distribution instead of installing it locally. For admins deploying fleet-wide.
hooks statusCheck whether the hook is enabled and when it last reported. For Claude Code it shows installed and required plugin versions. It reports disabled, outdated, failed or restart-pending plugins and prints a fix command.
hooks uninstallDisable automatic session reporting. For OpenCode this turns off the plugin's sync option only; its gateway and MCP options stay, and the entry is removed when none is left. For the Claude plugin this turns off session sync only; an MCP connection you set up stays. When neither is left, the plugin and marketplace are removed if forgebench installed them. A plugin you installed yourself is left exactly as it is, sync option included, and the command says so.
hooks uninstall --tool claude_codeDisable it for one tool only.

hooks manages session reporting only. To connect Claude Code to the hosted MCP server, see Installation & Setup.

Task

Sessions link to tracker tasks automatically from branch names and pull requests. See Work sources. To require a task, install the commit check in each repository or worktree.

forgebench task commit install --tool opencode --url https://api.forgebench.ai
forgebench task commit status
forgebench task commit uninstall
CommandDescription
task commit installAsk for a task ID at git commit in this worktree. --tool selects opencode (default), codex or claude_code. --workspace selects another worktree. Restart the coding client afterwards. Needs CLI 1.4.21 or later.
task commit statusShow whether the commit check is installed for this worktree.
task commit uninstallRemove the commit check and restore the worktree's previous Git hook selection.
task hooks install, task set, task clear, task statusLegacy before-work task declaration for Claude Code. Kept for existing setups; use task commit install for new ones.

Gateway

Routes coding tools through ForgeBench, so every model call is metered, budgeted and audited. This needs an API key with the chat:write scope, not the sign-in from forgebench setup. Install takes the key from FORGEBENCH_GATEWAY_KEY or asks for it once.

# Route Claude Code and Codex, plus Gemini CLI and OpenCode if installed
forgebench gateway install

# Only one tool (repeat --tool to pick several)
forgebench gateway install --tool codex

# Show what each tool points at
forgebench gateway status

# Take out only what install wrote
forgebench gateway remove
Command or flagDescription
gateway installPoint the selected tools at ForgeBench. Settings you already set, such as a model, are left as they are.
gateway statusShow whether each tool points at ForgeBench, at something else, or at its own vendor.
gateway removeRemove only what install wrote, including the key it saved for Codex. For OpenCode it turns off the plugin's gateway option and keeps sync and mcp with their URL and executable settings.
--tool codexSelect one tool. Repeat it to select several. Accepted values: claude, codex, gemini, opencode, agy, cline, kilocode, continue, hermes, droid, crush, qwen, zed, goose, aider, copilot.
--forgebench-url https://api.forgebench.aiThe ForgeBench API URL. Defaults to the one this CLI uses.
--codex-model MODELThe model Codex uses by default. Without it, install picks one from the key's models.
--opus-model, --sonnet-model, --haiku-modelThe model Claude Code uses for that tier (ANTHROPIC_DEFAULT_OPUS_MODEL and so on). Without them, install picks one when exactly one of the key's models matches the tier, otherwise it leaves the tier unset.
--model MODELThe default model for Gemini CLI, OpenCode, Continue, Hermes, Qwen Code, Goose and Aider, and one more model to list for Factory Droid, Crush and Zed. Use an id from GET /v1/models. Without it, no default is set.
--hide-other-providersOpenCode only: /models lists only ForgeBench models. A default or small model on a hidden provider is replaced, and agents pinned to one are named because they won't run. gateway remove restores what was replaced. Without this flag or --keep-other-providers, install asks you. With --yes or no terminal, it keeps your current choice.
--keep-other-providersOpenCode only: keep every provider's models in /models without asking.
--dry-runInstall and remove: show the files that would change, and write nothing.
--forceRemove only: remove ForgeBench's entries even if you've edited the file since install. Only what ForgeBench wrote is removed.
--fundingChoose api-only (default), subscription-only, or subscription-first. Subscription routing requires an enabled deployment and an assigned profile.
--paid-fallback-max-usdSet a positive per-request paid limit. Required for subscription-first; it cannot be used with the other funding modes.
--yesSkip the confirmation prompt.

Use forgebench gateway verify --forgebench-url https://api.forgebench.ai to check the deployed native routing contract without a model call. The API URL is required. Use your deployment's URL for a self-hosted instance. To verify traffic, run a small task and inspect Activity → Routed requests. The contract check alone does not establish that a request reached the gateway.

For a supported native subscription, use Setup guide → Advanced: use an existing native subscription to check availability and generate the command. For Codex, start the configured client with forgebench gateway launch --tool codex.

Codex needs no export. Install saves the key in the CLI's own settings, and Codex gets it by running forgebench gateway token. Install also sets a default model and lists the key's chat models in Codex's /model. Re-run forgebench gateway install after the key's models change. Hermes, Factory Droid and Crush still read the key from FORGEBENCH_GATEWAY_KEY in your shell.

Change the key or its models

# Replace the saved key (prompts for it without echoing), then refresh the routed tools
forgebench gateway set-key

# In a script, read the key from stdin
printf '%s' "$NEW_KEY" | forgebench gateway set-key --key-stdin

# The key's allowed models changed in the console: update Codex's model list
# and Claude Code's tier models with the saved key
forgebench gateway refresh --dry-run
forgebench gateway refresh

set-key checks that the new key has chat:write before saving it. The key is saved only in the CLI's per-URL key store, where Codex, Claude Code and OpenCode read it through forgebench gateway token. Nothing goes into your shell profile. If the key is rejected, nothing changes. refresh needs a saved key and at least one tool routed through that URL. Run gateway install first if you have neither. Both commands accept --forgebench-url and default to the same URL as install.

Check your routing

gateway explain shows what the gateway would do with your key without making a model call: the routing profile and its strategy, the models you're allowed to use, any reason a request would be denied, and the budget (what happens when it's exceeded, USD remaining and the period).

forgebench gateway explain
forgebench gateway explain --tool codex --profile backend --json
FlagDescription
--toolExplain for one tool's route.
--profileExplain a specific routing profile instead of the one assigned to you.
--projectExplain for a project.
--jsonMachine-readable output. It always includes "inference_executed": false.

The command exits with 1 when the key can't be read or a request would be denied.

Tools set up in their own UI or by environment

Some tools can't have their endpoint changed from a config file. gateway guide prints the steps to follow in the tool's own settings, with your ForgeBench URL filled in. On its own, it lists the available guides. These include Cursor, Cline, Kilo Code, Roo Code, Warp, Trae, JetBrains and GitHub Copilot in VS Code.

forgebench gateway guide
forgebench gateway guide cursor --model MODEL

Tools configured only by environment variables, such as GitHub Copilot CLI and agy, get their exports from gateway env. Only the exports go to stdout, so the output can be passed straight to eval:

eval "$(forgebench gateway env copilot --model MODEL)"

Without --model, COPILOT_MODEL is not set. Pick a model from GET /v1/models that supports tool calling and streaming.

OpenCode plugin entry

On OpenCode 2.x, gateway install --tool opencode adds one entry to the plugins list of opencode.json (or opencode.jsonc, comments kept): {"package": "@forgebench/opencode@<exact version>", "options": {...}}. The options hold three independent switches, gateway, sync and mcp, plus the ForgeBench url, the CLI executable, and, for gateway, the models and routing headers install resolved from your key. gateway install and hooks install each change only their own switch; mcp install keeps writing its direct MCP entry (see Install with the CLI). The entry stays while any switch is on and is removed with the last one.

Install never writes the key into opencode.json. It saves the key in the CLI's own key file (mode 0600), and the plugin runs forgebench gateway token for each request. An existing generated provider.forgebench block and opencode-gateway.key file are retired only after the key is saved and the entry is written; a block you edited is kept and reported.

SituationWhat the CLI does
OpenCode below 2.xInstall does nothing and says 2.x is required. gateway status reports an existing install as legacy. gateway remove still removes what the CLI wrote.
Pinned version not published, or the registry cannot be checkedInstall checks registry.npmjs.org for the exact version first. If it is missing or unverifiable, the existing generated files stay, the command says why, and the retry command is printed.
Older pin in the entryInstall replaces the version after the check and keeps your options, models, headers, comments and other plugins. A newer pin than the CLI expects is left alone.
Your own provider.forgebench or providers.forgebench, or a -@forgebench/opencode entryLeft alone; install refuses and exits with 1.
OpenCode 2 providers settingsKept as they are. Install edits only its own entries beside them.

gateway status and forgebench doctor read only the config file. They show the installed and pinned versions and, once configured, report that OpenCode loads the package on its next start; restart OpenCode to activate a change.

These options go in the options object of the plugin entry. Leave them out for the hosted defaults. Each feature is on unless you set it to false.

OptionDescription
urlThe ForgeBench address. It must be https; plain http is accepted only for a loopback address. Any other value turns off every network feature.
gatewayRegister the forgebench provider, model discovery and per-request credentials.
authWhich sign-in methods /connect offers: auto (default), oauth, key or none.
apiKeyA gateway key for headless or CI use. Prefer /connect or the FORGEBENCH_GATEWAY_KEY environment variable, so the key stays out of the config file.
reportingSend session and context data straight to ForgeBench. sync: false is accepted as the same opt-out.
contextSet to false to keep reporting on but send no repository, branch or remote.
tracesSet to false to stop sending tool and session spans.
task{ "connectionId": "CONNECTION_ID", "taskId": "TASK_ID" }. Declares a task when a session starts. It is never inferred from a branch.
mcp, mcpUrlRegister the ForgeBench MCP server. mcpUrl defaults to the url plus /mcp. An existing forgebench MCP entry is left alone.
modelsModels to offer until the list from /v1/models can be fetched.
headersExtra routing headers for the provider. Authorization is ignored.

To install the plugin without the CLI, see Install OpenCode without the CLI.

Try for this session

gateway launch runs Claude Code, Codex or OpenCode through ForgeBench for that one process, with no install first. The routing is temporary: nothing is written to the tool's configuration, your normal login, plugins and history are untouched, and the temporary files are deleted when the tool exits. The tool still writes its own session history as usual.

# Claude Code, one prompt
forgebench gateway launch --tool claude -- -p "summarize this repo"

# Codex, non-interactive
forgebench gateway launch --tool codex -- exec "summarize this repo"

For an initial routing check, use the non-interactive examples above. After the task finishes, inspect Activity → Routed requests to confirm that the native tool sent its model requests through Forgebench. A successful launch alone does not establish that routing worked.

The key is the one gateway install saved for that ForgeBench URL (or FORGEBENCH_GATEWAY_KEY for the default URL). Launch never saves a key and never sends one deployment's key to another. The key reaches the tool through its environment or the CLI's key store, never its arguments or a settings file.

BehaviourDescription
Exit codeThe tool's exit code. A tool ended by a signal returns 128 plus the signal number.
Ctrl-C and terminationThe signal is passed to the tool. If it does not exit, launch stops it, waits for it, then deletes the temporary files.
Claude Code settingsWith a key-funded profile, a ANTHROPIC_CUSTOM_HEADERS, ANTHROPIC_API_KEY or ANTHROPIC_AUTH_TOKEN in your user or project settings, or your shell, is overridden for this session only. A note names what was overridden and where; your files are not changed.
Allowed formsThe interactive default, -p for Claude Code, exec for Codex, and run for OpenCode. Arguments that change the routing, resume or fork a session, or attach to a server, are refused, as is a model outside your key's models.
Subscription profilesWhen the key's profile is funded by a subscription, Claude Code and Codex use the native subscription route and must be a client version the server has verified. OpenCode has no subscription route and is refused. A subscription-first profile launches subscription-only and stops at quota; paid fallback is enabled only by --paid-fallback-max-usd USD, which must be positive and within the profile's and server's limits. Claude Code settings with an apiKeyHelper are refused in this mode.
OpenCode versionOpenCode 2.x only; 1.x is refused.
Refused before the tool startsSetup refuses missing keys, tools or model lists, conflicting configuration, unreadable files, managed routing restrictions and OpenCode plugin or provider restrictions. Subscription-funded Claude Code also refuses conflicting credentials or ANTHROPIC_CUSTOM_HEADERS. The message names the file to change, and nothing is launched.

Task

Links your sessions to a task in a connected tracker (see Work sources), so their usage counts toward that task.

# Use this task for the next Claude Code session in this folder
forgebench task set --connection-id CONNECTION --task-id PROJ-123

# Or attach it to a session that already exists
forgebench task set --connection-id CONNECTION --task-id PROJ-123 --session-id SESSION

# Check, or clear the pending task
forgebench task status
forgebench task clear

# Require a valid task for every Claude Code session in this folder
forgebench task hooks install

# Ask for a ticket before each git commit in this repository
forgebench task commit install --tool claude_code
CommandDescription
task setSelect a task once for the next session, or for the session named by --session-id. --source picks the tool; the default is claude_code. --workspace picks the folder; the default is the current one.
task clearClear a pending task, or a selected session's local link.
task statusShow whether the local Claude Code task checks are available.
task hooks install / uninstallAdd or remove Claude Code SessionStart and PreToolUse checks that require a valid task.
task commit install / uninstall / statusTurn on, turn off or check the commit-time ticket prompt for this repository. --tool is opencode (default), codex or claude_code. Before a commit, you're asked for a ticket, and Forgebench must accept it for every session that contributed to the staged work. The ticket is then added to the commit message as Refs: PROJ-123. You need to be signed in.

Delegate

forgebench delegate runs a subagent in OpenCode or Codex on the model your Tuning policy assigns to a role. It's for tools and scripts that hand work to a child process. The CLI reads the live policy with your gateway key each time and doesn't store it. If the policy can't be read, the command refuses with exit code 3.

forgebench delegate run --role review --prompt-file review.md --json
CommandWhat it does
delegate runRuns the subagent and prints its result.
delegate status RUN_IDShows a run. --wait SECONDS waits up to 600 seconds for it to finish.
delegate cancel RUN_IDStops a run.

Options for delegate run:

OptionMeaning
--role ROLEOne of explore, plan, implement, review, test, debug or docs.
--prompt TEXT or --prompt-file FILEThe task. Use - for standard input. At most 1 MiB.
--harness opencode|codexThe tool that runs the subagent.
--model MODELOptional. Must be one of the role's models in the policy.
--cwd DIRThe working directory.
--timeout SECONDSDefault 900, from 10 to 3600.
--allow-editsLets the subagent change files. Without it, the subagent runs read-only.
--parent-harness, --parent-sessionAttribute the run to the session that started it.
--idempotency-key KEYA repeat with the same key returns the earlier run instead of starting another, for 24 hours.
--backgroundReturns at once with a run ID. Follow it with delegate status.
--jsonPrints one JSON object.
--request FILEReads the same options from a JSON file, or - for standard input.

Exit codes: 0 completed, or still running (a --background run, or a status check on a run that hasn't finished), so read the status in the output before treating 0 as done, 1 the subagent failed, 2 refused, 3 the policy or model catalog was unavailable, 4 the outcome is unknown, 124 timed out, 130 cancelled.

forgebench mcp serve-local offers the same action to a coding tool as the forgebench_delegate tool. Add --allow-edits to let that tool edit files in the directory it was started in.

Skills

Session reports record which version of each skill a session loaded, as a hash of the skill folder. skills hash prints that hash for a local skill. skills tag labels the current version of a repository's skills, usually from CI on merge, so versions show up under a readable name. Only names and hashes are sent.

# The hash ForgeBench records for a skill
forgebench skills hash .claude/skills/release-notes

# In CI, after a merge: tag every skill folder as git:<commit>
forgebench skills tag

# Use a release name instead
forgebench skills tag --tag v2.4 --note "spring release"
Command or flagDescription
skills hash DIRPrint the skill's name, tree_sha256 and skill_md_sha256. DIR is the folder holding SKILL.md. Add --json for machine-readable output.
skills tag [DIR ...]Tag each skill's current hash. Without folders, every skill under .claude/skills, .agents/skills and .codex/skills is tagged. The default tag is git:<commit> for the last commit that changed the folder, so running it again, or after a merge that didn't touch the skill, adds nothing.
--tagUse this tag instead of git:<commit>, for example a release name.
--noteA note stored with each tag.
--dry-runPrint the tags and send nothing.

hooks install also adds a Claude Code hook that hashes each skill as it loads, so a later checkout that changes the folder doesn't lose the version a session used.

Install, sync, publish and pin skills with the other skills commands. See Get skills on your machine.

Agent and MCP inventory

These commands work with the agent-harness-explorer and forgebench-onboarding skill bundles, which find the agents, MCP servers and tools in a repository. For the guided flow that uses them, see Onboarding Agents & Tools.

Install a skill bundle

install-bundle copies a skill bundle that ships with the CLI into a repository, so your coding tool loads it like any skill you wrote yourself.

forgebench install-bundle agent-harness-explorer
forgebench install-bundle forgebench-onboarding --tool codex --target ../my-repo
forgebench uninstall-bundle agent-harness-explorer
FlagDescription
NAMEThe bundle to install or remove. An unknown name is refused.
--target pathThe repository root to use. Defaults to the current folder.
--tool claude_codeThe tool that loads the skill: claude_code (default), codex or antigravity. claude_code uses .claude/skills. codex and antigravity use .agents/skills.
--forceinstall-bundle only. Replace an existing skill folder of the same name even if the CLI did not install it. Without it, the command refuses and exits with 1.

Installing again replaces a folder the CLI installed before. uninstall-bundle removes only a folder the CLI installed, and refuses one you wrote yourself.

Report what a scan found

Both report commands review first. Without --send they read a local file, show what is new since the last report you confirmed, and send nothing. Run forgebench login before you use --send.

# Review the MCP servers and tools in a snapshot
forgebench report-mcp-inventory snapshot.json

# Add a server the scan missed, then send
forgebench report-mcp-inventory snapshot.json --add-server NAME:TOOL1,TOOL2 --send

# Review the agents declared in code
forgebench report-agent-declarations discovered.json

report-mcp-inventory SNAPSHOT reports the MCP servers and tools in a snapshot made by agent-harness-explorer. A server seen with no tools is skipped, because every registered server needs at least one tool.

FlagDescription
--sendPush the report to ForgeBench. Use it only after you have read the review.
--add-server NAME:TOOL1,TOOL2Add an MCP server the scan missed. It needs at least one tool. Repeat the flag for more servers.
--add-tool NAMEAdd a plain tool the scan missed. Repeat the flag for more tools.
--url urlThe ForgeBench address to report to.

report-agent-declarations FILE reports the agents declared in code. FILE is the --out file written by the bundle's inspect_mcp_source.py --discover-only.

FlagDescription
--sendRegister the new agents and grant their access. Without it, nothing leaves your machine.
--confirm-fuzzy IDInclude one finding, by id, from a review pass done by a coding agent. A finding you do not name is never sent. Repeat the flag for more findings.
--fuzzy-findings file.jsonThe findings file for --confirm-fuzzy. Defaults to fuzzy_findings.json next to FILE.
--url urlThe ForgeBench address to report to.

If a send fails, the report is kept on your machine. Run the same command again once you are back online.

Status

Shows the installed version, sign-in status, whether the hook is installed, and whether a schedule is running.

forgebench status

# Machine-readable output
forgebench status --json

If reporting is not working, forgebench doctor diagnoses why and says how to fix it. It also accepts --json.

Capabilities

forgebench capabilities shows the CLI build and the features it supports. Add --json for machine-readable output.

Native subscription sign-in remains separate from gateway authorization. Subscription gateway modes require the deployment to advertise support for the client and version. Direct subscription calls with session reporting do not receive gateway routing or budget enforcement.

Update

Checks for a newer version. --install downloads the official release binary, checks it against the release checksum, and replaces the installed CLI.

# Check the stable channel (the default)
forgebench update

# Install the latest stable release
forgebench update --install

# Check or install from the preview channel instead
forgebench update --channel preview
forgebench update --install --channel preview
FlagDescription
--checkOnly check for a newer version. This is the default.
--installVerify and install the latest release of the selected channel.
--channel previewUse the preview channel (newer, less tested) instead of stable.
--auto onInstall a newer official release automatically after you run status or doctor in a terminal. Turning it on also turns on --auto-check. Off by default.
--auto-check offStop the background release check that runs when you use the CLI in a terminal. On by default.

--install only replaces the official release binary. If you installed the CLI with a package manager or from source, update it the same way you installed it. An update is refused while a local harness run (see Harness) is active; retry after it finishes.

Harness

Starts and controls a coding agent (Claude Code, Codex or OpenCode) running on your own machine, under your own user account. Each command prints the run's state as JSON.

# Start a run with an explicit backend and model
forgebench harness start --backend claude --model sonnet --prompt "Fix the failing test"

# Check on it, or wait for it to finish while relaying its output
forgebench harness status <run-id>
forgebench harness wait <run-id> --follow

# Queue the next turn while it runs, or continue a stopped run
forgebench harness followup <run-id> --prompt "Now add a test for the edge case"
forgebench harness resume <run-id> --prompt "Also update the changelog"

# Stop it
forgebench harness cancel <run-id>
CommandDescription
startLaunch a run. Requires --backend (claude, codex or opencode), --model and --prompt. Optional: --cwd (defaults to the current directory), --binary (an explicit path to the agent's executable), --parent-run-id, and --native-arg (repeatable) or options after -- to pass through to the agent. Model, session and daemon options are reserved and cannot be passed through. The backend and model cannot change for the life of the run.
status <run-id>Show the run's state: starting, running, stopping, completed, failed, cancelled, or outcome_unknown if its worker stopped reporting.
wait <run-id>Block until the run finishes. --timeout stops waiting after that many seconds. --follow relays the agent's output while you wait and prints the final state to stderr.
followup <run-id> --promptQueue the next turn. If the run is still working, the turn starts when the current one ends.
resume <run-id> --promptContinue a run that has stopped, in the same agent session. Refused while the run is active; use followup for that.
cancel <run-id>Stop the run, and drop any queued next turn.

A prompt can be up to 1 MB. The command exits with 1 when the run has failed or its outcome is unknown, and 2 when the command itself was refused.

Reset tool configuration

reset removes Forgebench's changes from coding tools and clears saved gateway keys. It keeps your reporting login. Use it to start tool setup again, rather than only forgetting answers with setup --fresh.

forgebench reset --dry-run
forgebench reset --tool codex

With no tool selected, reset covers every supported tool. Review the dry run before removing a working setup. --json returns a machine-readable result.

Uninstall

Removes the schedule, the hooks, and the stored login, then prints the command to remove the program itself. For Claude Code it also turns off the plugin's session sync and MCP connection, and removes the plugin and its marketplace when forgebench installed them. A plugin you installed yourself stays installed and its options are not changed. If the plugin cannot be removed, the command prints the claude plugin commands that finish the job and exits with 1.

forgebench uninstall

Next

Cookie settings

Our Cookie Policy lists every cookie and what it does.