Lesson
Agent: Build a Custom Agent Mode in Cursor for Managing Notes
Learn the iterative process of building and refining a sophisticated custom AI agent in Cursor to automate complex, multi-step workflows.
- Access
- Included
- Transcript
- Needs source
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.
The Process of Refining an Agent
This lesson walks through the real-world process of programming an AI agent, which involves:
- Initial Setup: Creating a new custom agent, assigning it a name ("Create Issues"), and setting a convenient keybinding (Cmd/Ctrl + M).
- Permission Scoping: Starting with a minimal set of tool permissions (e.g., only "Run Commands" and a specific "MCP Server") to ensure security and predictable behavior.
- Detailed Prompting: Providing a comprehensive, multi-step set of custom instructions that act as the agent's core logic or "rule."
- Testing and Observation: Running the agent and carefully observing its output and failure points.
- Iterative Refinement:
- Adding necessary permissions (like
read_fileandsearch_files) only when the agent reports it cannot perform a required action. - Enhancing the custom instructions to be more explicit, such as telling the agent how to get the current date with a specific terminal command.
- Adjusting the order of operations in the instructions to ensure a logical workflow (e.g., reading a local file before switching to a different project context).
- Adding necessary permissions (like
- Finalization: Continuing to test and refine until the agent performs the entire desired workflow flawlessly and efficiently with a single command.
Prompts
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.
Commands
The terminal command the agent is instructed to use to find the current date:
date +%Y-%m-%d
Code Snippets
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.