context-compactor

context-compactor is a skill for Claude Code, Codex from aragaobruno/toolbelt. It costs 34 tokens per session (432 once invoked), scanned A, original, MIT.

A codebase scanner that creates a compact map of Python, JavaScript, and TypeScript files by listing their classes, functions, methods, and documentation comments.

In plain words
What is it for?
Use it to create an architectural overview of a code directory, with optional exclusions such as tests or dependency folders.
Why use it?
It helps an agent understand a large project's structure without loading every implementation detail into its working context.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to create an architectural overview of a code directory, with optional exclusions such as tests or dependency folders.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/aragaobruno/toolbelt/context-compactor
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.

Any agent
npx skills add aragaobruno/toolbelt --skill context-compactor
Clone the repo
git clone --depth 1 https://github.com/aragaobruno/toolbelt

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for context-compactor

README.md
[![agentmods](https://agentmods.dev/badge/skills/aragaobruno/toolbelt/context-compactor/github.svg)](https://agentmods.dev/skills/aragaobruno/toolbelt/context-compactor)
Your own site
<a href="https://agentmods.dev/skills/aragaobruno/toolbelt/context-compactor"><img src="https://agentmods.dev/badge/skills/aragaobruno/toolbelt/context-compactor/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for context-compactor

Your own site · 80×15
<a href="https://agentmods.dev/skills/aragaobruno/toolbelt/context-compactor"><img src="https://agentmods.dev/badge/skills/aragaobruno/toolbelt/context-compactor.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 34 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 432 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00034 $0.00432
Opus 5.5 $0.00014 $0.00173
Sonnet 5.5 $0.00007 $0.00086
Haiku 4.5 $0.00003 $0.00043

Measured 1mo ago against content hash 6df8a0c71e55, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

context-compactor 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 1mo ago.

The scan reads SKILL.md. This mod also ships 2 executable files (scripts/compactor.py, scripts/test_compactor.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

skills/context/context-compactor/SKILL.md · 49 lines

What it actually says

📦 context-compactor

Overview

Feeding raw source files into an LLM context window is expensive and introduces noise. The context-compactor recursively scans a codebase, parses files (supporting Python, JavaScript, and TypeScript), and extracts only the structural elements—classes, methods, function signatures, and docstrings—while omitting the actual body implementations.

This results in a lightweight, token-efficient structural map of your codebase that agents can use to understand the architecture without reading thousands of lines of code.

Quick Start

To scan the current directory and generate a codebase map:

uv run skills/context/context-compactor/scripts/compactor.py C:\Users\araga\.gemini\antigravity\scratch\toolbelt --output map.txt

Utility Scripts

compactor.py (CLI)

A Python utility that recursively processes directories and extracts structural code elements.

  • Arguments:
    • <directory_path> (Required)
    • --output (Required): The file path where the output will be saved.
    • --exclude (Optional): Glob patterns to exclude (e.g., *.test.js,node_modules).
  • Example:
    uv run compactor.py C:\Users\araga\.gemini\antigravity\scratch\toolbelt --output codebase_summary.txt --exclude "node_modules,*.spec.js"
    

Output Format Example

For a Python file, the compactor will extract:

File: auth.py
----------------------------------------
class Authenticator:
    """Manages user sessions and OAuth flows."""

    def __init__(self, client_id: str):
        ...

    def get_token(self, code: str) -> str:
        """Exchanges authorization code for an access token."""
        ...
Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 1mo ago First seen · 49 lines · 34 tokens per session scan A 6df8a0c71e55

Subscribe to this mod's changes

context-compactor is a skill published in the GitHub repository aragaobruno/toolbelt (2 stars, last pushed 3mo ago), licensed MIT. It adds 34 tokens to every session and 432 once invoked, about $0.0001 per session on Opus 5.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-31.

Related

Other skills, from other repositories

build-personal-brain

Create, resume, validate, connect, or maintain a private cross-project memory for AI assistants. Use when a person asks to build a personal memory from local work folders and past assistant conversations, continue an interrupted memory audit, connect an existing memory to another local assistant, verify that the…

mikeshu2001/personal-brain-builder · 81 tokens

why

Explain the provenance, authority, expiry, degradation state, and token accounting of CIGAR context already presented in this session.

hashgraph-online/hol-cigar · 27 tokens

checkpoint

Create an inspectable CIGAR checkpoint before compaction, interruption, or a meaningful task boundary.

hashgraph-online/hol-cigar · 22 tokens

agent-state-bar

A design guide for an agent status bar: a short, automatically updated summary of progress, remaining tasks, tool counts, errors, and system state placed near the latest model input.

bojieli/ai-agent-book · 105 tokens

knowledge-org

A guide to organising large bodies of knowledge so an AI system can navigate relationships, summaries, and layers instead of searching only flat text chunks. It covers tree indexes, knowledge graphs, file-like structures, incremental updates, and long-term memory layouts.

bojieli/ai-agent-book · 96 tokens

memory-system

A guide to giving an AI agent persistent, user-specific memory across conversations. It covers what to remember, how to store it, how to update or compress it, and when to use memory instead of a shared knowledge base.

bojieli/ai-agent-book · 95 tokens