opencode-skills-collection 1.0.186 → 1.0.187
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundled-skills/.antigravity-install-manifest.json +5 -1
- package/bundled-skills/3d-web-experience/SKILL.md +152 -37
- package/bundled-skills/agent-evaluation/SKILL.md +1088 -26
- package/bundled-skills/agent-memory-systems/SKILL.md +1037 -25
- package/bundled-skills/agent-tool-builder/SKILL.md +668 -16
- package/bundled-skills/ai-agents-architect/SKILL.md +271 -31
- package/bundled-skills/ai-product/SKILL.md +716 -26
- package/bundled-skills/ai-wrapper-product/SKILL.md +450 -44
- package/bundled-skills/algolia-search/SKILL.md +867 -15
- package/bundled-skills/autonomous-agents/SKILL.md +1033 -26
- package/bundled-skills/aws-serverless/SKILL.md +1046 -35
- package/bundled-skills/azure-functions/SKILL.md +1318 -19
- package/bundled-skills/browser-automation/SKILL.md +1065 -28
- package/bundled-skills/browser-extension-builder/SKILL.md +159 -32
- package/bundled-skills/bullmq-specialist/SKILL.md +347 -16
- package/bundled-skills/clerk-auth/SKILL.md +796 -15
- package/bundled-skills/computer-use-agents/SKILL.md +1870 -28
- package/bundled-skills/context-window-management/SKILL.md +271 -18
- package/bundled-skills/conversation-memory/SKILL.md +453 -24
- package/bundled-skills/crewai/SKILL.md +252 -46
- package/bundled-skills/discord-bot-architect/SKILL.md +1207 -34
- package/bundled-skills/docs/integrations/jetski-cortex.md +3 -3
- package/bundled-skills/docs/integrations/jetski-gemini-loader/README.md +1 -1
- package/bundled-skills/docs/maintainers/repo-growth-seo.md +3 -3
- package/bundled-skills/docs/maintainers/skills-update-guide.md +1 -1
- package/bundled-skills/docs/users/bundles.md +1 -1
- package/bundled-skills/docs/users/claude-code-skills.md +1 -1
- package/bundled-skills/docs/users/gemini-cli-skills.md +1 -1
- package/bundled-skills/docs/users/getting-started.md +1 -1
- package/bundled-skills/docs/users/kiro-integration.md +1 -1
- package/bundled-skills/docs/users/usage.md +4 -4
- package/bundled-skills/docs/users/visual-guide.md +4 -4
- package/bundled-skills/email-systems/SKILL.md +646 -26
- package/bundled-skills/faf-expert/SKILL.md +221 -0
- package/bundled-skills/faf-wizard/SKILL.md +252 -0
- package/bundled-skills/file-uploads/SKILL.md +212 -11
- package/bundled-skills/firebase/SKILL.md +646 -16
- package/bundled-skills/gcp-cloud-run/SKILL.md +1117 -32
- package/bundled-skills/graphql/SKILL.md +1026 -27
- package/bundled-skills/hubspot-integration/SKILL.md +804 -19
- package/bundled-skills/idea-darwin/SKILL.md +120 -0
- package/bundled-skills/inngest/SKILL.md +431 -16
- package/bundled-skills/interactive-portfolio/SKILL.md +342 -44
- package/bundled-skills/langfuse/SKILL.md +296 -41
- package/bundled-skills/langgraph/SKILL.md +259 -50
- package/bundled-skills/micro-saas-launcher/SKILL.md +343 -44
- package/bundled-skills/neon-postgres/SKILL.md +572 -15
- package/bundled-skills/nextjs-supabase-auth/SKILL.md +269 -21
- package/bundled-skills/notion-template-business/SKILL.md +371 -44
- package/bundled-skills/personal-tool-builder/SKILL.md +537 -44
- package/bundled-skills/plaid-fintech/SKILL.md +825 -19
- package/bundled-skills/prompt-caching/SKILL.md +438 -25
- package/bundled-skills/rag-engineer/SKILL.md +271 -29
- package/bundled-skills/salesforce-development/SKILL.md +912 -19
- package/bundled-skills/satori/SKILL.md +54 -0
- package/bundled-skills/scroll-experience/SKILL.md +381 -44
- package/bundled-skills/segment-cdp/SKILL.md +817 -19
- package/bundled-skills/shopify-apps/SKILL.md +1475 -19
- package/bundled-skills/slack-bot-builder/SKILL.md +1162 -28
- package/bundled-skills/telegram-bot-builder/SKILL.md +152 -37
- package/bundled-skills/telegram-mini-app/SKILL.md +445 -44
- package/bundled-skills/trigger-dev/SKILL.md +916 -27
- package/bundled-skills/twilio-communications/SKILL.md +1310 -28
- package/bundled-skills/upstash-qstash/SKILL.md +898 -27
- package/bundled-skills/vercel-deployment/SKILL.md +637 -39
- package/bundled-skills/viral-generator-builder/SKILL.md +132 -37
- package/bundled-skills/voice-agents/SKILL.md +937 -27
- package/bundled-skills/voice-ai-development/SKILL.md +375 -46
- package/bundled-skills/workflow-automation/SKILL.md +982 -29
- package/bundled-skills/zapier-make-patterns/SKILL.md +772 -27
- package/package.json +1 -1
|
@@ -1,23 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: context-window-management
|
|
3
|
-
description:
|
|
3
|
+
description: Strategies for managing LLM context windows including
|
|
4
|
+
summarization, trimming, routing, and avoiding context rot
|
|
4
5
|
risk: unknown
|
|
5
|
-
source:
|
|
6
|
-
date_added:
|
|
6
|
+
source: vibeship-spawner-skills (Apache 2.0)
|
|
7
|
+
date_added: 2026-02-27
|
|
7
8
|
---
|
|
8
9
|
|
|
9
10
|
# Context Window Management
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
millions of conversations. You've seen systems hit token limits, suffer context rot,
|
|
13
|
-
and lose critical information mid-dialogue.
|
|
14
|
-
|
|
15
|
-
You understand that context is a finite resource with diminishing returns. More tokens
|
|
16
|
-
doesn't mean better results—the art is in curating the right information. You know
|
|
17
|
-
the serial position effect, the lost-in-the-middle problem, and when to summarize
|
|
18
|
-
versus when to retrieve.
|
|
19
|
-
|
|
20
|
-
Your cor
|
|
12
|
+
Strategies for managing LLM context windows including summarization, trimming, routing, and avoiding context rot
|
|
21
13
|
|
|
22
14
|
## Capabilities
|
|
23
15
|
|
|
@@ -28,31 +20,292 @@ Your cor
|
|
|
28
20
|
- token-counting
|
|
29
21
|
- context-prioritization
|
|
30
22
|
|
|
23
|
+
## Prerequisites
|
|
24
|
+
|
|
25
|
+
- Knowledge: LLM fundamentals, Tokenization basics, Prompt engineering
|
|
26
|
+
- Skills_recommended: prompt-engineering
|
|
27
|
+
|
|
28
|
+
## Scope
|
|
29
|
+
|
|
30
|
+
- Does_not_cover: RAG implementation details, Model fine-tuning, Embedding models
|
|
31
|
+
- Boundaries: Focus is context optimization, Covers strategies not specific implementations
|
|
32
|
+
|
|
33
|
+
## Ecosystem
|
|
34
|
+
|
|
35
|
+
### Primary_tools
|
|
36
|
+
|
|
37
|
+
- tiktoken - OpenAI's tokenizer for counting tokens
|
|
38
|
+
- LangChain - Framework with context management utilities
|
|
39
|
+
- Claude API - 200K+ context with caching support
|
|
40
|
+
|
|
31
41
|
## Patterns
|
|
32
42
|
|
|
33
43
|
### Tiered Context Strategy
|
|
34
44
|
|
|
35
45
|
Different strategies based on context size
|
|
36
46
|
|
|
47
|
+
**When to use**: Building any multi-turn conversation system
|
|
48
|
+
|
|
49
|
+
interface ContextTier {
|
|
50
|
+
maxTokens: number;
|
|
51
|
+
strategy: 'full' | 'summarize' | 'rag';
|
|
52
|
+
model: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const TIERS: ContextTier[] = [
|
|
56
|
+
{ maxTokens: 8000, strategy: 'full', model: 'claude-3-haiku' },
|
|
57
|
+
{ maxTokens: 32000, strategy: 'full', model: 'claude-3-5-sonnet' },
|
|
58
|
+
{ maxTokens: 100000, strategy: 'summarize', model: 'claude-3-5-sonnet' },
|
|
59
|
+
{ maxTokens: Infinity, strategy: 'rag', model: 'claude-3-5-sonnet' }
|
|
60
|
+
];
|
|
61
|
+
|
|
62
|
+
async function selectStrategy(messages: Message[]): ContextTier {
|
|
63
|
+
const tokens = await countTokens(messages);
|
|
64
|
+
|
|
65
|
+
for (const tier of TIERS) {
|
|
66
|
+
if (tokens <= tier.maxTokens) {
|
|
67
|
+
return tier;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return TIERS[TIERS.length - 1];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async function prepareContext(messages: Message[]): PreparedContext {
|
|
74
|
+
const tier = await selectStrategy(messages);
|
|
75
|
+
|
|
76
|
+
switch (tier.strategy) {
|
|
77
|
+
case 'full':
|
|
78
|
+
return { messages, model: tier.model };
|
|
79
|
+
|
|
80
|
+
case 'summarize':
|
|
81
|
+
const summary = await summarizeOldMessages(messages);
|
|
82
|
+
return { messages: [summary, ...recentMessages(messages)], model: tier.model };
|
|
83
|
+
|
|
84
|
+
case 'rag':
|
|
85
|
+
const relevant = await retrieveRelevant(messages);
|
|
86
|
+
return { messages: [...relevant, ...recentMessages(messages)], model: tier.model };
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
37
90
|
### Serial Position Optimization
|
|
38
91
|
|
|
39
92
|
Place important content at start and end
|
|
40
93
|
|
|
94
|
+
**When to use**: Constructing prompts with significant context
|
|
95
|
+
|
|
96
|
+
// LLMs weight beginning and end more heavily
|
|
97
|
+
// Structure prompts to leverage this
|
|
98
|
+
|
|
99
|
+
function buildOptimalPrompt(components: {
|
|
100
|
+
systemPrompt: string;
|
|
101
|
+
criticalContext: string;
|
|
102
|
+
conversationHistory: Message[];
|
|
103
|
+
currentQuery: string;
|
|
104
|
+
}): string {
|
|
105
|
+
// START: System instructions (always first)
|
|
106
|
+
const parts = [components.systemPrompt];
|
|
107
|
+
|
|
108
|
+
// CRITICAL CONTEXT: Right after system (high primacy)
|
|
109
|
+
if (components.criticalContext) {
|
|
110
|
+
parts.push(`## Key Context\n${components.criticalContext}`);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// MIDDLE: Conversation history (lower weight)
|
|
114
|
+
// Summarize if long, keep recent messages full
|
|
115
|
+
const history = components.conversationHistory;
|
|
116
|
+
if (history.length > 10) {
|
|
117
|
+
const oldSummary = summarize(history.slice(0, -5));
|
|
118
|
+
const recent = history.slice(-5);
|
|
119
|
+
parts.push(`## Earlier Conversation (Summary)\n${oldSummary}`);
|
|
120
|
+
parts.push(`## Recent Messages\n${formatMessages(recent)}`);
|
|
121
|
+
} else {
|
|
122
|
+
parts.push(`## Conversation\n${formatMessages(history)}`);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// END: Current query (high recency)
|
|
126
|
+
// Restate critical requirements here
|
|
127
|
+
parts.push(`## Current Request\n${components.currentQuery}`);
|
|
128
|
+
|
|
129
|
+
// FINAL: Reminder of key constraints
|
|
130
|
+
parts.push(`Remember: ${extractKeyConstraints(components.systemPrompt)}`);
|
|
131
|
+
|
|
132
|
+
return parts.join('\n\n');
|
|
133
|
+
}
|
|
134
|
+
|
|
41
135
|
### Intelligent Summarization
|
|
42
136
|
|
|
43
137
|
Summarize by importance, not just recency
|
|
44
138
|
|
|
45
|
-
|
|
139
|
+
**When to use**: Context exceeds optimal size
|
|
140
|
+
|
|
141
|
+
interface MessageWithMetadata extends Message {
|
|
142
|
+
importance: number; // 0-1 score
|
|
143
|
+
hasCriticalInfo: boolean; // User preferences, decisions
|
|
144
|
+
referenced: boolean; // Was this referenced later?
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
async function smartSummarize(
|
|
148
|
+
messages: MessageWithMetadata[],
|
|
149
|
+
targetTokens: number
|
|
150
|
+
): Message[] {
|
|
151
|
+
// Sort by importance, preserve order for tied scores
|
|
152
|
+
const sorted = [...messages].sort((a, b) =>
|
|
153
|
+
(b.importance + (b.hasCriticalInfo ? 0.5 : 0) + (b.referenced ? 0.3 : 0)) -
|
|
154
|
+
(a.importance + (a.hasCriticalInfo ? 0.5 : 0) + (a.referenced ? 0.3 : 0))
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
const keep: Message[] = [];
|
|
158
|
+
const summarizePool: Message[] = [];
|
|
159
|
+
let currentTokens = 0;
|
|
160
|
+
|
|
161
|
+
for (const msg of sorted) {
|
|
162
|
+
const msgTokens = await countTokens([msg]);
|
|
163
|
+
if (currentTokens + msgTokens < targetTokens * 0.7) {
|
|
164
|
+
keep.push(msg);
|
|
165
|
+
currentTokens += msgTokens;
|
|
166
|
+
} else {
|
|
167
|
+
summarizePool.push(msg);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// Summarize the low-importance messages
|
|
172
|
+
if (summarizePool.length > 0) {
|
|
173
|
+
const summary = await llm.complete(`
|
|
174
|
+
Summarize these messages, preserving:
|
|
175
|
+
- Any user preferences or decisions
|
|
176
|
+
- Key facts that might be referenced later
|
|
177
|
+
- The overall flow of conversation
|
|
178
|
+
|
|
179
|
+
Messages:
|
|
180
|
+
${formatMessages(summarizePool)}
|
|
181
|
+
`);
|
|
182
|
+
|
|
183
|
+
keep.unshift({ role: 'system', content: `[Earlier context: ${summary}]` });
|
|
184
|
+
}
|
|
46
185
|
|
|
47
|
-
|
|
186
|
+
// Restore original order
|
|
187
|
+
return keep.sort((a, b) => a.timestamp - b.timestamp);
|
|
188
|
+
}
|
|
48
189
|
|
|
49
|
-
###
|
|
190
|
+
### Token Budget Allocation
|
|
50
191
|
|
|
51
|
-
|
|
192
|
+
Allocate token budget across context components
|
|
193
|
+
|
|
194
|
+
**When to use**: Need predictable context management
|
|
195
|
+
|
|
196
|
+
interface TokenBudget {
|
|
197
|
+
system: number; // System prompt
|
|
198
|
+
criticalContext: number; // User prefs, key info
|
|
199
|
+
history: number; // Conversation history
|
|
200
|
+
query: number; // Current query
|
|
201
|
+
response: number; // Reserved for response
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function allocateBudget(totalTokens: number): TokenBudget {
|
|
205
|
+
return {
|
|
206
|
+
system: Math.floor(totalTokens * 0.10), // 10%
|
|
207
|
+
criticalContext: Math.floor(totalTokens * 0.15), // 15%
|
|
208
|
+
history: Math.floor(totalTokens * 0.40), // 40%
|
|
209
|
+
query: Math.floor(totalTokens * 0.10), // 10%
|
|
210
|
+
response: Math.floor(totalTokens * 0.25), // 25%
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
async function buildWithBudget(
|
|
215
|
+
components: ContextComponents,
|
|
216
|
+
modelMaxTokens: number
|
|
217
|
+
): PreparedContext {
|
|
218
|
+
const budget = allocateBudget(modelMaxTokens);
|
|
219
|
+
|
|
220
|
+
// Truncate/summarize each component to fit budget
|
|
221
|
+
const prepared = {
|
|
222
|
+
system: truncateToTokens(components.system, budget.system),
|
|
223
|
+
criticalContext: truncateToTokens(
|
|
224
|
+
components.criticalContext, budget.criticalContext
|
|
225
|
+
),
|
|
226
|
+
history: await summarizeToTokens(components.history, budget.history),
|
|
227
|
+
query: truncateToTokens(components.query, budget.query),
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
// Reallocate unused budget
|
|
231
|
+
const used = await countTokens(Object.values(prepared).join('\n'));
|
|
232
|
+
const remaining = modelMaxTokens - used - budget.response;
|
|
233
|
+
|
|
234
|
+
if (remaining > 0) {
|
|
235
|
+
// Give extra to history (most valuable for conversation)
|
|
236
|
+
prepared.history = await summarizeToTokens(
|
|
237
|
+
components.history,
|
|
238
|
+
budget.history + remaining
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
return prepared;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
## Validation Checks
|
|
246
|
+
|
|
247
|
+
### No Token Counting
|
|
248
|
+
|
|
249
|
+
Severity: WARNING
|
|
250
|
+
|
|
251
|
+
Message: Building context without token counting. May exceed model limits.
|
|
252
|
+
|
|
253
|
+
Fix action: Count tokens before sending, implement budget allocation
|
|
254
|
+
|
|
255
|
+
### Naive Message Truncation
|
|
256
|
+
|
|
257
|
+
Severity: WARNING
|
|
258
|
+
|
|
259
|
+
Message: Truncating messages without summarization. Critical context may be lost.
|
|
260
|
+
|
|
261
|
+
Fix action: Summarize old messages instead of simply removing them
|
|
262
|
+
|
|
263
|
+
### Hardcoded Token Limit
|
|
264
|
+
|
|
265
|
+
Severity: INFO
|
|
266
|
+
|
|
267
|
+
Message: Hardcoded token limit. Consider making configurable per model.
|
|
268
|
+
|
|
269
|
+
Fix action: Use model-specific limits from configuration
|
|
270
|
+
|
|
271
|
+
### No Context Management Strategy
|
|
272
|
+
|
|
273
|
+
Severity: WARNING
|
|
274
|
+
|
|
275
|
+
Message: LLM calls without context management strategy.
|
|
276
|
+
|
|
277
|
+
Fix action: Implement context management: budgets, summarization, or RAG
|
|
278
|
+
|
|
279
|
+
## Collaboration
|
|
280
|
+
|
|
281
|
+
### Delegation Triggers
|
|
282
|
+
|
|
283
|
+
- retrieval|rag|search -> rag-implementation (Need retrieval system)
|
|
284
|
+
- memory|persistence|remember -> conversation-memory (Need memory storage)
|
|
285
|
+
- cache|caching -> prompt-caching (Need caching optimization)
|
|
286
|
+
|
|
287
|
+
### Complete Context System
|
|
288
|
+
|
|
289
|
+
Skills: context-window-management, rag-implementation, conversation-memory, prompt-caching
|
|
290
|
+
|
|
291
|
+
Workflow:
|
|
292
|
+
|
|
293
|
+
```
|
|
294
|
+
1. Design context strategy
|
|
295
|
+
2. Implement RAG for large corpuses
|
|
296
|
+
3. Set up memory persistence
|
|
297
|
+
4. Add caching for performance
|
|
298
|
+
```
|
|
52
299
|
|
|
53
300
|
## Related Skills
|
|
54
301
|
|
|
55
302
|
Works well with: `rag-implementation`, `conversation-memory`, `prompt-caching`, `llm-npc-dialogue`
|
|
56
303
|
|
|
57
304
|
## When to Use
|
|
58
|
-
|
|
305
|
+
|
|
306
|
+
- User mentions or implies: context window
|
|
307
|
+
- User mentions or implies: token limit
|
|
308
|
+
- User mentions or implies: context management
|
|
309
|
+
- User mentions or implies: context engineering
|
|
310
|
+
- User mentions or implies: long context
|
|
311
|
+
- User mentions or implies: context overflow
|