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:
- lean-ctx-OWNED dedicated rule files outside the canonical global
location (project/parent
.cursor/rules/lean-ctx.mdc,.claude/rules/lean-ctx.md, …) → deleted. .cursorruleslean-ctx blocks → removed when the canonical global Cursor mdc exists (Cursor auto-loads both; pointer lives in AGENTS.md).- Stale compression blocks in
.cursorrules→ removed under the same condition (the global mdc carries the block). - 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§
- auto_
apply - Non-interactive auto-heal used by
lean-ctx setupanddoctor --fix(#578): applies every fixable dedup action (owned duplicates deleted, marked blocks stripped with.bakbackups) and returns one result line per action.Report-only findings (user-maintained content) are never touched. - run
- CLI entry:
lean-ctx rules dedup [--apply].