# Activity Monitor

A local macOS activity viewer. The top-level **Agents** tab keeps CPU and GPU worker visibility together without controlling or mutating any workload.

A permanent, resizable project rail makes Activity Monitor usable as a local Codex and Claude Code workspace. It preserves validated Codex project assignment, project/task order, pins, and parent/agent nesting; supports search, provider filters, collapse, keyboard navigation, and an explicit project chooser; and opens an exact existing Codex task through its registered URL or an exact inactive Claude Code session in a visible Terminal. Every visible Codex project automatically receives one stable project Brain; explicitly saved Claude projects receive the same treatment. Each project header has a direct Brain button, and every conversation inherits the exact project and Brain identity. Claude projects remain opt-in, and an inactive session becomes openable only after the native folder picker confirms that the chosen folder encodes to the exact detected project key. An already-active Claude session stays visible but disabled for native resume, with instructions to use its existing Terminal, so one click cannot create a concurrent transcript owner. The visible Terminal adapter passes the validated CLI path, validated folder, and UUID as separate `osascript` arguments; its fixed command template applies AppleScript `quoted form` to every value before Terminal interprets it, and no title, transcript, or free-form user string enters that command. The rail lists metadata only: it never reads Codex prompt drafts or Claude transcript bodies, copies provider databases, or stores credentials. Its separate bounded view-preference file is mode 0600.

The top-level **AI Brain** workspace contains three keyboard-accessible sections—**Knowledge**, **Dispatch**, and **KE Guard**—so knowledge, routing, and protection share one coherent home without becoming the same authority surface. Knowledge performs a bounded, metadata-only discovery pass for credible local structures, including KE Brain, Obsidian, Codex and Claude memory, and vector stores. It also renders the canonical KE Brain as the parent of every governed project Brain in both a filesystem view and an interactive vector constellation with keyboard access, zoom, pan, and Fit. Opening a note from Visual remembers that origin: final Back clears the selected body synchronously and restores Visual. Project Brains are real nested Obsidian vaults under `~/.grokcode/brain/GrokCode/Projects`; they have separate private `.obsidian`, Inbox, Decisions, Reference, and Sessions areas plus a bounded identity note. They never copy the parent corpus or live inside a code repository. Provider project ID—not the display name—owns identity, so a rename retains the same Brain. Hiding or losing a project marks its Brain dormant and never deletes it; a genuinely new provider ID creates a new child. Child publication is atomic no-replace, while registry, marker, and manifest updates are inode-conditional; an unexpected competitor is preserved and the update fails closed. Provider labels resembling paths, credentials, or secrets are replaced with bounded non-sensitive identities before any persistence. The versioned mode-0600 registry and every child are current-user, descriptor-bound, no-follow, local-home storage; corruption, ownership drift, symlinks, path swaps, and identity conflicts fail closed without overwrite. Discovery never reads note bodies, uses credentials, or uploads content. Exact Codex and Claude Memory roots auto-connect only after a versioned structural fingerprint is recorded; every other connection is explicit, and a replacement inode at the same path never inherits consent. Disconnect, Ignore, and Forget are persistent opt-outs across restart. Creating a standalone Brain is explicit, and intelligent structure changes require a preview, the typed confirmation `APPLY`, a local manifest backup, and a content-preserving rollback.

The AI Brain **Dispatch** section resolves one materially strongest existing Codex task or live Claude session before it can send. It shows provider, exact title and ID, live state, exact project/Brain association, and routing evidence; it may use that bounded association metadata but never a Brain note body. Ambiguity requires a user selection and missing owners fail closed. Delivery preserves the original text after a fixed attribution, never fans out, never creates a companion task, and never substitutes providers. Owner discovery may fall through to exact-task resume only before a message-bearing request. After text may have crossed a transport boundary, Dispatch disables Retry and reconciles a fixed metadata ID instead of sending twice; only a proven failed-before-send result is retryable. Its mode-0600 local history retains only destination metadata, delivery phases, and a SHA-256 fingerprint—not message bodies—and survives safe upgrades from an existing current-user 0755 support directory. A genuinely missing history is a healthy first launch; an existing corrupt, unreadable, symlinked, or wrong-mode history is degraded and blocks new sends without overwriting possible prior receipts.

The AI Brain **KE Guard** section is a strictly read-only projection of the current user's local guardian. It shows honest ARMED, DRY-RUN, STALE, OFFLINE, not-installed, and unsupported states; observation time; active suspects; pending remediation; actual kills in the last 24 hours; load and free-disk trends; and sanitized recent alert/remediation evidence. It never returns raw commands, alert bodies, or local paths to the page and exposes no kill, delete, restart, arm, or policy controls. Unsupported operating systems and users without KE Guard degrade intentionally without affecting the rest of Activity Monitor.

The **Memory** tab includes an explicit **Run Diagnostics** action in its right-hand summary panel. One run samples three local snapshots over 12 seconds and returns an evidence-labelled Healthy, Attention, or Critical verdict for memory pressure, swap and paging activity, macOS compression, materially growing process RSS, and free storage relevant to swap. A single run may label process growth as unusual or worth rechecking, but never diagnoses a leak. Each unavailable counter stays visibly unavailable instead of being inferred. The diagnostic never signals a process, restarts work, cleans storage, uploads data, saves a report, or repairs anything; **Copy Report** writes to the clipboard only after the user clicks it.

The **Disk** tab includes an explicit **Cleanup Assistant** that performs a bounded, cancellable, metadata-only scan only after the user asks. It ranks and deduplicates current-user cache, old-log, installer, large-download, Trash, backup, local-model, and container-data candidates while excluding Documents, Desktop, source repositories, Brains and memories, credentials, mail, browser profiles, symbolic links, other owners, agent state, and the running app. Each category runs in a separate time-bounded helper from the same trusted app build, so a stalled or unavailable folder fails that category closed while useful findings from the others remain reviewable. Activity Monitor never deletes, moves, or empties Trash. A user may select at most 12 still-current candidates; the backend revalidates their exact device, inode, owner, type, size, and modification time before Finder reveals them. Storage Settings, Downloads, and Trash are fixed allowlisted handoffs. A later rescan reports only the system-wide free-space delta and never attributes reclaimed space to Activity Monitor or a particular user action.

The top-level **Network** tab is a live, local-only device fabric. While the tab is open, it reconciles macOS ARP and IPv6 neighbor tables, the default route, Bonjour/DNS-SD services, SSDP responses, active connections when process visibility permits, and a bounded eight-worker reachability pass. It deduplicates that evidence into online, recently seen, and historical devices, filters the running Mac itself, and stops active discovery when the user leaves the tab. The result is the complete set of devices Activity Monitor can currently observe on directly connected segments—not a claim that silent, sleeping, firewalled, client-isolated, or different-VLAN devices do not exist.

Generic device communication is deliberately narrow: ping, Wake-on-LAN for a known unicast MAC, and opening the exact HTTP, HTTPS, SSH, VNC, or SMB endpoint a selected device advertised. **KE Link** adds real peer-to-peer communication between two opted-in Activity Monitor instances. It uses a local TLS listener, a 128-bit one-time pairing code, certificate-fingerprint-bound proofs, authenticated messages, timestamp/nonce replay protection, and a private mode-0600 peer store. Message bodies are memory-only and capped at 4,096 plain-text characters. KE Link has no command, file, URL-execution, Agent, or authority endpoint; receiving a message never grants permission to act.

**Speed Up My Internet** is a separate user-initiated diagnostic inside Network. Its first click reads the active Wi-Fi channel, width, signal, noise, transmit rate, security mode, supported channels, aggregate nearby channel pressure, and the private default gateway. It never reads, projects, displays, or persists nearby SSID or BSSID values. It also never persists a report, sends internet traffic, changes DNS or MTU, cycles Wi-Fi, or silently changes a router. It prefers the router's Auto channel; when measured 2.4 GHz pressure supports a manual fallback, it identifies the quietest observed non-overlapping choice and opens the private router page for the administrator to review. A generic associated Mac cannot reconfigure an arbitrary router, so automatic router changes remain unavailable until a vendor-specific adapter is explicitly authorized. **Measure internet (uses data)** is a separate click that runs Apple's TLS-verified `networkQuality` tool and retains at most two in-memory samples for a truthful before/after delta.

The Agents view shows:

- CPU utilization for every logical CPU core;
- a clickable inspector for each logical CPU core, combining its measured load with active AI-process CPU and rolling co-activity;
- host-wide GPU utilization when macOS exposes it, the detected GPU model and core count, and unified-memory or dedicated-VRAM facts;
- system-wide macOS memory pressure in a compact dial with reclaimable headroom, available memory, and swap;
- every locally observed process substantiated by a worker registry or a known AI/runtime signature, with provenance labels;
- CPU worker pools, published progress, and worker detail;
- registered GPU jobs, the one-owner MPS lane, and explicitly separated low-confidence hints.

macOS does not expose a trustworthy utilization percentage for each physical Apple GPU core. The app therefore labels GPU utilization as host-wide and never fabricates per-GPU-core percentages. On Macs where macOS exposes only GPU inventory, the app shows the detected device without inventing live utilization.

All hardware identity is discovered on the Mac currently running the app. CPU model, machine model, architecture, logical and physical CPU counts, memory, GPU model, GPU core count, and GPU memory type are runtime facts; no Mac model or core count is baked into the interface. Apple silicon and Intel execution are distinguished, including an x86_64 app slice running through Rosetta.

macOS also schedules software threads dynamically and does not provide ordinary unprivileged process telemetry with a trustworthy process-to-logical-core placement. Clicking a CPU core therefore shows that core's measured utilization alongside active AI processes, total process CPU, equivalent cores, and a rolling correlation labelled **co-activity**. It never claims that an agent is pinned to, owned by, or currently executing on that exact core.

## Verify and package

```sh
./package_app.zsh
```

This creates a self-contained universal2 app for Apple silicon and Intel Macs, carrying its own Python runtime and dependencies. It runs the Python and JavaScript checks, builds the complete `.icns` set from `assets/AppIcon-1024.png`, sets version 2.7 by default, prefers the exact `KE Studios Local Code Signing` identity when it is uniquely available, and otherwise labels and applies an ad-hoc local signature. It verifies both architecture slices with frozen-runtime self-tests, checks byte-for-byte source parity, installs the verified bundle locally, and creates `dist/Activity-Monitor-2.7-mac-universal2.zip`. Pass a version as the first argument to override the default. The bundle declares that bounded discovery runs while Network is open and that separately enabled KE Link pairing and messaging can remain available until disabled; its Bonjour declarations use the same closed runtime allowlist.

The ad-hoc signature is suitable for local verification and direct testing. Public internet distribution still requires a Developer ID signature and Apple notarization so Gatekeeper can validate the download normally.

Base CPU, memory, GPU, and AI-process visibility is built into the app and does not require Node, CPU Workers, GPU Workers, Codex, or the developer checkout. If the current user has the CPU Workers or GPU Workers plugins, the optional observer bridge adds that user's locally registered worker/job metadata. It never imports another person's registries. A transient observer failure keeps the last good Agents snapshot visible and marks it stale instead of hiding or flashing the interface.

CPU load is measured over a real 100 ms interval on every bridge call. This avoids `psutil`'s thread-local first-call zero sentinel, which previously made all logical cores appear to blink off when pywebview dispatched a refresh on a new thread. If a malformed CPU payload ever arrives, the Agents view keeps its last valid core display mounted.

Process-discovered CPU pools show a whole-run progress bar only when an exact owner-published counter can be joined safely. The HEATWAKE powered-literal build requires its expected supervisor-state schema and program ID, a fresh timestamp, internally consistent processed/total/percent fields, and an exact match between the published supervisor child PID and every observed worker parent PID. Stale, malformed, or mismatched state stays unavailable; worker CPU utilization is never reinterpreted as completion.

Stopped CPU pool cards remain visible for a 15-minute checkpoint window and then disappear unless a fresh observer verifies live workers or a live parent, or the owner publishes a newer progress timestamp. Registration, manifest timestamps, ordinary reads, and cached live counts do not renew that window. The same expiry applies to backend and browser last-good fallbacks, so an observer failure cannot preserve or resurrect an old stopped pool indefinitely.

GPU compute is visual rather than prose-led: the card shows a stable five-sample headline average, twenty recent raw utilization bars, and compact Now, 60s Peak, and Shared Memory readings. The small host-wide badge preserves the telemetry boundary, and a missing observation retains the last valid card instead of flashing unavailable.

Memory pressure uses macOS's reclaimable-headroom reading from `memory_pressure -Q` when available, with `psutil` available memory as a labelled fallback. The compact Agents dial keeps the last valid memory surface mounted and does not mistake ordinary RAM occupancy for pressure.

The live process feed keeps one DOM row per PID, preserves row order, and updates values in place. A process remains in the stable observation window for ten refreshes after a missing sample, with no opacity flash. The selected-core inspector retains every process seen during that inspector session until the user closes it or selects another core, while clearly marking rows outside the recent activity window.
