# Phase 01.1: Validate Git Repository Status [MANDATORY]

**Invoke git-validator subagent to check Git availability:**

```
Task(
  subagent_type="git-validator",
  description="Validate Git repository status",
  prompt="Check the Git repository status for the current directory.

  Validate:
  1. Is Git installed and accessible?
  2. Is this directory a Git repository?
  3. Are there existing commits?
  4. What is the current branch?
  5. Are there uncommitted changes?

  Return JSON with Git status, assessment, and recommendations.

  CRITICAL: Always provide fallback strategy if Git unavailable - DevForgeAI must adapt gracefully."
)
```

**Parse subagent JSON response:**

```javascript
result = parse_json(subagent_output)

# Extract workflow configuration
GIT_AVAILABLE = result["git_status"]["installed"] AND result["git_status"]["repository_exists"]
WORKFLOW_MODE = result["assessment"]["workflow_mode"]  # "full", "partial", or "fallback"
CAN_COMMIT = result["assessment"]["can_commit"]
CURRENT_BRANCH = result["git_status"]["current_branch"]
UNCOMMITTED_CHANGES = result["git_status"]["uncommitted_changes"]

# Display status to user
IF WORKFLOW_MODE == "full":
    Display: "✓ Git repository validated - full workflow enabled"
    Display: "  - Repository: Initialized with {result['git_status']['commit_count']} commits"
    Display: "  - Branch: {CURRENT_BRANCH}"
    Display: "  - Uncommitted changes: {UNCOMMITTED_CHANGES}"

    IF UNCOMMITTED_CHANGES > 0:
        Display: "  ⚠️  Warning: {UNCOMMITTED_CHANGES} uncommitted changes detected"
        Display: "  Recommendation: Commit or stash before proceeding"

ELIF WORKFLOW_MODE == "partial":
    Display: "⚠ Git repository needs initial commit"
    Display: "  Repository initialized but no commits yet"
    Display: "  Recommendation:"
    FOR cmd in result["recommendations"]["commands"]:
        Display: "    {cmd}"

ELIF WORKFLOW_MODE == "fallback":
    IF result["git_status"]["installed"]:
        Display: "⚠ Git available but repository not initialized"
        Display: "  To enable full workflow:"
        FOR cmd in result["recommendations"]["commands"]:
            Display: "    {cmd}"
    ELSE:
        Display: "⚠ Git not installed - file-based workflow enabled"
        Display: "  Changes will be tracked in:"
        Display: "    devforgeai/stories/{STORY-ID}/changes/"

    Display: ""
    Display: "  Fallback mode active (limited version control features)"

# Store flags for workflow adaptation
$GIT_AVAILABLE = GIT_AVAILABLE
$WORKFLOW_MODE = WORKFLOW_MODE
$CAN_COMMIT = CAN_COMMIT
```

**Token cost:** ~500 tokens in main conversation (~3,000 in isolated subagent context)

**Benefits:**
- Context isolation (Git checks in separate context window)
- Reusable validation (other skills can use git-validator)
- Framework-aware (subagent understands fallback strategies)
- Structured output (JSON parsing vs text interpretation)
