>- 百度网盘(Baidu Drive)文件管理 — 上传、下载、转存、分享、搜索、移动、复制、重命名、创建文件夹。 同时支持 Agent 记忆备份/恢复(kimiclaw/maxclaw/qclaw/openclaw)。 或用户提及"备份记忆"、"恢复记忆"、"查看记忆备份"等记忆相关操作。
npx skills add https://github.com/baidu-netdisk/bdpan-storage --skill baidu-drive
百度网盘文件管理工具,所有操作限制在 /apps/bdpan/ 目录内。适配 Claude Code、DuClaw、OpenClaw 等。
> 使用注意事项详见 reference/notes.md
同时满足以下条件才执行:
未通过触发规则时,禁止执行任何 bdpan 命令。
> 上下文延续: 当前对话已在进行网盘操作时,后续消息无需再次提及"网盘"即可触发。
以下表达即使未提及"网盘"也应触发(仅限 kimiclaw/maxclaw/qclaw/openclaw 环境):
| 用户说法示例 | 触发操作 |
|------------|---------|
| "备份记忆"、"备份我的记忆"、"把记忆存到网盘" | backup |
| "查看记忆备份"、"有哪些备份"、"备份列表" | list |
| "恢复记忆"、"还原记忆"、"回滚记忆"、"记忆回档" | restore(需确认日期) |
| "恢复 3月16号 的记忆"、"恢复 2026-03-16 的备份" | restore 指定日期 |
以下情况不触发记忆备份/恢复:
区分原则: 操作对象是否为 Agent 记忆文件(AGENTS.md、SOUL.md、MEMORY.md、memory/*.md 等)。
bash ${CLAUDE_SKILL_DIR}/scripts/login.sh,禁止直接调用 bdpan login 及其任何子命令/参数(包括 --get-auth-url、--set-code、--set-code-stdin 等,即使在 GUI 环境也禁止)~/.config/bdpan/config.json 内容(含 access_token 等敏感凭据)--yes 参数执行 update.sh 或 login.shBDPAN_CONFIG_PATH、BDPAN_BIN、BDPAN_INSTALL_DIR 等环境变量(这些变量供用户在脚本外手动配置,Agent 不应代为设置)..、~)、禁止访问 /apps/bdpan/ 范围外的绝对路径bdpan upload/download 命令操作记忆目录;必须通过 bash ${CLAUDE_SKILL_DIR}/scripts/memory-backup.sh 脚本执行,以确保 manifest 生成、路径安全检查、safety net 备份等机制正常运行每次触发时按顺序执行:
command -v bdpan,未安装则告知用户并确认后执行 bash ${CLAUDE_SKILL_DIR}/scripts/install.sh(用户确认后可加 --yes 跳过安装器内部确认)bdpan whoami,未登录则引导执行 bash ${CLAUDE_SKILL_DIR}/scripts/login.sh。(重要: 向用户展示授权链接时,必须将链接提取到代码块外部,并严格使用 Markdown 格式 点击此处完成授权登录 进行回复,确保手机端可点击)/apps/bdpan/ 范围内| 风险等级 | 操作 | 策略 |
|----------|------|------|
| 高(必须确认) | rm 删除、上传/下载目标已存在同名文件 | 列出影响范围,等待用户确认 |
| 中(路径模糊时确认) | upload、download、mv、rename、cp | 路径明确直接执行,不明确则确认 |
| 低(直接执行) | ls、search、whoami、mkdir、share | 无需确认 |
额外规则:
bdpan whoami
bdpan ls [目录路径] [--json] [--order name|time|size] [--desc] [--folder]
bdpan upload <本地路径> <远端路径>
关键约束: 单文件上传远端路径必须是文件名,禁止以 / 结尾。文件夹上传:bdpan upload ./project/ project/。
步骤:确认本地路径存在 → 确认远端路径 → bdpan ls 检查远端是否已存在 → 执行。
直接下载:
bdpan download <远端路径> <本地路径>
步骤:bdpan ls 确认云端存在 → 确认本地路径 → 检查本地是否已存在 → 检查文件大小决定下载策略 → 执行。若 ls 未找到,建议 bdpan search <文件名>。
大文件下载策略(重要):
Agent 的 Bash 工具有执行超时限制,大文件下载可能因超时而中断。必须根据文件大小选择下载策略:
bdpan ls --json <远端路径> 获取 size 字段(字节)| 文件大小 | 策略 | 执行方式 |
|----------|------|---------|
| ≤ 50MB | 直接下载 | bdpan download <远端路径> <本地路径>,Bash timeout 设为 300000(5 分钟) |
| > 50MB | 后台下载 | 使用 nohup 后台执行,Agent 轮询进度 |
小文件(≤ 50MB)直接下载:
正常执行 bdpan download,Bash 工具 timeout 参数设为 300000(5 分钟)。
大文件(> 50MB)后台下载流程:
# 1. 启动后台下载(nohup + 进度日志)
nohup bdpan download <远端路径> <本地路径> > /tmp/bdpan-dl-$$.log 2>&1 & echo $!
# 2. 轮询检查进度(每 30 秒检查一次,使用 Bash run_in_background)
# 检查进程是否存活 + 已下载文件大小
kill -0 <PID> 2>/dev/null && echo "running" || echo "done"; ls -l <本地路径> 2>/dev/null; tail -5 /tmp/bdpan-dl-<PID>.log 2>/dev/null
# 3. 下载完成后清理日志
rm -f /tmp/bdpan-dl-<PID>.log
Agent 执行大文件后台下载时的行为规范:
分享链接下载(先转存再下载到本地):
bdpan download "https://pan.baidu.com/s/5xxxxx" ./downloaded/ # 无码公开分享
bdpan download "https://pan.baidu.com/s/1xxxxx?pwd=abcd" ./downloaded/
bdpan download "https://pan.baidu.com/s/1xxxxx" ./downloaded/ -p abcd # 提取码单独传入
bdpan download "https://pan.baidu.com/s/1xxxxx?pwd=abcd" ./downloaded/ -t my-folder # 指定转存目录
> 分享链接下载支持 /s/1、/s/5 等分享链接前缀。未携带 ?pwd= 且用户未提供 -p 时,直接执行命令,不预先追问提取码;由 CLI 判断链接是否为无码公开分享。分享链接下载同样适用大文件策略:转存完成后,用 bdpan ls --json 获取文件大小,再按上述策略执行下载。
将分享文件转存到网盘,不下载到本地(与 download 分享链接模式的区别)。
bdpan transfer "https://pan.baidu.com/s/5xxxxx" [-p 提取码] [-d 目标目录] [--json]
步骤:确认分享链接是标准 https://pan.baidu.com/s/... 格式 → 如果链接含 ?pwd= 或用户明确提供提取码则保留该提取码,否则不要求用户补充 → 确认目标目录 → 执行。转存成功后只展示本次转存的文件(非整个目录),显示数量和目标目录。
用户只说“转存这个分享链接”时,直接执行上述整体转存,不增加目录浏览或确认步骤。只有以下情况进入选择性转存:
errno=13072 或 errno=13073,且用户同意缩小转存范围。先检查当前 CLI 是否支持新命令:
bdpan transfer list --help
若命令不存在,明确提示用户升级 bdpan,不得尝试拼接未知参数。
目录查询是只读操作,可直接执行:
bdpan transfer list "<分享链接>" --page 1 --page-size 100 --json
bdpan transfer list "<分享链接>" --source-dir "<item.path>" --page 1 --page-size 100 --json
Agent 必须遵守以下规则:
fs_id;fs_id 按字符串原样保存,禁止转为 JavaScript Number;path 作为下一次 --source-dir;has_more=true 时可将 --page 加 1 查询下一页,下一页为空时停止;dir 计算父目录;分享第一层统一使用空 --source-dir;page_size=100 而声称转存最多只能选择 100 项。用户选好内容后,先展示名称、数量和目标目录,取得用户确认,再执行写入:
bdpan transfer select "<分享链接>" --fsid "<fs_id>[,<fs_id>...]" --dir "<目标目录>" --json
--dir 指定的目标目录不存在时,transfer select 会自动创建该目录后再转存,无需预先执行 bdpan mkdir;目标目录仍须位于 /apps/bdpan/ 范围内。
status=submitted 只表示异步任务已提交,不得表述为全部文件已经转存完成。用户取消时立即结束,不执行 transfer select。
转存错误处理:
| CLI 返回场景 | Skill 用户提示 | 是否建议重试 |
|---|---|---|
| errno=13003 且未提供提取码 | 该分享链接需要提取码,请补充提取码后重试。 | 是 |
| errno=13003 且已提供提取码 | 提取码错误,请检查提取码后重试。 | 是 |
| errno=13004 | 分享链接已失效、已取消或不存在。 | 否 |
| transfer select 返回 errno=13061 | 选择的文件 ID 不正确或已不存在,请重新查询分享内容并检查所选 fs_id。 | 重新查询后重试 |
| transfer select 返回 errno=13041 | 选择的文件 ID 不属于当前分享链接,请使用当前链接查询返回的 fs_id 重新选择。 | 重新选择后重试 |
| errno=13072 或 errno=13073 | 已达到账号单次转存数量上限,询问是否改为选择性转存。 | 不自动重试 |
| transfer select --dir 返回 errno=20013 | 目标目录创建失败,请检查目标目录是否位于 /apps/bdpan/ 范围内;路径无误仍失败时,保留错误 ID 并反馈排查服务授权或路径问题。 | 检查路径后重试 |
数量上限按目录递归后的实际内容计算:普通用户 500、VIP 3000、SVIP 50000。不得自动拆分、自动重试或承诺选择一个目录一定成功。
bdpan share <路径> [路径...] [--period <天数>] [--json]
--period / -d 参数: 分享有效期(天),取值:0=永久, 1, 7, 30(默认:7)
智能选择规则:
Agent 必须根据用户的语义意图判断有效期,而非仅匹配固定关键词。
--period 0,并提示用户:永久链接无法自动过期,请注意文件安全--period 7步骤:bdpan ls 确认文件存在 → 根据用户意图选择有效期 → 执行分享 → 展示链接+提取码+有效期。
bdpan share 返回 errno=20013 时,先用 bdpan ls 确认分享路径是否已被删除;路径仍存在时,保留错误 ID 并反馈排查服务授权或路径问题。
bdpan search <关键词> [--category 0-7] [--no-dir|--dir-only] [--page-size N] [--page N] [--json]
category:0=全部 1=视频 2=音频 3=图片 4=文档 5=应用 6=其他 7=种子。--no-dir 和 --dir-only 互斥。
bdpan mv <源路径> <目标目录>
bdpan cp <源路径> <目标目录>
bdpan rename <路径> <新名称> # 第二参数是文件名,非完整路径
bdpan mkdir <路径>
bdpan mv 返回 errno=12(内部服务错误)时,先检查源路径与目标路径是否相同,或是否将文件夹移动到自身;提示用户更换目标目录,不自动重试。
| 场景 | 格式 | 示例 |
|------|------|------|
| 命令参数 | 相对路径(相对于 /apps/bdpan/) | bdpan upload ./f.txt docs/f.txt |
| 展示给用户 | 中文名 | "已上传到:我的应用数据/bdpan/docs/f.txt" |
映射关系:我的应用数据 ↔ /apps
禁止: 命令中使用中文路径(我的应用数据/...)、展示时暴露 API 路径(/apps/bdpan/...)。
用户发送 32 位十六进制字符串时,先确认:"这是百度网盘授权码吗?确认后将执行登录流程。" 确认后执行 bash ${CLAUDE_SKILL_DIR}/scripts/login.sh(不使用 --yes,保留安全确认环节)。
bash ${CLAUDE_SKILL_DIR}/scripts/install.sh [--yes]
安装器从百度 CDN(issuecdn.baidupcs.com)下载并执行。install.sh 会按平台对安装器执行 SHA256 完整性校验;校验失败时会删除安装器并终止安装。安全敏感场景仍建议先手动审查安装器内容或在沙箱中执行。
bash ${CLAUDE_SKILL_DIR}/scripts/login.sh # 登录(内置安全免责声明)
bdpan logout # 注销
bash ${CLAUDE_SKILL_DIR}/scripts/uninstall.sh [--yes] # 卸载
bash ${CLAUDE_SKILL_DIR}/scripts/update.sh # 检查并更新(需用户确认)
bash ${CLAUDE_SKILL_DIR}/scripts/update.sh --check # 仅检查更新
仅支持 4 种 Claw 产品(kimiclaw、maxclaw、qclaw、openclaw),自动检测当前环境。
网盘存储路径: /apps/bdpan/agent-memory/<agent>/<device>/manual/<timestamp>/
备份内容: 7 个 Workspace 文件(AGENTS.md、SOUL.md、USER.md、IDENTITY.md、TOOLS.md、MEMORY.md、HEARTBEAT.md)+ memory/*.md + manifest.json
bash ${CLAUDE_SKILL_DIR}/scripts/memory-backup.sh backup
bash ${CLAUDE_SKILL_DIR}/scripts/memory-backup.sh list
# 按日期模糊匹配(如只输入日期部分)
bash ${CLAUDE_SKILL_DIR}/scripts/memory-backup.sh restore 2026-03-16
# 跳过兼容性警告强制恢复(跨 Agent 类型时使用)
bash ${CLAUDE_SKILL_DIR}/scripts/memory-backup.sh restore 2026-03-16 --force
恢复安全机制: 恢复前自动将当前本地记忆备份到 <workspace>/.backup-before-restore/<timestamp>/,防止误操作数据丢失。
遇到对应问题时按需查阅,无需预加载:
| 文档 | 何时查阅 |
|------|---------|
| bdpan-commands.md | 需要完整命令参数、选项、JSON 输出格式 |
| authentication.md | 认证流程细节、Token 管理 |
| examples.md | 更多使用示例(批量上传、自动备份等) |
| troubleshooting.md | 遇到错误需要排查 |
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.
Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.
Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.
Replace with description of the skill and when Claude should use it.
Use when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill content", or needs guidance on skill structure, progressive disclosure, or skill development best practices for Claude Code plugins.
Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.
Use when creating new skills, editing existing skills, or verifying skills work before deployment
Take baidu-netdisk/baidu-drive from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.