agentleFS
wrm3wrm3/ai_project_template/.cursor/rules/computer_use/computer_use_agent.mdc

ai_project_template / computer_use

Cursor rule1 starsChanged 13 months agoMITView on GitHub

AI-powered desktop automation using screenshots and vision-guided actions to control any desktop application. Use these rules when user requests involve: - Desktop application automation - GUI control or navigation - Form filling in native applications - Multi-application workflows - Tasks requiring vision-based screen analysis - Automation that can't be done via browser or API The fstrent_mcp_computer_use MCP server provides: - computer_use_run_task - Execute complete multi-step automation task - computer_use_screenshot - Capture current screen - computer_use_click - Click at screen coordinates…

The file

Show its rules and text

We split this computer_use_agent.mdc into the rules it gives an agent

22 rules. About 0 are common, 20 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈20

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use these rules when user requests involve:

    line 9
  2. Very specific:

    Use computer_use_run_task MCP tool:

    line 82
  3. Distinctive:

    Verify element location via screenshot first

    line 107
  4. Distinctive:

    Use appropriate delay after click

    line 108
  5. Distinctive:

    Verify text entered correctly

    line 119
  6. Distinctive:

    Use multiple small scrolls vs one large

    line 138
  7. Distinctive:

    Verify target element visible

    line 139
  8. Distinctive:

    Wait longer (increase delay)

    line 192
  9. Distinctive:

    Check if application crashed

    line 193
  10. Distinctive:

    Do NOT force close without permission

    line 196
  11. Distinctive:

    Use web-tools for browser automation

    line 276
  12. Distinctive:

    Use computer-use-agent for native app parts

    line 277
  13. Distinctive:

    Use database-tools for data queries

    line 281
  14. Distinctive:

    Use computer-use-agent for UI without API

    line 282
  15. Distinctive:

    Use file-operations for batch file processing

    line 286
  16. Distinctive:

    Use computer-use-agent for GUI file operations

    line 287
  17. Distinctive:

    Start simple: - Test easy tasks first

    line 292
  18. Distinctive:

    Use appropriate delays: - Don't rush

    line 295
  19. Distinctive:

    Enable logging: - Always save screenshots

    line 297
  20. Distinctive:

    Verify results: - Check task completed correctly

    line 298
  21. Distinctive:

    Communicate clearly: - Keep user informed

    line 300
  22. Very specific:

    Ensure fstrent_mcp_computer_use is in .mcp.json:

    line 304

≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
computer_use_agent.mdc
# Computer Use Agent - Cursor Rules

## Overview

AI-powered desktop automation using screenshots and vision-guided actions to control any desktop application.

## When to Apply

Use these rules when user requests involve:
- Desktop application automation
- GUI control or navigation
- Form filling in native applications
- Multi-application workflows
- Tasks requiring vision-based screen analysis
- Automation that can't be done via browser or API

## MCP Tools Available

The `fstrent_mcp_computer_use` MCP server provides:
- `computer_use_run_task` - Execute complete multi-step automation task
- `computer_use_screenshot` - Capture current screen
- `computer_use_click` - Click at screen coordinates
- `computer_use_type` - Type text into focused element
- `computer_use_key_press` - Press keyboard keys
- `computer_use_scroll` - Scroll in specified direction
- `computer_use_mouse_move` - Move mouse to coordinates

## Safety Requirements

### Mandatory Safety Checks

**BEFORE executing ANY automation:**
1. ✅ Verify FAILSAFE is enabled (move mouse to upper-left corner to abort)
2. ✅ Confirm appropriate action delay is set (0.5-2.0 seconds)
3. ✅ Set reasonable max steps limit (10-100 based on complexity)
4. ✅ Enable screenshot logging for audit trail
5. ✅ Explain to user what will happen

**DURING automation:**
1. ✅ Pause between actions (respect action_delay)
2. ✅ Verify each action completed successfully
3. ✅ Check for unexpected states
4. ✅ Count steps to prevent infinite loops
5. ✅ Save screenshots for audit trail

**AFTER automation:**
1. ✅ Verify task completed as expected
2. ✅ Report results to user
3. ✅ Note any errors or issues
4. ✅ Provide screenshot paths for audit

### Prohibited Actions

**NEVER automate:**
- ❌ Password entry (security risk)
- ❌ Banking or financial transactions (too risky)
- ❌ System configuration changes (without explicit user permission)
- ❌ File deletion (without confirmation)
- ❌ Email sending (without user review)
- ❌ Social media posting (without user review)
- ❌ Anything involving PII or sensitive data

## Core Workflow

### Step 1: Task Analysis
1. Understand the goal
2. Identify applications involved
3. Assess complexity
4. Check safety implications
5. Confirm approach with user

### Step 2: Safety Configuration
```yaml
failsafe_enabled: true        # Always enabled
action_delay: 0.5-2.0         # Based on UI speed
max_steps: 10-100             # Based on complexity
confirmation_mode: varies     # true for first run/high risk
screenshot_logging: true      # Always enabled
```

### Step 3: Execute Automation
Use `computer_use_run_task` MCP tool:
```
computer_use_run_task(
    task_description="Clear description of task",
    max_steps=25,
    action_delay=0.5,
    save_screenshots=true
)
```

### Step 4: Monitor and Report
1. Check results
2. Review screenshots
3. Report to user
4. Provide audit trail
5. Note any issues

## Action Types

### Click Actions
- Click buttons, links, menu items
- Select checkboxes/radio buttons
- Activate UI controls

**Best Practices:**
- Verify element location via screenshot first
- Use appropriate delay after click
- Confirm expected state change

### Type Actions
- Fill text fields
- Enter search queries
- Input form data

**Best Practices:**
- Click field first to ensure focus
- Type slowly for character-by-character processing apps
- Verify text entered correctly

### Key Press Actions
Common keys:
- `Enter` - Submit forms, confirm dialogs
- `Tab` - Navigate between fields
- `Escape` - Close dialogs
- `Ctrl+C` - Copy
- `Ctrl+V` - Paste
- `Ctrl+S` - Save

### Scroll Actions
- `down` - Scroll down (most common)
- `up` - Scroll up
- `left` - Scroll left
- `right` - Scroll right

**Best Practices:**
- Capture screenshot after scrolling
- Use multiple small scrolls vs one large
- Verify target element visible

## Multi-Step Workflow Patterns

### Form Filling
```
1. Capture screenshot to locate form
2. For each field:
   a. Click field to focus
   b. Type value
   c. Verify value entered
3. Click submit button
4. Verify submission confirmation
```

### Menu Navigation
```
1. Capture screenshot to locate menu
2. Click menu to open
3. Wait for menu animation
4. Capture screenshot of open menu
5. Click menu item
6. Verify expected result
```

### File Operations
```
1. Open File Explorer
2. Navigate to source folder
3. Select file(s)
4. Copy/cut (Ctrl+C or Ctrl+X)
5. Navigate to destination
6. Paste (Ctrl+V)
7. Verify files copied/moved
```

## Error Handling

### Element Not Found
1. Capture fresh screenshot
2. Verify application state
3. Scroll if element off-screen
4. Try alternate identification
5. Report to user if still not found

### Unexpected Dialog
1. Capture screenshot of dialog
2. Analyze dialog type
3. Click appropriate button
4. Return to expected state
5. Retry original action

### Application Not Responding
1. Wait longer (increase delay)
2. Check if application crashed
3. Try keyboard shortcut to activate
4. Report to user if unrecoverable
5. Do NOT force close without permission

## Risk Assessment

### Low Risk (✅ Safe to Automate)
- Read-only operations
- Test environments
- Easily reversible
- No sensitive data

**Examples:** Reading content, navigating menus, taking screenshots

### Medium Risk (⚠️ Requires Caution)
- Modifies non-critical data
- Production environments
- Reversible with effort
- Professional data

**Examples:** Filling forms, creating documents, moving files

### High Risk (🛑 Extreme Caution)
- Deletes/overwrites data
- Difficult to reverse
- External communications
- System-level changes

**Examples:** Deleting files, sending emails, system settings

**Require confirmation + continuous monitoring**

### Prohibited (❌ Never Automate)
- Credentials/secrets
- Financial transactions
- Sensitive personal data
- Irreversible consequences

## User Communication

### Initial Response
```
I'll help you automate [TASK]. Here's my plan:

1. [Step 1]
2. [Step 2]
3. [Step 3]

Safety settings:
- FAILSAFE enabled (move mouse to upper-left corner to abort)
- Action delay: [X] seconds
- Max steps: [Y]
- Screenshot logging: enabled

Ready to proceed?
```

### Progress Updates
```
Progress update:
- Completed: [Steps completed]
- Current: [Current action]
- Remaining: [Estimated remaining]
- Status: [On track / Issue detected]
```

### Completion Report
```
Task completed successfully!

Summary:
- Task: [Description]
- Steps executed: [X]
- Time elapsed: [Y] seconds
- Screenshots saved: [Z] files

Screenshot audit trail: [Path]
```

## Integration with Other Tools

### With Web Tools
- Use web-tools for browser automation
- Use computer-use-agent for native app parts
- Combine for workflows spanning web and desktop

### With Database Tools
- Use database-tools for data queries
- Use computer-use-agent for UI without API
- Combine for data import/export workflows

### With File Operations
- Use file-operations for batch file processing
- Use computer-use-agent for GUI file operations

## Best Practices

1. **Always prioritize safety** - FAILSAFE, confirmations, logging
2. **Start simple** - Test easy tasks first
3. **Explain before executing** - Tell user the plan
4. **Monitor closely** - Watch first runs carefully
5. **Use appropriate delays** - Don't rush
6. **Set realistic step limits** - Prevent runaway automation
7. **Enable logging** - Always save screenshots
8. **Verify results** - Check task completed correctly
9. **Handle errors gracefully** - Detect, recover, or report
10. **Communicate clearly** - Keep user informed

## Configuration

Ensure `fstrent_mcp_computer_use` is in `.mcp.json`:
```json
{
  "mcpServers": {
    "fstrent_mcp_computer_use": {
      "command": "uv",
      "args": [
        "--directory",
        "C:\\.ai\\mcps\\fstrent_mcp_computer_use",
        "run",
        "fstrent_mcp_computer_use"
      ]
    }
  }
}
```

## Reference

For detailed information, see Claude Code Skill:
- `.claude/skills/computer-use-agent/SKILL.md`
- `.claude/skills/computer-use-agent/rules.md`
- `.claude/skills/computer-use-agent/reference/safety_guidelines.md`
- `.claude/skills/computer-use-agent/examples/automation_workflows.md`

---

**Remember:** This controls the user's actual computer. Safety must always be the top priority. When in doubt, ask for confirmation.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.