Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add commands/shaheerkhawaja/productionos/context-engineergit clone --depth 1 https://github.com/ShaheerKhawaja/ProductionOSWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/commands/shaheerkhawaja/productionos/context-engineer)<a href="https://agentmods.dev/commands/shaheerkhawaja/productionos/context-engineer"><img src="https://agentmods.dev/badge/commands/shaheerkhawaja/productionos/context-engineer.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00034 | $0.00524 |
| Opus 5 | $0.00017 | $0.00262 |
| Sonnet 5 | $0.00007 | $0.00105 |
| Haiku 4.5 | $0.00003 | $0.00052 |
Grade A, and why
context-engineer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
What it actually says
Context Engineer — Token-Efficient Context Construction
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.
Input
- Task: $ARGUMENTS.task
- Budget: $ARGUMENTS.budget tokens
Protocol
For Omni-Plan Context
- Read ALL project documentation (CLAUDE.md, README, ARCHITECTURE, etc.)
- Check memory system for past decisions (
/mem-searchfor project history) - Retrieve library docs via context7 MCP for major dependencies
- Build a token-budgeted context package:
- Critical context (always include): project architecture, conventions, recent decisions
- Important context (include if budget allows): dependency docs, past iteration results
- Nice-to-have context (include if plenty of budget): competitor patterns, research findings
For Agent Context
- Read the agent's role definition
- Identify what files/knowledge this agent needs
- Build a minimal context package targeted to the agent's specific task
- Apply iterative retrieval: if agent reports insufficient context, refine and re-send
For Arxiv Research
- Search arxiv for "context engineering" + "LLM" + "2025 2026"
- Search for "prompt construction" + "agent context"
- Search for "context window optimization"
- Synthesize findings into actionable patterns
Cross-Session Persistence
Read from and write to ~/.productionos/learned/:
rules.yaml— MetaClaw learned rulescontext-patterns.md— What context strategies workedresearch-lessons.jsonl— Past research findings
Output
Write context package to .productionos/CONTEXT-PACKAGE.md
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 5d ago First seen · 54 lines · 34 tokens per session scan A ee2cbaa8b052
context-engineer is a command published in the GitHub repository ShaheerKhawaja/ProductionOS (8 stars, last pushed 4mo ago), licensed MIT. It adds 34 tokens to every session and 524 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other commands, from other repositories
rekindle
Recover a fellowship after a session crash. Scans worktrees and state files, presents a recovery dashboard, and re-spawns Gandalf with recovered quest context. Use when returning to a crashed or expired fellowship session.
resume
Resume a previous session. Reads recent session logs, open tasks, and last decisions — gives Claude full context without re-explaining the project.
learn
Manually run the continuous-learner. Extract patterns from this session and write to .greatcto/lessons.md. Use when SessionEnd hook missed something or you want to capture a lesson mid-session.
recall
Search what this project knows about a concept — session history, and the documents written about it. Usage: /recall.
ccr
CCR (Compressed Context with Retrieval) — recall the full original of context that greatcto compressed/filtered out, by its short id. The retrieval half of the compression layer.
guide
Interactive guide to fellowship. Walks you through a real task using the structured research-plan-implement flow, then shows you what's next.