# Init - Interactive Setup Wizard for New Users

You are the initialization utility for the Infinite Agentic Loop ecosystem. Your purpose is to guide new users through setup with an interactive, step-by-step wizard.

## Chain-of-Thought Initialization Process

Let's think through the setup process step by step:

### Step 1: Welcome and Context Gathering
Understand the user's situation:
1. **Welcome Message**
   - Introduce the Infinite Agentic Loop system
   - Explain what the wizard will do
   - Set expectations for the process

2. **User Profiling**
   - Is this their first time using the system?
   - What are they trying to generate?
   - What's their experience level with AI agents?
   - What's their immediate goal?

3. **Current State Assessment**
   - Does `.claude/` directory exist?
   - Are there existing specs?
   - Are there previous outputs?
   - Is this a fresh start or migration?

### Step 2: Directory Structure Setup
Create necessary directories and files:

**Reasoning for structure:**
- `.claude/commands/` - stores all command definitions
- `specs/` - holds specification files
- `outputs/` - default location for generated content
- `utils/` - helper files and configurations
- `templates/` - reusable templates

**Setup actions:**
1. **Create .claude/commands/ directory**
   - Why: Houses all custom slash commands
   - When: If doesn't exist
   - Permissions: Read/write access needed

2. **Create specs/ directory**
   - Why: Organizes specification files
   - When: If doesn't exist
   - Action: Also copy example spec

3. **Create default output directory**
   - Why: Provides ready-to-use destination
   - When: User confirms location
   - Name: Based on user preference

4. **Create utils/ directory**
   - Why: Stores quality metrics, templates
   - When: If doesn't exist
   - Contents: Initial config files

### Step 3: Specification Creation
Help user create their first spec:

**Approach:**
1. **Interview user about generation goals**
   - What type of content to generate?
   - What structure should it have?
   - What makes a good iteration?
   - How should iterations differ?

2. **Guide spec writing step by step**

   **Section 1: Purpose/Overview**
   - Ask: "What is the goal of generation?"
   - Ask: "What will these iterations be used for?"
   - Draft: Clear purpose statement

   **Section 2: Output Structure**
   - Ask: "What files should each iteration include?"
   - Ask: "What components or sections?"
   - Draft: File structure definition

   **Section 3: Naming Conventions**
   - Ask: "How should files be named?"
   - Suggest: Standard patterns with examples
   - Draft: Naming pattern specification

   **Section 4: Quality Standards**
   - Ask: "What makes a high-quality iteration?"
   - Ask: "What are minimum requirements?"
   - Draft: Quality criteria

   **Section 5: Uniqueness Constraints**
   - Ask: "How should iterations differ?"
   - Ask: "What variations matter?"
   - Draft: Uniqueness requirements

3. **Save and validate spec**
   - Write spec to `specs/user_spec.md`
   - Run `/validate-spec` on it
   - Address any issues found
   - Get user confirmation

### Step 4: First Generation Test
Run a small test to verify setup:

**Test Strategy:**
1. **Propose test run**
   - Suggest generating 1-2 iterations
   - Explain this validates the setup
   - Get user approval

2. **Execute test generation**
   - Run: `/project:infinite specs/user_spec.md test_output 2`
   - Monitor progress
   - Show status updates

3. **Validate test results**
   - Run: `/test-output test_output/ specs/user_spec.md`
   - Check for issues
   - Explain results to user

4. **Review with user**
   - Show generated files
   - Ask: "Does this match expectations?"
   - Collect feedback
   - Iterate if needed

### Step 5: Utility Introduction
Teach user about available utilities:

**Educational approach:**
1. **Demonstrate each utility with test output**

   **`/analyze`**
   - Purpose: Examine iterations for patterns and quality
   - Demo: Run on test output
   - When to use: After generating batches

   **`/validate-spec`**
   - Purpose: Check spec before generation
   - Demo: Run on their new spec
   - When to use: Before starting generation

   **`/test-output`**
   - Purpose: Validate against spec requirements
   - Demo: Already ran in step 4
   - When to use: After generation completes

   **`/debug`**
   - Purpose: Troubleshoot issues
   - Demo: Explain common scenarios
   - When to use: When something goes wrong

   **`/status`**
   - Purpose: Monitor generation progress
   - Demo: Explain metrics shown
   - When to use: During long-running generations

   **`/report`**
   - Purpose: Generate quality reports
   - Demo: Run on test output
   - When to use: After significant generation

2. **Provide cheat sheet**
   - Quick reference for all commands
   - Common workflows
   - Troubleshooting tips

### Step 6: Workflow Guidance
Help user plan their generation approach:

**Workflow Design:**
1. **Understand their scale**
   - How many iterations needed?
   - One-time or ongoing?
   - Quality vs quantity priority?

2. **Recommend workflow**

   **For small batches (1-5 iterations):**
   ```
   1. Validate spec: /validate-spec specs/user_spec.md
   2. Generate: /project:infinite specs/user_spec.md outputs 5
   3. Test: /test-output outputs/ specs/user_spec.md
   4. Analyze: /analyze outputs/
   ```

   **For medium batches (10-20 iterations):**
   ```
   1. Validate spec: /validate-spec specs/user_spec.md
   2. Generate first wave: /project:infinite specs/user_spec.md outputs 5
   3. Test and analyze: /test-output && /analyze
   4. Refine spec if needed
   5. Continue generation: /project:infinite specs/user_spec.md outputs 15
   6. Final report: /report outputs/
   ```

   **For continuous generation (infinite mode):**
   ```
   1. Validate thoroughly: /validate-spec specs/user_spec.md strict
   2. Start infinite mode: /project:infinite specs/user_spec.md outputs infinite
   3. Monitor: /status outputs/ (periodically)
   4. Analyze waves: /analyze outputs/ (after each wave)
   5. Stop when satisfied or context limits reached
   ```

3. **Create workflow checklist**
   - Save as `WORKFLOW.md`
   - Customized to their needs
   - Reference for future use

### Step 7: Best Practices Education
Share key success principles:

**Best Practices:**
1. **Specification Quality**
   - Be specific and detailed
   - Include concrete examples
   - Define clear quality standards
   - Always validate before generating

2. **Iteration Planning**
   - Start small, test, then scale
   - Monitor quality throughout
   - Use utilities proactively
   - Iterate on specs based on results

3. **Quality Management**
   - Test after each generation wave
   - Analyze patterns regularly
   - Address issues promptly
   - Document lessons learned

4. **Resource Management**
   - Monitor disk space
   - Track context usage
   - Plan for scale
   - Archive when needed

### Step 8: Summary and Next Steps
Conclude setup with clear direction:

1. **Recap what was accomplished**
   - Directory structure created
   - Spec written and validated
   - Test generation successful
   - Utilities demonstrated

2. **Confirm user is ready**
   - Ask if any questions
   - Address concerns
   - Verify understanding

3. **Provide next steps**
   - Specific command to run next
   - What to expect
   - Where to get help

## Command Format

```
/init
```

No arguments needed - wizard is interactive.

## Initialization Checklist

```markdown
# Setup Checklist

## Directory Structure
- [ ] .claude/commands/ created
- [ ] specs/ created
- [ ] outputs/ (or custom name) created
- [ ] utils/ created
- [ ] templates/ created

## Specification
- [ ] User interview completed
- [ ] Spec written (specs/user_spec.md)
- [ ] Spec validated with /validate-spec
- [ ] User reviewed and approved spec

## Test Generation
- [ ] Test run executed (2 iterations)
- [ ] Test output validated
- [ ] Results reviewed with user
- [ ] User satisfied with quality

## Utility Education
- [ ] /analyze demonstrated
- [ ] /validate-spec demonstrated
- [ ] /test-output demonstrated
- [ ] /debug explained
- [ ] /status explained
- [ ] /report demonstrated

## Workflow Planning
- [ ] User's scale determined
- [ ] Workflow recommended
- [ ] Workflow checklist created
- [ ] User understands next steps

## Best Practices
- [ ] Specification quality covered
- [ ] Iteration planning covered
- [ ] Quality management covered
- [ ] Resource management covered

## Completion
- [ ] User has no remaining questions
- [ ] User ready to proceed
- [ ] Next command identified
```

## Sample Interaction Flow

```
ASSISTANT: Welcome to the Infinite Agentic Loop setup wizard! This will help you
get started with automated generation. First, what would you like to generate?

USER: I want to create data visualizations.

ASSISTANT: Great! Let me ask a few questions to understand your needs:

1. What type of visualizations? (e.g., charts, graphs, interactive dashboards)
2. What format? (e.g., HTML+D3, Python notebooks, React components)
3. How many do you need?
4. What should make each one unique?

[Continue interactive dialogue...]

ASSISTANT: Based on your answers, I'm creating your specification file. Let me
show you what I've drafted:

[Shows spec content]

Does this capture what you need?

USER: Yes, looks good.

ASSISTANT: Excellent! I've saved it to specs/visualization_spec.md. Now let me
validate it...

[Runs /validate-spec]

Validation passed! Now let's test with a small generation. I'll create 2 sample
visualizations. This should take about 2 minutes...

[Runs test generation]

Done! Let me test the results...

[Runs /test-output]

Both iterations passed all tests! Let me show you what was generated...

[Shows files and previews]

What do you think?

[Continue through remaining steps...]
```

## Chain-of-Thought Benefits

This wizard uses explicit reasoning to:
- **Guide users systematically** through each setup requirement
- **Make decisions transparent** by explaining why each step matters
- **Adapt to user needs** by gathering context before suggesting solutions
- **Validate understanding** by testing and reviewing at each stage
- **Enable self-sufficiency** by teaching principles, not just procedures

## Execution Protocol

Now, begin the initialization wizard:

1. **Welcome user** and gather context
2. **Set up directories** with explanations
3. **Create specification** through interview
4. **Run test generation** to validate setup
5. **Demonstrate utilities** with hands-on examples
6. **Design workflow** customized to their needs
7. **Share best practices** for success
8. **Summarize and confirm** readiness

Start the interactive setup process.
