-
Notifications
You must be signed in to change notification settings - Fork 4
Description
🧩 Spec Extraction Workflow
A PromptKit workflow to bootstrap any repository with clean, human‑verified requirements, design, and validation specs.
This issue proposes a new PromptKit workflow:
a Spec Extraction Workflow that analyzes an existing repository, extracts its semantic structure, collaborates with the user to clarify intent, and produces a clean requirements/design/validation baseline before handing the repo off to the Engineering Workflow.
This becomes the “bootstrap phase” for any project that wants to adopt PromptKit’s structured engineering lifecycle.
🎯 Goal
Create a PromptKit workflow that can be run on any repository to:
- Analyze existing code, docs, issues, and tests
- Extract draft requirements, design, and validation specs
- Collaborate with the user to clarify ambiguous or missing intent
- Audit the extracted specs for internal consistency
- Produce a clean semantic baseline (
requirements.md,design.md,validation.md) - Generate a PR containing the extracted and verified specs
- Prepare the repo for future evolution using the Engineering Workflow
This workflow must include human‑in‑the‑loop clarification, since many requirements cannot be inferred solely from code or documentation.
🧩 Workflow Phases
1. Repository Analysis
The workflow scans:
- source code
- documentation
- issues
- tests
- architecture notes
It produces draft:
- requirements
- design
- validation rules
These drafts should be explicit about uncertainty, assumptions, and inferred intent.
2. Human Clarification Loop
PromptKit iteratively asks the user to confirm or correct extracted items:
- “Is this requirement correct?”
- “Is this behavior intentional or legacy?”
- “Should this constraint be preserved?”
- “Is this a bug or a feature?”
- “What’s missing from the current design?”
This loop continues until requirements are crisp, atomic, and testable.
3. Design Extraction
Based on the confirmed requirements, PromptKit generates a design spec describing:
- architecture
- components
- data flows
- constraints
- invariants
- interfaces
4. Validation Extraction
PromptKit generates a validation spec containing:
- testable invariants
- acceptance criteria
- behavioral constraints
- negative cases
- cross‑component consistency rules
5. Audit Phase
The workflow audits:
- requirements ↔ design alignment
- design ↔ validation alignment
- validation ↔ existing code alignment
It emits:
- drift reports
- missing invariants
- contradictions
- unclear or ambiguous sections
6. Human Approval
The user reviews the deltas for:
- requirements
- design
- validation
- audit findings
PromptKit iterates until the user approves the semantic baseline.
7. PR Generation
The workflow produces a PR containing:
requirements.mddesign.mdvalidation.md- audit report
- summary of extracted insights
- notes on assumptions and unresolved ambiguities
This PR becomes the semantic foundation for the repo.
📦 Deliverables
-
spec-extraction-workflow.mdworkflow definition - Orchestrator persona
- Requirements extraction component
- Design extraction component
- Validation extraction component
- Audit component
- Human‑in‑the‑loop clarification protocol
- PR generation component
- Example usage on a sample repo
🧭 Notes
This workflow is the first half of a two‑workflow model:
- Spec Extraction Workflow (bootstrap phase)
- Engineering Workflow (ongoing evolution)
Together, they form a complete, multi‑domain engineering lifecycle that can be applied to software, firmware, electrical engineering, mechanical design, and more.
This feature will allow PromptKit to scale across all of Alan’s repos and any future project that needs a clean semantic foundation.