A2A agent protocol interoperability, Agent Cards, and MCP bridging / Protokol agen A2A, Agent Cards, dan integrasi MCP.
The English summary is being prepared. Showing the original description.
Expert guide for engineering and optimizing ultra-large context windows (2M+ tokens) across Gemini 4 Pro, Claude 5.5, and GPT Astra 6 — context partitioning, retrieval-augmented context injection, sliding window strategies, and cost-aware token budgeting / Panduan ahli rekayasa dan optimasi context window ultra-besar (2M+ token) di Gemini 4 Pro, Claude 5.5, dan GPT Astra 6 — partisi konteks, injeksi konteks berbasis retrieval, strategi sliding window, dan penganggaran token sadar-biaya.
The English summary is being prepared. Showing the original description.
Run score Not tested
See how to installReview the instructions the agent will receive before you install.
<a name="english"></a>
zero-to-prod-orchestrator (Phase 4 AI integration), brainstorming, session-memory-manager (context zone snapshots & handoff).kv-cache-prefix-optimizer (Zone 1-2 cache boundary alignment), adaptive-model-cascade (overflow routing across model sizes), llm-finops-router (per-zone token cost accounting).frontier-ai-models-expert (2M+ token recall curves), gemini-agent-booster (Google 2M+ native context caching), vercel-ai-sdk-expert (context streaming & tools).deep-research-analyst (retrieval-augmented injection), vector-db-rag-expert (retrieval vs context stuffing decisions).Production guide for engineering, partitioning, and optimizing ultra-large context windows (128k → 2M+ tokens) across frontier models. Prevents the most common failure mode in 2026 AI applications: dumping raw data into context without structure, causing degraded recall, wasted tokens, and hallucination amplification in the "lost in the middle" zone.
Activate this skill when:
| Model | Max Context | Effective Recall Zone | Cost per 1M Input Tokens | Cache Discount |
|---|---|---|---|---|
| Gemini 4 Pro | 2,097,152 | ~1.8M (reliable) | $1.25 | 75% (explicit cache) |
| Gemini 4 Flash | 1,048,576 | ~900k | $0.075 | 75% |
| Claude 5.5 Opus | 500,000 | ~450k | $15.00 | 90% (prompt cache) |
| Claude 5.5 Sonnet | 200,000 | ~180k | $3.00 | 90% |
| GPT Astra 6 | 256,000 | ~220k | $5.00 | 50% (prefix cache) |
Never treat the context window as a flat buffer. Partition it into semantically meaningful zones with explicit priority ordering:
┌──────────────────────────────────────────────────────┐
│ ZONE 1: IMMUTABLE SYSTEM DIRECTIVES (1-3%) │
│ System prompt, behavioral guardrails, output format │
│ ► NEVER changes mid-session │
├──────────────────────────────────────────────────────┤
│ ZONE 2: STATIC REFERENCE CONTEXT (10-40%) │
│ Codebase schemas, API specs, tool definitions, │
│ architectural docs, PRD excerpts │
│ ► Changes only between sessions │
├──────────────────────────────────────────────────────┤
│ ZONE 3: RETRIEVED CONTEXT (20-50%) │
│ RAG chunks, relevant code files, search results, │
│ documentation snippets │
│ ► Dynamically injected per query via retrieval │
├──────────────────────────────────────────────────────┤
│ ZONE 4: CONVERSATION HISTORY (10-30%) │
│ Prior turns, summarized older context, │
│ tool call results │
│ ► Sliding window with intelligent summarization │
├──────────────────────────────────────────────────────┤
│ ZONE 5: ACTIVE QUERY + SCRATCHPAD (1-5%) │
│ Current user message, chain-of-thought workspace │
│ ► Most volatile, always at the tail │
└──────────────────────────────────────────────────────┘
export interface ContextBudget {
totalCapacity: number;
zones: {
systemDirectives: { maxTokens: number; priority: 1 };
staticReference: { maxTokens: number; priority: 2 };
retrievedContext: { maxTokens: number; priority: 3 };
conversationHistory: { maxTokens: number; priority: 4 };
activeQuery: { maxTokens: number; priority: 5 };
};
}
export function createBudget(modelCapacity: number): ContextBudget {
return {
totalCapacity: modelCapacity,
zones: {
systemDirectives: { maxTokens: Math.floor(modelCapacity * 0.02), priority: 1 },
staticReference: { maxTokens: Math.floor(modelCapacity * 0.30), priority: 2 },
retrievedContext: { maxTokens: Math.floor(modelCapacity * 0.40), priority: 3 },
conversationHistory: { maxTokens: Math.floor(modelCapacity * 0.25), priority: 4 },
activeQuery: { maxTokens: Math.floor(modelCapacity * 0.03), priority: 5 },
},
};
}
export function enforceTokenBudget(
zoneContents: Map<string, string>,
budget: ContextBudget,
tokenCounter: (text: string) => number
): Map<string, string> {
const result = new Map<string, string>();
const zones = Object.entries(budget.zones).sort(([, a], [, b]) => a.priority - b.priority);
for (const [zoneName, { maxTokens }] of zones) {
const content = zoneContents.get(zoneName) ?? '';
const tokenCount = tokenCounter(content);
if (tokenCount <= maxTokens) {
result.set(zoneName, content);
} else {
result.set(zoneName, truncateToTokenLimit(content, maxTokens, tokenCounter));
}
}
return result;
}
function truncateToTokenLimit(
content: string,
maxTokens: number,
tokenCounter: (text: string) => number
): string {
const lines = content.split('\n');
let accumulated = '';
for (const line of lines) {
const candidate = accumulated ? `${accumulated}\n${line}` : line;
if (tokenCounter(candidate) > maxTokens) break;
accumulated = candidate;
}
return accumulated;
}
Frontier models exhibit degraded recall for information positioned in the middle 40-60% of the context. Mitigate with:
=== CRITICAL: Database Schema ===) to create attention anchors.| Criterion | Use RAG (Retrieve & Inject) | Use Long-Context Stuffing |
|---|---|---|
| Corpus size | >10M tokens total corpus | <2M tokens total corpus |
| Query specificity | Narrow, focused queries | Broad, synthesis-oriented queries |
| Freshness | Corpus updates frequently | Corpus is static per session |
| Cost sensitivity | High (pay only for retrieved chunks) | Lower priority (amortized via cache) |
| Recall requirement | Precision-critical (top-k retrieval) | Recall-critical (need full picture) |
export interface TurnSummary {
turnIndex: number;
role: 'user' | 'assistant';
summary: string;
tokenCount: number;
fullContent?: string;
}
export function buildSlidingWindow(
allTurns: TurnSummary[],
maxHistoryTokens: number,
recentTurnsToKeepFull: number = 4
): string[] {
const recentFull = allTurns.slice(-recentTurnsToKeepFull);
const older = allTurns.slice(0, -recentTurnsToKeepFull);
let budget = maxHistoryTokens;
const output: string[] = [];
for (const turn of recentFull) {
const content = turn.fullContent ?? turn.summary;
budget -= turn.tokenCount;
output.push(content);
}
if (budget > 0 && older.length > 0) {
const olderSummaries = older.map((t) => `[Turn ${t.turnIndex}] ${t.summary}`);
output.unshift(`=== SUMMARIZED EARLIER CONTEXT ===\n${olderSummaries.join('\n')}`);
}
return output;
}
tiktoken (OpenAI), @anthropic-ai/tokenizer, or Gemini's countTokens() API to measure actual token counts.kv-cache-prefix-optimizer so static zones (1-2) align with KV-cache prefix boundaries.data-telemetry-expert dashboards to identify context bloat early.| Anti-Pattern | Consequence | Remedy |
|---|---|---|
| Dumping entire codebase into context | Exceeds effective recall zone, hallucination spikes | Use targeted retrieval + file relevance scoring |
| No zone partitioning | Critical instructions get "lost in the middle" | Implement explicit zone headers and priority ordering |
| Ignoring token counting | Silent context truncation by model API | Pre-count and enforce budgets client-side |
| Keeping full conversation history forever | Context fills up after 10-15 turns | Implement sliding window with summarization |
<a name="bahasa-indonesia"></a>
zero-to-prod-orchestrator (Integrasi AI Fase 4), brainstorming, session-memory-manager (snapshot zona konteks & handoff).kv-cache-prefix-optimizer (penyelarasan batas cache Zona 1-2), adaptive-model-cascade (routing luapan kapasitas model), llm-finops-router (akuntansi biaya token per zona).frontier-ai-models-expert (kurva recall 2M+ token), gemini-agent-booster (caching konteks native Google 2M+), vercel-ai-sdk-expert (streaming konteks & tools).deep-research-analyst (injeksi berbasis retrieval), vector-db-rag-expert (keputusan retrieval vs penumpukan konteks).Panduan produksi untuk merekayasa, mempartisi, dan mengoptimalkan context window ultra-besar (128k → 2M+ token) pada model frontier. Mencegah kegagalan paling umum di aplikasi AI 2026: memasukkan data mentah ke konteks tanpa struktur, yang menyebabkan recall menurun, token terbuang, dan amplifikasi halusinasi di zona "lost in the middle".
Aktifkan skill ini ketika:
Jangan perlakukan context window sebagai buffer datar. Partisi menjadi zona bermakna secara semantik:
Model frontier menunjukkan recall yang menurun untuk informasi di tengah-tengah konteks. Mitigasi dengan penempatan informasi kritis di awal dan akhir, jangkar struktural, ringkasan redundan, dan retrieval berbasis chunk.
Gunakan RAG untuk korpus >10M token dengan query spesifik dan sensitivitas biaya tinggi. Gunakan long-context stuffing untuk korpus <2M token dengan kebutuhan sintesis luas dan corpus statis per sesi.
countTokens() untuk mengukur jumlah token aktual.kv-cache-prefix-optimizer agar zona statis selaras dengan batas prefix KV-cache.| Praktik Buruk | Dampak | Solusi |
|---|---|---|
| Memasukkan seluruh codebase ke konteks | Melebihi zona recall efektif, halusinasi melonjak | Gunakan retrieval terarah + skor relevansi file |
| Tanpa partisi zona | Instruksi kritis "hilang di tengah" | Implementasikan header zona eksplisit |
| Mengabaikan penghitungan token | Pemotongan konteks diam-diam oleh API model | Hitung dan terapkan anggaran dari sisi klien |
| Menyimpan seluruh riwayat percakapan | Konteks penuh setelah 10-15 giliran | Terapkan sliding window dengan ringkasan |
No reviews yet. Tell others what you thought.
No login needed. Share how it worked for you, ask a question, or note where it did not run.
No comments yet. Be the first to write one.
A2A agent protocol interoperability, Agent Cards, and MCP bridging / Protokol agen A2A, Agent Cards, dan integrasi MCP.
The English summary is being prepared. Showing the original description.
Expert guide for automated and manual Web Accessibility (a11y) testing — axe-core, Pa11y, Playwright a11y, screen reader testing, and WCAG 2.2 Level AA/AAA compliance / Panduan ahli pengujian aksesibilitas web.
The English summary is being prepared. Showing the original description.
Web accessibility testing with axe-core, Playwright, and WCAG 2.2 / Pengujian aksesibilitas web axe-core, Playwright, dan WCAG 2.2.
The English summary is being prepared. Showing the original description.
Expert guide for intelligent model cascading and routing — complexity-scored task routing from Flash/Haiku to Sonnet/Opus/Astra, dynamic escalation with quality gates, 40-60% token cost reduction while maintaining output quality / Panduan ahli untuk kaskade dan routing model cerdas — routing tugas berbasis skor kompleksitas dari Flash/Haiku ke Sonnet/Opus/Astra, eskalasi dinamis dengan gerbang kualitas, pengurangan biaya token 40-60% dengan kualitas output terjaga.
The English summary is being prepared. Showing the original description.
Model cascading & complexity-scored routing (Grok, Gemini, Claude) / Routing kaskade model & scoring kompleksitas (Grok, Gemini, Claude).
The English summary is being prepared. Showing the original description.
Affective computing, emotion AI, and multimodal sentiment analysis / Komputasi afektif, AI emosional, dan analisis sentimen multimodal.
The English summary is being prepared. Showing the original description.