跨平台基础工具集builtin-tools

张开发
2026/5/28 8:05:54 15 分钟阅读
跨平台基础工具集builtin-tools
Builtin ToolsSkillHubBuiltin Tools(ClawHub)name: builtin-toolsauthor: 王教成 Wang Jiaocheng (波动几何)description: 跨平台基础工具集 — 16 个独立可组合的 Python 脚本替代 Agent 平台缺失的基础工具能力。文件系统浏览/搜索/读写/替换/删除、内容搜索正则、网络搜索/抓取/预览、运行时安装、持久化记忆、定时任务、任务管理。纯 Python 标准库零外部依赖跨 Windows/macOS/Linux。自举设计execute_command.py 可调度所有其他脚本平台只需支持一条 Python 命令即可全量使用。builtin-tools — 跨平台基础工具集定位当宿主 Agent 平台缺少某个基础工具时用本技能的脚本补足。所有脚本纯 Python 标准库实现零外部依赖跨 Windows/macOS/Linux。核心规则优先用宿主平台内置工具— 仅在平台不支持时回退到本技能脚本通过 execute_command 调用— 所有脚本接受 JSON 输入输出 JSON 结果自举设计—execute_command.py可调度所有其他脚本只需平台支持执行一条 Python 命令脚本清单脚本功能调用方式execute_command.py自举入口 命令执行 管道串联见下方详细说明list_dir.py目录浏览python list_dir.py {path:.,ignore:[*.log]}search_file.py文件名搜索python search_file.py {pattern:*.py,recursive:true}read_file.py读取文件python read_file.py {path:f.txt,offset:0,limit:50}write_file.py写入文件python write_file.py {path:f.txt,content:hello}replace_in_file.py精确替换python replace_in_file.py {path:f.txt,old:a,new:b}delete_file.py删除文件python delete_file.py {path:f.txt}search_content.py正则内容搜索python search_content.py {pattern:TODO,path:.}web_search.py网页搜索python web_search.py {query:Python,engine:duckduckgo}web_fetch.py网页抓取python web_fetch.py {url:https://...}preview_url.py浏览器预览python preview_url.py {url:https://...}install_binary.py运行时安装python install_binary.py {type:python,version:3.13.12}update_memory.py持久化记忆python update_memory.py {action:create,title:...,content:...}automation_update.py定时任务python automation_update.py {mode:create,name:...,prompt:...,rrule:...}todo_write.py任务管理python todo_write.py {todos:[{id:1,status:in_progress,content:...}]}execute_command.py 详细用法模式 1执行系统命令{mode:command,command:ls -la,timeout:30,cwd:/tmp}模式 2执行内置脚本{mode:script,script:list_dir,params:{path:.}}模式 3打开 URL/文件{mode:open,url:https://example.com}模式 4管道串联多个脚本{mode:pipe,chain:[search_file,search_content],params:{pattern:*.py}}快捷模式python execute_command.py search_file{pattern:*.py}python execute_command.py--commandecho helloJSON 协议所有脚本遵循统一协议输入JSON 字符串命令行第一个参数 或 stdin输出{status:ok,data:{...},message:ok}或{status:error,code:N,message:...}Exit Code0成功, 1参数错误, 2执行失败, 3不支持的平台目录结构builtin-tools/ ├── SKILL.md # 本文件 ├── scripts/ │ ├── common.py # 公共层Shell执行/JSON协议/路径处理 │ ├── execute_command.py # 自举入口 │ ├── list_dir.py # 目录浏览 │ ├── search_file.py # 文件名搜索 │ ├── read_file.py # 读取文件 │ ├── write_file.py # 写入文件 │ ├── replace_in_file.py # 精确替换 │ ├── delete_file.py # 删除文件 │ ├── search_content.py # 正则内容搜索 │ ├── web_search.py # 网页搜索 │ ├── web_fetch.py # 网页抓取 │ ├── preview_url.py # 浏览器预览 │ ├── install_binary.py # 运行时安装 │ ├── update_memory.py # 持久化记忆 │ ├── automation_update.py # 定时任务 │ └── todo_write.py # 任务管理 └── references/ └── protocol.md # 接口协议详细文档安全策略execute_command.py不使用shellTrueWindows 用 list 参数传递给 powershell.exedelete_file.py禁止删除根目录和用户主目录replace_in_file.py默认限制替换次数防止误操作install_binary.py下载后校验文件完整性

更多文章