multi-project-file-guard

multi-project-file-guard is a cursor rule for Cursor from TashanGKD/tashan-cursor-skills. It costs 68 tokens per session (2,249 once invoked), scanned A, original, MIT.

A rule for working safely in workspaces that contain several projects with files having the same names. It requires identifying the exact project and full file path before reading or changing project documents.

In plain words
What is it for?
Use it when locating, reading, or updating shared documents such as architecture plans, product definitions, deployment guides, development plans, or coding standards.
Why use it?
It prevents an agent from editing the wrong project because it found a familiar filename or guessed from the editor’s current view.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc).

Good fit Use it when locating, reading, or updating shared documents such as architecture plans, product definitions, deployment guides, development plans, or coding standards.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/tashangkd/tashan-cursor-skills/multi-project-file-guard
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/TashanGKD/tashan-cursor-skills

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for multi-project-file-guard

README.md
[![agentmods](https://agentmods.dev/badge/rules/tashangkd/tashan-cursor-skills/multi-project-file-guard/github.svg)](https://agentmods.dev/rules/tashangkd/tashan-cursor-skills/multi-project-file-guard)
Your own site
<a href="https://agentmods.dev/rules/tashangkd/tashan-cursor-skills/multi-project-file-guard"><img src="https://agentmods.dev/badge/rules/tashangkd/tashan-cursor-skills/multi-project-file-guard/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for multi-project-file-guard

Your own site · 80×15
<a href="https://agentmods.dev/rules/tashangkd/tashan-cursor-skills/multi-project-file-guard"><img src="https://agentmods.dev/badge/rules/tashangkd/tashan-cursor-skills/multi-project-file-guard.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 68 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,249 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00068 $0.02249
Opus 5 $0.00034 $0.01125
Sonnet 5 $0.00014 $0.00450
Haiku 4.5 $0.00007 $0.00225

Measured 9d ago against content hash b3a52ab062d4, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

multi-project-file-guard scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

rules/multi-project-file-guard.mdc · 186 lines

How it starts

The opening of the file, as written. The whole thing — 186 lines — stays where its author put it; the contents beside it link to each section on GitHub.

多项目同名文件防混淆规则(multi-project-file-guard)

根本问题:同一个 workspace 下有多个项目,每个项目都有 技术架构.md产品定义.mdDEPLOY_ARCH.md开发计划.md 等同名文件。 凭文件名搜索、凭 IDE 打开文件推断、凭「应该在这里」的直觉去操作,都会导致操作到错误项目的文件。


已知高风险重名文件清单(当前 workspace)

DEPLOY_ARCH.md        → scholar-match / tashan-openbrain_myagent / tashan-world / _worktree_boyuan
技术架构.md / 技术架构_*.md → tashan-openbrain_myagent / tashan-world / ai-org-builder 等
产品定义.md           → tashan-openbrain_myagent / tashan-world 等
开发计划.md           → tashan-openbrain_myagent / tashan-world 等
开发规范.md           → tashan-world / scholar-match 等

每次触碰以上任何文件时,必须先走「项目上下文锁定」流程。


触发条件

以下任一情况发生时,本规则强制生效:

  • AI 准备 Read / StrReplace / Write 一个项目级文档(技术架构/产品定义/部署架构/开发规范等)
  • 用户说「更新技术架构」「看一下部署配置」「修改开发计划」等,但没有指定完整路径
  • AI 的上下文中涉及多个项目,不能确定「当前是在操作哪个项目」
  • AI 通过 Glob/Grep 搜到多个同名文件

强制执行流程

Step 1 — 项目上下文锁定

在操作任何文件之前,必须先声明当前项目上下文

【当前操作项目】:项目群/[项目名]/
【操作文件路径】:[完整绝对路径]
【确认依据】:[用户明确说明 / 对话上下文推断 / IDE 打开文件]
  • 依据来自「用户明确说明」→ 直接执行
  • 依据来自「对话上下文推断」→ 声明后询问用户确认,确认后再操作
  • 依据来自「IDE 打开文件」→ 必须向用户确认(强制规则11:IDE状态不得劫持意图)
  • 无法确定 → 向用户列出候选项,等待选择,不可猜测

Step 2 — 路径精确化

禁止使用模糊路径:

❌ 禁止:Read 技术架构.md
❌ 禁止:StrReplace 技术架构.md
❌ 禁止:「更新技术架构里的XXX」(不带完整路径)

✅ 必须:Read t:\TashanAgent4S_2026\0310_huaxiang\项目群\tashan-world\技术架构师\技术架构.md
✅ 必须:所有文件操作工具调用都包含完整绝对路径

如果之前在对话中已经声明了路径,后续操作可引用已确认路径,但不得「默默切换」到不同项目的文件。

Step 3 — 内容读取前,不允许输出分析结论

规则 R3 READ_FIRST 的多项目强化版

❌ 禁止:未 Read 文件就输出「技术架构里面XXX是这样设计的」
❌ 禁止:基于另一个项目的文件内容去描述当前项目的架构
❌ 禁止:「这两个项目应该差不多」的假设

✅ 必须:Read 目标文件 → 解析内容 → 再分析/引用/修改

Step 4 — 跨文件引用时,验证概念逻辑自洽

当修改一个文件中的概念/设计决策时,需同时确认:

检查清单(仅当修改设计级内容时执行,不适用于纯格式修改):
□ 本文件引用了哪些其他文件的概念?(如技术架构引用产品定义中的角色/功能)
□ 被引用的概念在源文件中是否一致?(不允许概念在两个文件中有不同的定义)
□ 本次修改是否造成跨文件的不一致?(如修改了接口名称,是否同步到引用文件)
□ 所有外部引用是否都指向同一项目的文件?(不得跨项目混引)

如果发现跨文件不一致 → 在修改前告知用户,由用户决策是否同步修改。


禁止行为清单(一票否决)

❌ 凭文件名直接搜索并操作第一个结果(不看路径)
❌ 因为 IDE 当前打开了某文件就默认「用户在操作这个项目」(见强制规则11)
❌ 把 A 项目的架构设计内容写入 B 项目的文档
❌ 在不确定当前项目的情况下,自行决定路径
❌ 跨项目复用概念定义而不声明差异(「和上个项目一样」≠「不需要确认」)

Read the full file on GitHub · 186 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 186 lines · 68 tokens per session scan A b3a52ab062d4

Subscribe to this mod's changes

multi-project-file-guard is a cursor rule published in the GitHub repository TashanGKD/tashan-cursor-skills (20 stars, last pushed 5mo ago), licensed MIT. It adds 68 tokens to every session and 2,249 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.