mirror of
https://github.com/wassname/pi-plan.git
synced 2026-09-26 14:10:23 +08:00
Co-Authored-By: PI[gpt-5.6-sol] <288921227+claudypoo@users.noreply.github.com>
34 lines
2.2 KiB
TypeScript
34 lines
2.2 KiB
TypeScript
import { readFileSync } from "node:fs";
|
|
import { describe, expect, it } from "vitest";
|
|
import { completeGoalDescription, planDrafting, planningState, resync } from "../src/prompts.js";
|
|
|
|
const workerSystemPrompt = readFileSync(new URL("../agents/goal-worker.md", import.meta.url), "utf8");
|
|
|
|
describe("planning prompt", () => {
|
|
it("requires fact finding or a focused question before a goal", () => {
|
|
expect(planDrafting).toContain("Use read-only repository tools or web search when either can\nresolve a fact.");
|
|
expect(planDrafting).toContain("ask the human to confirm your interpretation");
|
|
expect(planDrafting).toContain("approve an editorial or other preference choice");
|
|
expect(planDrafting).toContain("answer materially reduces uncertainty\nwhile discovering the right plan");
|
|
expect(planDrafting).toContain("self-contained: state the relevant\ncontext, use the human's language and ASD-STE100");
|
|
expect(planDrafting).toContain("placeholder goal such as \"work out the thing\"");
|
|
expect(planDrafting).toContain("object, observable result, settled scope, and required approval");
|
|
});
|
|
|
|
it("restores the same rule after compaction", () => {
|
|
expect(planningState(".pi/plan/test.md")).toContain("web search\nwhen either can resolve a fact.");
|
|
expect(planningState(".pi/plan/test.md")).toContain("choice that needs their approval");
|
|
expect(planningState(".pi/plan/test.md")).toContain("self-contained round with relevant context and a recommendation");
|
|
});
|
|
|
|
it("anchors work and sign-off to the user-visible result", () => {
|
|
expect(planDrafting).toContain("## User-visible result");
|
|
expect(planDrafting).toContain("Take it from the original request, not from your implementation plan");
|
|
expect(planDrafting).toContain("Future work may not defer any artifact or action named there");
|
|
expect(resync("plan", ".pi/plan/test.md", "Compacted.")).toContain("amend the plan rather than preserving an obsolete decision");
|
|
expect(workerSystemPrompt).toContain("human's latest message outranks the plan");
|
|
expect(workerSystemPrompt).toContain("retained goal supervisor owns direction and approval");
|
|
expect(completeGoalDescription).toContain("approval checkpoint only after it inspected");
|
|
});
|
|
});
|