feat: add /plan planning-mode instructions
This commit is contained in:
parent
21445cfc0a
commit
1179c3a88f
@ -310,6 +310,16 @@ describe("buildAgentSystemPrompt", () => {
|
|||||||
expect(prompt).toContain("/status shows Reasoning");
|
expect(prompt).toContain("/status shows Reasoning");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("includes /plan mode instructions", () => {
|
||||||
|
const prompt = buildAgentSystemPrompt({
|
||||||
|
workspaceDir: "/tmp/clawd",
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(prompt).toContain("## Plan Mode (/plan)");
|
||||||
|
expect(prompt).toContain("If the user message starts with /plan");
|
||||||
|
expect(prompt).toContain("plans/<timestamp>-<slug>/");
|
||||||
|
});
|
||||||
|
|
||||||
it("builds runtime line with agent and channel details", () => {
|
it("builds runtime line with agent and channel details", () => {
|
||||||
const line = buildRuntimeLine(
|
const line = buildRuntimeLine(
|
||||||
{
|
{
|
||||||
|
|||||||
@ -558,6 +558,27 @@ export function buildAgentSystemPrompt(params: {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Plan mode is conversational but stateful: compile a messy goal into a structured artifact.
|
||||||
|
if (!isMinimal) {
|
||||||
|
lines.push(
|
||||||
|
"## Plan Mode (/plan)",
|
||||||
|
"If the user message starts with /plan, enter *planning mode*.",
|
||||||
|
"- Treat everything after /plan as the goal.",
|
||||||
|
"- Ask targeted follow-up questions (one at a time) to remove ambiguity.",
|
||||||
|
"- Persist state in the workspace so planning can resume without losing context.",
|
||||||
|
"",
|
||||||
|
"Artifacts:",
|
||||||
|
"- Create a directory plans/<timestamp>-<slug>/ in the workspace.",
|
||||||
|
"- Maintain plans/<id>/answers.json (incremental) and plans/<id>/plan.md (human-readable).",
|
||||||
|
"- Optionally create plans/<id>/plan.json (structured) when helpful.",
|
||||||
|
"",
|
||||||
|
"Rules:",
|
||||||
|
"- Be token-efficient: do not restate the entire plan on every turn; ask the next question.",
|
||||||
|
"- When enough information is collected, produce a crisp plan with milestones + next actions.",
|
||||||
|
"",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
lines.push(
|
lines.push(
|
||||||
"## Runtime",
|
"## Runtime",
|
||||||
buildRuntimeLine(runtimeInfo, runtimeChannel, runtimeCapabilities, params.defaultThinkLevel),
|
buildRuntimeLine(runtimeInfo, runtimeChannel, runtimeCapabilities, params.defaultThinkLevel),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user