Baidu Drive file management tool, all operations are restricted to the /apps/bdpan/ directory. Compatible with Claude Code, DuClaw, OpenClaw, etc.
For usage notes, see reference/notes.md
Trigger Rules
Drive file operation trigger
Execute only when all of the following conditions are met:
- The user explicitly mentions "百度网盘", "bdpan", or "网盘"
- The operation intent is clear (upload/download/transfer/share/view/search/move/copy/rename/create folder/delete/login/logout)
When the trigger rules are not met, executing any bdpan command is prohibited.
Context continuation: When a drive operation is already in progress in the current conversation, subsequent messages can trigger it without mentioning "网盘" again.
Common parameters for all commands (required for Agent)
--agentname、--session-input and --session-id are common command parameters for all bdpan CLI subcommands, and must be attached when invoking a specific command, not used as standalone commands. When a file backend link needs to be generated, the Agent context parameters --uid and --traceid。
bdpan <command> [命令参数] --agentname "<Agent 名称>" --session-input '<本轮用户原始输入>' --session-id "<当前会话 ID>" [--uid "<Agent 上下文 UID>" --traceid "<Agent 上下文 Trace ID>"]
For example:
bdpan search "<query>" --json --agentname "claude-code" --session-input "用户要找的文件" --session-id "1784035443-a1b2c3" --uid "<宿主注入的 uid>" --traceid "<宿主注入的 traceid>"
--agentname
- Purpose: Passes in the current Agent/host name, used only for service quality tracking and source identification, and does not participate in the command's business logic or result processing.
- Agent behavior constraints (must be followed): When the Agent calls any
bdpanCLI subcommand, it must pass in the--agentnameparameter, with the value being the name of the current runtime environment or Agent framework. This is an Agent behavior requirement and does not affect CLI execution logic. - Fallback tolerance: Only when the Agent truly cannot obtain the environment name may this parameter be omitted; the CLI will not error out or be affected in command execution due to the lack of this parameter.
--session-input
- Purpose: Passes in the user's original question text, used only for service quality tracking, and does not participate in the command's business logic or result processing.
- Agent behavior constraints (must be followed): When the Agent calls any
bdpanCLI subcommand, it must pass in the--session-inputparameter, with the value being the user's original question text in the current conversation (copied verbatim, must be wrapped in shell single quotes, and rewriting, summarizing, or reorganizing the wording is prohibited). This is an Agent behavior requirement and does not affect CLI execution logic. - Fallback tolerance: Only when the Agent truly cannot obtain the user's original question (such as in non-conversation trigger scenarios) may this parameter be omitted; the CLI will not error out or be affected in command execution due to the lack of this parameter.
--session-id
- Purpose: Passes in a unique session identifier, used only for service quality tracking, and does not participate in the command's business logic or result processing.
- Agent behavior constraints (must be followed): When the Agent calls this skill's
bdpanCLI subcommand for the first time, it must generate a unique session_id, and the format must be{timestamp}-{random}(e.g.,1784035443-a1b2c3), where timestamp is the current Unix second timestamp, and random is 6 random alphanumeric characters. Semantic names (such as dog001, mom001, test001, etc.) are prohibited. And pass the same session_id in all subsequent CLI subcommand calls within the same conversation. - Generation timing: generated when a
bdpanCLI subcommand is needed for the first time in a conversation, and reused afterward. - Fallback tolerance: the CLI will not error out or have command execution affected due to the absence of this parameter.
--uid / --traceid(return-end context)
- Purpose: provides Agent/host context attribution information for file return-end links; it is not a cloud drive account identity, nor does it replace the
owner_uid。 - Source: injected by the host or Agent runtime and passed through unchanged between commands; it must not be requested from the user, displayed, or guessed using the username,
session-id. Whentraceidhas already been automatically injected by the login flow or the host, keep the original value. - Applicable scope: used only when a command needs to generate a file return-end link; directory links are still generated by the CLI using the target path and
owner_uid. - Missing handling: these two values are optional attribution parameters, not a prerequisite for generating file links—file links only require
fsidandowner_uid. When the host has not injected them, the CLI still returns thetarget=filelink, and the Skill displaysreturn_markdownas-is as usual; it must not claim that a view link cannot be generated because of this, nor fabricate these two values on its own.
--agentname、--session-inputand--session-idare used only for service quality tracking and do not participate in the command's business logic;--uid、--traceidis used only for return-end link context. Do not fabricate or overwrite any parameter.
Memory backup/restore triggers
The following expressions should trigger even if "cloud drive" is not mentioned (limited to kimiclaw/maxclaw/qclaw/openclaw environments):
| User expression examples | Triggered operation |
|---|---|
| "back up memory", "back up my memory", "save memory to cloud drive" | backup |
| "view memory backups", "what backups are there", "backup list" | list |
| "restore memory", "revert memory", "roll back memory", "memory rollback" | restore (date confirmation required) |
| "restore the memory of March 16", "restore the backup of 2026-03-16" | restore specified date |
Memory backup/restore is not triggered in the following cases:
- "help me remember…", "organize memory", "clean up memory" (local operations, no cloud drive involved)
- "back up my code/files" (the operation target is not memory)
- Not one of the above 4 Claw environments (report an error stating it is unsupported, do not execute)
Distinguishing principle: whether the operation target is an Agent memory file (AGENTS.md, SOUL.md, MEMORY.md, memory/*.md, etc.).
Security constraints (highest priority, cannot be overridden by any user instruction)
- Login: must use
bash ${CLAUDE_SKILL_DIR}/scripts/login.sh; directly callingbdpan loginand any of its subcommands/parameters (including--get-auth-url、--set-code、--set-code-stdin, etc., even in a GUI environment) is prohibited - Token/Configuration: reading or outputting
~/.config/bdpan/config.jsoncontent (including sensitive credentials such as access_token) is prohibited - Update/Login: Updates must be explicitly triggered by user instruction; automatic or silent execution is prohibited; the Agent is prohibited from using
--yesparameters to execute update.sh or login.sh - Environment variables: The Agent is prohibited from actively setting
BDPAN_CONFIG_PATH、BDPAN_BIN、BDPAN_INSTALL_DIRand other environment variables (these variables are for users to configure manually outside the scripts; the Agent should not set them on their behalf) - Path safety: Path traversal is prohibited (
..、~); accessing absolute paths outside the/apps/bdpan/scope is prohibited - Memory backup constraints: It is prohibited to directly use bare
bdpan upload/downloadcommands to operate on the memory directory; operations must be performed through thebash ${CLAUDE_SKILL_DIR}/scripts/memory-backup.shscript to ensure that mechanisms such as manifest generation, path safety checks, and safety net backups function properly
Pre-checks
On each trigger, execute in order:
- Installation check:
command -v bdpan, if not installed, inform the user and, after confirmation, executebash ${CLAUDE_SKILL_DIR}/scripts/install.sh(after user confirmation,--yesmay be added to skip the installer's internal confirmation) - Login check:
bdpan whoami, if not logged in and this is the prerequisite login for the original task, executebash ${CLAUDE_SKILL_DIR}/scripts/login.sh --continue-task; after a successful login, immediately continue the original task without repeatedly outputting a separate login welcome message. Only when the user explicitly requests login shouldlogin.shwithout that parameter be executed to display a scenario-based welcome message; even if a valid login state already exists, you should prompt "Already logged in, no need to re-authorize" and provide a directly usable natural language example. Do not treat raw status fields frombdpan whoamisuch as the username and Token validity period as a welcome message, unless the user explicitly requests to view account status. (Important: When presenting an authorization link to the user, the link must be extracted outside the code block, and the response must strictly use the Markdown format[点击此处完成授权登录](URL)to ensure it is clickable on mobile devices) - Path validation: Verify that the remote path is within the
/apps/bdpan/scope
Confirmation rules
| Risk level | Operation | Policy |
|---|---|---|
| High (requires explicit intent + explicit confirmation) | rm Delete, upload/download with an existing file of the same name at the target |
Deletion is performed only when the user explicitly requests it, and the objects to be deleted must first be listed and the user's explicit confirmation awaited before invoking the command |
| Medium (confirm when the path is ambiguous) | upload、download、mv、rename、cp | If the path is clear, execute directly; if not, confirm |
| Low (execute directly) | ls、search、whoami、mkdir、share、vip | No confirmation needed |
Additional rules:
- Operation intent is ambiguous ("handle the file" → confirm whether to upload or download) → must confirm
- Ordinal/pronoun references are ambiguous ("the Nth one", "it", "the one above") → must confirm
- User cancellation intent ("never mind", "don't want it anymore", "cancel") → abort immediately, do not execute any command
Deletion rules (rm)
rm Execute only when the user explicitly expresses deletion intent; do not proactively suggest deletion, and you must first obtain the user's explicit confirmation. Before execution, you must:
- Verify that the target path is clear, within the
/apps/bdpan/scope, and, when needed, usebdpan ls --jsonto distinguish files from folders; - If the target is ambiguous, the user expresses cancellation, or the user is merely asking how to delete, do not execute
rm, and clarify first; - Wait for explicit confirmation: List the objects to be deleted to the user one by one (full path + file/directory type + count), explain that deletion is irreversible and that deleting a directory also removes its contents, then wait for the user's explicit confirmation reply; if the user does not explicitly confirm, gives an ambiguous reply, or indicates cancellation, you must not call
rm; - After obtaining confirmation, call
bdpan rm <路径...> --force --json,--forceis only used to skip the CLI's interactive prompt,--jsonis used to read machine-parseable results; it must not be used to infer deletion intent on the user's behalf, skip the above confirmation, or obscure path ambiguity; - After deletion is complete, report only the actual number of successes returned by the CLI; on failure, retain the error reason, and do not describe "canceled" as "deleted".
If the user has already explicitly confirmed the same batch of objects in the same conversation round, no repeated confirmation is needed; any change to the target set (new paths, path rewrites, scope expansion) requires re-confirmation.
Core operations
View status
bdpan whoami
Membership activation/renewal
bdpan vip --json
When the user expresses payment intent ("want to top up membership", "activate membership", "how to renew", "buy Super Membership", "expand capacity", etc.), call bdpan vip --json, and give the user both checkout links returned by the CLI: mobile + desktop. Currently it is not possible to distinguish whether the user is on a phone or a computer, so give both and explain to choose according to device; it is forbidden to give only one, and forbidden to assemble or replace other payment addresses on your own. You may output agent_replydirectly as-is, or render mobile_url / desktop_url respectively as [移动端收银台](链接)、[电脑端收银台](链接). Membership prices and benefits are always subject to the checkout page, and must not be fabricated from memory.
List query
bdpan ls [目录路径] [--json] [--order name|time|size] [--desc] [--folder]
When the user says "view files", "list directory", etc. in natural language, you must call bdpan ls ... --json, and do not rely on ordinary table output. Output the return_markdownin the JSON directly item by item (the [点击查看](链接)already rendered by the CLI); it is forbidden to rewrite the text or reassemble it; only when this field is missing may you fall back to using return_url to render [点击查看]({return_url})yourself. If neither field is present, only state that a view link cannot currently be generated, and do not assemble one yourself based on the path or file name.
When the user says "view/open a certain file", first use ls --json or search --json to obtain the unique target; after confirming the result item, you must output that item's return_markdownas-is (if missing, use return_url to render it), and must not give only the file name, cloud drive path, or an ordinary table, nor download, share, or organize files on your own.
Upload
bdpan upload <本地路径> <远端路径>
Key constraints: For single-file upload, the remote path must be the file name; it is forbidden to end with / . Folder upload:bdpan upload ./project/ project/。
Steps: confirm the local path exists → confirm the remote path → bdpan ls check whether the remote already exists → execute.
Download
Direct download:
bdpan download <远端路径> <本地路径>
Steps:bdpan ls confirm the cloud exists → confirm the local path → check whether it already exists locally → check the file size to determine the download strategy → execute. If ls does not find it, suggest bdpan search <文件名>。
Large file download strategy (important):
The Agent's Bash tool has an execution timeout limit, and large file downloads may be interrupted due to timeout. You must choose a download strategy based on file size:
- Get file size: use
bdpan ls --json <远端路径>to get thesizefield (bytes) - Execute according to size-based strategy:
| File size | Strategy | Execution Method |
|---|---|---|
| ≤ 50MB | Direct Download | bdpan download <远端路径> <本地路径>, set Bash timeout to 300000 (5 minutes) |
| > 50MB | Background Download | Use nohup to execute in the background, and the Agent polls the progress |
Small files (≤ 50MB) are downloaded directly:
Execute normally bdpan download, and set the Bash tool timeout parameter to 300000(5 minutes).
Background download process for large files (> 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
Behavior guidelines for the Agent when executing background downloads of large files:
- After starting the background download,immediately inform the user: the download has started in the background, the file size is X, and it is expected to take Y time
- After each poll, report the progress to the user (downloaded size / total size, percentage)
- After the download is complete, inform the user of the final result
- If the process exits abnormally, check the logs and report the reason for the error
Share link download (first transfer, then download to local):
bdpan download "https://pan.baidu.com/s/<分享标识>" ./downloaded/ # 无码公开分享
bdpan download "https://pan.baidu.com/s/<分享标识>?pwd=abcd" ./downloaded/
bdpan download "https://pan.baidu.com/s/<分享标识>" ./downloaded/ -p abcd # 提取码单独传入
bdpan download "https://pan.baidu.com/s/<分享标识>?pwd=abcd" ./downloaded/ -t my-folder # 指定转存目录
Share link download accepts a Baidu Netdisk share link provided by the user. The internal identifier in the link is parsed by the CLI, and the Skill does not explain it to the user or ask them to choose an internal prefix. When it does not carry
?pwd=and the user has not provided-p, execute the command directly without asking in advance for the extraction code; the CLI determines whether the link is a public share without a code. The large file strategy also applies to share link downloads: after the transfer is complete, usebdpan ls --jsonto obtain the file size, then execute the download according to the above strategy.
Transfer
Transfer the shared file to the netdisk,without downloading to local(the difference from the download share link mode).
bdpan transfer "https://pan.baidu.com/s/<分享标识>" [-p 提取码] [-d 目标目录] [--json]
Steps: confirm that the user provided a Baidu Netdisk share link → if the link contains ?pwd= or the user explicitly provides the extraction code, keep that extraction code; otherwise do not require the user to supplement it → confirm the target directory → execute. After a successful transfer, display only the files transferred this time (not the entire directory), and echo the actual full save path returned by the CLI item by item; do not display only the target directory.
The internal identifiers and prefixes in the share link are part of the CLI parsing rules. The Skill only needs to pass in the link provided by the user as-is, and does not break it down, compare it, or guide the user to choose a prefix in the reply.
Asynchronous transfer status:
- Only when the CLI returns the completed file list may you reply "transfer successful," and echo the actual save path and viewing entry item by item.
- When it returns
status=submitted, it only means the task has been submitted and is still queued, executing, or temporarily unavailable for query; you must retaintask_idand the save location, and you must not reply "transfer successful," nor generate a viewing link for the completed files. - If the task query returns a permission/entitlement error (for example,
-6、13998、13080、13081), this means the current Skill temporarily cannot read the task status; it does not mean the transfer failed. Inform the user that the task has been submitted, do not resubmit the same task, and confirm the result later in Baidu Netdisk. errno=13070When the task is still not found after a brief retry, likewise retaintask_idand prompt to retry later; do not resubmit the same task.
Selective Transfer
When the user only says "transfer this share link," directly execute the above overall transfer without adding directory browsing or confirmation steps. Only the following situations enter selective transfer:
- The user explicitly requests to view the shared content, enter a directory, or select part of the content;
- The overall transfer returns
errno=13072orerrno=13073, and the user agrees to narrow the transfer scope.
First check whether the current CLI supports the new command:
bdpan transfer list --help
If the command does not exist, clearly prompt the user to upgrade bdpan, and do not attempt to concatenate unknown parameters.
Directory query is a read-only operation and can be executed directly:
bdpan transfer list "<分享链接>" --page 1 --page-size 100 --json
bdpan transfer list "<分享链接>" --source-dir "<item.path>" --page 1 --page-size 100 --json
The Agent must comply with the following rules:
- Display the current page contents to the user by name and sequence number; do not ask the user to manually enter
fs_id; fs_idis only an internal identifier and must not be displayed in user-facing replies (do not write it in body text, tables, or parenthetical supplementary explanations); provide it only when the user explicitly requests it;- Internally store the
fs_idin the JSON as a string exactly as is; do not convert it to a JavaScript Number; - When the user says "enter a directory", use that item's
pathas the next--source-dir; has_more=truewhen--pageadd 1 to query the next page, and stop when the next page is empty;- When returning to the previous level, calculate the parent directory based on the current
dir; for the first level of the share, uniformly use an empty--source-dir; - Do not claim that at most 100 items can be selected for transfer because of querying
page_size=100.
After the user has selected the content, first display the names, quantity, and target directory, obtain the user's confirmation, and then execute the write:
bdpan transfer select "<分享链接>" --fsid "<fs_id>[,<fs_id>...]" --dir "<目标目录>" --json
--dir When the target directory specified bytransfer select does not exist, bdpan mkdirwill automatically create that directory before transferring, with no need to execute /apps/bdpan/ in advance; the target directory must still be within the
status=submitted only indicates that the asynchronous task has been submitted, and must not be phrased as all files having been transferred. When the user cancels, end immediately and do not execute transfer select。
Transfer error handling:
| CLI returns scenario | Skill user prompt | Whether to recommend retry |
|---|---|---|
errno=13003 and no extraction code provided |
This share link requires an extraction code. Please provide the extraction code and retry. | Yes |
errno=13003 and an extraction code has been provided |
The extraction code is incorrect. Please check the extraction code and retry. | Yes |
errno=13004 |
The share link has expired, been canceled, or does not exist. | No |
errno=13070(still does not exist after retrying the task query) |
The task status cannot be queried temporarily; the transfer may still be in progress. Keep the task ID, check again later, and do not resubmit. | No, wait first |
errno=13071 |
Another transfer task is already in progress. Please wait about 5 minutes and try again. | Retry after waiting |
transfer select returns errno=13061 |
The selected file ID is incorrect or no longer exists. Please re-query the shared content and check the selected fs_id。 |
Retry after re-querying |
transfer select returns errno=13041 |
The selected file ID does not belong to the current share link. Please use the fs_id returned by querying the current link to select again. |
Retry after selecting again |
errno=13072 or errno=13073 |
The account's single-transfer item limit has been reached. Ask whether to switch to selective transfer. | Do not retry automatically |
transfer select --dir returns errno=20013 |
Failed to create the target directory. Please check whether the target directory is located in /apps/bdpan/ within the range; if it still fails though the path is correct, keep the error ID and feed back to investigate service authorization or path issues. |
Check the path and retry |
The quantity limit is calculated based on the actual contents after directory recursion: 500 for regular users, 3000 for VIP, and 50000 for SVIP. Do not automatically split, automatically retry, or promise that selecting a directory will definitely succeed.
Successful results and actual save paths
After a successful upload or transfer, the reply must include the actual full save path, for example:文件已保存到:我的应用数据/bdpan/项目资料/周报.md. Do not merely echo the “target directory” or the relative path entered by the user.
upload: preferentially read thesaved_pathfrom the CLI success result; for a single file, directly echo that path. For folder uploads,saved_pathis the actual target directory; if you need to list the files one by one, then usebdpan ls --jsonto verify that directory.transfer: use thesaved_pathfield of each file in the JSON result to echo them one by one (the top-levelsaved_pathis only the common target directory); for compatibility with older versions,files[].pathorremote_path. Only after confirming that the task has been completed may “已保存” be used.status=submittedcan only be expressed as “the transfer task has been submitted”; you must not claim that the file has been saved.- For displayed paths, uniformly use the form “我的应用数据/bdpan/...”, and do not expose the
/apps/bdpan/...API path to the user.
Backend link (click to view)
After the following commands succeed, the Agent must preferentially read the return_markdownreturned by the CLI JSON and directly output that value as-is; only when that field is missing should it fall back to using return_url and return_hint to assemble the Markdown link itself:
upload、download、transfer、search、ls、cp、mv、rename、mkdir。
-
return_markdownis the[点击查看](链接)already rendered by the CLI; it is forbidden to rewrite the text, truncate the link, or take only the URL from it and reassemble it. -
In table output without
--json, the link has already been merged into the name column (名称 → 链接). When rearranging results, that cell must be preserved as a whole; it is forbidden to copy only the name and lose the link. -
Single-result commands (
upload、download、cp、mv、rename、mkdir, single-filetransfer) must append a linereturn_markdownin the result reply; echoing only the path without the link is considered a failure to meet the display requirement. -
return_urlis an opaque value generated by the CLI/cloud drive service; the Skill must not assemble, rewrite, or replace query parameters on its own.return_hintis only a display hint; it cannot be used to infer that the target definitely supports preview. -
The current v1.7.5 CLI uses the official
union/spirit/launchprotocol; file targets returntarget=file, and directory targets returntarget=dir. Whether these two types of targets can be previewed is determined by the cloud drive main client. Therefore, file and folder results uniformly display[点击查看]({return_url}); the Skill does not determine previewability on its own based on extension, MIME, or file name. -
client_return_target_typeonly indicates whether the in-client protocol target is a file or a directory, and does not change the display text; if the server returns otherreturn_target_typein the future, thereturn_hintreturned by the CLI still prevails. -
Multiple results: each result item uses its own
return_urlandreturn_hint; multiple objects must not be merged into one guessed link;fs_idmust be passed as a string exactly as-is and must not be converted to a JavaScript Number. -
Each successful task's actual file/folder result must carry the corresponding string
fsid(compatibility retainsfs_id), or the generatedreturn_url; Skill must not guess fsid based solely on filename, relative path, or list index. -
fsid/fs_id、owner_uid、uid、traceidare all internal identifiers and context parameters, used only for invoking the CLI and generating links; displaying them in user-facing replies is prohibited (including body text, table columns, parenthetical additions); the only things visible to users are name, path, size, time, and thereturn_markdownlink. It may be provided only when the user explicitly requests it. -
transfer selectWhen it returnsstatus=submitted, it only means the task has been submitted; the client link for the completed object must not be generated in advance or claimed to be completed; display it only after the CLI returns the actual completion result. -
It is prohibited to use scripts, jq, python, or similar methods to re-trim the CLI's JSON result fields before replying: in actual testing, "extracting only
saved_path/message" will drop the link. The CLI already writes the link into bothmessageandagent_reply; simply echo one of them directly, and the link will not be missed even in long conversations. -
agent_replyis the CLI's pre-rendered full-sentence result (action + path +[点击查看](链接)), and can be output directly as-is; it is consistent with the content ofmessage、return_markdown, so choose either one to display, with no need to concatenate further. -
shareonly reuses thelink/short_urlshare link already returned by the CLI, and does not additionally generatereturn_url;rm; it does not return a client link.
Client links are generated by the CLI/cloud drive service according to the formal protocol; Skill does not assemble or rewrite URLs on its own. A file link only needs the file fs_id and account owner_uid; a directory link uses the target path and owner_uid. In the Agent context, uid、traceid is an optional attribution parameter; if present, it is passed through into the link, and if missing, it does not affect file link generation.owner_uid is obtained from the CLI's logged-in account information, anduid and traceid are passed through from the host/Agent context (via the CLI's --uid、--traceid parameter); they must not be requested from the user, nor guessed from username or session ID.traceid If it is automatically injected by login or the host, keep the original value and pass it through. All degraded forms are still the unified client page union/spirit/launch link: when fsid is missing, it degrades to the parent directory target=dir, and when even owner_uid is missing, it carries only path + target=dir and leaves identity handling to the landing page; it will not degrade into a pure Web directory page.
Client field reserved contract
When the cloud drive service later provides a unified link generation capability, the result may extend the following fields. The fields are generated by the server; Skill is only responsible for passing them through and displaying them, not for determining the protocol or assembling URLs:
client_return_url: the in-client link preferentially used by clients/mobile devices.web_return_url: the Web link used when the client is not installed, the version is unsupported, or launching fails.return_target_type: the Web/main link target type; currently the CLI fixes it todirectory(the Web fallback is always a directory).client_return_target_type: the in-client target type; currently the CLI returnsfilefor files anddirectoryfor directories. Whenfsidis missing, the file degrades to the in-client link of the directory it is in; at this time this field isdirectoryandclient_return_url_errorexplains the reason for degradation (missing Agent context does not trigger degradation).return_url: the primary link selected by the host from the above links according to the access environment; when the CLI does not yet stably provide two types of independent URLs, it is still handled compatibly according to the existingreturn_url.return_markdown: the CLI usesreturn_hintandreturn_urlPre-rendered Markdown link, for the host to output as-is, avoiding losing the link when concatenating it yourself.agent_reply: The full-sentence reply pre-rendered by the CLI (action + path + Markdown link). Even if the host forwards only a single field, the link will not be lost; at the same time,messagealready has the link embedded in it.
The display text for files and directories is unified as "click to view", based on the return_hint returned by the CLI, and the Skill does not rewrite it on its own. When the server cannot generate a link for the time being, keep the actual saved path and state "a view link cannot be generated for the time being"; do not forge a normal homepage or preview address.
When a successful result is missing a required field, context, or link generation fails, only echo the save path/result actually returned by the CLI, and state that a view link cannot be generated for the time being; do not forge links, treat an ordinary Web homepage link as a return link, or treat a share link as your own return link. Failed, canceled, or unauthorized results do not display a return link.
Delete
bdpan rm <路径> [路径...] [--force] [--json]
Execute only when the user explicitly requests deletion. First verify that the target path is unambiguous, then list the objects to be deleted to the user and wait for explicit confirmation; only after obtaining confirmation call bdpan rm <路径...> --force --json。--force is only used to skip CLI interactive prompts,--json is used to read results, and must not be used to bypass confirmation, intent, or path validation. When the target is ambiguous, the user cancels, the user has not explicitly confirmed, or the user only asks about the deletion method, the command must not be called.
Share
bdpan share <路径> [路径...] [--period <天数>] [--json]
--period / -d parameter: Share validity period (days), values: 0=permanent, 1, 7, 30 (default: 7)
Smart selection rules:
The Agent must determine the validity period based on the user's semantic intent, rather than merely matching fixed keywords.
- The user expresses semantics such as "hoping it will be valid long-term/permanent/never expires/always usable" → use
--period 0, and remind the user: permanent links cannot expire automatically, please pay attention to file security - The user specifies a concrete number of days or time range → choose the closest enum value (1, 7, 30)
- The user expresses no validity period preference → default to
--period 7
Steps:bdpan ls Confirm the file exists → choose the validity period according to the user's intent → perform the share → display link + extraction code + validity period.
bdpan share When errno=20013 is returned, first use bdpan ls to confirm whether the share path has been deleted; if the path still exists, keep the error ID and provide feedback to investigate service authorization or path issues.
Search
bdpan search <关键词> [--category 0-7] [--no-dir|--dir-only] [--page-size N] [--page N] [--json]
When the user says "search", "look for it", or other natural language, --jsonmust be appended. Output the return_markdownfrom the results directly for each item; only when that field is missing use return_url to render [点击查看]({return_url}). Do not use ordinary table results as a substitute for links, and do not concatenate URLs yourself.
category: 0=all 1=video 2=audio 3=image 4=document 5=application 6=other 7=torrent.--no-dir and --dir-only are mutually exclusive.
Move / Copy / Rename / Create folder
bdpan mv <源路径> <目标目录> --json
bdpan cp <源路径> <目标目录> --json
bdpan rename <路径> <新名称> --json # 第二参数是文件名,非完整路径
bdpan mkdir <路径> --json
These four commands must append --json, and in the result reply append the return_markdownof that result as-is; only echoing the path without providing a link is considered incomplete.
bdpan mv When errno=12(internal service error) is returned, first check whether the source path and target path are the same, or whether a folder is being moved into itself; prompt the user to change the target directory, and do not retry automatically.
Path rules
| Scenario | Format | Example |
|---|---|---|
| Command parameter | Relative path (relative to /apps/bdpan/) |
bdpan upload ./f.txt docs/f.txt |
| Displayed to the user | Chinese name | "Uploaded to: My app data/bdpan/docs/f.txt" |
Mapping relationship:我的应用数据 ↔ /apps
Prohibited: Using Chinese paths in commands (我的应用数据/...), exposing API paths when displaying (/apps/bdpan/...)。
Authorization code handling
When a user sends a 32-character hexadecimal string, first confirm: "Is this a Baidu Netdisk authorization code? Once confirmed, the login process will be executed." After confirmation, execute bash ${CLAUDE_SKILL_DIR}/scripts/login.sh(do not use --yes, keep the security confirmation step).
Management features
Installation
bash ${CLAUDE_SKILL_DIR}/scripts/install.sh [--yes]
The installer downloads from the Baidu CDN (issuecdn.baidupcs.com) and executes. install.sh performs a SHA256 integrity check on the installer according to the platform; if the check fails, it deletes the installer and terminates the installation. In security-sensitive scenarios, it is still recommended to manually review the installer contents first or execute it in a sandbox.
Login / Logout / Uninstall
bash ${CLAUDE_SKILL_DIR}/scripts/login.sh # 用户主动登录(成功后展示欢迎语)
bash ${CLAUDE_SKILL_DIR}/scripts/login.sh --continue-task # 原任务前置自动登录(成功后静默返回)
bdpan logout # 注销
bash ${CLAUDE_SKILL_DIR}/scripts/uninstall.sh [--yes] # 卸载
Update (must be triggered by an explicit user instruction)
bash ${CLAUDE_SKILL_DIR}/scripts/update.sh # 检查并更新(需用户确认)
bash ${CLAUDE_SKILL_DIR}/scripts/update.sh --check # 仅检查更新
Memory backup and restore
Only supports 4 Claw products (kimiclaw, maxclaw, qclaw, openclaw), automatically detects the current environment.
Netdisk storage path: /apps/bdpan/agent-memory/<agent>/<device>/manual/<timestamp>/
Backup contents: 7 Workspace files (AGENTS.md, SOUL.md, USER.md, IDENTITY.md, TOOLS.md, MEMORY.md, HEARTBEAT.md) + memory/*.md + manifest.json
Back up memory
bash ${CLAUDE_SKILL_DIR}/scripts/memory-backup.sh backup
View backup list
bash ${CLAUDE_SKILL_DIR}/scripts/memory-backup.sh list
Restore backup
# 按日期模糊匹配(如只输入日期部分)
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
Restore safety mechanism: Before restoring, automatically back up the current local memory to <workspace>/.backup-before-restore/<timestamp>/, to prevent data loss from mistaken operations.
Operation flow
- Automatic check before execution: whether bdpan is installed → whether logged in (if not satisfied, guide through handling)
- Detect the current Agent type → error and exit for unsupported environments
- Execute the corresponding operation (backup/list/restore)
Reference documentation
Consult as needed when encountering the corresponding issue, no need to preload:
| Documentation | When to consult |
|---|---|
| bdpan-commands.md | Need complete command parameters, options, JSON output format |
| authentication.md | Authentication flow details, Token management |
| examples.md | More usage examples (batch upload, automatic backup, etc.) |
| troubleshooting.md | Need to troubleshoot when encountering errors |