Proposal: Extensible workflows and validation in OpenSpec
Problem
OpenSpec supports custom schemas, but parts of the workflow still assume the default spec-driven format.
Today, schemas can define which artifacts to create, their templates, and their dependencies. However:
- Validation is hardcoded.
openspec validateexpects requirements, scenarios, and delta specs, even when a custom schema uses a different format. - Custom artifacts cannot define validation rules. A schema might produce
plan.mdorresearch.md, but there's no way to specify what makes those documents valid. - Archive assumes spec-driven behavior. It includes logic for merging requirement deltas into existing specs.
- Sharing workflows is cumbersome. Users can copy or fork schemas, but cannot easily package schemas, validators, and skills together.
This limits how much users can customize OpenSpec without changing its source code.
Proposed direction
Make OpenSpec a lightweight core that supports different workflows through extensible schemas and plugins.
1. Move format-specific behavior out of core
OpenSpec should manage the lifecycle of a change: creating artifacts, tracking progress, validating, implementing, and archiving.
The selected schema should determine the documents, instructions, validation rules, and any special behavior needed by that workflow.
The existing spec-driven workflow would remain bundled with OpenSpec, preserving its current behavior.
2. Let schemas define validation rules
Extend schema.yaml so each artifact can declare its own validation requirements.
For example:
plan.mdmust contain an Expected Behavior section.tasks.mdmust contain checkboxes.- A spec-driven document must contain valid requirements and scenarios.
- A custom workflow can run its own validator.
Start with simple built-in rules, such as required headings, non-empty sections, and task formatting.
Support custom executable validators for more complex checks, using a consistent interface for reporting errors and warnings.
Users should also be able to reuse and extend existing validation rules without copying entire schemas.
3. Introduce a lightweight, one-page workflow
Use this as the first example of a workflow that doesn't follow the existing spec-driven format.
A change could contain a single plan.md with:
- Goal: What are we trying to achieve?
- Expected behavior: What should the system do?
- Verification: How will we know it works?
- Tasks: What needs to be implemented?
No mandatory SHALL/MUST language, Gherkin-style scenarios, or delta specs.
It should still work with the existing OpenSpec lifecycle, including validation and archiving.
4. Make workflows shareable through plugins
Allow developers to package and distribute schemas, validators, and related skills together.
For example, community extensions could provide:
- A lightweight planning workflow.
- A TDD workflow.
- A more formal spec-driven workflow.
- Company-specific engineering processes.
Take inspiration from Pi, where extensions can be distributed through existing package systems or Git repositories.
Users should be able to install, update, and reuse these extensions across projects without copying files manually.
Local custom schemas should continue to work without needing to create a plugin.
Design principles
- Keep the core small. Avoid building format-specific assumptions into shared commands.
- Make simple customization easy. Most validation rules should be configurable without writing code.
- Support advanced use cases. Allow custom validators and richer workflows when needed.
- Preserve compatibility. Existing
spec-drivenprojects should continue working unchanged. - Avoid building a marketplace upfront. Start with package installation and distribution through existing ecosystems.
Suggested implementation order
- Make validation and archive behavior schema-aware.
- Add reusable validation rules and ship the one-page workflow.
- Support custom validators and extending existing rules.
- Add extension packaging, installation, and updates.
Goal
A developer should be able to define their own OpenSpec workflow, including its documents, instructions, and validation rules, without modifying OpenSpec itself.
The existing spec-driven workflow becomes one supported approach rather than a format every OpenSpec project must follow.
This issue proposes the overall direction, not a finalized plugin API or implementation design.
Related discussions
- #666: Hardcoded spec format prevents custom schemas from working
- #829: Schema-driven artifact validation
- #997: Route change validation by workflow schema
- #1081: Package schemas, skills, and hooks as extensions
- #1687: Extend existing schemas without maintaining full forks
- #2033: Rethinking deterministic spec merging during archive
One additional direction worth capturing here is letting the documentation grow with the complexity of the change, rather than choosing a fixed set of documents upfront.
For example, a developer might:
- Start with a single
plan.mdfor a small change. - Add
design.mdif the implementation introduces architectural decisions. - Add a test plan or security review if the work needs more rigorous verification.
These should be possible within the same change, without starting over or copying everything into a different schema.
This goes beyond selecting one of several complete schemas. It suggests exploring two related capabilities:
- Optional artifacts: a workflow can offer documents without requiring every change to produce them.
- Composition: a change can add an artifact or set of artifacts from another schema or extension, including its instructions and validation rules.
OpenSpec would need to track which artifacts are actually part of the change, resolve their dependencies, and ensure status, validate, apply, and archive all agree on what's required. Adding structure should not overwrite existing work.
I wouldn't make automatic complexity detection a requirement. The agent could suggest when a design or review would be useful, but users should remain in control of what gets added.
The proposed one-page workflow is a good first test: can a change stay simple when that's enough, but grow into a more detailed workflow when necessary?
Related discussions: #778 (schema inheritance), #900 (optional TDD steps), #2191 (opt-in risk analysis), and #1519 (planning readiness).
One further direction to explore: what if we defined concerns rather than document templates?
Today, a template tells the agent which sections to fill in. That can lead to unnecessary writing, because not every change needs the same level of detail.
Instead, a team could describe the things it generally cares about, such as expected behavior, compatibility, security, technical decisions, and verification. The agent would assess which concerns matter for a particular change, work through them, and capture the important outcomes in whatever form makes sense.
For example:
- Adding a simple UI button might only need a short description of the behavior and how to test it.
- Changing authentication might need detailed permission rules, failure cases, security decisions, and a migration plan.
The goal isn't to generate fewer files for its own sake. It's to capture what's important without forcing every change into the same structure. As a change becomes more complex, the documentation can grow with it.
We'd still need a way to make the agent's choices visible, and to enforce concerns that a team considers mandatory. Templates could remain useful when a team needs a prescribed format.
This may be a more useful long-term foundation than just letting agents choose between multiple predefined templates. It's a direction worth prototyping before settling on the extension model.
One more way to illustrate the idea, without introducing another “*-driven” methodology alongside spec-driven or test-driven:
What if a workflow defined what we care about, rather than prescribing the documents to generate?
Today, a schema largely defines the files and templates, and the agent fills them in. An alternative would let a team define reusable concerns and rules. The agent considers them in the context of the change, then decides what needs to be captured and how.
flowchart TD
subgraph Current["Current approach"]
A["Schema"] --> B["Templates and predefined sections"]
B --> C["Agent fills in documents"]
end
subgraph Possible["Alternative to explore"]
D["Change + team concerns and rules"] --> E["Agent assesses what's relevant"]
E --> F["Resolves questions and decisions"]
F --> G["Creates the appropriate artifacts"]
end
For example, a team might define concerns such as:
- Behavior: Make expected behavior and edge cases explicit.
- Security: Consider permissions and sensitive data when relevant.
- Compatibility: Identify changes to existing interfaces or data.
- Verification: Explain how the intended behavior will be checked.
- Specification format: Capture applicable behavior in Gherkin scenarios when the team requires that level of detail.
For a small UI change, that might result in a short plan with a few acceptance checks. For an authentication change, the same framework might lead to detailed scenarios, security decisions, and a migration plan. The Gherkin rule might shape part of the output without forcing every change to have a separate Gherkin document.
The point is not to invent a new “concern-driven” workflow. It's to explore a more flexible foundation where concerns and rules inform what gets produced, rather than the shape of a template determining what gets considered.
We'd still need to make applicability decisions visible, support mandatory rules, and allow fixed templates where teams actually need them.
One more idea worth exploring: what if OpenSpec could evaluate planning, rather than just validate the documents it produces?
If we define the concerns a team cares about, the agent could assess each change against them:
- Relevance: Does this concern apply to the change?
- Understanding: Do we have enough information to make the right decisions?
- Risk: What could go wrong, and how consequential would it be?
- Uncertainty: What assumptions or unanswered questions remain?
- Verification: How will we know the intended behavior works?
For example, imagine we're planning a CSV export feature.
| Concern | Assessment |
|---|---|
| Expected behavior | Defined |
| Security | Unresolved: who can export data? |
| Verification | Missing tests for CSV escaping and unauthorized access |
| Migration | Not applicable if stored data remains unchanged |
Instead of filling in more template sections, the agent could identify the next useful action: ask a question, investigate the codebase, record a decision, add test cases, or recommend a more detailed design.
Conceptually:
Change + project context
↓
Evaluate relevant concerns
↓
Identify gaps, risks, and uncertainty
↓
Resolve what matters
↓
Re-evaluate as the change evolves
This is somewhat like evals for planning. The goal isn't necessarily a numerical confidence or risk score. It's to make the agent's assessment visible, explain what's missing, and help determine whether we're ready to implement.
Some checks could be deterministic, while others would rely on agent judgment. We'd need to distinguish those clearly and allow teams to enforce mandatory requirements.
This could become the foundation for deciding what documentation, decisions, and verification a change actually needs, rather than choosing all of that upfront.
Related: #1519 (planning readiness) and #783 (cross-artifact quality review).
Sharing a real-world use case in case it helps shape this proposal.
We run a custom schema (proposal → specs → design → review → tasks → acceptance) across a multi-repo project: one planning store plus four code repos, all synced from a single schema source. One agent plans, a different agent implements, and humans approve at fixed gates. Over about 65 archived changes we have ended up building, outside OpenSpec, most of what this issue describes:
-
Levels / optional artifacts. Our changes come in three sizes (light / standard / architecture). Because artifacts can't be optional today, we plan to keep one source schema plus a switch table, generate one schema per level, and pick it with the per-change
schemafield. Native optional artifacts or composition (your first comment) would let us delete that generator. -
Per-artifact validation. Section-presence checks turned out to be easy to satisfy with boilerplate, and they tie each check to heading text. We're moving the machine-checked content into structured frontmatter validated by JSON Schema and leaving the prose free-form. For example, a "prior art" list where every item needs a source URL and a quoted excerpt, and "existing tools" entries whose paths must exist. We'd like the custom executable validator interface (step 3) to support this shape: input = change dir (+ artifact id), output = JSON errors/warnings. Heading rules as in #829 would still cover the simpler cases.
-
Concerns. Some of our concerns are domain-specific: for us, point-in-time data semantics (look-ahead bias) and multiple writers to one dataset. They apply to a change because they're relevant, not because of its size. That matches your "concerns rather than templates" idea, as long as "not applicable, because …" is recorded where people can see it.
-
Approvals and staleness. Human approval is the one thing we can't express. We can model the approval gates as artifacts in the graph, but there's no way to mark an approved artifact as stale when something upstream changes afterwards, so we keep our own digest check. If planning evals or re-evaluation (your last comment) cover "approved, then modified → needs re-approval", that would close the gap for us.
-
Cross-review. Before approval, a different model reviews the plan read-only, and the planner has to answer every finding. We model this as a regular artifact so it gets its instructions from the schema. Any built-in notion of "an artifact produced by a different agent" would help.
We'd be glad to test prototypes against this setup.
I've found this discussion quite interesting. Am I right that all those different ideas connect to a broader vision of making OpenSpec adaptable to different workflows?
One thing that comes to mind is how this relates to what's distincive about OpenSpec, namely its simplicity and approachability.
I'd be interested to explore how that flexibility and lightweightness could be brought together.
If I can chime in with another real-world use case for step 1 (schema-aware validation/archive), closely related to #666. It is also a follow-up to #1459/#1508.
Our setup (OpenSpec 2.1.1)
We keep main specs as flat markdown files under domain folders, so Obsidian and plain file browsers show meaningful names instead of a generic spec:
openspec/specs/<domain>/<name>.md, for examplebackend/overview.md,backend/api.mdorbackend/utils.md. The tree mixes capability specs, module specs and per-domain overview files.- Delta specs inside a change use the standard
openspec/changes/<change>/specs/<domain>/<name>/spec.md.
Nested <domain>/<capability> paths are already supported (#1459/#1508). The remaining gap is only that the leaf filename is fixed to spec.md.
What a project-local schema fixes and what it doesn't
A forked schema fixes authoring: templates and instruction text can describe our layout. It cannot change the rest of the lifecycle, because the main-spec path is hard-coded to <capability-path>/spec.md in validate, spec (show) and change, and in the shipped sync, verify and explore skill templates. In practice:
openspec list --specsprints "No specs found", andvalidate --specsfinds nothing.openspec show <id> --type specfails with "not found at ...//spec.md". openspec validate <change>reports that archive would refuse a MODIFIED delta because the "target spec does not exist", even though the flat file exists.- The stock propose/specs instructions tell the agent to use
list --specsandshow --type specto inventory existing capabilities. With nothing returned, the agent can't see what already exists, and the proposal and delta specs it writes don't match the project.
Request
Let the schema (or config.yaml) declare how main specs are discovered, for example specs/**/*.md, where the spec id is the file's path relative to specs/ without .md. The default would stay **/spec.md, where the id is the parent directory as today. Discovery, list, show, validate, sync and archive would all use the same rule. This avoids assuming a <capability> naming convention, and it would also help anyone who wants file names that read well in Obsidian or any file browser.
#666's requiredSpecArtifacts derives the filename from generates and falls back to the template when the pattern has wildcards, so it may not cover a flat file per spec. It would be good to confirm that case when the schema-aware validation work in step 1 is designed.
Related
- #829 (per-artifact validation blocks) could help us enforce our spec format (frontmatter, navigation links, TBD syntax) in the schema instead of in a separate test. It doesn't address where main specs are found, so the discovery question above is separate.
- #1687/#1686 propose layered overrides, but user-global only, with project-level overlays listed as a non-goal. Teams that commit a project schema still need a full fork, and a fork drifts from the packaged instructions on each upgrade. Project-level layering would help here as well.
Happy to test prototypes against this layout.