OpenSpec icon indicating copy to clipboard operation
OpenSpec copied to clipboard

archive silently drops delta text outside requirement blocks

Open runsonmypc opened this issue 1 month ago • 0 comments

What happens

openspec archive copies only ### Requirement: blocks from a delta spec into the main spec. That is by design. But any other text in the delta is dropped with no warning, and openspec validate --strict passes:

  • a ## section other than Purpose and the four delta sections (## Notes, ## Constraints, ## Acceptance Criteria, ...)
  • text above the first ## header
  • prose between ## ADDED Requirements (or MODIFIED) and its first requirement

The author finds out only by diffing the main spec afterwards, if at all.

Repro (1.14.1, main @ 9111a765)

Delta openspec/changes/c/specs/billing/spec.md:

# billing delta

Context written above the first section.

## ADDED Requirements

Intro prose before the first requirement.

### Requirement: Invoices
The system SHALL generate an invoice for every completed billing period.

#### Scenario: Period closes
- **WHEN** a billing period closes
- **THEN** an invoice is generated

## Acceptance Criteria
- Invoices reconcile with the ledger.

openspec validate c --strict prints Change 'c' is valid. openspec archive c -y writes only the requirement. The context line, the intro prose and ## Acceptance Criteria are gone, and nothing was printed about them.

Why it matters

Agent-written deltas often add sections like Summary, Constraints, Scope Exclusions and Acceptance Criteria. In two of our projects, 13 archived changes lost such sections this way, and nobody noticed. #2017 reports the same silent loss for frontmatter and ## Constraints tables.

Suggested fix

Keep the design (archive carries requirements only), but stop being silent: report the dropped text as a WARNING in validate and print it during archive. This is the same treatment requirements outside delta sections already get (#1804). Related: #2033.

runsonmypc avatar Oct 06 '26 16:10 runsonmypc