home / skills / sounder25 / google-antigravity-skills-library / 08_context_pruner
This skill prunes repository context to relevant files based on focus topics, reducing noise and preserving essential code.
npx playbooks add skill sounder25/google-antigravity-skills-library --skill 08_context_prunerReview the files below or copy the command above to add this skill to your agents.
---
name: Context Window Pruner
description: Optimize information density by filtering workspace files based on relevance to the current task. Excludes high-noise files (lockfiles, assets) and prioritizes source code matching semantic queries.
version: 1.0.0
author: Antigravity Skills Library
created: 2026-01-16
leverage_score: 5/5
---
# SKILL-008: Context Window Pruner
## Overview
Large repos flood the agent's context window with noise. This skill generates a `RELEVANT_FILES.txt` list by aggressively pruning irrelevant directories and searching for files related to a specific "Focus".
## Trigger Phrases
- `focus on <topic>`
- `find relevant files for <task>`
- `prune context`
## Inputs
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `--focus` | string | Yes | - | Keywords to filter file names/content (e.g. "gas", "auth") |
| `--max-files` | int | No | 50 | Limit output size |
## Outputs
1. `RELEVANT_FILES.txt`: List of absolute paths to read.
2. Console output summarizing token savings (estimated).
## Safety Checks
- Always respects `.gitignore`.
- Never includes binary files.
- Caps output to avoid context overflow.
## Implementation
See `prune_context.ps1`.
## Integration
```powershell
$files = .\skills\08_context_pruner\prune_context.ps1 -Focus "EVM opcode"
# Agent works only with $files
```
This skill optimizes an agent's working set by filtering workspace files to a concise, relevance-ranked list. It excludes high-noise files and directories, respects .gitignore, and produces a deterministic RELEVANT_FILES.txt for downstream reading. The result reduces token waste and focuses the agent on source files most likely to help the current task.
The pruner scans the repository tree while honoring .gitignore and skipping binaries, lockfiles, large assets, and other high-noise paths. It scores files by filename and content against the provided focus keywords, applies caps and safety gates, and emits a limited, ordered list of absolute file paths plus a token-savings summary. Execution is implemented as a PowerShell script for deterministic, testable behavior.
How does the pruner avoid binary or large files?
It checks file types and sizes and explicitly skips binaries and large assets; it also respects .gitignore to avoid irrelevant content.
Can I rely on the ordering of RELEVANT_FILES.txt?
Yes. Files are ranked by relevance to the focus query so the top entries are highest priority for the agent.