hive.terminal-tools-foundations
它能做什么
这个技能说明 AI 如何在你的电脑上运行命令、读取和编辑文件以及搜索文件夹。适合希望 AI 在项目文件夹中进行实际操作的人。
适用场景
- ✓当你的 AI 需要在你的电脑上运行命令,例如构建或测试的时候。
- ✓当你希望 AI 在项目中搜索文字或文件名的时候。
- ✓当某项任务需要编辑项目文件夹中的文件时。
技能链接
https://github.com/aden-hive/hive/blob/main/core/framework/skills/_preset_skills/terminal-tools-foundations/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请在我的项目文件夹中运行测试,并告诉我哪些测试失败了。”
每周 5 个新技能,1 分钟读完。
工作原理
AI 会在适合你系统的 shell 中运行命令,例如 Git Bash 或 PowerShell,并读取结果。它也可以在你工作的文件夹中搜索文件并进行编辑。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
terminal-tools — foundations
These tools provide command execution, background jobs, log streaming, filesystem search, and optional PTY sessions. POSIX uses bash for shell commands; Windows selects Git Bash, PowerShell, then cmd. Inspect shell_kind in results.
Tool preference (read first)
Use search_tools(query="inventory") before describing capabilities. It reports this session's loaded, searchable, disabled, and configured-but-unavailable tools. Load searchable tools by exact name. An absent schema alone does not prove a capability is missing; configuration does not prove credentials or connectivity work. Terminal tools and coding file tools default to the injected session workdir; an explicit absolute path overrides it.
- Reading files → use
read_filebeforeedit_filewhen the coding tools are enabled; it records file state for the stale-edit guard. Otherwise use a command appropriate toshell_kind. - Editing files → prefer
edit_filewhen enabled. Replacement mode requires a unique match unlessreplace_all=true; patch mode validates all operations before writing. Inspect its changed-file summary and diff. Re-read files after external changes. Terminal editing remains available when coding tools are disabled. - Writing files → heredoc:
terminal_exec("cat > PATH <<'EOF' ... EOF") - Searching →
terminal_rg(content / regex grep) andterminal_glob(find files by name) - Browser / web pages → call
browser_setup, read the browser skill, then runhive-browser <command> --jsonthroughterminal_exec. - Web search → check the inventory for
web_searchand load it if available; verify required credentials. Do not invent a callable tool name. - System operations (process exec, jobs, PTYs) → terminal-tools. This is its territory.
The standard envelope
Every spawn-style call (terminal_exec, the auto-promoted job state) returns this shape:
{
"exit_code": 0, // null when auto-backgrounded or pre-spawn error
"stdout": "...", // decoded, truncated to max_output_kb (default 256 KB)
"stderr": "...",
"stdout_truncated_bytes": 0, // > 0 means more is in output_handle
"stderr_truncated_bytes": 0,
"runtime_ms": 42,
"pid": 12345,
"output_handle": null, // "out_<hex>" when truncated — paginate with terminal_output_get
"timed_out": false,
"semantic_status": "ok", // "ok" | "signal" | "error" — read THIS, not just exit_code
"semantic_message": null, // e.g. "No matches found" for grep exit 1
"warning": null, // e.g. "may force-remove files" for rm -rf
"auto_backgrounded": false,
"job_id": null, // set when auto_backgrounded=true
"shell_kind": "bash" // interpreter that ran it: "bash" | "powershell" | "cmd" | "direct"
}
Auto-promotion (the core mental model)
The agent loop first waits up to five seconds for terminal_exec. A slower call returns a bg_* handle; redeem it with collect_result. The terminal's own promotion threshold defaults to 30 seconds. Past that threshold it transfers the process to its job manager and returns:
{ "auto_backgrounded": true, "exit_code": null, "job_id": "job_<hex>", ... }
When you see auto_backgrounded: true, pivot to polling. The job is still running:
terminal_job_logs(job_id, since_offset=0, wait_until_exit=true, wait_timeout_sec=30)
→ blocks server-side until the job exits or the timeout, returns logs + status
You're not failing — you're freed up to do other work while the long task runs.
collect_result does not redeem job_id: after collecting a promoted call, use terminal_job_logs until status is exited. Track separate stdout/stderr offsets; use terminal_job_manage(action="signal_term", job_id=...) to cancel. Poll waits are capped at 45 seconds and do not extend execution deadlines. Job retrieval/management ship with basic exec; explicit job creation and PTYs require the advanced category.
timeout_sec defaults to 60 seconds from command start, including time after promotion. Expiry terminates the owned process tree; final logs report timed_out=true. A deadline at or before promotion kills inline. Set timeout_sec=0 for unlimited execution with promotion enabled. To keep execution foreground, set auto_background_after_sec=0 and a finite timeout of at most 220 seconds (or less if the caller has a smaller b
常见问题
在 Windows 上它使用哪个 shell?
它会优先选择 Git Bash,其次是 PowerShell,再其次是 cmd,并在每次结果中标明 shell 的类型。
它可以在项目文件夹之外工作吗?
可以。明确指定的绝对路径会覆盖默认的项目文件夹。
编辑文件之前它会检查吗?
会。它会先读取文件,并使用需要唯一匹配的编辑步骤,除非另有指示。
详情
作者的原始描述
Required when terminal_* tools are available. Explains foreground execution, outer collect_result handles, promoted job IDs and their retrieval/cancellation, deadlines, output retention, platform shell selection, and structured editing when enabled.
repo: aden-hive/hive
热度
- GitHub 星标
- 11k
- 排名
- #11812
- 许可证
- Apache-2.0
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
browser-edge-cases
11k帮你的智能体修复在 LinkedIn、X 或脚本繁重的页面等复杂网站上失败的浏览器自动化任务。
hive.browser-automation
11k教你的智能体使用 hive-browser 工具控制你自己的 Chrome 浏览器,通过截图和点击完成操作。
hive.colony-progress-tracker
11k帮你的智能体认领任务,并把它的步骤和检查记录在共享数据库中,让工作在进行中就被跟踪。
hive.context-preservation
11k帮你的智能体在较早的细节从记忆中被移除之前,把长篇工具结果中的关键事实保存到笔记里。