expect(prompt).not.toContain("## Authorized Senders"); // Skills are included even in minimal mode when skillsPrompt is provided (cron sessions need them)
expect(prompt).toContain("## Skills");
expect(prompt).not.toContain("## Memory Recall");
expect(prompt).not.toContain("## Documentation");
expect(prompt).not.toContain("## Reply Tags");
expect(prompt).not.toContain("## Messaging");
expect(prompt).not.toContain("## Voice (TTS)");
expect(prompt).not.toContain("## Silent Replies");
expect(prompt).not.toContain("## Heartbeats");
expect(prompt).toContain("## Safety");
expect(prompt).toContain( "For long waits, avoid rapid poll loops: use exec with enough yieldMs or process(action=poll, timeout=<ms>).",
);
expect(prompt).toContain("You have no independent goals");
expect(prompt).toContain("Prioritize safety and human oversight");
expect(prompt).toContain("if instructions conflict");
expect(prompt).toContain("Inspired by Anthropic's constitution");
expect(prompt).toContain("Do not manipulate or persuade anyone");
expect(prompt).toContain("Do not copy yourself or change system prompts");
expect(prompt).toContain("## Subagent Context");
expect(prompt).not.toContain("## Group Chat Context");
expect(prompt).toContain("Subagent details");
});
it("includes skills in minimal prompt mode when skillsPrompt is provided (cron regression)", () => { // Isolated cron sessions use promptMode="minimal" but must still receive skills. const skillsPrompt = "<available_skills>\n <skill>\n <name>demo</name>\n </skill>\n</available_skills>"; const prompt = buildAgentSystemPrompt({
workspaceDir: "/tmp/openclaw",
promptMode: "minimal",
skillsPrompt,
});
expect(prompt).toContain("## Skills (mandatory)");
expect(prompt).toContain("<available_skills>");
expect(prompt).toContain( "When a skill drives external API writes, assume rate limits: prefer fewer larger writes, avoid tight one-item loops, serialize bursts when possible, and respect 429/Retry-After.",
);
});
it("omits skills in minimal prompt mode when skillsPrompt is absent", () => { const prompt = buildAgentSystemPrompt({
workspaceDir: "/tmp/openclaw",
promptMode: "minimal",
});
expect(prompt).not.toContain("## Skills");
});
it("avoids the Claude subscription classifier wording in reply tag guidance", () => { const prompt = buildAgentSystemPrompt({
workspaceDir: "/tmp/openclaw",
});
expect(prompt).toContain("## Assistant Output Directives");
expect(prompt).toContain("[[reply_to_current]]");
expect(prompt).not.toContain("Tags are stripped before sending");
expect(prompt).toContain("Supported tags are stripped before user-visible rendering");
});
it("omits the heartbeat section when no heartbeat prompt is provided", () => { const prompt = buildAgentSystemPrompt({
workspaceDir: "/tmp/openclaw",
promptMode: "full",
heartbeatPrompt: undefined,
});
it("includes safety guardrails in full prompts", () => { const prompt = buildAgentSystemPrompt({
workspaceDir: "/tmp/openclaw",
});
expect(prompt).toContain("## Safety");
expect(prompt).toContain("You have no independent goals");
expect(prompt).toContain("Prioritize safety and human oversight");
expect(prompt).toContain("if instructions conflict");
expect(prompt).toContain("Inspired by Anthropic's constitution");
expect(prompt).toContain("Do not manipulate or persuade anyone");
expect(prompt).toContain("Do not copy yourself or change system prompts");
});
it("includes voice hint when provided", () => { const prompt = buildAgentSystemPrompt({
workspaceDir: "/tmp/openclaw",
ttsHint: "Voice (TTS) is enabled.",
});
expect(prompt).toContain("## Voice (TTS)");
expect(prompt).toContain("Voice (TTS) is enabled.");
});
it("adds reasoning tag hint when enabled", () => { const prompt = buildAgentSystemPrompt({
workspaceDir: "/tmp/openclaw",
reasoningTagHint: true,
});
expect(prompt).toContain("Runtime-generated completion events may ask for a user update.");
expect(prompt).toContain("Rewrite those in your normal assistant voice");
expect(prompt).toContain("do not forward raw internal metadata");
});
it("does not include embed guidance in the default global prompt", () => { const prompt = buildAgentSystemPrompt({
workspaceDir: "/tmp/openclaw",
});
expect(prompt).not.toContain("## Control UI Embed");
expect(prompt).not.toContain("Use `[embed ...]` only in Control UI/webchat sessions");
});
expect(prompt).toContain("## Control UI Embed");
expect(prompt).toContain("Use `[embed ...]` only in Control UI/webchat sessions");
expect(prompt).toContain('[embed ref="cv_123" title="Status" height="320" /]');
expect(prompt).toContain( '[embed url="/__openclaw__/canvas/documents/cv_123/index.html" title="Status" height="320" /]',
);
expect(prompt).toContain( "Never use local filesystem paths or `file://...` URLs in `[embed ...]`.",
);
expect(prompt).toContain( "The active hosted embed root for this session is: `/Users/example/.openclaw-dev/canvas`.",
);
expect(prompt).not.toContain('[embed content_type="html" title="Status"]...[/embed]');
});
expect(prompt).toContain( "For long waits, avoid rapid poll loops: use exec with enough yieldMs or process(action=poll, timeout=<ms>).",
);
expect(prompt).toContain("Completion is push-based: it will auto-announce when done.");
expect(prompt).toContain("Do not poll `subagents list` / `sessions_list` in a loop");
expect(prompt).toContain( "When a first-class tool exists for an action, use the tool directly instead of asking the user to run equivalent CLI or slash commands.",
);
});
it("lists available tools when provided", () => { const prompt = buildAgentSystemPrompt({
workspaceDir: "/tmp/openclaw",
toolNames: ["exec", "sessions_list", "sessions_history", "sessions_send"],
});
expect(prompt).toContain("Tool availability (filtered by policy):");
expect(prompt).toContain("sessions_list");
expect(prompt).toContain("sessions_history");
expect(prompt).toContain("sessions_send");
});
expect(prompt).toContain( 'For requests like "do this in claude code/cursor/gemini" or similar ACP harnesses, treat it as ACP harness intent',
);
expect(prompt).toContain( "For Codex conversation binding/control, prefer the native Codex app-server plugin path",
);
expect(prompt).toContain( 'On Discord, default ACP harness requests to thread-bound persistent sessions (`thread: true`, `mode: "session"`)',
);
expect(prompt).toContain( "do not route ACP harness requests through `subagents`/`agents_list` or local PTY exec flows",
);
expect(prompt).toContain( 'do not call `message` with `action=thread-create`; use `sessions_spawn` (`runtime: "acp"`, `thread: true`) as the single thread creation path',
);
});
expect(prompt).not.toContain( 'For requests like "do this in codex/claude code/gemini", treat it as ACP harness intent',
);
expect(prompt).not.toContain('runtime="acp" requires `agentId`');
expect(prompt).not.toContain("not ACP harness ids");
expect(prompt).toContain("- sessions_spawn: Spawn an isolated sub-agent session");
expect(prompt).toContain("- agents_list: List OpenClaw agent ids allowed for sessions_spawn");
});
expect(prompt).not.toContain('runtime="acp" requires `agentId`');
expect(prompt).not.toContain("ACP harness ids follow acp.allowedAgents");
expect(prompt).not.toContain( 'For requests like "do this in codex/claude code/gemini", treat it as ACP harness intent',
);
expect(prompt).not.toContain( 'do not call `message` with `action=thread-create`; use `sessions_spawn` (`runtime: "acp"`, `thread: true`) as the single thread creation path',
);
expect(prompt).toContain("ACP harness spawns are blocked from sandboxed sessions");
expect(prompt).toContain('`runtime: "acp"`');
expect(prompt).toContain('Use `runtime: "subagent"` instead.');
});
expect(prompt).toContain("- Read: Read file contents");
expect(prompt).toContain("- Exec: Run shell commands");
expect(prompt).toContain( "- If exactly one skill clearly applies: read its SKILL.md at <location> with `Read`, then follow it.",
);
expect(prompt).toContain("OpenClaw docs: /tmp/openclaw/docs");
expect(prompt).toContain( "For OpenClaw behavior, commands, config, or architecture: consult local docs first.",
);
});
it("includes docs guidance when docsPath is provided", () => { const prompt = buildAgentSystemPrompt({
workspaceDir: "/tmp/openclaw",
docsPath: "/tmp/openclaw/docs",
});
expect(prompt).toContain("## Documentation");
expect(prompt).toContain("OpenClaw docs: /tmp/openclaw/docs");
expect(prompt).toContain( "For OpenClaw behavior, commands, config, or architecture: consult local docs first.",
);
});
it("includes workspace notes when provided", () => { const prompt = buildAgentSystemPrompt({
workspaceDir: "/tmp/openclaw",
workspaceNotes: ["Reminder: commit your changes in this workspace after edits."],
});
expect(prompt).toContain("Reminder: commit your changes in this workspace after edits.");
});
it("keeps bootstrap instructions out of the privileged system prompt", () => { const prompt = buildAgentSystemPrompt({
workspaceDir: "/tmp/openclaw",
workspaceNotes: ["Reminder: commit your changes in this workspace after edits."],
});
expect(prompt).not.toContain("## Bootstrap");
expect(prompt).not.toContain("Bootstrap is pending for this workspace.");
expect(prompt).not.toContain("BOOTSTRAP.md is present in Project Context");
});
it("adds bootstrap-specific prelude text to the user prompt prefix when bootstrap is pending", () => { const promptPrefix = buildAgentUserPromptPrefix({ bootstrapMode: "full" });
expect(promptPrefix).toContain("[Bootstrap pending]");
expect(promptPrefix).toContain("Please read BOOTSTRAP.md from the workspace");
expect(promptPrefix).toContain("If this run can complete the BOOTSTRAP.md workflow, do so.");
expect(promptPrefix).toContain("explain the blocker briefly");
expect(promptPrefix).toContain("offer the simplest next step");
expect(promptPrefix).toContain("Do not use a generic first greeting or reply normally");
expect(promptPrefix).toContain( "Your first user-visible reply for a bootstrap-pending workspace must follow BOOTSTRAP.md",
);
});
it("shows timezone section for 12h, 24h, and timezone-only modes", () => { const cases = [
{
name: "12-hour",
params: {
workspaceDir: "/tmp/openclaw",
userTimezone: "America/Chicago",
userTime: "Monday, January 5th, 2026 — 3:26 PM",
userTimeFormat: "12" as const,
},
},
{
name: "24-hour",
params: {
workspaceDir: "/tmp/openclaw",
userTimezone: "America/Chicago",
userTime: "Monday, January 5th, 2026 — 15:26",
userTimeFormat: "24" as const,
},
},
{
name: "timezone-only",
params: {
workspaceDir: "/tmp/openclaw",
userTimezone: "America/Chicago",
userTimeFormat: "24" as const,
},
},
] as const;
for (const testCase of cases) { const prompt = buildAgentSystemPrompt(testCase.params);
expect(prompt, testCase.name).toContain("## Current Date & Time");
expect(prompt, testCase.name).toContain("Time zone: America/Chicago");
}
});
it("hints to use session_status for current date/time", () => { const prompt = buildAgentSystemPrompt({
workspaceDir: "/tmp/clawd",
userTimezone: "America/Chicago",
});
// The prompt should contain the timezone but NOT the formatted date/time string. // This is intentional for prompt cache stability — the date/time was removed in // commit 66eec295b. If you're here because you want to add it back, please see // https://github.com/moltbot/moltbot/issues/3658 for the preferred approach: // gateway-level timestamp injection into messages, not the system prompt.
expect(prompt).toContain("Time zone: America/Chicago");
expect(prompt).not.toContain("Monday, January 5th, 2026");
expect(prompt).not.toContain("3:26 PM");
expect(prompt).not.toContain("15:26");
});
it("includes model alias guidance when aliases are provided", () => { const prompt = buildAgentSystemPrompt({
workspaceDir: "/tmp/openclaw",
modelAliasLines: [ "- Opus: anthropic/claude-opus-4-5", "- Sonnet: anthropic/claude-sonnet-4-6",
],
});
expect(prompt).toContain("## Model Aliases");
expect(prompt).toContain("Prefer aliases when specifying model overrides");
expect(prompt).toContain("- Opus: anthropic/claude-opus-4-5");
});
expect(prompt).toContain("## Skills");
expect(prompt).toContain( "- If exactly one skill clearly applies: read its SKILL.md at <location> with `read`, then follow it.",
);
});
it("appends available skills when provided", () => { const prompt = buildAgentSystemPrompt({
workspaceDir: "/tmp/openclaw",
skillsPrompt: "<available_skills>\n <skill>\n <name>demo</name>\n </skill>\n</available_skills>",
});
expect(prompt).toContain( "If SOUL.md is present, embody its persona and tone. Avoid stiff, generic replies; follow its guidance unless higher-priority instructions override it.",
);
});
it("omits project context when no context files are injected", () => { const prompt = buildAgentSystemPrompt({
workspaceDir: "/tmp/openclaw",
contextFiles: [],
});
expect(spawnOnlyPrompt).toContain( '- Sub-agent orchestration → use `sessions_spawn(...)` to start delegated work; omit `context` for isolated children, set `context:"fork"` only when the child needs the current transcript.',
);
expect(spawnOnlyPrompt).not.toContain("manage already-spawned children");
expect(orchestrationPrompt).toContain( '- Sub-agent orchestration → use `sessions_spawn(...)` to start delegated work; omit `context` for isolated children, set `context:"fork"` only when the child needs the current transcript; use `subagents(action=list|steer|kill)` to manage already-spawned children.',
);
});
expect(prompt).toContain("rely on native approval card/buttons when they appear");
expect(prompt).toContain("do not also send plain chat /approve instructions");
});
expect(prompt).toContain("Your working directory is: /workspace");
expect(prompt).toContain( "For read/write/edit/apply_patch, file paths resolve against host workspace: /tmp/openclaw. For bash/exec commands, use sandbox container paths under /workspace (or relative paths from that workdir), not host paths.",
);
expect(prompt).toContain("Sandbox container workdir: /workspace");
expect(prompt).toContain( "Sandbox host mount source (file tools bridge only; not valid inside sandbox exec): /tmp/sandbox",
);
expect(prompt).toContain("You are running in a sandboxed runtime");
expect(prompt).toContain("Sub-agents stay sandboxed");
expect(prompt).toContain("User can toggle with /elevated on|off|ask|full.");
expect(prompt).toContain("Current elevated level: on");
});
it("does not advertise /elevated full when auto-approved full access is unavailable", () => { const prompt = buildAgentSystemPrompt({
workspaceDir: "/tmp/openclaw",
sandboxInfo: {
enabled: true,
workspaceDir: "/tmp/sandbox",
containerWorkspaceDir: "/workspace",
workspaceAccess: "ro",
agentWorkspaceMount: "/agent",
elevated: {
allowed: true,
defaultLevel: "full",
fullAccessAvailable: false,
fullAccessBlockedReason: "runtime",
},
},
});
expect(prompt).toContain("Elevated exec is available for this session.");
expect(prompt).toContain("User can toggle with /elevated on|off|ask.");
expect(prompt).not.toContain("User can toggle with /elevated on|off|ask|full.");
expect(prompt).toContain( "Auto-approved /elevated full is unavailable here (runtime constraints).",
);
expect(prompt).toContain( "Current elevated level: full (full auto-approval unavailable here; use ask/on instead).",
);
});
expect(prompt).toContain("## Reactions");
expect(prompt).toContain("Reactions are enabled for Telegram in MINIMAL mode.");
});
});
describe("buildAgentUserPromptPrefix", () => {
it("uses friendly full bootstrap wording that is truthful about completion blockers", () => { const prompt = buildAgentUserPromptPrefix({ bootstrapMode: "full" });
expect(prompt).toContain("[Bootstrap pending]");
expect(prompt).toContain("Please read BOOTSTRAP.md");
expect(prompt).toContain("If this run can complete the BOOTSTRAP.md workflow, do so.");
expect(prompt).toContain("explain the blocker briefly");
expect(prompt).toContain("offer the simplest next step");
expect(prompt).toContain("Do not pretend bootstrap is complete when it is not.");
expect(prompt).toContain("must follow BOOTSTRAP.md, not a generic greeting");
});
expect(prompt).toContain("[Bootstrap pending]");
expect(prompt).toContain("cannot safely complete the full BOOTSTRAP.md workflow here");
expect(prompt).toContain("Do not claim bootstrap is complete");
expect(prompt).toContain("do not use a generic first greeting");
expect(prompt).toContain("switching to a primary interactive run with normal workspace access");
});
it("returns nothing when bootstrap is not pending", () => {
expect(buildAgentUserPromptPrefix({ bootstrapMode: "none" })).toBeUndefined();
expect(buildAgentUserPromptPrefix({})).toBeUndefined();
});
});
expect(prompt).toContain("## Sub-Agent Spawning");
expect(prompt).toContain( "You CAN spawn your own sub-agents for parallel or complex work using `sessions_spawn`.",
);
expect(prompt).toContain("sessions_spawn");
expect(prompt).toContain('runtime: "acp"');
expect(prompt).toContain("For ACP harness sessions (codex/claudecode/gemini)");
expect(prompt).toContain("set `agentId` unless `acp.defaultAgent` is configured");
expect(prompt).toContain("Do not ask users to run slash commands or CLI");
expect(prompt).toContain("Do not use `exec` (`openclaw ...`, `acpx ...`)");
expect(prompt).toContain("Use `subagents` only for OpenClaw subagents");
expect(prompt).toContain("Subagent results auto-announce back to you");
expect(prompt).toContain( "After spawning children, do NOT call sessions_list, sessions_history, exec sleep, or any polling tool.",
);
expect(prompt).toContain( "Track expected child session keys and only send your final answer after completion events for ALL expected children arrive.",
);
expect(prompt).toContain( "If a child completion event arrives AFTER you already sent your final answer, reply ONLY with NO_REPLY.",
);
expect(prompt).toContain("Avoid polling loops");
expect(prompt).toContain("spawned by the main agent");
expect(prompt).toContain("reported to the main agent");
expect(prompt).toContain("[... N more characters truncated]");
expect(prompt).toContain("offset/limit");
expect(prompt).toContain("instead of full-file `cat`");
});
expect(prompt).not.toContain('runtime: "acp"');
expect(prompt).not.toContain("For ACP harness sessions (codex/claudecode/gemini)");
expect(prompt).not.toContain("set `agentId` unless `acp.defaultAgent` is configured");
expect(prompt).toContain("You CAN spawn your own sub-agents");
});
expect(prompt).toContain("## Sub-Agent Spawning");
expect(prompt).toContain("leaf worker");
expect(prompt).toContain("CANNOT spawn further sub-agents");
expect(prompt).toContain("spawned by the parent orchestrator");
expect(prompt).toContain("reported to the parent orchestrator");
});
for (const testCase of leafCases) { const prompt = buildSubagentSystemPrompt(testCase.input);
expect(prompt, testCase.name).not.toContain("## Sub-Agent Spawning");
expect(prompt, testCase.name).not.toContain("You CAN spawn"); if (testCase.expectMainAgentLabel) {
expect(prompt, testCase.name).toContain("spawned by the main agent");
}
}
});
});
Messung V0.5 in Prozent
¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.33Angebot
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.