fix: add reasoning visibility hint
This commit is contained in:
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
- Agents/System: clarify sandboxed runtime in system prompt and surface elevated availability when sandboxed.
|
- Agents/System: clarify sandboxed runtime in system prompt and surface elevated availability when sandboxed.
|
||||||
|
- Agents/System: add reasoning visibility hint + /reasoning and /status guidance in system prompt.
|
||||||
- Auto-reply: prefer `RawBody` for command/directive parsing (WhatsApp + Discord) and prevent fallback runs from clobbering concurrent session updates. (#643) — thanks @mcinteerj.
|
- Auto-reply: prefer `RawBody` for command/directive parsing (WhatsApp + Discord) and prevent fallback runs from clobbering concurrent session updates. (#643) — thanks @mcinteerj.
|
||||||
- WhatsApp: fix group reactions by preserving message IDs and sender JIDs in history; normalize participant phone numbers to JIDs in outbound reactions. (#640) — thanks @mcinteerj.
|
- WhatsApp: fix group reactions by preserving message IDs and sender JIDs in history; normalize participant phone numbers to JIDs in outbound reactions. (#640) — thanks @mcinteerj.
|
||||||
- WhatsApp: expose group participant IDs to the model so reactions can target the right sender.
|
- WhatsApp: expose group participant IDs to the model so reactions can target the right sender.
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ The prompt is intentionally compact and uses fixed sections:
|
|||||||
- **Reply Tags**: optional reply tag syntax for supported providers.
|
- **Reply Tags**: optional reply tag syntax for supported providers.
|
||||||
- **Heartbeats**: heartbeat prompt and ack behavior.
|
- **Heartbeats**: heartbeat prompt and ack behavior.
|
||||||
- **Runtime**: host, OS, node, model, thinking level (one line).
|
- **Runtime**: host, OS, node, model, thinking level (one line).
|
||||||
|
- **Reasoning**: current visibility level + /reasoning toggle hint.
|
||||||
|
|
||||||
## Workspace bootstrap injection
|
## Workspace bootstrap injection
|
||||||
|
|
||||||
|
|||||||
@@ -584,6 +584,7 @@ export function buildEmbeddedSandboxInfo(
|
|||||||
function buildEmbeddedSystemPrompt(params: {
|
function buildEmbeddedSystemPrompt(params: {
|
||||||
workspaceDir: string;
|
workspaceDir: string;
|
||||||
defaultThinkLevel?: ThinkLevel;
|
defaultThinkLevel?: ThinkLevel;
|
||||||
|
reasoningLevel?: ReasoningLevel;
|
||||||
extraSystemPrompt?: string;
|
extraSystemPrompt?: string;
|
||||||
ownerNumbers?: string[];
|
ownerNumbers?: string[];
|
||||||
reasoningTagHint: boolean;
|
reasoningTagHint: boolean;
|
||||||
@@ -608,6 +609,7 @@ function buildEmbeddedSystemPrompt(params: {
|
|||||||
return buildAgentSystemPrompt({
|
return buildAgentSystemPrompt({
|
||||||
workspaceDir: params.workspaceDir,
|
workspaceDir: params.workspaceDir,
|
||||||
defaultThinkLevel: params.defaultThinkLevel,
|
defaultThinkLevel: params.defaultThinkLevel,
|
||||||
|
reasoningLevel: params.reasoningLevel,
|
||||||
extraSystemPrompt: params.extraSystemPrompt,
|
extraSystemPrompt: params.extraSystemPrompt,
|
||||||
ownerNumbers: params.ownerNumbers,
|
ownerNumbers: params.ownerNumbers,
|
||||||
reasoningTagHint: params.reasoningTagHint,
|
reasoningTagHint: params.reasoningTagHint,
|
||||||
@@ -921,6 +923,7 @@ export async function compactEmbeddedPiSession(params: {
|
|||||||
const appendPrompt = buildEmbeddedSystemPrompt({
|
const appendPrompt = buildEmbeddedSystemPrompt({
|
||||||
workspaceDir: effectiveWorkspace,
|
workspaceDir: effectiveWorkspace,
|
||||||
defaultThinkLevel: params.thinkLevel,
|
defaultThinkLevel: params.thinkLevel,
|
||||||
|
reasoningLevel: params.reasoningLevel ?? "off",
|
||||||
extraSystemPrompt: params.extraSystemPrompt,
|
extraSystemPrompt: params.extraSystemPrompt,
|
||||||
ownerNumbers: params.ownerNumbers,
|
ownerNumbers: params.ownerNumbers,
|
||||||
reasoningTagHint,
|
reasoningTagHint,
|
||||||
@@ -1301,6 +1304,7 @@ export async function runEmbeddedPiAgent(params: {
|
|||||||
const appendPrompt = buildEmbeddedSystemPrompt({
|
const appendPrompt = buildEmbeddedSystemPrompt({
|
||||||
workspaceDir: effectiveWorkspace,
|
workspaceDir: effectiveWorkspace,
|
||||||
defaultThinkLevel: thinkLevel,
|
defaultThinkLevel: thinkLevel,
|
||||||
|
reasoningLevel: params.reasoningLevel ?? "off",
|
||||||
extraSystemPrompt: params.extraSystemPrompt,
|
extraSystemPrompt: params.extraSystemPrompt,
|
||||||
ownerNumbers: params.ownerNumbers,
|
ownerNumbers: params.ownerNumbers,
|
||||||
reasoningTagHint,
|
reasoningTagHint,
|
||||||
|
|||||||
@@ -170,6 +170,17 @@ describe("buildAgentSystemPrompt", () => {
|
|||||||
expect(prompt).toContain("capabilities=inlineButtons");
|
expect(prompt).toContain("capabilities=inlineButtons");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("includes reasoning visibility hint", () => {
|
||||||
|
const prompt = buildAgentSystemPrompt({
|
||||||
|
workspaceDir: "/tmp/clawd",
|
||||||
|
reasoningLevel: "off",
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(prompt).toContain("Reasoning: off");
|
||||||
|
expect(prompt).toContain("/reasoning");
|
||||||
|
expect(prompt).toContain("/status shows Reasoning");
|
||||||
|
});
|
||||||
|
|
||||||
it("describes sandboxed runtime and elevated when allowed", () => {
|
it("describes sandboxed runtime and elevated when allowed", () => {
|
||||||
const prompt = buildAgentSystemPrompt({
|
const prompt = buildAgentSystemPrompt({
|
||||||
workspaceDir: "/tmp/clawd",
|
workspaceDir: "/tmp/clawd",
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
import type { ThinkLevel } from "../auto-reply/thinking.js";
|
import type { ReasoningLevel, ThinkLevel } from "../auto-reply/thinking.js";
|
||||||
import { SILENT_REPLY_TOKEN } from "../auto-reply/tokens.js";
|
import { SILENT_REPLY_TOKEN } from "../auto-reply/tokens.js";
|
||||||
import type { EmbeddedContextFile } from "./pi-embedded-helpers.js";
|
import type { EmbeddedContextFile } from "./pi-embedded-helpers.js";
|
||||||
|
|
||||||
export function buildAgentSystemPrompt(params: {
|
export function buildAgentSystemPrompt(params: {
|
||||||
workspaceDir: string;
|
workspaceDir: string;
|
||||||
defaultThinkLevel?: ThinkLevel;
|
defaultThinkLevel?: ThinkLevel;
|
||||||
|
reasoningLevel?: ReasoningLevel;
|
||||||
extraSystemPrompt?: string;
|
extraSystemPrompt?: string;
|
||||||
ownerNumbers?: string[];
|
ownerNumbers?: string[];
|
||||||
reasoningTagHint?: boolean;
|
reasoningTagHint?: boolean;
|
||||||
@@ -60,7 +61,7 @@ export function buildAgentSystemPrompt(params: {
|
|||||||
sessions_send: "Send a message to another session/sub-agent",
|
sessions_send: "Send a message to another session/sub-agent",
|
||||||
sessions_spawn: "Spawn a sub-agent session",
|
sessions_spawn: "Spawn a sub-agent session",
|
||||||
session_status:
|
session_status:
|
||||||
"Show a /status-equivalent status card (includes usage + cost when available); optional per-session model override",
|
"Show a /status-equivalent status card (usage/cost + Reasoning/Verbose/Elevated); optional per-session model override",
|
||||||
image: "Analyze an image with the configured image model",
|
image: "Analyze an image with the configured image model",
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -139,6 +140,7 @@ export function buildAgentSystemPrompt(params: {
|
|||||||
"<final>Hey there! What would you like to do next?</final>",
|
"<final>Hey there! What would you like to do next?</final>",
|
||||||
].join(" ")
|
].join(" ")
|
||||||
: undefined;
|
: undefined;
|
||||||
|
const reasoningLevel = params.reasoningLevel ?? "off";
|
||||||
const userTimezone = params.userTimezone?.trim();
|
const userTimezone = params.userTimezone?.trim();
|
||||||
const userTime = params.userTime?.trim();
|
const userTime = params.userTime?.trim();
|
||||||
const skillsPrompt = params.skillsPrompt?.trim();
|
const skillsPrompt = params.skillsPrompt?.trim();
|
||||||
@@ -361,6 +363,7 @@ export function buildAgentSystemPrompt(params: {
|
|||||||
]
|
]
|
||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
.join(" | ")}`,
|
.join(" | ")}`,
|
||||||
|
`Reasoning: ${reasoningLevel} (hidden unless on/stream). Toggle /reasoning; /status shows Reasoning when enabled.`,
|
||||||
);
|
);
|
||||||
|
|
||||||
return lines.filter(Boolean).join("\n");
|
return lines.filter(Boolean).join("\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user