initializdocs
DeveloperForge runtimeReference

CLI Reference

Complete reference for all Forge CLI commands.

Complete reference for all Forge CLI commands.

Global Flags

FlagShortDefaultDescription
--configforge.yamlConfig file path
--verbose-vfalseEnable verbose output
--output-dir-o.Output directory

forge init

Initialize a new agent project. Without --non-interactive, a TUI wizard walks through: name → model provider → fallbacks → channel → tools → skills → context compression → authentication → egress review → summary.

forge init [name] [flags]

Flags

FlagShortDefaultDescription
--name-nAgent name
--framework-fFramework: crewai, langchain, or custom
--language-lLanguage: python, typescript, or go
--model-provider-mModel provider: openai, anthropic, gemini, ollama, or custom. The custom value scaffolds an OpenAI-compatible endpoint by default (provider: openai + OPENAI_BASE_URL / OPENAI_API_KEY); the interactive wizard additionally offers an Anthropic Messages shape for Custom URLs which scaffolds provider: anthropic + ANTHROPIC_BASE_URL / ANTHROPIC_API_KEY (issue #202 Phase 1).
--channelsChannel adapters (e.g., slack,telegram)
--toolsBuiltin tools to enable (e.g., web_search,http_request)
--skillsRegistry skills to include (e.g., github,weather)
--api-keyLLM provider API key
--org-idOpenAI Organization ID (enterprise)
--from-skillsPath to a SKILL.md file for auto-configuration
--from-skill-dirPath to a skill folder (SKILL.md + scripts + reference files) to vendor into the new agent and wire (egress/env). See Skills CLI / Importing a skill folder
--write-forge-metafalseWith --from-skill-dir: inject inferred requires.bins into the imported SKILL.md when it has no metadata.forge block
--non-interactivefalseSkip interactive prompts
--compressionfalseEnable reversible context compression — writes compression.enabled: true to the scaffolded forge.yaml. See Context Compression
--authAuth mode: none, oidc, http_verifier, aws_sigv4, gcp_iap, azure_ad, custom
--auth-issuerOIDC issuer URL (required with --auth=oidc)
--auth-audienceOIDC audience (required with --auth=oidc)
--auth-urlVerifier URL (required with --auth=http_verifier)
--auth-default-orgDefault org_id for http_verifier
--auth-groups-claimCustom JWT claim name for groups (oidc, default groups)
--auth-aws-regionAWS region for aws_sigv4 (e.g. us-east-1)
--auth-aws-audienceInformational audience for aws_sigv4
--auth-aws-allowed-principalAllowed principal glob for aws_sigv4 (repeatable)
--auth-aws-allowed-accountAllowed AWS account ID for aws_sigv4 (repeatable, 12-digit)
--auth-aws-cache-ttl60saws_sigv4 identity cache TTL
--auth-gcp-iap-audienceBackend service ID for gcp_iap
--auth-azure-tenantEntra tenant GUID for azure_ad
--auth-azure-audienceAudience (Application ID URI) for azure_ad
--auth-azure-multi-tenantfalseAccept tokens from any Entra tenant
--auth-azure-allowed-tenantAllowed Entra tenant GUID for multi-tenant azure_ad (repeatable)
--auth-azure-groups-modeclaimazure_ad groups mode: claim or graph

Generated Files

forge init generates these key files:

FilePurpose
forge.yamlAgent configuration
guardrails.jsonGuardrail policy config (PII, security, secret patterns, gate config)
SKILL.mdAgent skill definition
.envEnvironment variables
.gitignoreIncludes guardrails.json, .env, .forge/

Examples

# Interactive mode (default)
forge init my-agent

# Non-interactive with all options
forge init my-agent \
  --framework langchain \
  --language python \
  --model-provider openai \
  --channels slack,telegram \
  --non-interactive

# From a skills file
forge init my-agent --from-skills SKILL.md

# From a skill folder (SKILL.md + scripts + reference files)
forge init my-agent --from-skill-dir ./path/to/skill-folder

# With builtin tools and registry skills
forge init my-agent \
  --framework custom \
  --model-provider openai \
  --tools web_search,http_request \
  --skills github \
  --api-key sk-... \
  --non-interactive

# OpenAI enterprise with organization ID
forge init my-agent \
  --model-provider openai \
  --api-key sk-... \
  --org-id org-xxxxxxxxxxxxxxxxxxxxxxxx \
  --non-interactive

# AWS IAM auth (any caller in account 412664885516)
forge init my-agent \
  --model-provider ollama \
  --auth=aws_sigv4 \
  --auth-aws-region=us-east-1 \
  --auth-aws-allowed-account=412664885516 \
  --non-interactive

# Azure AD multi-tenant with explicit partner allowlist
forge init my-agent \
  --model-provider ollama \
  --auth=azure_ad \
  --auth-azure-audience=api://forge \
  --auth-azure-multi-tenant \
  --auth-azure-allowed-tenant=00000000-1111-... \
  --auth-azure-allowed-tenant=55555555-6666-... \
  --non-interactive

See Authentication for the full auth provider reference.


forge try

Talk to a working demo agent in your terminal in under 60 seconds — no build, no cluster, no config. Scaffolds a keyless demo agent (the native forge LLM executor + the weather skill + http_request/datetime_now/math_calculate builtins) into a throwaway workspace, resolves whatever model credential is available, and drops you into a chat whose tool calls and egress checks render inline. See the Quick Start for the full walkthrough.

# Interactive: resolves a credential, then chat
forge try

# One-shot (CI / docs / a quick check)
forge try --once "what's 17% of 4,200?"

# Keep the demo agent to make it your own (writes ./forge-quickstart)
forge try --keep
FlagDescription
--providerModel provider: openai, anthropic, gemini, or ollama. Skips auto-resolution.
--modelModel name (defaults to the provider's default).
--once <prompt>Run a single prompt non-interactively, then exit.
--keepWrite the demo agent to ./forge-quickstart instead of an auto-cleaned temp dir.
--quietHide the inline tool/egress loop lines.
--auditShow the full NDJSON audit event stream instead of the compact summary.

Credential resolution order: explicit --provider/--model → env key (ANTHROPIC_API_KEYOPENAI_API_KEYGEMINI_API_KEY) → saved OpenAI OAuth session → local Ollama daemon → interactive picker (sign in with OpenAI, paste a key, or use Ollama). Nothing is written to disk unless you pass --keep; a pasted key is held in memory only. Use forge auth logout to clear a saved OAuth session and re-show the picker.

The demo runs the same runtime as forge run (tool registry, egress enforcement, audit + progress hooks) in-process — no A2A server, daemon, or port binding. Exit with /exit, Ctrl-D, or Ctrl-C.


forge compression

Inspect context compression state.

forge compression suggestions

Shows keep_patterns candidates mined from context_expand retrievals (the learning loop), with a paste-ready compression.keep_patterns block for entries that crossed the suggestion threshold.

forge build

Build the agent container artifact. Runs the full 8-stage build pipeline.

forge build [flags]

Uses global --config and --output-dir flags. Output is written to .forge-output/ by default.

Flags

FlagDefaultDescription
--signing-keyPath to Ed25519 private key for signing build output
--slimfalseMinimize image size (skip heavy/optional binaries)
--alpinefalsePrefer Alpine base image
--local-binLocal binary override as name=/path/to/file (repeatable). See Binary Dependencies § Use a local binary file.
--policyPath to a YAML SecurityPolicy file for the build's security-analysis stage (overrides forge.yaml security.policy_path and the builtin DefaultPolicy). Same schema as forge skills audit --policy. See Skills CLI / Security Audit.

Examples

# Build with default config
forge build

# Build with custom config and output
forge build --config agent.yaml --output-dir ./build

# Build with a local binary override
forge build --local-bin forge=/path/to/linux/forge

# Build with Alpine base and slim image
forge build --alpine --slim

# Build with a custom security policy (e.g. acknowledged internal egress domains)
forge build --policy ./security-policy.yaml

When the security-analysis stage fails the policy check, per-skill rule + message detail is printed to stderr along with the path to compiled/security-audit.json (the full risk-factor breakdown) and a hint about overriding the active policy. The legacy "2 error(s)" summary is preserved in the returned error for programmatic consumers.


forge validate

Validate agent spec and forge.yaml.

forge validate [flags]

Flags

FlagDefaultDescription
--strictfalseTreat warnings as errors
--command-compatfalseCheck Command platform import compatibility

Examples

# Basic validation
forge validate

# Strict mode
forge validate --strict

# Check Command compatibility
forge validate --command-compat

forge run

Run the agent locally with an A2A-compliant dev server.

forge run [flags]

On startup the server prints a banner whose Forge: line shows the running binary/runtime version (issue #335/#336) — e.g. Forge: v0.18.1. A build without embedded version info degrades to dev (or dev (commit: <sha>)), so an operator can tell at a glance which forge runtime an agent pod is on. This is the runtime version; forge --version prints the CLI's, and the OTel forge.runtime.version span attribute carries the same value for traces.

Flags

FlagDefaultDescription
--port8080Port for the A2A dev server
--host"" (all interfaces)Bind address
--shutdown-timeout0 (immediate)Graceful shutdown timeout
--mock-toolsfalseUse mock runtime instead of subprocess
--enforce-guardrailsfalseEnforce guardrail violations as errors
--modelOverride model name (sets MODEL_NAME env var)
--providerLLM provider: openai, anthropic, or ollama
--compressionEnable reversible context compression; --compression=false forces it off. Absent = forge.yaml/env decide (sets FORGE_COMPRESSION). See Context Compression
--env.envPath to .env file
--withComma-separated channel adapters (e.g., slack,telegram)
--auth-urlExternal auth provider URL for token validation
--cors-originslocalhostComma-separated CORS allowed origins (e.g., https://app.example.com,https://admin.example.com). Use * to allow all origins
--otel-enabledfalseEnable OTLP tracing export. Falls back to OTEL_SDK_DISABLED env and observability.tracing.enabled in forge.yaml. See Observability — Tracing.
--otel-endpointOTLP target URL. Falls back to OTEL_EXPORTER_OTLP_TRACES_ENDPOINT / OTEL_EXPORTER_OTLP_ENDPOINT.
--otel-protocolhttp/protobufOTLP protocol: http/protobuf or grpc. HTTP is recommended (the egress enforcer can wrap it).
--otel-samplerparentbased_always_onStandard OTEL_TRACES_SAMPLER name.
--otel-sampler-ratio1.0Ratio for *traceidratio* samplers (0.0–1.0).
--otel-timeout10sPer-request exporter timeout.
--otel-service-nameagent_idOTel service.name resource attribute.
--otel-capture-contentfalseReserved — enterprise opt-in for prompt/completion content on spans. Phase 3 ships metadata-only.
--otel-redacttruePII redaction posture flag.

Examples

# Run with defaults
forge run

# Run with mock tools on custom port
forge run --port 9090 --mock-tools

# Run with LLM provider and channels
forge run --provider openai --model gpt-4 --with slack

# Container deployment
forge run --host 0.0.0.0 --shutdown-timeout 30s

# Run with guardrails enforced
forge run --enforce-guardrails --env .env.production

# Run with custom CORS origins (for K8s ingress)
forge run --cors-origins 'https://app.example.com,https://admin.example.com'

# Run with OpenTelemetry tracing enabled (export to local collector)
forge run --otel-enabled \
  --otel-endpoint http://localhost:4318/v1/traces \
  --otel-sampler always_on

# Same, but service name + protocol override
forge run --otel-enabled \
  --otel-endpoint otel.example.com:4317 \
  --otel-protocol grpc \
  --otel-service-name my-agent-staging

forge serve

Manage the agent as a background daemon process.

forge serve [start|stop|status|logs] [flags]

Subcommands

SubcommandDescription
start (default)Start the daemon in background
stopSend SIGTERM (10s timeout, SIGKILL fallback)
statusShow PID, listen address, health check
logsTail .forge/serve.log

Flags (start)

FlagDefaultDescription
--port8080HTTP server port
--host127.0.0.1Bind address (secure default)
--withChannel adapters
--cors-originslocalhostComma-separated CORS allowed origins
--compressionEnable reversible context compression; --compression=false forces it off. Forwarded to the daemon forge run only when explicitly passed

Examples

# Start daemon (secure defaults: 127.0.0.1, 30s shutdown timeout)
forge serve

# Start on custom port
forge serve start --port 9090 --host 0.0.0.0

# Stop the daemon
forge serve stop

# Check status (PID, uptime, health)
forge serve status

# View recent logs (last 100 lines)
forge serve logs

The daemon forks forge run in the background with setsid, writes state to .forge/serve.json, and redirects output to .forge/serve.log.


forge export

Export agent spec for Command platform import.

forge export [flags]

Flags

FlagDefaultDescription
--output{agent_id}-forge.jsonOutput file path
--prettyfalseFormat JSON with indentation
--include-schemasfalseEmbed tool schemas inline
--simulate-importfalsePrint simulated import result
--devfalseInclude dev-category tools in export

Examples

# Export with defaults
forge export

# Pretty-print with embedded schemas
forge export --pretty --include-schemas

# Simulate Command import
forge export --simulate-import

forge package

Build a container image for the agent.

forge package [flags]

Flags

FlagDefaultDescription
--pushfalsePush image to registry after building
--platformTarget platform (e.g., linux/amd64)
--no-cachefalseDisable layer cache
--devfalseInclude dev tools in image
--prodfalseProduction build (rejects dev tools and dev-open egress)
--verifyfalseSmoke-test container after build
--registryRegistry prefix (e.g., ghcr.io/org)
--builderForce builder: docker, podman, or buildah
--skip-buildfalseSkip re-running forge build
--with-channelsfalseGenerate docker-compose.yaml with channel adapters
--slimfalseMinimize image size (skip heavy/optional binaries)
--alpinefalsePrefer Alpine base image
--local-binLocal binary override as name=/path/to/file (repeatable). See Binary Dependencies § Use a local binary file.

Examples

# Build image with auto-detected builder
forge package

# Build and push to registry
forge package --registry ghcr.io/myorg --push

# Build for specific platform with no cache
forge package --platform linux/amd64 --no-cache

# Generate docker-compose with channels
forge package --with-channels

# Package with a local binary override
forge package --local-bin forge=/path/to/linux/forge

# Package with slim Alpine image
forge package --alpine --slim

forge schedule

Manage cron schedules.

forge schedule list

Lists all configured cron schedules (both YAML-defined and LLM-created).


forge mcp

Manage Model Context Protocol servers and their OAuth tokens. Servers are declared under the mcp: block in forge.yaml; each server's discovered tools register as namespaced <server>__<tool>.

# List configured MCP servers + their discovered tools and auth status
forge mcp list

# Test a server connection (optionally invoke a tool)
forge mcp test <server>
forge mcp test <server> --call <tool> --args '{"key":"value"}'

# OAuth login for a server (type: oauth) — discovers endpoints via
# RFC 9728/8414 + dynamic client registration (RFC 7591) at first login
forge mcp login <server>

# Clear a stored MCP OAuth token
forge mcp logout <server>

Auth types (mcp.servers[].auth.type): oauth (browser login, stored token), bearer / static (token from token_env), platform (managed agent-principal token — no login needed), and user (managed delegated per-user token — lazy consent, no upfront login). See MCP configuration and the MCP CLI reference.


forge tool

Manage and inspect agent tools.

forge tool list

List all available tools.

forge tool list

forge tool describe

Show tool details and input schema.

forge tool describe <name>

forge channel

Manage agent communication channels.

forge channel add

Add a channel adapter to the project.

forge channel add <slack|telegram>

forge channel serve

Run a standalone channel adapter.

forge channel serve <slack|telegram>

Requires the AGENT_URL environment variable to be set.

forge channel list

List available channel adapters.

forge channel list

forge channel status

Show configured channels from forge.yaml.

forge channel status

forge secret

Manage encrypted secrets.

# Store a secret (prompts for value securely)
forge secret set OPENAI_API_KEY

# Store with inline value
forge secret set SLACK_BOT_TOKEN xoxb-...

# Retrieve a secret (shows source)
forge secret get OPENAI_API_KEY

# List all secret keys
forge secret list

# Delete a secret
forge secret delete OLD_KEY

# Agent-local secret
forge secret set API_KEY --local

forge auth

Manage the runtime bearer token Forge mints at agent startup (issue #162 part 1, PR #168). The token is stored at <agent-root>/.forge/runtime.token (0600 permissions) and is the same token channel adapters use to call back into the A2A endpoint. Scheduled CronJobs deployed via forge package also consume this token through a Kubernetes Secret the operator populates out-of-band — forge package never bakes the token into the generated manifests.

# Print the stored token to stdout. Exits 1 with an actionable error
# when the file is absent.
forge auth show-token

# Generate a fresh 256-bit token, store it (overwriting any existing
# value), and print to stdout. Use for first-deploy bootstrap from a
# clean checkout.
forge auth mint-token

# Print a ready-to-apply Kubernetes Secret YAML containing the token.
# Default name and namespace match what `forge package` emits.
forge auth secret-yaml
forge auth secret-yaml --namespace prod
forge auth secret-yaml --name custom-secret-name

# Common one-liner: populate the Secret a `forge package` deploy
# expects from the local runtime.token.
forge auth secret-yaml | kubectl apply -f -

# Remove a stored LLM OAuth credential (default: openai) so the next
# `forge init` / `forge try` prompts you to sign in again.
forge auth logout
forge auth logout openai

The forge.agent.id label on the generated Secret is always sourced from forge.yaml's agent_id (or the "forge-agent" fallback), never from the --name override — so operators using --name to match an existing cluster convention still see telemetry and label-selectors keyed on the real agent ID.

forge auth logout is an operator/laptop command: it deletes the OAuth credential from ~/.forge/credentials and the encrypted store, and refuses to run inside an agent runtime — a container, or when FORGE_PLATFORM_TOKEN is set. A deployed agent authenticates with an injected API key or platform token, not the OAuth credential store, so there is nothing there for the runtime to log out of; the refusal is defense-in-depth so Forge is never the tool an agent shells out to in order to wipe an operator's credential.


forge key

Manage Ed25519 signing keys.

# Generate an Ed25519 signing keypair
forge key generate

# Generate with a custom name
forge key generate --name ci-key

# Add a public key to the trusted keyring
forge key trust ~/.forge/signing-key.pub

# List signing and trusted keys
forge key list

forge skills

Manage agent skills.

# Add a skill from the registry (prompts for env vars, merges egress domains)
forge skills add <skill-name>

# Import an external skill folder (SKILL.md + scripts + reference files) into
# the current project; vendors files, merges egress, reports env requirements
forge skills import ./path/to/skill-folder
forge skills import ./path/to/skill-folder --name my-skill --overwrite
# Infer + inject requires.bins (python3/node) for a plain SKILL.md with no metadata.forge
forge skills import ./path/to/skill-folder --write-forge-meta

# List available skills
forge skills list

# Filter by category
forge skills list --category sre

# Filter by tags
forge skills list --tags kubernetes,incident-response

# Validate skill requirements
forge skills validate  # checks bins, env, invalid Input keys, missing/orphan scripts; non-zero exit on error

# Audit skill security
forge skills audit --embedded

# Sign a skill
forge skills sign

# Generate a signing key
forge skills keygen

# Generate trust report
forge skills trust-report

forge ui

Launch the local web dashboard.

# Launch with defaults
forge ui

# Specify workspace and port
forge ui --dir /path/to/workspace --port 4200

# Launch without auto-opening browser
forge ui --no-open

See Dashboard for full documentation.

On this page