# GuruRMM Agent (Claude Integration) — Project State

> Last updated: 2026-04-20

**Status:** ACTIVE
**Last Activity:** 2026-04-20

Rust/Tokio integration layer enabling Main Claude to invoke Claude Code CLI on AD2 (Windows Server 2022) via the GuruRMM WebSocket API. Rate-limited (10 tasks/hr), 2 concurrent max, 300s timeout. Implementation is production-ready but integration into the live GuruRMM agent binary was the pending step.

**NEW:** macOS agent v0.6.1 deployed to Mac (Mikes-MacBook-Air.local) on 2026-04-20. Agent successfully connects to RMM server (172.16.3.30:3001), authenticates with site code SWIFT-CLOUD-6910, and executes remote commands as root. LaunchDaemon service configured with passwordless sudo for GuruRMM operations.

## What Was Done

- `agent/src/claude.rs` — 684-line Rust module: ClaudeExecutor struct, input sanitization, rate limiting, concurrency control, timeout management, unit tests
- `commands_modifications.rs` — step-by-step integration guide for adding `claude_task` command type to GuruRMM agent dispatcher
- `Cargo_dependencies.toml` — dependency spec (tokio 1.35, serde, serde_json, once_cell)
- `TESTING_AND_DEPLOYMENT.md` — 497-line complete deployment and testing guide
- `README.md` — full project documentation

## Recent Changes

| Date | By | Machine | Change | Status |
|------|-----|---------|--------|--------|
| 2026-04-20 | Mike | Mac | macOS agent v0.6.1 deployed - built ARM64 binary, configured LaunchDaemon, passwordless sudo setup, authenticated successfully, tested root command execution | DEPLOYED |
| 2026-04-20 | Mike | Mac | Deleted stale agent entry (6177bcac-e046-4166-ac76-a6db68a363ab) from RMM database - old connection from 2026-04-03 that crashed after 4 seconds | COMPLETE |
| 2026-04-20 | Mike | Mac | Fixed agent authentication - config file required `api_key = "SWIFT-CLOUD-6910"` (site code), not placeholder value | FIXED |
| 2026-04-20 | Mike | Mac | Created passwordless sudo rules for GuruRMM operations - `/etc/sudoers.d/claudetools` with wildcard paths to handle spaces | DEPLOYED |

## If Resuming

1. Copy `agent/src/claude.rs` into the live GuruRMM agent project (`azcomputerguru/gururmm`)
2. Follow `commands_modifications.rs` to wire up the `claude_task` command type
3. Update `Cargo.toml` in the agent crate with required dependencies
4. Build with `cargo build --release`, run `cargo test` and `cargo clippy`
5. Deploy to AD2 per `TESTING_AND_DEPLOYMENT.md` (stop service, backup binary, deploy, restart, smoke test)
6. Note: this was built against the GuruRMM API at 172.16.3.30:3001 — verify agent ID for AD2 before sending commands

## macOS Agent Details (2026-04-20 deployment)

**Agent Info:**
- Agent ID: 001d5198-7807-4d63-b46d-069c9c10ed75
- Hostname: Mikes-MacBook-Air.local
- OS: macOS 26.3.1 (Darwin ARM64)
- Version: 0.6.1
- Site: Main Office (SWIFT-CLOUD-6910)
- Status: online

**Installation:**
- Binary: `/usr/local/bin/gururmm-agent` (3.2 MB ARM64)
- Config: `/Library/Application Support/GuruRMM/agent.toml`
- LaunchDaemon: `/Library/LaunchDaemons/com.azcomputerguru.gururmm.plist`
- Logs: `/Library/Logs/GuruRMM/agent.log` and `agent-error.log`
- Runs as: root (no UserName in plist)

**Command Execution:**
- Tested: `whoami && hostname && uname -a`
- Result: Executes as root successfully
- Execution time: 61ms
- Remote commands via RMM dashboard work without sudo prompts

**Passwordless Sudo:**
- File: `/etc/sudoers.d/claudetools`
- Purpose: Manual ClaudeTools operations (agent already runs as root)
- Syntax: Uses wildcards for paths with spaces (`/Library/Application*`)
