名称: claude-connect
描述: "一键将 Claude 订阅连接到 Clawdbot,并保持 24/7 持续在线。安装后运行即可链接您的订阅,之后令牌将自动永久刷新。"
一步将您的 Claude 订阅连接到 Clawdbot。
自动完成以下操作:
- ✅ 从钥匙串读取 Claude OAuth 令牌
- ✅ 以正确的 OAuth 格式写入 Clawdbot
- ✅ 每 2 小时自动刷新(在令牌过期前)
- ✅ 成功/失败时通知您
- ✅ 与 clawdbot onboard 兼容(修复 OAuth auth-profiles 错误)
1. 安装技能:
clawdhub install claude-connect
cd ~/clawd/skills/claude-connect
2. 确保 Claude CLI 已登录:
claude auth
# 按照浏览器登录流程操作
3. 运行安装脚本:
./install.sh
完成!令牌将每 2 小时自动刷新。
clawdbot onboard 的 OAuth 错误运行 clawdbot onboard --auth-choice claude-cli 时,有时无法正确将 OAuth 令牌写入 auth-profiles.json。
本技能:
1. 从 macOS 钥匙串(Claude CLI 存储令牌的位置)读取 OAuth 令牌
2. 以正确的 OAuth 格式写入 ~/.clawdbot/agents/main/agent/auth-profiles.json:
json
{
"profiles": {
"anthropic:claude-cli": {
"type": "oauth",
"provider": "anthropic",
"access": "sk-ant-...",
"refresh": "sk-ant-ort...",
"expires": 1234567890
}
}
}
3. 设置自动刷新(通过 launchd 每 2 小时运行)
4. 保持您的连接 24/7 在线
cd ~/clawd/skills/claude-connect
./install.sh
安装程序将:
- ✅ 验证 Claude CLI 是否已设置
- ✅ 创建配置文件
- ✅ 设置自动刷新任务(launchd)
- ✅ 运行首次刷新以测试
复制示例配置文件:
bash
cp claude-oauth-refresh-config.example.json claude-oauth-refresh-config.json
编辑配置(可选):
bash
nano claude-oauth-refresh-config.json
测试刷新:
bash
./refresh-token.sh --force
安装 launchd 任务(可选 - 用于自动刷新):
bash
cp com.clawdbot.claude-oauth-refresher.plist ~/Library/LaunchAgents/
launchctl load ~/Library/LaunchAgents/com.clawdbot.claude-oauth-refresher.plist
编辑 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"
}
选项说明:
- refresh_buffer_minutes:在令牌剩余指定分钟数时刷新(默认:30)
- log_file:刷新活动日志的存储位置
- notifications.on_success:成功刷新时通知(默认:true)
- notifications.on_failure:失败时通知(默认:true)
- notification_target:您的 Telegram 聊天 ID(留空则禁用通知)
# 立即刷新(即使未过期)
./refresh-token.sh --force
# 仅在需要时刷新
./refresh-token.sh
# 查看最近日志
tail ~/clawd/logs/claude-oauth-refresh.log
# 检查认证配置文件
cat ~/.clawdbot/agents/main/agent/auth-profiles.json | jq '.profiles."anthropic:claude-cli"'
# 检查 Clawdbot 状态
clawdbot models status
向 Clawdbot 发送指令:
禁用 Claude 刷新成功通知
或编辑配置:
{
"notifications": {
"on_success": false,
"on_failure": true
}
}
Claude Code-credentials 获取 OAuth 令牌--force 参数)通过 ~/Library/LaunchAgents/com.clawdbot.claude-oauth-refresher.plist 每 2 小时运行一次
控制命令:
# 停止自动刷新
launchctl unload ~/Library/LaunchAgents/com.clawdbot.claude-oauth-refresher.plist
# 启动自动刷新
launchctl load ~/Library/LaunchAgents/com.clawdbot.claude-oauth-refresher.plist
# 检查是否运行
launchctl list | grep claude
症状:clawdbot onboard --auth-choice claude-cli 完成但 Clawdbot 无法使用令牌
修复方法:
cd ~/clawd/skills/claude-connect
./refresh-token.sh --force
这将以正确的 OAuth 格式写入令牌。
症状:8 小时后认证持续失败
修复方法:确保 launchd 任务正在运行:
launchctl load ~/Library/LaunchAgents/com.clawdbot.claude-oauth-refresher.plist
launchctl list | grep claude
症状:No 'Claude Code-credentials' entries found
修复方法:使用 Claude CLI 登录:
claude auth
# 按照浏览器流程操作
然后再次运行刷新:
./refresh-token.sh --force
cd ~/clawd/skills/claude-connect
./uninstall.sh
或手动卸载:
# 停止自动刷新
launchctl unload ~/Library/LaunchAgents/com.clawdbot.claude-oauth-refresher.plist
rm ~/Library/LaunchAgents/com.clawdbot.claude-oauth-refresher.plist
# 删除技能
rm -rf ~/clawd/skills/claude-connect
如果您之前安装了旧版本:
cd ~/clawd/skills/claude-connect
./validate-update.sh # 检查变更内容
clawdhub update claude-connect # 更新到最新版本
./install.sh # 如有需要,重新运行安装程序
版本: 1.1.0
作者: TunaIssaCoding
许可证: MIT
仓库: https://github.com/TunaIssaCoding/claude-connect