Skip to content

CLI Reference

Forge ships as a single binary: forge. All subcommands follow the form forge <subcommand> [flags].

A global --log-level flag (values: trace, debug, info, warn, error) is accepted by every subcommand and overrides the config file value. The default is info.

Exit codes: 0 for success, 1 for any error (the error message is printed to stderr).


Index a repository. Performs an incremental index by default; use --full to wipe and re-index from scratch.

forge index <path> [flags]
FlagTypeDefaultDescription
pathstring (positional)Path to the repository root. Required.
--fullboolfalseWipe the existing index and re-index from scratch.
--with-searchboolfalseBuild the Tantivy full-text search index after AST indexing. Required before forge search and forge_search work.
--with-gitboolfalseIngest git commit history after AST indexing. Equivalent to running forge ingest-git afterward.
--max-commitsinteger1000Maximum git commits to ingest when --with-git is set.
--with-embeddingsboolfalseGenerate vector embeddings for semantic search. Requires --with-search. Embedding failure is non-fatal. (Requires embeddings build feature.)
--cache-tostringPush the built index to R2 team cache. Format: r2://<team_id>/<cache-key>. Requires Team tier.
--use-cachestringFetch index from R2 team cache before indexing; skips rebuild on hit. Format: r2://<team_id>/<cache-key>. Requires Team tier.

Examples:

Terminal window
# Incremental index with search support
forge index . --with-search
# Full re-index including git history
forge index /my/repo --full --with-search --with-git
# CI: use cached index if available, push new cache after
forge index . --use-cache r2://team_abc123/main --cache-to r2://team_abc123/main

Expected output:

Indexed 622 files in 2.6s (incremental)
Search index built: 622 chunks

Start the Forge MCP stdio server. Exposes all tools over JSON-RPC 2.0 on stdin/stdout.

forge serve [path] [flags]
FlagTypeDefaultDescription
pathstring (positional)current directoryPath to the repository root.
--watchboolfalseEnable background file watching; triggers incremental re-index on file save.
--dashboardboolfalseStart the local web dashboard alongside the MCP server. Requires Solo tier or higher.

Examples:

Terminal window
forge serve .
forge serve /my/repo --watch

Show current index statistics for a repository.

forge status [flags]
FlagTypeDefaultDescription
--repostringcurrent directoryPath to the repository.

Expected output:

Repository: /my/repo
Files indexed: 622
Last indexed: 2026-04-16 10:30 UTC
Stale files: 0
Git history: available (1000 commits)
License: Solo — p***[email protected] (expires 2027-04-15)

Run health checks and print findings grouped by severity.

forge health [flags]
FlagTypeDefaultDescription
--repostringcurrent directoryPath to the repository.
--no-secret-scanboolfalseDisable the secret-scanning health check.

Exit codes: 0 for no findings or warnings/info only; 1 for any P0 (critical) or P1 (error) findings.

Expected output:

P0 Critical: 0
P1 Error: 1
[ERROR] broken_imports: src/api/handler.ts imports '../models/user' which does not exist
P2 Warning: 3
P3 Info: 5

Generate an architecture map for a repository.

forge map [flags]
FlagTypeDefaultDescription
--repostringcurrent directoryPath to the repository.
--outputstringstdoutOutput file path.

Example:

Terminal window
forge map --repo . --output terrain/ironpine-labs/architecture.md

Full-text search across indexed code chunks. Understands camelCase and snake_case: searching payment finds processPayment, payment_handler, and PaymentService.

Requires the search index (run forge index --with-search first).

forge search <query> [flags]
FlagTypeDefaultDescription
querystring (positional)Keywords. Supports AND/OR and quoted phrases.
--repostringcurrent directoryPath to the repository.
--languagestringRestrict to a language: typescript, rust, python, go.
--chunk-typestringRestrict to a chunk type: function, class, interface, module_header.
--limitinteger10Maximum results to return.

Example:

Terminal window
forge search "payment handler" --language typescript --limit 5

Structural AST pattern search using $VAR wildcards for single-node matches and $$$VAR for multi-node spreads.

forge pattern <pattern> [flags]
FlagTypeDefaultDescription
patternstring (positional)Code pattern to search for.
--repostringcurrent directoryPath to the repository.
--languagestringRestrict to a language.
--limitinteger20Maximum results to return.

Examples:

Terminal window
forge pattern 'console.log($$$ARGS)'
forge pattern 'async function $NAME($$$PARAMS) { $$$BODY }'
forge pattern 'fn $NAME($$$) -> Result<$$$, $$$> { $$$BODY }' --language rust

Ingest a SCIP index file. Upgrades heuristic import edges to compiler-resolved edges. Requires Pro tier or higher.

forge ingest-scip <path> [flags]
FlagTypeDefaultDescription
pathstring (positional)Path to the SCIP index file (typically index.scip).
--repostringdirectory containing the SCIP fileRepository root path.

Ingest test coverage data. Auto-detects LCOV, Istanbul JSON, or Cobertura XML.

forge ingest-coverage <path> [flags]
FlagTypeDefaultDescription
pathstring (positional)Path to the coverage file.
--repostringcurrent directoryRepository root, used to resolve relative file paths in the report.

Ingest git commit history. Populates the commits and file_changes tables; enables forge_git_history, forge_git_blame, and hotspot analysis.

forge ingest-git [flags]
FlagTypeDefaultDescription
--repostringcurrent directoryPath to the repository.
--max-commitsinteger1000Maximum commits to ingest.

Show git blame for a file, grouped by commit section.

forge git-blame <file> [flags]
FlagTypeDefaultDescription
filestring (positional)File path (relative to the repository root or absolute).
--repostringcurrent directoryRepository path.

Pre-download the embedding model without running inference. Run once before forge index --with-embeddings to avoid blocking on a download. (Requires embeddings build feature.)

forge warmup-model [flags]
FlagTypeDefaultDescription
--modelstringnomic-embed-text-v1.5Model name to download and verify.

Set up the embedding runtime. Downloads and configures Ollama and the embedding model automatically. Safe to re-run. (Requires embeddings build feature.)

forge setup [flags]
FlagTypeDefaultDescription
--bundle-pathstringPath to an offline bundle directory. When provided, installs from the bundle instead of downloading from the internet.

Create or install an offline embedding bundle for air-gapped installations. (Requires embeddings build feature.)

forge bundle create [flags]
FlagTypeDefaultDescription
--outputstringforge-embedding-bundle.tar.gzOutput path for the bundle tarball.
forge bundle install <path>
ArgumentTypeDescription
pathstring (positional)Path to a bundle tarball produced by forge bundle create.

Activate a Forge license key or team invite token. License key validation is performed entirely offline (Ed25519 signature check); no network call is made. Team invite activation exchanges the token with the admin portal API.

forge activate [<key>] [flags]
FlagTypeDefaultDescription
keystring (positional)License key from your purchase email. Mutually exclusive with --team.
--teamstringTeam invite token provided by your team admin.

Example:

Terminal window
forge activate eyJrZXkiOi....<signature>
forge activate --team invite_abc123

Expected output:

License activated.
Tier: Solo
Email: p***[email protected]
Features: dashboard, plugins, semantic_search, workflow_tools
Expires: 2027-04-15

Show the current license status, masked email, features, and expiry date.

forge license

No flags. Shows community-mode feature summary if no license is installed.


Check for or install binary updates from https://downloads.forge.ironpinelabs.com.

forge update [flags]
FlagTypeDefaultDescription
--checkboolfalseOnly print the available version and URL; do not download.

Show local usage statistics from ~/.forge/stats.json. Data never leaves the machine.

forge stats [flags]
FlagTypeDefaultDescription
--jsonboolfalseOutput raw JSON instead of a human-readable table.
--resetboolfalseReset all statistics (prompts for confirmation).

Run Forge in CI mode: index, health check, output annotations in CI platform formats, exit non-zero on P0 findings. Requires Pro tier or higher.

forge ci [flags]
FlagTypeDefaultDescription
--repostring.Repository path.
--formatstringautoOutput format: github, gitlab, azure, or auto (detects from CI environment variables).
--fail-on-p0boolfalseExit with code 1 if any P0 finding is present.
--teamstringTeam ID for automatic R2 index cache usage. Requires Team tier.

Open the pricing and trial page in the default browser. On headless systems (no DISPLAY or WAYLAND_DISPLAY), prints the URL to stdout instead.

forge upgrade

No flags.


Remove this machine’s license association. Use when replacing a laptop or decommissioning a development machine.

forge deactivate [flags]
FlagTypeDefaultDescription
--yesboolfalseConfirm deactivation without an interactive prompt.

Display the heartbeat status, last check time, cached result, and the exact payload transmitted. Nothing is sent by running this command.

forge config heartbeat show

Force an immediate heartbeat, bypassing the weekly schedule. Use after re-subscribing or to test connectivity. Exits non-zero if the heartbeat fails.

forge config heartbeat now

Display or export third-party software attribution notices.

forge licenses [flags]
FlagTypeDefaultDescription
--htmlboolfalseWrite the full LICENSES.html attribution document to disk.
--textboolfalsePrint condensed text attribution (license names and crate counts).
--outputstring./LICENSES.htmlOutput path for --html mode.

Examples:

Terminal window
forge licenses # Print summary to stdout
forge licenses --text # Condensed attribution text
forge licenses --html # Write LICENSES.html to current directory
forge licenses --html --output /tmp/ # Write to a specific path