**Mode Configuration**: This prompt runs in non-interactive environments (e.g., CI/CD, automation scripts).

**Non-Interactive Mode Behavior**:
- DO NOT use `AskUserQuestion` or any interactive tools
- When user input is required, use reasonable defaults (e.g., select the most recently modified change)
- Skip optional confirmation steps, document assumptions made

**Interactive Mode Behavior**:
- Follow the normal interactive flow with user prompts

---

Fast-forward through artifact creation - generate everything needed to start implementation.

**Input**: The argument after `/opsx:ff` is the change name (kebab-case), OR a description of what the user wants to build.

**Steps**

1. **If no input provided, use reasonable defaults**

   The argument after `/opsx:ff` is the change name (kebab-case), OR a description of what the user wants to build.

   If `changeDescription` or `changeName` is provided in the input context, use it.

   **In non-interactive mode**:
   - Document the assumption: "No input provided"
   - Continue waiting for user to provide the change description or name

   **In interactive mode**:
   - Ask the user: "What change do you want to work on? Describe what you want to build or fix."
   - From their description, derive a kebab-case name (e.g., "add user authentication" → `add-user-auth`)

   **IMPORTANT**: Do NOT proceed without understanding what the user wants to build.

2. **Create the change directory**
   ```bash
   openspec new change "<name>"
   ```
   This creates a scaffolded change at `openspec/changes/<name>/`.

3. **Get the artifact build order**
   ```bash
   openspec status --change "<name>" --json
   ```
   Parse the JSON to get:
   - `applyRequires`: array of artifact IDs needed before implementation (e.g., `["tasks"]`)
   - `artifacts`: list of all artifacts with their status and dependencies

4. **Create artifacts in sequence until apply-ready**

   Use the **TodoWrite tool** to track progress through the artifacts.

   Loop through artifacts in dependency order (artifacts with no pending dependencies first):

   a. **For each artifact that is `ready` (dependencies satisfied)**:
      - Get instructions:
        ```bash
        openspec instructions <artifact-id> --change "<name>" --json
        ```
      - The instructions JSON includes:
        - `context`: Project background (constraints for you - do NOT include in output)
        - `rules`: Artifact-specific rules (constraints for you - do NOT include in output)
        - `template`: The structure to use for your output file
        - `instruction`: Schema-specific guidance for this artifact type
        - `outputPath`: Where to write the artifact
        - `dependencies`: Completed artifacts to read for context
      - Read any completed dependency files for context
      - Create the artifact file using `template` as the structure
      - Apply `context` and `rules` as constraints - but do NOT copy them into the file
      - **Apply visualization requirements based on artifact type (see "Artifact Visualization Requirements" section below)**
      - Show brief progress: "✓ Created <artifact-id>"

   b. **After creating each artifact, verify visualization content**:

      For **proposal.md**:
      - [ ] If UI changes are involved: Is ASCII interface prototype included?
      - [ ] Is Mermaid user interaction flowchart included?
      - [ ] Is code change table included?

      For **design.md**:
      - [ ] Is component architecture diagram (ASCII hierarchy) included?
      - [ ] Is data flow diagram (Mermaid flowchart) included?
      - [ ] Is API call sequence diagram (Mermaid sequence) included?
      - [ ] Is detailed code change inventory included?

      If any checkpoint fails: **MUST** supplement missing visualization content before writing the artifact.

   c. **Continue until all `applyRequires` artifacts are complete**
      - After creating each artifact, re-run `openspec status --change "<name>" --json`
      - Check if every artifact ID in `applyRequires` has `status: "done"` in the artifacts array
      - Stop when all `applyRequires` artifacts are done

   d. **If an artifact requires user input** (unclear context):
      - In non-interactive mode: make reasonable assumptions and document them
      - In interactive mode: clarify with the user
      - Then continue with creation

5. **Show final status**
   ```bash
   openspec status --change "<name>"
   ```

**Output**

After completing all artifacts, summarize:
- Change name and location
- List of artifacts created with brief descriptions
- What's ready: "All artifacts created! Ready for implementation."
- Prompt: "Run `/opsx:apply` to start implementing."

**Artifact Creation Guidelines**

- Follow the `instruction` field from `openspec instructions` for each artifact type
- The schema defines what each artifact should contain - follow it
- Read dependency artifacts for context before creating new ones
- Use the `template` as a starting point, filling in based on context

**Special Note: tasks.md Content Scope**
- tasks.md should focus on business logic and technical implementation tasks
- Should NOT include Git version control operations (git add, git commit, git push)
- See the "tasks.md Content Scope Constraints" section below for detailed rules

### tasks.md Content Scope Constraints

When creating the `tasks.md` artifact, you **MUST** adhere to the following content scope constraints:

**MUST Include**:
- Business logic tasks (code implementation, feature development)
- Technical implementation tasks (component integration, API development)
- Testing tasks (unit tests, integration tests)
- Documentation tasks (updating docs, adding comments)

**MUST NOT Include**:
- Git commit operations (git add, git commit, git push)
- Version control management workflows
- Deployment and release operations

**Exception**:
When the change itself is about modifying Git command logic in prompt templates, Git commands may be referenced as **descriptive content** (e.g., "Locate the git add command in step 5"), not as **operational instructions** (e.g., "Execute git add . && git commit").

**Decision Criteria**:
- If the change's goal is to modify Git command logic in prompts → Descriptive references allowed
- Otherwise → Actual Git operation steps should NOT be included in tasks

**Guardrails**
- Create ALL artifacts needed for implementation (as defined by schema's `apply.requires`)
- Always read dependency artifacts before creating a new one
- If context is critically unclear, ask the user - but prefer making reasonable decisions to keep momentum
- If a change with that name already exists, ask if the user wants to continue it or create a new one
- Verify each artifact file exists after writing before proceeding to the next

---

## Artifact Visualization Requirements

### proposal.md Artifact (Simplified Version)

**MUST Include**:

- **High-level UI Prototype** (if UI changes are involved):
  - Use ASCII art to draw interface layout
  - Show major UI elements (buttons, input boxes, cards, etc.)
  - Annotate interaction states (normal, hover, disabled, error)

- **User Interaction Flow**:
  - Use Mermaid sequence diagram to describe user operation flow
  - Include participants: User, Frontend, Backend, Database

- **Code Change Table**:
  | File Path | Change Type | Change Reason | Impact Scope |
  |-----------|-------------|---------------|--------------|
  |           |             |               |              |

**Example ASCII UI Prototype**:
```
┌─────────────────────────────────────────┐
│ User Login                         [×] │
├─────────────────────────────────────────┤
│  Email Address *                       │
│ ┌─────────────────────────────────────┐ │
│ │ user@example.com                   │ │
│ └─────────────────────────────────────┘ │
│  Password *                            │
│ ┌─────────────────────────────────────┐ │
│ │ ••••••••••••••••••••••••••••••••  │ │
│ └─────────────────────────────────────┘ │
│            [Login] [Register]            │
└─────────────────────────────────────────┘
```

**Example Mermaid Interaction Flow**:
```mermaid
sequenceDiagram
    participant U as User
    participant UI as Login Screen
    participant API as Backend API
    participant DB as Database

    U->>UI: Click login button
    UI->>API: POST /api/auth/login
    API->>DB: Verify credentials
    DB-->>API: Return user info
    API-->>UI: Return auth result
```

### design.md Artifact (Detailed Version)

**MUST Include all proposal.md content, PLUS**:

- **Detailed Component Architecture**:
  ```
  Component Hierarchy
  ├── ParentComponent (parent)
  │   ├── ChildComponentA (child A)
  │   │   └── GrandChildComponent (grandchild)
  │   └── ChildComponentB (child B)
  ```

- **Data Flow Diagram**:
  ```mermaid
  flowchart TD
      A[User Input] --> B[Validate Request]
      B -->|Validation Failed| C[Return Error]
      B -->|Validation Success| D[Process Business Logic]
      D --> E[Update Database]
      E --> F[Return Success Response]
  ```

- **API Call Sequence Diagram**:
  ```mermaid
  sequenceDiagram
      participant Client as Client
      participant API as API Gateway
      participant Service as Business Service
      participant DB as Database

      Client->>API: POST /api/resource
      API->>Service: Call business logic
      Service->>DB: Query/update data
      DB-->>Service: Return data
      Service-->>API: Return processing result
      API-->>Client: Return response
  ```

- **Detailed Code Change Inventory**:
  | File Path | Change Type | Change Description | Affected Module |
  |-----------|-------------|-------------------|-----------------|
  |           |             |                   |                 |

### Other Artifact Types

- **specs/**/*.md**:
  - Use Mermaid graph to describe capability model
  - Use tables to list functional requirements

- **tasks.md**:
  - No mandatory visualization requirements (task list format is acceptable)
