code-hygiene
Codebase health analysis: dead code, test quality, duplicates, complexity, security, architecture mapping. Tool-first, structured storage, forge integration.
Full documentation hygiene pass: memory, CLAUDE.md, lessons, references, guides. Audit freshness, delete stale, update outdated, compress index.
$ npx -y skills add malakhov-dmitrii/forge --skill docs-refresh --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/docs-refreshContext preview
The summary Claude sees to decide when to auto-load this skill.
Full documentation hygiene pass: memory, CLAUDE.md, lessons, references, guides. Audit freshness, delete stale, update outdated, compress index.
name: docs-refresh description: "Full documentation hygiene pass: memory, CLAUDE.md, lessons, references, guides. Audit freshness, delete stale, update outdated, compress index."
Audit all project documentation for freshness. Delete what's dead, update what drifted, compress what's bloated.
All doc layers, in order:
| Layer | Location | What to check | |-------|----------|---------------| | **Memory files** | `.claude/projects/.../memory/*.md` | Each file vs codebase reality | | **Memory index** | `.claude/projects/.../memory/MEMORY.md` | Orphans, duplicates, line count | | **CLAUDE.md (root)** | `CLAUDE.md` | Gotchas: still real? Commands: still work? | | **CLAUDE.md (.claude)** | `.claude/CLAUDE.md` | OMC config: still accurate? | | **Docs vault** | `docs/` (architecture, decisions, specs, runbooks, retros, articles) | Stale specs, outdated architecture | | **Lessons index** | Lessons in memory + `docs/` | Lessons for deleted/rewritten systems |
---
Catalog everything with dates:
Memory files: count, oldest, newest MEMORY.md: line count (warn if >170) CLAUDE.md: gotcha count, last modified docs/: file count per subdir, oldest files
Flag files older than 14 days for review. Flag any file referencing deleted code paths.
For each doc file, check against reality:
**Memory files** — classify each:
**CLAUDE.md gotchas** — for each:
**docs/** — for each:
Output a structured report:
## DELETE (stale, system removed, or fully guarded) - [ ] memory: lesson-X — system deleted on 2026-04-03 - [ ] memory: arch-Y — replaced by arch-Z, duplicate info - [ ] docs: spec-old.md — implemented and diverged, spec is now a lie ## UPDATE (partially stale, core still valid) - [ ] memory: client-vladimir — pricing changed - [ ] CLAUDE.md gotcha line 42 — partially fixed, needs narrowing ## COMPRESS (valid but verbose, can merge or shorten) - [ ] memory: feedback_A + feedback_B — same theme, merge into one - [ ] MEMORY.md — 3 entries pointing to same concept ## KEEP (verified fresh) - (count): N files verified current
**User reviews the triage.** No deletions without approval.
After user approves (or approves with edits):
1. **Delete** approved files. Remove their MEMORY.md entries. 2. **Update** flagged files with current info. Re-read source of truth before editing. 3. **Compress** merged entries. Update MEMORY.md index. 4. **CLAUDE.md**: remove fixed gotchas, update commands if changed, trim Common Failures. 5. **docs/**: archive or delete stale specs. Update architecture docs that drifted.
After execution:
Skip entirely if `--skip-mempalace` flag is set or if `mempalace_status` MCP tool is unavailable.
**6.1 Re-mine project** — push updated docs into palace.
mempalace mine <project-root>
Incremental: mempalace compares `source_mtime` per file and skips unchanged. Only updated/added memory files, CLAUDE.md, and docs/ get re-chunked. Cheap even on large repos.
Do NOT re-mine the convos wing (`~/.claude/projects/...` with `--mode convos`) — conversation history is append-only and handled separately.
**6.2 KG invalidate for deleted files** — for each file removed in Phase 4:
1. Extract entity name from filename slug (`client-vladimir-yakimenko.md` → `Vladimir Yakimenko`, `arch-reply-queue.md` → `reply-queue`). 2. `mempalace_kg_query(entity=...)` — list facts currently stored. 3. For facts whose `source_file` matches the deleted file → `mempalace_kg_invalidate(fact_id=...)`. 4. If unsure about a fact's provenance, SKIP — never invalidate a fact you can't trace to the deleted file.
**6.3 KG add for updates** — for facts that CHANGED during Phase 4 (e.g. client pricing updated, project status flipped):
1. `mempalace_kg_invalidate` on the old fact (if it exists in KG). 2. `mempalace_kg_add` with the new fact, including `source_file` pointing to the updated memory file.
Only add facts you are confident about. Facts derived from speculation or uncommitted plans should NOT enter the KG.
**6.4 Diary write** — record the refresh pass:
mempalace_diary_write( agent_name="claude-code", topic="docs-refresh", entry="REFRESH:<date>|deleted:N|updated:M|compressed:K|kg_invalidated:X|kg_added:Y|memory.lines:A→B" )
Keep AAAK-compressed — one line. Omit details that
Ore in, steel out. A blacksmith doesn't blame the ore. It smelts, shapes, tempers, and quenches — until what comes out holds an edge.
Repo: malakhov-dmitrii/forge
Codebase health analysis: dead code, test quality, duplicates, complexity, security, architecture mapping. Tool-first, structured storage, forge integration.
Ore in, steel out. Planning pipeline with independent verification, persistent memory, and compounding knowledge. Use for 3+ files or unclear scope.