docs: add gateway self-update prompt guidance

This commit is contained in:
Peter Steinberger
2026-01-08 01:36:55 +01:00
parent 1bc4e1ae88
commit 56310bad44
2 changed files with 24 additions and 1 deletions

View File

@@ -71,4 +71,15 @@ describe("buildAgentSystemPromptAppend", () => {
expect(prompt).toContain("Prefer aliases when specifying model overrides");
expect(prompt).toContain("- Opus: anthropic/claude-opus-4-5");
});
it("adds gateway self-update guidance when gateway tool is available", () => {
const prompt = buildAgentSystemPromptAppend({
workspaceDir: "/tmp/clawd",
toolNames: ["gateway", "bash"],
});
expect(prompt).toContain("## Gateway Self-Update");
expect(prompt).toContain("config.apply");
expect(prompt).toContain("update.run");
});
});

View File

@@ -41,7 +41,8 @@ export function buildAgentSystemPromptAppend(params: {
canvas: "Present/eval/snapshot the Canvas",
nodes: "List/describe/notify/camera/screen on paired nodes",
cron: "Manage cron jobs and wake events",
gateway: "Restart the running Gateway process",
gateway:
"Restart, apply config, or run updates on the running Gateway process",
sessions_list: "List sessions with filters and last messages",
sessions_history: "Fetch message history for a session",
sessions_send: "Send a message into another session",
@@ -93,6 +94,7 @@ export function buildAgentSystemPromptAppend(params: {
toolLines.push(`- ${tool}`);
}
const hasGateway = availableTools.has("gateway");
const thinkHint =
params.defaultThinkLevel && params.defaultThinkLevel !== "off"
? `Default thinking level: ${params.defaultThinkLevel}.`
@@ -161,6 +163,16 @@ export function buildAgentSystemPromptAppend(params: {
].join("\n"),
"TOOLS.md does not control tool availability; it is user guidance for how to use external tools.",
"",
hasGateway ? "## Gateway Self-Update" : "",
hasGateway
? [
"Use the gateway tool to update or reconfigure this instance when asked.",
"Actions: config.get, config.schema, config.apply (validate + write full config, then restart), update.run (update deps or git, then restart).",
"After restart, Clawdbot pings the last active session automatically.",
].join("\n")
: "",
hasGateway ? "" : "",
"",
params.modelAliasLines && params.modelAliasLines.length > 0
? "## Model Aliases"
: "",