一键导入
context-fundamentals
Activate when designing agent systems, debugging unexpected agent behavior, or optimizing context usage and attention budgets.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Activate when designing agent systems, debugging unexpected agent behavior, or optimizing context usage and attention budgets.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | context-fundamentals |
| version | 1.0.0 |
| description | Activate when designing agent systems, debugging unexpected agent behavior, or optimizing context usage and attention budgets. |
| triggers | ["context","attention","progressive-disclosure","context-window","token-budget","system-prompt"] |
Context is the complete state available to a language model at inference time: system instructions, tool definitions, retrieved documents, message history, and tool outputs. Understanding how to engineer context effectively is prerequisite to getting high-quality results from AI coding agents.
.ai/ skill files for maximum effectivenessSystem Prompts establish the agent's identity, constraints, and behavioral guidelines. They persist throughout the session. The optimal "altitude" balances specificity (concrete signals for desired output) with flexibility (strong heuristics, not brittle logic). Organize prompts with clear section boundaries using XML tags or Markdown headers.
Tool Definitions specify actions an agent can take. They live near the front of context and collectively steer behavior. Poor descriptions force agents to guess; optimized descriptions include usage context, examples, and defaults.
Message History is the conversation between user and agent. For long tasks, it can dominate context. It serves as scratchpad memory for tracking progress and maintaining state across turns.
Tool Outputs are results of agent actions (file contents, search results, command output). They can reach 80%+ of total context usage in typical agent sessions. This creates pressure for strategies like observation masking and compaction.
Models process tokens through attention mechanisms creating pairwise relationships between all tokens. As context grows, the model's ability to capture these relationships gets stretched thin. The result is an "attention budget" that depletes as context grows.
Models remain capable at longer contexts but show reduced precision for information retrieval and long-range reasoning compared to shorter contexts. This is why stuffing everything into a massive context window doesn't work.
At startup, agents should load only skill names and descriptions — enough to know when a skill is relevant. Full content loads only on activation. This applies at multiple levels:
Processing cost grows disproportionately with context length. Model performance degrades beyond certain thresholds even when the window supports more tokens. The guiding principle: include what matters for the decision at hand, exclude what doesn't, and design systems that can access additional information on demand.
Good: Progressive document loading
# Step 1: Load summary
docs/api_summary.md # Lightweight overview
# Step 2: Load specific section as needed
docs/api/endpoints.md # Only when API calls needed
docs/api/authentication.md # Only when auth context needed
Good: Organized system prompt
## Background
You are a TypeScript expert working on a data pipeline.
## Instructions
- Write clean, typed code with no `any`
- Include type hints for function signatures
- Follow project conventions in .ai/skills/
## Tool Guidance
Use grep for search, file reads for exploration.
context-optimization (techniques to extend capacity), context-compression (managing long sessions), filesystem-context (filesystem as context layer)Activate when an Engineering Manager needs to shape a rough initiative into a clear, scoped, outcome-oriented brief before execution.
Activate when reviewing branches, commits, or pull requests using the emoji-driven review protocol.
Activate when managing conversation history in long sessions, choosing compression strategies, or preserving critical information during context truncation.
Activate when hitting context limits, experiencing quality degradation in long sessions, or needing to extend effective context capacity.
Activate when generating in-code comments or system documentation using the Diátaxis framework.
Activate when testing agent systems, measuring output quality, or designing evaluation frameworks for AI-assisted workflows.