wicked-garden-agentic-context-engineering
Skill9 starsChanged 7 months agoMITView on GitHub
Context window management, token optimization, and memory patterns for efficient multi-agent systems.
In this repository142 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .claude/CLAUDE.mdCLAUDE.md
- plugin-json-schemaSkill
- readme-style-guideSkill
- releaseSkill
- scaffoldSkill
- wicked-garden-agentic-agentic-patternsSkill
- wicked-garden-agentic-architectSkill
- wicked-garden-agentic-frameworksSkill
- wicked-garden-agentic-performance-analystSkill
- wicked-garden-agentic-review-methodologySkill
- wicked-garden-agentic-safety-reviewerSkill
- wicked-garden-agenticSkill
- wicked-garden-agentic-trust-and-safetySkill
- wicked-garden-appsSkill
- wicked-garden-archetypeSkill
- wicked-garden-build-guideSkill
- wicked-garden-classifySkill
- wicked-garden-coreSkill
- wicked-garden-data-engineerSkill
- wicked-garden-dataSkill
- wicked-garden-deliberateSkill
- wicked-garden-demoSkill
- wicked-garden-domain-coverageSkill
- wicked-garden-domain-extractorSkill
- wicked-garden-domain-modelerSkill
- wicked-garden-domainSkill
- wicked-garden-draftSkill
- wicked-garden-editor-scaffoldSkill
- wicked-garden-engineering-api-documentarianSkill
- wicked-garden-engineering-architectureSkill
- wicked-garden-engineering-backendSkill
- wicked-garden-engineering-debuggingSkill
- wicked-garden-engineering-docsSkill
- wicked-garden-engineering-frontendSkill
- wicked-garden-engineering-integrationSkill
- wicked-garden-engineering-large-scale-migrationSkill
- wicked-garden-engineering-migration-engineerSkill
- wicked-garden-engineering-patchSkill
- wicked-garden-engineeringSkill
- wicked-garden-engineering-solution-architectSkill
- wicked-garden-engineering-system-designSkill
- wicked-garden-engineering-unit-test-qualitySkill
- wicked-garden-governed-workerSkill
- wicked-garden-groundSkill
- wicked-garden-jam-brainstorm-facilitatorSkill
- wicked-garden-jam-councilSkill
- wicked-garden-jamSkill
- wicked-garden-learnSkill
- wicked-garden-mcp-scaffoldSkill
- wicked-garden-mcpSkill
- wicked-garden-mem-captureSkill
- wicked-garden-mem-ingestSkill
- wicked-garden-memSkill
- wicked-garden-personaSkill
- wicked-garden-platform-auditSkill
- wicked-garden-platform-compliance-officerSkill
- wicked-garden-platform-complianceSkill
- wicked-garden-platform-errorsSkill
- wicked-garden-platform-gate-benchmark-rebaselineSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 45
Only load relevant context based on the current task.
- Distinctive: line 48
Use JSON/structured formats instead of prose to reduce tokens.
- Distinctive: line 51
Before: "The user's name is John Smith..." (verbose)
- Distinctive: line 133
Lazy load details: Only when needed
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Context Engineering
Techniques for managing context windows, optimizing token usage, and designing efficient memory systems for agentic applications.
Context Window Fundamentals
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:
- Cost: Charged per token (input + output)
- Latency: More tokens = slower response
- Quality: Irrelevant context can confuse model
State Management Patterns
| 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 |
Token Optimization Techniques
1. Aggressive Summarization
Compress old context into summaries to reduce token usage.
2. Selective Context Loading
Only load relevant context based on the current task.
3. Structured Compression
Use JSON/structured formats instead of prose to reduce tokens.
Example:
- Before: "The user's name is John Smith..." (verbose)
- After:
{"name": "John Smith", ...}(compact)
4. Lazy Loading
Load details only when explicitly needed.
5. Reference Instead of Embedding
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 Patterns
| 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.
Prompt Engineering for Agents
Role Definition
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.Task Specification
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."
Format Control
Specify exact output format to reduce tokens.
Few-Shot Examples
Show examples for complex tasks.
See refs/selective-loading.md for detailed prompting patterns.
Context Loading Strategies
| 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 |
Cost Modeling
Token Cost Calculation
Track input and output tokens separately. Rates vary by model (typically $0.003-0.075 per 1K tokens).
Budget Enforcement
Set hard token limits per agent/session to prevent runaway costs.
Multi-Agent Cost Attribution
Track costs per agent to identify expensive components.
See refs/cost-calculation-budget.md and refs/cost-optimization-reporting.md for detailed cost strategies.
Context Window Strategies by Agent Pattern
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.
Quick Wins
- Compress old messages: Summarize history > 20 messages
- Use structured outputs: JSON instead of prose
- Lazy load details: Only when needed
- Set token budgets: Hard limits per agent/session
- Monitor token usage: Track and optimize high-cost agents
References
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, reporting
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

