这正是 OpenSpec 想解决的核心矛盾。它把"规格(spec)"从一份事后补的文档,变成 AI 工作流的前置约束和可追溯产物。README 里那句 “fluid not rigid / iterative not waterfall / built for brownfield” 说得很克制,翻译成人话就是:它不要求你先写一份完美的 PRD 再去动代码,而是用一套轻量的目录结构和斜杠命令,把"为什么改、改什么、怎么改、改完归档"这四个环节固定下来,让每次变更都留下可 review 的痕迹。
对 brownfield(存量)项目尤其重要:AI 最容易在存量代码里"顺手重构"出一堆你没要求的改动,OpenSpec 的 change 目录机制本质上是在给 AI 划一条变更边界线。
核心技术揭秘
OpenSpec 本身是一个 TypeScript 编写的 CLI(npm 包 @fission-ai/openspec),它不做代码生成、不接管模型调用,而是做两件事:初始化一套约定式目录骨架,以及提供一组解析/校验命令,让 AI 助手在斜杠命令里读写这套结构。换句话说,它是"AI 工作流的文件系统层",真正的智能来自宿主助手。
graph TD
A[用户斜杠命令] --> B{"命令类型"}
B -->|"explore"| C[对话式需求澄清]
B -->|"propose"| D[生成 change 目录]
D --> E[proposal.md 变更动机]
D --> F[specs 需求与场景]
D --> G[design.md 技术方案]
D --> H[tasks.md 任务清单]
B -->|"apply"| I[按 tasks 逐条实现]
I --> J[CLI 校验结构一致性]
J -->|"通过"| K[代码变更 + 任务勾选]
J -->|"失败"| L[提示补全缺失规格]
K --> M[archive 归档到 specs]
C --> D
值得注意的设计取舍:它用 Markdown 作为唯一真相源(single source of truth),而不是引入 JSON Schema 或数据库。好处是 AI 助手天然擅长读写 Markdown、Git diff 天然可读、人类也能直接改;代价是结构校验只能靠 CLI 的启发式解析,遇到不规范写法容易误判——这也是后面踩坑部分要提的点。
tasks.md 的勾选机制是另一个巧妙设计:它把"进度"编码进了文件本身,AI 每次 apply 只需读文件就知道做到哪了,无需额外的状态存储。这是一种极简状态机,也解释了为什么它强调 “fluid not rigid”。
→ fluid not rigid
→ iterative not waterfall
→ easy not complex
→ built for brownfield not just greenfield
→ scalable from personal projects to enterprises
You: /openspec-explore
AI: What would you like to explore?
You: I want dark mode but I'm not sure how to do it cleanly.
AI: Let me look at your styling setup...
Cleanest path here: CSS variables + a small theme context,
with system-preference detection. No new dependencies. Scope it?
You: Yes, let's do it.
You: /openspec-propose add-dark-mode
AI: Created openspec/changes/add-dark-mode/
✓ proposal.md — why we're doing this, what's changing
✓ specs/ — requirements and scenarios
✓ design.md — technical approach
✓ tasks.md — implementation checklist
Ready for implementation!
You: /openspec-apply-change
AI: Implementing tasks...
✓ 1.1 Add theme context provider
✓ 1.2 Create toggle component
✓ 2.1 Add CSS variables
✓ 2.2 Wire up localStorage
All tasks complete!
You: /openspec-archive-change
AI: Archived to openspec/changes/archive/2025-01-23-add-dark-mode/
Specs updated. Ready for the next feature.
What do the specs actually look like?
Plain Markdown — requirements with concrete scenarios, no special syntax to learn. Here’s what goes in the specs/ folder created above:
## ADDED Requirements
### Requirement: Theme selection
The app SHALL let users switch between light and dark themes,
defaulting to the system preference.
#### Scenario: User toggles dark mode
- **WHEN** the user clicks the theme toggle
- **THEN** the app switches to dark mode and persists the choice
Your AI writes these; you review the plan before any code is written.
OpenSpec is built with OpenSpec — browse this repo’s live specs and in-flight changes for real examples at scale.
OpenSpec Dashboard
Why teams adopt OpenSpec
Solo, OpenSpec keeps you and your AI honest on a single repo. On a team, the hard part moves: a feature spans the API server, the web app, and a shared library; requirements are owned by one team and consumed by others; planning starts before any code exists.
Stores are the answer — planning in a repo of its own. The same openspec/ shape you already know (specs and changes), shared by git push like anything else. One source of truth your whole team and every coding agent can read, across every repo.
Cross-repo features — one change, one plan, even when the code lands in three repos.
Shared requirements — a platform team owns the specs; product teams reference them read-only, right where their coding agent can read them. No drifting wiki.
Plan before code — capture the plan in the store now; the code repos catch up later.
Install OpenSpec. On macOS or Linux, in your terminal:
curl -fsSL https://openspec.dev/cli/install.sh | sh
On Windows, in PowerShell:
irm https://openspec.dev/cli/install.ps1 | iex
Prefer a package manager? npm install -g @fission-ai/openspec@latest (needs Node.js 22.20.0 or higher) or the official Homebrew formula, brew install openspec.
Then navigate to your project directory and initialize:
cd your-project
openspec init
Want your AI to do it? Paste the setup prompt into your coding assistant — it installs the CLI, runs openspec init, and verifies the result.
Now talk to your AI:
Not sure what to build yet? Start with /openspec-explore, a no-stakes thinking partner that reads your code, weighs options, and shapes a plan before any code gets written. (Quickstart)
Already know what you want? Go straight to /openspec-propose <what-you-want-to-build>.
Both are in the default profile. If you want the expanded workflow (openspec-new-change, openspec-continue-change, openspec-ff-change, openspec-verify-change, openspec-bulk-archive-change, openspec-onboard), select it with openspec config profile and apply with openspec update.
These are skills. Most tools invoke them as /openspec-propose and Codex as $openspec-propose, or you can ask for the work in plain words. openspec init prints the right form for the tools you picked — see Supported Tools. Coming from 1.x and its /opsx:* commands? See Upgrade to 2.0.
Note 注意
Not sure if your tool is supported? View the full list – we support 30+ tools and growing.
→ Quickstart: your first change, start to finish
→ Set up your project: what openspec init installs
→ CLI: terminal reference
→ Supported Tools: tool integrations & install paths
→ Customize: profiles, project config, and schemas
→ Stores: plan in a separate repo, shared across your team (beta)
→ Community: custom schema examples and projects built with OpenSpec
Why OpenSpec?
AI coding assistants are powerful but unpredictable when requirements live only in chat history. OpenSpec adds a lightweight spec layer so you agree on what to build before any code is written.
Agree before you build — human and AI align on specs before code gets written
Stay organized — each change gets its own folder with proposal, specs, design, and tasks
Work fluidly — update any artifact anytime, no rigid phase gates
Use your tools — works with 30+ AI assistants via skills
How we compare
vs. Spec Kit (GitHub) — Thorough but heavyweight. Rigid phase gates, lots of Markdown, Python setup. OpenSpec is lighter and lets you iterate freely.
vs. Kiro (AWS) — Powerful but you’re locked into their IDE and limited to Claude models. OpenSpec works with the tools you already use.
vs. nothing — AI coding without specs means vague prompts and unpredictable results. OpenSpec brings predictability without the ceremony.
Updating OpenSpec
Upgrade the CLI
With the standalone install, run openspec install. If you installed with npm:
npm install -g @fission-ai/openspec@latest
If you installed OpenSpec with Homebrew:
brew upgrade openspec
Refresh agent instructions
Run this once to refresh the skills installed on your machine. If your team keeps skills in Git, run it in each project that commits them.
openspec update
Usage Notes
Model selection: OpenSpec works best with high-reasoning models. We recommend Codex 5.5 and Opus 4.7 for both planning and implementation.
Context hygiene: OpenSpec benefits from a clean context window. Clear your context before starting implementation and maintain good context hygiene throughout your session.
Contributing
Every change starts as an issue. We discuss it there, and if we agree to pursue it, a maintainer implements the change or invites you to build it with us.
→ CONTRIBUTING.md: the full process, from first issue to merged PR
Other
Telemetry
OpenSpec collects anonymous usage stats.
We collect only command names and version to understand usage patterns. No arguments, paths, content, or PII. Automatically disabled in CI.
Opt-out (any one is enough):
openspec config set telemetry.enabled false (global config; unset means on)
export OPENSPEC_TELEMETRY=0 or export DO_NOT_TRACK=1 (env overrides config)
Maintainers & Advisors
See MAINTAINERS.md for the list of core maintainers and advisors who help guide the project.
评论