context-density-optimizer is an AgentSkill for pruning bloated working context before implementation, review, debugging, or planning work. It helps an agent decide which files, notes, logs, summaries, and references should stay active, which should be condensed, and which should be deferred or dropped for the current task horizon.
The skill is intentionally narrow: it does not replace codebase understanding, planning, review, or shared-memory infrastructure. It improves those workflows by keeping the active context set small, relevant, and auditable.
- Auditing the current working context for relevance and redundancy
- Recommending
KEEP,CONDENSE,DEFER, andDROPactions - Protecting task-critical requirements, constraints, and active work artifacts
- Producing a concise audit that explains why pruning is safe
- Building or storing cross-agent shared memory
- Replacing authoritative architecture or product documentation
- Automatically deleting files or mutating the repository
- Acting as a general summarizer for arbitrary long-form content
context-density-optimizer/
|-- SKILL.md
|-- README.md
|-- CHANGELOG.md
|-- LICENSE
|-- agents/
| `-- openai.yaml
|-- evals/
| |-- README.md
| |-- trigger-evals.json
| `-- results/
|-- examples/
| `-- sample-audit.md
|-- references/
| |-- evaluation.md
| |-- operating-model.md
| `-- response-contract.md
|-- scripts/
| `-- run-trigger-evals.ps1
`-- schemas/
`-- context-density-audit.schema.json
Use this skill when:
- a codebase sweep pulled in too many files and the next step is unclear
- logs, traces, or generated artifacts are crowding out the real signal
- multiple summaries, handoffs, or reference bundles overlap
- a task changed scope and the active context no longer matches the next action
- you need an explicit rationale for what stays in context versus what can be deferred
Do not use it when:
- the real problem is missing context rather than excessive context
- you need a domain-specific analysis skill instead of context triage
- the next task depends on exhaustive line-by-line forensic review of all artifacts
The skill optimizes for the immediate task horizon rather than a hypothetical future. It treats context as a working set that should remain:
- relevant to the next concrete step
- minimally redundant
- explicit about risks introduced by pruning
- scoped correctly across runtime memory, project-local memory, and shared memory
See references/operating-model.md for the full filtering model.
The default output is a concise audit with:
- task horizon
- overall assessment
- keep / condense / defer / drop recommendations
- pruning risks
- next working set
When a machine-readable result is needed, use the schema in schemas/context-density-audit.schema.json and the guidance in references/response-contract.md.
See examples/sample-audit.md for a representative audit.
This repository includes a lightweight evaluation guide in references/evaluation.md. It is designed for regression-style human or agent review rather than heavyweight test infrastructure.
Suggested evaluation questions:
- Did the audit preserve everything needed for the next step?
- Did it cut obvious redundancy and low-signal material?
- Did it avoid treating deletion and deferral as the same thing?
- Did it explain risk when pruning was uncertain?
For trigger-behavior checks, see evals/README.md and run scripts/run-trigger-evals.ps1.
Place this folder in your AgentSkills directory so the host can discover SKILL.md.
If your environment supports skill metadata for UI presentation, keep agents/openai.yaml alongside the skill.
- Pair with a codebase-context skill before broad implementation work.
- Pair with a shared-memory skill only when stable information truly needs promotion beyond the current task or project.
- Pair with review or planning skills after the context working set has been trimmed.
These integrations are optional and out of scope for the skill implementation itself.
Keep the runtime skill lean. Add detail to references/ only when it improves repeatability or evaluation quality. Prefer changes that sharpen decision quality, reduce ambiguity, or improve audit consistency over changes that add breadth without operational value.
This repository currently ships v2.0.0.
1.xrepresents the original prototype-era prompt implementation.2.xrepresents the structured, GitHub-ready, dispatcher-aware skill package.
Track notable changes in CHANGELOG.md.