You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What neither covers: structural architecture rules — layer boundaries, allowed dependency directions, forbidden imports, cycle bans — enforced deterministically. Prose rules in rules/*.md are advisory: an agent optimizing to make a feature work will happily import across a boundary that a Markdown file told it to respect. Scenario-derived tests won't catch that either, because the feature works — the architecture just eroded.
This class of drift is exactly what AI agents produce at scale, and it is also the class of rules that is cheapest to enforce deterministically, because mature tooling already exists in every major ecosystem.
Proposal
OpenSpec should not implement architecture checking itself — it should be the bridge from spec to existing enforcers:
A structured architecture rules format. E.g. openspec/rules/architecture.rules.md (fits the Enhancement: Rules #447 layout) with a machine-readable block (YAML frontmatter or fenced block) declaring layers/modules, allowed dependencies, and constraints (no cycles, naming, etc.).
A compile step. Something like openspec arch generate that translates those rules into config for the ecosystem's standard tool:
JS/TS → dependency-cruiser or eslint-plugin-boundaries
The result: architecture rules stop being instructions the agent may follow and become gates the implementation must pass — regardless of which agent or model wrote the code. This is the "living spec" idea from #433 extended from behavior to structure.
Suggested MVP
One stack (TypeScript + dependency-cruiser), one rules schema, generate + verify wiring.
Everything else (more languages, more rule types) is adapters on a stable core.
Problem
Two current threads leave a gap between them:
rules/folder where architecture and convention constraints live as Markdown for the agent to follow.What neither covers: structural architecture rules — layer boundaries, allowed dependency directions, forbidden imports, cycle bans — enforced deterministically. Prose rules in
rules/*.mdare advisory: an agent optimizing to make a feature work will happily import across a boundary that a Markdown file told it to respect. Scenario-derived tests won't catch that either, because the feature works — the architecture just eroded.This class of drift is exactly what AI agents produce at scale, and it is also the class of rules that is cheapest to enforce deterministically, because mature tooling already exists in every major ecosystem.
Proposal
OpenSpec should not implement architecture checking itself — it should be the bridge from spec to existing enforcers:
A structured architecture rules format. E.g.
openspec/rules/architecture.rules.md(fits the Enhancement: Rules #447 layout) with a machine-readable block (YAML frontmatter or fenced block) declaring layers/modules, allowed dependencies, and constraints (no cycles, naming, etc.).A compile step. Something like
openspec arch generatethat translates those rules into config for the ecosystem's standard tool:Verification integration. The verification flow proposed in Integration with Verification #433 (and the lightweight variant in Add lightweight verification step (implementation vs spec) #381) runs these architecture tests alongside scenario tests; CI blocks merges on violations.
The result: architecture rules stop being instructions the agent may follow and become gates the implementation must pass — regardless of which agent or model wrote the code. This is the "living spec" idea from #433 extended from behavior to structure.
Suggested MVP
generate+ verify wiring.Prior art
Relationship to existing issues