Skip to content

[Question/Bug] archive without syncing #764

Closed

Description

@harikrishnan83

In OpenSpec 1.0, the archive command started prompting with this:

1. Sync now (recommended), then archive
2. Archive without syncing

I may be missing some context here, but I am finding it a little hard to understand why I would want to archive without syncing first.

In my experience, Claude Code and Codex usually seem to handle this well and prompt to sync before archiving. However, with OpenCode (and depending on model), I have noticed that sometimes it archives without syncing, and I may not even realize that the sync was skipped.

This feels more noticeable with the OpenSpec 1.2 core profile, where sync is not included by default. If I miss syncing at the point of archiving, I cannot sync afterward unless I customize the setup to include the sync command.

Because of this, I feel it may be simpler and easier to understand if archive always performs a sync before archiving.

Please do let me know if I am missing an important reason for keeping sync separate from archive. I wanted to raise this mainly because the current behavior can be a little confusing in practice.

Activity

  1. 21st-connector commented on Feb 26, 2026

    @21st-connector
    Contributor

    Task completed.

    The enrichment comment has been posted on issue #764. Here's a summary of what was included:

    Key findings:

    Three potential approaches were suggested:

    1. Always sync before archive (as proposed), with an opt-out --skip-sync flag
    2. Move sync-at-archive into deterministic CLI code rather than agent instructions
    3. Add sync to the core profile as a minimum recovery path

    View full conversation

    Powered by 1Code

  2. changed the title [-]Archive without syncing[/-] [+][Question/Bug] archive without syncing[/+] on Feb 26, 2026
  3. 21st-connector commented on Feb 26, 2026

    @21st-connector
    Contributor

    Issue Analysis

    Thanks for the detailed report. Here's a codebase analysis to help contextualize this request.

    Relevant Code

    The sync-before-archive prompt is defined in the archive skill template:

    • src/core/templates/workflows/archive-change.ts:63-67 — The prompt logic:

      • If delta spec changes are needed: offers "Sync now (recommended)" vs "Archive without syncing"
      • If already synced: offers "Archive now", "Sync anyway", "Cancel"
    • src/core/templates/workflows/archive-change.ts:56-67 — The full sync assessment step: checks for delta specs at openspec/changes/<name>/specs/, compares each with its corresponding main spec, then shows a combined summary before prompting.

    • src/core/templates/workflows/archive-change.ts:67 — If sync is chosen, it invokes openspec-sync-specs via the Skill tool (a sub-agent). The key line: "Proceed to archive regardless of choice" — this means sync is always optional from the archive flow's perspective.

    The same prompt structure is duplicated in the OPSX command template at line 179-180 of the same file.

    Core vs. Custom Profile

    The issue author correctly identifies that sync is not in the core profile:

    • src/core/profiles.ts:14 — Core profile: ['propose', 'explore', 'apply', 'archive']
    • src/core/profiles.ts:19-30 — sync is in ALL_WORKFLOWS but only available when using the custom profile

    This means core profile users who skip sync at archive time have no standalone /opsx:sync command to run afterward — the delta specs are archived away and can no longer be applied to main specs without manual extraction.

    The Core Implementation

    The CLI's ArchiveCommand class (src/core/archive.ts:50) handles the actual move operation but does not contain sync logic itself. Spec application is in src/core/specs-apply.ts (used by the CLI's --skip-specs flag path). The sync-at-archive-time decision is entirely agent-driven via the skill template instructions.

    Design History

    The separation of sync from archive was an intentional design choice introduced in these PRs:

    The Problem Pattern

    The issue describes a real gap in the current design:

    1. Agent reliability: The sync prompt is handled by the AI agent interpreting skill template instructions, not by deterministic code. Some models/agents may skip the prompt or default to "archive without syncing" — especially in non-interactive or fast-path scenarios.
    2. No recovery path on core profile: If sync is skipped at archive time and the user is on the core profile, delta specs are moved into the archive directory with no standalone sync command available to recover them.
    3. Silent data loss: The user may not realize sync was skipped, particularly if the agent doesn't clearly surface the choice.

    Potential Approaches

    Based on the codebase, here are a few paths forward:

    1. Make sync-before-archive the default (as proposed): Remove the "Archive without syncing" option and always sync delta specs before archiving. This would mean modifying the skill templates in src/core/templates/workflows/archive-change.ts (both the skill and command templates) and potentially adding a --skip-sync CLI flag for power users who explicitly want to opt out.

    2. Make sync deterministic in the CLI: Move the sync-at-archive logic from the agent-driven skill template into the ArchiveCommand class in src/core/archive.ts, so it runs as code rather than relying on agent interpretation. The CLI already has specs-apply.ts for this purpose — the --skip-specs flag path uses it.

    3. Add sync to the core profile: Change CORE_WORKFLOWS in src/core/profiles.ts:14 to include 'sync', so core profile users always have a recovery path via /opsx:sync even if they skip at archive time.

    Related Issues

  4. harikrishnan83 commented on May 1, 2026

    @harikrishnan83
    ContributorAuthor

    With sync being part of the core workflow in #1030 this issue resolved. Thanks @TabishB .

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions