heymegabyte/agent-skills / 01-operating-system
operating-system
VerifiedSupreme policy layer governing all agent behavior. Autonomy, one-line prompt interpretation, speed standards, emphasis signal processing, cross-skill coordination, done definitions, conflict resolution. Loaded every prompt.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 6.4 KB |
| ai-native-coding.md | markdown | 4.3 KB |
| architecture-thought-loop.md | markdown | 8.3 KB |
| autonomous-orchestrator.md | markdown | 9.2 KB |
| context-engineering.md | markdown | 3.2 KB |
| one-line-saas.md | markdown | 3.0 KB |
| output-compression.md | markdown | 3.5 KB |
context-engineering.md
View on GitHub---
name: "Context Engineering"
version: "1.0.0"
updated: "2026-04-23"
description: "JIT retrieval, structured note-taking, tool result clearing, hybrid architecture, Goldilocks prompts. Anthropic's 5 techniques for managing context in agentic workflows. 3-tier multi-agent model. Compaction strategies."
---
# Context Engineering
**Context > prompting** — what the model sees matters more than how you ask.
## 5 Techniques (Anthropic Engineering)
- **JIT retrieval** — agents hold file paths/identifiers, load data at runtime. Never preload entire codebases. `grep`/`head` for targeted reads, not `cat *`.
- **Structured note-taking** — persistent notes outside context window (`progress.md`, `SPEC.md`) for multi-hour operations. Preserves coherence across compactions. Write before context >60%.
- **Tool result clearing** — safest compaction. Remove tool outputs, keep reasoning chain. Reconstructable data is disposable; decisions are not.
- **Hybrid architecture** — pre-load `CLAUDE.md` + rules (cacheable prefix) + allow autonomous exploration via tools. Static context sets policy; dynamic context discovers facts.
- **Goldilocks prompts** — XML/Markdown-sectioned, specific enough to guide, flexible enough for heuristics. System prompts >3000 tokens degrade reasoning. Rules: pipe-delimited one-liners. Skills: dense fragments. CLAUDE.md <200 lines.
## 3-Tier Multi-Agent Model
- **Tier 1 — In-process** — Claude Code subagents, same terminal, shared filesystem. Fast. Default.
- **Tier 2 — Local orchestrator** — 3-5 agents in isolated worktrees, task state files for coordination, file ownership enforced. Sweet spot for feature work.
- **Tier 3 — Cloud async** — overnight runs, return to a PR. Agent teams, remote triggers, `/ultraplan`.
**Coordination** — shared task list + dependency tracking + peer messaging + file locking. Each agent sees only files it owns (specialization > generalism). Token costs scale linearly with agent count.
## Context Budget
- Subagents — fill with 900K relevant context (skills + code + docs + web research). Return ≤200-word summary to main thread.
- Main thread — orchestrate only, never implement.
- Context >60% → save `progress.md` → spawn fresh.
## Anti-Patterns
- **Context rot** — agent understanding degrades as conversation grows. Compact proactively.
- **Autonomy outrunning verification** — every build step needs a check step.
- **Security blindspot** — 48% of AI-generated code contains security vulnerabilities (Becker study). Never skip review.
- **Idle time** — doubles in agentic mode. Keep agents busy, not developers waiting.
## Caching Strategy
- Deterministic load order: Tools → System → CLAUDE.md → rules (alpha) → skill descriptions → MEMORY.md → conversation
- Static prefix = cacheable (90% savings on repeated reads)
- Min cacheable: Opus 4096 tokens, Sonnet 2048 tokens
- Cache TTL: 5min default, 1hr with frequent access
## Ownership
- **Owns** — context window strategy, compaction triggers, subagent context loading, caching order, note-taking protocol, JIT retrieval patterns, multi-agent coordination
- **Cross-refs** — `autonomous-orchestrator.md` (Ralph Loop), `output-compression.md` (token reduction)
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |