How udayanirogi/agent-hygiene works
agent-hygiene is a local macOS/Linux CLI for inventorying coding-agent files, auto-starts, and processes, then previewing safe cleanup with reversible backups. Its main workflow runs from CLI commands through scan and inventory presentation or cleanup planning, application, and undo; separate commands supervise agent runs and check team policy. The graph follows documented CLI behavior and sampled imports/calls. Some command implementations and subsystems are unsampled, so their internal links are limited to README-documented behavior.
Main entry points: __init__.py Inventory orchestrator · cli.py Command router · runner.py Agent supervisor · processes.py Process and ports
Components 19
CLI workflow
- Command router
agent_hygiene/cli.py - Inventory output
agent_hygiene/output.py
Agent inventory
- Agent registry
agent_hygiene/agents.py - Inventory orchestrator
agent_hygiene/scan/__init__.py - Disk footprints
agent_hygiene/scan/footprint.py - Auto-start scan
agent_hygiene/scan/autostart.py - Process and ports
agent_hygiene/scan/processes.py - Inventory model
agent_hygiene/model.py
Cleanup and undo
- Cleanup planner
agent_hygiene/clean.py - Team policy
agent_hygiene/policy.py - Backup journal
agent_hygiene/journal.py - Restore and purge
agent_hygiene/restore.py
Run supervision
- Agent supervisor
agent_hygiene/runner.py
Shared services
- Platform utilities
agent_hygiene/platform.py
Other components
- Operator
- Coding-agent CLI
- Local OS
- Home and backup files
- OS process tools
Connections 33
- Operator → Command router: runs command
README.md - Command router → Inventory orchestrator: requests inventory
agent_hygiene/cli.py - Inventory orchestrator → Agent registry: iterates agents
agent_hygiene/scan/__init__.py - Inventory orchestrator → Disk footprints: scans disk
agent_hygiene/scan/__init__.py - Inventory orchestrator → Auto-start scan: scans entries
agent_hygiene/scan/__init__.py - Inventory orchestrator → Process and ports: scans processes
agent_hygiene/scan/__init__.py - Inventory orchestrator → Inventory model: builds inventory
agent_hygiene/scan/__init__.py - Disk footprints → Agent registry: reads agent paths
agent_hygiene/scan/footprint.py - Auto-start scan → Agent registry: matches entries
agent_hygiene/scan/autostart.py - Process and ports → Agent registry: matches commands
agent_hygiene/scan/processes.py - Command router → Inventory output: renders results
agent_hygiene/cli.py - Inventory output → Inventory model: formats inventory
agent_hygiene/output.py - Command router → Team policy: checks policy
agent_hygiene/cli.py - Command router → Cleanup planner: builds and applies plan
agent_hygiene/cli.py - Cleanup planner → Inventory orchestrator: gets inventory
agent_hygiene/cli.py - Cleanup planner → Backup journal: records changes
agent_hygiene/clean.py - Cleanup planner → Home and backup files: modifies agent files
README.md - Backup journal → Home and backup files: stores backups
agent_hygiene/journal.py - Command router → Restore and purge: dispatches undo
agent_hygiene/cli.py - Restore and purge → Backup journal: loads records
agent_hygiene/restore.py - Restore and purge → Home and backup files: restores or purges
README.md - Command router → Agent supervisor: starts supervisor
agent_hygiene/cli.py - Agent supervisor → Coding-agent CLI: launches and tracks
README.md - Agent supervisor → Process and ports: identifies children
agent_hygiene/runner.py - Agent supervisor → Home and backup files: writes run reports
README.md - Inventory orchestrator → Local OS: reads host details
agent_hygiene/scan/__init__.py - Disk footprints → Platform utilities: uses path helpers
agent_hygiene/scan/footprint.py - Auto-start scan → Platform utilities: uses OS helpers
agent_hygiene/scan/autostart.py - Process and ports → Platform utilities: runs system commands
agent_hygiene/scan/processes.py - Backup journal → Platform utilities: uses private storage
agent_hygiene/journal.py - Agent supervisor → Platform utilities: uses OS helpers
agent_hygiene/runner.py - Auto-start scan → OS process tools: queries startup state
README.md - Process and ports → OS process tools: reads process sockets
README.md