Baidu Drive file management tool, all operations are restricted to within 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 "Baidu Drive", "bdpan", "netdisk"
- 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 the current conversation is already performing drive operations, subsequent messages can trigger without mentioning "drive" again.
Common parameters for all commands (Agent must pass)
--agentname、--session-input and --session-id are common command parameters for all bdpan CLI subcommands, and must be attached when invoking a specific command; they are not standalone commands. When a file return-end link needs to be generated, also pass through 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: Pass in the current Agent/host name, used only for service quality tracking and source identification; it does not participate in the command's business logic or result processing.
- Agent behavior constraint (must be complied with): When the Agent calls any
bdpanCLI subcommand, it must pass the--agentnameparameter, with the value being the name of the currently invoked runtime environment or Agent framework. This is an Agent behavior requirement and does not affect CLI execution logic. - Fallback fault tolerance: Only when the Agent truly cannot obtain the environment name may this parameter be omitted; the CLI will not error or have command execution affected due to the absence of this parameter.
--session-input
- Purpose: Pass in the user's original question text, used only for service quality tracking; it does not participate in the command's business logic or result processing.
- Agent behavior constraint (must be complied with): When the Agent calls any
bdpanCLI subcommand, it must pass 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; rewriting, summarizing, or reorganizing the language is prohibited). This is an Agent behavior requirement and does not affect CLI execution logic. - Fallback fault 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 or have command execution affected due to the absence of this parameter.
--session-id
- Purpose: Pass in a unique session identifier, used only for service quality tracking; it does not participate in the command's business logic or result processing.
- Agent behavior constraint (must be complied with): 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 timestamp in seconds, and random is a 6-character random alphanumeric string. Semantic names (such as dog001, mom001, test001, etc.) are prohibited. Also, pass the same session_id in all subsequent CLI subcommand calls within the same conversation. - Generation timing: generated when the
bdpanCLI subcommand needs to be called 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-to-end context)
- Purpose: provides Agent/host context attribution information for file return-to-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 as-is between commands; it must not be requested from the user, displayed, or guessed using a username,
session-id.traceidhas already been automatically injected by the login flow or the host, keep the original value. - Scope of application: used only when a command needs to generate a file return-to-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 returnstarget=filelink, and the Skill displaysreturn_markdownas-is as usual; you must not claim on this basis that a view link cannot be generated, nor forge these two values yourself.
--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-to-end link context. Do not fabricate or overwrite any parameter yourself.
Memory backup/restore triggers
The following expressions should trigger even if "cloud drive" is not mentioned (limited to kimiclaw/maxclaw/qclaw/openclaw environments):
| Example user phrasing | 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 memory from March 16", "restore the backup from 2026-03-16" | restore with specified date |
The following situations do not trigger memory backup/restore:
- "help me remember…", "organize memory", "clean up memory" (local operations, not involving the cloud drive)
- "back up my code/files" (the operation target is not memory)
- environments other than the above 4 Claw environments (report an error stating it is not supported; do not execute)
Principle for distinguishing: 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 the user to manually configure outside the script, and the Agent should not set them on their behalf) - Path security: Path traversal is prohibited (
..、~), and accessing absolute paths outside the/apps/bdpan/scope is prohibited - Memory backup constraints: Directly using bare
bdpan upload/downloadcommands to operate on the memory directory is prohibited; it must be executed through thebash ${CLAUDE_SKILL_DIR}/scripts/memory-backup.shscript to ensure that mechanisms such as manifest generation, path security checks, and safety net backups operate normally
Pre-checks
Execute in order on each trigger:
- Installation check:
command -v bdpan, and if not installed, inform the user and, after confirmation, executebash ${CLAUDE_SKILL_DIR}/scripts/install.sh(after user confirmation,--yescan be added to skip the installer's internal confirmation) - Login check:
bdpan whoami, and if not logged in and the current context is the prerequisite login for the original task, executebash ${CLAUDE_SKILL_DIR}/scripts/login.sh --continue-task; after successful login, immediately continue the original task without repeatedly outputting a separate login welcome message. Only when the user explicitly requests login shouldlogin.shbe executed without that parameter to display a scenario-based welcome message; even if a valid login state already exists, you should still prompt "Already logged in, no need to reauthorize" and provide directly usable natural language examples. Do not treat raw status fields such as the username, Token validity period, etc. frombdpan whoamias a welcome message unless the user explicitly requests to view account status. (Important: When showing the authorization link to the user, the link must be extracted outside the code block, and the reply must strictly use the Markdown format[点击此处完成授权登录](URL)to ensure it is clickable on mobile) - Path verification: Verify that the remote path is within the
/apps/bdpan/scope
Confirmation rules
| Risk level | Operation | Policy |
|---|---|---|
| High (requires explicit intent + explicit confirmation) | rm Deletion, upload/download target already has a file with the same name |
Deletion is only executed when the user explicitly requests it, and the objects to be deleted must first be listed and the command called only after waiting for explicit user confirmation |
| 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 required |
Additional rules:
- Ambiguous operation intent ("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", "I don't want it anymore", "cancel") → abort immediately and do not execute any command
Deletion rules (rm)
rm Only execute when the user explicitly expresses deletion intent, do not proactively suggest deletion, and explicit user confirmation must first be obtained. Before execution, you must:
- Verify that the target path is clear, within the
/apps/bdpan/scope, and if necessary usebdpan ls --jsonto distinguish files and folders; - If the target is ambiguous, the user expresses cancellation, or the user is only asking how to delete, do not execute
rm, and clarify first; - Wait for explicit confirmation: List to the user, one by one, the objects that will be deleted (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 prompts,--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 success count actually returned by the CLI; on failure, retain the error reason, and do not describe "cancelled" as "deleted".
If in the same conversation round the user has already explicitly confirmed for the same batch of objects, 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 impossible 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 concatenate or replace them with other payment addresses on your own. You may directly output agent_replyas-is, or render each of mobile_url / desktop_url 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 in natural language such as "view files" or "list directory", you must call bdpan ls ... --json, and do not rely on ordinary table output. Output directly, item by item, the return_markdownin the JSON (the [点击查看](链接)already rendered by the CLI); it is forbidden to rewrite the text or reassemble it; only when that field is missing fall back to using return_url to render [点击查看]({return_url})yourself. When neither field is present, only explain that a view link cannot be generated for the time being, 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 (when 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 it exists in the cloud → confirm the local path → check whether it already exists locally → check the file size to decide 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. The download strategy must be chosen based on file size:
- Get file size: use
bdpan ls --json <远端路径>to get thesizefield (bytes) - Execute by size-based strategy:
| File size | Strategy | Execution method |
|---|---|---|
| ≤ 50MB | Direct download | bdpan download <远端路径> <本地路径>, set the 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:
Normally execute bdpan download, with the Bash tool timeout parameter set 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 been started in the background, the file size is X, and it is estimated 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 locally):
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 or ask the user to choose an internal prefix. When it does not carry
?pwd=and the user has not provided-p, directly execute the command without asking in advance for the extraction code; the CLI determines whether the link is a public share without a code. Share link download is also subject to the large file strategy: after the transfer is complete, usebdpan ls --jsonto obtain the file size, and then execute the download according to the above strategy.
Transfer
Transfer the shared file to the netdisk,without downloading it locally(the difference from the download share link mode).
bdpan transfer "https://pan.baidu.com/s/<分享标识>" [-p 提取码] [-d 目标目录] [--json]
Steps: confirm that what the user provided is a Baidu Netdisk share link → if the link contains ?pwd= or the user explicitly provides an extraction code, retain 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 complete save path returned by the CLI item by item; do not display only the target directory.
The internal identifier and prefix in the share link are CLI parsing rules. The Skill only needs to pass in the link provided by the user as is, and must 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 paths and viewing entries 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, must not reply "transfer successful", and must not generate viewing links for 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, and 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, similarly retaintask_idand prompt the user 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 entire batch save returns
errno=13072orerrno=13073, and the user agrees to narrow the batch save 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; 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 content to the user by name and sequence number; do not require the user to manually input
fs_id; fs_idis only an internal identifier and is prohibited from being 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; converting it to a JavaScript Number is prohibited; - When the user says "enter a directory", use that item's
pathas the next--source-dir; has_more=trueyou may add 1 to--pageto query the next page; 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 batch save 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, 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 mkdirin advance; the target directory must still be within the /apps/bdpan/ scope.
status=submitted only indicates that the asynchronous task has been submitted, and must not be stated as all files having been completely batch saved. When the user cancels, end immediately without executing transfer select。
Batch save error handling:
| CLI return 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 extraction code already provided |
The extraction code is incorrect. Please check the extraction code and retry. | Yes |
errno=13004 |
The share link has expired, has 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 batch save may still be executing. Keep the task ID, check again later, and do not resubmit. | No, wait first |
errno=13071 |
Another batch save 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 query the shared content again and check the selected fs_id。 |
Retry after querying again |
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 batch save quantity limit has been reached. Ask whether to switch to selective batch save. | Do not automatically retry |
transfer select --dir returns errno=20013 |
Target directory creation failed. Please check whether the target directory is located in /apps/bdpan/ within range; if it still fails although the path is correct, keep the error ID and report back to investigate service authorization or path issues. |
Retry after checking the path |
The quantity limit is calculated based on the actual contents after directory recursion: regular users 500, VIP 3000, SVIP 50000. 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, thesaved_pathis the actual target directory. If you need to list files item by item, then usebdpan ls --jsonto verify that directory.transfer: use each file'ssaved_pathfield in the JSON result to echo item by item (the top-levelsaved_pathis only the common target directory); compatible with the legacyfiles[].pathorremote_path. Only after confirming the task is complete may you use "saved".status=submittedcan only be expressed as "transfer task submitted"; you must not claim the file has been saved.- Display paths uniformly in the form "My App Data/bdpan/...", and do not expose the
/apps/bdpan/...API path to the user.
Reply-side link (click to view)
After the following command succeeds, 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 may 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 kept 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 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 and 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, directory targets returntarget=dir, and whether these two types of targets can be previewed is determined by the main cloud drive client. Therefore, file and folder results uniformly display[点击查看]({return_url}), and the Skill does not judge 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 anotherreturn_target_typein the future, thereturn_hintreturned by the CLI still prevails. -
Multiple results: each result item uses its own
return_urlandreturn_hint, and multiple objects must not be merged into one guessed link;fs_idmust be passed as-is as a string and must not be converted to a JavaScript Number. -
The actual file/folder result of each successful task must carry the corresponding string
fsid(with compatibility retainingfs_id), or the already generatedreturn_url; Skill must not guess the fsid based solely on the filename, relative path, or list index. -
fsid/fs_id、owner_uid、uid、traceidare internal identifiers and context parameters, used only for calling the CLI and generating links; they must not be displayed in user-facing replies (including body text, table columns, and parenthetical notes); the only things visible to the user are the name, path, size, time, and thereturn_markdownlink. They may be provided only when the user explicitly requests them. -
transfer selectreturnsstatus=submitted, it only means the task has been submitted; the client-side link of the completed object must not be generated in advance or claimed to be complete; display it only after the CLI returns the actual completion result. -
It is forbidden to use scripts, jq, python, or similar methods to re-trim the CLI's JSON result fields before replying: in testing, "taking only
saved_path/message" causes the link to be lost. The CLI already writes the link into bothmessageandagent_reply; simply echo one of them, and the link will not be missed even in long conversations. -
agent_replyis the full pre-rendered sentence result from the CLI (action + path +[点击查看](链接)), which can be output as-is; it is consistent with the content ofmessage、return_markdown, so choose either one to display, with no need to concatenate again. -
shareonly reuses thelink/short_urlsharing link already returned by the CLI, and does not additionally generatereturn_url;rm. It does not return a client-side link.
Client-side links are generated by the CLI/cloud drive service according to the formal protocol; the 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. The uid、traceid in the Agent context 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 login 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 the username or session ID.traceid If it is automatically injected by login or the host, pass it through with its original value. All degraded forms are still the unified client-side 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 , leaving identity handling to the landing page; it will not degrade into a pure Web directory page.
Client-side field reservation contract
When the cloud drive service subsequently provides a unified link generation capability, the result may be extended with the following fields. The fields are generated by the server; the 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 the client/mobile end.web_return_url: the Web link used when the client is not installed, the version is unsupported, or launching fails.return_target_type: the target type of the Web/main link; 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 its containing directory; in this case this field isdirectoryandclient_return_url_errorexplains the reason for degradation (missing Agent context does not trigger degradation).return_url: the main link selected by the host from the above links according to the access environment; when the CLI does not yet stably provide two 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,messagealso has the link embedded inside 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 is temporarily unable to generate a link, keep the actual saved path and state "temporarily unable to generate a view link"; do not fabricate a normal homepage or preview address.
When a successful result lacks the required fields, context, or link generation fails, only echo back the save path/result actually returned by the CLI, and state that a view link cannot be generated temporarily; do not fabricate a link, treat an ordinary Web homepage link as a return link, or treat a share link as the user's own return link. Failure, cancellation, or no-permission 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 the CLI interactive prompt,--json is used to read the result, 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 how to delete, 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.
- If the user expresses semantics such as "hoping to be valid long-term/permanent/never expires/always usable" → use
--period 0, and remind the user: permanent links cannot expire automatically, so pay attention to file security - If the user specifies a specific number of days or a time range → choose the closest enum value (1, 7, 30)
- If the user does not express any validity period preference → default
--period 7
Steps:bdpan ls Confirm the file exists → choose the validity period according to the user's intent → execute 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 report back to troubleshoot 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", "find it" or other natural language, --jsonmust be appended. Directly output the return_markdownin the result item by 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; echoing only the path without giving a link is considered incomplete.
bdpan mv When errno=12is returned (internal service error), 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 | Examples |
|---|---|---|
| Command parameter | Relative path (relative to /apps/bdpan/) |
bdpan upload ./f.txt docs/f.txt |
| Displayed to 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 the 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 is downloaded from the Baidu CDN (issuecdn.baidupcs.com) and executed. install.sh performs an SHA256 integrity check on the installer according to the platform; if the check fails, the installer will be deleted and the installation terminated. In security-sensitive scenarios, it is still recommended to manually review the installer content or execute it in a sandbox first.
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 content: 7 Workspace files (AGENTS.md, SOUL.md, USER.md, IDENTITY.md, TOOLS.md, MEMORY.md, HEARTBEAT.md) + memory/*.md + manifest.json
Backup 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 misoperation.
Operation process
- Automatic check before execution: whether bdpan is installed → whether logged in (if not satisfied, guide the user through handling)
- Detect the current Agent type → error out and exit for unsupported environments
- Execute the corresponding operation (backup/list/restore)
Reference documentation
Consult as needed when encountering the corresponding issues; no need to preload:
| Document | When to consult |
|---|---|
| bdpan-commands.md | Need complete command parameters, options, JSON output format |
| authentication.md | Authentication process details, Token management |
| examples.md | More usage examples (batch upload, automatic backup, etc.) |
| troubleshooting.md | Encountered an error and need troubleshooting |