|
1 | 1 | # OpenSpec |
2 | 2 |
|
3 | | -A specification-driven development system for maintaining living documentation alongside your code. |
| 3 | +[](https://github.com/Fission-AI/OpenSpec/actions/workflows/ci.yml) |
| 4 | +[](https://www.npmjs.com/package/@fission-ai/openspec) |
| 5 | +[](https://nodejs.org/) |
| 6 | +[](./LICENSE) |
| 7 | +[](https://conventionalcommits.org) |
| 8 | + |
| 9 | +**Supported AI Tools:** ✅ Claude Code | 🔜 Cursor (coming soon) | 🔜 AGENTS.md support (coming soon) |
| 10 | + |
| 11 | +Create **alignment** between humans and AI coding assistants through spec-driven development. **No API keys required.** |
| 12 | + |
| 13 | +OpenSpec ensures you and your AI assistant agree on what to build before any code is written. By discussing and refining specifications first, you bring determinism to AI code generation, getting exactly what you want, not what the AI thinks you might want. |
| 14 | + |
| 15 | +## Why OpenSpec? |
| 16 | + |
| 17 | +**The Problem:** AI coding assistants are powerful but unpredictable. Without clear specifications, they generate code based on assumptions, often missing requirements or adding unwanted features. Teams waste time in review cycles because humans and AI aren't aligned on what to build. |
| 18 | + |
| 19 | +**The Solution:** OpenSpec creates alignment BEFORE code is written: |
| 20 | +- **Human-AI Alignment** - You and your AI agree on specifications before implementation |
| 21 | +- **Deterministic Output** - Clear specs lead to predictable code generation |
| 22 | +- **Team Alignment** - Everyone reviews specs, not code surprises |
| 23 | +- **Focus on What, Not How** - Define requirements while AI handles implementation |
| 24 | +- **Living Documentation** - Specs evolve with your code as a natural byproduct |
| 25 | + |
| 26 | +## What You Get |
| 27 | + |
| 28 | +- **Alignment First** - Ensure humans and AI agree on what to build before writing code |
| 29 | +- **Predictable AI Output** - Turn non-deterministic AI into a reliable development partner |
| 30 | +- **Universal Tool Support** - Works with any AI assistant - Claude Code, Cursor, or future tools |
| 31 | +- **No API Keys Required** - Integrates through context rules, not external services |
| 32 | +- **Spec-Level Reviews** - Teams review intentions, not implementation details |
| 33 | +- **Clear Feature Scope** - Know exactly what you're building and what you're not |
| 34 | +- **Progress Tracking** - See what's proposed, in progress, or completed at a glance |
| 35 | + |
| 36 | +## How It Works |
| 37 | + |
| 38 | +``` |
| 39 | +┌─────────────┐ ┌─────────────┐ ┌──────────────┐ |
| 40 | +│ SPECS │ │ CHANGES │ │ ARCHIVE │ |
| 41 | +│ (Truth) │◀──────│ (Proposals) │──────▶│ (Completed) │ |
| 42 | +└─────────────┘ └─────────────┘ └──────────────┘ |
| 43 | + ▲ │ │ |
| 44 | + │ ▼ │ |
| 45 | + │ ┌─────────────┐ │ |
| 46 | + └───────────────│ CODE │◀──────────────┘ |
| 47 | + └─────────────┘ |
| 48 | +
|
| 49 | +1. SPECS define current capabilities (what IS built) |
| 50 | +2. CHANGES propose modifications using deltas (what SHOULD change) |
| 51 | +3. CODE implements the changes following tasks |
| 52 | +4. ARCHIVE preserves completed changes after deployment |
| 53 | +``` |
4 | 54 |
|
5 | 55 | ## Installation |
6 | 56 |
|
| 57 | +### Prerequisites |
| 58 | + |
| 59 | +- Node.js >= 20.19.0 |
| 60 | + |
| 61 | +### Install OpenSpec |
| 62 | + |
| 63 | +Install globally: |
| 64 | + |
7 | 65 | ```bash |
8 | | -npm install -g openspec |
| 66 | +npm install -g @fission-ai/openspec |
9 | 67 | ``` |
10 | 68 |
|
11 | | -## Quick Start |
| 69 | +## Getting Started |
| 70 | + |
| 71 | +### 1. Initialize OpenSpec in Your Project |
12 | 72 |
|
13 | 73 | ```bash |
14 | | -# Initialize OpenSpec in your project |
| 74 | +# Navigate to your project |
| 75 | +cd my-project |
| 76 | + |
| 77 | +# Initialize OpenSpec |
15 | 78 | openspec init |
16 | 79 |
|
17 | | -# Update existing OpenSpec instructions (team-friendly) |
18 | | -openspec update |
| 80 | +# Select your AI tool (more coming soon!): |
| 81 | +# "Which AI tool do you use?" |
| 82 | +# > Claude Code |
| 83 | +# Cursor (coming soon) |
| 84 | + |
| 85 | +# This creates: |
| 86 | +# openspec/ |
| 87 | +# ├── specs/ # Current specifications (truth) |
| 88 | +# ├── changes/ # Proposed changes |
| 89 | +# └── README.md # AI instructions for your tool |
| 90 | +``` |
| 91 | + |
| 92 | +### 2. Create Your First Change |
| 93 | + |
| 94 | +Jump straight into creating a change proposal with your AI assistant (works with Claude Code, Cursor, or any AI tool): |
| 95 | + |
| 96 | +```markdown |
| 97 | +// Quick win - Add a simple new feature: |
| 98 | +You: "I want to add a user profile API endpoint. |
| 99 | + Please create an OpenSpec change proposal for this." |
19 | 100 |
|
20 | | -# List specs or changes |
21 | | -openspec spec list # specs (IDs by default; use --long for details) |
22 | | -openspec change list # changes (IDs by default; use --long for details) |
| 101 | +AI: "I'll create an OpenSpec change proposal for the user profile API..." |
| 102 | + *Creates openspec/changes/add-user-profile-api/ with:* |
| 103 | + - proposal.md (why this feature is needed) |
| 104 | + - tasks.md (implementation checklist) |
| 105 | + - design.md (API design decisions) |
| 106 | + - specs/user-profile/spec.md (new requirements) |
23 | 107 |
|
24 | | -# Archive completed changes |
25 | | -openspec archive [change-name] |
| 108 | +You: "The proposal looks good. Let's implement it." |
| 109 | + |
| 110 | +AI: "Following the tasks in openspec/changes/add-user-profile-api/tasks.md: |
| 111 | + Task 1.1: Create user profile model..." |
| 112 | + *Implements each task systematically* |
26 | 113 | ``` |
27 | 114 |
|
28 | | -## Commands |
| 115 | +### 3. Track Your Work |
29 | 116 |
|
30 | | -### `openspec init` |
| 117 | +```bash |
| 118 | +# View active changes (what's being worked on) |
| 119 | +openspec list |
31 | 120 |
|
32 | | -Initializes OpenSpec in your project by creating: |
33 | | -- `openspec/` directory structure |
34 | | -- `openspec/README.md` with OpenSpec instructions |
35 | | -- AI tool configuration files (based on your selection) |
| 121 | +# Validate your changes are properly formatted |
| 122 | +openspec validate add-2fa --strict |
36 | 123 |
|
37 | | -### `openspec update` |
| 124 | +# After deployment, archive the completed change |
| 125 | +openspec archive add-2fa |
| 126 | +# This moves the change to archive/ and updates specs/ |
| 127 | +``` |
38 | 128 |
|
39 | | -Updates OpenSpec instructions to the latest version. This command is **team-friendly** and only updates files that already exist: |
| 129 | +## Common Commands |
40 | 130 |
|
41 | | -- Always updates `openspec/README.md` with the latest OpenSpec instructions |
42 | | -- **Only updates existing AI tool configuration files** (e.g., CLAUDE.md, CURSOR.md) |
43 | | -- **Never creates new AI tool configuration files** |
44 | | -- Preserves content outside of OpenSpec markers in AI tool files |
| 131 | +```bash |
| 132 | +# Most used: |
| 133 | +openspec list # See what changes you're working on |
| 134 | +openspec archive <change> # Mark a change as complete after deployment |
45 | 135 |
|
46 | | -This allows team members to use different AI tools without conflicts. Each developer can maintain their preferred AI tool configuration file, and `openspec update` will respect their choice. |
| 136 | +# Also useful: |
| 137 | +openspec validate <change> # Check formatting before committing |
| 138 | +openspec show <change> # View change details |
| 139 | +``` |
47 | 140 |
|
48 | | -### `openspec spec` |
| 141 | +## Example: How AI Creates OpenSpec Files |
49 | 142 |
|
50 | | -Manage and view specifications. |
| 143 | +When you ask your AI assistant to "add two-factor authentication", it creates: |
51 | 144 |
|
52 | | -Examples: |
53 | | -- `openspec spec show <spec-id>` |
54 | | - - Text mode: prints raw `spec.md` content |
55 | | - - JSON mode (`--json`): returns minimal, stable shape |
56 | | - - Filters are JSON-only: `--requirements`, `--no-scenarios`, `-r/--requirement <1-based>` |
57 | | -- `openspec spec list` |
58 | | - - Prints IDs only by default |
59 | | - - Use `--long` to include `title` and `[requirements N]` |
60 | | -- `openspec spec validate <spec-id>` |
61 | | - - Text: human-readable summary to stdout/stderr |
62 | | - - `--json` for structured report |
| 145 | +``` |
| 146 | +openspec/ |
| 147 | +├── specs/ |
| 148 | +│ └── auth/ |
| 149 | +│ └── spec.md # Current auth spec (if exists) |
| 150 | +└── changes/ |
| 151 | + └── add-2fa/ # AI creates this entire structure |
| 152 | + ├── proposal.md # Why and what changes |
| 153 | + ├── tasks.md # Implementation checklist |
| 154 | + ├── design.md # Technical decisions (optional) |
| 155 | + └── specs/ |
| 156 | + └── auth/ |
| 157 | + └── spec.md # Delta showing additions |
| 158 | +``` |
63 | 159 |
|
64 | | -### `openspec change` |
| 160 | +### AI-Generated Spec (created in `openspec/specs/auth/spec.md`): |
65 | 161 |
|
66 | | -Manage and view change proposals. |
| 162 | +```markdown |
| 163 | +# Auth Specification |
67 | 164 |
|
68 | | -Examples: |
69 | | -- `openspec change show <change-id>` |
70 | | - - Text mode: prints raw `proposal.md` content |
71 | | - - JSON mode (`--json`): `{ id, title, deltaCount, deltas }` |
72 | | - - Filtering is JSON-only: `--deltas-only` (alias: `--requirements-only`, deprecated) |
73 | | -- `openspec change list` |
74 | | - - Prints IDs only by default |
75 | | - - Use `--long` to include `title` and counts `[deltas N] [tasks x/y]` |
76 | | -- `openspec change validate <change-id>` |
77 | | - - Text: human-readable result |
78 | | - - `--json` for structured report |
| 165 | +## Purpose |
| 166 | +Authentication and session management. |
79 | 167 |
|
80 | | -### `openspec archive [change-name]` |
| 168 | +## Requirements |
| 169 | +### Requirement: User Authentication |
| 170 | +The system SHALL issue a JWT on successful login. |
81 | 171 |
|
82 | | -Archives a completed change: |
83 | | -- Moves change from `openspec/changes/` to `openspec/changes/archive/` |
84 | | -- Adds a date prefix to the archived change |
85 | | -- Updates specs to reflect the new state |
86 | | -- Use `--skip-specs` to archive without updating specs (for abandoned changes) |
| 172 | +#### Scenario: Valid credentials |
| 173 | +- WHEN a user submits valid credentials |
| 174 | +- THEN a JWT is returned |
| 175 | +``` |
87 | 176 |
|
88 | | -## Team Collaboration |
| 177 | +### AI-Generated Change Delta (created in `openspec/changes/add-2fa/specs/auth/spec.md`): |
89 | 178 |
|
90 | | -OpenSpec is designed for team collaboration: |
| 179 | +```markdown |
| 180 | +# Delta for Auth |
91 | 181 |
|
92 | | -1. **AI Tool Flexibility**: Each team member can use their preferred AI assistant (Claude, Cursor, etc.) |
93 | | -2. **Non-Invasive Updates**: The `update` command only modifies existing files, never forcing tools on team members |
94 | | -3. **Specification Sharing**: The `openspec/` directory contains shared specifications that all team members work from |
95 | | -4. **Change Tracking**: Proposed changes are visible to all team members for review before implementation |
| 182 | +## ADDED Requirements |
| 183 | +### Requirement: Two-Factor Authentication |
| 184 | +The system MUST require a second factor during login. |
| 185 | + |
| 186 | +#### Scenario: OTP required |
| 187 | +- WHEN a user submits valid credentials |
| 188 | +- THEN an OTP challenge is required |
| 189 | +``` |
| 190 | + |
| 191 | +### AI-Generated Tasks (created in `openspec/changes/add-2fa/tasks.md`): |
| 192 | + |
| 193 | +```markdown |
| 194 | +## 1. Database Setup |
| 195 | +- [ ] 1.1 Add OTP secret column to users table |
| 196 | +- [ ] 1.2 Create OTP verification logs table |
| 197 | + |
| 198 | +## 2. Backend Implementation |
| 199 | +- [ ] 2.1 Add OTP generation endpoint |
| 200 | +- [ ] 2.2 Modify login flow to require OTP |
| 201 | +- [ ] 2.3 Add OTP verification endpoint |
| 202 | + |
| 203 | +## 3. Frontend Updates |
| 204 | +- [ ] 3.1 Create OTP input component |
| 205 | +- [ ] 3.2 Update login flow UI |
| 206 | +``` |
| 207 | + |
| 208 | +**Important:** You don't create these files manually. Your AI assistant generates them based on your requirements and the existing codebase. |
| 209 | + |
| 210 | +## Understanding OpenSpec Files |
| 211 | + |
| 212 | +### Delta Format |
| 213 | + |
| 214 | +Deltas are "patches" that show how specs change: |
| 215 | + |
| 216 | +- **`## ADDED Requirements`** - New capabilities |
| 217 | +- **`## MODIFIED Requirements`** - Changed behavior (include complete updated text) |
| 218 | +- **`## REMOVED Requirements`** - Deprecated features |
| 219 | + |
| 220 | +**Format requirements:** |
| 221 | +- Use `### Requirement: <name>` for headers |
| 222 | +- Every requirement needs at least one `#### Scenario:` block |
| 223 | +- Use SHALL/MUST in requirement text |
96 | 224 |
|
97 | | -## Contributing |
98 | 225 |
|
99 | | -See `openspec/specs/` for the current system specifications and `openspec/changes/` for pending improvements. |
| 226 | +## Why OpenSpec Works |
100 | 227 |
|
101 | | -## Notes |
| 228 | +OpenSpec creates **alignment** between you and your AI coding assistant: |
102 | 229 |
|
103 | | -- The legacy `openspec list` command is deprecated. Use `openspec spec list` and `openspec change list`. |
104 | | -- Text output is raw-first (no formatting or filtering). Prefer `--json` for tooling-friendly output. |
105 | | -- Global `--no-color` disables ANSI colors and respects `NO_COLOR`. |
| 230 | +1. **You describe** what you want to build |
| 231 | +2. **AI creates specs** before writing any code |
| 232 | +3. **You review and adjust** the specifications |
| 233 | +4. **AI implements** exactly what was specified |
| 234 | +5. **Everyone understands** what's being built through clear specs |
| 235 | + |
| 236 | +**True Interoperability:** OpenSpec is designed to be universal. No API keys, no vendor lock-in. It works by adding context rules to ANY AI coding tool - whether you use Claude Code today, switch to Cursor tomorrow, or adopt the next breakthrough AI assistant. Your specs remain portable and your workflow stays consistent. |
| 237 | + |
| 238 | + |
| 239 | +## How OpenSpec Compares |
| 240 | + |
| 241 | +### vs. Kiro.dev |
| 242 | +OpenSpec groups all changes for a feature in one place (`openspec/changes/feature-name/`), making it easy to track what needs to be done. Kiro spreads changes across multiple spec folders, making feature tracking harder. |
| 243 | + |
| 244 | +### vs. No Specs |
| 245 | +Without specs, AI coding assistants generate code based on vague prompts, often missing requirements or adding unwanted features. OpenSpec ensures alignment before any code is written. |
| 246 | + |
| 247 | +## Team Adoption |
| 248 | + |
| 249 | +### Getting Started with Your Team |
| 250 | + |
| 251 | +1. **Initialize OpenSpec** - Run `openspec init` in your project |
| 252 | +2. **Start with new features** - Use OpenSpec for your next change proposal |
| 253 | +3. **Build incrementally** - Each new feature adds to your spec library |
| 254 | +4. **Future capability** - We're working on tools to generate specs from existing code |
| 255 | + |
| 256 | +**Tool Freedom:** Your team can use different AI assistants. One developer might use Claude Code while another uses Cursor - OpenSpec keeps everyone aligned through shared specifications. Run `openspec update` to configure for any supported tool without affecting others. |
| 257 | + |
| 258 | + |
| 259 | +## Contributing |
| 260 | + |
| 261 | +- Install dependencies: `npm install` |
| 262 | +- Build: `npm run build` |
| 263 | +- Test: `npm test` |
| 264 | +- Develop CLI locally: `npm run dev` or `npm run dev:cli` |
| 265 | +- Conventional commits (one-line): `type(scope): subject` |
106 | 266 |
|
107 | 267 | ## License |
108 | 268 |
|
109 | | -MIT |
| 269 | +MIT |
| 270 | + |
0 commit comments