Skip to content

heymegabyte/agent-skills / 01-operating-system

operating-system

Verified

Supreme 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.

FileKindSize
SKILL.mdskill md6.4 KB
ai-native-coding.mdmarkdown4.3 KB
architecture-thought-loop.mdmarkdown8.3 KB
autonomous-orchestrator.mdmarkdown9.2 KB
context-engineering.mdmarkdown3.2 KB
one-line-saas.mdmarkdown3.0 KB
output-compression.mdmarkdown3.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)
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: 471kUpdated Claude CodeCodexVerifiedInstall
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: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
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 availableStars: 322kUpdated Claude CodeCodexVerifiedInstall