/context - Context Analysis & Optimization banner
VAMFI VAMFI

/context - Context Analysis & Optimization

Development community intermediate

Description

Analyze and optimize your Claude Code context configuration using Anthropic's context engineering principles.

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

Repository README

This is the README for VAMFI/claude-user-memory, shared by 5 entries in this directory. It describes the repository, not this entry specifically.


name: context description: Analyze and optimize context configuration. Reviews CLAUDE.md, knowledge-core.md, and active context for optimization opportunities. Helps prevent context rot (39% improvement, 84% token reduction).

/context - Context Analysis & Optimization

Analyze and optimize your Claude Code context configuration using Anthropic's context engineering principles.

Usage

/context                # Analyze mode (default)
/context analyze        # Same as default
/context optimize       # Actively optimize context
/context reset          # Reset to templates

What This Does

Analyze Mode (Default)

When you run `/context` or `/context analyze`:

  1. **Read context files**

    • CLAUDE.md (project configuration)
    • knowledge-core.md (accumulated learnings)
    • Imported files (via @ syntax)
  2. **Analyze token count and relevance**

    • Count total tokens in context
    • Identify stale/redundant information
    • Check for context rot indicators
  3. **Identify optimization opportunities**

    • Sections that should be archived
    • Redundant content that can be consolidated
    • Missing imports that could improve modularity
  4. **Report findings**

    • Current token usage
    • Stale information detected
    • Potential token savings
    • Recommended actions

Optimize Mode

When you run `/context optimize`:

  1. **Run analysis** (as above)

  2. **Archive stale information**

    • Move outdated patterns to knowledge-core.md historical section
    • Add timestamps to archived content
    • Preserve information for future retrieval
  3. **Prune redundant context**

    • Remove duplicate information
    • Consolidate similar sections
    • Replace verbose explanations with concise bullet points
  4. **Update CLAUDE.md**

    • Keep only high-signal, project-specific content
    • Use imports for modular organization
    • Ensure clear structure with markdown headings
  5. **Report token savings**

    • Before/after token counts
    • Percentage reduction
    • Expected performance improvement

Reset Mode

When you run `/context reset`:

  1. **Confirmation prompt**

    • Warns that this will discard current context
    • Asks for explicit confirmation
  2. **Restore templates** (if confirmed)

    • CLAUDE.md → .claude/templates/CLAUDE.md.template
    • knowledge-core.md → Fresh template
    • Clear project-specific customizations
  3. **Fresh start**

    • Ideal for switching to new project
    • Removes accumulated context rot
    • Begins with clean slate

Output Examples

Analyze Mode Output

📊 Context Analysis

## Current Configuration

**Memory Hierarchy**:
- Enterprise: Not configured
- Project: ./CLAUDE.md (450 tokens)
- User: ~/.claude/CLAUDE.md (120 tokens)
- Imports: 3 files (280 tokens)

**Total Context**: 850 tokens

**Files Analyzed**:
- ✓ CLAUDE.md (450 tokens)
- ✓ knowledge-core.md (320 tokens)
- ✓ @.claude/templates/agents-overview.md (100 tokens)
- ✓ @.claude/templates/skills-overview.md (90 t