project-independence

project-independence is a cursor rule for Cursor from TashanGKD/tashan-cursor-skills. It costs 67 tokens per session (1,271 once invoked), scanned A, original, MIT.

A set of project rules for keeping software self-contained when it uses code from another project. It requires copied source code to retain its licence and version details, while external packages may be used only through stable public interfaces.

In plain words
What is it for?
Planning integrations, forks, and copied source code, especially when maintaining reference copies of upstream repositories.
Why use it?
It prevents a project from breaking because it depends on private file paths, build-generated names, or hidden implementation details in another project.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc). Also seen: built for openclaw; mentions OpenCode.

Good fit Planning integrations, forks, and copied source code, especially when maintaining reference copies of upstream repositories.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/tashangkd/tashan-cursor-skills/project-independence
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 project-independence

README.md
[![agentmods](https://agentmods.dev/badge/rules/tashangkd/tashan-cursor-skills/project-independence/github.svg)](https://agentmods.dev/rules/tashangkd/tashan-cursor-skills/project-independence)
Your own site
<a href="https://agentmods.dev/rules/tashangkd/tashan-cursor-skills/project-independence"><img src="https://agentmods.dev/badge/rules/tashangkd/tashan-cursor-skills/project-independence/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 project-independence

Your own site · 80×15
<a href="https://agentmods.dev/rules/tashangkd/tashan-cursor-skills/project-independence"><img src="https://agentmods.dev/badge/rules/tashangkd/tashan-cursor-skills/project-independence.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 67 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,271 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.00067 $0.01271
Opus 5 $0.00034 $0.00635
Sonnet 5 $0.00013 $0.00254
Haiku 4.5 $0.00007 $0.00127

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

Security

Grade A, and why

project-independence 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/project-independence.mdc · 119 lines

How it starts

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

项目独立性规范(RULE-INDEP)

触发条件:任何涉及"基于 X 项目构建"、"集成第三方库"、"fork 已有仓库"的架构设计或开发任务。


核心原则

每个他山项目必须完全自包含(self-contained),运行时不依赖外部项目的私有 API 或内部实现细节。


强制规则

RULE-INDEP-1:外部代码通过「复制源码」集成,不通过「安装包后引用私有路径」

❌ 错误做法:
  import { MemoryIndexManager } from "openclaw/dist/manager-runtime--abc123.js"
  问题:dist 文件名含 hash,每次编译变化,私有路径无版本保证

✅ 正确做法:
  1. 确认外部项目许可证允许复制(MIT/Apache 等开源许可)
  2. 将所需源码目录复制到本项目内,如:
     cp -r reference/repos/openclaw/src/memory/  apps/server/src/memory-engine/
  3. 在文件头部注明来源:
     // 来源:openclaw/src/memory/(openclaw 项目,MIT 许可)
     // 原始 commit:ef7a5c3
     // 与上游的差异:[列出所有修改]
  4. 在 reference/repos/ 维护原始版本作为同步基准

RULE-INDEP-2:只允许依赖外部包的「公开稳定 API」

判断标准:该 API 是否出现在 package.json 的 exports 字段中?
  ✅ 出现在 exports → 公开 API,可以 import
  ❌ 不在 exports,是 dist/ 内部路径 → 私有 API,不允许 import

示例:
  ✅ import { something } from "some-package"          ← 主入口公开 API
  ✅ import { x } from "some-package/plugin-sdk/core"  ← exports 里声明的路径
  ❌ import { x } from "some-package/dist/index-abc.js" ← hash 路径,私有
  ❌ import { x } from "some-package/src/internal/x"   ← src 内部路径,私有

RULE-INDEP-3:reference/ 目录是参考基准,不是运行时依赖

reference/repos/         ← 只读参考(git clone --depth=1 上游仓库)
  opencode/              ← 用于理解架构、找到要复制的模块
  openwork/              ← 作为 fork 的上游基准
  openclaw/              ← 用于复制需要的源码模块
  
注意:
  ✅ 开发时阅读 reference/ 理解代码
  ✅ 从 reference/ 复制源码到自己项目
  ❌ 运行时让项目代码 import from reference/ 路径
  ❌ 把 reference/ 里的包安装为 npm 依赖后引用私有路径

RULE-INDEP-4:Fork 项目必须明确声明「何时与上游同步」

每个 fork 的项目必须有:
1. TASHAN-ARCHITECTURE.md(或等效文档)声明上游仓库和 commit hash
2. 说明哪些文件是「从上游复制但做了修改」及修改原因
3. 定义上游同步策略:
   - 跟随上游:定期 git merge upstream/main
   - 定点冻结:只在有明确需求时手动同步特定模块

例外情况

以下情况允许直接安装并使用外部包:

情况 条件
使用 npm 包的公开 API 必须出现在 package.json exports 中
使用广泛使用的工具库 如 zod / @sinclair/typebox / bun:sqlite 等标准工具
已发布稳定 npm 版本的模块 版本锁定在 package.json 中

触发后立即执行

1. 检查本次架构/开发是否涉及引用外部项目代码
2. 若涉及:
   □ 该代码是否通过 package.json exports 公开暴露?
     是 → 可以安装包并 import
     否 → 必须复制源码
   □ 如复制源码:是否在文件头部注明来源和修改记录?
   □ reference/repos/ 是否已有该上游仓库的 git clone?
3. 在架构文档的「依赖策略」章节声明

Read the full file on GitHub · 119 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 · 119 lines · 67 tokens per session scan A f6a7f7cd0fce

Subscribe to this mod's changes

project-independence is a cursor rule published in the GitHub repository TashanGKD/tashan-cursor-skills (20 stars, last pushed 5mo ago), licensed MIT. It adds 67 tokens to every session and 1,271 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.