cognitive-structure-write-guard

cognitive-structure-write-guard is a cursor rule for Cursor from TashanGKD/tashan-cursor-skills. It costs 86 tokens per session (2,209 once invoked), scanned A, original, MIT.

A set of writing safeguards for changing core cognitive-structure documents. It checks the file path and requires backups, change notes, source labels, related updates, and a system log.

In plain words
What is it for?
Use it when editing files in the L1 or L1.5 cognitive-structure directories. It helps preserve versions, record changes, label user and AI contributions, and update connected records.
Why use it?
It prevents important shared documents from being changed without a clear history or trace of where new content came from. It also helps avoid writing to the wrong directory.

Cursor rule for Cursor

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

Good fit Use it when editing files in the L1 or L1.5 cognitive-structure directories. It helps preserve versions, record changes, label user and AI contributions, and update connected records.

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

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

Your own site · 80×15
<a href="https://agentmods.dev/rules/tashangkd/tashan-cursor-skills/cognitive-structure-write-guard"><img src="https://agentmods.dev/badge/rules/tashangkd/tashan-cursor-skills/cognitive-structure-write-guard.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 86 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,209 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.00086 $0.02209
Opus 5 $0.00043 $0.01104
Sonnet 5 $0.00017 $0.00442
Haiku 4.5 $0.00009 $0.00221

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

Security

Grade A, and why

cognitive-structure-write-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/cognitive-structure-write-guard.mdc · 138 lines

How it starts

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

认知结构写保护规则(Cognitive Structure Write Guard)

核心原则

写入L1或L1.5文档,不是一个简单的文件修改操作,而是对「系统唯一真相」的变更,必须完整执行下面的流程。


触发条件

当 AI 准备对以下路径中的文件执行 Write 操作时,本规则强制生效:

  • _内部总控/认知结构/L1_系统性文档/ 下的任何 .md 文件
  • _内部总控/认知结构/L1.5_底层原则层/底层原则库.md

⚠️ 写入前路径合法性检查(新增,2026-03-20)

在执行任何写入之前,先验证路径:

  1. 目标路径是否在 _内部总控/认知结构/ 的合法子目录内?
    • 合法:L1_系统性文档/[维度]/L1.5_底层原则层/L2_碎片化思考/L3_原始记录/[维度]/知识库/
    • 不合法(常见错误路径)产品定义/项目群/_内部总控/(非认知结构子目录)
  2. 若路径不合法 → 立即停止写入,提示: 「⚠️ 路径合法性检查失败:[目标路径] 不在认知结构合法目录内。请确认是否应该写入认知结构,或选择正确的路径(项目目录/产品定义目录等)」

例外(不触发本规则)

  • _内部总控/认知结构/L1_系统性文档/[任意维度]/知识库/ 路径下的文件 → 这些是 REF-EXT 外部参考知识,遵循「维护协议_自洽规范.md → 新增REF-EXT文档时」规则,无需版本快照/归因标注/L0更新 → 本规则的强制5步骤不适用于知识库/目录

强制执行流程(不可跳过任何一步)

写入前

检查1:版本快照与变更记录

第一次写入该文档(文档刚迁入认知结构): → 创建 v1.0 快照:历史版本/[文档名]_v1.0_YYYYMMDD.md → 新建 [文档名]_变更记录.md(记录 v1.0 的建立时间和背景)

非第一次写入(文档已有 x.0 快照): → 判断此次修改是否为「重大变更」(核心论点变化/结构重组):

  • 是重大变更 → 先创建新的 x.0 快照(v2.0/v3.0...),再修改
  • 是增量修改 → 直接修改,修改完成后必须在变更记录中追加一条 → 不允许跳过记录直接修改

检查2:归因标注

  • 写入的内容必须包含归因标记:
    • 🔵 = 用户原始思考(用户直接说的内容)
    • 🟢 = AI整理(AI对用户思考的结构化提炼)
    • 🟡 = AI生成(AI基于已有文档推导的新内容)
  • 如果 AI 发现自己准备写入的内容没有归因标记,先标注再写入

写入后(并行执行,顺序不限,但全部必须完成)

强制1:追加变更记录 查找或新建 [文档名]_变更记录.md(与文档同目录),追加一条:

## [YYYY-MM-DD] [操作类型]
**修改位置**:[章节]
**修改摘要**:[一句话]
**归因**:[🔵/🟢/🟡]
**触发来源**:[用户指令 | Skill名称 | 矛盾消解]

强制2:更新L0大脑总地图(必须同步 L0 内所有计数引用)

  • Write: _内部总控/认知结构/L0_大脑总地图.md
  • 更新该文档的「最后更新时间」字段
  • 如果本次修改修复了某个 Gap,更新 Gap 状态为 ✅
  • ⚠️ 若新增了 L1 文档,必须同步更新以下所有位置(不允许只改其中一处): ① 框架关系图(ASCII art)中的维度篇数标注 ② 目录树区段中的维度篇数标注(如「产品理论维度/(5篇)」) ③ L1 总计数标注(如「L1_系统性文档/(18篇,6个维度)」) ④ 知识图谱版本引用(如「知识图谱_正式文档.md(v1.2,18节点22边)」)

强制3:追加系统日志

  • Write: _内部总控/认知结构/L3_原始记录/系统日志.md(append-only)
  • 格式:[LOG-YYYYMMDD-NN] [Skill名称 | 直接修改] | [操作摘要] | [文档名]

强制4:更新文档分类清单(迁移操作时必须执行)

  • 触发条件:当操作是「将文档从原始位置复制/迁移到认知结构」时
  • Write: _内部总控/认知结构/文档分类清单.md
  • 将该文档的状态从 ◑ PENDING 更新为 ★ CURRENT,并注明认知结构中的实际路径
  • 不允许跳过:迁移后分类清单状态不更新 = C5 违规,必须立即修复

强制5:更新知识图谱(新增 L1 文档时必须执行)

  • 触发条件:当操作是「新建一篇 L1 文档(首次写入)」时
  • Write: _内部总控/认知结构/知识图谱_正式文档.md
  • 在「三、文档定位总表」的 L1 表格中追加一行(文档ID / 简称 / 聚类 / 核心主张 / 认知结构位置)
  • 在「二、完整关系边图」中追加新文档与现有文档的关系边(至少1条)
  • 更新文件末尾的「图谱版本行」(更新篇数计数 + 关系边计数)
  • 不允许跳过:新增 L1 文档后知识图谱未更新 = C3 违规,必须立即修复

Read the full file on GitHub · 138 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 · 138 lines · 86 tokens per session scan A ca43e9517e78

Subscribe to this mod's changes

cognitive-structure-write-guard is a cursor rule published in the GitHub repository TashanGKD/tashan-cursor-skills (20 stars, last pushed 5mo ago), licensed MIT. It adds 86 tokens to every session and 2,209 once invoked, about $0.0004 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.