openspec init
Creates the OpenSpec directory structure and configures AI tool integrations.
openspec init [path] [options]Arguments
Section titled “Arguments”| Argument | Description |
|---|---|
path | Project directory (default: current) |
Options
Section titled “Options”| Option | Description |
|---|---|
--tools <list> | Comma-separated tool IDs, all, or none |
What It Creates
Section titled “What It Creates”openspec/├── project.md # Project conventions template├── AGENTS.md # AI instructions├── specs/ # Specifications directory└── changes/ └── archive/ # Completed changesPlus tool-specific files based on your selection.
Interactive Mode
Section titled “Interactive Mode”When run without --tools, prompts for AI tool selection:
? Which AI tools would you like to configure? ◉ Claude Code ◯ Cursor ◉ OpenCode ◯ GitHub CopilotNon-Interactive Mode
Section titled “Non-Interactive Mode”# Select specific toolsopenspec init --tools claude,cursor,opencode
# Select all available toolsopenspec init --tools all
# Skip tool configurationopenspec init --tools noneExamples
Section titled “Examples”Basic initialization
Section titled “Basic initialization”cd my-projectopenspec initInitialize subdirectory
Section titled “Initialize subdirectory”openspec init ./packages/apiCI/CD initialization
Section titled “CI/CD initialization”openspec init --tools allTool Configurations
Section titled “Tool Configurations”Each selected tool gets its own configuration:
| Tool | Files 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 |
Extend Mode
Section titled “Extend Mode”If OpenSpec is already initialized, init enters extend mode:
- Skips directory creation
- Allows adding new tools
- Refreshes existing tool configurations
# Add Cursor to existing setupopenspec init --tools cursorAfter Initialization
Section titled “After Initialization”- Restart your AI assistant - Slash commands load at startup
- Populate project.md - Add your conventions
- Run
openspec list- Verify setup
Exit Codes
Section titled “Exit Codes”| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Error (invalid tools, permissions) |