Skip to content

Commit c874978

Browse files
backnotpropclaude
andcommitted
fix: restore Pi plan file hint and vendor template for source installs
Add optional planFilePath to planDenyFeedback so Pi can tell the agent to read the plan file before editing. Check in a vendored copy of the template so Pi source installs work without running build:pi first. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 63fd274 commit c874978

4 files changed

Lines changed: 42 additions & 3 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**
2+
* Vendored copy of packages/shared/feedback-templates.ts for source installs.
3+
* Keep this file in sync with the shared source via `bun run build:pi`.
4+
*/
5+
6+
export interface PlanDenyFeedbackOptions {
7+
planFilePath?: string;
8+
}
9+
10+
export const planDenyFeedback = (
11+
feedback: string,
12+
toolName: string = "ExitPlanMode",
13+
options?: PlanDenyFeedbackOptions,
14+
): string => {
15+
const planFileRule = options?.planFilePath
16+
? `- Read ${options.planFilePath} to see the current plan before editing it.\n`
17+
: "";
18+
19+
return `YOUR PLAN WAS NOT APPROVED.\n\nYou MUST revise the plan to address ALL of the feedback below before calling ${toolName} again.\n\nRules:\n${planFileRule}- Use the Edit tool to make targeted changes to the plan — do not resubmit the same plan unchanged.\n- Do NOT change the plan title (first # heading) unless the user explicitly asks you to.\n\n${feedback || "Plan changes requested"}`;
20+
};

apps/pi-extension/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ export default function plannotator(pi: ExtensionAPI): void {
446446
content: [
447447
{
448448
type: "text",
449-
text: planDenyFeedback(feedbackText, "exit_plan_mode"),
449+
text: planDenyFeedback(feedbackText, "exit_plan_mode", { planFilePath }),
450450
},
451451
],
452452
details: { approved: false, feedback: feedbackText },

packages/shared/feedback-templates.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,13 @@ describe("feedback-templates", () => {
5151
expect(result.toLowerCase()).toContain("title");
5252
expect(result.toLowerCase()).toContain("heading");
5353
});
54+
55+
test("plan deny can include a plan file hint for file-based integrations", () => {
56+
const result = planDenyFeedback("feedback", "exit_plan_mode", {
57+
planFilePath: "plans/auth.md",
58+
});
59+
60+
expect(result).toContain("Read plans/auth.md to see the current plan before editing it.");
61+
expect(result).toContain("exit_plan_mode");
62+
});
5463
});

packages/shared/feedback-templates.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,18 @@
55
* directive framing — Claude was ignoring softer phrasing.
66
*/
77

8+
export interface PlanDenyFeedbackOptions {
9+
planFilePath?: string;
10+
}
11+
812
export const planDenyFeedback = (
913
feedback: string,
1014
toolName: string = "ExitPlanMode",
11-
): string =>
12-
`YOUR PLAN WAS NOT APPROVED.\n\nYou MUST revise the plan to address ALL of the feedback below before calling ${toolName} again.\n\nRules:\n- Use the Edit tool to make targeted changes to the plan — do not resubmit the same plan unchanged.\n- Do NOT change the plan title (first # heading) unless the user explicitly asks you to.\n\n${feedback || "Plan changes requested"}`;
15+
options?: PlanDenyFeedbackOptions,
16+
): string => {
17+
const planFileRule = options?.planFilePath
18+
? `- Read ${options.planFilePath} to see the current plan before editing it.\n`
19+
: "";
20+
21+
return `YOUR PLAN WAS NOT APPROVED.\n\nYou MUST revise the plan to address ALL of the feedback below before calling ${toolName} again.\n\nRules:\n${planFileRule}- Use the Edit tool to make targeted changes to the plan — do not resubmit the same plan unchanged.\n- Do NOT change the plan title (first # heading) unless the user explicitly asks you to.\n\n${feedback || "Plan changes requested"}`;
22+
};

0 commit comments

Comments
 (0)