RCP-CWK-036 Project Cleanup: State Audit

The equivalent of โ€œspring cleaningโ€ for a multi-session CRAFT project

Performs a full-project longitudinal audit across all sessions. Detects hallucinated state claims, orphaned references, internal contradictions, and accumulated state drift that escaped per-session checks. The equivalent of โ€œspring cleaningโ€ for a multi-session CRAFT project.


Project Cleanup: Comprehensive State Audit

Tags: Introduced in Beta, QA, Audit, State Integrity, Dual-Persona, Verification, Cleanup, Cowork

TL;DR

What It Does
Performs a full-project longitudinal audit across all sessions. Detects hallucinated state claims, orphaned references, internal contradictions, and accumulated state drift that escaped per-session checks. The equivalent of “spring cleaning” for a multi-session CRAFT project.
How It Works
Six phases with dual-persona execution. Cat orchestrates Phases 1–3 (domain knowledge): file integrity audit, handoff chain integrity, and Lessons Learned consistency. Fernand validates Phases 4–5 (structural integrity): recipe infrastructure audit and cross-reference validation. Phase 6 is joint synthesis — both personas cross-validate findings, CWK-024 scores confidence on all CRITICAL and WARNING findings, and a structured CLEANUP-REPORT is generated. Three scope options: full (all 6 phases), quick (phases 1, 2, 5, 6), or custom (specify phases, with Phase 6 always included).
What To Expect
A CLEANUP-REPORT file with severity-classified findings (CRITICAL, WARNING, INFO), confidence scores from CWK-024, and remediation recommendations. Each finding cites specific evidence (file paths, line numbers, tool output). Optional auto-fix mode applies simple fixes with human approval.
Best Results When You
Run in report-only mode (auto_fix=false) on first pass to survey the landscape. Use full scope for comprehensive audits, quick scope for routine checks. Schedule cleanup periodically — state drift accumulates over sessions.
Typical Time
Full scope: 45–60 minutes (all 6 phases). Quick scope: 20–25 minutes (4 phases). Custom scope: varies. CWK-024 confidence scoring adds 2–5 minutes for findings verification.
Difficulty
Advanced — the recipe handles complexity internally, but interpreting findings requires understanding of CRAFT project structure, handoff chains, recipe infrastructure, and cross-reference patterns. User-triggered only — no automated triggers.

How To Start

This recipe performs a comprehensive state audit of your CRAFT project. It is user-triggered only — run it when you suspect accumulated drift or as periodic maintenance. Choose the scope that matches your needs.

STEP 1Specify Project and Scope

Provide the project ID and choose the audit scope.
Available parameters
  • project_id · string · required
    Three-digit project ID to audit (e.g., “060”).
  • scope · string · optional · default: “full”
    “full” = all 6 phases (~45–60 min). “quick” = phases 1, 2, 5, 6 (~20–25 min). “custom” = specify phases via phase_list.
  • phase_list · string · optional
    Comma-separated phase numbers for custom scope (e.g., “1,2,5,6”). Phase 6 (synthesis) is always included. Ignored unless scope=custom.
  • auto_fix · boolean · optional · default: false
    false = report-only mode (recommended first run). true = apply simple fixes with human approval. Complex fixes always require explicit confirmation.
Invocations
Full audit
#H->AI::Directive: (Execute CWK-036 with project_id="060", scope="full")
Quick audit
#H->AI::Directive: (Execute CWK-036 with project_id="060", scope="quick")
Custom audit with auto-fix
#H->AI::Directive: (Execute CWK-036 with project_id="060", scope="custom", phase_list="1,3,5,6", auto_fix=true)

Usage Examples

EXAMPLE 1Full project cleanup

User
Run a full cleanup audit on this project.
Cat
Initiating Project Cleanup — full scope, 6 phases. Phase 1 (File Integrity): 3 findings — 1 WARNING (line count drift on chat history), 2 INFO (orphaned files). Phase 2 (Handoff Chain): 1 INFO (merged session documented). Phase 3 (Lessons Learned): 0 findings. Fernand executing Phases 4–5. Phase 4 (Recipe Infrastructure): 0 findings. Phase 5 (Cross-Reference): 1 WARNING (stale priority marked complete without evidence). Phase 6 (Synthesis): CWK-024 scoring complete. Report: 5 findings, 0 CRITICAL, 2 WARNING, 3 INFO. Report written.

EXAMPLE 2Quick scope audit

User
Do a quick cleanup check before we push.
Cat
Quick cleanup — phases 1, 2, 5, 6. Phase 1: Clean — all files present, line counts aligned. Phase 2: Handoff chain intact, no gaps. Phase 5: All cross-references valid. Phase 6: 0 findings. Project state is clean — safe to push.

EXAMPLE 3Auto-fix mode

User
Run cleanup with auto-fix on the critical issues.
Cat
Full cleanup with auto_fix=true. 7 total findings, 1 CRITICAL: CLAUDE.md references transfers/pending/XFER-001.txt but file was moved to transfers/archived/. Proposed fix: update CLAUDE.md path reference. Awaiting your approval. [User approves] Fix applied. Git checkpoint saved. Remaining: 2 WARNING, 4 INFO (report-only, no auto-fix available).

EXAMPLE 4Custom scope targeting lessons and recipes

User
Just check the Lessons Learned and recipe infrastructure.
Cat
Custom cleanup — phases 3, 4, 6. Phase 3 (Lessons Learned): 2 findings — 1 WARNING (LL references deprecated recipe ID), 1 INFO (count mismatch between CLAUDE.md and file). Fernand executing Phase 4 (Recipe Infrastructure): 0 findings. Phase 6 (Synthesis): CWK-024 scoring complete. Report: 2 findings, 0 CRITICAL.

How AI Reads This Recipe

When this recipe is triggered, the AI performs a comprehensive project state audit. The AI should:
  1. Pre-Flight (Step 0). Resolve scope to active phase list. Load key file paths via Glob. Verify SESSION_GROUND_TRUTH exists (requires CWK-001 session init). Initialize findings accumulator.
  2. File Integrity Audit (Phase 1, Cat). Check all CLAUDE.md Key Files paths exist on disk. Compare actual file line counts against latest handoff FILE_STATE claims. Detect orphaned files not referenced by CLAUDE.md, recipe index, or handoffs. Validate git state against CLAUDE.md claims.
  3. Handoff Chain Integrity (Phase 2, Cat). Verify handoff sequence (H001 through latest) — flag gaps, verify merge documentation. Check prior handoff chain links. Sample recent NEXT_PRIORITIES for completion evidence. Validate recipe/file references in handoffs against cookbooks.
  4. Lessons Learned Consistency (Phase 3, Cat). Validate LL entry count against ground truth. Check recipe ID validity in LL entries against cookbooks. Detect contradictions between adjacent LL entries on the same topic. Verify CLAUDE.md LL count alignment.
  5. Recipe Infrastructure Audit (Phase 4, Fernand). Validate recipe counts (INDEX vs cookbooks). Check recipe ID uniqueness across all cookbooks. Sample CLAUDE.md recipe version claims against cookbook headers. Validate dependency chains for sampled recipes.
  6. Cross-Reference Validation (Phase 5, Fernand). Verify all CLAUDE.md file paths exist. Sample recipe index line number accuracy. Verify git commit hashes from handoffs. Check transfer registry integrity. Validate CLAUDE.md priority completion claims.
  7. Synthesis & Report (Phase 6, Cat + Fernand). Score all CRITICAL and WARNING findings through CWK-024 verification gates. Fernand validates evidence-grounding of Cat’s findings. Cat validates domain context of Fernand’s findings. Generate CLEANUP-REPORT with severity distribution, detailed findings, and recommended actions. Apply auto-fixes if enabled (with human approval for each). Present summary.

When To Use This Recipe

Use this recipe when you suspect accumulated state drift across many sessions, want to verify project integrity before a major milestone or push, need to audit handoff chain continuity after session merges or gaps, or want a comprehensive check of recipe infrastructure, Lessons Learned, and cross-references.
Do Not Use When
You need per-session QA — CWK-023 (Fernand Checklist) handles that. For recipe-specific validation, use CWK-024 (Verification Gate) directly. For git-only checks, use CWK-005 (Git Checkpoint). This recipe is the heavy-weight, full-project audit — not for routine per-session checks.

Recipe FAQ

How often should I run a cleanup audit?
Every 10–15 sessions or before major milestones. Quick scope is fine for routine checks; use full scope when you suspect meaningful drift or after a long gap between sessions.

What are the six phases?
Phase 1: File Integrity (CLAUDE.md paths, line counts, orphans, git state). Phase 2: Handoff Chain (sequence, links, priorities, references). Phase 3: Lessons Learned (counts, recipe IDs, contradictions). Phase 4: Recipe Infrastructure (counts, uniqueness, versions, dependencies). Phase 5: Cross-Reference (paths, index lines, commits, transfers, priorities). Phase 6: Synthesis (confidence scoring, cross-validation, report generation).

What is the difference between full and quick scope?
Full runs all 6 phases (~45–60 min). Quick skips Phases 3 (Lessons Learned) and 4 (Recipe Infrastructure), running only phases 1, 2, 5, 6 (~20–25 min). Quick is sufficient for routine pre-push checks; full is for comprehensive audits.

Should I use auto_fix on the first run?
No — run report-only first (auto_fix=false, the default) to survey the findings. Review the report, then re-run with auto_fix=true if you want simple fixes applied. Complex fixes always require explicit confirmation regardless of the setting.

Why does Phase 6 always run?
Phase 6 is the synthesis phase that scores findings through CWK-024, cross-validates between Cat and Fernand, and generates the final report. Without it, findings would be raw and unscored. It also ensures both personas review each other’s work.

Version History

v1.00a — 2026-03-05
Initial creation via CWK-021 feature request (H044). Six-phase audit with dual-persona execution (Cat + Fernand), CWK-024 confidence scoring, three scope options (full, quick, custom), optional auto-fix with human approval, structured CLEANUP-REPORT generation with severity classification.

Get this recipe with CRAFT for Claude Cowork

Cowork recipes ship bundled with CRAFT for Claude Cowork — there’s no separate download. Clone the framework once, and your AI runs every recipe automatically when invoked.

Pull anytime to stay on the latest version — free to clone, no login or email required.

Then start your session

Once CRAFT is in your project folder, open a new Cowork session and ask Claude to initialize. For example:

You

Please initialize my CRAFT session.

Claude

CRAFT session ready. Your project is loaded, your persona is active, and your recipes are available. What would you like to work on?

What is CRAFT for Claude Cowork?

Not familiar with Git? Download as a ZIP

No command line needed. Just download, move, and unzip:

  1. Open the CRAFT framework repo on GitHub.
  2. Click the green Code button, then choose Download ZIP.
  3. Move the downloaded ZIP into your Claude Cowork project folder.
  4. Unzip it: double-click on Mac, or right-click → Extract All on Windows.

Similar Posts