Spec-writing workflow: create new specs, update planned/in-progress specs, evolve shipped specs with contract protection. Handles NFR integration, delta tracking via migrations, and spec health checks. Use when user says "write spec", "create spec", "add acceptance criteria", "update spec", "evolve spec", "spec for F-XXXX", "ag spec", "mark shipped", "feature status", "ag specs", "add feature to FEATURES.md", "track this feature". Do NOT use for: implementing features (use implementing-features), planning architecture (use planning-features).
Spec-writing workflow with protection levels, NFR integration, and delta tracking.
Determine the spec operation and its protection level:
| Scenario | Protection | Rules |
|---|---|---|
| New Feature | None | Create FEATURES.md entry + acceptance file + migration |
| Update Planned/In-Progress | Low | Update criteria, migration if significant |
| Evolve Shipped Feature | HIGH | Additive-only, markers, migration mandatory, human approval |
| Status Update | Low | Use feature.sh script |
| Audit | Read-only | Run check-spec-health.sh |
For new features:
spec/FEATURES.mdspec/NFR.md — identify applicable NFRsspec/acceptance/F-XXXX.md from .agentic/spec/acceptance.template.md
## Behavior section first (technology-agnostic user goal)**Verify independently** per AC group## Verificationbash .agentic/tools/migration.sh create "Add F-XXXX [Name]"bash .agentic/tools/check-spec-health.sh F-XXXXag plan F-XXXX before implementing"For status updates:
bash .agentic/tools/feature.sh F-XXXX status shipped
For evolving shipped specs (CONTRACT MODIFICATION):
[Discovered], [Revised in M-NNN: was "X" now "Y"]bash .agentic/tools/migration.sh create "Evolve F-XXXX: [reason]"For audit:
bash .agentic/tools/check-spec-health.sh F-XXXX # Single feature
bash .agentic/tools/check-spec-health.sh --all # All features
For non-trivial features (3+ ACs), scan the acceptance criteria against this taxonomy:
For each gap found, ask the user (max 5 questions, multiple-choice with
recommended answer). Record answers as [Clarified] markers:
[Clarified: user chose option B — offline-first]Skip this pass for trivial features (<3 ACs) unless the user requests it.
After any spec change:
bash .agentic/tools/check-spec-health.sh F-XXXX passesSee references/ for detailed workflows:
spec_writing.md — canonical spec-writing workflow with protection levelsspec_evolution.md — how specs evolve during implementationspec_protection.md — shipped spec contract rules and markersExample 1: Create new feature spec
User says: "Let's spec out the caching feature"
Steps: Find next F-XXXX → check NFRs → create FEATURES.md entry + acceptance file → migration → validate → handoff to ag plan.
Example 2: Evolve shipped spec
User says: "We need to add rate limiting criteria to F-0010"
Steps: Read current spec → show to user → add [Discovered] criteria → create migration → user approves.
Example 3: Mark feature shipped
User says: "F-0125 is done"
Steps: bash .agentic/tools/feature.sh F-0125 status shipped → verify acceptance criteria met.
Example 4: Audit specs
User says: "ag spec --check"
Steps: bash .agentic/tools/check-spec-health.sh --all → report issues.
Pre-commit blocks shipped spec change
Cause: Modified acceptance criteria for a shipped feature without migration.
Solution: bash .agentic/tools/migration.sh create "Evolve F-XXXX: [reason]" and include the migration in the commit.
Pre-commit blocks status downgrade Cause: Changed a shipped feature's status back to in_progress. Solution: This is intentionally blocked. If truly needed, create a migration documenting why.