fragment-before-direct-edit

fragment-before-direct-edit is a cursor rule for Cursor from TashanGKD/cognitive-os. It costs 71 tokens per session (561 once invoked), scanned A, a copy of fragment-before-direct-edit, MIT.

A rule for deciding whether a new idea should be added directly to a knowledge document or first saved as a fragment for later review. It applies when someone wants to add new content without explicitly choosing the direct-edit path.

In plain words
What is it for?
Use it when adding a new point to a knowledge document; it prompts you to choose direct editing or fragment capture, while allowing immediate edits for corrections and formatting changes.
Why use it?
It helps prevent duplicate or poorly integrated ideas and preserves where a new insight came from.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when adding a new point to a knowledge document; it prompts you to choose direct editing or fragment capture, while allowing immediate edits for corrections and formatting changes.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/tashangkd/cognitive-os/fragment-before-direct-edit
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/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 fragment-before-direct-edit

README.md
[![agentmods](https://agentmods.dev/badge/rules/tashangkd/cognitive-os/fragment-before-direct-edit.svg)](https://agentmods.dev/rules/tashangkd/cognitive-os/fragment-before-direct-edit)
Your own site
<a href="https://agentmods.dev/rules/tashangkd/cognitive-os/fragment-before-direct-edit"><img src="https://agentmods.dev/badge/rules/tashangkd/cognitive-os/fragment-before-direct-edit.svg" alt="Measured on agentmods" height="20"></a>
Per session 71 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 561 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 100% copy Near-identical to another mod 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.00071 $0.00561
Opus 5 $0.00036 $0.00280
Sonnet 5 $0.00014 $0.00112
Haiku 4.5 $0.00007 $0.00056

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

Security

Grade A, and why

fragment-before-direct-edit 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 8d 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.

Origin

This is a copy

100% identical to fragment-before-direct-edit — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

.cursor/rules/fragment-before-direct-edit.mdc · 53 lines

What it actually says

碎片优先规则(Fragment Before Direct Edit)

核心原则

直接修改L1文档 vs 先记录为L2碎片再整合,这两种路径有本质区别:

直接修改 先记录碎片再整合
快,但跳过了关卡A(可能引入重复) 稍慢,但经过检查
没有留下「这个想法的来龙去脉」 碎片记录了原始想法的背景
难以追溯「为什么加了这段」 碎片整合索引可追溯
适合:修改已有内容的表述 适合:加入全新的洞见或观点

触发条件

当用户说类似以下表述,且尚未明确说「直接改」时:

  • 「我想在[文档]里加上X」
  • 「[文档]的某章应该包含...」
  • 「我觉得[文档]漏了一个点」
  • 「[文档]需要补充...」

AI 应该做的事

在直接修改之前,先询问一次:

「这个新观点是加入[文档],还是先作为碎片记录后再整合?

直接修改:更快,适合修改已有表述、纠正错误 先记碎片:更严谨,适合加入全新洞见(会自动检查是否重复、标注关联)

[直接修改] [先记录为碎片]」

→ 用户选「直接修改」→ 触发 cognitive-update-knowledge Skill → 用户选「先记录为碎片」→ 触发 cognitive-capture-fragment Skill,之后自动问是否立即整合


例外情况(不需要询问,直接执行修改)

  • 用户明确说「直接改」「不用记碎片了」
  • 修改类型是纠正错别字/改格式/更新日期等非内容修改
  • 用户正在执行某个 Skill 的中间步骤(已经走在整合流程里)
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. 8d ago First seen · 53 lines · 71 tokens per session scan A 210b5bb7ea14

Subscribe to this mod's changes

fragment-before-direct-edit is a cursor rule published in the GitHub repository TashanGKD/cognitive-os (8 stars, last pushed 5mo ago), licensed MIT. It adds 71 tokens to every session and 561 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to fragment-before-direct-edit, differing in 0 lines, and is treated as a copy.

Related

Other cursor rules, from other repositories

cognitive-l3-auto-log

An automatic logging rule for important changes to a cognitive-structure system. It appends dated entries to a system log after related skills run or key documents and records are changed.

TashanGKD/tashan-cursor-skills · 1,083 tokens

cognitive-principle-check

A consistency check for adding new material to L1 cognitive-structure documents. It compares the new text with confirmed L1.5 principles, which are the system’s underlying rules.

TashanGKD/tashan-cursor-skills · 57 tokens

profile-collector

A Chinese-language assistant for building and maintaining a structured researcher's profile. The profile records identity, skills, current needs, thinking style, motivation, personality, and an overall interpretation.

TashanGKD/tashan-cursor-skills · 34 tokens

fragment-before-direct-edit

A rule for recording a new idea as a smaller knowledge fragment before adding it to a main knowledge document. It distinguishes new insights from corrections, formatting changes, and other direct edits.

TashanGKD/tashan-cursor-skills · 71 tokens

memory-bank

You are an expert software engineer with a unique characteristic: your memory resets completely between sessions. This isn't a limitation - it's what drives you to maintain perfect documentation. At the beginning of each dialogue, you rely ENTIRELY on your Memory Bank to understand the project and continue work…

leshchenko1979/fast-mcp-telegram · 1,623 tokens

memory

Persistent memory graph — load graphindex.md at session start, follow task routing table, update after significant changes.

karstom/simplegraph-agentic · 291 tokens