CLI Commands
Complete reference for all SpecForge CLI commands, flags, and usage examples.
The specforge CLI is distributed as the npm package @specforge/cli. It manages authentication, project configuration, team membership, and agent scaffolding.
npm install -g @specforge/cli
# or run directly
npx @specforge/cli <command>Authentication
specforge login
Authenticate with SpecForge.
specforge loginOpens a browser-based OAuth flow and stores credentials in ~/.specforge/config.json.
For headless environments (remote servers, CI):
specforge login --api-key sf_live_...Credentials are stored in ~/.specforge/config.json:
{
"apiKey": "sf_live_...",
"userId": "user_abc123"
}Project Setup
specforge init
Initialize SpecForge in the current directory. Creates configuration files, detects installed coding tools, and generates agent/skill files.
specforge initWhat It Does
- Fetches your projects from the SpecForge API and prompts for selection
- Fetches specifications from the selected project and prompts for selection
- Prompts for output format —
json(structured MCP responses) ortoon(human-readable) - Creates
.specforge/config.jsonwith project and specification IDs - Detects installed tools — Claude Code, Cursor, Gemini CLI, Codex CLI, OpenCode — and generates per-tool config files
- Generates agent instruction files —
CLAUDE.md,GEMINI.md, orAGENTS.mddepending on detected tools - Optionally sets up Agent Teams — if
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1is set, generates skill files in.claude/skills/
Flags
| Flag | Effect |
|---|---|
--project <id> | Skip project selection, use this project ID |
--spec <id> | Skip specification selection, use this specification ID |
--format <type> | Set output format: json or toon |
--yes | Accept all defaults without prompting |
--force | Overwrite existing config files without confirmation |
--spec-only | Update only the specification ID, keep everything else |
--show | Print generated config to stdout instead of writing files |
--skip-git | Skip git repository checks during init |
--no-agents | Skip agent instruction file generation |
# Non-interactive for CI
specforge init --project proj_abc123 --spec spec_xyz789 --format json --yes
# Update only the active specification
specforge init --spec-only
# Preview what would be generated
specforge init --show
# Reinitialize, overwriting existing files
specforge init --forceℹ️ If config files already exist,
specforge initprompts for confirmation before overwriting unless--forceis passed.
specforge configure
View or set configuration values. Without arguments, shows the full resolved config. With a key, shows that value. With a key and value, sets it.
specforge configure [key] [value]configure accepts exactly five flat keys (no dotted paths). Anything else is rejected with an “invalid key” error:
| Key | Scope | Values | Purpose |
|---|---|---|---|
mcpOutputFormat | global + project | json | toon (default toon) | Local MCP response encoding |
projectId | project | ID | Default project ID |
specificationId | project | ID | Default specification ID |
autoSetContext | project | true | false | Auto-set working context on MCP server start |
defaultProjectId | global | ID | Global default project ID |
# View all config
specforge configure
# View a specific value
specforge configure defaultProjectId
# Set the local MCP output format (json or toon)
specforge configure mcpOutputFormat json
# Set the default project / specification
specforge configure projectId proj_abc123
specforge configure specificationId spec_xyz789Modifies .specforge/config.json (project keys) or ~/.specforge/config.json (global keys) directly. Useful for scripting or making point changes without re-running init.
ℹ️ Agent Teams settings (
agentTeams.*) and other structured sections are notconfigurekeys — they live in the.specforge/config.jsonfile and are set byspecforge initor by hand-editing that file. See Configuration Schema.
specforge switch
Change the active project or specification context.
specforge switch <id>The <id> can be a project ID or a specification ID. SpecForge detects the type automatically.
# Switch to a different project
specforge switch proj_abc123
# Switch to a different specification
specforge switch spec_xyz789
# Switch both at once
specforge switch proj_abc123 --spec spec_xyz789Updates .specforge/config.json and regenerates agent instruction files to reflect the new context. The MCP server picks up the change on the next tool call.
Diagnostics
specforge doctor
Run diagnostics to verify your SpecForge configuration. Checks authentication, project config, MCP server connectivity, and agent setup.
specforge doctor| Flag | Effect |
|---|---|
--json | Output results as JSON |
--verbose | Show detailed diagnostic info including API response times |
SpecForge Doctor
API Key ✓ authenticated as user@example.com
MCP Server ✓ registered in .mcp.json
Project ✓ proj_abc123 accessible
Specification ✓ spec_xyz789 loaded (3 epics, 14 tickets)
Agent Config ✓ CLAUDE.md present
Git ✓ clean working tree
All checks passed.✅ Run
specforge doctorafter any configuration change to verify everything still works.
specforge status
Display the current work context: active project, specification, and ticket status summary.
specforge status| Flag | Effect |
|---|---|
--json | Output as JSON |
--toon | Display a visual summary with progress bars and ticket counts |
Diagnostics & Debug
specforge debug
Low-level diagnostics for inspecting the MCP surface and connectivity. Useful when troubleshooting an agent integration.
specforge debug call <tool> # Direct MCP tool dispatch
specforge debug tools # List available MCP tools
specforge debug test # Connection test
specforge debug whoami # Identity and config infoℹ️ The planning-review gate and per-ticket assay run inside the MCP tools (
complete_planning_session,complete_work_session) — there is no standalonespecforgereview command. See MCP Tools.
Team Management
specforge members add
Invite a user to the current project.
specforge members add <email> [--role <role>]Roles: editor, viewer. Default is editor. (The project creator is the owner; invites accept only editor or viewer.)
specforge members add alice@example.com
specforge members add bob@example.com --role viewerspecforge members role
Change a member’s role.
specforge members role <email> <role>specforge members remove
Remove a member from the project.
specforge members remove <email>⚠️ Removing a member revokes access immediately and cannot be undone — you must re-invite to restore access.
specforge invitations accept
Accept a project invitation.
specforge invitations accept <invitation-id>specforge invitations decline
Decline a project invitation.
specforge invitations decline <invitation-id>Agent Scaffolding
specforge scaffold
Generate or regenerate agent configuration files for detected coding tools. Use when adding a new tool to your environment or resetting a config you accidentally modified.
specforge scaffold| Flag | Effect |
|---|---|
--target <target> | Specific tool: claude-code, cursor, gemini, codex, opencode |
--dry-run | Preview what would be generated without writing files |
# Detect all tools and generate configs
specforge scaffold
# Target a specific tool
specforge scaffold --target claude-code
# Preview without writing
specforge scaffold --dry-runGenerated Files by Target
| Target | Files Generated |
|---|---|
claude-code | .mcp.json, CLAUDE.md, .claude/skills/, .claude/agents/ |
cursor | .mcp.json, AGENTS.md |
gemini | .gemini/settings.json, GEMINI.md |
codex | .codex/config.toml, AGENTS.md |
opencode | opencode.json, AGENTS.md |
Feedback
specforge feedback
Submit feedback about SpecForge directly from the CLI.
specforge feedbackOpens an interactive prompt to categorize and describe your feedback.
File Summary
| File | Scope | Purpose |
|---|---|---|
~/.specforge/config.json | Global | API key and account credentials |
.specforge/config.json | Project | Project ID, specification ID, Agent Teams config |
.mcp.json | Project | MCP server registration for Claude Code and Cursor |
CLAUDE.md | Project | Project context anchor for Claude Code |
GEMINI.md | Project | Agent instructions for Gemini CLI |
AGENTS.md | Project | Universal agent instructions for Codex CLI, OpenCode, and others |
.claude/skills/ | Project | Operational skills for Claude Code (planning, implementation, validation) |
.claude/agents/ | Project | Agent definitions for Claude Code Agent Teams |
.gemini/settings.json | Project | MCP config for Gemini CLI |
.codex/config.toml | Project | MCP config for Codex CLI |
opencode.json | Project | MCP config for OpenCode |
ℹ️ Add
.specforge/to your.gitignoreif your config contains sensitive values. The.mcp.jsonfile is safe to commit as long as you use environment variables for the API key instead of hardcoding it.
See Also
- Configuration Schema — Full schema for all configuration files
- MCP Tools — The 17 tools these commands configure access to
- Install CLI — First-time setup walkthrough