apex-accelerator context-optimization.instructions.md

Rules for keeping GitHub Copilot agent definitions, skills, and instruction files within practical context limits. The context window is the amount of project information an AI agent can use at once.

In plain words
What is it for?
Use them when writing or reviewing agent bodies, descriptions, tool lists, and context-related sections so the files remain valid and efficient.
Why use it?
They help agents receive relevant instructions without unnecessary text and identify limits that repository validation enforces.

Instructions file for GitHub Copilot

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/jonathan-vella/apex-accelerator/context-optimization
Clone the repo
git clone --depth 1 https://github.com/jonathan-vella/apex-accelerator

Made for: GitHub Copilot.

Per session 1,957 This file is loaded in full into every session.
When invoked 1,957 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.01957 $0.01957
Opus 5 $0.00979 $0.00979
Sonnet 5 $0.00391 $0.00391
Haiku 4.5 $0.00196 $0.00196

Measured 2d ago against content hash a4bc0e52f0e4, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

apex-accelerator context-optimization.instructions.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.github/instructions/context-optimization.instructions.md · 170 lines

How it starts

The opening of the file, as written. The whole thing — 170 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Context Window Optimization Rules

Rules for keeping agent context windows efficient. These apply when creating or modifying agent definitions, skills, and instruction files.

Agent Definition Rules

Two tiers govern agent definitions: hard limits (CI-enforced — a breach fails npm run validate:agents) and soft guidelines (advisory — keep lean, but no validator blocks them). Earlier revisions listed the soft targets as hard caps; the tables below now match what the validators in tools/scripts/ actually enforce.

Hard limits (CI-enforced)

Rule Limit Enforced by
Agent body length ≤ 600 lines tools/scripts/_lib/paths.mjs (MAX_BODY_LINES)
description length ≤ 350 chars (warn ≥ 300) validate-agents.mjs frontmatter check
Claude body > 350 lines requires <context_awareness> validate-agents.mjs Check 3 (legacy-003)
Claude research agent requires <investigate_before_answering> validate-agents.mjs Check 4 (legacy-004)

Soft guidelines (advisory — not CI-enforced)

Rule Target Rationale
Tool list size ≤ 30 tools Each tool adds ~75 tokens to prompt
Agent body length ≤ 350 lines Soft target; past it add <context_awareness> (hard cap is 600)
Inline template size ≤ 50 lines Move larger templates to skills
Handoff count ≤ 8 handoffs Each adds ~40 tokens; orchestrators are exempt (they route every step)
Skill references in body ≤ 5 "Read" lines Progressive load, not bulk load

Read the full file on GitHub · 170 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 170 lines · 1,957 tokens per session scan A a4bc0e52f0e4

Subscribe to this mod's changes

apex-accelerator context-optimization.instructions.md is an instructions file published in the GitHub repository jonathan-vella/apex-accelerator (50 stars, last pushed 6d ago), licensed MIT. It adds 1,957 tokens to every session, about $0.0098 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.