agentleFS
NVIDIAKnown publisherNVIDIA/Personal-AI-Router/.cursor/rules/file-editing.mdc

Personal-AI-Router / rules

Cursor rule1.5k starsChanged 2 months agoApache-2.0View on GitHub

Read-before-write rule — always Read a file before Write/StrReplace. No shell scripts to mutate code. No exceptions.

Trending

Quiet since September.thin dataabout the whole repository

Dec 2025: 0 mentionsJan 2026: 0 mentionsFeb 2026: 0 mentionsMar 2026: 0 mentionsApr 2026: 0 mentionsMay 2026: 0 mentionsJun 2026: 0 mentionsJul 2026: 0 mentionsAug 2026: 0 mentionsSep 2026: 10 mentionsOct 2026: 0 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the NVIDIA/Personal-AI-Router repository that our weekly crawl found: only 10 in all, so this is a hint, not a trend. There is no adoption data for this file yet.

Who's talking about NVIDIA/Personal-AI-Router

The biggest 5 of 10 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 10

Talked about on GitHub, Hacker News and Bluesky (10 times).

On GitHub · 6

1 more on GitHub

On Hacker News · 2

The file

Files
file-editing.mdc
---
description: Read-before-write rule — always Read a file before Write/StrReplace. No shell scripts to mutate code. No exceptions.
alwaysApply: true
---
<!--
SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
SPDX-License-Identifier: Apache-2.0
-->

# File Editing

## NEVER use shell commands or scripts to modify code

This is the **hard top-tier rule** of this repo. **Never** use `sed`,
`awk`, `perl -i`, `tr`, `find -exec`, PowerShell `(Get-Content … | Set-Content)`,
heredoc-into-file, `echo > file`, or any other shell construct that mutates
source files. **Always** use the dedicated edit tools: `StrReplace`,
`Write`, or `EditNotebook`.

Why: shell-based rewrites bypass Cursor's diff UI. The user cannot review,
accept, or reject the change — it just happens silently. Even a "tiny
rename" across many files must be done as a series of `StrReplace` calls
(one per file, or `replace_all: true` within a file) so each edit shows up
in the diff panel.

- ❌ `sed -i 's/foo/bar/g' src/**/*.ts`
- ❌ `find src -name '*.ts' -exec sed -i …`
- ❌ `node -e "require('fs').writeFileSync(…)"`
- ❌ `cat > file.ts <<'EOF' … EOF`
- ✅ `StrReplace` with `replace_all: true` for in-file mass-rename
- ✅ One `StrReplace` per file for cross-file rename (read each first)
- ✅ `Write` only when creating a new file or wholesale rewriting
  (after `Read`)

The `Shell` tool is for actual terminal operations (`git`, `npm`,
`tsc`, `lint`, etc.) only. If you catch yourself reaching for `sed`
to "save tool calls", **stop** — the user must see every code change.

## ALWAYS read a file before editing it

The user may have edited the file since you last read it. Your memory of
the file is stale. Before **any** `Write` or `StrReplace` call, call
`Read` on the target path **in the same turn**.

- `Write` is **destructive** — no old_string check, no safety net. A
  stale mental model silently erases the user's edits.
- `StrReplace` self-validates via `old_string`, but when the fuzzy match
  shows the file has drifted from what you expect, **re-read first**
  rather than forcing a match.
- A `preToolUse` hook (see `.cursor/hooks.json`) blocks `Write` on
  existing files that have not been read this session. Do not work
  around it — call `Read` and retry.

## No legacy fallbacks

This is a greenfield codebase. Do not add compatibility shims, alternate
resolution paths, or "just in case" code. See **`no-legacy-fallbacks.mdc`**.

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.