1---2name: context-engineering-33description: Dynamic context injection, mode switching (dev/review/research), selective loading, and strategic compaction for token optimization.4---56- Load: architecture docs, active code files, test files, recent changes7- Skip: historical discussions, completed milestones, research notes8- Priority: implementation speed910### Review Mode11- Load: code diff, coding standards, security rules, test coverage12- Skip: architecture docs, planning notes, research13- Priority: thoroughness and accuracy1415### Research Mode16- Load: requirements, existing patterns, external research, alternatives17- Skip: implementation details, test files, CI configs18- Priority: breadth of information1920## Dynamic Injection21- Detect project context automatically (language, framework, tools)22- Load relevant skills based on detected context23- Inject domain-specific patterns and conventions24- Adjust tool allowlists per context mode2526## Selective Loading27- Load only files relevant to the current task28- Use glob patterns to scope file reading29- Prioritize recently modified files30- Skip binary files and generated code3132## Strategic Compaction33- Monitor context token usage34- Suggest compression for resolved/completed items35- Archive to memory files (activeContext, patterns, progress)36- Pre-compaction state preservation37- Automated compaction triggers at token thresholds3839## Cross-Platform Detection40- Package manager: npm (package-lock.json), pnpm (pnpm-lock.yaml), yarn (yarn.lock), bun (bun.lockb)41- Language: TypeScript (tsconfig.json), Go (go.mod), Python (pyproject.toml), Java (pom.xml)42- Test runner: vitest, jest, pytest, go test43- CI/CD: GitHub Actions, Dockerfile, docker-compose4445## When to Use4647- Session initialization (detect context)48- Before each phase (inject relevant context)49- Token budget warnings (strategic compaction)50- Mode transitions (dev to review to research)5152## Agents Used5354- Used by all agents indirectly through context detection55- `context-engineering` agent for explicit compaction analysis