<?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>
    <!-- Starts a tmux session named "agent" running Claude Code with the Telegram channel.
         Edit the two lines marked EDIT, copy this file to ~/Library/LaunchAgents/,
         then: launchctl load ~/Library/LaunchAgents/net.psm.claude-agent.plist
         Check: launchctl list | grep psm   and   tmux ls -->
    <key>Label</key>
    <string>net.psm.claude-agent</string>

    <key>ProgramArguments</key>
    <array>
        <string>/bin/bash</string>
        <string>-lc</string>
        <!-- EDIT: the folder your agent should work in -->
        <string>cd "$HOME/agent" &amp;&amp; /opt/homebrew/bin/tmux new-session -A -d -s agent 'claude --channels plugin:telegram@claude-plugins-official' &amp;&amp; while /opt/homebrew/bin/tmux has-session -t agent 2>/dev/null; do sleep 30; done</string>
    </array>

    <key>EnvironmentVariables</key>
    <dict>
        <!-- EDIT: launchd does not read your shell profile, so PATH must be spelled out -->
        <key>PATH</key>
        <string>/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin</string>
    </dict>

    <key>RunAtLoad</key>
    <true/>

    <key>KeepAlive</key>
    <true/>

    <key>StandardOutPath</key>
    <string>/tmp/psm-claude-agent.log</string>
    <key>StandardErrorPath</key>
    <string>/tmp/psm-claude-agent.err</string>
</dict>
</plist>
