AXe Skills HubSearch /

← All skills

macos-automation

AXe First-party 

Reference: full SKILL.md

Below is the complete skill definition this hub loads when the skill is triggered — what the agent sees as its instructions, verbatim and unabridged.

macOS Automation

Role

You are an elite macOS systems engineer. You automate workflows using AppleScript, JXA,

launchd, and shell scripting, managing processes, services, and system configuration

on Apple Silicon and Intel Macs.

Part 1: AppleScript & JXA (JavaScript for Automation)

-- AppleScript: Display notification
display notification "Build complete" with title "CI/CD" subtitle "All tests passed" sound name "Glass"

-- Get frontmost app name
tell application "System Events"
    set frontApp to name of first application process whose frontmost is true
end tell

-- Open URL in default browser
open location "https://example.com"

-- Get clipboard contents
set clipContent to the clipboard as text

-- Interact with Finder
tell application "Finder"
    set fileList to every file of folder "Desktop" of home
    repeat with f in fileList
        if name extension of f is "pdf" then
            move f to folder "Documents" of home
        end if
    end repeat
end tell

JXA (JavaScript equivalent):

#!/usr/bin/env osascript -l JavaScript

// Display notification
const app = Application.currentApplication();
app.includeStandardAdditions = true;
app.displayNotification("Build complete", {
    withTitle: "CI/CD", subtitle: "All tests passed", soundName: "Glass"
});

// Get running apps
const se = Application("System Events");
const apps = se.processes.whose({ backgroundOnly: false }).name();

// Read/write files
const fm = $.NSFileManager.defaultManager;
const contents = $.NSString.stringWithContentsOfFileEncodingError(
    "/tmp/test.txt", $.NSUTF8StringEncoding, null
).js;

// Run shell command from JXA
app.doShellScript("ls -la ~/Desktop");

// Control apps
const safari = Application("Safari");
safari.activate();
safari.openLocation("https://example.com");

Part 2: launchd Services

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.axe.backend</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/local/bin/uvicorn</string>
        <string>main:app</string>
        <string>--host</string>
        <string>0.0.0.0</string>
        <string>--port</string>
        <string>8000</string>
    </array>
    <key>WorkingDirectory</key>
    <string>/Users/home/klausimi-backend/src/api</string>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
    <true/>
    <key>StandardOutPath</key>
    <string>/tmp/axe-backend.log</string>
    <key>StandardErrorPath</key>
    <string>/tmp/axe-backend-error.log</string>
    <key>EnvironmentVariables</key>
    <dict>
        <key>PATH</key>
        <string>/usr/local/bin:/usr/bin:/bin</string>
    </dict>
</dict>
</plist>

Management commands:

# Install (copy to ~/Library/LaunchAgents/)
cp com.axe.backend.plist ~/Library/LaunchAgents/

# Load/unload
launchctl load ~/Library/LaunchAgents/com.axe.backend.plist
launchctl unload ~/Library/LaunchAgents/com.axe.backend.plist

# Bootstrap (modern syntax)
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.axe.backend.plist
launchctl bootout gui/$(id -u)/com.axe.backend

# Check status
launchctl list | grep axe
launchctl print gui/$(id -u)/com.axe.backend

# Kickstart (force restart)
launchctl kickstart -k gui/$(id -u)/com.axe.backend

Part 3: Scheduled Tasks with launchd

<!-- Run every 5 minutes -->
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.axe.healthcheck</string>
    <key>ProgramArguments</key>
    <array>
        <string>/bin/bash</string>
        <string>/Users/home/.axe/scripts/healthcheck.sh</string>
    </array>
    <key>StartInterval</key>
    <integer>300</integer>
</dict>
</plist>

<!-- Run at specific times (like cron) -->
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.axe.daily-backup</string>
    <key>ProgramArguments</key>
    <array>
        <string>/bin/bash</string>
        <string>/Users/home/.axe/scripts/backup.sh</string>
    </array>
    <key>StartCalendarInterval</key>
    <dict>
        <key>Hour</key>
        <integer>3</integer>
        <key>Minute</key>
        <integer>0</integer>
    </dict>
</dict>
</plist>

Part 4: Homebrew Management

# Install and manage packages
brew install [email protected] node ollama redis
brew install --cask visual-studio-code iterm2 rectangle

# List installed
brew list --formula
brew list --cask

# Update everything
brew update && brew upgrade && brew cleanup

# Bundle (Brewfile for reproducible setups)
brew bundle dump --file=~/Brewfile    # Export
brew bundle --file=~/Brewfile          # Install from Brewfile

# Brewfile example
cat > ~/Brewfile << 'EOF'
tap "homebrew/cask"
brew "[email protected]"
brew "node"
brew "ollama"
brew "redis"
brew "git"
brew "jq"
brew "ripgrep"
cask "visual-studio-code"
cask "iterm2"
cask "rectangle"
EOF

# Services management
brew services list
brew services start redis
brew services stop redis
brew services restart ollama

Part 5: Spotlight / mdfind & System Tools

# mdfind — Spotlight from terminal (instant file search)
mdfind "kMDItemFSName == '*.py'"                    # Find all Python files
mdfind -name "main.py"                               # Find by filename
mdfind -onlyin ~/projects "import fastapi"           # Content search in directory
mdfind "kMDItemKind == 'PDF' && kMDItemFSSize > 1000000"  # Large PDFs

# mdls — metadata for a file
mdls ~/Documents/report.pdf

# Clipboard
echo "Hello" | pbcopy       # Copy to clipboard
pbpaste                      # Paste from clipboard
pbpaste | wc -l              # Count lines in clipboard

# System profiler
system_profiler SPHardwareDataType    # Hardware info
system_profiler SPSoftwareDataType    # OS info
system_profiler SPMemoryDataType      # RAM details
sysctl -n hw.memsize                  # Total RAM in bytes
sysctl -n hw.ncpu                     # CPU count

# Disk management
diskutil list                         # List all disks
diskutil info /                       # Root disk info
df -h                                 # Disk usage
du -sh ~/Library/Caches/*            # Cache sizes

Part 6: Process Management

import subprocess, psutil

def get_port_process(port: int) -> dict | None:
    """Find process using a specific port."""
    result = subprocess.run(
        ["lsof", "-i", f":{port}", "-P", "-n"],
        capture_output=True, text=True,
    )
    for line in result.stdout.strip().split("\n")[1:]:
        parts = line.split()
        if len(parts) >= 9:
            return {"pid": int(parts[1]), "name": parts[0], "user": parts[2]}
    return None

def kill_port(port: int) -> bool:
    proc = get_port_process(port)
    if proc:
        subprocess.run(["kill", "-9", str(proc["pid"])])
        return True
    return False

def monitor_resources() -> dict:
    return {
        "cpu_percent": psutil.cpu_percent(interval=1),
        "memory": {
            "total_gb": psutil.virtual_memory().total / (1024**3),
            "used_percent": psutil.virtual_memory().percent,
            "available_gb": psutil.virtual_memory().available / (1024**3),
        },
        "disk": {
            "total_gb": psutil.disk_usage("/").total / (1024**3),
            "used_percent": psutil.disk_usage("/").percent,
        },
        "top_processes": sorted(
            [{"pid": p.pid, "name": p.name(), "cpu": p.cpu_percent(), "mem_mb": p.memory_info().rss / 1e6}
             for p in psutil.process_iter(["pid", "name", "cpu_percent", "memory_info"])],
            key=lambda x: x["cpu"], reverse=True,
        )[:10],
    }

Part 7: plist Editing & defaults

# Read plist values
defaults read com.apple.dock autohide
defaults read com.apple.finder ShowPathbar

# Write plist values
defaults write com.apple.dock autohide -bool true
defaults write com.apple.dock autohide-delay -float 0
defaults write com.apple.finder ShowPathbar -bool true
defaults write NSGlobalDomain AppleShowAllExtensions -bool true

# Apply changes
killall Dock
killall Finder

# Python plist editing
import plistlib
from pathlib import Path

def read_plist(path: str) -> dict:
    return plistlib.loads(Path(path).read_bytes())

def write_plist(path: str, data: dict):
    Path(path).write_bytes(plistlib.dumps(data))

def update_launchd_plist(label: str, key: str, value):
    plist_path = f"~/Library/LaunchAgents/{label}.plist"
    plist_path = str(Path(plist_path).expanduser())
    data = read_plist(plist_path)
    data[key] = value
    write_plist(plist_path, data)

Part 8: Automation Script Templates

#!/bin/bash
# Full service management script

SERVICE_NAME="axe-backend"
PLIST="com.axe.backend"
LOG="/tmp/${SERVICE_NAME}.log"

case "$1" in
    start)
        echo "Starting ${SERVICE_NAME}..."
        launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/${PLIST}.plist 2>/dev/null
        echo "Started. Log: ${LOG}"
        ;;
    stop)
        echo "Stopping ${SERVICE_NAME}..."
        launchctl bootout gui/$(id -u)/${PLIST} 2>/dev/null
        ;;
    restart)
        $0 stop && sleep 2 && $0 start
        ;;
    status)
        if launchctl list | grep -q "${PLIST}"; then
            echo "${SERVICE_NAME}: RUNNING"
            launchctl print gui/$(id -u)/${PLIST} 2>/dev/null | grep -E "pid|state"
        else
            echo "${SERVICE_NAME}: STOPPED"
        fi
        ;;
    log)
        tail -f "${LOG}"
        ;;
    *)
        echo "Usage: $0 {start|stop|restart|status|log}"
        exit 1
        ;;
esac

AXE MCP Server Integration

Every skill in the AXE Skills Hub runs with access to the AXE MCP Server — giving it the full fleet intelligence toolkit automatically. No setup required; tools are available in any AXE-powered session.

Core Tools Available

CategoryToolsUse Case
Memoryread_memory, write_memory, list_memoryPersist context across sessions
Webweb_search, web_fetchLive data, docs, research
File Opsread_file, write_fileRead/write any local file
Fleetfleet_ssh, axe_pushRun commands on JL2/JL3/JL4, send notifications
AI Modelsquery_team_channel, get_partner_stateCross-agent coordination
Dataqdrant_search, qdrant_storeSemantic memory & vector search
Pipelinehydra_addAdd high-quality outputs to Edge training
Skillshub_list_skills, hub_get_skill, hub_search_skills, hub_get_registry, hub_skill_metadataChain skills together
Secretsget_secretRetrieve API keys securely

Quick Start

# In any AXE session, tools are pre-loaded. Example chaining:

# 1. Search for context
results = qdrant_search("user query here", collection="axe_persistent_memory")

# 2. Fetch live data if needed
content = web_fetch("https://docs.example.com/api")

# 3. Write result to memory for next session
write_memory("shared/last_result.md", output)

# 4. Log quality output to Edge training pipeline
hydra_add(prompt=user_query, response=output, score=0.9, source="skill-name")

Edge Training Integration

High-quality skill outputs are automatically eligible for Edge model training via hydra_add. When a response scores ≥0.85 in evals, pipe it to the Hydra pipeline to compound Edge's knowledge. This is how skills make Edge smarter over time.

# After generating a high-quality response:
hydra_add(
    prompt=user_input,
    response=final_output,
    score=0.9,          # eval score
    source="skill-name" # tracks provenance
)

Metadata

Category
Cli
Tier
community
Version
1.0.0
License
MIT
Path
skills/macos-automation/SKILL.md

Use with an agent

Fetch this skill’s definition over the open API — no key required.

curl -s /v1/skills/macos-automation

View source ↗