reflect:consolidate

Project-level memory consolidation. Merges orphaned worktree memory directories into a single .agents/MEMORY.md for the current project. Deduplicates, sections, and proposes cleanup of orphan dirs. Does NOT index into the global knowledge base — use reflect:ingest for that.

Best use case

reflect:consolidate is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Project-level memory consolidation. Merges orphaned worktree memory directories into a single .agents/MEMORY.md for the current project. Deduplicates, sections, and proposes cleanup of orphan dirs. Does NOT index into the global knowledge base — use reflect:ingest for that.

Teams using reflect:consolidate should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/consolidate/SKILL.md --create-dirs "https://raw.githubusercontent.com/stevengonsalvez/agents-in-a-box/main/plugins/reflect/skills/consolidate/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/consolidate/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How reflect:consolidate Compares

Feature / Agentreflect:consolidateStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Project-level memory consolidation. Merges orphaned worktree memory directories into a single .agents/MEMORY.md for the current project. Deduplicates, sections, and proposes cleanup of orphan dirs. Does NOT index into the global knowledge base — use reflect:ingest for that.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Reflect: Consolidate — Project Memory Cleanup

Merge orphaned worktree memory directories for the current project into a single,
tidy `.agents/MEMORY.md`. This is a **project-level** operation — it does not
touch the global knowledge base.

**For global indexing** (GraphRAG + QMD), use `/reflect:ingest` after consolidating.

## When to Use

- After deleting git worktrees
- When multiple worktree sessions left orphaned memory dirs
- To keep `.agents/MEMORY.md` current and deduped
- Before running `/reflect:ingest` (consolidate first, then index)

## What It Does

1. Discovers orphaned worktree memory dirs for the current project
2. Reads all MEMORY.md files from those dirs
3. Deduplicates entries (fuzzy — same concept = skip)
4. Routes skill-worthy content to existing skills
5. Writes consolidated `.agents/MEMORY.md` (200-line max)
6. Ensures agent config references it
7. Proposes cleanup of orphaned dirs

## What It Does NOT Do

- Does NOT index into GraphRAG or QMD (that's `reflect:ingest`)
- Does NOT scan other tools (Codex, Copilot, Gemini) — project-scoped only
- Does NOT archive originals to `~/.learnings/` — that's ingest's job

## Pipeline

### Step 1: Discover Project Identity

```bash
python3 {{HOME_TOOL_DIR}}/skills/reflect/scripts/memory_discovery.py project-id
# -> e.g. "shotclubhouse"
```

### Step 2: Find Orphaned Memory Dirs

```bash
python3 {{HOME_TOOL_DIR}}/skills/reflect/scripts/memory_discovery.py discover --provider claude
# Lists all worktree memory dirs for the current repo
# Excludes current session's memory dir
```

### Step 3: Read All MEMORY.md Files

Read from each matched directory. Extract individual entries (sections, bullets, paragraphs).

### Step 4: Deduplicate and Categorize

Group by section, remove redundant entries:
- Same concept = skip
- Same error + same solution = skip
- More detailed version = keep the detailed one

### Step 5: Route Skill-Worthy Content

Check if entries match existing skill topics (check `{{HOME_TOOL_DIR}}/skills/` and
`.claude/skills/`). Propose adding matching content to those skills.

### Step 6: Write `.agents/MEMORY.md`

Consolidated, deduped, within 200-line limit:

```markdown
# Project Memory

> Auto-consolidated by /reflect:consolidate. 200-line max.
> Detailed learnings route to skills. Global index via /reflect:ingest.

## Architecture & Patterns

## Build & Deploy

## Gotchas & Workarounds

## Testing

## Environment & Config
```

Sections are dynamic — empty sections removed, new sections created as needed.

### Step 7: Ensure Agent Config Reference

Check if `.claude/CLAUDE.md` or `.claude/AGENTS.md` contains `@.agents/MEMORY.md`.
If not, add it at the top.

### Step 8: Propose Orphan Cleanup

Show list of orphaned dirs and ask for confirmation:

```bash
# After user approval:
python3 {{HOME_TOOL_DIR}}/skills/reflect/scripts/memory_discovery.py cleanup /tmp/reflect-cleanup-dirs.txt --execute
```

### Step 9: Report

```markdown
## Consolidation Complete

- **Orphaned dirs processed**: 7
- **Entries consolidated**: 42
- **Duplicates removed**: 15
- **Routed to skills**: 3
- **.agents/MEMORY.md**: 127 lines
- **Dirs cleaned up**: 7

Next: Run `/reflect:ingest` to index into GraphRAG + QMD.
```

## Stats (Quick Check)

Check orphaned memory status without making changes:

```bash
python3 {{HOME_TOOL_DIR}}/skills/reflect/scripts/memory_discovery.py stats
# -> Repo: shotclubhouse
# -> Orphaned memory dirs: 7
# -> Total lines across all: 283
```

## Safety

- NEVER auto-apply without user approval
- NEVER delete orphaned dirs without explicit confirmation
- Always show what will be written to `.agents/MEMORY.md` before writing
- Preserve original structure of existing `.agents/MEMORY.md`

Related Skills

reflect

8
from stevengonsalvez/agents-in-a-box

Full conversation scan for self-improvement. Detects behavioral corrections and knowledge signals, classifies them, proposes agent updates and knowledge notes with entity sidecars for GraphRAG indexing. Correct once, never again.

reflect-status

8
from stevengonsalvez/agents-in-a-box

Show reflection metrics, pending reviews, sidecar coverage, and GraphRAG health. Read-only views into the reflect system state. Can also approve/reject pending low-confidence items.

reflect:recall

8
from stevengonsalvez/agents-in-a-box

Retrieve relevant prior learnings from the global knowledge base. Hybrid vector + graph search over 170+ indexed learnings, reranked by confidence, recency, and tag overlap. Use when starting work, debugging a recurring problem, or before implementing a feature that may have prior art.

reflect:ingest

8
from stevengonsalvez/agents-in-a-box

The global knowledge indexer. Harvests ALL memory sources across all tools (Claude, Codex, Copilot, Gemini) and all project types into the unified GraphRAG + QMD knowledge base. Archives originals, generates entity sidecars, and dual-indexes for future retrieval. This is THE command that makes the knowledge base comprehensive.

reflect:errors-ack

8
from stevengonsalvez/agents-in-a-box

Triage and acknowledge entries in the reflect errors sink (~/.reflect/errors.json). Invoked from the statusline ⚠N badge when pipeline errors accumulate (drain poison, parser crashes, ingest failures, hook timeouts).

reflect:cost

8
from stevengonsalvez/agents-in-a-box

Report reflect drain spend over a time window — tokens split by cached (cache_read), uncached writes (cache_creation), and io (input+output), with a $ estimate, grouped by day / outcome / model / transcript. Reads the drainer's cost log and surfaces outlier runs and cache-reuse health (the 41.5M-token failure mode = low cache reuse + high cache writes). Use to answer "what is reflection costing me" for the last day / week.

workflow

8
from stevengonsalvez/agents-in-a-box

Guide through structured delivery workflow with plan, implement, validate phases

webapp-testing

8
from stevengonsalvez/agents-in-a-box

Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.

validate

8
from stevengonsalvez/agents-in-a-box

Verify implementation against specifications

ui-ux-pro-max

8
from stevengonsalvez/agents-in-a-box

UI/UX design intelligence. 67 styles, 96 palettes, 57 font pairings, 25 charts, 13 stacks (React, Next.js, Vue, Svelte, Astro, Nuxt, SwiftUI, React Native, Flutter, Tailwind, shadcn/ui, Jetpack Compose). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient.

tui-style-guide

8
from stevengonsalvez/agents-in-a-box

TUI style guide for consistent terminal interface design

token-usage

8
from stevengonsalvez/agents-in-a-box

Show Claude Code token usage across sessions — daily, weekly, per-project, and per-session breakdowns. Parses {{HOME_TOOL_DIR}}/projects/**/*.jsonl for consumption data. Use when the user asks about token usage, costs, how many tokens were used, session statistics, or wants a usage report.