From everything-claude-code-mobile
Compacts context in large Android codebases using module, layer (UI/data/domain), variant, test, and pattern (Compose/MVI/Koin) strategies to optimize token usage while preserving critical info.
How this skill is triggered — by the user, by Claude, or both
Slash command
/everything-claude-code-mobile:mobile-compactionThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Strategic context compaction for large Android projects to optimize token usage while preserving critical information.
Strategic context compaction for large Android projects to optimize token usage while preserving critical information.
Compact context when:
Focus on a single Android module:
/compact --module=feature:auth
What happens:
Use when: Deep work on a specific feature
Focus on architecture layer:
/compact --layer=ui
/compact --layer=data
/compact --layer=domain
What happens:
| Layer | Retain | Summarize |
|---|---|---|
| UI | Composables, ViewModels, navigation | Repository details, data models |
| Data | Repositories, data sources, models | Compose code, UI state |
| Domain | Use cases, domain models | Implementation details |
Use when: Working on cross-cutting concerns in a layer
Narrow to specific build variant:
/compact --variant=debug
What happens:
Use when: Debugging or test development
Compact around failing tests:
/compact --test=AuthViewModelTest
/compact --test-failing
What happens:
Use when: Fixing specific test failures
Compact based on architectural patterns:
/compact --pattern=compose
/compact --pattern=mvi
/compact --pattern=koin
What happens:
Use when: Pattern-specific work (e.g., Compose optimization)
| Level | Retention | Token Savings | Use Case |
|---|---|---|---|
| Lite | Current task only | 70-80% | Deep focus work |
| Medium | Current + related | 50-60% | Feature development |
| Standard | Project summary | 30-40% | Default compaction |
| Minimal | Essential only | 80-90% | Context at limit |
/compact # Auto-select strategy
/compact --level=medium # Specify level
/compact --focus=compose # Focus on specific area
/compact --smart # AI chooses strategy
/compact --adaptive # Adjusts based on usage
/compact --keep=file1.kt,file2.kt # Keep specific files
/compact --drop=discussion-1 # Drop specific discussion
/compact --summarize=feature-x # Summarize specific topic
1. /memory-save all # Save current state to memory
2. /mobile-checkpoint save pre-compact # Optional checkpoint
3. /compact --strategy=module --focus=feature:auth
1. /memory-summary # Verify memory preserved
2. /instinct-status # Verify instincts preserved
3. Continue work...
# Pre-compact hook automatically saves checkpoint
# Restore to recover if compaction removes needed context
# Memory survives compaction
# Query memory to recover details:
/memory-query "What was the auth flow architecture?"
# Instincts survive compaction
# High-confidence instincts always retained
# Low-confidence may be summarized
If compaction removed needed context:
1. /memory-query <topic> # Query memory
2. /mobile-checkpoint list # Check for checkpoints
3. /mobile-checkpoint restore <name> # Restore if needed
4. Git history for file diffs
Context: Working on auth feature, context contains old home feature discussions
Action: /compact --module=feature:auth
Result: Retains auth files, summarizes home feature
Context: Many files, focus on fixing LoginTest
Action: /compact --test=LoginTest
Result: Retains LoginTest, related auth files, summarizes rest
Context: Large project, optimizing Compose performance
Action: /compact --pattern=compose --level=medium
Result: Retains Compose files, summaries of data/network layers
Remember: Compaction is reversible via checkpoints and memory. When in doubt, checkpoint first.
npx claudepluginhub ahmed3elshaer/everything-claude-code-mobile --plugin everything-claude-code-mobilePreserves critical context data before Claude Code's automatic compaction using snapshots, integrity verification, and zero-loss extraction protocols for complex projects.
Persists mobile Android project context across sessions, tracking structure, Gradle dependencies, MVI architecture, test coverage, and Jetpack Compose screens. Useful for resuming development or onboarding.
Saves critical files, task progress, and working state before context compaction, then restores them after. Use before /compact or when auto-compact triggers.