From 4998bb433b9c7baa88e3e3d3e843c0ccbbef9f95 Mon Sep 17 00:00:00 2001 From: Leonard Kugis Date: Fri, 10 Apr 2026 20:50:32 +0200 Subject: Refined dev role Now it uses wrapped tool scripts instead of raw bash commands. Together with JSON function mapping this enables better use-case fitting and less errors in tool usage (e.g. partial file writes with out-of-context deletions). --- agents/dev/index.yaml | 13 +++++++++---- agents/dev/tools.txt | 6 ++++++ tools/execute_command.sh | 2 +- tools/fs_patch.sh | 9 +++++++++ 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/agents/dev/index.yaml b/agents/dev/index.yaml index 9bcc870..30b7b86 100644 --- a/agents/dev/index.yaml +++ b/agents/dev/index.yaml @@ -18,15 +18,20 @@ If it is already initialized, simply continue using it. After each request including writes to files within `/work`, perform a git commit with a reasonable commit message If a checkout to a previous state is requested, do it also with git For shell commands, use `execute_command`. -If single patches are too big (more than 100 lines affected in total), split them into multiple patches. +To simply write text or code to files, use `fs_write`. +To apply changes in text or code to files, use `fs_patch`. +To list files of a given path, use `fs_ls`. +To delete a file under a given path, use `fs_rm`. +To create a directory, use `fs_mkdir`. +After writing a partial file, always continue and do not rewrite it. To regain context, perform `fs_cat` on the file. Use absolute paths whenever possible and dont assume a `cd` state. Whenever a website / URL `download`, `lookup`, `scrape`, `view` or `content extraction` is requested, do the following: Use `curl` and `lynx` with `execute_command`. -For coding or technical related requests directly related to the website use `curl -fsSL -L ""` if applicable (you will receive the page source to stdout). -For content related requests, use `curl -fsSL -L "" | lynx -stdin -dump | iconv -f UTF-8 -t UTF-8 -c` if applicable (you will receive a text-only dump to stdout from lynx). ALWAYS use lynx and ALWAYS use iconv, because lynx sometimes spits out illegal symbols crashing the model. +For coding or technical related requests directly related to the website use `curl -fsSL -L "URL"` if applicable (you will receive the page source to stdout). +For content related requests, use `curl -fsSL -L "URL" | lynx -stdin -dump | iconv -f UTF-8 -t UTF-8 -c` if applicable (you will receive a text-only dump to stdout from lynx). ALWAYS use lynx and ALWAYS use iconv, because lynx sometimes spits out illegal symbols crashing the model. Before doing requests with giant text, perform feature extraction For feature extraction use `grep`, `sed` or `awk` with useful keywords and reasonable surrounding on the text. Only if results are unsatisfactory, use the entire page. -Whenever using `web_search`: +Whenever using `web_search`, Keep queries short (< 250 chars). Only use alphanumeric characters and spaces in the query. When executing python scripts, do the following. diff --git a/agents/dev/tools.txt b/agents/dev/tools.txt index c51e5df..bfdd625 100644 --- a/agents/dev/tools.txt +++ b/agents/dev/tools.txt @@ -1 +1,7 @@ +execute_command.sh fs_patch.sh +fs_cat.sh +fs_mkdir.sh +fs_ls.sh +fs_write.sh +fs_rm.sh diff --git a/tools/execute_command.sh b/tools/execute_command.sh index b98aa55..c6504bf 100755 --- a/tools/execute_command.sh +++ b/tools/execute_command.sh @@ -68,7 +68,7 @@ main() { # Run command (do not let failures exit the tool) set +e - bash -lc "$cmd" >"$out_file" 2>"$err_file" + : | bash -lc "$cmd" >"$out_file" 2>"$err_file" rc=$? set -e diff --git a/tools/fs_patch.sh b/tools/fs_patch.sh index 2d9d7e4..a87cef5 100755 --- a/tools/fs_patch.sh +++ b/tools/fs_patch.sh @@ -6,6 +6,15 @@ set -uo pipefail # @option --path The path of the file to apply to # @option --contents The patch to apply to the file # @env LLM_OUTPUT=/dev/stdout The output path +# +# Example: +# --- a/hello.py +# +++ b/hello.py +# \@@ ... @@ +# def hello(): +# - print("Hello World") +# + name = input("What is your name? ") +# + print(f"Hello {name}") ROOT_DIR="${LLM_ROOT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)}" OUT="${LLM_OUTPUT:-/dev/stdout}" -- cgit v1.2.3