documentation

A set of rules for organizing Markdown documentation in a code project. README files stay at workspace or module roots, while other Markdown files go inside docs folders.

In plain words
What is it for?
Use it to decide where new guides, summaries, and architecture notes belong, and to check whether README files are placed and linked correctly.
Why use it?
It prevents documentation from being scattered through source and script directories. It also defines when documentation should be created and requires README files to link to their docs folder.

Cursor rule

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/cdbattags/ai/documentation
Clone the repo
git clone --depth 1 https://github.com/cdbattags/ai
Per session 369 This file is loaded in full into every session.
When invoked 369 The same file — it is already loaded in full.
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.00369 $0.00369
Opus 5 $0.00185 $0.00185
Sonnet 5 $0.00074 $0.00074
Haiku 4.5 $0.00037 $0.00037

Measured yesterday against content hash 81b37d14c41f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

documentation 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 yesterday.

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.

src/rules/documentation.mdc · 53 lines

What it actually says

Documentation Guidelines

Markdown File Organization (STRICT RULE)

README.md — Only at Root Levels

Allowed locations:

  • Workspace root: ./README.md
  • Module/package roots: ./modules/*/README.md, ./packages/*/README.md
  • Infra root: ./infra/README.md

Forbidden locations (no READMEs in subdirectories):

  • ./docs/README.md, ./src/README.md, ./scripts/README.md
  • ./modules/my-module/src/README.md

All Other .md Files — Must Go in docs/ Folders

  • Workspace docs: ./docs/*.md
  • Module docs: ./modules/*/docs/*.md
  • Infra docs: ./infra/docs/*.md

README.md Must Reference docs/

Every README.md should have a Documentation section linking to its docs/ folder.

When to Create Documentation

Do NOT create documentation files unless:

  1. Explicitly requested — user asks for a summary, guide, or docs
  2. Very complex changes — spanning 10+ files or multiple systems
  3. Architecture decisions — major changes needing rationale captured

Default: focus on implementation, let git history document the trail.

Quick Decision Tree

Creating a .md file?
├─ Named README.md?
│  ├─ At workspace/module/infra root? → OK
│  └─ Elsewhere? → FORBIDDEN
└─ Not README.md?
   └─ Must go in a docs/ folder
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. yesterday First seen · 53 lines · 369 tokens per session scan A 81b37d14c41f

Subscribe to this mod's changes

documentation is a cursor rule published in the GitHub repository cdbattags/ai (4 stars, last pushed 6mo ago), licensed MIT. It adds 369 tokens to every session, about $0.0018 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.