一键导入
mobile-compaction
Context compaction strategies for large Android codebases. Optimize token usage while preserving critical context.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Context compaction strategies for large Android codebases. Optimize token usage while preserving critical context.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Core Android development patterns for Kotlin, including coroutines, lifecycle management, and functional programming idioms.
Apple Combine framework for reactive programming. Publishers, subscribers, operators, and error handling.
Pattern extraction and skill generation for mobile development sessions. Automatically learns from your coding patterns.
Instinct-based learning system with confidence scoring for mobile patterns. Automatically extracts and evolves patterns.
Core Data for iOS persistence. Data models, fetch requests, background contexts, and SwiftData migration.
Kotlin Coroutines and Flow patterns for structured concurrency, error handling, and async operations.
| name | mobile-compaction |
| description | Context compaction strategies for large Android codebases. Optimize token usage while preserving critical context. |
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.