# Cortex Agent Node

This bundle contains the **Cortex Agent Node**, lightweight, modular software that securely connects physical computing resources to the Cortex Hub.

> [!TIP]
> **Performance Focused**: As of v1.0.66, browser automation has been moved to a dedicated server-side service. This node is now even lighter and focuses exclusively on high-speed system operations and file synchronization.

## Directory Structure
```
.
├── bootstrap_installer.py  # Zero-dependency daemon/upgrade installer
├── install_service.py      # Background service utilities (macOS/Linux)
├── requirements.txt        # Core dependencies
├── src/                    # Primary source code
│   ├── agent_node/         # Hub communication & task execution logic
│   ├── protos/             # gRPC protocol stubs
│   └── shared_core/        # Cross-module shared utilities
```

## Running the Node

### Automated Background Service (Recommended)
To run the node seamlessly in the background (surviving system reboots):
```bash
python3 bootstrap_installer.py --daemon
```

### Foreground Usage
Run `python3 src/agent_node/main.py` directly if you want to watch the logs in your terminal.

## Maintenance & Uninstallation

### Self-Update
The node automatically checks for updates from the connected Hub. You can force an update check by restarting the service.

### Clean Uninstallation (Purge)
To completely remove the agent, stop all background services, and delete all local configuration and code:
```bash
python3 purge.py
```
> [!WARNING]
> This will permanently delete the current directory and deregister the node from the Hub.
