FN-7499: require before-after task summaries

Require generated task specs to summarize the requested before-to-after transformation near the top.

- Add a Before → After Transformation section to standard and fast planning prompt templates.\n- Document the new task definition section and cover it with prompt regression tests.\n- Add a patch changeset for the published Fusion package.\n\nFiles changed:\n .changeset/fn-7499-before-after-transformation.md |  7 +++++++\n docs/task-management.md                           |  1 +\n packages/core/src/__tests__/agent-prompts.test.ts | 17 +++++++++++++++\n packages/core/src/agent-prompts.ts                | 25 +++++++++++++++++++----\n packages/engine/src/__tests__/triage.test.ts      | 20 ++++++++++++++++++\n 5 files changed, 66 insertions(+), 4 deletions(-)

Fusion-Task-Id: FN-7499

Fusion-Task-Lineage: d049b5d6-a4bc-40dd-831d-04a11f9dc2cf

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
This commit is contained in:
gsxdsm
2026-07-04 10:08:53 -07:00
parent e8dc2ae6d1
commit d2e3134746
5 changed files with 66 additions and 4 deletions

View File

@@ -22,6 +22,7 @@ const { mockReviewStep, mockCreateFnAgent } = vi.hoisted(() => ({
}));
const TRIAGE_POLICY_PROMPT = resolveAgentPrompt("triage");
const STANDARD_PLANNING_PROMPT = builtinSeamPrompt("planning");
const FAST_PLANNING_PROMPT = builtinSeamPrompt("planning-fast");
const RENDERED_TRIAGE_POLICY_PROMPT = renderTriagePolicyPlaceholders(TRIAGE_POLICY_PROMPT, {});
@@ -733,6 +734,25 @@ describe("FN-5893 invariant regression wording", () => {
"utf8",
);
it("requires before-to-after transformation summaries in standard and fast planning prompts", () => {
for (const prompt of [
TRIAGE_POLICY_PROMPT,
STANDARD_PLANNING_PROMPT,
FAST_PLANNING_PROMPT,
]) {
expect(prompt).toContain("## Before → After Transformation");
expect(prompt).toContain("Before");
expect(prompt).toContain("After");
expect(prompt).toContain("current state");
expect(prompt).toContain("target state");
expect(prompt).toContain("satisfies the user's request at a glance");
}
expect(STANDARD_PLANNING_PROMPT).toBe(TRIAGE_POLICY_PROMPT);
expect(FAST_PLANNING_PROMPT).not.toContain("## Review Level");
expect(FAST_PLANNING_PROMPT).not.toContain("## Proactive Subtask Breakdown");
});
it("requires invariant-level regression coverage in standard, fast, and core triage prompts", () => {
for (const prompt of [
TRIAGE_POLICY_PROMPT,