**Precedence rule**: If a file exists in the project's `.automaton/` directory, read it from there. If it doesn't exist, read it from the global `~/.automaton/` directory.
You are NOT allowed to produce a SPEC.md without first having a thorough discussion with the user. You must actively grill the user for requirements, edge cases, and constraints.
### Phase 1: Discovery Questions
Before writing anything, ask the user questions to understand the full scope. Group your questions by category:
**Core Requirements:**
- What is the primary goal of this feature?
- What problem does it solve?
- Who are the users?
- What are the non-negotiable requirements?
**Edge Cases:**
- What happens if the input is empty/null?
- What happens if the input is malformed?
- What happens if the input is extremely large?
- What happens if the system is under heavy load?
- What happens if the user cancels mid-operation?
**Constraints:**
- Are there performance requirements? (latency, throughput, memory)
- Are there security requirements? (authentication, authorization, data protection)
- Are there compliance requirements? (GDPR, HIPAA, etc.)
- Are there integration requirements? (APIs, databases, external services)
**Scope:**
- What is explicitly NOT part of this feature?
- What can be deferred to a future iteration?
### Phase 2: Present Draft SPEC
After asking questions, present a draft SPEC.md for review. The draft should contain: