doc-maintenance

A documentation-maintenance rule for keeping architecture references, package guides, and contributor documentation accurate after code changes. An ADR, or architecture decision record, explains a decision; a reference document describes the system as it currently works.

In plain words
What is it for?
Use it whenever a correction changes a package, interface, generated output, or documented architecture. Update the relevant README, contributor guide, subsystem document, architecture document, or worked example in the same change.
Why use it?
It prevents documentation from describing an old system shape or package behavior. This helps new contributors and users rely on the docs when code, contracts, or public types change.

Cursor rule for Codex

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/prisma/prisma-next/doc-maintenance
Clone the repo
git clone --depth 1 https://github.com/prisma/prisma-next

Made for: Codex.

Per session 898 This file is loaded in full into every session.
When invoked 898 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
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 $0.00898 $0.00898
Opus 5 $0.00449 $0.00449
Sonnet 5 $0.00180 $0.00180
Haiku 4.5 $0.00090 $0.00090

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

Security

Grade A, and why

doc-maintenance 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.

Origin

This is a copy

100% identical to doc-maintenance — 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.

.agents/rules/doc-maintenance.mdc · 46 lines

What it actually says

  • Whenever you receive a correction or correct a mistake, make sure it's documented in .cursor/rules either by updating an existing doc or adding a new one

  • An ADR records the decision; the subsystem/reference doc records the current shape. They are separate obligations. When a change alters a documented system shape or contract (IR shape, emitted-type surface, render path, public type alias), update the relevant doc under docs/architecture docs/subsystems/ (and any worked examples it contains) in the same change — not only the ADR. Landing the ADR does not discharge the obligation to refresh the reference docs a fresh contributor reads; a subsystem doc that still shows the pre-change shape is actively misleading even when the ADR is correct.

  • Whenever you make changes to a package, make sure its docs stay up to date.

    • User-facing packages: keep README.md focused on what the package does, when to use it, and a few concrete examples. Avoid internal implementation detail unless it materially affects usage.
    • Contributor details: put responsibilities/dependencies/architecture diagrams/internal exports in DEVELOPING.md (or CONTRIBUTING.md) within that package, and add a short link from README.md.
  • Docs must not link to transient project artifacts under projects/ (link to durable docs/ or package READMEs instead)

  • Source-code comments, ADRs, package READMEs, and test names must not reference transient project artefacts. This includes:

    • projects/<x>/... paths
    • Milestone / project labels (e.g. "Project 1", "Project 2", "M1", "Milestone 2")
    • Task or round IDs (e.g. T1.7, T2.5.3, R4 design choice, R8B, (T7))
    • Spec decision IDs (e.g. (D1), (D6), spec D7, (FR6))
    • Milestone-named acceptance criteria (e.g. AM12, AC-13, AC-E2E-BIGINT, AC-MW1, AC-DEC2)
    • File names that encode acceptance-criteria IDs (e.g. ac-e2e-bigint.test.ts — drop the ac- prefix)
    • Prose attributions like "the spec calls out", "the spec wording mentions", "the spec promises", "per spec", "out of scope per spec", "M2 review", "sub-spec § 4", "sub-spec OQ3"

    When a comment needs to explain why something is the way it is, describe the constraint or behaviour itself; do not attribute it to the transient project artefact that introduced it.

    Stable references that are fine: Linear ticket IDs (e.g. TML-2397), ADR numbers (e.g. ADR 211), and links to durable docs under docs/architecture docs/.

    Worked example. Bad:

    // Per-envelope plaintext is forwarded as `unknown` (D1) — the
    // SDK sees the original JS plaintext untouched. Pins AC-MW1.
    

    Good:

    // Per-envelope plaintext is forwarded to the SDK as `unknown`
    // — the SDK sees the original JS plaintext untouched.
    

    Before opening a PR, scan the branch diff for these patterns:

    rg 'Project [12]|\bD[1-9]\b|\(FR[0-9]+\)|\(T[0-9]+\)|AC-[A-Z][A-Z0-9-]*|\bR[0-9]+B?\b|\bF[1-7]\b|\bM[12]\b|per spec|the spec\b|spec calls|spec wording|spec promises|sub-spec|milestone' -- ':!projects/' ':!*.generated.*'
    
  • If you establish a new design decision, update the architecture docs in docs/architecture docs

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 · 46 lines · 898 tokens per session scan A c6dba411e70a

Subscribe to this mod's changes

doc-maintenance is a cursor rule published in the GitHub repository prisma/prisma-next (421 stars, last pushed 7d ago), licensed Apache-2.0. It adds 898 tokens to every session, about $0.0045 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to doc-maintenance, differing in 0 lines, and is treated as a copy.