diff --git a/internal/agent/prompts/hwlab-v02-runtime.md b/internal/agent/prompts/hwlab-v02-runtime.md index dc03a26d..4128ca01 100644 --- a/internal/agent/prompts/hwlab-v02-runtime.md +++ b/internal/agent/prompts/hwlab-v02-runtime.md @@ -21,8 +21,11 @@ When the user asks what skills are visible, mention the HWLAB bundle skills by n MiniMax-M3 tool-call guidance: - Keep every command tool call argument as valid JSON. Put shell metacharacters, pipes, quotes, and newlines inside one command string instead of emitting partial JSON fragments. +- Prefer one short, single-purpose command per tool call. Do not emit multi-line inline scripts or large quoted programs as a command argument; complex quoting has repeatedly produced invalid tool-call JSON with MiniMax-M3. - Prefer `rg` for repository search. If `rg` is unavailable, use `find ... -name` plus plain `grep`; BusyBox `grep` may not support GNU flags such as `--include`. - Treat optional tool probes as non-terminal checks: use `command -v rg >/dev/null 2>&1 || true` or a separate short command, then choose the available path. Do not let an optional missing tool mark the whole verification as failed. +- The AgentRun runner does not guarantee `python3` or `jq`. Do not use them unless a separate `command -v python3` or `command -v jq` probe succeeds. Prefer `node -e` only for short one-line JSON checks; otherwise use multiple `grep -F` checks against saved JSON. +- For `/v1/skills` verification, prefer this low-quoting sequence: `curl -fsS http://74.48.78.17:19666/v1/skills -o /tmp/skills.json`, then separate `grep -F` commands for the expected `commitId`, `device-pod-cli`, `hwlab-agent-runtime`, `hwpod`, and `unidesk-ssh` strings. - For GitHub issue/PR reads, prefer `gh issue view --repo owner/name --json title,body,state,comments` or `gh pr view ... --json ...`; avoid plain `gh issue view` output that can be polluted by Projects Classic GraphQL warnings. - If a command fails because the command arguments were malformed, report the malformed command and retry once with a shorter single-purpose command. diff --git a/internal/agent/runtime-prompt.test.mjs b/internal/agent/runtime-prompt.test.mjs new file mode 100644 index 00000000..0ae2a285 --- /dev/null +++ b/internal/agent/runtime-prompt.test.mjs @@ -0,0 +1,18 @@ +import assert from "node:assert/strict"; +import { readFile } from "node:fs/promises"; +import test from "node:test"; + +const runtimePromptPath = new URL("./prompts/hwlab-v02-runtime.md", import.meta.url); + +test("HWLAB v0.2 runtime prompt constrains MiniMax-M3 tool calls", async () => { + const prompt = await readFile(runtimePromptPath, "utf8"); + assert.match(prompt, /MiniMax-M3 tool-call guidance/u); + assert.match(prompt, /one short, single-purpose command/u); + assert.match(prompt, /Do not emit multi-line inline scripts/u); + assert.match(prompt, /does not guarantee `python3` or `jq`/u); + assert.match(prompt, /command -v python3/u); + assert.match(prompt, /multiple `grep -F` checks/u); + assert.match(prompt, /curl -fsS http:\/\/74\.48\.78\.17:19666\/v1\/skills -o \/tmp\/skills\.json/u); + assert.match(prompt, /device-pod-cli/u); + assert.match(prompt, /unidesk-ssh/u); +});