cognitive-structure-write-guard

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

A writing-protection rule for changes to core cognitive documents. It requires path checks, version backups, attribution labels, change records, map updates, and system logs.

In plain words
What is it for?
It governs edits to L1 and L1.5 files, creates snapshots for major changes, records incremental edits, labels content by origin, and triggers the required follow-up updates.
Why use it?
It protects the knowledge structure as a source of truth and keeps a trace of what changed, why it changed, and whether the change was written by the user or AI.

Cursor rule for Cursor

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.

agentmods
npx agentmods add rules/tashangkd/cognitive-os/cognitive-structure-write-guard
Clone the repo
git clone --depth 1 https://github.com/TashanGKD/cognitive-os

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/cognitive-os/cognitive-structure-write-guard.svg)](https://agentmods.dev/rules/tashangkd/cognitive-os/cognitive-structure-write-guard)
Your own site
<a href="https://agentmods.dev/rules/tashangkd/cognitive-os/cognitive-structure-write-guard"><img src="https://agentmods.dev/badge/rules/tashangkd/cognitive-os/cognitive-structure-write-guard.svg" alt="Measured on agentmods" height="20"></a>
Per session 72 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,128 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00072 $0.02128
Opus 5 $0.00036 $0.01064
Sonnet 5 $0.00014 $0.00426
Haiku 4.5 $0.00007 $0.00213

Measured 5d ago against content hash 4df61230bb9d, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 5d 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.

.cursor/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 操作时,本规则强制生效:

  • cognitive/L1_knowledge/ 下的任何 .md 文件
  • cognitive/L1.5_principles/principles.md

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

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

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

例外(不触发本规则)

  • cognitive/L1_knowledge/[任意维度]/知识库/ 路径下的文件 → 这些是 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: cognitive/L0_brain_map.md
  • 更新该文档的「最后更新时间」字段
  • 如果本次修改修复了某个 Gap,更新 Gap 状态为 ✅
  • ⚠️ 若新增了 L1 文档,必须同步更新以下所有位置(不允许只改其中一处): ① 框架关系图(ASCII art)中的维度篇数标注 ② 目录树区段中的维度篇数标注(如「产品理论维度/(5篇)」) ③ L1 总计数标注(如「L1_系统性文档/(18篇,6个维度)」) ④ 知识图谱版本引用(如「知识图谱_正式文档.md(v1.2,18节点22边)」)

强制3:追加系统日志

  • Write: cognitive/L3_logs/system_log.md(append-only)
  • 格式:[LOG-YYYYMMDD-NN] [Skill名称 | 直接修改] | [操作摘要] | [文档名]

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

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

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. 5d ago First seen · 138 lines · 72 tokens per session scan A 4df61230bb9d

Subscribe to this mod's changes

cognitive-structure-write-guard is a cursor rule published in the GitHub repository TashanGKD/cognitive-os (8 stars, last pushed 5mo ago), licensed MIT. It adds 72 tokens to every session and 2,128 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-31.

Related

Other cursor rules, from other repositories

role-menu

他山AI产品角色菜单。列出所有可用角色Skill及触发方式。每次对话开始时AI自动知晓,用户说"开始[任务]"时按此菜单加载对应角色。.

TashanGKD/tashan-cursor-skills · 9,726 tokens

session-bootstrap

会话执行协议(执行序列,不是声明式规则)。定义每次收到消息时的强制执行顺序,以及任何实质性任务完成后的强制收尾序列。解决「role-menu Rule 14 依赖AI自我执行」的根本问题:把收尾从文本约束改为步骤序列。替代原 role-menu 第14条。.

TashanGKD/tashan-cursor-skills · 10,443 tokens

auto-experience-hook

经验自动感知钩子。任务结束时执行三步收尾:①回顾过程感知A-G信号并写入PENDING-EXPERIENCES(G=结构性根因:失败根因是规范/机制本身设计缺陷,而非执行疏忽);②自动写入任务日志.md(不输出提醒,直接写文件);③告知用户。禁止输出"请记得..."类的提醒文字。任何实质性任务完成后必须触发(由 role-menu 强制规则第14条约束执行)。.

TashanGKD/tashan-cursor-skills · 121 tokens

deploy-arch-maintenance

部署架构文档维护规则(RULE-21/22/23/24/25)。当任务涉及部署、服务器、容器、端口、域名、CI/CD、新项目上线、技术架构设计、数据库操作时自动激活。.

TashanGKD/tashan-cursor-skills · 54 tokens

frontend-brand-guard

前端品牌规范强制守门规则。任何涉及前端开发、UI组件、页面样式、配色、字体、圆角、交互的任务时自动激活。这是品牌安全级别约束,不可绕过。.

TashanGKD/tashan-cursor-skills · 2,520 tokens

full-node-audit

全节点审核规则(F-022/P10?):每个生产节点必须内置挑战者视角。当任何 Skill 完成一个「生产性输出」步骤时自动激活——包括:生成内容/代码/架构/Skill/认知碎片/产品定义等。触发后要求执行挑战者反思再输出。.

TashanGKD/tashan-cursor-skills · 73 tokens