Workflow for running the same prompt on multiple pages (scripting cursor.sh)

anyone have an idea of how i can accomplish this with cursor?

my idea is to ask cursor to identify blog posts on my website that are similar to the current page.

so the workflow would be:

  1. for all pages in /works/
  2. run the same prompt
    • “suggest 5 other works on https://raw.works that are the most relevant to this page”
    • …some additional prompting to edit each file accordingly, adding the links formatted in a certain way.

basically, i want a way to “script” cursor into executing the same prompt recursively.

Cursor doesn’t have a feature that lets you automate sending prompts.

However, you might be able to make this work with just a single prompt. Depending on how many blogs you have, you could add every blog with the @-reference to your chat message or use the codebase context feature (make sure to enable the “Reasoning step” in the advanced codebase context settings to improve the results). Then, you could ask for what you want, and it might give you all suggestions for every page in one go.

Regarding actually editing the files, you can use the /edit slash command in Chat. However, it doesn’t support editing multiple files at once yet. So, you would need to focus on one blog file, have the chat opened that has the suggestions (/edit sees your conversation history), and say something like “Apply the changes for this blog.”.

cool, thanks for the clarification.

follow-up questions / feature requests:

  • is editing multiple files on the roadmap?
  • can i @ a directory? (where cursor would recursively @ every file in a directory)

Both are on our roadmap.

2 Likes

is there a ballpark timeline on (re)adding the ability to edit multiple files? this will dramatically increase my use cases for cursor.

It’s very clunky but I’ve written a script that lets you remote control Cursor via the CLI: GitHub - SokolskyNikita/cli-control-cursor-ide

This lets you either write a script that tells Cursor to edit all the files in a folder one-by-one or you can have agent run in yolo mode and instruct it to trigger itself recursively :slight_smile:

1 Like

looks really cool!

a few examples in the repo would be really helpful.

for example, making sharing the scripts for the workflows you described above.

SO this is really weird, but wouldnt this be the same feature as this actual forum has where it tells you that what submitting is same as previous post…

Same logic - scrape from whatever this forum substrate app is…

Ha, this is nice! I’ve been doing a similar workflow with AppleScript/Osascript, but it requires Cursor to be in focus when starting a new task, which interrupts with whatever else i’m trying to do. Will definitely take a closer look to see if it’s more feasible than my current approach :slight_smile:

The new background agents mode in 0.50 is also a solution for the same thing, but this would be better approach for automating the workflow of running N tasks in a sequence. Just like aider/claude code but controlling Cursor instead.