cosh-tools
Tools crate for cosh — a coding agent for the terminal.
cosh-tools implements every tool the cosh agent harness exposes to the LLM: filesystem operations, bash execution, search, LSP, web, desktop control, skills, subagents, planning, and structured user questions. Each tool is a self-contained async builder API plus an MCP-schema tool description, so the crate can be used standalone in your own agent — the same tools the cosh app registers.
Highlights
- Sandboxed file editing — reads carry a
file_hashthat writes must verify; edits are anchored on hashline tags with per-target errors, plus fuzzy-equivalent matching and AST-based structural rewrites (ast-grep+tree-sitter). Every write records a version for session rollback. - Path guarding — all paths are denied until the project root is set; write and read-only allow/blocklists, and kernel-pinned sandboxing (
openat+O_NOFOLLOW) on Unix. - Accessibility-tree-first computer tools — observe and drive native desktop apps through the OS accessibility tree (
xa11y), with screenshots and synthetic input as support. Works on X11 and Wayland. - Streaming bash — stdout/stderr streamed as chunks with exit codes, PTY mode, timeouts, and pre-spawn security validation.
- ACP subagents — dispatch to external agent harnesses (Gemini, Claude, Codex, Cline, Devin, Goose, OpenCode, Kilo) or an internal nested harness, with session resume and streamed turns.
- LSP integration — definitions, references, renames, call hierarchy and passive diagnostics feedback on touched files.
- Skills system — schema-driven
SKILL.mdcapability packs with glob matching and sandboxed asset reads. - Vector recall (optional,
embedfeature) — embedding-agnostic LanceDB similarity search.
Tools
| Module | Tools |
|---|---|
fs |
fs_read, fs_write, fs_edit, fs_edit_lines, fs_ast_edit, fs_rollback |
bash |
bash_run |
find |
find_glob, find_grep |
lsp |
lsp_definitions, lsp_references, lsp_symbols, lsp_rename, lsp_hover, lsp_code_actions, … |
computer |
computer_apps, computer_snapshot, computer_act, computer_control, computer_screenshot, computer_wait |
web |
web_fetch, web_search |
skills |
skills_list, skills_read, skills_read_asset, skills_match_skills |
subagent |
subagent_call |
plan |
plan_todo_write |
question |
ask_questions |
recall (embed) |
recall_search |
Usage
use ;
async
More examples in examples/ — run with cargo run --example fs-read (also bash, computer-control, …).
Requirements
- Rust 2024 edition (≥ 1.85)
- The
computermodule needs an OS accessibility stack (X11 or Wayland) - External agent CLIs only if dispatching to them via
subagent_call
Related crates
cosh-sdk— agent harness SDKcosh-recall— memory and context recallcosh-tui— terminal interface
License
Apache-2.0. See LICENSE.