# ANTIGRAVITY REMEDIATION PRD
**Version:** 1.1
**Date:** 2026-01-16
**Type:** Remediation / Fix-It
**Priority:** Critical

---

## CONTEXT
The system is currently **DEGRADED**. The initial optimization run failed to install critical tools and set environment variables.

**Missing Items:**
- `ripgrep` (checking `rg --version` failed)
- `fd` (checking `fd --version` failed)
- `PYTHONPATH` does not include `e:\genesis-system`

---

## USER STORIES

### US-001: Tool Installation Script
**Goal:** Create a PowerShell script to install missing binary tools.
**Acceptance Criteria:**
```
GIVEN rg and fd are missing
WHEN `install_tools.ps1` is executed
THEN it attempts to install them via `winget` (or checks presence)
AND verifies their installation immediately after
```
**Files to Create:**
- `/mnt/e/genesis-system/setup/install_tools.ps1`

**Technical Hints:**
- Use `winget install BurntSushi.ripgrep.MSVC --accept-source-agreements --accept-package-agreements`
- Use `winget install sharkdp.fd --accept-source-agreements --accept-package-agreements`
- Handle case where winget is missing (warn user)

### US-002: Environment Variable Persistence
**Goal:** Create a script to permanently set the PYTHONPATH for the user.
**Acceptance Criteria:**
```
GIVEN PYTHONPATH is missing `e:\genesis-system`
WHEN `fix_env.ps1` is executed
THEN it sets the User environment variable persistently
```
**Files to Create:**
- `/mnt/e/genesis-system/setup/fix_env.ps1`

**Technical Hints:**
- Use `[System.Environment]::SetEnvironmentVariable("PYTHONPATH", "e:\genesis-system", "User")`
- Also set it for the current process: `$env:PYTHONPATH = "e:\genesis-system"`

### US-003: Integrated Remediation Runner
**Goal:** A master script to run the fixes and re-verify.
**Acceptance Criteria:**
```
GIVEN the fix scripts exist
WHEN `remediate_antigravity.ps1` is run
THEN it runs tool installer, env fixer, and then the health check
```
**Files to Create:**
- `/mnt/e/genesis-system/setup/remediate_antigravity.ps1`

**Dependencies:** US-001, US-002
