Help us improve
Share bugs, ideas, or general feedback.
From claudeforge
Walks every CLAUDE.md, prunes stale references, enforces 150-line cap by splitting into sub-files, and repairs root↔subdirectory links. Supports --weekly for periodic audit.
npx claudepluginhub alirezarezvani/claudeforgeHow this command is triggered — by the user, by Claude, or both
Slash command
/claudeforge:sync-claude-md [--weekly | --dry-run | --paths-only | <directory>]Files this command reads when invoked
This command is limited to the following tools:
The summary Claude sees in its command listing — used to decide when to auto-load this command
# /sync-claude-md — CLAUDE.md Sync & Cleanup This command keeps every CLAUDE.md in the project current, lean, and chained. Apply the Karpathy behavioural guidelines (`~/.claude/skills/karpathy-guidelines/SKILL.md`) while running it: state assumptions, keep changes surgical, define verification per step. --- ## Phase 0: Weekly Audit (only when `--weekly` is passed) When the user invokes `/sync-claude-md --weekly`, run the three audit skills in parallel via the **Skill tool** before touching any file. Each is forked (`context: fork`, `agent: Explore`) so its work happens in an isolated co...
/claude-md-validateValidates CLAUDE.md files across directory tree for references, structure, consistency, content quality, integration, and deployment readiness, generating JSON reports and markdown summaries.
/sync-docsSynchronizes documentation files (prompt_plan.md, spec.md, CLAUDE.md, rules/) with recent code changes from git diff analysis. Supports --check-only mode.
/memory-spring-cleaningReviews all CLAUDE.md and CLAUDE.local.md files in the project: verifies content against codebase, removes obsolete/duplicate info, consolidates, and relocates to appropriate hierarchy locations.
/sync-claude-mdFetches the latest CLAUDE.md from fcakyon/claude-codex-settings GitHub repo and updates ~/.claude/CLAUDE.md, confirming successful sync.
Share bugs, ideas, or general feedback.
This command keeps every CLAUDE.md in the project current, lean, and chained. Apply the Karpathy behavioural guidelines (~/.claude/skills/karpathy-guidelines/SKILL.md) while running it: state assumptions, keep changes surgical, define verification per step.
--weekly is passed)When the user invokes /sync-claude-md --weekly, run the three audit skills in parallel via the Skill tool before touching any file. Each is forked (context: fork, agent: Explore) so its work happens in an isolated context and only the summary returns:
Skill(claude-md-drift-audit) — references against last 7 days of git history.Skill(claude-md-link-check) — @path imports and markdown links resolve.Skill(claude-md-dependency-rescan) — Tech Stack sections vs. manifest files.Issue all three in a single message so they execute concurrently. Wait for all three to return, then aggregate their findings into one report at the top of this run — ## Weekly Audit Summary with one subsection per skill. If any audit returns findings, proceed to Phase 1 with those findings in mind so the sync work resolves them. If all three are clean, skip to Phase 4 (chain repair) — no edits required.
When --weekly is not passed, skip this phase entirely and start at Phase 1.
Discover every CLAUDE.md in the project (skipping vendor directories) and report sizes.
!find . -name "CLAUDE.md" -type f -not -path "./node_modules/*" -not -path "./.git/*" -not -path "./vendor/*" -not -path "./dist/*" -not -path "./build/*" -print -exec wc -l {} \;
Then capture the project signal that drives staleness checks:
!ls -la package.json requirements.txt pyproject.toml go.mod Cargo.toml 2>/dev/null || true
!git status --short 2>/dev/null || echo "Not a git repository"
!git diff --name-status HEAD~10 -- . 2>/dev/null | head -50 || true
For each CLAUDE.md found, run the claude-md-enhancer skill's analyzer to compute:
Stale references to flag and remove unless the user objects:
package.json / requirements.txt / pyproject.toml / go.mod / Cargo.toml.[Backend Guidelines](backend/CLAUDE.md) or @backend/CLAUDE.md imports where the target file no longer exists.CHANGELOG.md shows as current.For each finding, show the offending line(s) with file:line references before editing.
Any CLAUDE.md exceeding 150 lines must be split. Prefer this order:
backend/CLAUDE.md exists, push backend-specific content there.database/CLAUDE.md) using claude-md-enhancer.generate_context_file(). The generator automatically prepends a back-link to the root.@path/to/CLAUDE.md chain imports — using claude-md-enhancer.After splitting, re-validate every modified file with BestPracticesValidator and confirm line count ≤ 150.
Verify the bidirectional chain:
Quick Navigation block listing every existing sub-CLAUDE.md, plus a @<relative-path> import line for each.../CLAUDE.md (or the correct relative path) with both a markdown link and a @../CLAUDE.md import.Repair any missing or broken chain links. Remove chain entries for sub-files that have been deleted.
After edits, regenerate validator output for each file and show:
Do not commit. Leave the diff staged-but-uncommitted so the user can review with git diff and choose when to commit.
claude-md-guardian flags drift on session start./enhance-claude-md — initialise or upgrade a CLAUDE.md when one is missing or thin.claude-md-guardian agent — runs sync automatically on session start when changes are detected.karpathy-guidelines skill — behavioural rules applied to every edit this command makes.