Skip to content
Skill

Principle guard the context window

Keeps an agent's context window from overflowing during large or long-running tasks

Principle guard the context window is an open-source agent skill for developer tools. It is available on Claude Code.

Scripts
None
Platforms
Claude Code
GitHub stars
5.1K
Last commit
License
MIT
Listing updated

Similar skills

About Principle guard the context window

This skill is a guiding principle for managing context budget. It tells the agent to notice when its working context is filling up, such as after large command outputs, long files, repeated reads, or when planning work that fans out across many steps. The core guidance is to route bulk work to subagents and keep only condensed summaries in the main conversation rather than raw payloads.

The workflow it sets out is to size phases of work in advance and cap their scope, for example by limiting how many files a phase touches, setting turn budgets, and accounting for the cost of each mechanism used. The rationale given is that a crowded context degrades reasoning quality, introduces compression artifacts, and can stall progress.

The skill is a short markdown instruction file with no scripts or bundled reference files. It is written for Claude Code and is packaged as part of a Claude Code plugin in the pstack-claude marketplace. It is not meant to be invoked directly by users.

When your agent uses it

Apply when context is filling up: large outputs, long files, repeated reads, fan-out planning. Route bulk to subagents; keep summaries in the main thread, not raw payloads.

From the skill's SKILL.md. Your agent reads this description to decide when to load the skill.

What it can access

From a static check of its 2 files (553 bytes) on GitHub on 1 December 2026. Nothing was run. Read the files before you install a skill: it can tell your agent to run anything its tools allow.

Check another skill before you install it.

Install

This skill ships in the pstack plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

/plugin marketplace add michael-denyer/pstack-claude
/plugin install pstack@pstack-claude

Or copy only this skill to ~/.claude/skills/principle-guard-the-context-window:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michael-denyer/pstack-claude.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/principle-guard-the-context-window &&
cp -R "$tmp/plugins/pstack/skills/principle-guard-the-context-window" ~/.claude/skills/principle-guard-the-context-window &&
rm -rf "$tmp"

For one project only, put the folder in .claude/skills/principle-guard-the-context-window inside it instead.

Claude Code docs on skills

Copy the skill folder to ~/.agents/skills/principle-guard-the-context-window to use it in every repository:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michael-denyer/pstack-claude.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/principle-guard-the-context-window &&
cp -R "$tmp/plugins/pstack/skills/principle-guard-the-context-window" ~/.agents/skills/principle-guard-the-context-window &&
rm -rf "$tmp"

For one repository only, put the folder in .agents/skills/principle-guard-the-context-window inside it instead.

Codex docs on skills

Copy the skill folder to ~/.cursor/skills/principle-guard-the-context-window to use it in every project:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michael-denyer/pstack-claude.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/principle-guard-the-context-window &&
cp -R "$tmp/plugins/pstack/skills/principle-guard-the-context-window" ~/.cursor/skills/principle-guard-the-context-window &&
rm -rf "$tmp"

For one project only, put the folder in .cursor/skills/principle-guard-the-context-window inside it instead.

Cursor docs on skills

Run in a terminal (add --scope workspace to install it for the current workspace only):

gemini skills install https://github.com/michael-denyer/pstack-claude.git --path plugins/pstack/skills/principle-guard-the-context-window

Or copy the folder to ~/.gemini/skills/principle-guard-the-context-window yourself.

Gemini CLI docs on skills

For GitHub Copilot in VS Code, copy the skill folder to ~/.copilot/skills/principle-guard-the-context-window:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michael-denyer/pstack-claude.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/principle-guard-the-context-window &&
cp -R "$tmp/plugins/pstack/skills/principle-guard-the-context-window" ~/.copilot/skills/principle-guard-the-context-window &&
rm -rf "$tmp"

For one project only, put the folder in .github/skills/principle-guard-the-context-window inside it instead.

VS Code docs on skills

Get the folder:

git clone --depth 1 https://github.com/michael-denyer/pstack-claude.git

Then copy pstack-claude/plugins/pstack/skills/principle-guard-the-context-window into your agent's skills folder as principle-guard-the-context-window. Agents that support SKILL.md read one folder per skill.

The SKILL.md format

What it does

Context overflow detection
Prompts the agent to recognise when its working context is filling up during a task.
Subagent delegation
Recommends routing bulk reading and large outputs to subagents so the main thread stays lean.
Summary-first results
Keeps condensed findings in the main conversation instead of raw payloads.
Phase sizing and scope caps
Guides limiting files per phase and setting turn budgets before starting work.
Fan-out planning
Covers accounting for the cost of each mechanism when planning parallel work.

Good for

  • Break up a large codebase audit so results come back as summaries
  • Plan a multi-file refactor in phases with limited files per step
  • Process long log output without pasting the full payload into the conversation
  • Coordinate several parallel research tasks and collect only their conclusions

Principle guard the context window FAQ

When does Principle guard the context window apply?

It is meant to apply when context is filling up, such as with large outputs, long files, repeated reads, or fan-out planning.

Does Principle guard the context window need any scripts or extra tools?

No. It has no scripts, and its frontmatter does not restrict allowed tools. It consists of a SKILL.md instruction file and one other file.

Can users invoke Principle guard the context window directly?

No. The skill is marked as not user-invocable, so it is loaded by the agent when the task matches.

How do I install Principle guard the context window in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/principle-guard-the-context-window to use it in all your projects, or to .claude/skills/principle-guard-the-context-window in one project. Or install the pstack plugin, which includes it: /plugin marketplace add michael-denyer/pstack-claude, then /plugin install pstack@pstack-claude.

Does Principle guard the context window run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

Which AI agents can use Principle guard the context window?

Claude Code. It reads skills in the SKILL.md format; the install steps on this page show where to put the folder.

What are the best alternatives to Principle guard the context window?

The closest alternatives to Principle guard the context window are Principle never block on the human, Context strategy, Context budget, Principle foundational thinking and Principle laziness protocol.

Where this comes from

  • Description: from the skill's own SKILL.md.

More from michael-denyer/pstack-claude

  1. Makes the agent read pstack's poteto-mode skill first and follow its routing

    • Open source
    • 5.1K GitHub stars
    • Developer tools
  2. Has the agent restate your goals and the problem you're solving in its own words

    • Open source
    • 5.1K GitHub stars
    • Productivity
  3. Sketches types, signatures and module layout before the agent writes code

    • Open source
    • 5.1K GitHub stars
    • Developer tools
  4. Runs parallel candidate attempts at a task, then merges the best parts into one artifact

    • Open source
    • 5.1K GitHub stars
    • Developer tools
  5. Drafts a personal working-style skill from your past agent conversations

    • Open source
    • 5.1K GitHub stars
    • Developer tools