Creating a simple AI agent in Cursor is straightforward, but making it perform a complex, multi-step task reliably requires more than just a basic prompt. Agents often fail due to missing permissions, a lack of real-world context (like the current date), or an incorrect understanding of the required sequence of actions.
This lesson demonstrates the practical, iterative process of building and refining a sophisticated custom agent from the ground up. You will learn how to meticulously configure the agent's tool permissions, craft detailed step-by-step instructions to guide its behavior, and troubleshoot common failure points.
The result is a powerful, one-click automation that can process a daily note, extract actionable items, and create new issues in a separate project context. This hands-on example showcases how to build robust, personalized AI workflows that go far beyond simple chat commands.
This lesson walks through the real-world process of programming an AI agent, which involves:
read_file and search_files) only when the agent reports it cannot perform a required action.A prompt to start the demonstration:
Let's make the hero text larger and move it down a little bit.
The simple trigger word used to activate the fully programmed agent:
go
A prompt to give the agent date-awareness:
run a terminal command to determine today's date
Another prompt to help the agent find the correct file:
find the note matching today's date in the following format.
The terminal command the agent is instructed to use to find the current date:
date +%Y-%m-%d
The final, refined custom instructions pasted into the agent's configuration. This multi-step prompt guides the agent through the entire workflow, including error handling and context switching.
# Rule: create-issues-from-today
## Description
This rule describes the process for extracting content from a daily note and creating categorized issues (features, fixes, etc.) in a separate memory project.
## Steps (with MCP Tools)
0. Read the content of ./notes/YYYY-MM-DD.md using the read_file tool.
1. **Switch to the 'issues' memory project**
- Tool: `mcp_basic-memory_switch_project`
- Usage: Switch to the `issues` project to access its file structure and create new notes.
2. **Extract Actionable Items from Note**
- Process the content of the daily note provided.
- For each actionable item (e.g., a bug, a feature request), create a new note in the appropriate folder (`fix/`, `feature/`, etc.) within the `issues` memory project.
- Tool: `mcp_basic-memory_write_note` (to add references/links in the note content)
- Usage: If needed, add references back to the original daily note for traceability.
3. **Switch back to the "script-generator" project**
- Tool: `mcp_basic-memory_switch_project`
- Usage: Switch back to the "script-generator" project to continue working on the script.
## Example
- A bug described in the daily note becomes a file in `fix/`.
- A performance concern becomes a file in `perf/`.
This process ensures daily notes are systematically converted into actionable, categorized issues for tracking and follow-up.
[00:00] Now instead of a script you can also just create a custom agent. So if I drop in something like, let's make the hero text larger and move it down a little bit. Then I'll open the agent panel and create a custom agent down in this menu with add custom mode. We'll call this create issues. The name doesn't really matter.
[00:16] We'll set a key by clicking this and I'll use command M. Then I'll click again. I know command M is minimized but I never use that anyway. Then I'm going to disable search, disable edit, and only allow it to run commands and mcp servers. Let's disable all of them and only pick basic memory.
[00:34] And then in the advanced options we can turn off all of this. And I'm going to swap over to my cursor rule and copy the entire body of this rule into the custom instructions. If you try and reference the rule from in here, it doesn't always work, so I prefer just to copy and paste the entire thing in. So now from anywhere, if I close this, close all my files, hit command M, I can just say go. You need to type at least something.
[01:02] Hit enter and then it'll run through the instructions you gave it. Oh, I did need to enable autorun. So let's modify this. Advanced options, autorun. Then let's start this again.
[01:13] Hit enter and now it'll walk through all the tool calling. And it looks like because we didn't specifically reference the markdown file, let's update the instructions here where we edit the advanced options. And my biggest gripe about this whole UI is how difficult it is to update everything. So we'll call this create issues from today. And let's start with run a terminal command to determine today's date, then find the note matching today's date in the following format.
[01:41] And we'll say notes, and this will be year, year, year, year, month, month, day, day, mark down, then give it one more shot. It is worth noting that anytime you're using agents they are not aware of the date. It's not part of their data and they'll often think it's a year before or something. So let's give this another shot. So now it generates the date and now we need to tweak it again so that it can actually read files.
[02:05] So we'll allow it to read files but do nothing else. And this is just kind of the process when figuring out how restrictive you want an agent to be. And I'm also going to grab this command, which it ran, and bring this in to here. Since it worked once, we're going to learn from that and say, use this bash command. This way it should consistently use the same command every time.
[02:30] And now we'll run it one more time and this time it should be able to read the file. It should consistently generate the date for us. So now it's reading the content. So we still didn't give it enough permissions to actually locate files. So one last edit here under search.
[02:45] Let's give it search files as well and then fire this off and now we got the date and this time it was able to Read in the daily note, but it looks like it attempted to find it through the MCP first So we'll give this one last little tweak. I believe in our steps. Let's say step zero is read the content of Notes, and you'll have to excuse me the scrolling jumps around in this UI quite a bit. And I haven't found any text files backing this up. So notes, year year year, month month, day day, and we'll even say using the read file tool, which is Cursor's internal tool for reading files.
[03:26] And now if we run this again it should avoid making a bunch of calls before switching, which appear to be trying to read the file. And let's delete the file it made last time. So last time it created this. Run this one more time. So now we have the date.
[03:40] Now it read the file. Switching project. Write note. And you can see we have a much better step-by-step, much less tool calling, much faster, and everything ended up in the right spot. So it's under here, under a feature folder, and we're done.