openspec-sync-specs
npx machina-cli add skill azzgo/agent-skills/openspec-sync-specs --openclawSync delta specs from a change to main specs.
This is an agent-driven operation - you will read delta specs and directly edit main specs to apply the changes. This allows intelligent merging (e.g., adding a scenario without copying the entire requirement).
Input: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
Steps
-
If no change name provided, prompt for selection
Run
openspec list --jsonto get available changes. Use the AskUserQuestion tool to let the user select.Show changes that have delta specs (under
specs/directory).IMPORTANT: Do NOT guess or auto-select a change. Always let the user choose.
-
Find delta specs
Look for delta spec files in
openspec/changes/<name>/specs/*/spec.md.Each delta spec file contains sections like:
## ADDED Requirements- New requirements to add## MODIFIED Requirements- Changes to existing requirements## REMOVED Requirements- Requirements to remove## RENAMED Requirements- Requirements to rename (FROM:/TO: format)
If no delta specs found, inform user and stop.
-
For each delta spec, apply changes to main specs
For each capability with a delta spec at
openspec/changes/<name>/specs/<capability>/spec.md:a. Read the delta spec to understand the intended changes
b. Read the main spec at
openspec/specs/<capability>/spec.md(may not exist yet)c. Apply changes intelligently:
ADDED Requirements:
- If requirement doesn't exist in main spec → add it
- If requirement already exists → update it to match (treat as implicit MODIFIED)
MODIFIED Requirements:
- Find the requirement in main spec
- Apply the changes - this can be:
- Adding new scenarios (don't need to copy existing ones)
- Modifying existing scenarios
- Changing the requirement description
- Preserve scenarios/content not mentioned in the delta
REMOVED Requirements:
- Remove the entire requirement block from main spec
RENAMED Requirements:
- Find the FROM requirement, rename to TO
d. Create new main spec if capability doesn't exist yet:
- Create
openspec/specs/<capability>/spec.md - Add Purpose section (can be brief, mark as TBD)
- Add Requirements section with the ADDED requirements
-
Show summary
After applying all changes, summarize:
- Which capabilities were updated
- What changes were made (requirements added/modified/removed/renamed)
Delta Spec Format Reference
## ADDED Requirements
### Requirement: New Feature
The system SHALL do something new.
#### Scenario: Basic case
- **WHEN** user does X
- **THEN** system does Y
## MODIFIED Requirements
### Requirement: Existing Feature
#### Scenario: New scenario to add
- **WHEN** user does A
- **THEN** system does B
## REMOVED Requirements
### Requirement: Deprecated Feature
## RENAMED Requirements
- FROM: `### Requirement: Old Name`
- TO: `### Requirement: New Name`
Key Principle: Intelligent Merging
Unlike programmatic merging, you can apply partial updates:
- To add a scenario, just include that scenario under MODIFIED - don't copy existing scenarios
- The delta represents intent, not a wholesale replacement
- Use your judgment to merge changes sensibly
Output On Success
## Specs Synced: <change-name>
Updated main specs:
**<capability-1>**:
- Added requirement: "New Feature"
- Modified requirement: "Existing Feature" (added 1 scenario)
**<capability-2>**:
- Created new spec file
- Added requirement: "Another Feature"
Main specs are now updated. The change remains active - archive when implementation is complete.
Guardrails
- Read both delta and main specs before making changes
- Preserve existing content not mentioned in delta
- If something is unclear, ask for clarification
- Show what you're changing as you go
- The operation should be idempotent - running twice should give same result
Source
git clone https://github.com/azzgo/agent-skills/blob/main/.opencode/skills/openspec-sync-specs/SKILL.mdView on GitHub Overview
openspec-sync-specs is an agent-driven operation that reads delta specs from a change and applies them directly to the main specs. It enables intelligent merging—adding new requirements, updating existing ones, removing deprecated blocks, and renaming capabilities—without archiving the change. If the main spec doesn’t exist, it will create it and add the added requirements.
How This Skill Works
It scans openspec/changes/<change>/specs for delta specs, reads each delta spec’s ADDED, MODIFIED, REMOVED, and RENAMED sections, then reads the corresponding main spec at openspec/specs/<capability>/spec.md (creating it if needed). It applies changes per rules: add or update requirements, merge in new scenarios, remove blocks, and rename as directed. After processing, it outputs a summary of which capabilities changed and exactly what was added, modified, removed, or renamed.
When to Use It
- You have a delta spec with new requirements to add to an existing capability.
- You need to modify or add scenarios within a capability without copying the entire main spec.
- You must remove a deprecated requirement from the main spec.
- You need to rename a requirement in the main spec (FROM to TO).
- The target capability does not exist yet and should be created from the delta ADDED requirements.
Quick Start
- Step 1: If a change name is not provided, run openspec list --json and use the AskUserQuestion tool to pick a delta change.
- Step 2: For the chosen change, locate delta specs under openspec/changes/<name>/specs/<capability>/spec.md, read them, and read the main spec at openspec/specs/<capability>/spec.md (creating it if needed).
- Step 3: Review the generated summary and confirm the changes are correct; the tool will report 'Specs Synced: <change-name>' and which capabilities were updated.
Best Practices
- Always prompt to select the change name when multiple delta changes exist; do not auto-select.
- Review ADDED vs MODIFIED blocks to understand intent before applying.
- Preserve existing main spec content not mentioned in the delta.
- Test the merged main specs by validating scenarios after the sync.
- Use clear delta naming and maintain a changelog note for traceability.
Example Use Cases
- Delta 'feature-auth-merge' adds a new authentication scenario to the 'Authentication' capability.
- Delta 'rename-login' changes '### Requirement: Login' to '### Requirement: UserLogin' in the main spec.
- Delta 'remove-deprecated' removes the 'LegacyReporting' requirement from 'Reporting' capability.
- Delta 'enhanced-outputs' adds a new 'OutputService' requirement with its own scenarios.
- Delta 'new-capability' creates the 'PaymentProcessing' main spec with initial added requirements.