skills/agentic/context-engineering/SKILL.md
Context window management, token optimization, and memory patterns for efficient multi-agent systems. Use when: optimizing token usage in an agentic pipeline, designing memory scope for short / long-term / episodic state, or applying a context-loading strategy (anticipatory / JIT / hybrid).
npx skillsauth add mikeparcewski/wicked-garden context-engineeringInstall 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.
Techniques for managing context windows, optimizing token usage, and designing efficient memory systems for agentic applications.
Context Window: Maximum tokens an LLM can process in a single request (input + output).
Limits vary by provider and model. Check the active model's documentation for the exact value.
Token Efficiency Matters:
| Pattern | Use when | Pros | Cons | |---------|----------|------|------| | Shared | Agents need synchronized view | Consistency, simple coordination | Contention, single point of failure | | Isolated | Agents operate independently | No contention, parallel execution | Inconsistency possible, harder to coordinate | | Checkpointed | Long-running processes, need recovery | Fault tolerance, replayability | Storage overhead, consistency complexity |
Compress old context into summaries to reduce token usage.
Only load relevant context based on the current task.
Use JSON/structured formats instead of prose to reduce tokens.
Example:
{"name": "John Smith", ...} (compact)Load details only when explicitly needed.
Reference external documents instead of embedding full text.
See refs/selective-loading.md and refs/caching-and-optimization.md for code examples and detailed strategies.
| Memory | Scope | Size | Retention | |--------|-------|------|-----------| | Short-term (working) | Current session/task | 1K-10K tokens | Minutes to hours | | Long-term | Cross-session, permanent | Unbounded (vector DB) | Days to forever | | Episodic | Historical events | Summaries stored | Varies by importance |
See refs/compression-techniques.md for implementation patterns.
Be specific about agent's role and boundaries.
Example:
You are a Python code reviewer specializing in security.
Your job is to identify security vulnerabilities.
You do NOT review style or performance.
Clear, actionable instructions with explicit format.
Bad: "Review this code." Good: "Review for security: 1) SQL injection 2) Input validation 3) Secrets. Output: JSON with vulnerabilities."
Specify exact output format to reduce tokens.
Show examples for complex tasks.
See refs/selective-loading.md for detailed prompting patterns.
| Strategy | Pros | Cons | |----------|------|------| | Anticipatory | Faster response time (load before needed) | May load unnecessary data | | Just-in-Time (JIT) | Minimal token usage (load only when needed) | Latency on each request | | Hybrid | Balanced (core context + JIT for task-specific) | More complex implementation |
Track input and output tokens separately. Rates vary by model (typically $0.003-0.075 per 1K tokens).
Set hard token limits per agent/session to prevent runaway costs.
Track costs per agent to identify expensive components.
See refs/cost-calculation-budget.md and refs/cost-optimization-reporting.md for detailed cost strategies.
Sequential Pattern: Pass only output of previous agent, not entire chain.
Hierarchical Pattern: Parent gets summaries from children, children get only relevant task context.
Collaborative Pattern: Shared context (compressed), each agent adds only delta.
Autonomous Pattern: Minimal shared context, isolated context per agent.
refs/compression-techniques.md - Conversation summarization, deduplication, entity compressionrefs/selective-loading.md - Relevance filtering, time decay, token-budgeted retrievalrefs/caching-and-optimization.md - Prompt caching, semantic caching, batching, cost-aware model selectionrefs/cost-calculation-budget.md - Token pricing, cost calculation, budget managementrefs/cost-optimization-reporting.md - Cost estimation, optimization strategies, reportingdevelopment
--- name: large-scale-migration description: How to execute a LARGE MECHANICAL change across any codebase with LEVERAGE instead of an agent-grind or hand-edits — a cross-cutting migration, refactor, rename, dialect/framework/DB port, library adoption, or bulk transform. The map→transform→gate pattern: a deterministic transform driven by a source-of-truth map, proven by a differential-equivalence gate. Use when the work is "migrate all X to Y", "rename Z everywhere", "port to a new DB/dialect/fra
testing
v11 LLM-based work-shape classifier. Replaces the regex archetype detector with the model's own reasoning. Reads the user's prompt, picks the right archetype(s) from the catalog, identifies signals (blast_radius, novelty, reversibility, etc.), and persists to SessionState so subsequent turns steer correctly. Use when: the prompt_submit hook emitted a `<wg classify-due />` directive, OR explicitly invoked at session start, OR when re-classifying after the user changes scope mid-session.
tools
v11 work-shape archetype runner. When a prompt has been routed to one of the 9 archetypes (triage, explore, specify, decide, ship, review, incident, build, migrate), this skill is the entry point. It picks the right per-archetype playbook from refs/ and executes the phase shape declared in `.claude-plugin/archetypes.json`. Use when: a `<wg archetype="X">` or `<wg archetypes>` system-reminder tag appears, an explicit "let's run the X archetype" request, or when one of the per-archetype slash commands resolves to this skill.
development
Show or set the session intent variable. Intent gates how loud the framework is — simple-edit (silent), feature/research (synthesis directive), rigor (full crew context). Auto-detected on turn 1; this skill overrides explicitly. Sticky for the session. Use when: "set intent", "intent override", "/wicked-garden:intent", "make the framework quiet", "force rigor", "what's my intent".