Skip to content

Add invariant extraction template #40

@Alan-Jowett

Description

@Alan-Jowett

Summary

Add a template that extracts structured invariants (MUST/SHOULD/MAY constraints, state transitions, timing assumptions, error conditions) from existing specifications or source code. This is Phase 3 of the specification integrity roadmap.

Motivation

Invariant extraction is foundational for two use cases:

  1. Feeding audit templates — extracting structured requirements from an RFC or legacy spec so they can be audited with audit-traceability or audit-code-compliance
  2. Standalone analysis — understanding what a spec or codebase actually guarantees, in a machine-readable format

Scope

New components needed:

  • Template: extract-invariants — consumes specification text or source code; produces a structured invariant set (requirements-document format with MUST/SHOULD/MAY classification)
  • Protocol (optional): May need a thin invariant-extraction reasoning protocol, or may be able to compose requirements-elicitation + requirements-from-implementation depending on whether input is spec or code

Reused components:

  • specification-analyst or reverse-engineer persona (depending on input type)
  • requirements-doc format (invariants are structured requirements)
  • anti-hallucination + self-verification guardrails

Open questions

  • Should this be one template handling both spec and code inputs, or two separate templates?
  • Should the output format be requirements-doc or a new invariant-set format with additional structure (e.g., state machine notation)?
  • How does this relate to the existing reverse-engineer-requirements template? Is this an extension or a separate concern?

Acceptance criteria

  • Template (and protocol if needed) created
  • Manifest updated
  • tests/validate-manifest.py passes
  • Scenario added to docs/scenarios.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions