OpenSpec icon indicating copy to clipboard operation
OpenSpec copied to clipboard

/opsx-archive can offer 'Sync now' even when openspec-sync-specs is not installed (core profile)

Open kitimark opened this issue 7 months ago • 5 comments

Summary

In the default core profile (propose, explore, apply, archive), /opsx-archive can still instruct the agent to invoke openspec-sync-specs when the user picks "Sync now (recommended)". But that skill is not installed in core profile, so the sync step fails with a missing-skill error.

Environment

  • OpenSpec CLI: 1.2.0
  • Tool: OpenCode
  • Profile: core (default)

Repro

  1. openspec init with default profile.
  2. Confirm installed skills do not include openspec-sync-specs.
  3. Run /opsx-archive for a change that has delta specs.
  4. Choose "Sync now (recommended)".

Actual

Error: Skill \"openspec-sync-specs\" not found.

Expected

One of:

  1. Do not offer "Sync now" unless sync workflow is installed.
  2. Use deterministic CLI path (openspec archive <change>) for sync+archive.
  3. Prompt user to enable custom profile with sync before offering that path.

Why this looks like template/profile mismatch

  • Archive workflow template references openspec-sync-specs.
  • Core profile excludes sync.
  • So archive guidance can reference a skill unavailable by design in default profile.

Related

  • #863
  • #656
  • #764
  • #762 (core profile has only 4 skills by default)

kitimark avatar Apr 03 '26 17:04 kitimark

🤖 Automation triggered: Enrich Github Issue

I'm starting to work on this automatically.


View live progress

Powered by 1Code

21st-connector avatar Apr 03 '26 17:04 21st-connector

Triage Notes

Root Cause

The archive skill/command templates in src/core/templates/workflows/archive-change.ts unconditionally include instructions to invoke openspec-sync-specs when the user chooses "Sync now", but openspec-sync-specs is only installed when the sync workflow is active. The core profile (src/core/profiles.ts:14) defines only 4 workflows — ['propose', 'explore', 'apply', 'archive'] — and sync is not among them.

Key locations:

  • Template generating the "Sync now" option: src/core/templates/workflows/archive-change.ts:63-67 (skill template) and src/core/templates/workflows/archive-change.ts:178-182 (command template)
  • Sync invocation instruction: Lines 67 and 182 both contain: use Task tool ... to invoke openspec-sync-specs
  • Guardrails also reference it: Lines 114 and 276: "If sync is requested, use openspec-sync-specs approach (agent-driven)"
  • Core profile definition: src/core/profiles.ts:14 — CORE_WORKFLOWS = ['propose', 'explore', 'apply', 'archive']
  • Workflow-to-skill mapping: src/core/shared/skill-generation.ts:63 — sync maps to openspec-sync-specs
  • Bulk archive has the same issue: src/core/templates/workflows/bulk-archive-change.ts:124-127 also references openspec-sync-specs

The CLI already handles sync deterministically

The openspec archive CLI command (src/core/archive.ts:196-265) already has built-in deterministic spec sync logic via findSpecUpdates() and buildUpdatedSpec() from src/core/specs-apply.ts. It does not depend on the openspec-sync-specs skill at all. This means the agent-driven templates are reimplementing sync via a skill dependency that may not exist, while the CLI handles it natively.

Duplicate / Related Issues

This issue is closely related to several open issues that identify the same architectural gap:

  • #764 — Documents the exact same problem: archive offers "Sync now" but sync is not in the core profile, leaving no recovery path for core-profile users who skip sync. Suggests three approaches: always sync by default, move sync into deterministic CLI, or add sync to core profile.
  • #863 — Asks why the archive skill template doesn't invoke openspec archive CLI (which handles sync internally) instead of manually orchestrating file operations and depending on openspec-sync-specs.
  • #656 — Earlier version of the same question as #863.
  • #762 (closed) — Confirms the core profile intentionally has only 4 skills, explaining why openspec-sync-specs is absent by default.

Suggested Fix Approaches

Option A: Conditionally offer "Sync now" based on available skills (minimal change)

Modify the archive templates in src/core/templates/workflows/archive-change.ts to instruct the agent to check whether openspec-sync-specs is installed (e.g., check if the skill directory exists on disk) before offering "Sync now". If not installed, either skip the sync prompt or suggest the user enable the custom profile. This is the narrowest fix but still leaves sync unavailable on core profile.

Option B: Use openspec archive CLI instead of agent-driven sync (recommended)

Update both archive templates (archive-change.ts and bulk-archive-change.ts) to instruct the agent to run openspec archive <name> (or openspec archive <name> --yes) instead of manually orchestrating file moves and invoking openspec-sync-specs. The CLI already handles spec sync deterministically via findSpecUpdates()/buildUpdatedSpec() in src/core/archive.ts:196-265. This eliminates the dependency on the sync skill entirely and aligns with the approach requested in #863 and #656.

Option C: Add sync to the core profile

Add 'sync' to CORE_WORKFLOWS in src/core/profiles.ts:14. This makes openspec-sync-specs available in all default installations, but adds a 5th skill to the context window (which #762 was specifically designed to reduce per #611).

Option D: Hybrid — CLI for sync, agent for orchestration

Keep the agent-driven archive orchestration (prompts, warnings, summary) but replace the openspec-sync-specs invocation with a direct openspec archive <name> CLI call or a targeted openspec specs-apply <change> CLI call for the sync step only. This preserves the agent UX while removing the skill dependency.

Files That Would Need Changes

File What to change
src/core/templates/workflows/archive-change.ts Remove/condition openspec-sync-specs references (lines 67, 114, 182, 276)
src/core/templates/workflows/bulk-archive-change.ts Same — references at lines ~125, 372
src/core/profiles.ts Only if Option C (add sync to CORE_WORKFLOWS)

21st-connector avatar Apr 03 '26 18:04 21st-connector

Thanks for calling this out. I agree this is part of a broader skills-packaging decision, so I’ve kept this at P1 in backlog and will use it as the acceptance test case as we roll that out.

alfred-openspec avatar Apr 05 '26 13:04 alfred-openspec

In fact, there is no /opsx:sync command anymore. The doc https://github.com/Fission-AI/OpenSpec/blob/main/docs/commands.md#default-quick-path-core-profile might mislead new users.

>>> openspec --version
1.3.1

iamtodor avatar May 25 '26 20:05 iamtodor

The exact default-core-profile failure reported here is resolved on current main; this is ready to close.

Proof:

  • The core profile now includes sync alongside propose, explore, apply, update, and archive: https://github.com/Fission-AI/OpenSpec/blob/45cca5db6137ed209117cc70510eb3e057fb981b/src/core/profiles.ts#L14

  • The regression test pins that exact 6-workflow core set: https://github.com/Fission-AI/OpenSpec/blob/45cca5db6137ed209117cc70510eb3e057fb981b/test/core/profiles.test.ts#L10-L14

  • From a clean temporary directory at main (45cca5db), I ran:

    node bin/openspec.js init <empty-dir> --tools claude --force --profile core --no-animation
    

    It generated all 6 skills, including .claude/skills/openspec-sync-specs/SKILL.md and .claude/skills/openspec-archive-change/SKILL.md. The original “archive references a sync skill that core did not install” mismatch therefore cannot be reproduced.

  • Focused profile/init/template/adapter verification passed: 4 test files, 1,167 tests.

PR #1443 is intentionally not being closed as part of this issue closure: it proposes a broader fallback for custom profiles that deliberately omit sync, which is additional work beyond this issue's default-core acceptance case. This closure only records that the concrete core-profile bug reported here is fixed. Thank you for the precise repro and analysis.

clay-good avatar Aug 03 '26 19:08 clay-good