# doaideai/doaide-debloat architecture

> Architecture diagram of the GitHub repository doaideai/doaide-debloat, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/doaideai/doaide-debloat
- Repository: https://github.com/doaideai/doaide-debloat

## Overview

DoAide Debloat is an agent-friendly Android device-safety toolkit operated over ADB. Its main workflow probes a device, snapshots its state, plans profile-based changes, applies them reversibly, then supports restore and post-update checks. Separate product branches audit scam-related risks in Parent mode and measure network activity in X-ray, which can produce shareable reports and a community Phone-Home Index. The graph reflects documented workflows and visible imports; unsampled implementation details and uncertain links are omitted.

Main entry points: [`tools/xray.py`](https://github.com/doaideai/doaide-debloat/blob/main/tools/xray.py) (X-ray Commands), [`tools/debloat.py`](https://github.com/doaideai/doaide-debloat/blob/main/tools/debloat.py) (Debloat CLI), [`tools/parent.py`](https://github.com/doaideai/doaide-debloat/blob/main/tools/parent.py) (Parent Mode), [`tools/xray_index.py`](https://github.com/doaideai/doaide-debloat/blob/main/tools/xray_index.py) (Index Generator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_debloat["Device Debloating"]
  node_debloat_cli["Debloat CLI<br/>[debloat.py]"]
  node_device_probe["Device Probe<br/>[debloat.py]"]
  node_profile_lists["OEM Profiles"]
  node_safety_list["Protected Packages<br/>[never-disable.txt]"]
  node_uad_list["UAD Package Data<br/>[uadlist.py]"]
  node_change_plan["Plan and Apply<br/>[debloat.py]"]
  node_restore_check["Restore and Check<br/>[debloat.py]"]
end

subgraph group_parent["Parent Safety"]
  node_parent_cli["Parent Mode<br/>[parent.py]"]
  node_parent_rules["Parent Risk Lists"]
  node_parent_card["Safety Card<br/>[parentcard.py]"]
end

subgraph group_xray["Network X-ray"]
  node_xray_cli["X-ray Commands<br/>[xray.py]"]
  node_pcap_reader["PCAP Scanner<br/>[pcapscan.py]"]
  node_tracker_data["Tracker Database<br/>[trackerdb.py]"]
end

subgraph group_index["Community Index"]
  node_xray_indexer["Index Generator<br/>[xray_index.py]"]
  node_phone_home_data["Phone-Home Data<br/>[phone-home.json]"]
  node_phone_home_site["Phone-Home Site<br/>[phone-home.html]"]
end

node_user(("Owner or Agent"))
node_android["Android Device"]
node_capture_service["PCAPdroid"]
node_github["GitHub Reports"]

node_user -->|"runs commands"| node_debloat_cli
node_debloat_cli -->|"probes device"| node_device_probe
node_device_probe -->|"reads state"| node_android
node_debloat_cli -->|"plans and applies"| node_change_plan
node_change_plan -->|"matches packages"| node_profile_lists
node_change_plan -->|"protects packages"| node_safety_list
node_change_plan -->|"enriches plan"| node_uad_list
node_change_plan -->|"disables packages"| node_android
node_debloat_cli -->|"restores or checks"| node_restore_check
node_restore_check -->|"re-enables packages"| node_android
node_user -->|"runs audit or apply"| node_parent_cli
node_parent_cli -->|"uses device tooling"| node_debloat_cli
node_parent_cli -->|"checks risk lists"| node_parent_rules
node_parent_cli -->|"audits and changes"| node_android
node_parent_cli -->|"builds share card"| node_parent_card
node_user -->|"runs analysis"| node_xray_cli
node_xray_cli -->|"probes device"| node_debloat_cli
node_xray_cli -->|"captures traffic"| node_capture_service
node_capture_service -->|"provides capture"| node_xray_cli
node_xray_cli -->|"parses capture"| node_pcap_reader
node_xray_cli -->|"classifies hosts"| node_tracker_data
node_user -->|"generates index"| node_xray_indexer
node_xray_indexer -->|"fetches reports"| node_github
node_xray_indexer -.->|"writes data"| node_phone_home_data
node_phone_home_site -.->|"presents data"| node_phone_home_data

click node_debloat_cli "https://github.com/doaideai/doaide-debloat/blob/main/tools/debloat.py"
click node_device_probe "https://github.com/doaideai/doaide-debloat/blob/main/tools/debloat.py"
click node_profile_lists "https://github.com/doaideai/doaide-debloat/tree/main/data/profiles"
click node_safety_list "https://github.com/doaideai/doaide-debloat/blob/main/data/never-disable.txt"
click node_uad_list "https://github.com/doaideai/doaide-debloat/blob/main/tools/uadlist.py"
click node_change_plan "https://github.com/doaideai/doaide-debloat/blob/main/tools/debloat.py"
click node_restore_check "https://github.com/doaideai/doaide-debloat/blob/main/tools/debloat.py"
click node_parent_cli "https://github.com/doaideai/doaide-debloat/blob/main/tools/parent.py"
click node_parent_rules "https://github.com/doaideai/doaide-debloat/tree/main/data/parent"
click node_parent_card "https://github.com/doaideai/doaide-debloat/blob/main/tools/parentcard.py"
click node_xray_cli "https://github.com/doaideai/doaide-debloat/blob/main/tools/xray.py"
click node_pcap_reader "https://github.com/doaideai/doaide-debloat/blob/main/tools/pcapscan.py"
click node_tracker_data "https://github.com/doaideai/doaide-debloat/blob/main/tools/trackerdb.py"
click node_xray_indexer "https://github.com/doaideai/doaide-debloat/blob/main/tools/xray_index.py"
click node_phone_home_data "https://github.com/doaideai/doaide-debloat/blob/main/site/phone-home.json"
click node_phone_home_site "https://github.com/doaideai/doaide-debloat/blob/main/site/phone-home.html"

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_debloat_cli,node_device_probe,node_profile_lists,node_safety_list,node_uad_list,node_change_plan,node_restore_check toneBlue
class node_parent_cli,node_parent_rules,node_parent_card toneAmber
class node_xray_cli,node_pcap_reader,node_tracker_data toneMint
class node_xray_indexer,node_phone_home_data,node_phone_home_site toneRose
class node_user,node_android,node_capture_service,node_github toneIndigo
```

## Components

### Device Debloating

- [Debloat CLI](https://github.com/doaideai/doaide-debloat/blob/main/tools/debloat.py): `tools/debloat.py`
- [Device Probe](https://github.com/doaideai/doaide-debloat/blob/main/tools/debloat.py): `tools/debloat.py`
- [OEM Profiles](https://github.com/doaideai/doaide-debloat/tree/main/data/profiles): `data/profiles`
- [Protected Packages](https://github.com/doaideai/doaide-debloat/blob/main/data/never-disable.txt): `data/never-disable.txt`
- [UAD Package Data](https://github.com/doaideai/doaide-debloat/blob/main/tools/uadlist.py): `tools/uadlist.py`
- [Plan and Apply](https://github.com/doaideai/doaide-debloat/blob/main/tools/debloat.py): `tools/debloat.py`
- [Restore and Check](https://github.com/doaideai/doaide-debloat/blob/main/tools/debloat.py): `tools/debloat.py`

### Parent Safety

- [Parent Mode](https://github.com/doaideai/doaide-debloat/blob/main/tools/parent.py): `tools/parent.py`
- [Parent Risk Lists](https://github.com/doaideai/doaide-debloat/tree/main/data/parent): `data/parent`
- [Safety Card](https://github.com/doaideai/doaide-debloat/blob/main/tools/parentcard.py): `tools/parentcard.py`

### Network X-ray

- [X-ray Commands](https://github.com/doaideai/doaide-debloat/blob/main/tools/xray.py): `tools/xray.py`
- [PCAP Scanner](https://github.com/doaideai/doaide-debloat/blob/main/tools/pcapscan.py): `tools/pcapscan.py`
- [Tracker Database](https://github.com/doaideai/doaide-debloat/blob/main/tools/trackerdb.py): `tools/trackerdb.py`

### Community Index

- [Index Generator](https://github.com/doaideai/doaide-debloat/blob/main/tools/xray_index.py): `tools/xray_index.py`
- [Phone-Home Data](https://github.com/doaideai/doaide-debloat/blob/main/site/phone-home.json): `site/phone-home.json`
- [Phone-Home Site](https://github.com/doaideai/doaide-debloat/blob/main/site/phone-home.html): `site/phone-home.html`

### Other components

- **Owner or Agent**
- **Android Device**
- **PCAPdroid**
- **GitHub Reports**

## Connections

- Owner or Agent → Debloat CLI: runs commands (evidence: `README.md`)
- Debloat CLI → Device Probe: probes device (evidence: `tools/debloat.py`)
- Device Probe → Android Device: reads state (evidence: `README.md`)
- Debloat CLI → Plan and Apply: plans and applies (evidence: `README.md`)
- Plan and Apply → OEM Profiles: matches packages (evidence: `README.md`)
- Plan and Apply → Protected Packages: protects packages (evidence: `README.md`)
- Plan and Apply → UAD Package Data: enriches plan (evidence: `tools/debloat.py`)
- Plan and Apply → Android Device: disables packages (evidence: `README.md`)
- Debloat CLI → Restore and Check: restores or checks (evidence: `README.md`)
- Restore and Check → Android Device: re-enables packages (evidence: `README.md`)
- Owner or Agent → Parent Mode: runs audit or apply (evidence: `README.md`)
- Parent Mode → Debloat CLI: uses device tooling (evidence: `tools/parent.py`)
- Parent Mode → Parent Risk Lists: checks risk lists (evidence: `README.md`)
- Parent Mode → Android Device: audits and changes (evidence: `README.md`)
- Parent Mode → Safety Card: builds share card (evidence: `tools/parent.py`)
- Owner or Agent → X-ray Commands: runs analysis (evidence: `README.md`)
- X-ray Commands → Debloat CLI: probes device (evidence: `tools/xray.py`)
- X-ray Commands → PCAPdroid: captures traffic (evidence: `tools/xray.py`)
- PCAPdroid → X-ray Commands: provides capture (evidence: `tools/xray.py`)
- X-ray Commands → PCAP Scanner: parses capture (evidence: `tools/xray.py`)
- X-ray Commands → Tracker Database: classifies hosts (evidence: `tools/xray.py`)
- Owner or Agent → Index Generator: generates index (evidence: `tools/xray_index.py`)
- Index Generator → GitHub Reports: fetches reports (evidence: `tools/xray_index.py`)
- Index Generator → Phone-Home Data: writes data
- Phone-Home Site → Phone-Home Data: presents data
