$npx -y skills add berabuddies/Semia --skill claude-connectConnect Claude to Clawdbot instantly and keep it connected 24/7. Run after setup to link your subscription, then auto-refreshes tokens forever.
| 1 | # claude-connect |
| 2 | |
| 3 | **Connect your Claude subscription to Clawdbot in one step.** |
| 4 | |
| 5 | Automatically: |
| 6 | - ✅ Reads Claude OAuth tokens from Keychain |
| 7 | - ✅ Writes them to Clawdbot in proper OAuth format |
| 8 | - ✅ Auto-refreshes every 2 hours (before expiry) |
| 9 | - ✅ Notifies you on success/failure |
| 10 | - ✅ Works with `clawdbot onboard` (fixes OAuth auth-profiles bug) |
| 11 | |
| 12 | --- |
| 13 | |
| 14 | ## Quick Start |
| 15 | |
| 16 | **1. Install the skill:** |
| 17 | ```bash |
| 18 | clawdhub install claude-connect |
| 19 | cd ~/clawd/skills/claude-connect |
| 20 | ``` |
| 21 | |
| 22 | **2. Ensure Claude CLI is logged in:** |
| 23 | ```bash |
| 24 | claude auth |
| 25 | # Follow the browser login flow |
| 26 | ``` |
| 27 | |
| 28 | **3. Run installer:** |
| 29 | ```bash |
| 30 | ./install.sh |
| 31 | ``` |
| 32 | |
| 33 | That's it! Tokens will refresh automatically every 2 hours. |
| 34 | |
| 35 | --- |
| 36 | |
| 37 | ## What It Does |
| 38 | |
| 39 | ### Fixes `clawdbot onboard` OAuth Bug |
| 40 | |
| 41 | When you run `clawdbot onboard --auth-choice claude-cli`, it sometimes doesn't properly write OAuth tokens to `auth-profiles.json`. |
| 42 | |
| 43 | This skill: |
| 44 | 1. Reads OAuth tokens from macOS Keychain (where Claude CLI stores them) |
| 45 | 2. Writes them to `~/.clawdbot/agents/main/agent/auth-profiles.json` in **proper OAuth format**: |
| 46 | ```json |
| 47 | { |
| 48 | "profiles": { |
| 49 | "anthropic:claude-cli": { |
| 50 | "type": "oauth", |
| 51 | "provider": "anthropic", |
| 52 | "access": "sk-ant-...", |
| 53 | "refresh": "sk-ant-ort...", |
| 54 | "expires": 1234567890 |
| 55 | } |
| 56 | } |
| 57 | } |
| 58 | ``` |
| 59 | 3. Sets up auto-refresh (runs every 2 hours via launchd) |
| 60 | 4. Keeps your connection alive 24/7 |
| 61 | |
| 62 | --- |
| 63 | |
| 64 | ## Installation |
| 65 | |
| 66 | ### Automatic (Recommended) |
| 67 | |
| 68 | ```bash |
| 69 | cd ~/clawd/skills/claude-connect |
| 70 | ./install.sh |
| 71 | ``` |
| 72 | |
| 73 | The installer will: |
| 74 | - ✅ Verify Claude CLI is set up |
| 75 | - ✅ Create config file |
| 76 | - ✅ Set up auto-refresh job (launchd) |
| 77 | - ✅ Run first refresh to test |
| 78 | |
| 79 | ### Manual |
| 80 | |
| 81 | 1. Copy example config: |
| 82 | ```bash |
| 83 | cp claude-oauth-refresh-config.example.json claude-oauth-refresh-config.json |
| 84 | ``` |
| 85 | |
| 86 | 2. Edit config (optional): |
| 87 | ```bash |
| 88 | nano claude-oauth-refresh-config.json |
| 89 | ``` |
| 90 | |
| 91 | 3. Test refresh: |
| 92 | ```bash |
| 93 | ./refresh-token.sh --force |
| 94 | ``` |
| 95 | |
| 96 | 4. Install launchd job (optional - for auto-refresh): |
| 97 | ```bash |
| 98 | cp com.clawdbot.claude-oauth-refresher.plist ~/Library/LaunchAgents/ |
| 99 | launchctl load ~/Library/LaunchAgents/com.clawdbot.claude-oauth-refresher.plist |
| 100 | ``` |
| 101 | |
| 102 | --- |
| 103 | |
| 104 | ## Configuration |
| 105 | |
| 106 | Edit `claude-oauth-refresh-config.json`: |
| 107 | |
| 108 | ```json |
| 109 | { |
| 110 | "refresh_buffer_minutes": 30, |
| 111 | "log_file": "~/clawd/logs/claude-oauth-refresh.log", |
| 112 | "notifications": { |
| 113 | "on_success": true, |
| 114 | "on_failure": true |
| 115 | }, |
| 116 | "notification_target": "YOUR_CHAT_ID" |
| 117 | } |
| 118 | ``` |
| 119 | |
| 120 | **Options:** |
| 121 | - `refresh_buffer_minutes`: Refresh when token has this many minutes left (default: 30) |
| 122 | - `log_file`: Where to log refresh activity |
| 123 | - `notifications.on_success`: Notify on successful refresh (default: true) |
| 124 | - `notifications.on_failure`: Notify on failure (default: true) |
| 125 | - `notification_target`: Your Telegram chat ID (or leave empty to disable) |
| 126 | |
| 127 | --- |
| 128 | |
| 129 | ## Usage |
| 130 | |
| 131 | ### Manual Refresh |
| 132 | |
| 133 | ```bash |
| 134 | # Refresh now (even if not expired) |
| 135 | ./refresh-token.sh --force |
| 136 | |
| 137 | # Refresh only if needed |
| 138 | ./refresh-token.sh |
| 139 | ``` |
| 140 | |
| 141 | ### Check Status |
| 142 | |
| 143 | ```bash |
| 144 | # View recent logs |
| 145 | tail ~/clawd/logs/claude-oauth-refresh.log |
| 146 | |
| 147 | # Check auth profile |
| 148 | cat ~/.clawdbot/agents/main/agent/auth-profiles.json | jq '.profiles."anthropic:claude-cli"' |
| 149 | |
| 150 | # Check Clawdbot status |
| 151 | clawdbot models status |
| 152 | ``` |
| 153 | |
| 154 | ### Disable Notifications |
| 155 | |
| 156 | Ask Clawdbot: |
| 157 | ``` |
| 158 | Disable Claude refresh success notifications |
| 159 | ``` |
| 160 | |
| 161 | Or edit config: |
| 162 | ```json |
| 163 | { |
| 164 | "notifications": { |
| 165 | "on_success": false, |
| 166 | "on_failure": true |
| 167 | } |
| 168 | } |
| 169 | ``` |
| 170 | |
| 171 | --- |
| 172 | |
| 173 | ## How It Works |
| 174 | |
| 175 | ### Refresh Process |
| 176 | |
| 177 | 1. **Read from Keychain:** Gets OAuth tokens from `Claude Code-credentials` |
| 178 | 2. **Check Expiry:** Only refreshes if < 30 minutes left (or `--force`) |
| 179 | 3. **Call OAuth API:** Gets new access + refresh tokens |
| 180 | 4. **Update auth-profiles.json:** Writes proper OAuth format |
| 181 | 5. **Update Keychain:** Syncs new tokens back |
| 182 | 6. **Restart Gateway:** Picks up new tokens |
| 183 | 7. **Notify:** Sends success/failure message (optional) |
| 184 | |
| 185 | ### Auto-Refresh (launchd) |
| 186 | |
| 187 | Runs every 2 hours via `~/Library/LaunchAgents/com.clawdbot.claude-oauth-refresher.plist` |
| 188 | |
| 189 | **Controls:** |
| 190 | ```bash |
| 191 | # Stop auto-refresh |
| 192 | launchctl unload ~/Library/LaunchAgents/com.clawdbot.claude-oauth-refresher.plist |
| 193 | |
| 194 | # Start auto-refresh |
| 195 | launchctl load ~/Library/LaunchAgents/com.clawdbot.claude-oauth-refresher.plist |
| 196 | |
| 197 | # Check if running |
| 198 | launchctl list | grep claude |
| 199 | ``` |
| 200 | |
| 201 | --- |
| 202 | |
| 203 | ## Troubleshooting |
| 204 | |
| 205 | ### OAuth not working after onboard |
| 206 | |
| 207 | **Symptom:** `clawdbot onboard --auth-choice claude-cli` completes but Clawdbot can't use tokens |
| 208 | |
| 209 | **Fix:** |
| 210 | ```bash |
| 211 | cd ~/clawd/skills/claude-connect |
| 212 | ./refresh-token.sh --force |
| 213 | ``` |
| 214 | |
| 215 | This will write tokens in proper OAuth format. |
| 216 | |
| 217 | ### Tokens keep expiring |
| 218 | |
| 219 | **Symptom:** Auth keeps failing after 8 hours |
| 220 | |
| 221 | **Fix:** Ensure launchd job is running: |
| 222 | ```bash |
| 223 | launchctl load ~/Library/LaunchAgents/com.clawdbot.claude-oauth-refresher.plist |
| 224 | launchctl list | grep claude |
| 225 | ``` |
| 226 | |
| 227 | ### No |