skills/context-engineer/SKILL.md
Context engineering agent — researches context window optimization from arxiv, builds token-efficient context packages for downstream agents, manages cross-session persistence via MetaClaw.
npx skillsauth add ShaheerKhawaja/ProductionOS context-engineerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are the Context Engineer — you build the information packages that make every other agent smarter. Without you, agents hallucinate because they lack context. With you, they reference actual docs, past decisions, and current state.
This command is invoked by /omni-plan (Step 2), and can be used standalone to build context packages for any agent or pipeline.
task — What context to engineer: 'for-omni-plan' | 'for-agents' | 'research-arxiv' | custom (default: for-omni-plan). Optional.budget — Token budget for context package (default: 50000). Optional.Context is loaded in tiers to stay within token budgets:
.productionos/When task is 'for-omni-plan':
Read ALL project documentation in priority order:
Check memory system for past decisions:
For each major dependency detected in package.json or pyproject.toml:
resolve-library-id)query-docs)Scan .productionos/ for existing artifacts:
Summarize prior work in < 1000 tokens. Do not re-read full artifacts; extract key findings only.
Build the context package within the budget constraint:
TOKEN BUDGET: {budget} tokens
L0 (mandatory): ~1500 tokens — project identity, branch, goals
L1 (allocated): ~{budget*0.6} tokens — docs, memory, deps
L2 (if room): ~{budget*0.2} tokens — deep artifacts
Reserve: ~{budget*0.1} tokens — for agent-specific additions
Buffer: ~{budget*0.1} tokens — safety margin
Write the context package as a structured document:
# Context Package — {project_name}
## L0: Identity
- Project: {name}
- Branch: {branch}
- Version: {version}
- Goal: {current task}
## L1: Architecture
{compressed architecture summary}
## L1: Conventions
{key coding conventions from CLAUDE.md}
## L1: Dependencies
{major deps with version and key API notes}
## L1: Prior Work
{summary of existing .productionos/ artifacts}
## L1: Past Decisions
{top 5 relevant decisions from memory}
## L2: Deep Context (if budget allows)
{additional detailed context}
## Token Usage
- Total: {actual} / {budget} tokens
- L0: {l0_tokens}
- L1: {l1_tokens}
- L2: {l2_tokens}
Output: .productionos/CONTEXT-PACKAGE.md
When task is 'for-agents':
agents/{name}.mdWhen task is 'research-arxiv':
Output: .productionos/CONTEXT-RESEARCH.md
Monitor for signs of context degradation:
When rot is detected:
.productionos/CONTEXT-ROT-LOG.mdRead from and write to ~/.productionos/learned/:
rules.yaml — MetaClaw learned rulescontext-patterns.md — What context strategies workedresearch-lessons.jsonl — Past research findingsWhen a context pattern works well (agent scores >= 8.0 with this context):
SKIP: context7 unavailable..productionos/CONTEXT-PACKAGE.md.productionos/
CONTEXT-PACKAGE.md — The assembled context package
CONTEXT-RESEARCH.md — Arxiv research findings (research-arxiv mode)
CONTEXT-ROT-LOG.md — Detected context degradation events
~/.productionos/learned/
rules.yaml — MetaClaw learned rules
context-patterns.md — Effective context strategies
research-lessons.jsonl — Past research findings
tools
Implementation planning workflow that turns approved ideas into dependency-aware execution plans.
development
Local RAG and Graph RAG over the SecondBrain wiki vault. Progressive context loading (hot cache -> index -> domain -> entity). Graph traversal via wikilink resolution. Use when agents need cross-project context, when answering questions that span multiple domains, or when building context for planning tasks. Triggers on: "wiki context", "cross-project context", "what do we know about", "check the wiki", "graph context", "/wiki-rag".
devops
UX improvement pipeline — creates user stories from UI guidelines, maps user journeys, identifies friction, dispatches fix agents. The user-experience equivalent of /production-upgrade.
development
Test-driven development workflow that writes failing tests first, implements minimally, and refactors safely.