SuperAPI AI Directory

soia-pkm-baidu-netdisk-ops

Office & productivity

View repository

Updated 10-16 09:29

About this skill

soia-pkm-baidu-netdisk-ops — Baidu Netdisk atomic operation layer

Customer-readable description

This skill integrates Baidu's official baidu-drive Skill and bdpan CLI into the PKM workflow, and is responsible for safe Baidu Netdisk atomic operations and read-only resource scanning.

Positioning

This skill is the Baidu Netdisk adapter for the PKM layer, and by default uses Baidu's officially public baidu-drive Skill and its bdpan CLI; it can also explicitly switch to the community mqhe2007/baidupan-cli for open platform application directory testing. Both backends are selected by the same private configuration; this skill supplements PKM-oriented security boundaries, read-only scanning, and standard JSONL output.

It is not responsible for automatically organizing directories, generating collections, or formulating study plans; these should be handled by upper-layer curator skills consuming the scan results.

What this skill can do

Customer wants Skill will do Customer can see
Log in to or verify Baidu Netdisk Check bdpan, version, and login status; complete authorization according to the official script Official authorization address, non-sensitive status, and verification results; does not display tokens or configuration files
Browse directories or search files Use ls --json / search --json Remote scope, entries, and failure reasons
Transfer or manage files Upload, download, share, transfer/save, move, copy, rename, create directory Expected scope, execution results, conflict policy, and final-state verification
Build full-disk index input Run read-only DFS, generate JSONL and .errors/.progress/.done sidecar Scan statistics, error count, and output location

Official bdpan intentionally does not provide a delete command. This skill does not supplement deletion through other clients, and does not use web cookies, BDUSS, or undisclosed interfaces.

How customers use it

Describe the goal in natural language, and provide the remote virtual path (such as /资料) and the necessary local target path. The Agent will first check dependencies and login status; when upload, download, sharing, transfer/save, or remote organization is involved, it will first show the exact scope and conflict policy, then execute after confirmation and read back for verification.

Dependencies and installation

First install this skill:

npx skills add soia-team/soia-open-pkm-clip-skills -g -a '*' -s soia-pkm-baidu-netdisk-ops -y

Prefer to install Baidu's official upstream Skill:

npx skills add https://github.com/baidu-netdisk/bdpan-storage/skills --skill baidu-drive

Then follow the upstream baidu-drive/SKILL.md to operate:

  1. Installed by the upstream scripts/install.sh Installation bdpan(the current upstream installer version is subject to the repository; the installation script is downloaded from Baidu CDN, and the script and network source should be reviewed before execution).
  2. For login, first check whether bdpan help login contains --device-code: when supported, the Agent directly executes this skill'sdevice code login entry, automatically generates the authorization link/QR code and waits for the customer to authorize on the Baidu page or App; this entry automatically passes --accept-disclaimer, and the customer does not need to enter Y or the authorization code in the terminal. Only when an old version does not support device code should it fall back to the upstream scripts/login.sh --yes; in this case --yes Only skip the script security notice prompt that has already been shown to the client; authorization is still completed by the client.
  3. Run bdpan whoami to verify login status.

The upstream Skill's path is its own installation directory; do not mistake this skill's directory for the upstream directory; when the upstream Skill is missing, stop and prompt to install the dependency. Installation, login, and updates all require the user's explicit intent; do not trigger them silently; after the client explicitly requests login,--yes is only used to skip the script disclaimer that has already been shown; it does not mean completing Baidu authorization on the client's behalf.

Community mode requires AppKey, SecretKey, and the application name; official mode does not require these variables. For the facts, limitations, and switching boundaries of the two backends, see provider-cli.md。

Private configuration and path contract

  • Private configuration is stored by default at:

    ~/.config/soia-skills/soia-pkm-baidu-netdisk-ops/config.yml
    

    Can be overridden with SOIA_PKM_BAIDU_NETDISK_OPS_CONFIG_FILE=<custom-config-path> . Copy this skill's config.example.yml and fill it in according to the selected backend; do not put the private config.yml back into the repository.

  • The only configuration options are provider: official|community and the optional binary: bdpan|baidupan-cli。binary . provider is only used to select the CLI; by default it is selected according to

  • The official provider configuration is maintained by bdpan itself in ~/.config/bdpan/config.json. The Agent does not read, print, or copy this file, nor does it actively set BDPAN_CONFIG_PATH、BDPAN_BIN or BDPAN_INSTALL_DIR。

  • The community provider only reads from the private configuration's env: to read BAIDUPAN_APP_KEY、BAIDUPAN_APP_SECRET、BAIDUPAN_APP_NAME and the optional BAIDUPAN_CRYPTO_PASSPHRASE; the process environment takes precedence over the configuration file. The wrapper does not perform shell interpolation and does not print these values.

  • The official application isolation root is /apps/bdpan/; the user-visible name is usually 我的应用数据/bdpan/. For user-facing displays and command input, use relative paths or this skill's virtual paths, for example /资料、/资料/a.pdf, and do not expose the full provider prefix to the user.

  • Paths are forbidden from containing .. or ~, and do not treat local absolute paths as remote paths. Before writing, check the source, target parent directory, and conflict policy.

  • bdpan 's JSON fields are primarily fs_id、server_filename、isdir、size、md5、server_mtime ; the parser only accepts equivalent case-insensitive fields and does not parse human-readable tables.

Standard workflow

1. Installation and login

python3 <skill-path>/scripts/run_with_env.py -- version
python3 <skill-path>/scripts/run_with_env.py -- whoami

The wrapper selects according to config.yml Select bdpan or baidupan-cli. If the official mode's bdpan does not exist, first ask the user to confirm, then run the upstream installation script; if the community mode's baidupan-cli does not exist, install it from its Releases . When official mode login is invalid, first check whether the current CLI supports device code; if it does, use this skill's scripts/device_login.py, which will automatically include --accept-disclaimer, generate a link, and wait for authorization. When device code login produces a QR code image address, use scripts/decode_qr.py to decode the browser authorization address, and give the address to the client as a clickable link; the client only needs to complete authorization in the Baidu App/browser and does not need to open a terminal, enter Y , or paste the authorization code. Only older versions fall back to the upstream scripts/login.sh --yes. After login, run whoami and --json lsin sequence, and check the actual output and exit code; do not write the authorization code, QR code content, or token into the receipt. For the complete gating and failure handling, see login-playbook.md。

2. Read-only operations

python3 <skill-path>/scripts/run_with_env.py -- --json ls
python3 <skill-path>/scripts/run_with_env.py -- --json ls 资料
python3 <skill-path>/scripts/run_with_env.py -- --json search "关键词"
python3 <skill-path>/scripts/run_with_env.py -- whoami

Prefer reading existing scan/index artifacts; only scan the remote when no usable artifacts exist. If the directory does not exist, permissions are insufficient, the exit code is nonzero, or the scan shows LIST_FAIL , the result must not be described as an "empty directory".

3. Remote write operations

First use the wrapper to execute ls --json to check the source and target parent directories, then explicitly confirm the exact scope, conflict policy, and whether partial success is allowed. Command names and parameters are subject to the selected provider's reference documentation. If an upload returns a business JSON error (especially errno=-10), retries must stop and the target must be read back; at the same time, have the customer check the cloud drive capacity and the open platform's upload capability. Write permission must not be inferred solely from a successful login.

python3 <skill-path>/scripts/run_with_env.py -- mkdir 资料/新目录
python3 <skill-path>/scripts/run_with_env.py -- mv 资料/旧名 资料/
python3 <skill-path>/scripts/run_with_env.py -- cp 资料/a.pdf 备份/
python3 <skill-path>/scripts/run_with_env.py -- rename 资料/旧名 新名

All write operations must, after execution, re-list the affected directories or verify the target.share invokes potentially billable capabilities, so it must be separately flagged and confirmed:

python3 <skill-path>/scripts/run_with_env.py -- share 资料/a.pdf --period 7 --json
python3 <skill-path>/scripts/run_with_env.py -- transfer '<share-url>' -p '<提取码>' --json

4. Upload and download

python3 <skill-path>/scripts/run_with_env.py -- upload <local-file> 资料/
python3 <skill-path>/scripts/run_with_env.py -- download 资料/a.pdf <local-file>
python3 <skill-path>/scripts/run_with_env.py -- download '<share-url>' <local-dir> -p '<提取码>'

The remote target of a single-file upload must include the file name; a directory upload ends with / . Overwrites, large files, batch tasks, and share transfers must all be confirmed first; after completion, verify local file existence and size, and independently compute hashes when necessary. A terminal timeout does not equal a transfer failure; first query the task/target status before deciding whether to retry. An explicit API business error must not be handled as a timeout.

5. Full read-only JSONL scan

The scanner selects the CLI according to configuration and calls only the corresponding provider's read-only ls --json, normalizes entries into path、name、id、dir、size、sha1, and preserves md5、mtime:

python3 <skill-path>/scripts/scan_drive.py \
  --root / \
  --out <user-output-dir>/baidupan-scan.jsonl \
  --workers 4 --resume

reusable --root /资料 to limit the scope; use --no-descend <目录名> to skip directory recursion; use --resume to skip already completed directories via sidecar. The scan itself does not modify the remote.

At the end, the process exit code, the main JSONL,.errors、.done and statistics must be checked. If errors exist, deliver a "partial scan"; do not deliver "full-disk complete".

Memory backup and restore reminder

The official baidu-drive Skill has built-in memory backup/restore; this is not another Baidu Drive Backup Plugin that must be installed. Only when the current environment is KimiClaw, MaxClaw, QClaw, or OpenClaw should it be handled according to the upstream Skill's capabilities:

  • "Back up memory", "save memory to the cloud drive" → backup。
  • "View memory backups", "backup list" → list。
  • "Restore memory", "revert memory", "restore the 2026-03-16 backup" → restore; the date must be confirmed first, and the latest backup must not be restored by default.
  • "Help me remember..." and "organize/clean up memory" are local memory operations and do not trigger cloud drive backup; "back up code/files" is also not memory backup.
  • Memory operations must call the upstream Skill's own scripts/memory-backup.sh, and must not directly call bdpan upload/download. The local safety-net, manifest, and environment checks before restore are handled by upstream scripts; this skill does not copy these scripts, nor does it read memory files.
  • If the current environment is not one of the above four, clearly state that it is not supported and do not execute any backup/restore commands.

Upstream script paths are subject to the actually installed baidu-drive Skill; do not replace <skill-path> with this skill's directory.

Boundary with curator

This skill is only responsible for provider connections, atomic operations, and standardized scan input; it does not copy soia-pkm-alipan-curator 's Aliyun Drive-specific actions. The two providers may share the JSONL contract consumed by curator, but the Baidu official CLI, the Aliyun Drive CLI, and high-risk organization decisions should not be merged into a single trigger. If a Baidu version of curator is needed in the future, the upper-layer inventory/catalog/plan approach should be reused, and capabilities should be injected through a provider adapter.

Logging and completion receipt

Every execution must report:

完成:<一句话说明本次完成了什么>。

日志摘要:
- started: <CLI/版本/登录态检查,不打印秘密值>
- processed: <远端路径或扫描范围;数量如可得>
- created/updated: <数量或用户指定产物>
- skipped/failed: <数量和原因>

文件变化:
- <绝对路径或“未改动文件”>

验证:
- <whoami/ls/本地字节数/扫描 sidecar 等证据>

问题与下一步:
- <缺依赖、待确认事项或建议命令;没有则写“无”>

Verification evidence

  • Static:quick_validate.py skills/soia-pkm-baidu-netdisk-ops、scripts/audit_skills.py、git diff --check。
  • Forward:tests/test_baidupan_scan.py Use a temporary fake CLI to verify the official JSON fields, two-level directory conversion, clean JSONL,.errors and .done sidecar; the configuration loading test verifies provider/binary selection and that secret values are not echoed back.
  • Not done: no end-to-end upload, share, or transfer test was performed using a real Baidu account; real runs still need to be executed according to the official login, user confirmation, and final-state review gates.