ワンクリックで
context-engineering
Context Engineering is the discipline of maximizing agent output quality while minimizing token expenditure.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Context Engineering is the discipline of maximizing agent output quality while minimizing token expenditure.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Parallel Agent Orchestration is the discipline of dispatching, coordinating, and aggregating results from multiple concurrent subagents to dramatically accelerate complex tasks.
Proactive Intelligence enables agents to autonomously seek out external information — web searches, API re-pulls, data freshness checks — during analysis without waiting for explicit user requests
Prompt Architecture is the structural engineering of agent instructions.
Verification Loops are systematic evaluation pipelines that validate agent outputs at every stage of execution.
Continuous Learning enables agents to automatically extract successful patterns from completed sessions and codify them into reusable skills, rules, and prompt refinements.
Entity Memory Management is the systematic extraction, persistence, and retrieval of named entities across agent sessions, enabling long-term contextual awareness that transforms transient conversations into persistent relationships.
| name | context-engineering |
| description | Context Engineering is the discipline of maximizing agent output quality while minimizing token expenditure. |
Part of Agent Skills™ by googleadsagent.ai™
Context Engineering is the discipline of maximizing agent output quality while minimizing token expenditure. In a world where every token carries cost and latency implications, the ability to surgically curate what enters an agent's context window separates production-grade systems from expensive toys. This skill codifies the techniques pioneered across the googleadsagent.ai™ platform, where Buddy™ routinely operates within 200k-token windows while maintaining domain-expert-level accuracy.
The core insight is that context is not merely "what you send to the model" — it is working memory, and it must be engineered with the same rigor as any other system resource. Information density optimization, structured loading sequences, and progressive disclosure patterns ensure the agent receives precisely the right information at precisely the right moment. Poorly engineered context leads to hallucination, instruction drift, and ballooning costs.
This skill teaches agents to treat context as a finite, managed resource: measure it, compress it, prioritize it, and reclaim it. The techniques here apply universally across Claude Code, Cursor, Codex, and Gemini harnesses.
graph TD
A[Raw Context Sources] --> B[Relevance Scoring]
B --> C{Score > Threshold?}
C -->|Yes| D[Compression Engine]
C -->|No| E[Context Archive]
D --> F[Priority Queue]
F --> G[Token Budget Allocator]
G --> H[Context Window Assembly]
H --> I[Agent Execution]
I --> J[Context Reclamation]
J --> K{Session Active?}
K -->|Yes| B
K -->|No| L[Session Summary → Memory]
The context lifecycle begins with raw sources — files, previous messages, tool outputs, knowledge bases — flowing through a relevance scoring pass. Items scoring below the threshold are archived rather than discarded, available for retrieval if needed. High-relevance items enter a compression engine that reduces token footprint while preserving semantic content. A priority queue orders compressed items by recency, importance, and task relevance. The token budget allocator enforces hard limits, ensuring the assembled context window never exceeds the target budget. After agent execution, context reclamation identifies items that are no longer needed for subsequent turns.
Token Budget Enforcement:
class ContextBudget {
constructor(maxTokens = 180000) {
this.maxTokens = maxTokens;
this.reservedForOutput = 20000;
this.reservedForSystem = 5000;
this.available = maxTokens - this.reservedForOutput - this.reservedForSystem;
this.allocations = new Map();
}
allocate(category, tokens) {
const currentUsage = this.currentUsage();
if (currentUsage + tokens > this.available) {
return this.evictAndAllocate(category, tokens);
}
this.allocations.set(category, (this.allocations.get(category) || 0) + tokens);
return true;
}
evictAndAllocate(category, needed) {
const sorted = [...this.allocations.entries()]
.sort((a, b) => a[1] - b[1]);
for (const [cat, tokens] of sorted) {
if (cat === category) continue;
this.allocations.delete(cat);
if (this.available - this.currentUsage() >= needed) break;
}
return this.allocate(category, needed);
}
currentUsage() {
return [...this.allocations.values()].reduce((sum, t) => sum + t, 0);
}
}
Progressive Disclosure Pattern:
function buildProgressiveContext(task, depth = 0) {
const layers = [
{ level: 0, content: getTaskSummary(task), tokens: 200 },
{ level: 1, content: getRelevantFiles(task), tokens: 2000 },
{ level: 2, content: getFileContents(task), tokens: 10000 },
{ level: 3, content: getFullDependencyTree(task), tokens: 40000 },
];
return layers
.filter(layer => layer.level <= depth)
.map(layer => layer.content);
}
Context Compression via Summarization:
def compress_context(messages, budget_tokens):
"""Compress conversation history to fit within token budget."""
total = count_tokens(messages)
if total <= budget_tokens:
return messages
system_msgs = [m for m in messages if m["role"] == "system"]
recent = messages[-4:]
middle = messages[len(system_msgs):-4]
summary = summarize_messages(middle)
compressed = system_msgs + [{"role": "system", "content": f"Prior conversation summary: {summary}"}] + recent
if count_tokens(compressed) > budget_tokens:
return system_msgs + recent[-2:]
return compressed
| Feature | Claude Code | Cursor | Codex | Gemini CLI |
|---|---|---|---|---|
| Context budget enforcement | ✅ Full | ✅ Full | ✅ Full | ✅ Full |
| Progressive disclosure | ✅ Native | ✅ Via skills | ✅ Via prompts | ✅ Via prompts |
| Token counting | ✅ Anthropic API | ✅ Via extensions | ✅ tiktoken | ✅ Vertex API |
| Context compression | ✅ Full | ✅ Full | ✅ Full | ✅ Full |
| Session summarization | ✅ Hooks | ✅ Rules | ✅ Instructions | ✅ System prompts |
In Mythos Preview evaluation, Anthropic ranks each file 1–5 by how likely it is to contain interesting, vulnerability-relevant logic (e.g., constants-only files vs. network parsing or auth). They then process the highest-ranked files first instead of burning budget on every path equally.
Adopt the same idea for any large corpus: score likely signal density up front, sort descending, and load or assign work in that order so the context window and agent time go to the most promising sources first. Source: Mythos Preview.
context-engineering, token-optimization, context-window, information-density, progressive-disclosure, context-compression, working-memory, token-budget, context-lifecycle, agent-skills
© 2026 googleadsagent.ai™ | Agent Skills™ | MIT License