context-fundamentals

Explain how context components affect agent behavior and architecture design.

4|Updated Dec 23, 2025
One-click install
npx skills add https://github.com/ken-cavanagh-glean/fieldkit --skill context-fundamentals-ken-cavanagh-glean
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: context-fundamentals
Source: https://github.com/ken-cavanagh-glean/fieldkit/tree/main/plugins/context-engineering/skills/context-engineering/context-fundamentals
Command: npx skills add https://github.com/ken-cavanagh-glean/fieldkit --skill context-fundamentals-ken-cavanagh-glean

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Context is the complete state available to a language model at inference time. This skill helps teams understand and optimize how those components influence agent behavior. By clarifying how system prompts, tool definitions, retrieved documents, message history, and tool outputs interact, it enables reliable design and debugging of agent architectures.

Core Features & Use Cases

  • Clear definitions of the context components and their constraints.
  • Guidance for designing agent architectures, debugging context-related failures, and reducing token costs.
  • Practical recommendations on progressive disclosure and context budgeting to maintain performance under token limits.
  • Onboarding resource for new engineers and data scientists working on context engineering.

Quick Start

Start by mapping out the five context components on your current project. Then, for a representative task, populate each component and observe how changes affect context usage. Experiment with a minimal example to see how the agent's behavior shifts as you adjust context budgets.

Frequently Asked Questions about context-fundamentals

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I organize system prompts and tool definitions to improve agent reliability?

Organize context components—system prompts, tool definitions, retrieved documents, message history, and tool outputs—into a structured hierarchy. Clear separation and logical ordering help agents interpret instructions consistently and reduces behavioral drift caused by context conflicts or ambiguity.

What's the best way to manage token budget constraints when designing agents?

Token budgeting allocates fixed space across context components using progressive disclosure: prioritize high-value system prompts and tool definitions, compress message history, and defer non-critical documents. This maintains agent performance under token limits while preserving decision quality.

Why does my agent behave inconsistently when I change the context?

Agent behavior shifts when context components—especially system prompts, tool outputs, and message history—interact unexpectedly or compete for attention. Debugging requires mapping all five context components, observing their relative size and order, then adjusting each to isolate the root cause.

How do I reduce token costs without degrading agent performance?

Optimize token efficiency by right-sizing each context component: compress verbose tool definitions, trim message history to recent turns, summarize retrieved documents, and prune redundant system instructions. Progressive disclosure ensures the agent receives only necessary context per task.

What's the difference between system prompts and tool definitions in context?

System prompts guide overall agent reasoning and constraints; tool definitions specify available actions and their parameters. Both occupy token budget but serve distinct roles—system prompts shape strategy, while tool definitions enable execution. Balancing their size and clarity prevents conflicts.

Can I use context budgeting for debugging agent failures?

Yes. Systematically isolate failure causes by mapping context components, then incrementally adjust each—removing tool outputs, shortening history, simplifying prompts—and observe behavior changes. This reveals whether failures stem from prompt ambiguity, tool confusion, or context overload.