Skip to main content

Module rules_dedup

Module rules_dedup 

Source
Expand description

lean-ctx rules dedup — collapse duplicated lean-ctx guidance (#578).

A client should pay for lean-ctx rules exactly once per session. Older installs (and parent-directory walks in monorepos) left full rule copies in several auto-loaded files; doctor overhead detects the duplication, this command repairs it:

  1. lean-ctx-OWNED dedicated rule files outside the canonical global location (project/parent .cursor/rules/lean-ctx.mdc, .claude/rules/lean-ctx.md, …) → deleted.
  2. .cursorrules lean-ctx blocks → removed when the canonical global Cursor mdc exists (Cursor auto-loads both; pointer lives in AGENTS.md).
  3. Stale compression blocks in .cursorrules → removed under the same condition (the global mdc carries the block).
  4. Compression block in a shared AGENTS.md (#684) → removed (pointer kept) once every AGENTS.md reader is covered by its own canonical carrier; otherwise reported and left as the carrier.

Only lean-ctx-owned files and lean-ctx-marked blocks are ever touched. Unmarked user content is reported, never modified. Default is a dry-run report; --apply executes with .bak backups for partial edits.

Functions§

run
CLI entry: lean-ctx rules dedup [--apply].