Claude Code 2.0: Massive Upgrade with Agent Loops
By Prompt Engineering
Key Concepts
- Scheduled Tasks: Automated, recurring operations within the Cursor (Cloud) ecosystem.
/loopCommand: A CLI-based tool for short-term, session-bound recurring tasks.- Desktop Scheduled Tasks: Persistent automation within the Cursor Desktop app that survives restarts.
- Work Trees: A method to run tasks on separate branches to avoid conflicts with the main codebase.
- Stateful Memory (
state.json): A pattern to provide persistence to stateless agents, allowing them to learn from previous errors. - MCP (Model Context Protocol): A standard for connecting AI assistants to local tools, files, and servers.
- GitHub Actions: A cloud-based infrastructure for running tasks without requiring a local machine to be powered on.
1. Overview of Scheduling Mechanisms
The video identifies four distinct ways to schedule tasks in the Cursor ecosystem, each with unique persistence rules, access levels, and limitations. Choosing the wrong method can lead to silent failures or permission stalls.
A. The /loop Command (CLI)
- Function: Designed for the Cursor Code CLI. It parses an interval and a prompt to create a cron-like job.
- Mechanism: If the agent is busy, it waits for the task to finish before starting the next interval. It is not strictly deterministic.
- Limitations:
- Tied to a specific terminal session; closing the terminal or putting the computer to sleep kills the process.
- 3-day expiry: Tasks automatically stop after 72 hours.
- Capacity: Maximum of 50 tasks per session.
B. Desktop Scheduled Tasks (Co-work & Cloud Code)
- Function: Persistent automation that survives app restarts.
- Mechanism: Tasks are persisted to the disk. When triggered, the agent reads the prompt, executes the work, outputs results to the sidebar, and closes the session.
- Limitations: Requires the computer to be awake and the app to be open. If the computer sleeps, it will only execute the most recent missed task upon waking.
C. GitHub Actions (The "Fourth Way")
- Function: Offloads execution to cloud infrastructure.
- Use Case: Ideal for tasks that must run regardless of local machine status (e.g., PR reviews, security audits, CI failure fixes).
- Limitation: Scope is strictly limited to the GitHub repository.
2. Architectural Differences: Co-work vs. Cloud Code
- Co-work: Runs in a VM sandbox. It is optimized for non-developers and has access to external connectors/plugins (Slack, Gmail, Calendar, Web Search).
- Cloud Code: Runs directly on the local machine. It has full access to local files, MCP servers, Git, terminal, and bash.
3. Methodologies for Optimization
- Stateful Memory Pattern: Since scheduled tasks are inherently stateless, the author recommends creating a
state.jsonfile. The agent reads this file to understand past errors and successes, preventing the repetition of mistakes and reducing token usage. - Work Trees: To prevent conflicts, run scheduled tasks on a separate branch or work tree. Once the task completes, the user can review the changes and merge them into the
mainbranch. - Permission Management: Users can set tasks to "auto-accept" or "ask for permission." The author warns against "dangerously skip permissions" due to the risk of destructive operations.
4. Decision Framework
The author provides a framework based on Time Horizon and Task Type:
| Task Type | Time Horizon | Recommended Tool |
| :--- | :--- | :--- |
| Dev/DevOps (Logs, Deploy status) | Short-lived | /loop command |
| Dev/DevOps (Security scans, Audits) | Long-running | Desktop Scheduled Tasks (Cloud Code) |
| Business/General (Reports, Emails) | Long-running | Desktop Scheduled Tasks (Co-work) |
| Infrastructure (API Uptime) | Ongoing | GitHub Actions |
5. Notable Quotes
- "If you pick the wrong one, your task is going to silently die, stall on permission prompt, or just never run at all."
- "The more I use Open Claw, the more I realize that 90% plus of the use cases can be covered by the latest version of Cursor... especially with scheduled tasks." — Attributed to "Fan" (via Twitter).
6. Synthesis and Conclusion
The Cursor ecosystem has evolved into a powerful automation platform. While the /loop command is excellent for quick, session-based debugging, the Desktop Scheduled Tasks provide a robust framework for long-term, persistent automation. By utilizing state.json for memory and work trees for safety, users can effectively automate complex workflows. For tasks requiring 24/7 uptime without local machine dependency, GitHub Actions remains the superior choice. The key takeaway is to match the tool's access level (VM vs. Local) and persistence requirements to the specific nature of the task.
Chat with this Video
AI-PoweredHi! I can answer questions about this video "Claude Code 2.0: Massive Upgrade with Agent Loops". What would you like to know?