I have idea about spec
I have an idea. Currently, the generated specs are mostly business-related. Could we also generate corresponding specs for non-business aspects, such as coding standards, so the model can take them into context?
Specifically, I think we could set up spec indexes within the context of config.yaml. This way, they would be included during the exploration and implementation phases for the model to read, thereby achieving a higher level of consistency in a sense.
Task completed.
The enrichment comment has been posted on issue #691. Here's a summary of what was included:
Key findings:
- The project already has a
config.yamlmechanism withcontextandrulesfields that inject non-business context into the AI model, but it's separate from the spec system - The spec system currently enforces a strict business-requirement structure (SHALL/MUST keywords, WHEN/THEN scenarios) that wouldn't naturally fit coding standards
- Three closely related open issues were identified: #447 (dedicated rules folder), #688 (structured coding standards in config.yaml), and #662 (hierarchical spec structure with
_global/namespace) - Four potential implementation approaches were outlined with pointers to the relevant code locations
Powered by 1Code
Issue Analysis
Thanks for the idea, @SilentFlower. Here's some context from the codebase to help frame this discussion.
Current State: How Non-Business Context Reaches the Model
The project already has a mechanism for injecting non-business context (like coding standards) into the AI model, but it's done through config.yaml rather than through the spec system:
contextfield inopenspec/config.yaml— a free-form string (max 50KB) injected into all artifact instructions as<project_context>. Currently used for tech stack info and cross-platform path handling rules. Seesrc/core/project-config.ts:19-41for the schema definition.rulesfield inopenspec/config.yaml— per-artifact rule lists (keyed by artifact ID likespecs,tasks,design) injected as<rules>. Seesrc/core/artifact-graph/instruction-loader.ts:256-270for how they're loaded.
Both are passed to the AI during the instruction generation phase (src/commands/workflow/instructions.ts:135-152).
How Specs Differ Today
The spec system (openspec/specs/) is currently designed for business/feature specifications with a strict structure enforced by Zod validation:
- Each spec must have a name, overview, and at least one requirement (
src/core/schemas/spec.schema.ts:5-17) - Requirements must contain
SHALLorMUSTkeywords (src/core/schemas/base.schema.ts:8-16) - Requirements must have at least one scenario with WHEN/THEN format
This structure works well for testable business requirements but would be a poor fit for coding standards (e.g., "use arrow functions for components") without schema modifications.
Closely Related Open Issues
This idea overlaps significantly with several open proposals:
- #447 — "Enhancement: Rules" — Proposes a dedicated
openspec/rules/folder with.rules.mdfiles for conventions and standards (e.g.,typescript.rules.md,solid.rules.md). Very similar goal, different mechanism. - #688 — "opsx-config - updating config.yaml" — Proposes structured fields within
config.yamlfor "Coding Standards" and "Architectural Patterns & Constraints", which directly addresses the "spec indexes in config.yaml" idea. - #662 — "Add hierarchical spec structure support" — Proposes a
_global/namespace for cross-cutting concerns like testing standards and security requirements. - #664 — "Configurable specs path" — Proposes
specsPathinconfig.yamlfor configuring where specs live.
Potential Approaches
Based on the codebase, there are a few directions this could take:
-
Extend
config.yamlwith structured fields (aligns with #688) — Add dedicated sections likestandards.coding,standards.architecturethat get injected into<project_context>. This is the simplest path sincereadProjectConfig()(src/core/project-config.ts:66-161) already supports resilient field-by-field validation. -
Dedicated rules folder (aligns with #447) — Create a new
openspec/rules/directory with separate markdown files for different standard categories. Would require new loading logic ingenerateInstructions()(src/core/artifact-graph/instruction-loader.ts:211-275). -
New spec type/schema — Extend the spec format to support a "standards" or "conventions" type that relaxes the SHALL/MUST + scenario requirements. Would require changes to the Zod schemas and parsers.
-
Spec index in config.yaml (as proposed) — Add a
specIndexfield inconfig.yamlthat references spec files to always include in context. This would work with existing spec loading but needs a way to reference and resolve spec paths.
Given the overlap with #447 and #688, it may be worth consolidating the discussion there to converge on a single approach.
Thanks for raising this, @SilentFlower 🙏
This is about Generate specs for non-business aspects (coding standards) and index them in config.yaml context. — an open-ended feature/design idea rather than a discrete, PR-actionable bug or task. To honor it properly we've moved it to Discussions, where it can keep evolving with community input and you can re-engage anytime:
👉 https://github.com/Fission-AI/OpenSpec/discussions/1561
The original issue (and any comments) stays here for the record, so nothing is lost — please continue the conversation in the discussion above. Closing the issue in favor of that thread.