diff --git a/apps/open-swe/src/graphs/planner/nodes/generate-plan/prompt.ts b/apps/open-swe/src/graphs/planner/nodes/generate-plan/prompt.ts index e7761e00..b652c7dc 100644 --- a/apps/open-swe/src/graphs/planner/nodes/generate-plan/prompt.ts +++ b/apps/open-swe/src/graphs/planner/nodes/generate-plan/prompt.ts @@ -1,3 +1,5 @@ +import { GITHUB_WORKFLOWS_PERMISSIONS_PROMPT } from "../../../shared/prompts.js"; + export const SCRATCHPAD_PROMPT = `Here is a collection of technical notes you wrote to a scratchpad while gathering context for the plan. Ensure you take these into account when writing your plan. @@ -51,6 +53,8 @@ Create your plan following these guidelines: 6. **Combine simple, related steps:** - If you have multiple simple steps that are related, and should be executed one after the other, combine them into a single step. - For example, if you have multiple steps to run a linter, formatter, etc., combine them into a single step. The same goes for passing arguments, or editing files. + +${GITHUB_WORKFLOWS_PERMISSIONS_PROMPT} diff --git a/apps/open-swe/src/graphs/programmer/nodes/generate-message/prompt.ts b/apps/open-swe/src/graphs/programmer/nodes/generate-message/prompt.ts index c118c1cd..e7f130b1 100644 --- a/apps/open-swe/src/graphs/programmer/nodes/generate-message/prompt.ts +++ b/apps/open-swe/src/graphs/programmer/nodes/generate-message/prompt.ts @@ -1,4 +1,5 @@ import { createMarkTaskCompletedToolFields } from "@open-swe/shared/open-swe/tools"; +import { GITHUB_WORKFLOWS_PERMISSIONS_PROMPT } from "../../../shared/prompts.js"; const IDENTITY_PROMPT = ` You are a terminal-based agentic coding assistant built by LangChain. You wrap LLM models to enable natural language interaction with local codebases. You are precise, safe, and helpful. @@ -66,6 +67,7 @@ const CODING_STANDARDS_PROMPT = ` - Ensure package manager files are updated to include the new dependency. - If a command you run fails (e.g. a test, build, lint, etc.), and you make changes to fix the issue, ensure you always re-run the command after making the changes to ensure the fix was successful. - IMPORTANT: You are NEVER allowed to create backup files. All changes in the codebase are tracked by git, so never create file copies, or backups. + - ${GITHUB_WORKFLOWS_PERMISSIONS_PROMPT} `; const COMMUNICATION_GUIDELINES_PROMPT = ` diff --git a/apps/open-swe/src/graphs/shared/prompts.ts b/apps/open-swe/src/graphs/shared/prompts.ts new file mode 100644 index 00000000..6c758ce8 --- /dev/null +++ b/apps/open-swe/src/graphs/shared/prompts.ts @@ -0,0 +1,6 @@ +export const GITHUB_WORKFLOWS_PERMISSIONS_PROMPT = ` +IMPORTANT: You do not have permissions to EDIT or DELETE files inside the GitHub workflows directory (commonly found at .github/workflows/). + - If you need to modify or create a workflow, ensure you always do so inside a 'tmp-workflows' directory. + - Any attempt to create or modify a workflow file in the .github/workflows/ directory will result in a fatal error that will end the session. + - Notify the user that they will need to manually move the workflow file from the 'tmp-workflows' directory to the .github/workflows/ directory since you do not have permissions to do so. +`;