# Context Engineering

Master the four operations of context engineering, Write, Select, Compress, Isolate.

- Repository: https://github.com/rohitg00/pro-workflow (2940 stars)
- Category: AI and agents
- License: see repository
- Last updated: 2026-09-29
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add rohitg00/pro-workflow --skill context-engineering -g -a claude-code -y`
Codex: `npx skills add rohitg00/pro-workflow --skill context-engineering -g -a codex -y`
Cursor: `npx skills add rohitg00/pro-workflow --skill context-engineering -g -a cursor -y`
Gemini CLI: `npx skills add rohitg00/pro-workflow --skill context-engineering -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add rohitg00/pro-workflow`

## Description

Master the four operations of context engineering, Write, Select, Compress, Isolate. Manage token budgets, compaction strategies, and context partitioning to keep AI sessions sharp and efficient.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Context Engineering

Four operations control everything about how context flows through an AI coding session. Master them and you control the quality of every response.

## The Four Operations

### 1. Write, Persist Info Outside Context

Move information out of the context window into durable storage so it survives compaction and session boundaries.

**Where to write:**

| Target | When | Example |
|--------|------|---------|
| CLAUDE.md | Permanent project rules | "Always use pnpm, never npm" |
| NOTES.md / scratchpad | Working state for current task | Architecture decisions, open questions |
| `.claude/memory/` | Learnings and patterns | `[LEARN]` rules from corrections |
| External files | Data too large for context | Test plans, migration checklists |

**Pattern, Scratchpad workflow:**
```text
1. Start complex task → create NOTES.md with goals and constraints
2. After research → write findings to NOTES.md
3. After compaction → NOTES.md survives, context does not
4. Resume → read NOTES.md to recover full state
```

### 2. Select, Retrieve Relevant Info

Pull the right information into context at the right time. Precision matters more than volume.

**Methods ranked by precision:**

1. `@file` references, exact file injection
2. `grep` / `Glob`, targeted pattern search
3. Subagent exploration, delegated deep search
4. RAG / embeddings, semantic retrieval for large codebases

**Key principle: Focused 300 tokens > unfocused 113K tokens.**

A surgical grep result that returns the exact function signature beats dumping an entire module into context. Every irrelevant token dilutes attention.

**Pattern, Progressive retrieval:**
```text
1. Start with file names (Glob)
2. Narrow to specific functions (Grep)
3. Read only the relevant lines (Read with offset+limit)
4. Never read entire large files when you need one function
```

### 3. Compress, Reduce Tokens, Preserve Signal

Shrink context without losing the information that matters.

The rest: https://github.com/rohitg00/pro-workflow/blob/HEAD/skills/context-engineering/SKILL.md
