dual-agent-fork-guard

dual-agent-fork-guard is a cursor rule for Cursor from TashanGKD/tashan-cursor-skills. It costs 806 tokens per session, scanned A, original, MIT.

A coding rule that warns when a proposed agent, module, or code path substantially overlaps with an existing one. It recommends reuse, extension, or a separate component only when there is a justified reason.

In plain words
What is it for?
Use it during system design and implementation to compare overlapping components, identify shared behavior, and require justification before adding an independent path.
Why use it?
It helps prevent architectural forks, where two implementations solve essentially the same problem and later need to be merged.

Cursor rule for Cursor

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

Good fit Use it during system design and implementation to compare overlapping components, identify shared behavior, and require justification before adding an independent path.

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

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

Your own site · 80×15
<a href="https://agentmods.dev/rules/tashangkd/tashan-cursor-skills/dual-agent-fork-guard"><img src="https://agentmods.dev/badge/rules/tashangkd/tashan-cursor-skills/dual-agent-fork-guard.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 806 This file is loaded in full into every session.
When invoked 806 The same file — it is already loaded in full.
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.00806 $0.00806
Opus 5 $0.00403 $0.00403
Sonnet 5 $0.00161 $0.00161
Haiku 4.5 $0.00081 $0.00081

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

Security

Grade A, and why

dual-agent-fork-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 12d 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/dual-agent-fork-guard.mdc · 76 lines

What it actually says

架构分叉警示(dual-agent-fork-guard)

根因(2026-03-22 消息系统架构设计发现): 「消息对话」和「proxy模式」本质同构,均为「用户与分身的认知文档对话」, 过早引入独立 MESSAGE_AGENT 造成不必要的代码分叉,最终需要合并。 认知规律:「两套 agent/模块/服务 做同一件事」是架构分叉的警示信号。


核心规则(系统设计/代码实现任务中生效)

检测触发条件(任一满足即触发):

  • 正在创建第二个「与已有X功能高度相似」的 Agent/Skill/模块
  • 正在为两条「本质相同的路径」分别实现逻辑
  • 发现代码库中两个函数/类的职责有≥70%重叠

检测到时,必须在继续执行前输出警示:

⚠️ [架构分叉检测]
发现 [新组件名] 与 [已有组件名] 可能做同一件事:
  新组件:[一句话描述职责]
  已有组件:[一句话描述职责]
  相同点:[列出3条相同的核心行为]
  差异点:[列出真实存在的差异,如无则说明]

建议:
  A. 直接复用已有组件(差异通过参数/配置解决)
  B. 扩展已有组件(在原有基础上加入差异行为)
  C. 确实需要独立组件(请说明无法合并的根本原因)

等待确认后继续。

典型案例(已验证)

案例1:tashan-openbrain 消息系统

  • 错误:新建 MESSAGE_AGENT(第一人称消息对话)
  • 正确:复用 PROXY_AGENT(同为「与分身的认知文档对话」,仅视角不同)
  • 修复:将 messages.py 的 agent_type="message" 改为 agent_type="proxy"

案例2:「用户上传文档建脑」vs「NPC内容提取」

  • 错误:写独立的 extract_npc_content.py 自定义逻辑
  • 正确:复用 /twin/build-cognition 端点(同一条认知构建管道)
  • 修复:run_npc_init.py 调用相同的代码路径

合并优先级原则

单一代码路径 > 参数化分支 > 继承/组合 > 独立组件

只有满足以下所有条件,才允许创建独立组件:
1. 两者有根本不同的安全边界(如:写入权限不同)
2. 两者的核心算法逻辑无法统一
3. 合并会导致代码复杂度净增加(有量化证据)

变更记录

2026-03-23 — 初始创建

根因:project-retrospective-20260323 E1 类架构级发现。 来源:消息/proxy同构问题(PENDING-EXPERIENCES 2026-03-22 新发现E)。 本 Rule 作为 alwaysApply 约束,在架构设计和代码实现任务中触发分叉检测。

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. 12d ago First seen · 76 lines · 806 tokens per session scan A 3870dff3050c

Subscribe to this mod's changes

dual-agent-fork-guard is a cursor rule published in the GitHub repository TashanGKD/tashan-cursor-skills (20 stars, last pushed 5mo ago), licensed MIT. It adds 806 tokens to every session, about $0.0040 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.