Delta specs should be transformed when merging to not include "evolutionary" language
Title: Should spec sync strip change-oriented language from main specs?
During a recent change cycle (ux-refactor-simulate-tab), we noticed that delta specs naturally use change-oriented language that makes sense in context — things like:
- AND no separate Monte Carlo tab exists
- THEN the API receives the same Portfolio JSON structure as before
- AND no backend API changes are required
This reads fine in the delta spec (in changes/), where the purpose is to describe what changed. But when these deltas get synced to main specs (via /opsx:sync or /opsx:archive), that language ends up in the permanent spec, where it reads oddly. A main spec is supposed to describe the current system — "what IS" — and saying "no Monte Carlo tab exists" is a strange thing to assert as a permanent requirement. Taken to its logical conclusion, main specs would accumulate lots of negations about things that used to exist.
After the sync, we manually rewrote the affected scenarios:
Before (change language):
- THEN the tab navigation shows "Portfolio", "Simulate", and "Compare"
- AND no "Monte Carlo" tab exists
After (describes what IS):
- THEN the tab navigation shows exactly 3 tabs: "Portfolio", "Simulate", and "Compare"
Before:
- THEN the API receives the same Portfolio JSON structure as before
- AND no backend API changes are required
After:
- THEN the API receives a single Portfolio JSON containing both
portfolio data and simulation assumptions
The archived delta specs still preserve the evolutionary context for anyone who wants to understand what changed and why.
Possible approaches:
-
Add guidance to the /opsx:sync and /opsx:archive skill prompts
The sync/archive logic is where deltas get merged into main specs. Adding a step like "rewrite content to describe current system state, strip change-oriented language" would catch this at the right point in the workflow. This seems like the most natural fit since:
- Delta spec authors SHOULD use change language (that's the point of ADDED/MODIFIED/REMOVED headers)
- The transformation should happen at sync time, not authoring time
- It's a universal principle, not project-specific
-
Add guidance to the specs artifact instruction template
The
instructionfield for the specs artifact could mention that scenario content should be written to stand on its own, even in delta specs. But this conflicts with the delta format — MODIFIED specs inherently reference what changed. -
Per-project rules in config.yaml
Projects can add a rule like: rules: specs: - Main specs describe what IS, not what changed. Strip evolutionary language during sync.
This works but puts the burden on each project to discover and configure this. It also lands in the spec authoring instructions, not the sync step where it matters.
Approach 1 seems like the best fit — it's where the transformation naturally belongs, and it would benefit all openspec users without requiring per-project configuration.
attribution - Claude Opus 4.5, in openspec --version 1.1.1
Task completed.
The enrichment comment has been posted on issue #678. Here's a summary of what it covers:
Key findings:
-
Not a duplicate — no existing issues cover this topic. #656 is the closest but addresses a different concern (why archive uses LLM merging at all).
-
Mapped all three approaches to specific code locations with file paths and line numbers:
- Approach 1 (sync/archive skill prompts) →
src/core/templates/skill-templates.ts:2474-2608 - Approach 2 (specs instruction template) →
schemas/spec-driven/schema.yaml:30-82 - Approach 3 (config rules) →
src/core/project-config.ts
- Approach 1 (sync/archive skill prompts) →
-
Identified an important architectural gap — there are two separate sync paths (agent-driven via
/opsx:syncand programmatic viaopenspec archiveCLI). Approach 1 only covers the agent-driven path. The CLI path does structural block manipulation without semantic understanding, so it can't detect or rewrite evolutionary language without an LLM call. -
Provided a concrete implementation suggestion — specific text to add to the sync skill prompt under the existing "Key Principle" section, plus a note about updating the formal spec.
Powered by 1Code
I raised this issue with the chatbot since the merged specs seemed unnatural to me. This issue above was generated from the conversation about that.
Issue Analysis
Not a duplicate
No existing issues cover this topic. The closest related issue is #656 (why archive relies on LLM for merging), which touches on the same sync/archive workflow but addresses a different concern.
Relevant code locations
The three approaches map to these files:
Approach 1 — Modify /opsx:sync and /opsx:archive skill prompts (recommended by author)
The skill prompt templates are defined in:
-
/opsx:syncskill:src/core/templates/skill-templates.ts:2474-2608—getOpsxSyncCommandTemplate(). The sync skill is agent-driven (the LLM reads delta specs and edits main specs directly). This is where transformation guidance would be most effective. The "Key Principle: Intelligent Merging" section at line 2576 already establishes the pattern of the agent using judgment during merging — adding "rewrite change-oriented language to describe current system state" fits naturally here. -
/opsx:archiveskill:src/core/templates/skill-templates.ts:2784-2941—getOpsxArchiveCommandTemplate(). The archive skill delegates sync to the sync skill (line 2844), so adding guidance here would be redundant if approach 1 focuses on/opsx:sync. -
Formal spec for sync skill:
openspec/specs/specs-sync-skill/spec.md— Would need a new scenario under "Delta Reconciliation Logic" describing the language transformation requirement.
Approach 2 — Modify specs artifact instruction template
- Schema definition:
schemas/spec-driven/schema.yaml:30-82— Thespecsartifact'sinstructionfield. As the issue notes, this conflicts with delta spec intent — delta authors should use change-oriented language since the format uses ADDED/MODIFIED/REMOVED headers.
Approach 3 — Per-project rules in config.yaml
- Config schema:
src/core/project-config.ts— Therulesfield is aRecord<string, string[]>keyed by artifact ID. Rules get injected into artifact instructions wrapped in<rules>tags (seesrc/core/artifact-graph/instruction-loader.ts). As the issue notes, rules target authoring-time instructions, not sync-time behavior — making this approach a poor fit.
Important architectural context
There are two separate sync paths — this matters for implementation:
-
Agent-driven sync (
/opsx:syncskill) — The LLM reads delta specs and directly edits main specs. This is where Approach 1 would apply and is the natural place for language transformation since the agent is already making judgment calls about how to merge content. -
Programmatic sync (
openspec archiveCLI command) — Usessrc/core/specs-apply.tsandsrc/core/archive.tsfor structural merging (add/modify/remove/rename requirement blocks). This path performs text-level block manipulation without semantic understanding — it wouldn't be able to detect or rewrite "evolutionary language" without an LLM call.
This means Approach 1 only covers the agent-driven path. Users who run openspec archive from the CLI get programmatic merging that copies delta content verbatim. Addressing the CLI path would require either:
- Calling an LLM during
openspec archive(significant architectural change, relates to #656) - Accepting that CLI archive is a structural merge and language cleanup is a manual step
Suggested implementation for Approach 1
Add a new guideline to the /opsx:sync skill prompt in getOpsxSyncCommandTemplate(), under the existing "Key Principle" section at line 2576:
**Key Principle: Main Specs Describe Current State**
When writing content to main specs, rewrite any change-oriented or evolutionary
language from the delta to describe the current system state. Delta specs describe
what CHANGED — main specs describe what IS.
Examples of transformations:
- "no Monte Carlo tab exists" → list the tabs that DO exist
- "the API receives the same structure as before" → describe the actual structure
- "no backend API changes are required" → (omit — this is only meaningful in context of a change)
The archived delta specs preserve the evolutionary context for anyone who needs it.
A corresponding new scenario should be added to openspec/specs/specs-sync-skill/spec.md under the "Delta Reconciliation Logic" requirement.
I have the same problem: transient context keeps leaking into the delta spec, which will be stale as soon as the delta spec is archived/synced to the main spec.
Usually, for me, the transient context refers to the code/implementation state. (Hypothetically, it could also refer to the current state of the main spec, but I have not seen that happen yet.)
I am honestly not sure which proposed solution option is better, 1 or 2. I can see it both ways.
- Option 1: If you went with this,
- A: You would need to be very careful with the wording of the archive/sync step instructions. If you don't, you may lose clarity in the main spec.
- B: This is because the agent session that runs the archive/sync step might not be the one that wrote the delta.
- Option 2: risks muddling the alignment between the agent's and the user's intent.
Maybe a better solution would be an intentional markup that wraps transient content in the delta spec. Then it can be deterministically stripped during sync/archive. The delta-authoring instructions would need to make the convention clear, though.
- THEN the tab navigation shows "Portfolio", "Simulate", and "Compare"
<!-- transient-context:
- AND no "Monte Carlo" tab exists
-->
After stripping:
- THEN the tab navigation shows "Portfolio", "Simulate", and "Compare"
But that has a problem: The wrapped line, wasn't just context for the change, it was also a real constraint (the "Monte Carlo" tab must stay gone). The stripped version no longer says that, it can be read as "shows these 3 tabs, maybe others too". So a plain stripping can quietly weaken the requirement.
one possible solution: write the scenario text the way the main spec should read, and only put the change explanation inside the markup:
- THEN the tab navigation shows exactly 3 tabs: "Portfolio", "Simulate", "Compare"
<!-- transient-context: the "Monte Carlo" tab is removed by this change -->
After stripping (describes what IS):
- THEN the tab navigation shows exactly 3 tabs: "Portfolio", "Simulate", "Compare"
That way, the agent writing the delta decides the wording (it has the transient context regarding the change), and the sync/archive step only strips it (see my option 1 concern B). The user/reviewer still sees what changed. It just can't end up in the main spec (my option 2 worry).
Side note: I think this issue's title should be changed to reflect only the problem. Currently, a proposed solution is leaked into the title.
Environment context: Claude Code 2.1.205 Fable 5 (and Opus 4.8) OpenSpec 1.4.1