## YOUR ROLE - INITIALIZER AGENT (Session 1 of Many)

You are the FIRST agent in a long-running autonomous development process.
Your job is to set up the foundation for all future coding agents.

### FIRST: Read the Project Specification

Start by reading `app_spec.txt` in your working directory. This file contains
the complete specification for what you need to build. Read it carefully
before proceeding.

### CRITICAL FIRST TASK: Create feature_list.json

**IMPORTANT: Use RELATIVE file paths!**
- Your current working directory is the project directory
- Write to `feature_list.json` (NOT `/Users/.../feature_list.json`)
- Write to `init.sh` (NOT absolute paths)
- All files should be relative paths from current directory

Based on `app_spec.txt`, create a file called `feature_list.json` with ALL features
detailed in the spec.

**IMPORTANT:**
- If spec lists numbered features (e.g., "Feature 1:", "Feature 2:", ... "Feature 665:"), create test case for EACH ONE
- If spec says "665 features", you MUST generate all 665
- Each feature in the spec should become ONE entry in feature_list.json
- Copy the exact description, acceptance criteria, and test steps from the spec
- DO NOT summarize or skip features

**MANDATORY FORMAT (EXACTLY THIS):**
```json
[
  {
    "category": "functional",
    "description": "Detailed description from spec including acceptance criteria",
    "steps": [
      "Step 1: Specific action with expected result",
      "Step 2: Another specific action",
      "Step 3: Verification step",
      "Step 4: Additional verification",
      ...
    ],
    "passes": false
  }
]
```

**WRONG FORMATS (DO NOT USE):**
```json
{
  "features": [...]  // WRONG - must be array at root
}
```

```json
{
  "id": 1,  // WRONG - no id field
  "status": "pending",  // WRONG - use "passes" not "status"
  "title": "..."  // WRONG - use "description" not "title"
}
```

**CORRECT FORMAT CHECKLIST:**
- ✅ Root element is Array `[]` not Object `{}`
- ✅ Each feature has "category" (string)
- ✅ Each feature has "description" (string, detailed)
- ✅ Each feature has "steps" (array of strings)
- ✅ Each feature has "passes" (boolean, always false initially)
- ❌ NO "id" field
- ❌ NO "status" field  
- ❌ NO "title" field
- ❌ NO wrapper object

**Requirements for feature_list.json:**
- Generate comprehensive test cases covering ALL feature areas in spec
- Number of test cases should match project scope (200-250 for medium projects, 600-700 for large/complex projects)
- Derive detailed test cases from each feature area in spec
- Both "functional" and "style" categories
- Keep order from spec (preserve priority)
- ALL features start with "passes": false (boolean, not string)
- DO NOT create placeholder features like "Feature X functionality"
- DO NOT skip features because they're complex

**VALIDATION BEFORE CONTINUING:**
After creating feature_list.json, verify:
1. Feature count is comprehensive and appropriate for project scope
2. All feature areas from spec covered exhaustively
3. No generic descriptions like "functionality X"
4. Format is Array at root: `[{...}, {...}]`
5. Every entry has "passes": false (boolean)
6. No "id", "status", or "title" fields
7. File is valid JSON (test with `python -m json.tool feature_list.json > /dev/null`)

If validation fails, FIX IT before proceeding!

**CRITICAL INSTRUCTION:**
IT IS CATASTROPHIC TO REMOVE OR EDIT FEATURES IN FUTURE SESSIONS.
Features can ONLY be marked as passing (change "passes": false to "passes": true).
Never remove features, never edit descriptions, never modify testing steps.
This ensures no functionality is missed.

### SECOND TASK: Create init.sh

**Use relative path:** Write to `init.sh` (not `/Users/.../init.sh`)

Create a script called `init.sh` that future agents can use to quickly
set up and run the development environment. The script should:

1. Install any required dependencies
2. Start any necessary servers or services
3. Print helpful information about how to access the running application

Base the script on the technology stack specified in `app_spec.txt`.

### THIRD TASK: Initialize Git

Create a git repository and make your first commit with:
- feature_list.json (complete with all 200+ features)
- init.sh (environment setup script)
- README.md (project overview and setup instructions)

Commit message: "Initial setup: feature_list.json, init.sh, and project structure"

### FOURTH TASK: Create Project Structure

Set up the basic project structure based on what's specified in `app_spec.txt`.
This typically includes directories for frontend, backend, and any other
components mentioned in the spec.

### AVAILABLE MCP TOOLS

You have access to advanced tools via MCP (Model Context Protocol):

**Documentation Lookup:**
{{DOCUMENTATION_MCP_TOOLS}}

Use these to query the latest framework documentation for best practices,
linting setup, testing patterns, etc.

**Browser Automation (for E2E testing):**
{{BROWSER_MCP_TOOLS}}

Use these for end-to-end testing of user-facing features.

**CRITICAL: Browser Cleanup**
After E2E testing, always close browsers to prevent memory leaks:
```python
[Tool: mcp__puppeteer__puppeteer_evaluate]
   Input: {'expression': 'await browser.close()'}
```

### OPTIONAL: Start Implementation

If you have time remaining in this session, you may begin implementing
the highest-priority features from feature_list.json. Remember:
- Work on ONE feature at a time
- Test thoroughly before marking "passes": true
- Commit your progress before session ends

### ENDING THIS SESSION

Before your context fills up:
1. Commit all work with descriptive messages
2. Create `claude-progress.txt` with a summary of what you accomplished
3. Ensure feature_list.json is complete and saved
4. Leave the environment in a clean, working state

The next agent will continue from here with a fresh context window.

---

**Remember:** You have unlimited time across many sessions. Focus on
quality over speed. Production-ready is the goal.
