context-fundamentals

Teaches context engineering principles for designing and debugging LLM agent systems.

Updated Apr 7, 2026
One-click install
npx skills add https://github.com/NT-boop-star/BRMV-tract --skill context-fundamentals-nt-boop-star
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: context-fundamentals
Source: https://github.com/NT-boop-star/BRMV-tract/tree/main/antigravity/skills/context-fundamentals
Command: npx skills add https://github.com/NT-boop-star/BRMV-tract --skill context-fundamentals-nt-boop-star

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? LLM agents degrade unpredictably as context grows: instructions get lost in the middle of long prompts, tool outputs silently consume most of the window, and nominal token limits mislead capacity planning. This Skill provides the foundational mental models and concrete thresholds needed to design, debug, and optimize agent context. ## Core Features & Use Cases - Context anatomy guidance: Covers system prompts, tool definitions, retrieved documents, message history, and tool outputs with actionable placement and sizing rules. - Attention and budgeting mechanics: Explains the U-shaped attention curve, the 60-70% effective-capacity rule, and compaction triggers at 70-80% utilization. - Progressive disclosure patterns: Three-level loading strategy (skill selection, document loading, tool result retention) with a Python context_manager.py utility for token estimation, truncation, validation, and lazy file loading. - Use Case: When an agent's reasoning quality collapses after 20-30 tool calls, use this Skill to diagnose message-history bloat and implement observation masking plus compaction triggers. ## Quick Start Ask the agent to explain why my agent loses track of instructions in long conversations and how to fix its context budget.

Frequently Asked Questions about context-fundamentals

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

FAQPage Schema
How do I prevent my LLM agent from losing instructions in long contexts?

Place critical constraints at the beginning and end of the context, where recall accuracy runs 85-95%. The middle of context suffers the lost-in-the-middle effect with 10-40% lower recall, so never put safety constraints or output format rules there.

What is progressive disclosure in agent context management?

Progressive disclosure loads only skill names and summaries at startup, fetching full content only when a task explicitly matches activation conditions. It applies at three levels: skill selection, document loading, and tool result retention.

How much of a 200K token context window is actually usable?

Effective capacity is typically 60-70% of the advertised window, so a 200K-token model starts degrading around 120-140K tokens. Complex retrieval accuracy can drop to as low as 15% at extreme lengths, so budget accordingly.

Why does my agent's reasoning degrade after many tool calls?

Each tool call adds both request and full response to message history, which can consume 70-80% of the window after 20-30 iterations. Apply observation masking to replace verbose outputs with compact references and trigger compaction at 70-80% utilization.

Can I rely on the 4 characters per token estimate for budgeting?

The 4-characters-per-token heuristic works only for rough English prose estimates. Code tokenizes at 2-3 characters per token and URLs even denser, so use a real tokenizer like tiktoken or the provider's token-counting API for budget-critical calculations.