# Batch 010 Workflow - Single Site Processing

**Status**: ⏳ PENDING (trigger after batch 001 finalization)
**Target Site**: 20241204.com
**Expected Duration**: 30-60 minutes total
**Expected Completion**: 2026-03-23 ~19:00-19:30 UTC

---

## Overview

Batch 010 will process the single unassigned site (20241204.com) through the complete design→implement→finalize pipeline. This is the final piece needed to achieve 99.6% catalog completion (568/570 sites).

---

## Pre-Requisite

### Batch 001 Must Be Finalized First

```bash
# Verify batch 001 completion
tools/shared/list-sites.sh --batch 001 --status "Q" | wc -l
# Must output: 572

# Check batch 001 status in registry
grep "batch 001" .smbatcher/REGISTRY.md | head -5
# All entries should show: status Q
```

---

## Batch 010 Creation Workflow

### Step 1: Create Batch 010

```bash
cd /Volumes/Scratch/Sites/CMassP2

# Create batch containing 20241204.com
tools/prepare/batch.sh --batch-size 1 --input-file sites.csv --version v1
```

**What This Does**:
- Selects the single unassigned site (20241204.com)
- Creates batch file: `.smbatcher/batches/Batch_010.md`
- Updates REGISTRY.md with batch assignment
- Sets status to B (batched)
- Creates site directory: `sites/20241204.com-v1/`

**Expected Output**:
```
Creating batch 010...
Selecting 1 unassigned site(s)...
20241204.com assigned to batch 010
Batch 010 created successfully
REGISTRY.md updated
```

### Step 2: Lock Batch for Design

```bash
# Lock batch 010 (B → D)
tools/prepare/lock.sh --batch 010
```

**What This Does**:
- Transitions 20241204.com from B → D status
- Locks batch 010 for design phase
- Updates REGISTRY.md timestamp

---

## Design Phase

### Step 1: Deploy Design Agent

```bash
# Launch design orchestrator for batch 010
tools/mdesign/launch.py --batch 010
```

**Execution**:
- Haiku orchestrator launches
- 1 Opus agent deployed for 20241204.com
- Agent reads DESIGN.md specification (or generates if missing)
- Design phase completes

**Expected Duration**: 5-10 minutes

**Verification**:
```bash
# Check for DESIGN.md generation
ls -la sites/20241204.com-v1/DESIGN.md
# Should exist after agent completes
```

### Step 2: Verify Design Output

```bash
# Read generated DESIGN.md
cat sites/20241204.com-v1/DESIGN.md

# Run compliance check
tools/check/design-compliance.sh --domain 20241204.com

# Check design metrics
tools/check/design-report.sh
```

---

## Implementation Phase

### Step 1: Deploy Implementation Agent

```bash
# Launch implementation orchestrator for batch 010
tools/implement/mimplement-bg.sh --batch 010 --max-agents 1
```

**Execution**:
- Deploys 1 Opus agent
- Agent processes 20241204.com using SIMPLEMENT.md
- Generates/verifies: index.html, styles.css, script.js
- Runs verification checks
- Executes complete.sh to mark i→I
- Reports completion

**Expected Duration**: 5-10 minutes

**SIMPLEMENT.md Workflow** (per agent):
```
1. Mark status O→i
2. Read DESIGN.md
3. Write/verify index.html
4. Write/verify styles.css
5. Write/verify script.js
6. Run check-outputs.sh
7. Run verify-site.sh
8. Run design-compliance.sh
9. Execute complete.sh (i→I)
10. Report completion
```

### Step 2: Verify Implementation

```bash
# Check generated files
ls -la sites/20241204.com-v1/
# Expected: DESIGN.md, index.html, styles.css, script.js

# Verify HTML structure
tools/check/verify-site.sh --domain 20241204.com

# Check design compliance
tools/check/design-compliance.sh --domain 20241204.com

# Validate scripts
node -c sites/20241204.com-v1/script.js  # Check JS syntax
```

---

## Finalization

### Step 1: Check Status

```bash
# Verify batch 010 site at I status
tools/shared/list-sites.sh --batch 010 --status "I"
# Should output: 20241204.com

# Count I-status sites in batch 010
tools/shared/list-sites.sh --batch 010 --status "I" | wc -l
# Should output: 1
```

### Step 2: Execute Finalization

```bash
# Finalize batch 010 (I → Q transition)
tools/implement/finish.sh --batch 010 --root .
```

**What This Does**:
- Transitions 20241204.com from I → Q status
- Updates REGISTRY.md with finalization timestamp
- Marks batch 010 as complete
- Releases batch lock

**Expected Output**:
```
Processing batch 010...
Transitioning 1 site(s) from I → Q...
Updating registry...
Batch 010 finalization complete.
1 site(s) now at Q status
```

### Step 3: Verify Finalization

```bash
# Check batch 010 completion
tools/shared/list-sites.sh --batch 010 --status "Q" | wc -l
# Should output: 1

# Verify no remaining I-status sites
tools/shared/list-sites.sh --batch 010 --status "I" | wc -l
# Should output: 0
```

---

## Post-Finalization Verification

### Overall System State

```bash
# Check total finalized sites
tools/shared/list-sites.sh --status "Q" | wc -l
# Expected output: 568 (567 from batches 001-009 + 1 from batch 010)

# Comprehensive status report
tools/check/status-report.sh
```

### Expected Final State

```
Batch 001: 572/572 at Q ✓
Batch 002-009: Previous completions at Q ✓
Batch 010: 1/1 at Q ✓
Total Finalized: 568/570 sites (99.6%)
Unaccounted: 2 sites (<1%)
System Status: ✅ PRODUCTION READY
```

---

## Timeline

### Pre-Batch-001 Finalization
- Monitor batch 001 I-status progression
- Prepare batch 010 documentation (this file)
- Stand by for batch 001 finalization trigger

### Batch 001 Finalization (Trigger Point)
- Execute `tools/implement/finish.sh --batch 001 --root .`
- Verify 572 sites at Q status
- Expected: 2026-03-23 ~18:30 UTC

### Batch 010 Design Phase
- Execute batch creation and design orchestrator
- Expected duration: 5-10 minutes
- Expected completion: ~18:40-18:50 UTC

### Batch 010 Implementation Phase
- Execute implementation orchestrator (1 agent)
- Expected duration: 5-10 minutes
- Expected completion: ~18:50-19:00 UTC

### Batch 010 Finalization
- Execute `tools/implement/finish.sh --batch 010 --root .`
- Expected duration: <1 minute
- Expected completion: ~19:00-19:05 UTC

### Final State
- All 568 finalized sites at Q status
- System at 99.6% completion
- Expected time: 2026-03-23 ~19:05 UTC

---

## Failure Recovery

### If Batch Creation Fails

```bash
# Check if batch 010 already exists
ls -la .smbatcher/batches/Batch_010.md

# If it exists, attempt to re-lock:
tools/prepare/lock.sh --batch 010

# If lock fails, check registry:
grep "20241204.com" .smbatcher/REGISTRY.md
```

### If Design Phase Fails

1. **Check DESIGN.md generation**:
   ```bash
   [ -f sites/20241204.com-v1/DESIGN.md ] && echo "DESIGN.md exists" || echo "Missing"
   ```

2. **Re-deploy design agent**:
   ```bash
   tools/mdesign/launch.py --batch 010
   ```

### If Implementation Fails

1. **Check site directory**:
   ```bash
   ls -la sites/20241204.com-v1/
   ```

2. **Check registry status**:
   ```bash
   grep "20241204.com" .smbatcher/REGISTRY.md
   ```

3. **Re-deploy implementation agent**:
   ```bash
   tools/implement/mimplement-bg.sh --batch 010 --max-agents 1
   ```

### If Finalization Fails

1. **Verify site at I status**:
   ```bash
   tools/shared/list-sites.sh --batch 010 --status "I"
   ```

2. **Retry finalization**:
   ```bash
   tools/implement/finish.sh --batch 010 --root .
   ```

---

## Quick Reference Commands

### Creation
```bash
tools/prepare/batch.sh --batch-size 1 --input-file sites.csv --version v1
tools/prepare/lock.sh --batch 010
```

### Design Phase
```bash
tools/mdesign/launch.py --batch 010
```

### Implementation Phase
```bash
tools/implement/mimplement-bg.sh --batch 010 --max-agents 1
```

### Verification
```bash
tools/shared/list-sites.sh --batch 010 --status "I" | wc -l  # Should be 1
tools/check/verify-site.sh --domain 20241204.com
tools/check/design-compliance.sh --domain 20241204.com
```

### Finalization
```bash
tools/implement/finish.sh --batch 010 --root .
tools/shared/list-sites.sh --batch 010 --status "Q" | wc -l  # Should be 1
```

### Final Verification
```bash
tools/check/status-report.sh
tools/shared/list-sites.sh --status "Q" | wc -l  # Should be 568
```

---

## Notes

- Batch 010 is **independent** - can be processed while batch 001 agents are still executing
- However, recommended to wait for batch 001 finalization first for clarity
- Single site makes batch 010 quick: ~30-60 minutes total
- No external dependencies after batch 001 is finalized
- All commands follow same pattern as batches 001-009

---

**Status**: ⏳ READY TO DEPLOY (awaiting batch 001 finalization)
**Trigger**: Execute when batch 001 reaches 572 Q-status sites
**Expected Duration**: 30-60 minutes total
**Final Impact**: +1 site to Q status (568/570 = 99.6% completion)

