Skip to main content
subagent CX Codex

context-engineer — Claude Code subagent: what it does, how to install

context-engineer audits context window usage across project files, tools, and MCP servers. Useful when sessions run slow or hit token compaction too often.

MIT ★ 2,966 updated 2026-09-29

Install into Claude Code · Plugin marketplace All methods and platforms ↓
/plugin marketplace add rohitg00/pro-workflow
/plugin install pro-workflow@pro-workflow
Open on GitHub

What context-engineer does

The subagent inspects files that populate the context window during a session. It scans all CLAUDE.md files, totals tool descriptions across MCP servers, and tallies installed skills along with their description overhead. After parsing the setup, it returns a context health score between 0 and 100.

The audit flags any single CLAUDE.md exceeding 200 lines, MCP servers exposing 20 or more tools, and skills untouched for over 30 days. Because the agent is strictly read-only and relies on Read, Glob, Grep, and Bash, it never alters configuration files on its own.

What it helps with

  • audit total token overhead from CLAUDE.md files
  • detect inactive skills and bloated MCP tool definitions
  • calculate a context health score before installing new plugins
  • identify guidelines suitable for moving into dedicated subagents

Example prompts for the agent

  • Audit context consumption and recommend compaction strategies
  • Check our CLAUDE.md files and MCP servers for context bloat

How to install context-engineer

1Plugin marketplace

/plugin marketplace add rohitg00/pro-workflow
/plugin install pro-workflow@pro-workflow

2Manually: put the files in place

.claude/agents/context-engineer.md

For all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention

Step by step, with commands for each platform: Claude Code subagents: how to create one, call it and keep context clean

Questions about context-engineer

How to install context-engineer in Claude Code?

Run /plugin marketplace add rohitg00/pro-workflow in Claude Code, then run /plugin install pro-workflow@pro-workflow.

What does context-engineer do?

It measures token weight across documentation, skills, and MCP tools, delivering actionable compaction advice and a health score.

Does context-engineer edit project files?

No, its workflow is strictly read-only. It provides recommendations on what to trim or move to subagents without modifying existing files.

Source text

context-engineer.md · MIT
---
name: context-engineer
description: Analyzes and optimizes context window usage across sessions. Use when context feels bloated, sessions run slow, or approaching compaction limits.
tools: ["Read", "Glob", "Grep", "Bash"]
omitClaudeMd: true
---

# Context Engineer

Audit context consumption and recommend compaction strategies.

## Trigger

Use when sessions feel slow, compaction fires too often, token budget seems wasted, or before adding new skills/agents/MCP servers.

## Workflow

1. Measure CLAUDE.md total size (root + all descendants)
2. Count installed skills and estimate description overhead
3. Count MCP servers and their tool count
4. Count agents and their preloaded skills
5. Identify redundancy across memory files
6. Score context health (0-100)
7. Recommend specific actions

## Audit Checklist

### CLAUDE.md Size
- Root CLAUDE.md: ideal < 60 lines, maximum < 150 lines
- Total across all CLAUDE.md files: flag if > 500 lines
- Check for stale entries, duplicate info, verbose examples

### Skill Overhead
- Each skill description consumes ~50-200 tokens in the slash menu
- Flag skills that haven't been invoked in 30+ days
- Identify skills that overlap in purpose

### MCP Servers
- Each server adds tool descriptions to context
- Count total tools across all servers
- Flag servers with 20+ tools (consider tool filtering)

### Agent Preloaded Skills
- Skills in agent frontmatter load fully into agent context
- Flag agents with 3+ preloaded skills
- Suggest moving rarely-needed knowledge to on-demand skills

## Output

```
CONTEXT AUDIT
Date: [date]
Health: [score]/100

CLAUDE.md: [X] lines across [N] files
  Root: [X] lines ([ok/bloated])
  Largest: [path] ([X] lines)

Skills: [N] installed, ~[X] tokens in descriptions
  Unused (30d+): [list]
  Overlapping: [pairs]

MCP Servers: [N] servers, [X] total tools
  Heaviest: [name] ([X] tools)

Agents: [N] agents, [X] preloaded skills total

RECOMMENDATIONS:
1. [Highest impact action]
2. [Second action]
3. [Third action]

MOVE TO SUB-AGENTS:
- [Knowledge that doesn't need to be in main context]

KEEP IN MAIN CONTEXT:
- [Knowledge needed every session]
```

## Rules

- Never modify files. Read-only analysis.
- Prioritize recommendations by token savings.
- Always distinguish between "move to sub-agent" and "delete entirely."
- Flag anything over 200 lines in a single CLAUDE.md as a split candidate.

© Rohit Ghumare · MIT · rohitg00/pro-workflow

Similar subagents

All subagents for Agent setup: memory, context, orchestration →

From the same set83

The whole set →
orchestrator orchestrator — a subagent for Claude Code that splits complex builds into three phases: research, plan, implement. Each phase requires approval before the next — use it for features touching 5+ files or needing architecture decisions. CX Codex ★ 2,966repo stars learn-rule learn-rule is a Claude Code skill that turns corrections and surfaced mistakes into categorized rules in permanent memory, carrying them across sessions to prevent repeats. CX Codex +1 ★ 2,966repo stars develop Runs structured feature development through research, planning, testing checkpoints, and strict verification before committing. CX Codex +1 ★ 2,966repo stars cost-analyst cost-analyst reviews session token use, spots costly operations, and checks cache hits to suggest concrete ways to lower session costs. CX Codex ★ 2,966repo stars pre-flight-discipline The pre-flight-discipline rule makes Claude Code surface assumptions, limit edits to the request, and verify multi-step work. It fits projects where drive-by changes are a concern. CX Codex +1 ★ 2,966repo stars smart-commit smart-commit runs lint, typecheck and tests before a commit, scans staged code for leftovers, then writes a conventional commit message from the diff. CX Codex +1 ★ 2,966repo stars file-watcher file-watcher configures Claude Code hooks to react to changes in configuration files, dependencies, and environment files. CX Codex +1 ★ 2,966repo stars commit Runs project checks, reviews staged changes, and creates a focused git commit. Use it when a change is ready to be recorded. CX Codex +1 ★ 2,966repo stars

Project sponsors

Companies that keep this analytics open