context-optimizer
Skill3 starsChanged 8 months agoMITArchived repositoryView on GitHub
Audits agent context window usage via debug logs, token profiling, and redundancy detection. USE FOR: context optimization, token waste analysis, debug log parsing, hand-off gap analysis. DO NOT USE FOR: Azure infrastructure, Bicep/Terraform code, architecture design, deployments.
4 other projects use a version of this.
Adopted by
Most recently taken up by
- delorenj/skillstheir own version, first seen Oct 2, 2026
- rohitg00/pro-workflowtheir own version, first seen Sep 29, 2026
- NISTALTALSON/Ghosttheir own version, first seen Apr 5, 2026
- webbertakken/agent-skillstheir own version, first seen Feb 20, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- rohitg00/pro-workflow★ 2.9ksame name
- delorenj/skills★ 15same name
- NISTALTALSON/Ghost★ 3same name
- webbertakken/agent-skills★ 3same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository48 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- appinsights-instrumentationSkill
- azure-adrSkill
- azure-aigatewaySkill
- azure-aiSkill
- azure-artifactsSkill
- azure-bicep-patternsSkill
- azure-cloud-migrateSkill
- azure-complianceSkill
- azure-computeSkill
- azure-cost-optimizationSkill
- azure-defaultsSkill
- azure-deploySkill
- azure-diagnosticsSkill
- azure-diagramsSkill
- azure-hosted-copilot-sdkSkill
- azure-kustoSkill
- azure-messagingSkill
- azure-prepareSkill
- azure-quotasSkill
- azure-rbacSkill
- azure-resource-lookupSkill
- azure-resource-visualizerSkill
- azure-storageSkill
- azure-validateSkill
- context-shreddingSkill
- copilot-customizationSkill
- count-registrySkill
- docs-writerSkill
- drawioSkill
- entra-app-registrationSkill
- excalidrawSkill
- github-operationsSkill
- golden-principlesSkill
- iac-commonSkill
- make-skill-templateSkill
- mermaidSkill
- microsoft-code-referenceSkill
- microsoft-docsSkill
- microsoft-foundrySkill
- microsoft-skill-creatorSkill
- python-diagramsSkill
- session-resumeSkill
- terraform-patternsSkill
- terraform-search-importSkill
- terraform-testSkill
- workflow-engineSkill
The file
Files
Context Window Optimization Skill
Structured methodology for auditing how GitHub Copilot agents consume their context window. Identifies waste, recommends hand-off points, and produces prioritized optimization reports.
When to Use This Skill
- Auditing context window efficiency across a multi-agent system
- Identifying where to introduce subagent hand-offs
- Reducing redundant file reads and skill loads
- Optimizing instruction file
applyToglob patterns - Profiling per-turn token cost from debug logs
- Porting agent optimizations to a new project
Quick Reference
| Capability | Description |
| Log Parsing | Extract structured data from Copilot Chat debug logs |
| Turn-Cost Profiling | Estimate token spend per turn from timing and model metadata |
| Redundancy Detection | Find duplicate file reads, overlapping instructions |
| Hand-Off Gap Analysis | Identify agents that should delegate to subagents |
| Instruction Audit | Flag overly broad globs and oversized instruction files |
| Report Generation | Structured markdown report with prioritized recommendations |
Prerequisites
- Python 3.10+ (for log parser script)
- Access to VS Code Copilot Chat debug logs
- Agent definitions in
.github/agents/*.agent.md(or equivalent)
Enabling Debug Logs
Copilot Chat writes debug logs automatically to the VS Code log directory. To find the latest logs:
find ~/.vscode-server/data/logs/ -name "GitHub Copilot Chat.log" -newer /tmp/marker 2>/dev/null \
| sort | tail -5For richer output, set github.copilot.advanced.debug.overrideLogLevels
in VS Code settings to capture verbose tool-call data.
Analysis Methodology
📋 Reference: Read references/analysis-methodology.md for the complete methodology including:
- Log Format Reference —
ccreqline parsing, request types, latency heuristics - Steps 1-5 — Log parsing, turn-cost profiling, agent definition audit, context growth mapping, optimization recommendations
- Common Optimization Patterns — Subagent extraction, instruction narrowing, progressive skill loading, prompt deduplication, context summarization
- Baseline Comparison — Automated snapshot/diff workflow (Phase 0 and Phase 6)
Report Template
See templates/optimization-report.md for the full output template.
Portability
This skill contains no project-specific logic. To use in another project:
- Copy
.github/skills/context-optimizer/to the target repo - Copy
.github/agents/11-context-optimizer.agent.md - Copy
.github/instructions/context-optimization.instructions.md - Copy
scripts/snapshot-agent-context.shandscripts/diff-context-baseline.sh - Adjust agent numbering if needed (11 is the slot used in this repo)
- The log parser auto-discovers VS Code log directories
References
scripts/parse-chat-logs.py— Log parser producing structured JSONtemplates/optimization-report.md— Report output templatereferences/token-estimation.md— Detailed token cost heuristics
Reference Index
| Reference | When to Load |
references/token-estimation.md | When estimating token counts for context optimization |
references/analysis-methodology.md | Log format, 5-step methodology, optimization patterns, baseline comparison |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

