# muanyan-mjq/codex-desktop-fixer architecture

> Architecture diagram of the GitHub repository muanyan-mjq/codex-desktop-fixer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/muanyan-mjq/codex-desktop-fixer
- Repository: https://github.com/muanyan-mjq/codex-desktop-fixer

## Overview

Codex Desktop Fixer is a Windows repair utility for the Codex/ChatGPT desktop app, plus two separate configuration-repair tools. Its main workflow is scheduled or manual execution of the guard: inspect the app’s processes and windows, repair qualifying stuck or hidden-window cases, and take over slow runtime extraction when detected. The README documents these behaviors and installer wiring; no source excerpts were available, so internal implementation details beyond those documented are omitted.

Main entry points: [`codex-guard.ps1`](https://github.com/muanyan-mjq/codex-desktop-fixer/blob/main/codex-guard.ps1) (Guard orchestration), [`install.ps1`](https://github.com/muanyan-mjq/codex-desktop-fixer/blob/main/install.ps1) (Task installation), [`fix-codex.ps1`](https://github.com/muanyan-mjq/codex-desktop-fixer/blob/main/fix-codex.ps1) (Manual repair wrapper), [`remove-claude-imports.ps1`](https://github.com/muanyan-mjq/codex-desktop-fixer/blob/main/remove-claude-imports.ps1) (Import cleanup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_guard["Desktop Guard"]
  node_guard["Guard orchestration<br/>[codex-guard.ps1]"]
  node_inspection["Process and window inspection<br/>[codex-guard.ps1]"]
  node_stuck["Stuck-instance cleanup<br/>[codex-guard.ps1]"]
  node_window["Hidden-window rescue<br/>[codex-guard.ps1]"]
  node_staging["Slow-path detection<br/>[codex-guard.ps1]"]
  node_runtime["Runtime copy and validation<br/>[codex-guard.ps1]"]
  node_relaunch["App relaunch<br/>[codex-guard.ps1]"]
  node_audit["Action log<br/>[codex-guard.ps1]"]
end

subgraph group_setup["Installation"]
  node_installer["Task installation<br/>[install.ps1]"]
  node_manual["Manual repair wrapper<br/>[fix-codex.ps1]"]
  node_uninstaller["Task removal<br/>[uninstall.ps1]"]
end

subgraph group_config["Configuration Repair"]
  node_claude["Import cleanup"]
  node_mcp["GitHub MCP repair<br/>[fix-github-mcp.ps1]"]
end

node_user(("User"))
node_scheduler["Task Scheduler"]
node_wscript["WScript launcher"]
node_windows["Windows process and window APIs"]
node_desktop["Codex desktop app"]
node_appfiles[("App runtime files")]
node_userconfig[("User configuration files")]

node_user -->|"installs"| node_installer
node_installer -->|"registers task"| node_scheduler
node_scheduler -->|"launches"| node_wscript
node_wscript -->|"starts"| node_guard
node_user -->|"runs repair"| node_manual
node_manual -->|"invokes"| node_guard
node_guard -->|"checks state"| node_inspection
node_inspection -->|"queries"| node_windows
node_inspection -->|"examines"| node_desktop
node_guard -->|"cleans qualifying instances"| node_stuck
node_guard -->|"rescues hidden windows"| node_window
node_guard -->|"checks staging"| node_staging
node_staging -->|"reads staging data"| node_appfiles
node_guard -->|"takes over extraction"| node_runtime
node_runtime -->|"copies and validates"| node_appfiles
node_guard -->|"restarts app"| node_relaunch
node_relaunch -->|"starts"| node_desktop
node_guard -->|"records actions"| node_audit
node_user -->|"runs cleanup"| node_claude
node_claude -->|"removes imports and backs up config"| node_userconfig
node_user -->|"runs repair"| node_mcp
node_mcp -->|"updates MCP settings"| node_userconfig
node_user -.->|"removes installation"| node_uninstaller

click node_guard "https://github.com/muanyan-mjq/codex-desktop-fixer/blob/main/codex-guard.ps1"
click node_inspection "https://github.com/muanyan-mjq/codex-desktop-fixer/blob/main/codex-guard.ps1"
click node_stuck "https://github.com/muanyan-mjq/codex-desktop-fixer/blob/main/codex-guard.ps1"
click node_window "https://github.com/muanyan-mjq/codex-desktop-fixer/blob/main/codex-guard.ps1"
click node_staging "https://github.com/muanyan-mjq/codex-desktop-fixer/blob/main/codex-guard.ps1"
click node_runtime "https://github.com/muanyan-mjq/codex-desktop-fixer/blob/main/codex-guard.ps1"
click node_relaunch "https://github.com/muanyan-mjq/codex-desktop-fixer/blob/main/codex-guard.ps1"
click node_audit "https://github.com/muanyan-mjq/codex-desktop-fixer/blob/main/codex-guard.ps1"
click node_installer "https://github.com/muanyan-mjq/codex-desktop-fixer/blob/main/install.ps1"
click node_manual "https://github.com/muanyan-mjq/codex-desktop-fixer/blob/main/fix-codex.ps1"
click node_uninstaller "https://github.com/muanyan-mjq/codex-desktop-fixer/blob/main/uninstall.ps1"
click node_claude "https://github.com/muanyan-mjq/codex-desktop-fixer/blob/main/remove-claude-imports.ps1"
click node_mcp "https://github.com/muanyan-mjq/codex-desktop-fixer/blob/main/fix-github-mcp.ps1"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_guard,node_inspection,node_stuck,node_window,node_staging,node_runtime,node_relaunch,node_audit,node_user toneBlue
class node_installer,node_manual,node_uninstaller,node_appfiles,node_userconfig toneAmber
class node_claude,node_mcp,node_windows toneMint
class node_scheduler toneRose
class node_wscript,node_desktop toneIndigo
```

## Components

### Desktop Guard

- [Guard orchestration](https://github.com/muanyan-mjq/codex-desktop-fixer/blob/main/codex-guard.ps1): `codex-guard.ps1`
- [Process and window inspection](https://github.com/muanyan-mjq/codex-desktop-fixer/blob/main/codex-guard.ps1): `codex-guard.ps1`
- [Stuck-instance cleanup](https://github.com/muanyan-mjq/codex-desktop-fixer/blob/main/codex-guard.ps1): `codex-guard.ps1`
- [Hidden-window rescue](https://github.com/muanyan-mjq/codex-desktop-fixer/blob/main/codex-guard.ps1): `codex-guard.ps1`
- [Slow-path detection](https://github.com/muanyan-mjq/codex-desktop-fixer/blob/main/codex-guard.ps1): `codex-guard.ps1`
- [Runtime copy and validation](https://github.com/muanyan-mjq/codex-desktop-fixer/blob/main/codex-guard.ps1): `codex-guard.ps1`
- [App relaunch](https://github.com/muanyan-mjq/codex-desktop-fixer/blob/main/codex-guard.ps1): `codex-guard.ps1`
- [Action log](https://github.com/muanyan-mjq/codex-desktop-fixer/blob/main/codex-guard.ps1): `codex-guard.ps1`

### Installation

- [Task installation](https://github.com/muanyan-mjq/codex-desktop-fixer/blob/main/install.ps1): `install.ps1`
- [Manual repair wrapper](https://github.com/muanyan-mjq/codex-desktop-fixer/blob/main/fix-codex.ps1): `fix-codex.ps1`
- [Task removal](https://github.com/muanyan-mjq/codex-desktop-fixer/blob/main/uninstall.ps1): `uninstall.ps1`

### Configuration Repair

- [Import cleanup](https://github.com/muanyan-mjq/codex-desktop-fixer/blob/main/remove-claude-imports.ps1): `remove-claude-imports.ps1`
- [GitHub MCP repair](https://github.com/muanyan-mjq/codex-desktop-fixer/blob/main/fix-github-mcp.ps1): `fix-github-mcp.ps1`

### Other components

- **User**
- **Task Scheduler**
- **WScript launcher**
- **Windows process and window APIs**
- **Codex desktop app**
- **App runtime files**
- **User configuration files**

## Connections

- User → Task installation: installs (evidence: `README.md`)
- Task installation → Task Scheduler: registers task (evidence: `README.md`)
- Task Scheduler → WScript launcher: launches (evidence: `README.md`)
- WScript launcher → Guard orchestration: starts (evidence: `README.md`)
- User → Manual repair wrapper: runs repair (evidence: `README.md`)
- Manual repair wrapper → Guard orchestration: invokes (evidence: `README.md`)
- Guard orchestration → Process and window inspection: checks state (evidence: `README.md`)
- Process and window inspection → Windows process and window APIs: queries (evidence: `README.md`)
- Process and window inspection → Codex desktop app: examines (evidence: `README.md`)
- Guard orchestration → Stuck-instance cleanup: cleans qualifying instances (evidence: `README.md`)
- Guard orchestration → Hidden-window rescue: rescues hidden windows (evidence: `README.md`)
- Guard orchestration → Slow-path detection: checks staging (evidence: `README.md`)
- Slow-path detection → App runtime files: reads staging data (evidence: `README.md`)
- Guard orchestration → Runtime copy and validation: takes over extraction (evidence: `README.md`)
- Runtime copy and validation → App runtime files: copies and validates (evidence: `README.md`)
- Guard orchestration → App relaunch: restarts app (evidence: `README.md`)
- App relaunch → Codex desktop app: starts (evidence: `README.md`)
- Guard orchestration → Action log: records actions (evidence: `README.md`)
- User → Import cleanup: runs cleanup (evidence: `README.md`)
- Import cleanup → User configuration files: removes imports and backs up config (evidence: `README.md`)
- User → GitHub MCP repair: runs repair (evidence: `README.md`)
- GitHub MCP repair → User configuration files: updates MCP settings (evidence: `README.md`)
- User → Task removal: removes installation
