Skip to content

Conversation

@TabishB
Copy link
Contributor

@TabishB TabishB commented Jan 7, 2026

Summary

  • Add /opsx:archive slash command to archive completed changes in the experimental workflow
  • Integrate with openspec artifact-experimental-setup to generate skill and command files
  • Complete the OPSX workflow lifecycle with archive capability

Changes

New Features

  • Change selection prompt - Uses AskUserQuestion to let user select from available changes
  • Artifact completion check - Uses openspec status --json to verify all artifacts are done (warns if not)
  • Task completion check - Parses tasks.md for incomplete tasks - [ ] (warns if incomplete)
  • Spec sync prompt - Offers to run /opsx:sync before archiving if delta specs exist
  • Archive process - Moves change to archive/YYYY-MM-DD-<name>/, preserves .openspec.yaml
  • Clear output formatting - Success, success with warnings, and error cases

Files Modified

  • src/core/templates/skill-templates.ts - Added archive skill and command templates
  • src/commands/artifact-workflow.ts - Added archive to setup command output

OPSX Command Suite (Complete)

Command Purpose
/opsx:new Start a new change
/opsx:continue Create the next artifact
/opsx:ff Fast-forward all artifacts
/opsx:apply Implement tasks
/opsx:sync Sync delta specs to main
/opsx:archive Archive completed change ✨ NEW

Test plan

  • Verify skill file generated at .claude/skills/openspec-archive-change/SKILL.md
  • Verify command file generated at .claude/commands/opsx/archive.md
  • Verify setup output includes /opsx:archive in usage instructions
  • Verify command covers all spec scenarios (complete change, incomplete artifacts, incomplete tasks, delta specs, no change name)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added /opsx:archive slash command for archiving completed experimental changes
    • Validates artifact and task completion before archiving
    • Prompts users to synchronize specifications prior to archiving
    • Creates timestamped archives with metadata preservation
  • Documentation

    • Added specification and design documentation for the archive workflow

✏️ Tip: You can customize this high-level summary in your review settings.

Add `/opsx:archive` slash command to complete the OPSX workflow lifecycle.
This command archives completed changes in the experimental workflow with:

- Change selection prompt (if not specified)
- Artifact completion check using `openspec status --json`
- Task completion check (parsing tasks.md for `- [ ]`)
- Spec sync prompt (offers `/opsx:sync` before archiving if specs exist)
- Archive to `openspec/changes/archive/YYYY-MM-DD-<name>/`
- Clear output formatting for success, warnings, and errors

This completes the OPSX command suite:
- /opsx:new - Start a change
- /opsx:continue - Create next artifact
- /opsx:ff - Fast-forward all artifacts
- /opsx:apply - Implement tasks
- /opsx:sync - Sync delta specs
- /opsx:archive - Archive completed change (NEW)
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 7, 2026

📝 Walkthrough

Walkthrough

This pull request introduces a new /opsx:archive slash command to the experimental OPSX workflow for archiving completed changes. The feature includes design documentation, skill and command templates, integration into the artifact workflow system, and comprehensive specification with task completion checks against artifact graphs and tasks.md files.

Changes

Cohort / File(s) Summary
OPSX Archive Feature Documentation
openspec/changes/opsx-archive-command/.openspec.yaml, openspec/changes/opsx-archive-command/design.md, openspec/changes/opsx-archive-command/proposal.md
Configuration and design rationale for the archive feature, including core decisions: slash command approach, pre-archive sync prompts, artifact-graph-based completion verification, and metadata preservation during archival.
OPSX Archive Specification
openspec/changes/opsx-archive-command/specs/opsx-archive-skill/spec.md
Behavioral contract for the /opsx:archive command detailing: interactive change selection, artifact and task completion checks with user warnings, delta-spec synchronization prompts, archive directory creation with YYYY-MM-DD-<change-name> naming, conflict handling, and comprehensive output feedback.
OPSX Archive Implementation Tasks
openspec/changes/opsx-archive-command/tasks.md
Task breakdown for implementing the archive command covering skill creation, artifact-status checks, task parsing, sync prompts, archive operations, and test scenarios for completion/incompletion cases.
Archive Workflow Integration
src/commands/artifact-workflow.ts
Integrates new ArchiveChangeSkillTemplate and OpsxArchiveCommandTemplate into the experimental artifact workflow, exposing the /opsx:archive slash command and updating status/help output to reflect the new capability.
Skill & Command Templates
src/core/templates/skill-templates.ts
Adds getArchiveChangeSkillTemplate() and getOpsxArchiveCommandTemplate() functions that define the complete archival workflow including prompts for change selection, artifact/task completion checks, sync offers, directory operations, and multi-state success outputs. ⚠️ Note: duplicate addition of getOpsxArchiveCommandTemplate() detected in diff.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant Archive as /opsx:archive<br/>Command
    participant OpenSpec as OpenSpec<br/>System
    participant TasksMD as tasks.md<br/>Parser
    participant ArtifactGraph as Artifact<br/>Status
    participant FileSystem as File<br/>System

    User->>Archive: Invoke /opsx:archive [optional: change-name]
    
    alt Change name not provided
        Archive->>Archive: Prompt user to select<br/>active change
        User->>Archive: Select change
    end

    Archive->>ArtifactGraph: Check artifact<br/>completion status
    ArtifactGraph-->>Archive: Artifact status

    alt Incomplete artifacts detected
        Note over Archive: ⚠️ Warn user about<br/>incomplete items
        Archive->>User: List incomplete artifacts +<br/>ask for confirmation
        alt User rejects
            User-->>Archive: Cancel
            Archive-->>User: Abort archive
        end
    end

    Archive->>FileSystem: Check for tasks.md
    
    alt tasks.md exists
        FileSystem-->>TasksMD: Read tasks.md
        TasksMD->>TasksMD: Parse for - [ ]<br/>incomplete tasks
        TasksMD-->>Archive: Incomplete task count

        alt Incomplete tasks found
            Note over Archive: ⚠️ Warn with count
            Archive->>User: Confirm to proceed
            alt User rejects
                User-->>Archive: Cancel
                Archive-->>User: Abort archive
            end
        end
    end

    Archive->>FileSystem: Check for specs/
    
    alt specs/ directory exists
        rect rgb(230, 245, 255)
            Note over Archive,User: Delta specs found—<br/>offer sync
            Archive->>User: Prompt: Run /opsx:sync?
            alt User accepts
                User->>OpenSpec: Run /opsx:sync
                OpenSpec-->>Archive: Sync results
            else User declines
                User-->>Archive: Skip sync
            end
        end
    end

    rect rgb(200, 255, 200)
        Note over Archive,FileSystem: Archive operation
        Archive->>FileSystem: Create archive/<br/>if missing
        Archive->>FileSystem: Move change to<br/>archive/YYYY-MM-DD-\<name\>/
        Archive->>FileSystem: Preserve .openspec.yaml
    end

    Archive->>User: ✓ Archive complete<br/>with summary<br/>(location, schema, warnings)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Poem

🐰 A rabbit hops through changes past,
With archive skills that hold so fast,
From sync to checks, to YYYY dates,
New /opsx:archive navigates! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add /opsx:archive command for archiving completed changes' directly and clearly describes the main change: adding a new slash command to archive changes.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@vibe-kanban-cloud
Copy link

Review Complete

Your review story is ready!

View Story

Comment !reviewfast on this PR to re-generate the story.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (4)
openspec/changes/opsx-archive-command/proposal.md (2)

1-3: Condense the "Why" section to 1–2 sentences.

Per coding guidelines, the Why section should be concise (1–2 sentences). Consider combining these into a single impactful statement about the motivation.

Current structure:

Sentence 1: Explains existing OPSX commands
Sentence 2: Notes missing archive command
Sentence 3: States the gap with regular `openspec archive`

Could be condensed to:

Single statement: OPSX workflow lacks an archive command integration, forcing users to fall back to `openspec archive`, which doesn't honor schema-aware artifact tracking.

5-11: Add explicit breaking-change markers to "What Changes" bullets (even if none apply).

Per coding guidelines, the What Changes section should use breaking-change markers for items that introduce backward-incompatible changes. While this feature appears purely additive, explicitly marking these as non-breaking (e.g., [non-breaking] or similar notation) would improve clarity and guideline compliance.

Suggested format:

- [non-breaking] Add `/opsx:archive` slash command...
- [non-breaking] Use artifact graph to check completion...
...
src/commands/artifact-workflow.ts (1)

31-31: Consider breaking the import statement into multiple lines.

The import statement is quite long with 12 functions. While functionally correct, splitting it across multiple lines would improve readability:

🔎 Suggested refactor for readability
-import { getNewChangeSkillTemplate, getContinueChangeSkillTemplate, getApplyChangeSkillTemplate, getFfChangeSkillTemplate, getSyncSpecsSkillTemplate, getArchiveChangeSkillTemplate, getOpsxNewCommandTemplate, getOpsxContinueCommandTemplate, getOpsxApplyCommandTemplate, getOpsxFfCommandTemplate, getOpsxSyncCommandTemplate, getOpsxArchiveCommandTemplate } from '../core/templates/skill-templates.js';
+import {
+  getNewChangeSkillTemplate,
+  getContinueChangeSkillTemplate,
+  getApplyChangeSkillTemplate,
+  getFfChangeSkillTemplate,
+  getSyncSpecsSkillTemplate,
+  getArchiveChangeSkillTemplate,
+  getOpsxNewCommandTemplate,
+  getOpsxContinueCommandTemplate,
+  getOpsxApplyCommandTemplate,
+  getOpsxFfCommandTemplate,
+  getOpsxSyncCommandTemplate,
+  getOpsxArchiveCommandTemplate,
+} from '../core/templates/skill-templates.js';
src/core/templates/skill-templates.ts (1)

1053-1157: Clarify sync execution in the command template.

The skill template (line 1108) clarifies: "execute /opsx:sync logic (use the openspec-sync-specs skill)"

The command template (line 1354) only says: "execute /opsx:sync logic" without clarification.

For consistency, the command template should also specify to use the openspec-sync-specs approach or invoke /opsx:sync directly.

🔎 Suggested fix for consistency
    **If delta specs exist:**
    - Prompt: "This change has delta specs. Would you like to sync them to main specs before archiving?"
-   - If user confirms, execute \`/opsx:sync\` logic
+   - If user confirms, execute \`/opsx:sync\` logic (use the /opsx:sync command)
    - Proceed with archive regardless of sync choice

Also applies to: 1298-1448

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a5c10ed and b72014e.

📒 Files selected for processing (7)
  • openspec/changes/opsx-archive-command/.openspec.yaml
  • openspec/changes/opsx-archive-command/design.md
  • openspec/changes/opsx-archive-command/proposal.md
  • openspec/changes/opsx-archive-command/specs/opsx-archive-skill/spec.md
  • openspec/changes/opsx-archive-command/tasks.md
  • src/commands/artifact-workflow.ts
  • src/core/templates/skill-templates.ts
🧰 Additional context used
📓 Path-based instructions (4)
openspec/changes/**/*.md

📄 CodeRabbit inference engine (openspec/AGENTS.md)

Scaffold proposal using proposal.md, tasks.md, optional design.md, and delta specs under openspec/changes/<id>/

Files:

  • openspec/changes/opsx-archive-command/proposal.md
  • openspec/changes/opsx-archive-command/tasks.md
  • openspec/changes/opsx-archive-command/specs/opsx-archive-skill/spec.md
  • openspec/changes/opsx-archive-command/design.md
openspec/changes/*/proposal.md

📄 CodeRabbit inference engine (openspec/AGENTS.md)

Ensure proposal.md includes sections: Why (1-2 sentences), What Changes (bullet list with breaking change markers), and Impact (affected specs and code)

Files:

  • openspec/changes/opsx-archive-command/proposal.md
openspec/changes/*/tasks.md

📄 CodeRabbit inference engine (openspec/AGENTS.md)

Ensure tasks.md contains implementation checklist with numbered sections and checkbox items

Files:

  • openspec/changes/opsx-archive-command/tasks.md
openspec/changes/**/specs/**/spec.md

📄 CodeRabbit inference engine (openspec/AGENTS.md)

openspec/changes/**/specs/**/spec.md: Use ## ADDED|MODIFIED|REMOVED|RENAMED Requirements headers in spec delta files
Include at least one #### Scenario: per requirement in spec delta files
Use #### Scenario: Name format (4 hashtags) for scenario headers, not bullets or bold text
Use ## ADDED Requirements for new orthogonal capabilities that can stand alone; use ## MODIFIED Requirements for behavior changes of existing requirements
When using MODIFIED Requirements, paste the full requirement block including header and all scenarios

Files:

  • openspec/changes/opsx-archive-command/specs/opsx-archive-skill/spec.md
🧠 Learnings (12)
📓 Common learnings
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-25T01:08:19.004Z
Learning: Use `openspec archive <change-id> --skip-specs --yes` for tooling-only changes
📚 Learning: 2025-11-25T01:08:19.004Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-25T01:08:19.004Z
Learning: Use `openspec archive <change-id> --skip-specs --yes` for tooling-only changes

Applied to files:

  • openspec/changes/opsx-archive-command/.openspec.yaml
  • openspec/changes/opsx-archive-command/proposal.md
  • openspec/changes/opsx-archive-command/tasks.md
  • src/commands/artifact-workflow.ts
  • src/core/templates/skill-templates.ts
  • openspec/changes/opsx-archive-command/specs/opsx-archive-skill/spec.md
  • openspec/changes/opsx-archive-command/design.md
📚 Learning: 2025-11-25T01:08:19.004Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-25T01:08:19.004Z
Learning: Applies to openspec/changes/**/*.md : Scaffold proposal using `proposal.md`, `tasks.md`, optional `design.md`, and delta specs under `openspec/changes/<id>/`

Applied to files:

  • openspec/changes/opsx-archive-command/.openspec.yaml
  • openspec/changes/opsx-archive-command/tasks.md
  • openspec/changes/opsx-archive-command/specs/opsx-archive-skill/spec.md
  • openspec/changes/opsx-archive-command/design.md
📚 Learning: 2025-11-25T01:08:19.004Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-25T01:08:19.004Z
Learning: Check `openspec/project.md` for project conventions before creating specs

Applied to files:

  • openspec/changes/opsx-archive-command/.openspec.yaml
📚 Learning: 2025-11-25T01:08:19.004Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-25T01:08:19.004Z
Learning: Applies to openspec/changes/*/tasks.md : Ensure `tasks.md` contains implementation checklist with numbered sections and checkbox items

Applied to files:

  • openspec/changes/opsx-archive-command/tasks.md
📚 Learning: 2025-11-25T01:08:02.839Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T01:08:02.839Z
Learning: Use `@/openspec/AGENTS.md` to learn how to create and apply change proposals, spec format and conventions, and project structure and guidelines

Applied to files:

  • openspec/changes/opsx-archive-command/specs/opsx-archive-skill/spec.md
📚 Learning: 2025-11-25T01:08:02.839Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T01:08:02.839Z
Learning: Always open `@/openspec/AGENTS.md` when the request mentions planning or proposals (words like proposal, spec, change, plan), introduces new capabilities, breaking changes, architecture shifts, or performance/security work, or sounds ambiguous and needs the authoritative spec before coding

Applied to files:

  • openspec/changes/opsx-archive-command/specs/opsx-archive-skill/spec.md
📚 Learning: 2025-11-25T01:08:19.004Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-25T01:08:19.004Z
Learning: Applies to openspec/changes/**/specs/**/spec.md : Use `## ADDED Requirements` for new orthogonal capabilities that can stand alone; use `## MODIFIED Requirements` for behavior changes of existing requirements

Applied to files:

  • openspec/changes/opsx-archive-command/specs/opsx-archive-skill/spec.md
📚 Learning: 2025-11-25T01:08:19.004Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-25T01:08:19.004Z
Learning: Applies to openspec/changes/**/specs/**/spec.md : When using MODIFIED Requirements, paste the full requirement block including header and all scenarios

Applied to files:

  • openspec/changes/opsx-archive-command/specs/opsx-archive-skill/spec.md
📚 Learning: 2025-11-25T01:08:19.004Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-25T01:08:19.004Z
Learning: Applies to openspec/changes/**/specs/**/spec.md : Include at least one `#### Scenario:` per requirement in spec delta files

Applied to files:

  • openspec/changes/opsx-archive-command/specs/opsx-archive-skill/spec.md
📚 Learning: 2025-11-25T01:08:19.004Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-25T01:08:19.004Z
Learning: Applies to openspec/changes/**/specs/**/spec.md : Use `## ADDED|MODIFIED|REMOVED|RENAMED Requirements` headers in spec delta files

Applied to files:

  • openspec/changes/opsx-archive-command/specs/opsx-archive-skill/spec.md
📚 Learning: 2025-11-25T01:08:19.004Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-25T01:08:19.004Z
Learning: Create `design.md` only when needed: cross-cutting changes, new external dependencies, significant data model changes, security/performance complexity, or pre-coding ambiguity

Applied to files:

  • openspec/changes/opsx-archive-command/design.md
🪛 LanguageTool
openspec/changes/opsx-archive-command/specs/opsx-archive-skill/spec.md

[style] ~37-~37: ‘without warning’ might be wordy. Consider a shorter alternative.
Context: ...s have status done - THEN proceed without warning ### Requirement: Task Completion Check...

(EN_WORDINESS_PREMIUM_WITHOUT_WARNING)

🔇 Additional comments (6)
openspec/changes/opsx-archive-command/.openspec.yaml (1)

1-2: Configuration metadata looks good.

The YAML structure correctly records the schema type and creation date for this change. No issues detected.

openspec/changes/opsx-archive-command/tasks.md (1)

1-23: Excellent task checklist structure.

The tasks.md file properly follows the coding guideline format with three numbered sections, each containing checkbox items in the standard [x] format. The hierarchical numbering (1.1, 1.2, etc.) is clear, and all tasks are marked as complete. This provides good documentation of the implementation workflow.

openspec/changes/opsx-archive-command/design.md (1)

1-84: LGTM! Well-structured design document.

The design decisions are clearly articulated with strong rationale:

  • Skill-only implementation avoids CLI duplication
  • Agent-driven sync prompting maintains workflow flexibility
  • Artifact graph integration provides schema-aware checking
  • Identified risks have reasonable mitigations

This appropriately documents the cross-cutting nature of the archive feature and its integration points.

src/commands/artifact-workflow.ts (1)

801-906: LGTM! Archive feature properly integrated.

The archive skill and command are correctly wired into the artifact workflow setup:

  • Templates retrieved and included in skills/commands arrays
  • Directory and file naming consistent with other OPSX features
  • Usage documentation updated to include /opsx:archive

The integration follows the established pattern for experimental workflow commands.

openspec/changes/opsx-archive-command/specs/opsx-archive-skill/spec.md (1)

1-122: LGTM! Specification follows guidelines correctly.

The spec delta properly uses:

  • ## ADDED Requirements header for the new archive capability
  • #### Scenario: format (4 hashtags) for all scenarios
  • At least one scenario per requirement

The requirements comprehensively cover the archive workflow including completion checks, sync prompting, and various output states.

src/core/templates/skill-templates.ts (1)

1069-1069: The openspec list --json command is properly defined and supports the --json flag for programmatic output. No action needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants