Skip to content

Instantly share code, notes, and snippets.

@grittyninja
Last active October 29, 2025 14:12
Show Gist options
  • Select an option

  • Save grittyninja/a9964ece9b40dc4346aba4550ad73b90 to your computer and use it in GitHub Desktop.

Select an option

Save grittyninja/a9964ece9b40dc4346aba4550ad73b90 to your computer and use it in GitHub Desktop.
---
alwaysApply: false
---
<system-reminder>
# Cursor Native Tools Policy
<mandatory-rules>
## Primary Directive
ALL file operations and code searches MUST use Cursor native tools. Terminal commands are restricted to project execution only.
## Tool Hierarchy
<file-operations>
### File Operations
- **Read**: `read_file` - View file contents
- **Write/Edit**: `edit_file` - Create or modify files with precise diffs
- **Delete**: `delete_file` - Remove files
- **Navigate**: `list_dir` - List directory contents
- **Search**: `glob_file_search` - Find files by pattern
</file-operations>
<code-search>
### Code Search
- **Semantic**: `codebase_search` - Find code by meaning/concept
- **Exact**: `grep` - Find exact strings/symbols (ripgrep-based)
- **Diagnostics**: `read_lints` - Read linter errors
</code-search>
<terminal-usage>
### Terminal Usage
**Allowed via `run_terminal_cmd`:**
- Project commands: `npm test`, `pytest`, `cargo build`
- Package management: `npm install`, `pip install`
- Version control: `git status`, `git commit`
- Project scripts defined in package.json, Makefile, etc.
- NEVER use `apply_patch`
**NEVER use terminal for:**
- File reading/writing/editing
- Text manipulation
- Code searching
- File system operations
</terminal-usage>
</mandatory-rules>
<forbidden-patterns>
## Explicitly Forbidden Shell Commands
### File Writing
- `echo >`, `echo >>`, `cat >`, `tee`
- `printf >`, `heredoc`, `redirection operators`
### File Editing
- `sed -i`, `awk`, `ed`, `perl -i`, `apply_patch`
- Any in-place text manipulation
### File Operations
- `mv`, `cp`, `rm`, `mkdir` via shell
- `touch`, `ln`, `chmod` via shell
### Search Operations
- Shell `grep`, `rg`, `ag`, `find`
- `locate`, `which`, `whereis` for code search
### Wrapper Patterns
- `bash -lc` wrapper
- Chained shell pipelines for file manipulation
- Multi-line bash scripts for editing
</forbidden-patterns>
<required-workflow>
## Required Workflow Patterns
### Before Any Edit
1. Use `read_file` to view current content
2. Plan minimal, targeted changes
3. Apply via `edit_file` with specific hunks
### For Code Discovery
1. Start with `codebase_search` for semantic understanding
2. Use `grep` for exact symbol/string matches
3. Never fall back to shell search commands
### For File Management
1. Use `list_dir` to explore structure
2. Use `glob_file_search` for pattern matching
3. Use native tools for all create/move/delete operations
### For Project Tasks
1. Use `run_terminal_cmd` directly. **NEVER** use bash wrapper
2. Capture only essential output
3. Keep commands simple and project-specific
</required-workflow>
<enforcement>
## Enforcement Principles
### Every file operation MUST:
- Use the corresponding native tool
- Provide clear intent before execution
- Generate auditable, reviewable changes
### Every search operation MUST:
- Prioritize semantic search over text matching
- Use native search tools exclusively
- Respect project ignore patterns
### Terminal commands MUST:
- Be limited to project execution tasks
- Run directly without shell wrappers
- Never manipulate files or search code
</enforcement>
<rationale>
## Why This Matters
Native tools provide:
- **Safety**: Structured diffs and rollback capability
- **Context**: Preserve editor state and history
- **Reliability**: Consistent behavior across environments
- **Auditability**: Clear change tracking and review
Shell commands for file operations are:
- **Brittle**: Platform-dependent behavior
- **Dangerous**: No rollback or diff preview
- **Opaque**: Hard to review and audit
- **Context-loss**: Break editor integration
</rationale>
</system-reminder>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment