diff --git a/Agents.md b/Agents.md index ce73749..470d739 100644 --- a/Agents.md +++ b/Agents.md @@ -736,14 +736,20 @@ available; only the auto-injected prompt text is suppressed. Coyote comes packaged with some useful built-in agents: * `coder`: An agent to assist you with all your coding tasks -* `code-reviewer`: A [CodeRabbit](https://coderabbit.ai)-style code reviewer that spawns per-file reviewers using the teammate messaging pattern +* `code-reviewer`: A [CodeRabbit](https://coderabbit.ai)-style code reviewer that spawns per-file reviewers using the + teammate messaging pattern * `demo`: An example agent to use for reference when learning to create your own agents * `deep-research`: A graph-based agent designed to perform deep web research * `explore`: An agent designed to help you explore and understand your codebase * `file-reviewer`: An agent designed to perform code-review on a single file (used by the `code-reviewer` agent) +* `librarian`: A graph-based agent that researches external references. It finds official docs, production OSS examples, + and web best practices. The "external grep" sibling of `explore` (which handles internal/codebase grep). Designed to + be delegated to by `sisyphus` whenever an unfamiliar library, API, or framework is involved. * `oracle`: An agent for high-level architecture, design decisions, and complex debugging * `report-writer`: An agent to polish research findings into clear, citation-preserving final reports -* `sisyphus`: A powerhouse orchestrator agent for writing complex code and acting as a natural language interface for your codebase (similar to ClaudeCode, Gemini CLI, Codex, or OpenCode). Uses sub-agent spawning to delegate to `explore`, `coder`, and `oracle`. +* `sisyphus`: A powerhouse orchestrator agent for writing complex code and acting as a natural language interface for + your codebase (similar to ClaudeCode, Gemini CLI, Codex, or OpenCode). Uses sub-agent spawning to delegate to + `explore`, `librarian`, `coder`, and `oracle`. * `sql`: A universal SQL agent that enables you to talk to any relational database in natural language Coyote writes these built-in agents to your agents directory on first run and never overwrites them afterward, so any diff --git a/Custom-Bash-Tools.md b/Custom-Bash-Tools.md index b138d81..f68f663 100644 --- a/Custom-Bash-Tools.md +++ b/Custom-Bash-Tools.md @@ -284,6 +284,58 @@ $ ./get_current_time.sh Fri Oct 24 05:55:04 PM MDT 2025 ``` +# Reading argument values from `LLM_TOOL_RAW_JSON` + +Coyote dispatches a bash tool call by converting the LLM's JSON arguments into shell `--option=` flags via `jq`, +then `eval`-ing the result. The flag values reach your `main` function as `argc_*` variables. For short, single-line +values this works fine. + +However, for **large multi-line values, or values dense with shell-significant characters** (markdown table pipes (`|`), +single quotes, em-dashes, etc.), the shell-quoting round-trip can occasionally drop characters or truncate the value +before it reaches your `argc_*` variable. Symptoms include `argc_*` being shorter than what the LLM sent, or starting +mid-content. + +To sidestep the shell-quoting layer entirely, read the value directly from the raw JSON envelope that Coyote exports as +the `LLM_TOOL_RAW_JSON` environment variable: + +```bash +# shellcheck disable=SC2154 +main() { + argc_contents="$(jq -r '.contents' <<< "$LLM_TOOL_RAW_JSON")" + argc_path="$(jq -r '.path' <<< "$LLM_TOOL_RAW_JSON")" + + # ... rest of your tool logic using $argc_contents and $argc_path +} +``` + +The `jq -r` ("raw") flag preserves every byte of the original LLM-sent value, including newlines, quotes, em-dashes, +and shell-special characters, without any shell-quoting layer in between. This is the pattern Coyote's bundled +`fs_write`, `fs_patch`, `execute_command`, `execute_sql_code`, and `send_mail` tools use for their large-payload +options. The argc `# @option --foo!` directives stay in your script so Coyote can build the JSON schema for the LLM +and validate the call, but your `main()` reads from `LLM_TOOL_RAW_JSON` instead of trusting argc's value capture. + +## When to use this + +- Your option's value can legitimately be many KB of text (file contents, code, email bodies, SQL queries). +- Your option's value can contain shell-significant characters in dense patterns (pipes, single quotes, ANSI escapes). +- You observe that `argc_