Skip to content

openspec init

Creates the OpenSpec directory structure and configures AI tool integrations.

Terminal window
openspec init [path] [options]
ArgumentDescription
pathProject directory (default: current)
OptionDescription
--tools <list>Comma-separated tool IDs, all, or none
openspec/
├── project.md # Project conventions template
├── AGENTS.md # AI instructions
├── specs/ # Specifications directory
└── changes/
└── archive/ # Completed changes

Plus tool-specific files based on your selection.

When run without --tools, prompts for AI tool selection:

? Which AI tools would you like to configure?
◉ Claude Code
◯ Cursor
◉ OpenCode
◯ GitHub Copilot
Terminal window
# Select specific tools
openspec init --tools claude,cursor,opencode
# Select all available tools
openspec init --tools all
# Skip tool configuration
openspec init --tools none
Terminal window
cd my-project
openspec init
Terminal window
openspec init ./packages/api
Terminal window
openspec init --tools all

Each selected tool gets its own configuration:

ToolFiles Created
Claude Code.claude/commands/openspec/*.md, CLAUDE.md
Cursor.cursor/commands/openspec-*.md
OpenCode.opencode/commands/openspec-*.md
Windsurf.windsurf/workflows/openspec-*.md
Codex~/.codex/prompts/openspec-*.md
GitHub Copilot.github/prompts/openspec-*.prompt.md

If OpenSpec is already initialized, init enters extend mode:

  • Skips directory creation
  • Allows adding new tools
  • Refreshes existing tool configurations
Terminal window
# Add Cursor to existing setup
openspec init --tools cursor
  1. Restart your AI assistant - Slash commands load at startup
  2. Populate project.md - Add your conventions
  3. Run openspec list - Verify setup
CodeMeaning
0Success
1Error (invalid tools, permissions)