openspec/changes/add-artifact-regeneration-support/proposal.md
Currently, there is no way to regenerate artifacts in the OPSX workflow:
/opsx:apply just reads whatever's on disk/opsx:continue only creates the NEXT artifact - won't touch existing onesIf you edit design.md after tasks.md exists, your only options are:
/opsx:continueThe documentation claims you can "update artifacts mid-flight and continue" but there's no mechanism that actually supports this.
Two parts:
Add artifact staleness detection to /opsx:apply:
/opsx:apply runs, check if upstream artifacts (design.md, specs) have been modified since tasks.md was generated/opsx:continue?"This is the workflow we want to enable (currently documented but not supported):
You: /opsx:apply
AI: Working through tasks...
✓ Task 1.1: Created caching layer
✓ Task 1.2: Added cache invalidation
Working on 1.3: Implement TTL...
I noticed the design assumes Redis, but your project uses
in-memory caching. Should I update the design?
You: Yes, update it to use the existing cache module.
AI: Updated design.md to use CacheManager from src/cache/
Updated tasks.md with revised implementation steps
Continuing implementation...
✓ Task 1.3: Implemented TTL using CacheManager
...
No restart needed. Just update the artifact and continue.
When user manually edits an upstream artifact:
$ /opsx:apply
⚠️ Detected changes to upstream artifacts:
- design.md modified 5 minutes ago (after tasks.md was generated)
Options:
1. Regenerate tasks (recommended)
2. Continue anyway with current tasks
3. Cancel
>
Add a way to regenerate specific artifacts:
# Option A: Flag on continue
/opsx:continue --regenerate tasks
# Option B: Separate command
/opsx:regenerate tasks
# Option C: Interactive prompt when staleness detected
/opsx:apply
# "Design changed. Regenerate tasks? [y/N]"
Store .openspec-meta.json in change directory:
{
"tasks.md": {
"generated_at": "2025-01-24T10:00:00Z",
"dependencies": {
"design.md": "2025-01-24T09:55:00Z",
"specs/feature/spec.md": "2025-01-24T09:50:00Z"
}
}
}
Add YAML frontmatter to generated artifacts:
---
generated_at: 2025-01-24T10:00:00Z
depends_on:
- design.md@2025-01-24T09:55:00Z
---
# Tasks
...
Use git to detect if upstream files changed since downstream was last modified. No extra metadata needed but requires git.
fix-midflight-update-docs so docs are accurate first