Files
homeagent-sdk/example/localuse/skill/localuse-tools/SKILL.md
root db58f66d83 docs(skills): 按需插件 skill 对齐仓内规范 + 文件操作强制走 files 插件
## 1. 文件操作必须走 files 插件(用户明确要求)

旧 skill 写着「如果你已经有 run_shell / bash 之类的能力,优先用那个 —— 它更直接」,
与「文件操作必须走 files_*」相悖。改为:

- 所有已知内容的读写一律 files_read/files_write/files_edit/files_edit_line;
- 不用 cat/echo/sed/tee/重定向代替(shell 拼长文本会被引号转义吃掉,
  且重定向会截断原文件,而本插件是原子写 + 写前留档);
- 唯一例外:文件是命令的副产物(go build -o、git clone、日志重定向)。

cmd-tools skill 同步补一条:文件读写不要用 shell 代替。

## 2. 三个新 skill 对齐 ai_image 等既有规范

- 结构统一为:什么时候用 / 先拉起插件(plugin_start 代码块)/ 工具表 /
  用完可释放(plugin_stop)/ 注意 / 「plugin_stop vs plugin_disable」对照表;
- 修正上一版的错误:把 `plugin_enable` 写成拉起方式 —— 那是**持久**解禁,
  会改开机行为;按需拉起应使用 `plugin_start name=<插件>`。
- files skill 保持 auto_start=false(与「大部分插件不需要自启」一致),
  但把「怎么拉起」写清楚。

## 3. cmd_run 描述补充能力边界

「经完整 bash 执行,支持管道、分号、&&、命令替换、heredoc、重定向;
不支持交互(vim/ssh/top 用 terminal_create)」。

验证:四工程 hmapdev 构建通过;本机重装后 skills_registered=1;
问 agent 写文件时它先 plugin_start 再 files_write/files_read,未用 shell 代替。
2026-10-20 08:57:53 +08:00

54 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
name: localuse-tools
description: 本机外设:截屏/看屏、摄像头、扬声器、剪贴板、整机操控。按需工具:先 plugin_start localuse,用完可 plugin_stop。
---
# 本地外设
## 什么时候用
用户要求**看本机屏幕 / 拍一张 / 读剪贴板 / 操作本机界面**时。
纯文本任务不要拉它——外设能力会占住屏幕与麦克风。
## 先拉起插件
```
plugin_start name=localuse
```
| 工具 | 用途 |
|---|---|
| `local_screensee` | 截屏当前画面(返回图片) |
| `local_screensue` | 主动操作屏幕(点击/键入) |
| `local_camerasue` | 摄像头拍照 |
| `local_speakeruse` | 扬声器播放 |
| `local_clipboardsee` | 读剪贴板 |
| `local_clipboardsue` | 写剪贴板 |
| `local_computeruse` | 整机操控 |
命名约定:`see` = 只读观察,`sue` = 主动执行。
## 用完可释放
```
plugin_stop name=localuse
```
## 注意
- 摄像头 / 麦克风 / 整机操控属于敏感操作,**先向用户确认**再执行。
- 依赖系统工具(Linux 下截图用 scrot / import / gnome-screenshot 任一),
全都缺时会明确报错,不要反复重试。
## ★ 用 plugin_stop / plugin_start,不要用 plugin_disable / plugin_enable
| 工具 | 作用 | 跨重启 |
|---|---|---|
| `plugin_stop` | **运行态**关闭,现在停掉 | **不影响**,重启照常加载 |
| `plugin_start` | **运行态**拉起,现在开回来 | 不影响 |
| `plugin_disable` | **持久**禁用 | **会记下来**,开机也不自启 |
| `plugin_enable` | 解除持久禁用 | 会记下来 |
**释放上下文用 `plugin_stop`。** 本插件声明 `auto_start: false`,本来就不自启;
但 `plugin_disable` 仍会写进持久禁用清单,让 `plugin_start` 拒绝拉起。