Join our Newsletter — 33% off our NHI Course
Agentic AI & Autonomous Identity

Spec-As-Source

← Back to Glossary
By NHI Mgmt Group Updated October 31, 2026 Domain: Agentic AI & Autonomous Identity

Spec-as-source is the most ambitious form of spec-driven development, where the specification is the primary maintained artifact and code is regenerated from it. This model treats the spec as the canonical expression of behavior, so versioning, review, and promotion controls apply to the spec itself.

What Spec-As-Source Means in Practice

Spec-as-source is the strongest form of spec-driven development because it makes the specification the authoritative artifact, not a commentary on the code. That shifts engineering discipline upstream: the spec must be precise enough to describe behavior, constraints, and intended outputs before implementation exists, and it becomes the basis for regeneration, review, and release promotion.

The key implication is that defects can originate in the specification layer itself. If the spec is ambiguous, incomplete, or inconsistent, those flaws are propagated into every regenerated build, which makes review quality and spec governance more important than in code-first workflows.

Why Spec-As-Source Changes the Development Model

In a code-first model, source code is the canonical artifact and documentation often lags behind it. Spec-as-source reverses that relationship: developers validate the spec as the system of record, then generate code from it. That can improve consistency, reduce drift, and make intended behavior easier to reason about across teams and tooling.

This model is most useful when many downstream artifacts need to stay aligned, such as generated services, client libraries, schemas, or policy-enforced interfaces. It is less forgiving than ordinary documentation because the spec is no longer advisory; it is operationally binding.

Spec-as-source also raises the bar for change management. A spec update is not just a design note, it is a functional change that can alter runtime behavior, interfaces, tests, and release approvals.

Specification Quality, Versioning, and Promotion

Because the specification is canonical, version control becomes a governance control over behavior, not just text. Teams need clear review discipline for schema changes, behavioral rules, compatibility breaks, and defaults, because a small spec edit can fan out into many regenerated components.

Promotion controls matter as much as generation controls. A spec that passes local review may still need additional approval before it is allowed to drive production code, especially where the generated output affects security boundaries, data handling, or external integrations.

Good practice is to treat the spec like a release artifact with its own lifecycle: draft, review, approve, promote, and retire. That keeps ownership explicit and makes it possible to audit who changed the system’s intended behavior and when.

Security Implications of Canonical Specifications

Spec-as-source can strengthen security when the specification encodes input validation, authorization rules, interface contracts, and prohibited states with more consistency than hand-written code. It can also weaken security if the spec becomes a single point of failure, because a malicious or careless spec change can propagate quickly and at scale.

The largest security risk is usually trust in generated correctness. Generation does not prove that the spec is secure, complete, or aligned with policy, so organisations still need review of the spec itself, plus verification that generated outputs actually preserve the intended controls.

Spec-as-source can therefore be a control amplifier, but only when the organisation has strong review, traceability, and promotion discipline around the spec rather than relying on code review alone.

Risk and Threat Considerations

Spec-as-source concentrates risk in the specification layer, so a defect or compromise there can replicate across every build derived from it. That makes the model powerful, but also unusually sensitive to silent specification drift, weak approvals, and injected changes that look harmless in text yet alter downstream behavior.

Failure mechanism: Ambiguous requirements, unsafe defaults, or unauthorized spec edits are regenerated into code, tests, interfaces, and releases, so the same weakness can be reproduced consistently across the pipeline.

Impact: Organisations can ship insecure or incorrect behavior at scale, lose confidence in the generated system, and spend more effort proving the spec is trustworthy than they would validating hand-written code.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP ASVS and NIST SP 800-53 Rev 5 set the technical controls, while ISO/IEC 27001:2022 defines the regulatory obligations.

FrameworkControl / ReferenceRelevance
OWASP ASVSV15 — Secure Coding and ArchitectureSpec-as-source shapes system behavior and generation rules at the architecture level.
Recommendation — Review generated behaviors against V15-style architecture expectations before promoting the spec.
NIST SP 800-53 Rev 5CM-3 — Configuration Change ControlThe canonical spec functions as a controlled change artifact that drives system behavior.
SA-11 — Developer Testing and EvaluationGenerated code still needs verification that it faithfully implements the approved specification.
Recommendation — Apply CM-3 to approve and track spec changes before regeneration. Use SA-11 to validate that generated output matches the approved spec and intended behavior.
ISO/IEC 27001:2022A.8.32 — Change managementSpec promotion is a change-management activity because it alters implemented behavior.
Recommendation — Control spec promotion under A.8.32 so behavior changes are reviewed and authorized.

Practitioner Guidance

Governance implication: Treat the specification as a controlled production artifact with ownership, review criteria, and release gates equal to or stronger than application code. If the spec can regenerate behavior, then it needs traceability, approval history, and rollback discipline.

What to watch for: Pay close attention to spec changes that alter defaults, error handling, permission checks, data classification, or interface compatibility. Those are the edits most likely to create broad downstream effects even when the diff looks small.

Practitioner takeaway: Spec-as-source works best when teams review the spec as if it were executable policy, because in practice, it is.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Reviewed and updated by the NHIMG editorial team on October 31, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org