Skip to content

llama-atmosphere-agent: general-purpose default prompt; cross-platform ShellToolTest - #450

Merged
bernardladenthin merged 3 commits into
mainfrom
agent-general-purpose-prompt
Sep 21, 2026
Merged

bernardladenthin merged 3 commits into
mainfrom
agent-general-purpose-prompt

Conversation

@bernardladenthin

Copy link
Copy Markdown
Owner

Why

With --allow-shell, Qwen3-4B refused "lokal läuft docker, kannst du alle verfügbaren images listen" ("my tools are only for files") although run_command was registered and docker was on PATH. A fresh single-turn run refused too, so the chat history was not the cause — the prompt was: the default called the agent a "careful coding agent" and described run_command as a way "to build, test or inspect the project"; the tool description said "build, test, grep or list files".

Experiments (Qwen3-4B-Instruct-2507, Vulkan, RTX 3070):

Prompt Question Result
old default docker images? refuses
old default "run docker images with run_command" calls the tool
--system "run_command executes ANY command…" docker images? calls the tool
new default (this PR) docker images? calls run_command {command=docker images}
old default, Qwen2.5-Coder-7B docker images? writes the call as a JSON code block instead of calling the tool

What

  • LocalAgent.systemPrompt: a general-purpose assistant on the user's machine. With --allow-shell it states that run_command executes any command line through the named shell (cmd.exe on Windows, sh elsewhere), starting in the workspace but not limited to it, and that the model should run a command instead of explaining one. Without the flag it says commands are unavailable and names the flag. Answers in the user's language.
  • ShellTool: description widened; isWindows() / shellName() shared with the prompt.
  • ShellToolTest runs on every platform: each test picks its command with ShellTool.isWindows() (the same detection ShellTool.run uses), instead of POSIX-only commands that failed 4 of 5 on Windows.
  • READMEs: general-purpose wording, an "everything at once" example with --allow-shell --system '…', a "The system prompt" section, generic paths only. CLAUDE.md: why the prompt must not be narrowed back.

--allow-shell stays opt-in.

Verified

  • Windows 11: all 31 agent tests + spotless:check green.
  • Linux (maven:3.9-eclipse-temurin-21): ShellToolTest 5/5, AgentOptionsTest 11/11.
  • Live, see table above.

🤖 Generated with Claude Code

https://claude.ai/code/session_01E2h8gXyyE5UeimkL9vQv9G

bernardladenthin and others added 2 commits September 21, 2026 21:01
…or any command

The default system prompt called the agent a "careful coding agent" and described
run_command as a way "to build, test or inspect the project"; the tool description
said "build, test, grep or list files". Qwen3-4B read that as a prohibition and
refused "list the docker images" ("my tools are only for files") although the tool
was registered and docker was on PATH -- in a fresh single-turn run too, so it was
the prompt, not the chat history.

- LocalAgent.systemPrompt: a general-purpose assistant on the user's machine. With
  --allow-shell it states that run_command executes any command line through the
  named shell, starting in the workspace but not limited to it, and that the model
  should run a command instead of explaining one; without it, the prompt says
  commands are unavailable and names the flag. Answers in the user's language.
- ShellTool: description widened to "any command line on this machine through
  <shell>"; isWindows()/shellName() shared with the prompt.
- READMEs: general-purpose wording, an "everything at once" example with
  --allow-shell --system, a "The system prompt" section, generic paths only.
- CLAUDE.md: why the prompt must not be narrowed back; ShellToolTest is POSIX-only.

Verified with Qwen3-4B-Instruct-2507 on Vulkan: the same question now calls
run_command {command=docker images} with the default prompt.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E2h8gXyyE5UeimkL9vQv9G
ShellToolTest used POSIX commands (ls, sleep, printf, `; exit 3`) and failed 4 of 5
tests on Windows, where ShellTool runs cmd.exe /c. Each test now picks its command
line with ShellTool.isWindows() -- the same detection ShellTool.run uses to choose
the shell -- so it always speaks the shell the tool actually starts:

- ls / dir /b
- `echo boom 1>&2; exit 3` / `echo boom 1>&2 & exit 3`
- truncation: echo on both, the expected length counts the platform's line
  separator (\n from sh, \r\n from cmd.exe)
- sleep 30 / ping -n 30 127.0.0.1 >nul (also a child of the shell, so the
  descendant kill stays covered)

Verified: Windows 11 (all 31 agent tests), Linux in maven:3.9-eclipse-temurin-21
(ShellToolTest 5/5, AgentOptionsTest 11/11).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E2h8gXyyE5UeimkL9vQv9G
The system prompt and the run_command description were Java string
concatenations. They are now plain text next to the classes, in
src/main/resources/net/ladenthin/llama/atmosphere/:

- system-prompt.txt          ({workspace}, {shell_section})
- system-prompt-shell.txt    ({shell}; the section with --allow-shell)
- system-prompt-no-shell.txt (the section without it)
- run-command-tool.txt       ({shell}; the tool description)

each with a .license sidecar so REUSE stays green without an SPDX comment
reaching the model. LocalAgent.prompt(name) loads them (UTF-8, trimmed; a
missing file throws). New test promptResourcesLoadAndEveryPlaceholderIsFilled
fails on a missing file or a placeholder left unfilled; the tool-description
test checks the same. README and CLAUDE.md point at the files.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E2h8gXyyE5UeimkL9vQv9G
@bernardladenthin
bernardladenthin merged commit efc8c33 into main Sep 21, 2026
7 of 11 checks passed
@bernardladenthin
bernardladenthin deleted the agent-general-purpose-prompt branch September 21, 2026 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant