Manually running AI agents or multi-step processes in your editor is tedious and repetitive, even with powerful tools. Interactive prompts slow you down when you know exactly what task you want done. This lesson demonstrates how to transform a multi-step, interactive AI workflow into a single, executable bash script.
You'll learn how to leverage Cursor's "rules," MCP (Model Context Protocol) tools, and the command line to create fully automated, locked-down scripts. Go from manually guiding an AI through parsing daily notes and creating structured issue files to running a single, reliable command that does it all for you.
-p for print mode, --allowedTools for security).Please create a bash script in my scripts folder for this command cat .cursor/rules/create-issues-from-today.mdc | claude -p --allowedTools "mcp_basic-memory_switch_project,mcp_basic-memory_write_note"
# Add a new MCP server named 'basic-memory' that uses the 'bm' command
claude mcp add -t stdio basic-memory -- bm --project "issues" mcp
# Launch the Claude interactive agent
claude
# Inside Claude, view the configured MCP servers
/mcp
# Run a rule file interactively
cat .cursor/rules/create-issues-from-today.mdc | claude
# Run the same rule file non-interactively, pre-approving specific tools
cat .cursor/rules/create-issues-from-today.mdc | claude -p --allowedTools "mcp_basic-memory_switch_project,mcp_basic-memory_write_note"
# Run the final, generated script
./scripts/create-issues-from-today.sh
# Verify the output of the script
cat issues/feature/Add\ chat\ feature\ for\ script\ collaboration.md
// .claude/settings.local.json
{
"permissions": [
{
"allow": [
"mcp_basic-memory_switch_project",
"mcp_basic-memory_write_note"
],
"deny": []
}
]
}
[00:00] So I removed all the issues that we generated from the agent using our cursor rule, and this time I'm going to do it in a scripted fashion by invoking clod and saying mcp add basic memory. Now this uses a transport of standard I O and the arguments to launch basic memory are VM which is a Global I have installed for basic memory with a project of issues and it launches in MCP mode So running this command will allow me to launch Claude and I'll hit slash MCP and you'll see basic memory listed. I'll dig in, you can see the tools and how we launched it. And if you look at the tools, you'll see the tools we used in our agent before. And specifically if we look at something like write note, you'll see the full name of the tool which will be very important to us.
[00:48] Now what we can do is just exit out of everything, clear our terminal, and we can pipe our cursor rules create issues from today and pipe that into Clod. Now this will launch Clod in interactive mode And it'll pull in that cursor rule, essentially use it as a workflow or script to work through, and it'll ask us to allow it to use these commands like basic memory switch project. I'll hit 2 to approve that. And actually while this is working I'm going to come over to our rule. And if you remember from our previous lesson if we're going to script this I definitely want to have the last step be this switch back to script generator as our main project.
[01:30] So the last thing it does is to switch back. Then we'll need to approve every MCP tool it attempts to use. So now it'll say what it did, get the final message, and if we look in our issues directory you'll see a feature and a fix based on our notes from today. I'm going to delete these again and this time instead of running CLOD in an interactive mode we're actually going to run CLOD in what's called a print mode where all it's going to do is run in the background and once it's done print out what happened and exit. Then also for complete control of this, we're going to list the allowed tools.
[02:07] And the only tools we're going to allow are these specific MCP tools required to achieve this task. And if you look at the tools that it created in the clod settings local. You'll see it listed the ones we need for us here. So all we're going to do is allow clod code to switch projects and write notes. It won't be able to manually edit files or delete anything.
[02:28] We'll completely lock it down to these two abilities. So I'm going to grab these out. I need to quickly remove the quotes just so I can copy and paste this, and then I'll undo, undo, undo. Then to run our command again, this time we will cat and run our previous command, but this time we'll do it with the P flag for print mode and we'll pass in the allowed tools. And I don't know why that's camel cased and every other flag is dash cased, but I'll pass in the two tools we'll allow it to use.
[02:58] Then you can just sit back and relax while it parses your notes from today and automatically creates those issues in the issues memory project. So once it's done all you'll get back is that final message, which will probably be very similar to the previous final message. And if we look in our issues folder inside a feature We can look at the file I created and we've scripted that entire thing away. So then obviously the next step would be to grab this command from our history. We'll go ahead and echo this out and say please create a bash script in my scripts folder for this command.
[03:35] Make sure to escape the quotes here, here, and pipe this into Cloud. Hit enter and then let Cloud create that script for us. Make it executable. And now that we have that script, I'll go ahead and remove my issues from the feature. I'll remove that.
[03:51] I'll remove my issues from the fix. Remove that. Then just run my script of create issues from today. Then I can go grab a sandwich. Then check on the two issues it created, under issues, feature, and you can see we've completely scripted away the process.