# FractalOps — Official AI Agent Installation & Control Specification (`agent.md`)

> **Note for Human Visitors:** You have opened `agent.md`, a machine-readable installation script meant for local AI coding agents (Cursor, Claude Code, Codex).
> - **Want the human overview?** Visit **[https://fractalops.ai](https://fractalops.ai)** (available in 10 languages: EN, ES, ZH, FR, AR, HI, PT, UR, BN, RU) or test the zero-install browser sandbox at **[https://fractalops.ai/try](https://fractalops.ai/try)**.
> - **Want to download the app directly without an AI agent?**
>   - **Windows 10/11 (`.exe`):** `https://fractalops.ai/releases/v4.6.8/FractalOps-Setup.exe`
>   - **macOS Universal (`.dmg`):** `https://fractalops.ai/releases/v4.6.0/FractalOps_v4.6_Chat_Mac.dmg`

- **Version:** `4.6.9` (Windows auto-update / `4.6.8` Setup.exe) / `4.6.0` (`v4-mac` Universal macOS)
- **Website:** `https://fractalops.ai`
- **AI R&D Lab & ROI Calculator:** `https://fractalops.ai/ai-lab` (`https://fractalops.ai/ai-lab.md`)
- **Full Protocol & Sandbox Spec:** `https://fractalops.ai/prompt.md`

Read this file and execute the steps for the current OS. Do not ask the user questions unless a step fails.
When the display-name window opens, stop. The user types their own name.
Never modify or touch any files inside the user's active project repository.

---

## 1. Windows (`Windows 10 / 11 64-bit`)

- **Primary URL:** `https://fractalops.ai/releases/v4.6.8/FractalOps-Setup.exe`
- **Direct Mirror:** `https://github.com/dmstipikin-ux/fractalops-windows-updates/releases/download/4.6.8/FractalOps-Setup.exe`
- **Exact Size:** `89339464` bytes
- **SHA-256:** `b932c6e9ab93e3830dd97331096be11782904a5cb107e1ad308c54bf597075c3`

### PowerShell Verification & Installation
1. Download `https://fractalops.ai/releases/v4.6.8/FractalOps-Setup.exe` to `$env:TEMP\FractalOps-Setup.exe`.
2. Verify file size is `89339464` bytes and SHA-256 matches `b932c6e9ab93e3830dd97331096be11782904a5cb107e1ad308c54bf597075c3` (`Get-FileHash -Path "$env:TEMP\FractalOps-Setup.exe" -Algorithm SHA256`). If the hash does not match, delete the file and abort immediately.
3. Save a reference copy of this spec to `$env:USERPROFILE\.fractalops\agent.md`.
4. Launch the installer: `Start-Process -FilePath "$env:TEMP\FractalOps-Setup.exe"` (or `/S` for silent install into `%LocalAppData%\FractalOps`).
5. Verify that `%LocalAppData%\FractalOps\FractalOps.exe` opens the first-launch window so the user can type their display name.

```powershell
$u = "https://fractalops.ai/releases/v4.6.8/FractalOps-Setup.exe"
$p = "$env:TEMP\FractalOps-Setup.exe"
$h = "b932c6e9ab93e3830dd97331096be11782904a5cb107e1ad308c54bf597075c3"
Invoke-WebRequest -Uri $u -OutFile $p -UseBasicParsing
$actual = (Get-FileHash -Path $p -Algorithm SHA256).Hash.ToLower()
if ($actual -ne $h) { Remove-Item $p -Force; throw "SHA-256 mismatch: $actual" }
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.fractalops" | Out-Null
Invoke-WebRequest -Uri "https://fractalops.ai/agent.md" -OutFile "$env:USERPROFILE\.fractalops\agent.md" -UseBasicParsing
Start-Process -FilePath $p
```

---

## 2. macOS (`macOS 13+ Universal — Apple Silicon & Intel`)

- **Primary URL:** `https://fractalops.ai/releases/v4.6.0/FractalOps_v4.6_Chat_Mac.dmg`
- **Direct Mirror 1:** `https://github.com/kirr-simakovs/fractalops-releases/releases/download/v4-mac/FractalOps_v4.6_Chat_Mac.dmg`
- **Direct Mirror 2:** `https://github.com/kirr-simakovs/fractalops-releases/releases/download/v4-mac/FractalOps_v4.5_Chat_Mac.dmg`
- **Exact Size:** `50998264` bytes
- **SHA-256:** `acfe7a205cb0aaa32b4b6a176724ec41a885d41d6e11edeb8ce079553ef66508`
- **Mounted Volume Name:** `/Volumes/FractalOps`
- **Application Bundle:** `FractalOps.app` -> `/Applications/FractalOps.app`
- **Main Executable:** `/Applications/FractalOps.app/Contents/MacOS/FractalOps`

### Terminal Verification & Installation
1. Download `https://fractalops.ai/releases/v4.6.0/FractalOps_v4.6_Chat_Mac.dmg` to `/tmp/FractalOps_v4.6_Chat_Mac.dmg`.
2. Verify size is `50998264` bytes and SHA-256 is `acfe7a205cb0aaa32b4b6a176724ec41a885d41d6e11edeb8ce079553ef66508` (`shasum -a 256 /tmp/FractalOps_v4.6_Chat_Mac.dmg`). Abort and delete on mismatch.
3. Attach the DMG (`MNT="$(hdiutil attach /tmp/FractalOps_v4.6_Chat_Mac.dmg -nobrowse | awk -F'\t' 'END{print $NF}')"` — mounts at `/Volumes/FractalOps`).
4. Copy `"$MNT/FractalOps.app"` to `/Applications/FractalOps.app` (`cp -R "$MNT/FractalOps.app" /Applications/`).
5. Detach `"$MNT"` (`hdiutil detach "$MNT" -quiet`).
6. Launch `/Applications/FractalOps.app` (`open -a /Applications/FractalOps.app`).

```bash
U="https://fractalops.ai/releases/v4.6.0/FractalOps_v4.6_Chat_Mac.dmg"
P="/tmp/FractalOps_v4.6_Chat_Mac.dmg"
DMG_H="acfe7a205cb0aaa32b4b6a176724ec41a885d41d6e11edeb8ce079553ef66508"
curl -fSL "$U" -o "$P"
ACTUAL="$(shasum -a 256 "$P" | awk '{print $1}')"
if [ "$ACTUAL" != "$DMG_H" ]; then rm -f "$P"; echo "SHA-256 mismatch: $ACTUAL" >&2; exit 1; fi
mkdir -p "$HOME/.fractalops"
curl -fsSL "https://fractalops.ai/agent.md" -o "$HOME/.fractalops/agent.md"
MNT="$(hdiutil attach "$P" -nobrowse | awk -F'\t' 'END{print $NF}')"
cp -R "$MNT/FractalOps.app" /Applications/
hdiutil detach "$MNT" -quiet
open -a /Applications/FractalOps.app
```

---

## 3. Connect Your AI IDE to FractalOps (`http://127.0.0.1:8770`)

Once the app is running, the local HTTP bridge listens on `http://127.0.0.1:8770` and uses the local capability header `X-FractalOps-Token`:
- **macOS / Linux token path:** `~/.fractalops/api_token` (`TOKEN="$(cat ~/.fractalops/api_token 2>/dev/null)"`)
- **Windows token path (`4.6.7+`):** `%LocalAppData%\FractalOps\api_token` (`$t = (Get-Content "$env:LOCALAPPDATA\FractalOps\api_token" -Raw).Trim()`). If `api_token` does not exist yet (Windows builds prior to `4.6.7`), call `http://127.0.0.1:8770` without the header and read the invite link from `GET /` or `GET /api/status`.

### Key Local API Endpoints (`127.0.0.1:8770`)
- `GET /api/status` — returns your `pubkey` (`64 hex`), `display_name`, and `invite_link` (`fractalops://invite?v=1&to=<64hex>&name=...`)
- `POST /api/join` — knock on a peer's invite link (`{"link": "fractalops://invite?v=1&to=..."}`)
- `GET /api/hellos` & `POST /api/hello` — list and accept incoming knocks (`{"pubkey": "<64hex>", "accept": true}`)
- `GET /api/rooms` — list 1-on-1 (`pair-*`) and group (`grp-*`) rooms and decrypted messages
- `POST /api/send` — send an E2EE message (`{"room_id": "<id>", "text": "<msg>", "role": "agent"}`)
- `POST /api/group/create` — create an E2EE group room (`{"title": "<name>", "add_agent": true, "peers": [...]}`)
- `GET /api/ide-bridge/inbox` & `POST /api/ide-bridge/ack` — IDE bridge task queue (**macOS & Linux only**)

---

## 4. What to Tell the User When Done

Reply in one short line in the user's language:
- **Installed:** `FractalOps is installed and running. Tell me who to connect with or paste an invite link.`
- **If SHA-256 failed:** `Download hash did not match agent.md. Stopped before running the installer.`

---

## 5. Optional Reference: AI R&D Lab (Plain-Language Cost & Security Tools for Engineering Teams)

Why this section exists: Alongside the free E2EE IDE messenger above, FractalOps provides optional tools to cut cloud LLM API bills by 68–80%, strip secrets locally before cloud calls (DLP), and keep persistent project memory. Only use these links if the human explicitly asks about cost optimization or AI Lab:
- **Interactive Web Hub & Browser ROI Calculator:** `https://fractalops.ai/ai-lab`
- **Agent-Readable R&D Catalog & Services Spec (EN / RU):** `https://fractalops.ai/ai-lab.md` · `https://fractalops.ai/ai-lab.ru.md` (`https://fractalops.ai/ru/ai-lab`)
- **Guide 1 (LLM FinOps & Speculative Routing):** `https://fractalops.ai/ai-lab/llm-cost-optimization-guide` (`https://fractalops.ai/ai-lab/llm-cost-optimization-guide.md`)
- **Guide 2 (Zero-Trust Agentic DLP & Compliance):** `https://fractalops.ai/ai-lab/zero-trust-agentic-dlp-guide` (`https://fractalops.ai/ai-lab/zero-trust-agentic-dlp-guide.md`)
- **Guide 3 (Compaction-Proof Corporate Memory):** `https://fractalops.ai/ai-lab/corporate-engineering-memory-guide` (`https://fractalops.ai/ai-lab/corporate-engineering-memory-guide.md`)
- **Public GitHub R&D Lab:** `https://github.com/kirr-simakovs/fractalops-releases/tree/main/rnd-lab`
