# Context Engineer

> Context window optimizer — analyze, audit, and optimize your agent's context utilization. Know exactly where your tokens go before they're sent.

- **Type:** Skill
- **Install:** `agentstack add skill-cacheforge-ai-cacheforge-skills-context-engineer`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [cacheforge-ai](https://agentstack.voostack.com/s/cacheforge-ai)
- **Installs:** 0
- **Category:** [Cloud & Infrastructure](https://agentstack.voostack.com/c/cloud-infrastructure)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [cacheforge-ai](https://github.com/cacheforge-ai)
- **Source:** https://github.com/cacheforge-ai/cacheforge-skills/tree/main/skills/context-engineer
- **Website:** https://clawhub.com

## Install

```sh
agentstack add skill-cacheforge-ai-cacheforge-skills-context-engineer
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

## When to use this skill

Use this skill when the user wants to:
- Understand where their context window tokens are going
- Analyze workspace files (SKILL.md, SOUL.md, MEMORY.md, etc.) for bloat
- Audit tool definitions for redundancy and overhead
- Get a comprehensive context efficiency report
- Compare before/after snapshots to measure optimization progress
- Optimize system prompts for token efficiency

## Commands

```bash
# Analyze workspace context files — token counts, efficiency scores, recommendations
python3 skills/context-engineer/context.py analyze --workspace ~/.openclaw/workspace

# Analyze with a custom budget and save a snapshot for later comparison
python3 skills/context-engineer/context.py analyze --workspace ~/.openclaw/workspace --budget 128000 --snapshot before.json

# Audit tool definitions for overhead and overlap
python3 skills/context-engineer/context.py audit-tools --config ~/.openclaw/openclaw.json

# Generate a comprehensive context engineering report
python3 skills/context-engineer/context.py report --workspace ~/.openclaw/workspace --format terminal

# Compare two snapshots to see projected token savings
python3 skills/context-engineer/context.py compare --before before.json --after after.json
```

## What It Analyzes

- **System prompt efficiency** — Length, redundancy detection, compression potential
- **Tool definition overhead** — Count tools, per-tool token cost, identify unused/overlapping
- **Memory file bloat** — MEMORY.md size, stale entries, optimization suggestions
- **Skill overhead** — Installed skills contributing to context, per-skill token cost
- **Context budget** — What % of model context window is consumed by static content vs available for conversation

## Options

- `--workspace PATH` — Path to workspace directory (default: `~/.openclaw/workspace`)
- `--config PATH` — Path to OpenClaw config file (default: `~/.openclaw/openclaw.json`)
- `--budget N` — Context window token budget (default: 200000)
- `--snapshot FILE` — Save analysis snapshot to FILE for later comparison
- `--format terminal` — Output format (currently: terminal)

## Notes

- Token estimates are approximate (~4 characters per token). For precise counts, use a model-specific tokenizer.
- No external dependencies required — runs with Python 3 stdlib only.
- Built by Anvil AI — context engineering experts. https://labs.anvil-ai.io

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [cacheforge-ai](https://github.com/cacheforge-ai)
- **Source:** [cacheforge-ai/cacheforge-skills](https://github.com/cacheforge-ai/cacheforge-skills)
- **License:** MIT
- **Homepage:** https://clawhub.com

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-cacheforge-ai-cacheforge-skills-context-engineer
- Seller: https://agentstack.voostack.com/s/cacheforge-ai
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
