& {
+ actionType: "scratchpad";
};
type GetURLContentActionProps = BaseActionProps &
@@ -123,7 +123,7 @@ export type ActionItemProps =
| ShellActionProps
| PatchActionProps
| InstallDependenciesActionProps
- | PlannerNotesActionProps
+ | ScratchpadActionProps
| GetURLContentActionProps
| McpActionProps
| SearchActionProps
@@ -139,7 +139,7 @@ const ACTION_GENERATING_TEXT_MAP = {
[shellTool.name]: "Executing...",
[applyPatchTool.name]: "Applying patch...",
[installDependenciesTool.name]: "Installing dependencies...",
- [plannerNotesTool.name]: "Saving notes...",
+ [scratchpadTool.name]: "Saving notes...",
[getURLContentTool.name]: "Fetching URL content...",
[searchDocumentForTool.name]: "Searching document...",
[searchTool.name]: "Searching...",
@@ -212,8 +212,10 @@ function ActionItem(props: ActionItemProps) {
return props.success ? "Patch applied" : "Patch failed";
} else if (props.actionType === "install_dependencies") {
return props.success ? "Dependencies installed" : "Installation failed";
- } else if (props.actionType === "planner_notes") {
- return props.success ? "Notes saved" : "Failed to save notes";
+ } else if (props.actionType === "scratchpad") {
+ return props.success
+ ? "Scratchpad updated"
+ : "Failed to update scratchpad";
} else if (props.actionType === "get_url_content") {
return props.success
? "URL content fetched"
@@ -248,8 +250,8 @@ function ActionItem(props: ActionItemProps) {
return !!props.output;
} else if (props.actionType === "apply-patch") {
return !!props.diff;
- } else if (props.actionType === "planner_notes") {
- return !!(props.notes && props.notes.length > 0);
+ } else if (props.actionType === "scratchpad") {
+ return !!(props.scratchpad && props.scratchpad.length > 0);
} else if (props.actionType === "mcp") {
const hasArgs = props.args && Object.keys(props.args).length > 0;
const hasOutput = !!props.output;
@@ -272,10 +274,10 @@ function ActionItem(props: ActionItemProps) {
);
}
- if (props.actionType === "planner_notes") {
+ if (props.actionType === "scratchpad") {
return (
}
/>
);
@@ -341,11 +343,11 @@ function ActionItem(props: ActionItemProps) {
);
}
- if (props.actionType === "planner_notes") {
+ if (props.actionType === "scratchpad") {
return (
- Planner Notes
+ Scratchpad
);
@@ -584,14 +586,14 @@ function ActionItem(props: ActionItemProps) {
);
} else if (
- props.actionType === "planner_notes" &&
- props.notes &&
- props.notes.length > 0
+ props.actionType === "scratchpad" &&
+ props.scratchpad &&
+ props.scratchpad.length > 0
) {
return (
- {props.notes.map((note, i) => (
+ {props.scratchpad.map((note, i) => (
- ;
-const plannerNotesTool = createTakePlannerNotesFields();
-type PlannerNotesToolArgs = z.infer;
+const scratchpadTool = createScratchpadFields("");
+type ScratchpadToolArgs = z.infer;
const markFinalReviewTaskCompletedTool =
createCodeReviewMarkTaskCompletedFields();
type MarkFinalReviewTaskCompletedToolArgs = z.infer<
@@ -113,7 +113,7 @@ function isMcpTool(toolName: string): boolean {
shellTool.name,
applyPatchTool.name,
installDependenciesTool.name,
- plannerNotesTool.name,
+ scratchpadTool.name,
getURLContentTool.name,
openPrTool.name,
diagnoseErrorTool.name,
@@ -194,6 +194,9 @@ export function mapToolMessageToActionStepProps(
const status: ActionItemProps["status"] = "done";
const success = message.status === "success";
+ const msgContent = getContentString(message.content);
+ const output = msgContent === "" ? "Empty string" : msgContent;
+
if (toolCall?.name === shellTool.name) {
const args = toolCall.args as ShellToolArgs;
return {
@@ -202,7 +205,7 @@ export function mapToolMessageToActionStepProps(
success,
command: args.command || [],
workdir: args.workdir,
- output: getContentString(message.content),
+ output,
reasoningText,
};
} else if (toolCall?.name === applyPatchTool.name) {
@@ -231,7 +234,7 @@ export function mapToolMessageToActionStepProps(
exclude_files: args.exclude_files || "",
include_files: args.include_files || "",
file_types: args.file_types || [],
- output: getContentString(message.content),
+ output,
reasoningText,
};
} else if (toolCall?.name === installDependenciesTool.name) {
@@ -242,16 +245,16 @@ export function mapToolMessageToActionStepProps(
success,
command: args.command || "",
workdir: args.workdir || "",
- output: getContentString(message.content),
+ output,
reasoningText,
};
- } else if (toolCall?.name === plannerNotesTool.name) {
- const args = toolCall.args as PlannerNotesToolArgs;
+ } else if (toolCall?.name === scratchpadTool.name) {
+ const args = toolCall.args as ScratchpadToolArgs;
return {
- actionType: "planner_notes",
+ actionType: "scratchpad",
status,
success,
- notes: args.notes || [],
+ scratchpad: args.scratchpad || [],
reasoningText,
};
} else if (toolCall?.name === getURLContentTool.name) {
@@ -261,7 +264,7 @@ export function mapToolMessageToActionStepProps(
status,
success,
url: args.url || "",
- output: getContentString(message.content),
+ output,
reasoningText,
};
} else if (toolCall?.name === searchDocumentForTool.name) {
@@ -272,7 +275,7 @@ export function mapToolMessageToActionStepProps(
success,
url: args.url || "",
query: args.query || "",
- output: getContentString(message.content),
+ output,
reasoningText,
};
} else if (toolCall && isMcpTool(toolCall.name)) {
@@ -282,7 +285,7 @@ export function mapToolMessageToActionStepProps(
success,
toolName: toolCall.name,
args: toolCall.args as Record,
- output: getContentString(message.content),
+ output,
reasoningText,
};
}
@@ -351,7 +354,7 @@ export function AssistantMessage({
tc.name === applyPatchTool.name ||
tc.name === searchTool.name ||
tc.name === installDependenciesTool.name ||
- tc.name === plannerNotesTool.name ||
+ tc.name === scratchpadTool.name ||
tc.name === getURLContentTool.name ||
isMcpTool(tc.name),
)
@@ -638,12 +641,12 @@ export function AssistantMessage({
workdir: args?.workdir || "",
output: "",
} as ActionItemProps;
- } else if (toolCall.name === plannerNotesTool.name) {
- const args = toolCall.args as PlannerNotesToolArgs;
+ } else if (toolCall.name === scratchpadTool.name) {
+ const args = toolCall.args as ScratchpadToolArgs;
return {
- actionType: "planner_notes",
+ actionType: "scratchpad",
status: "generating",
- notes: args?.notes || [],
+ scratchpad: args?.scratchpad || [],
} as ActionItemProps;
} else if (toolCall.name === getURLContentTool.name) {
const args = toolCall.args as GetURLContentToolArgs;
diff --git a/packages/shared/src/open-swe/tools.ts b/packages/shared/src/open-swe/tools.ts
index eae8e4c3..05aa94dd 100644
--- a/packages/shared/src/open-swe/tools.ts
+++ b/packages/shared/src/open-swe/tools.ts
@@ -344,22 +344,21 @@ export function createOpenPrToolFields() {
};
}
-export function createTakePlannerNotesFields() {
- const plannerContextNotesSchema = z.object({
- notes: z
+export function createScratchpadFields(whenMessage: string) {
+ const scratchpadSchema = z.object({
+ scratchpad: z
.array(z.string())
.describe(
- "The high quality, concise and technical notes you deem important to save for the programmer to use when implementing the plan.",
+ `Write concise, technical, and useful notes to your scratchpad. These notes will be saved for you to use ${whenMessage}.`,
),
});
return {
- name: "take_notes",
- schema: plannerContextNotesSchema,
+ name: "scratchpad",
+ schema: scratchpadSchema,
description:
- "Use this tool to write & save technical notes on the planner context.\n" +
- "This should be called if you come across context you think will be highly useful to the programmer when they are actually implementing the plan, and you want to ensure it's not lost.\n" +
- "Do not duplicate any information present in the user provided 'custom rules', as we want to avoid duplicating context.",
+ `Use this tool to write & save technical notes on the actions you take, and observations you make, and any notes you believe will be useful ${whenMessage}.` +
+ " This should be called if you come across context which you believe will be useful to you during later steps.",
};
}
diff --git a/packages/shared/src/open-swe/types.ts b/packages/shared/src/open-swe/types.ts
index 56de7210..129d4711 100644
--- a/packages/shared/src/open-swe/types.ts
+++ b/packages/shared/src/open-swe/types.ts
@@ -178,7 +178,7 @@ export const GraphAnnotation = MessagesZodState.extend({
},
}),
/**
- * Notes taken based on the actions preformed by the planning agent.
+ * Notes taken based on the actions performed by the planning agent.
*/
contextGatheringNotes: withLangGraph(z.custom(), {
reducer: {