-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Hello,
Coming from Kiro and Github Spec Kit I felt the need to better understand how OpenSpec workflow is working.
Here is a try (similar to github/spec-kit#1377 ) with the following prompt:
Create Mermaid diagram (flowchart, sequence diagram) for https://github.com/Fission-AI/OpenSpec
Create a Markdown file with mermaid embedded
with Claude Caude Opus 4.5
OpenSpec - Mermaid Diagrams
Spec-driven development for AI coding assistants
Repository: github.com/Fission-AI/OpenSpec
Table of Contents
- Main Workflow
- Interaction Sequence
- Folder Structure
- Change Folder Contents
- Spec Delta Format
- AI Tool Integration
- Archive Process
- System Overview
1. Main Workflow
The OpenSpec workflow consists of four phases: Draft, Review, Implement, and Archive.
flowchart TD
subgraph DRAFT["π 1. Draft Phase"]
A[Developer identifies feature/change] --> B[Request AI to create proposal]
B --> C[AI scaffolds change folder]
C --> D["Creates proposal.md, tasks.md, spec deltas"]
end
subgraph REVIEW["π 2. Review & Align Phase"]
E[Review proposal with AI] --> F{Specs acceptable?}
F -->|No| G[Refine specs/tasks]
G --> E
F -->|Yes| H[Approve plan]
end
subgraph IMPLEMENT["βοΈ 3. Implementation Phase"]
I[AI implements tasks] --> J[Mark tasks complete]
J --> K{All tasks done?}
K -->|No| I
K -->|Yes| L[Implementation complete]
end
subgraph ARCHIVE["π¦ 4. Archive Phase"]
M[Archive the change] --> N[Merge spec deltas into source specs]
N --> O[Move change folder to archive/]
O --> P[Updated specs become new source of truth]
end
D --> E
H --> I
L --> M
style DRAFT fill:#e1f5fe,stroke:#01579b
style REVIEW fill:#fff3e0,stroke:#e65100
style IMPLEMENT fill:#e8f5e9,stroke:#1b5e20
style ARCHIVE fill:#f3e5f5,stroke:#4a148c
2. Interaction Sequence
This sequence diagram shows the communication flow between the Developer, AI Assistant, OpenSpec CLI, and the File System throughout the complete workflow.
sequenceDiagram
participant Dev as π€ Developer
participant AI as π€ AI Assistant
participant CLI as βοΈ OpenSpec CLI
participant FS as π File System
rect rgb(225, 245, 254)
Note over Dev,FS: 1. Draft Phase
Dev->>AI: Create proposal for "add profile filters"
AI->>FS: Create openspec/changes/add-profile-filters/
AI->>FS: Write proposal.md
AI->>FS: Write tasks.md
AI->>FS: Write specs/profile/spec.md (delta)
AI-->>Dev: Change folder created β
end
rect rgb(255, 243, 224)
Note over Dev,FS: 2. Review Phase
Dev->>CLI: openspec list
CLI-->>Dev: Shows active changes
Dev->>CLI: openspec validate add-profile-filters
CLI-->>Dev: Validation results
Dev->>CLI: openspec show add-profile-filters
CLI-->>Dev: Displays proposal, tasks, specs
Dev->>AI: Add acceptance criteria for filters
AI->>FS: Updates spec.md and tasks.md
AI-->>Dev: Specs updated β
end
rect rgb(232, 245, 233)
Note over Dev,FS: 3. Implementation Phase
Dev->>AI: Implement the change
loop For each task
AI->>FS: Implement task
AI->>FS: Mark task complete in tasks.md
end
AI-->>Dev: All tasks complete β
end
rect rgb(243, 229, 245)
Note over Dev,FS: 4. Archive Phase
Dev->>CLI: openspec archive add-profile-filters --yes
CLI->>FS: Merge spec deltas into openspec/specs/
CLI->>FS: Move change to openspec/archive/
CLI-->>Dev: Change archived successfully β
end
3. Folder Structure
OpenSpec organizes files into three main directories: specs/ (source of truth), changes/ (active work), and archive/ (completed changes).
flowchart TB
subgraph ROOT["π Project Root"]
subgraph OPENSPEC["π openspec/"]
direction TB
subgraph SPECS["π specs/<br/><i>Source of Truth</i>"]
S1["π auth/spec.md"]
S2["π profile/spec.md"]
S3["π payments/spec.md"]
end
subgraph CHANGES["π changes/<br/><i>Active Proposals</i>"]
C1["π add-2fa/"]
C2["π add-profile-filters/"]
end
subgraph ARCHIVE["π archive/<br/><i>Completed</i>"]
A1["π add-login/"]
A2["π fix-session/"]
end
PM["π project.md"]
AG["π AGENTS.md"]
end
end
style SPECS fill:#c8e6c9,stroke:#2e7d32
style CHANGES fill:#fff9c4,stroke:#f9a825
style ARCHIVE fill:#e0e0e0,stroke:#616161
4. Change Folder Contents
Each change folder contains everything needed to understand and implement a feature change.
flowchart LR
subgraph CHANGE["π openspec/changes/add-2fa/"]
direction TB
P["π proposal.md"]
T["π tasks.md"]
D["π design.md"]
subgraph DELTA["π specs/"]
DS1["π auth/spec.md"]
end
end
P --> INTENT["π‘ Why & What<br/><i>Intent and scope</i>"]
T --> WORK["β
Checklist<br/><i>Implementation tasks</i>"]
D --> DECISIONS["ποΈ Technical<br/><i>Design decisions</i>"]
DELTA --> ADDITIONS["π Delta<br/><i>ADDED/MODIFIED/REMOVED</i>"]
style P fill:#bbdefb,stroke:#1976d2
style T fill:#c5cae9,stroke:#303f9f
style D fill:#d1c4e9,stroke:#512da8
style DELTA fill:#fff9c4,stroke:#f9a825
5. Spec Delta Format
Deltas describe changes to specifications using ADDED, MODIFIED, and REMOVED sections.
flowchart TB
subgraph DELTA["π Delta Spec Structure"]
direction LR
ADDED["## ADDED<br/>Requirements"]
MODIFIED["## MODIFIED<br/>Requirements"]
REMOVED["## REMOVED<br/>Requirements"]
end
subgraph FORMAT["Requirement Format"]
direction TB
HEADER["### Requirement: Name"]
DESC["The system SHALL/MUST..."]
SCENARIO["#### Scenario: Name"]
STEPS["- WHEN condition<br/>- THEN outcome"]
end
ADDED --> HEADER
MODIFIED --> HEADER
REMOVED --> HEADER
HEADER --> DESC
DESC --> SCENARIO
SCENARIO --> STEPS
style ADDED fill:#c8e6c9,stroke:#2e7d32
style MODIFIED fill:#fff9c4,stroke:#f9a825
style REMOVED fill:#ffcdd2,stroke:#c62828
style FORMAT fill:#e3f2fd,stroke:#1565c0
Example Delta
# Delta for Auth
## ADDED Requirements
### Requirement: Two-Factor Authentication
The system MUST require a second factor during login.
#### Scenario: OTP required
- WHEN a user submits valid credentials
- THEN an OTP challenge is required6. AI Tool Integration
OpenSpec integrates with AI coding assistants through native slash commands or the AGENTS.md convention.
flowchart TB
subgraph OPENSPEC["βοΈ OpenSpec"]
INIT["openspec init"]
UPDATE["openspec update"]
end
subgraph NATIVE["π Native Slash Commands"]
direction TB
CC["Claude Code<br/><code>/openspec:proposal</code>"]
CU["Cursor<br/><code>/openspec-proposal</code>"]
GC["Gemini CLI<br/><code>/openspec:proposal</code>"]
GH["GitHub Copilot<br/><code>/openspec-proposal</code>"]
WS["Windsurf<br/><code>/openspec-proposal</code>"]
RC["RooCode<br/><code>/openspec-proposal</code>"]
CX["Codex<br/><code>/openspec-proposal</code>"]
end
subgraph AGENTSMD["π AGENTS.md Compatible"]
AMP["Amp"]
JU["Jules"]
OT["Other Tools"]
end
INIT --> NATIVE
INIT --> AGENTSMD
UPDATE --> NATIVE
UPDATE --> AGENTSMD
style OPENSPEC fill:#e3f2fd,stroke:#1565c0
style NATIVE fill:#e8f5e9,stroke:#2e7d32
style AGENTSMD fill:#fff3e0,stroke:#ef6c00
Supported Commands
| Command | Purpose |
|---|---|
/openspec:proposal |
Create a new change proposal |
/openspec:apply |
Implement tasks from a change |
/openspec:archive |
Archive completed change |
7. Archive Process
When a change is archived, spec deltas are merged into the source specs and the change folder is preserved in the archive.
flowchart LR
subgraph BEFORE["Before Archive"]
direction TB
B1["π changes/add-2fa/"]
B2["βββ specs/auth/spec.md<br/><i>(delta with ADDED)</i>"]
B3["π specs/auth/"]
B4["βββ spec.md<br/><i>(current truth)</i>"]
end
CMD["βοΈ openspec archive<br/>add-2fa --yes"]
subgraph AFTER["After Archive"]
direction TB
A1["π archive/add-2fa/"]
A2["<i>(preserved for history)</i>"]
A3["π specs/auth/"]
A4["βββ spec.md<br/><i>(merged & updated)</i>"]
end
B1 --> CMD
B3 --> CMD
CMD --> A1
CMD --> A3
style BEFORE fill:#fff9c4,stroke:#f9a825
style CMD fill:#e1bee7,stroke:#7b1fa2
style AFTER fill:#c8e6c9,stroke:#2e7d32
8. System Overview
Complete architecture showing the relationship between all OpenSpec components.
flowchart TB
subgraph HUMAN["π€ Human"]
DEV[Developer]
end
subgraph AI_TOOLS["π€ AI Assistants"]
direction LR
CLAUDE[Claude Code]
CURSOR[Cursor]
COPILOT[GitHub Copilot]
GEMINI[Gemini CLI]
OTHER[Others...]
end
subgraph CLI_CMDS["βοΈ OpenSpec CLI"]
direction TB
INIT["init"]
LIST["list"]
SHOW["show"]
VALIDATE["validate"]
ARCHIVE["archive"]
VIEW["view"]
end
subgraph FILES["π OpenSpec Files"]
direction TB
SPECS["specs/<br/><i>Source of Truth</i>"]
CHANGES["changes/<br/><i>Active Work</i>"]
ARCH_DIR["archive/<br/><i>History</i>"]
PROJECT["project.md"]
AGENTS["AGENTS.md"]
end
DEV <-->|"Natural language<br/>requests"| AI_TOOLS
AI_TOOLS <-->|"Slash commands<br/>& AGENTS.md"| CLI_CMDS
AI_TOOLS <-->|"Read/Write<br/>specs & tasks"| FILES
CLI_CMDS <-->|"Manage<br/>files"| FILES
DEV <-->|"CLI<br/>commands"| CLI_CMDS
style HUMAN fill:#e3f2fd,stroke:#1565c0
style AI_TOOLS fill:#f3e5f5,stroke:#7b1fa2
style CLI_CMDS fill:#e8f5e9,stroke:#2e7d32
style FILES fill:#fff3e0,stroke:#ef6c00
Quick Reference
CLI Commands
openspec init # Initialize OpenSpec in a project
openspec list # View active change folders
openspec view # Interactive dashboard
openspec show <change> # Display change details
openspec validate <change> # Check spec formatting
openspec archive <change> # Archive completed change
openspec update # Update AI tool integrationsWorkflow Summary
Draft β Review β Implement β Archive
β β β β
β β β βββ Merge deltas into specs/
β β βββ AI implements tasks
β βββ Refine until specs are approved
βββ AI creates proposal + tasks + spec deltas
Generated for OpenSpec - Spec-driven development for AI coding assistants