The Journey: OpenSpec + SpecFact Integration
OpenSpec and SpecFact are complementary, not competitive.
Primary Use Case: OpenSpec for specification anchoring and change tracking
Secondary Use Case: SpecFact adds brownfield analysis, runtime enforcement, and DevOps integration
π― Why Integrate?
What OpenSpec Does Great
OpenSpec is excellent for:
- β
Specification Anchoring - Source-of-truth specifications (
openspec/specs/) that document what IS built - β Change Tracking - Delta specs (ADDED/MODIFIED/REMOVED) that document what SHOULD change
- β
Change Proposals - Structured proposals (
openspec/changes/) with rationale, impact, and tasks - β Cross-Repository Support - Specifications can live in separate repositories from code
- β Spec-Driven Development - Clear workflow: proposal β delta specs β implementation β archive
- β Team Collaboration - Shared specifications and change proposals for coordination
Note: OpenSpec excels at managing specifications and change proposals - it provides the βwhatβ and βwhyβ for changes, but doesnβt analyze existing code or enforce contracts.
What OpenSpec Is Designed For (vs. SpecFact CLI)
OpenSpec is designed primarily for:
- β
Specification Management - Source-of-truth specs (
openspec/specs/) and change proposals (openspec/changes/) - β Change Tracking - Delta specs (ADDED/MODIFIED/REMOVED) that document proposed changes
- β Cross-Repository Workflows - Specifications can be in different repos than code
- β Spec-Driven Development - Clear proposal β implementation β archive workflow
OpenSpec is not designed primarily for (but SpecFact CLI provides):
- β οΈ Brownfield Analysis - Not designed for reverse-engineering from existing code
- OpenSpec focuses on documenting what SHOULD be built (proposals) and what IS built (specs)
- This is where SpecFact CLI complements OpenSpec π―
- β οΈ Runtime Contract Enforcement - Not designed for preventing regressions with executable contracts
- β οΈ Code2Spec Extraction - Not designed for automatically extracting specs from legacy code
- β οΈ DevOps Integration - Not designed for syncing change proposals to GitHub Issues, ADO, Linear, Jira
- β οΈ Automated Validation - Not designed for CI/CD gates or automated contract validation
- β οΈ Symbolic Execution - Not designed for discovering edge cases with CrossHair
When to Integrate
| Need | OpenSpec Solution | SpecFact Solution |
|---|---|---|
| Work with existing code β PRIMARY | β οΈ Not designed for - Focuses on spec authoring | β
code import β - Reverse-engineer existing code to plans (PRIMARY use case) |
| Sync change proposals to DevOps | β οΈ Not designed for - Manual process | β
sync bridge --adapter github β
- Export proposals to GitHub Issues (IMPLEMENTED) |
| Track code changes | β οΈ Not designed for - Manual tracking | β
--track-code-changes β
- Auto-detect commits and add progress comments (IMPLEMENTED) |
| Runtime enforcement | Manual validation | β Contract enforcement - Prevent regressions with executable contracts |
| Code vs spec alignment | Manual comparison | β Alignment reports β³ - Compare SpecFact features vs OpenSpec specs (PLANNED) |
| Brownfield modernization | Manual spec authoring | β Brownfield analysis β - Extract specs from legacy code automatically |
π± The Integration Vision
Complete Brownfield Modernization Stack
When modernizing legacy code, you can use both tools together for maximum value:
graph TB
subgraph "OpenSpec: Specification Management"
OS1[openspec/specs/<br/>Source-of-Truth Specs]
OS2[openspec/changes/<br/>Change Proposals]
OS3[Delta Specs<br/>ADDED/MODIFIED/REMOVED]
end
subgraph "SpecFact: Code Analysis & Enforcement"
SF1[code import<br/>Extract specs from code]
SF2[Runtime Contracts<br/>Prevent regressions]
SF3[Bridge Adapters<br/>Sync to DevOps]
end
subgraph "DevOps Integration"
GH[GitHub Issues]
ADO[Azure DevOps]
LIN[Linear]
end
OS2 -->|Export| SF3
SF3 -->|Create Issues| GH
SF3 -->|Create Issues| ADO
SF3 -->|Create Issues| LIN
SF1 -->|Compare| OS1
OS1 -->|Validate| SF2
style OS1 fill:#3b82f6,stroke:#1e40af,stroke-width:2px,color:#fff
style OS2 fill:#3b82f6,stroke:#1e40af,stroke-width:2px,color:#fff
style OS3 fill:#3b82f6,stroke:#1e40af,stroke-width:2px,color:#fff
style SF1 fill:#f97316,stroke:#c2410c,stroke-width:2px,color:#fff
style SF2 fill:#f97316,stroke:#c2410c,stroke-width:2px,color:#fff
style SF3 fill:#f97316,stroke:#c2410c,stroke-width:2px,color:#fff
style GH fill:#64748b,stroke:#475569,stroke-width:2px,color:#fff
style ADO fill:#64748b,stroke:#475569,stroke-width:2px,color:#fff
style LIN fill:#64748b,stroke:#475569,stroke-width:2px,color:#fff
The Power of Integration:
- OpenSpec manages specifications and change proposals (the βwhatβ and βwhyβ)
- SpecFact analyzes existing code and enforces contracts (the βhowβ and βsafetyβ)
- Bridge Adapters sync change proposals to DevOps tools (the βtrackingβ)
- Together they form a complete brownfield modernization solution
π The Integration Journey
Stage 1: DevOps Export β IMPLEMENTED
Time: < 5 minutes
Whatβs Available Now:
Export OpenSpec change proposals to GitHub Issues and track implementation progress:
# Step 1: Create change proposal in OpenSpec
mkdir -p openspec/changes/add-feature-x
cat > openspec/changes/add-feature-x/proposal.md << 'EOF'
# Change: Add Feature X
## Why
Add new feature X to improve user experience.
## What Changes
- Add API endpoints
- Update database schema
- Add frontend components
## Impact
- Affected specs: api, frontend
- Affected code: src/api/, src/frontend/
EOF
# Step 2: Export to GitHub Issues
specfact project sync bridge --adapter github --mode export-only \
--repo-owner your-org \
--repo-name your-repo \
--repo /path/to/openspec-repo
What You Get:
- β Issue Creation - OpenSpec change proposals become GitHub Issues automatically
- β Progress Tracking - Code changes detected and progress comments added automatically
- β Content Sanitization - Protect internal information when syncing to public repos
- β Separate Repository Support - OpenSpec proposals and source code can be in different repos
Visual Flow:
sequenceDiagram
participant Dev as Developer
participant OS as OpenSpec
participant SF as SpecFact CLI
participant GH as GitHub Issues
Dev->>OS: Create change proposal<br/>openspec/changes/add-feature-x/
Dev->>SF: specfact project sync bridge --adapter github
SF->>OS: Read proposal.md
SF->>GH: Create issue from proposal
GH-->>SF: Issue #123 created
SF->>OS: Update proposal.md<br/>with issue tracking
Note over Dev,GH: Implementation Phase
Dev->>Dev: Make commits with change ID
Dev->>SF: specfact project sync bridge --track-code-changes
SF->>SF: Detect commits mentioning<br/>change ID
SF->>GH: Add progress comment<br/>to issue #123
GH-->>Dev: Progress visible in issue
rect rgb(59, 130, 246)
Note over OS: OpenSpec<br/>Specification Management
end
rect rgb(249, 115, 22)
Note over SF: SpecFact CLI<br/>Code Analysis & Enforcement
end
rect rgb(100, 116, 139)
Note over GH: DevOps<br/>Backlog Tracking
end
Key Insight: OpenSpec proposals become actionable DevOps backlog items automatically!
Stage 2: OpenSpec Bridge Adapter β IMPLEMENTED
Time: Available now (v0.22.0+)
Whatβs Available:
Read-only sync from OpenSpec to SpecFact for change proposal tracking:
# Sync OpenSpec change proposals to SpecFact
specfact project sync bridge --adapter openspec --mode read-only \
--bundle my-project \
--repo /path/to/openspec-repo
# The adapter reads OpenSpec change proposals from openspec/changes/
# and syncs them to SpecFact change tracking
What You Get:
- β Change Proposal Import - OpenSpec change proposals synced to SpecFact bundles
- β Change Tracking - Track OpenSpec proposals in SpecFact format
- β Read-Only Sync - Import from OpenSpec without modifying OpenSpec files
- β³ Alignment Reports - Compare OpenSpec specs vs code-derived features (planned)
- β³ Gap Detection - Identify OpenSpec specs not found in code (planned)
- β³ Coverage Calculation - Measure how well code matches specifications (planned)
Visual Flow:
graph LR
subgraph "OpenSpec Repository"
OS1[openspec/specs/<br/>Source-of-Truth]
OS2[openspec/changes/<br/>Proposals]
end
subgraph "SpecFact Analysis"
SF1[code import<br/>Extract features]
SF2[Alignment Report<br/>Compare specs vs code]
end
OS1 -->|Import| SF2
SF1 -->|Compare| SF2
SF2 -->|Gap Report| Dev[Developer]
style OS1 fill:#3b82f6,stroke:#1e40af,stroke-width:2px,color:#fff
style OS2 fill:#3b82f6,stroke:#1e40af,stroke-width:2px,color:#fff
style SF1 fill:#f97316,stroke:#c2410c,stroke-width:2px,color:#fff
style SF2 fill:#f97316,stroke:#c2410c,stroke-width:2px,color:#fff
style Dev fill:#10b981,stroke:#047857,stroke-width:2px,color:#fff
Key Insight: Validate that your code matches OpenSpec specifications automatically!
Stage 3: Bidirectional Sync β³ PLANNED
Time: Future enhancement
Whatβs Coming:
Full bidirectional sync between OpenSpec and SpecFact:
# Bidirectional sync (future)
specfact project sync bridge --adapter openspec --bidirectional \
--bundle my-project \
--repo /path/to/openspec-repo \
--watch
What Youβll Get:
- β³ Spec Sync - OpenSpec specs β SpecFact features
- β³ Change Sync - OpenSpec proposals β SpecFact change tracking
- β³ Conflict Resolution - Automatic conflict resolution with priority rules
- β³ Watch Mode - Real-time sync as files change
Visual Flow:
graph TB
subgraph "OpenSpec"
OS1[Specs]
OS2[Change Proposals]
end
subgraph "SpecFact"
SF1[Features]
SF2[Change Tracking]
end
OS1 <-->|Bidirectional| SF1
OS2 <-->|Bidirectional| SF2
style OS1 fill:#3b82f6,stroke:#1e40af,stroke-width:2px,color:#fff
style OS2 fill:#3b82f6,stroke:#1e40af,stroke-width:2px,color:#fff
style SF1 fill:#f97316,stroke:#c2410c,stroke-width:2px,color:#fff
style SF2 fill:#f97316,stroke:#c2410c,stroke-width:2px,color:#fff
Key Insight: Keep OpenSpec and SpecFact in perfect sync automatically!
π Complete Workflow Example
Brownfield Modernization with OpenSpec + SpecFact
Hereβs how to use both tools together for legacy code modernization:
# Step 1: Analyze legacy code with SpecFact
specfact code import legacy-api --repo ./legacy-app
# β Extracts features from existing code
# β Creates SpecFact bundle: .specfact/projects/legacy-api/
# Step 2: Create OpenSpec change proposal
mkdir -p openspec/changes/modernize-api
cat > openspec/changes/modernize-api/proposal.md << 'EOF'
# Change: Modernize Legacy API
## Why
Legacy API needs modernization for better performance and maintainability.
## What Changes
- Refactor API endpoints
- Add contract validation
- Update database schema
## Impact
- Affected specs: api, database
- Affected code: src/api/, src/db/
EOF
# Step 3: Export proposal to GitHub Issues β
IMPLEMENTED
specfact project sync bridge --adapter github --mode export-only \
--repo-owner your-org \
--repo-name your-repo \
--repo /path/to/openspec-repo
# Step 4: Implement changes
git commit -m "feat: modernize-api - refactor endpoints"
# Step 5: Track progress β
IMPLEMENTED
specfact project sync bridge --adapter github --mode export-only \
--repo-owner your-org \
--repo-name your-repo \
--track-code-changes \
--repo /path/to/openspec-repo \
--code-repo /path/to/source-code-repo
# Step 6: Sync OpenSpec change proposals β
AVAILABLE
specfact project sync bridge --adapter openspec --mode read-only \
--bundle legacy-api \
--repo /path/to/openspec-repo
# β Generates alignment report
# β Shows gaps between OpenSpec specs and code
# Step 7: Add runtime contracts
specfact govern enforce stage --preset balanced
# Step 8: Archive completed change
openspec archive modernize-api
Complete Flow:
graph TB
Start[Start: Legacy Code] --> SF1[SpecFact: Extract Features]
SF1 --> OS1[OpenSpec: Create Proposal]
OS1 --> SF2[SpecFact: Export to GitHub]
SF2 --> GH[GitHub: Issue Created]
GH --> Dev[Developer: Implement]
Dev --> SF3[SpecFact: Track Progress]
SF3 --> GH2[GitHub: Progress Comments]
GH2 --> SF4[SpecFact: Validate Alignment]
SF4 --> SF5[SpecFact: Add Contracts]
SF5 --> OS2[OpenSpec: Archive Change]
OS2 --> End[End: Modernized Code]
style Start fill:#8b5cf6,stroke:#6d28d9,stroke-width:2px,color:#fff
style End fill:#10b981,stroke:#047857,stroke-width:2px,color:#fff
style SF1 fill:#f97316,stroke:#c2410c,stroke-width:2px,color:#fff
style SF2 fill:#f97316,stroke:#c2410c,stroke-width:2px,color:#fff
style SF3 fill:#f97316,stroke:#c2410c,stroke-width:2px,color:#fff
style SF4 fill:#f97316,stroke:#c2410c,stroke-width:2px,color:#fff
style SF5 fill:#f97316,stroke:#c2410c,stroke-width:2px,color:#fff
style OS1 fill:#3b82f6,stroke:#1e40af,stroke-width:2px,color:#fff
style OS2 fill:#3b82f6,stroke:#1e40af,stroke-width:2px,color:#fff
style GH fill:#64748b,stroke:#475569,stroke-width:2px,color:#fff
style GH2 fill:#64748b,stroke:#475569,stroke-width:2px,color:#fff
style Dev fill:#6366f1,stroke:#4f46e5,stroke-width:2px,color:#fff
π― Implementation Status
β Implemented Features
| Feature | Status | Description |
|---|---|---|
| DevOps Export | β Available | Export OpenSpec change proposals to GitHub Issues |
| Code Change Tracking | β Available | Detect commits and add progress comments automatically |
| Content Sanitization | β Available | Protect internal information for public repos |
| Separate Repository Support | β Available | OpenSpec proposals and source code in different repos |
| Progress Comments | β Available | Automated progress comments with commit details |
β³ Planned Features
| Feature | Status | Description |
|---|---|---|
| OpenSpec Bridge Adapter | β Available | Read-only sync from OpenSpec to SpecFact (v0.22.0+) |
| Alignment Reports | β³ Planned | Compare OpenSpec specs vs code-derived features |
| Specification Import | β³ Planned | Import OpenSpec specs into SpecFact bundles |
| Bidirectional Sync | β³ Future | Full bidirectional sync between OpenSpec and SpecFact |
| Watch Mode | β³ Future | Real-time sync as files change |
π‘ Key Insights
The βAha!β Moment
OpenSpec = The βwhatβ and βwhyβ (specifications and change proposals)
SpecFact = The βhowβ and βsafetyβ (code analysis and contract enforcement)
Together = Complete brownfield modernization solution
Why This Integration Matters
- OpenSpec provides structured change proposals and source-of-truth specifications
- SpecFact extracts features from legacy code and enforces contracts
- Bridge Adapters sync proposals to DevOps tools for team visibility
- Alignment Reports (planned) validate that code matches specifications
The Power of Separation
- OpenSpec Repository: Specifications and change proposals (the βplanβ)
- Source Code Repository: Actual implementation (the βcodeβ)
- SpecFact: Bridges the gap between plan and code
This separation enables:
- β Cross-Repository Workflows - Specs in one repo, code in another
- β Team Collaboration - Product owners manage specs, developers implement code
- β Clear Separation of Concerns - Specifications separate from implementation
See Also
Related Guides
-
Integrations Overview - Overview of all SpecFact CLI integrations
- Command Chains Reference - Complete workflows including External Tool Integration Chain
- Common Tasks Index - Quick reference for OpenSpec integration tasks
- DevOps Adapter Integration - GitHub Issues and backlog tracking
- Team Collaboration Workflow - Team collaboration patterns
Related Commands
- Command Reference - Import Commands -
import from-bridgereference - Command Reference - Sync Commands -
sync bridgereference - Command Reference - DevOps Adapters - Adapter configuration
Related Examples
- OpenSpec Integration Examples - Real-world integration examples
Getting Started
- Getting Started - Quick setup guide
- Architecture - System architecture and design
π Next Steps
Try It Now β
- DevOps Adapter Integration Guide - Export OpenSpec proposals to GitHub Issues
- Commands Reference - Complete
sync bridgedocumentation - OpenSpec Documentation - Learn OpenSpec basics
Available Now β
- OpenSpec Bridge Adapter - Read-only sync for change proposal tracking (v0.22.0+)
Coming Soon β³
- Alignment Reports - Compare OpenSpec specs vs code-derived features
- Bidirectional Sync - Keep OpenSpec and SpecFact in sync
- Watch Mode - Real-time synchronization
π Related Documentation
- DevOps Adapter Integration - GitHub Issues and backlog tracking
- Spec-Kit Journey - Similar guide for Spec-Kit integration
- Brownfield Engineer Guide - Complete brownfield modernization workflow
- Commands Reference - Complete command documentation
Need Help?
- π¬ GitHub Discussions
- π GitHub Issues
- π§ [email protected]
Remember: OpenSpec manages specifications, SpecFact analyzes code. Together they form a complete brownfield modernization solution! π