✨

Claude 订阅自动续签专家

Claude Connect · v1.1.0
入口已确认,内容待校验 文件树里有 SKILL.md,但正文还没采回,frontmatter 未核对。
专业技能 安全 A 级 作者 tunaissacoding 公开目录收录
5.5k 下载 12 安装 23.9k 收藏 23 浏览

简介

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、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。

或者手动安装

Claude Code~/.claude/skills/claude-connect/
Codex CLI~/.codex/skills/claude-connect/
DeepSeek Harness~/.agents/skills/claude-connect/

包是「根级 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 脚本实现,无额外依赖

潜在缺点与局限性

  1. 平台锁定:完全依赖 macOS Keychain 和 launchd,不支持 Linux/Windows
  2. 单用户场景:配置硬编码 ~/ 路径,多用户系统需手动调整
  3. T3 来源风险:个人开发者维护,长期更新保障存疑
  4. 功能单一:仅处理 Claude ↔ Clawdbot 的 OAuth 桥接,无其他认证源支持
  5. 通知依赖外部:Telegram 通知需用户自行配置 chat ID,无内置兜底机制

适合人群

  • 已订阅 Claude Pro/Team 且使用 Clawdbot 的 macOS 开发者
  • 厌倦手动处理 OAuth 令牌过期的自动化爱好者
  • 遇到 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

When you run clawdbot onboard --auth-choice claude-cli, it sometimes doesn't properly write OAuth tokens to auth-profiles.json.

This skill:

  1. Reads OAuth tokens from macOS Keychain (where Claude CLI stores them)
  2. Writes them to ~/.clawdbot/agents/main/agent/auth-profiles.json in proper OAuth format:
    {
      "profiles": {
        "anthropic:claude-cli": {
          "type": "oauth",
          "provider": "anthropic",
          "access": "sk-ant-...",
          "refresh": "sk-ant-ort...",
          "expires": 1234567890
        }
      }
    }
    
  3. Sets up auto-refresh (runs every 2 hours via launchd)
  4. 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

  1. Copy example config:

    cp claude-oauth-refresh-config.example.json claude-oauth-refresh-config.json
    
  2. Edit config (optional):

    nano claude-oauth-refresh-config.json
    
  3. Test refresh:

    ./refresh-token.sh --force
    
  4. 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

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 activity
  • notifications.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

Ask Clawdbot:

Disable Claude refresh success notifications

Or edit config:

{
  "notifications": {
    "on_success": false,
    "on_failure": true
  }
}

How It Works

Refresh Process

  1. Read from Keychain: Gets OAuth tokens from Claude Code-credentials
  2. Check Expiry: Only refreshes if < 30 minutes left (or --force)
  3. Call OAuth API: Gets new access + refresh tokens
  4. Update auth-profiles.json: Writes proper OAuth format
  5. Update Keychain: Syncs new tokens back
  6. Restart Gateway: Picks up new tokens
  7. 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

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


Version: 1.1.0
Author: TunaIssaCoding
License: MIT
Repo: https://github.com/TunaIssaCoding/claude-connect

正文来自原始仓库, 版权归作者所有,许可:MIT。 权利人认为有不妥,可申请下架。

原始仓库

作者的项目地址:https://github.com/tunaissacoding/claude-connect

标签

oauthauthenticationautomationmacoskeychainlaunchdclawdbotanthropictoken-refreshcli

同类 Skill