# 编码器

编码器家族正是让 OpenHuman 成为一个可行的编码伙伴，而不是一个假装 *知道* 代码库的聊天窗口。

## 该家族中的工具

| 工具               | 它的作用                    |
| ---------------- | ----------------------- |
| `file_read`      | 读取文件（带行号，类似 `cat -n`).  |
| `file_write`     | 写入新文件。                  |
| `edit_file`      | 有针对性的编辑——带严格唯一性检查的查找替换。 |
| `apply_patch`    | 应用统一 diff。              |
| `glob_search`    | 按 glob 模式查找文件。          |
| `grep`           | 类似 ripgrep 的树形搜索。       |
| `list_files`     | 遍历目录树。                  |
| `read_diff`      | 两个文件或修订版本之间的差异。         |
| `git_operations` | 状态、差异、日志、责备、分支、提交。      |
| `run_linter`     | 运行项目的代码检查器。             |
| `run_tests`      | 运行项目的测试命令。              |
| `csv_export`     | 将查询结果导出为 CSV。           |

## 为什么这些是原生工具，而不是仅靠 shell

一个 shell 工具加上 `cat`/`sed`/`awk` 可以 *技术上* 完成所有这些。原生工具之所以存在，是因为：

* 编辑会经过唯一性检查，因此代理不会意外覆盖错误的行。
* 读取结果会带有行号，代理可以在后续中引用。
* Git 操作会将输出解析为结构化数据，而不是让代理去抓取纯文本输出。
* Lint 和测试运行都绑定到项目的实际命令，而不是通用猜测。

## 工作区作用域

文件系统工具遵守工作区边界——未经明确许可，代理不能在其外部读取或写入。其余应用在 `OPENHUMAN_WORKSPACE`.

## 另见

* [系统与实用工具](/openhuman/zh/gong-neng/native-tools/system-and-utilities.md) - `shell`, `node_exec`, `npm_exec` 用于开发循环的其余部分。
* [代理协同](/openhuman/zh/gong-neng/native-tools/agent-coordination.md) - `todo_write`, `spawn_subagent` 用于更大的重构。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://tinyhumans.gitbook.io/openhuman/zh/gong-neng/native-tools/coder.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
