Session Snapshot
定期保存会话状态,支持断点续作和历史回溯。
用于管理多个网站登录会话的加密本地工具,支持跨浏览器切换与共享。
openclaw skills install @leeguooooo/cookie-use命令、参数、文件名以原文为准
一个无站点依赖、对代理友好的多账号会话管理器。它能安全存储任意网站(例如 100 个 ChatGPT 账号)的登录会话,并支持列出、捕获、切换和应用这些会话到浏览器中。
该工具基于 [chrome-use](https://github.com/leeguooooo/chrome-use) 构建:所有浏览器与 Cookie 操作(如解密用户资料文件中的 Cookie、注入到运行中的浏览器、启动隔离上下文)均由 chrome-use 处理。cookie-use 负责账号模型、加密库(vault)以及整体流程编排。
如果系统提示 cookie-use 命令未找到(command not found),请直接安装,不要尝试使用其他工具替代:
curl -fsSL https://raw.githubusercontent.com/leeguooooo/cookie-use/main/install.sh | shcookie-use **依赖 chrome-use 在 PATH 中可用**。若也缺失,请执行:
curl -fsSL https://raw.githubusercontent.com/leeguooooo/chrome-use/main/install.sh | sh仅限 macOS 系统(使用 Keychain 存储加密密钥,且依赖 chrome-use 的 macOS Cookie 解密功能)。
一个 账号 是针对某个网站的一个已保存会话:包含完整的跨域 Cookie 集合及元数据(ID、站点、标签、提示、时间戳、状态)。加密库(vault)可存储多个站点的多个账号,所有数据在磁盘上均加密存储(AES-256-GCM,密钥存于 macOS Keychain,路径为 ~/.cookie-use/vault.enc)。Cookie 值从不以明文形式写入磁盘,list 和 show 命令也不会输出任何敏感信息。
--site 参数支持逗号分隔的域名列表,因此可将多主机认证(如 chatgpt.com,openai.com)作为一个账号统一捕获。
# 从 Chrome 用户资料中捕获一个已登录会话(适用于任意网站)。
cookie-use add --from-profile "<profile>" --site "<domain[,domain]>" [--id <id>] [--label <l>]
# <profile> = 目录名(如 "Profile 14")、显示名(如 "Davian")或 "auto"。
# --with-localstorage 同时快照主源的 localStorage
# (一次浏览器读取;适用于将 token 或用户信息存储在 localStorage 的 SPA 应用)。
# 从 JSON Cookie 数组或原始 "name=value; ..." Cookie 头导入。
cookie-use import --file <path> --site <domain> --id <id>
# 查看信息。
cookie-use list [--site <domain>] [--json]
cookie-use show <id> # 仅显示元数据,绝不暴露秘密
cookie-use check <id> # 通过 Cookie 过期时间检测账号有效性
# 应用 / 切换。
cookie-use use <id> --target session:<name> # 注入到已连接的 chrome-use 会话中
cookie-use use <id> --target isolated # 启动一个临时浏览器并加载此账号
cookie-use switch <id> --target session:<name> # 清除站点 Cookie 后再应用
# 添加 --no-open 可跳过应用后的页面打开。
# --rewrite-domain <host> 重写注入时的 Cookie 域名(如 "localhost")
# 使生产环境或测试环境的会话可在不同源下使用。
# --open-url <url> 打开指定 URL(如开发服务器的 "http://localhost:8001")
# 可与 --rewrite-domain 配合使用。
# --no-localstorage 忽略注入账号时携带的 localStorage
# (默认情况下,若存在且页面打开则自动注入)。
# --no-confirm 跳过注入前的 Touch ID / TTY 确认步骤。
# 跨域测试便捷功能:将捕获的会话回放至本地开发环境。
cookie-use replay <id> --to localhost:8001 # 等价于 use --rewrite-domain localhost
# --open-url http://localhost:8001
# 同时打开多个账号,每个账号独立窗口(并排展示)。
cookie-use run <id> # 单个账号,隔离运行
cookie-use run --site chatgpt.com --all # 所有 ChatGPT 账号,同时并排
cookie-use run --all # 整个库中的所有账号
# 代理身份模式:在特定账号会话环境下运行命令。
# 设置 COOKIE_USE_ACCOUNT / _SITE / _TARGET 和 CHROME_USE_SESSION,
# 使代理(或任何 chrome-use 调用)在单次任务中以该账号身份执行。
cookie-use as <id> --target session:work -- chrome-use open https://dash.cloudflare.com
# 与同事共享会话:生成一个密码加密的会话包(病毒式传播:需安装 cookie-use 才能兑换)。
# 永远不会写入明文 Cookie。
cookie-use share <id> [--out <path.cusession>] [--password <pw>]
cookie-use redeem <path.cusession> [--password <pw>] [--id <new-id>]
# 管理操作。
cookie-use rename <id> <new-id>
cookie-use rm <id> # (别名:revoke <id>)
cookie-use wipe [--yes] # 删除整个加密库注入会话属于高风险操作,因此 use / switch / replay / as 命令在执行前会进行确认:macOS 上使用 Touch ID(LocalAuthentication),失败后降级为 TTY 的 y/N 输入。在非交互式环境中(如自动化脚本),必须显式添加 --no-confirm 或设置 COOKIE_USE_YES=1;否则,在非交互式 Shell 中将拒绝执行,而非静默继续。
COOKIE_USE_YES=1 —— 跳过注入确认(用于代理或自动化场景)。COOKIE_USE_VAULT_KEY —— 32 字节密钥的 base64 编码值;直接使用该密钥,不再依赖 macOS Keychain。适用于无登录 Keychain 的无头环境、CI 流水线或代理主机(由调用方自行保管密钥)。若未设置,则密钥仍存于 Keychain。COOKIE_USE_VAULT —— 覆盖加密库文件路径(支持多个独立库、无头主机、测试场景)。默认值为 ~/.cookie-use/vault.enc。CHROME_USE_BIN —— 若 chrome-use 不在 PATH 中,可指定其二进制文件路径。session:<name>(默认值为 session:default)—— 一个已存在的 chrome-use 会话。 首先将其连接到目标位置:用户真实的、已登录的 Chrome 浏览器(通过 chrome-use extension connect 连接),或你启动的浏览器。这是最可靠的路径,无需重启 Chrome 即可生效。
isolated —— cookie-use 通过 chrome-use --launch 启动一个全新的临时浏览器,注入账号并打开网站。适用于在干净环境中运行账号。批量导入所有已登录的配置文件,然后使用其中一个:
cookie-use add --from-profile "花月社" --site "chatgpt.com,openai.com" --id chatgpt/huayue
cookie-use add --from-profile "Davian" --site "claude.ai,anthropic.com" --id claude/davian
cookie-use list
cookie-use use chatgpt/huayue --target isolated # 以该账号身份打开 ChatGPT将账号应用到用户的真实 Chrome 浏览器(控制其实际浏览器):
chrome-use extension connect # 将会话连接到真实 Chrome
cookie-use use claude/davian --target session:default在本地开发服务器上复用生产环境/测试环境的登录状态(跨域测试)。由于 Cookie 的域名绑定限制,localhost 无法访问生产环境的 Cookie —— 可通过重写域名(如需,也同步 localStorage 内容)解决:
# 捕获生产环境会话(包括 localStorage,令牌和用户信息常存储于此)
cookie-use add --from-profile auto --site "example.com" --id app/prod --with-localstorage
# 在本地开发环境重放该会话
cookie-use use app/prod --target session:real \
--rewrite-domain localhost \
--open-url http://localhost:8001注意:此方法仅解决域名绑定和存储问题。若本地开发服务器调用的后端或网关与生产环境不同,令牌可能不被接受——这是环境配置问题,cookie-use 无法解决。
将一个会话分享给同事(并将其导入自己的仓库):
cookie-use share chatgpt/team-seat --out seat.cusession # 提示输入密码
# 同事执行(如未安装 cookie-use,则先安装):
cookie-use redeem seat.cusession --id chatgpt/team-seat让代理以特定账号身份执行单个任务,或同时处理多个账号:
cookie-use run --site chatgpt.com --all # 同时打开所有账号
COOKIE_USE_YES=1 cookie-use as chatgpt/seat-07 --target session:agent -- \
chrome-use open https://chatgpt.com # 代理现在以 seat-07 身份运行proxy / fingerprint 字段,用于未来防关联功能,目前尚未启用。share 生成的包采用 argon2id + AES-256-GCM 加密,使用指定密码加密 —— 唯一离开本地机器的文件,且仅在执行 share 命令时产生。仓库始终为本地存储。check 是通用的过期检测机制(尚未支持按站点探测)—— 无法区分服务器撤销的会话与有效会话,仅能识别已过期的 Cookie 设置。已收录 3 个 Skill