# Consolidate

> Audit and prune rules, skills, and learnings to cut context bloat. Triggers "consolidate", "clean up rules", "what's redundant", or degraded agent performance from oversized instructions.

- Skill: `darkroomengineering/consolidate` (Agent Skill)
- Install (CLI): `npx skillmds@latest add darkroomengineering/consolidate`
- Raw SKILL.md: https://api.skillmd.com/api/skills/darkroomengineering/consolidate/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: darkroomengineering (https://skillmd.com/u/darkroomengineering)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/darkroomengineering/consolidate

---


# Consolidate Rules, Skills, and Learnings

## Standalone Codex mode

Audit `${CODEX_HOME:-$HOME/.codex}/AGENTS.md`, native
`${CODEX_HOME:-$HOME/.codex}/agents/`, native
`${CODEX_HOME:-$HOME/.codex}/rules/`, and the managed skills in the real
cc-settings checkout named by
`${CODEX_HOME:-$HOME/.codex}/.cc-settings-version` `repo_path`. Validate that
path is a git checkout of `darkroomengineering/cc-settings` before treating it
as source. The installed plugin/cache and `darkroom/source` runtime copy may be
read to diagnose drift, but must never be edited as though either were the git
source.

Claude auto-memory and `CLAUDE.md` cleanup are unavailable in standalone
Codex. Skip those counts and phases rather than redirecting them into
`~/.claude`. Verify native agent/rule references and managed source skill
triggers, then ask before deleting anything.

The remaining path examples describe Claude Code.

## Phase 1: Audit

### Count everything
```bash
echo "Rules:" && ls ~/.claude/rules/*.md 2>/dev/null | wc -l
echo "Skills:" && ls -d ~/.claude/skills/*/SKILL.md 2>/dev/null | wc -l
echo "Auto-memory entries:" && find ~/.claude/projects/*/memory -name "*.md" -not -name "MEMORY.md" 2>/dev/null | wc -l
echo "CLAUDE.md lines:" && wc -l ~/.claude/CLAUDE.md 2>/dev/null
echo "AGENTS.md lines:" && wc -l ~/.claude/AGENTS.md 2>/dev/null
```

### Check for contradictions
Read all rules and flag:
- Opposites ("always X" in one, "never X" in another)
- Significant overlap (two rules covering the same concern)
- References to outdated tools, patterns, or dependencies
- Vague rules that aren't actionable

### Check skill triggers
Read all skill descriptions and flag:
- Overlapping trigger phrases between skills
- Skills that never get invoked (ask the user)
- Outdated instructions

## Phase 2: Merge and Deduplicate

### Rules
- Merge rules covering the same concern
- Remove rules that duplicate AGENTS.md guardrails
- Remove rules for problems that no longer occur
- Tighten vague rules into specific instructions

### Skills
- Merge skills with overlapping triggers
- Remove unused skills. In Claude Code, run native `/skill-doctor` first: it reports which loaded skills went unused and what each costs in context, so prune from its numbers rather than by guess
- Update outdated instructions
- Ensure distinct, non-overlapping trigger phrases

### Auto-memory
- Review entries under `~/.claude/projects/<hash>/memory/`
- Remove entries about long-fixed bugs
- Remove entries about deprecated patterns
- Consolidate similar entries into one

## Phase 3: Simplify CLAUDE.md

CLAUDE.md should be a routing table:
- Points to AGENTS.md for standards
- Points to rules for specific concerns
- Points to skills for specific workflows
- Minimal inline content

If it exceeds ~100 lines of content, extract inline sections into rules or skills.

## Phase 4: Verify

1. Start a fresh Claude Code session
2. Test that key skills still trigger
3. Verify no regressions in agent behavior
4. Ask the user about rules you're unsure about

## Output Format

```markdown
## Consolidation Report

### Changes Made
- Merged: [list]
- Removed: [list]
- Updated: [list]

### Current State
- Rules: N (was M)
- Skills: N (was M)
- Learnings: N (was M)
- CLAUDE.md: N lines (was M)

### Flagged for User Review
- [Item]: [Why it needs human judgment]

### Recommendations
- [Further cleanup suggestions]
```

## Remember

- Ask before deleting — the user may have reasons you don't see
- Fix contradictions first — they cause the most confusion
- Overlapping triggers cause skill mis-invocation
- 10 sharp rules beat 30 vague ones

