Claude 订阅自动续签专家
简介
Clawdbot 的 Claude 订阅 OAuth Token 自动刷新工具,解决授权配置难题,7×24 小时保持连接
原始描述
Connect Claude to Clawdbot instantly and keep it connected 24/7. Run after setup to link your subscription, then auto-refreshes tokens forever.
通过你的 Agent 添加
安装目录:claude-connect/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
中文使用说明 来自收录源
核心用法
claude-connect 是一款专为 macOS 设计的自动化 OAuth 令牌管理工具,解决 Claude CLI 与 Clawdbot 之间的身份认证衔接问题。
主要功能:
- 一键安装:运行
./install.sh自动完成环境检测、配置生成、launchd 定时任务部署 - 密钥链读取:从 macOS Keychain 提取 Claude CLI 存储的 OAuth 令牌
- 格式修复:将令牌写入 Clawdbot 要求的 OAuth 标准格式(解决
clawdbot onboard的已知 bug) - 自动续期:每 2 小时自动刷新令牌,避免 8 小时过期中断
- 状态通知:可选 Telegram 通知刷新成功/失败状态
典型工作流:
clawdhub install claude-connect
claude auth # 确保已登录
./install.sh # 完成全部配置
显著优点
维度
优势
零维护
安装后无需人工干预,launchd 后台自动运行
精准修复
专门解决 clawdbot onboard --auth-choice claude-cli 的 OAuth 格式写入问题
安全设计
仅读取本地 Keychain,不涉及第三方服务器通信
可观测性
完整日志记录 + 可选实时通知
轻量
纯 Shell 脚本实现,无额外依赖
潜在缺点与局限性
- 平台锁定:完全依赖 macOS Keychain 和 launchd,不支持 Linux/Windows
- 单用户场景:配置硬编码
~/ 路径,多用户系统需手动调整
- T3 来源风险:个人开发者维护,长期更新保障存疑
- 功能单一:仅处理 Claude ↔ Clawdbot 的 OAuth 桥接,无其他认证源支持
- 通知依赖外部:Telegram 通知需用户自行配置 chat ID,无内置兜底机制
适合人群
- 已订阅 Claude Pro/Team 且使用 Clawdbot 的 macOS 开发者
- 厌倦手动处理 OAuth 令牌过期的自动化爱好者
- 遇到
clawdbot onboard OAuth 配置失败的技术用户
常规风险
- 密钥泄露风险:脚本需要访问 Keychain,虽为本地操作但需用户授予权限
- launchd 任务残留:卸载不彻底可能导致后台任务持续运行
- 上游变更:Anthropic 或 Clawdbot 的 OAuth 流程调整可能导致脚本失效
- 日志增长:长期运行需关注
~/clawd/logs/ 目录大小,建议配合日志轮转
| 维度 | 优势 |
|---|---|
| 零维护 | 安装后无需人工干预,launchd 后台自动运行 |
| 精准修复 | 专门解决 clawdbot onboard --auth-choice claude-cli 的 OAuth 格式写入问题 |
| 安全设计 | 仅读取本地 Keychain,不涉及第三方服务器通信 |
| 可观测性 | 完整日志记录 + 可选实时通知 |
| 轻量 | 纯 Shell 脚本实现,无额外依赖 |
- 平台锁定:完全依赖 macOS Keychain 和 launchd,不支持 Linux/Windows
- 单用户场景:配置硬编码
~/路径,多用户系统需手动调整 - T3 来源风险:个人开发者维护,长期更新保障存疑
- 功能单一:仅处理 Claude ↔ Clawdbot 的 OAuth 桥接,无其他认证源支持
- 通知依赖外部:Telegram 通知需用户自行配置 chat ID,无内置兜底机制
适合人群
- 已订阅 Claude Pro/Team 且使用 Clawdbot 的 macOS 开发者
- 厌倦手动处理 OAuth 令牌过期的自动化爱好者
- 遇到
clawdbot onboard OAuth 配置失败的技术用户
常规风险
- 密钥泄露风险:脚本需要访问 Keychain,虽为本地操作但需用户授予权限
- launchd 任务残留:卸载不彻底可能导致后台任务持续运行
- 上游变更:Anthropic 或 Clawdbot 的 OAuth 流程调整可能导致脚本失效
- 日志增长:长期运行需关注
~/clawd/logs/ 目录大小,建议配合日志轮转
clawdbot onboard OAuth 配置失败的技术用户- 密钥泄露风险:脚本需要访问 Keychain,虽为本地操作但需用户授予权限
- launchd 任务残留:卸载不彻底可能导致后台任务持续运行
- 上游变更:Anthropic 或 Clawdbot 的 OAuth 流程调整可能导致脚本失效
- 日志增长:长期运行需关注
~/clawd/logs/目录大小,建议配合日志轮转
技能正文
name: claude-connect
description: "Connect Claude to Clawdbot instantly and keep it connected 24/7. Run after setup to link your subscription, then auto-refreshes tokens forever."
claude-connect
Connect your Claude subscription to Clawdbot in one step.
Automatically:
- ✅ Reads Claude OAuth tokens from Keychain
- ✅ Writes them to Clawdbot in proper OAuth format
- ✅ Auto-refreshes every 2 hours (before expiry)
- ✅ Notifies you on success/failure
- ✅ Works with
clawdbot onboard(fixes OAuth auth-profiles bug)
Quick Start
1. Install the skill:
clawdhub install claude-connect
cd ~/clawd/skills/claude-connect
2. Ensure Claude CLI is logged in:
claude auth
# Follow the browser login flow
3. Run installer:
./install.sh
That's it! Tokens will refresh automatically every 2 hours.
What It Does
Fixes clawdbot onboard OAuth Bug
clawdbot onboard OAuth BugWhen you run clawdbot onboard --auth-choice claude-cli, it sometimes doesn't properly write OAuth tokens to auth-profiles.json.
This skill:
- Reads OAuth tokens from macOS Keychain (where Claude CLI stores them)
- Writes them to
~/.clawdbot/agents/main/agent/auth-profiles.jsonin proper OAuth format:{ "profiles": { "anthropic:claude-cli": { "type": "oauth", "provider": "anthropic", "access": "sk-ant-...", "refresh": "sk-ant-ort...", "expires": 1234567890 } } } - Sets up auto-refresh (runs every 2 hours via launchd)
- Keeps your connection alive 24/7
Installation
Automatic (Recommended)
cd ~/clawd/skills/claude-connect
./install.sh
The installer will:
- ✅ Verify Claude CLI is set up
- ✅ Create config file
- ✅ Set up auto-refresh job (launchd)
- ✅ Run first refresh to test
Manual
-
Copy example config:
cp claude-oauth-refresh-config.example.json claude-oauth-refresh-config.json
-
Edit config (optional):
nano claude-oauth-refresh-config.json
-
Test refresh:
./refresh-token.sh --force
-
Install launchd job (optional - for auto-refresh):
cp com.clawdbot.claude-oauth-refresher.plist ~/Library/LaunchAgents/
launchctl load ~/Library/LaunchAgents/com.clawdbot.claude-oauth-refresher.plist
Configuration
Copy example config:
cp claude-oauth-refresh-config.example.json claude-oauth-refresh-config.json
Edit config (optional):
nano claude-oauth-refresh-config.json
Test refresh:
./refresh-token.sh --force
Install launchd job (optional - for auto-refresh):
cp com.clawdbot.claude-oauth-refresher.plist ~/Library/LaunchAgents/
launchctl load ~/Library/LaunchAgents/com.clawdbot.claude-oauth-refresher.plist
Edit claude-oauth-refresh-config.json:
{
"refresh_buffer_minutes": 30,
"log_file": "~/clawd/logs/claude-oauth-refresh.log",
"notifications": {
"on_success": true,
"on_failure": true
},
"notification_target": "YOUR_CHAT_ID"
}
Options:
refresh_buffer_minutes: Refresh when token has this many minutes left (default: 30)log_file: Where to log refresh activitynotifications.on_success: Notify on successful refresh (default: true)notifications.on_failure: Notify on failure (default: true)notification_target: Your Telegram chat ID (or leave empty to disable)
Usage
Manual Refresh
# Refresh now (even if not expired)
./refresh-token.sh --force
# Refresh only if needed
./refresh-token.sh
Check Status
# View recent logs
tail ~/clawd/logs/claude-oauth-refresh.log
# Check auth profile
cat ~/.clawdbot/agents/main/agent/auth-profiles.json | jq '.profiles."anthropic:claude-cli"'
# Check Clawdbot status
clawdbot models status
Disable Notifications
# View recent logs
tail ~/clawd/logs/claude-oauth-refresh.log
# Check auth profile
cat ~/.clawdbot/agents/main/agent/auth-profiles.json | jq '.profiles."anthropic:claude-cli"'
# Check Clawdbot status
clawdbot models status
Ask Clawdbot:
Disable Claude refresh success notifications
Or edit config:
{
"notifications": {
"on_success": false,
"on_failure": true
}
}
How It Works
Refresh Process
- Read from Keychain: Gets OAuth tokens from
Claude Code-credentials - Check Expiry: Only refreshes if < 30 minutes left (or
--force) - Call OAuth API: Gets new access + refresh tokens
- Update auth-profiles.json: Writes proper OAuth format
- Update Keychain: Syncs new tokens back
- Restart Gateway: Picks up new tokens
- Notify: Sends success/failure message (optional)
Auto-Refresh (launchd)
Runs every 2 hours via ~/Library/LaunchAgents/com.clawdbot.claude-oauth-refresher.plist
Controls:
# Stop auto-refresh
launchctl unload ~/Library/LaunchAgents/com.clawdbot.claude-oauth-refresher.plist
# Start auto-refresh
launchctl load ~/Library/LaunchAgents/com.clawdbot.claude-oauth-refresher.plist
# Check if running
launchctl list | grep claude
Troubleshooting
OAuth not working after onboard
Symptom: clawdbot onboard --auth-choice claude-cli completes but Clawdbot can't use tokens
Fix:
cd ~/clawd/skills/claude-connect
./refresh-token.sh --force
This will write tokens in proper OAuth format.
Tokens keep expiring
Symptom: Auth keeps failing after 8 hours
Fix: Ensure launchd job is running:
launchctl load ~/Library/LaunchAgents/com.clawdbot.claude-oauth-refresher.plist
launchctl list | grep claude
No tokens in Keychain
Symptom: No 'Claude Code-credentials' entries found
Fix: Log in with Claude CLI:
claude auth
# Follow browser flow
Then run refresh again:
./refresh-token.sh --force
Uninstall
cd ~/clawd/skills/claude-connect
./uninstall.sh
cd ~/clawd/skills/claude-connect
./uninstall.sh
Or manually:
# Stop auto-refresh
launchctl unload ~/Library/LaunchAgents/com.clawdbot.claude-oauth-refresher.plist
rm ~/Library/LaunchAgents/com.clawdbot.claude-oauth-refresher.plist
# Remove skill
rm -rf ~/clawd/skills/claude-connect
Upgrade
If you previously installed an older version:
cd ~/clawd/skills/claude-connect
./validate-update.sh # Check what changed
clawdhub update claude-connect # Update to latest
./install.sh # Re-run installer if needed
See Also
- QUICKSTART.md - 60-second setup guide
- UPGRADE.md - Upgrading from older versions
- Clawdbot docs - Model authentication
Version: 1.1.0
Author: TunaIssaCoding
License: MIT
Repo: https://github.com/TunaIssaCoding/claude-connect