一键导入
lfe-hygiene
Conduct a structural audit of the repository to detect "Documentation Drift" or "Spaghetti Files." Use in Phase 5 (Hygiene sub-pipeline, Step 1).
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Conduct a structural audit of the repository to detect "Documentation Drift" or "Spaghetti Files." Use in Phase 5 (Hygiene sub-pipeline, Step 1).
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Act as the Archivist for an LFE-compliant project. Use when a change is approved and needs documentation sync, changelog updates, or pipeline status cleanup.
Act as the Architect for an LFE-compliant project. Design solutions and draft high-fidelity plans.
Act as the Builder for an LFE-compliant project. Use when implementing an approved plan, writing code in src/**, or running unit tests.
Inspector sub-skill. Analyses changed code for cyclomatic complexity, excessive nesting, oversized functions, and cognitive load indicators. Pure LLM reasoning — no external tooling. Writes .plans/checks/complexity_findings.md. Called by lfe-inspector when enabled in inspector-config.md.
Inspector sub-skill. Reviews dependency manifest files (package.json, requirements.txt, go.mod, Cargo.toml, pom.xml) changed in the current diff for risky version patterns and stale majors. Emits a human-run audit instruction rather than executing tools. Writes .plans/checks/dep_findings.md. Called by lfe-inspector when enabled in inspector-config.md.
Disciplined bug-diagnosis loop. Reproduce → Hypothesise → Fix. Use in the Inspector sub-pipeline (Step 3, conditional) when verification fails.
| name | lfe-hygiene |
| description | Conduct a structural audit of the repository to detect "Documentation Drift" or "Spaghetti Files." Use in Phase 5 (Hygiene sub-pipeline, Step 1). |
pipeline_status.md) or manually by human/lfe-improve-architecture (Step 2)Ensure the repository remains LFE-compliant. Detect drift between the Library and the physical filesystem, and verify the coordination layer is clean.
.docs/README.md.The cleanup tiers in lfe-archivist/SKILL.md Step 5a/5b are the source of truth for which files should be present at each lifecycle moment. This audit checks for drift from those rules.
Mission State == [MISSION COMPLETE] or [BLANK CANVAS]): no execution OR planning files should remain. If any of 01_grill_summary.md, 02_prd.md, 03_slices.md, plan_critique.md, active_plan.md, builder_done.md, tdd_report.md, critique.md, inspection_report.md, diagnosis_report.md, rework_directive.md still exist, or if .plans/checks/ contains any files → flag as "Stale Coordination Files".Mission State == [IN-FLIGHT: <phase>] and Active Persona is Architect): planning files (01_grill_summary.md, 02_prd.md, 03_slices.md) MAY exist; execution files (plan_critique.md, active_plan.md, builder_done.md, tdd_report.md, critique.md, inspection_report.md, diagnosis_report.md, rework_directive.md, .plans/checks/) MUST be absent — flag any present as "Partial Cleanup Skipped".active_plan.md exists but Active Persona is NOT Architect, plan-critique, or Builder → flag as "Orphaned Plan".plan_critique.md should exist only between Plan Approval and Builder start. If plan_critique.md exists AND builder_done.md exists → the critique file should have been cleaned up by Partial Cleanup; flag as "Stale Plan Critique".hygiene_report.md is owned by the Hygiene sub-pipeline; flag only if it persists outside an active hygiene cycle.Coordination Files row in pipeline_status.md matches the mainline files in .plans/ (the nine checkboxes are 01 02 03 plan plan_critique build tdd critique inspect). Conditional artifacts (diagnosis_report.md, rework_directive.md, hygiene_report.md, .plans/checks/*.md) intentionally have no checkbox — their presence on disk is not row-drift.pipeline_status.md reflects the current reality:
CONTEXT.md exists if grill-with-docs has been run (check for 01_grill_summary.md in commit history)CHANGELOG.md respects the 7-milestone rolling window.pipeline_status.md is being incremented..agents/skills/ has a SKILL.md with YAML frontmatter (name + description)..agents/permissions.json maps exactly to the roles defined in .docs/protocol/PERSONAS.md (no documentation drift in tool gateways)..plans/checks/*_findings.md referenced as the output of a skill in .agents/skills/; identify sub-skills by their findings-file frontmatter kind: sub-skill. Name patterns (-check, -audit, -verify) are an unreliable signal — only the typed marker counts. For each discovered sub-skill, verify it is listed in .docs/quality/inspector-config.md. If a sub-skill exists but is absent from the config, flag as "Unconfigured Sub-Skill"..docs/ with 3+ files missing a README.md Shelf Index..docs/ exceeding ~6,000 characters. For any file that exceeds this threshold, check whether it has a Shelf Index header (## Index or similar). Flag files that are both oversized AND lack a Shelf Index as "Doc Size Violation" — these are candidates for splitting into atomic docs. Files with a Shelf Index that organise sub-entries are acceptable at larger sizes.The contract in COORDINATION_FILES.md defines a frontmatter schema and per-tier file lists. Drift between the contract and what skills actually do is the framework's most common silent-failure class. Two cheap mechanical checks:
.plans/, parse the YAML frontmatter and verify required fields (phase, step, status, timestamp, source) are present with legal values. For execution-tier files (active_plan.md, builder_done.md, tdd_report.md, inspection_report.md, diagnosis_report.md), also verify slice: is present (unless inspection_report.source is .docs/quality/PROTOCOL_DEBT.md, in which case slice is legitimately absent). Flag any file with missing/illegal fields.lfe-archivist/SKILL.md Step 5a (Partial Cleanup delete) and Step 5b (Full Cleanup delete) must match the lists in this skill's Section 2 audit. Read both skills, extract the lists, diff them. Flag any divergence — drift here means orphan-detection and cleanup are operating on different sets, which silently corrupts the multi-slice loop.Walk the Retention Policy table in .docs/protocol/GOVERNANCE.md. For each row:
.docs/archive/, preserving their full content and adding a row to the cold file's index table.Last archive sweep: session N) to the current session.LLM_AGENT_GUIDE.md under ## Retention Policy Overrides.Write .plans/hygiene_report.md per the contract in COORDINATION_FILES.md. Findings must be persisted to a file — verbal-only output creates a black hole where findings are lost if the session ends, leaving the Architect unable to fix structural violations that went unseen.
---
phase: hygiene
step: hygiene
status: complete
timestamp: <ISO-8601>
source: n/a
---
## 🔴 Critical (blocks next session)
- <violations>
## 🟡 Warning (should be fixed soon)
- <violations>
## 🟢 Clean
- <areas with no drift>
## Recommendation
- Proceed to `/lfe-improve-architecture` for architecture sweep? (Yes/No)
If fully clean, the report still gets written — body reads Repo is LFE-Compliant. Zero Drift Detected. Critical findings should be reviewed and triaged by the human before further refactoring; the framework surfaces the findings but does not block work — when to act on them is a human judgment call (typical defer reason: mid-mission, hold until completion).