context-packing

context-packing is a skill for Claude Code from coltonbearden/carrel. It costs 78 tokens per session (1,247 once invoked), scanned A, original, MIT.

Guidance for bundling folders or groups of files into one document that an AI model can read. It explains how to estimate size, choose Markdown, XML, or JSON, and trim or split content to fit the model's context limit.

In plain words
What is it for?
Preparing a codebase or document folder as reusable AI context, selecting files with include or exclude patterns, and dividing oversized bundles into chunks.
Why use it?
It prevents sending too much irrelevant material or exceeding the amount of text an AI model can handle at once.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the carrel-inspect plugin — 1 skill, 4 commands shipped together

Good fit Preparing a codebase or document folder as reusable AI context, selecting files…

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/coltonbearden/carrel/context-packing
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 coltonbearden/carrel --skill context-packing
Clone the repo
git clone --depth 1 https://github.com/coltonbearden/carrel

Made for: Claude Code.

Or install carrel-inspect, the plugin that ships this one along with the rest of its 1 skill, 4 commands.

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-packing

README.md
[![agentmods](https://agentmods.dev/badge/skills/coltonbearden/carrel/context-packing.svg)](https://agentmods.dev/skills/coltonbearden/carrel/context-packing)
Your own site
<a href="https://agentmods.dev/skills/coltonbearden/carrel/context-packing"><img src="https://agentmods.dev/badge/skills/coltonbearden/carrel/context-packing.svg" alt="Measured on agentmods" height="20"></a>
Per session 78 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,247 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.00078 $0.01247
Opus 5 $0.00039 $0.00624
Sonnet 5 $0.00016 $0.00249
Haiku 4.5 $0.00008 $0.00125

Measured yesterday against content hash dea5d3fc2ae9, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

context-packing 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 yesterday.

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.

plugins/carrel-inspect/skills/context-packing/SKILL.md · 55 lines

How it starts

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

Context packing with carrel pack

carrel pack PATHS... turns files and folders into a single LLM-ready document. The skill is choosing which files and how much of them — in that order. Run carrel pack --help before composing flags; the slash command /carrel-inspect:pack carries the current help.

When to pack

  • The user wants an LLM (this session or another) to "read" a folder of documents.
  • You need repeatable, shareable context (a file you can re-attach) rather than ad-hoc Reads.
  • Many small files are involved — one pack beats dozens of Read calls.

Don't pack when the user needs 1–2 specific files — just read those.

Decision procedure

  1. Ask the index first: --query. For "what does this folder say about X", don't pack the folder — pack the hits: carrel --root DIR pack DIR --query 'X OR "x phrase"' --top 12 -o ctx.md. Files come out in relevance order (FTS5 syntax: phrases in quotes, AND/OR/NOT, term*). This needs a desk index — run carrel --root DIR index once (incremental, cheap to repeat). --fail-empty turns "no hits" into exit 5 so you notice.
  2. Scope by git for reviews: --since. For a PR or branch, carrel pack . --since main -o pr.md packs only what changed since the ref (deleted files are listed in the header as removed, not packed); --changed does the same for uncommitted work. Combine with --query or globs — filters intersect.
  3. Orient before you commit: --tree-only / --outline. On an unknown folder, carrel pack DIR --outline costs the same as a tree but shows .py def/class names with line numbers and .md headings — usually enough to pick --include globs. --tree-only is the bare structure. --stats prints a per-file token table (the pack is still written when -o is given).
  4. Choose a format.
    • --format xml for Claude — CDATA-wrapped <file> sections parse robustly.
    • --format md (default) for humans and most models — fenced sections, fences auto-lengthen on collision.
    • --format json when a program will consume the pack.
  5. Trim before you chunk. Prefer --exclude/--include globs (repeatable) over huge chunk counts: exclude build output, archives, fixtures. .gitignore is honored, including !pattern re-includes with git's last-match-wins rule (--no-gitignore disables); .git/.carrel are always skipped. Binaries outside the supported types are tree-listed, never inlined. --dedupe-content inlines identical files once.
  6. Count precisely when it matters: --tokenizer exact. The default estimate is ceil(chars/3.6) labeled tokens_est — fine for sizing. When the pack must fit a hard budget (chunks near the window, billing), add --tokenizer exact (tiktoken o200k_base, field tokens; needs the carrel[tokens] extra — exit 3 tells you).
  7. Set budgets.
    • Fits comfortably (rule of thumb: ≤ half the model's window, e.g. ≲80k tokens for a 200k window): single pack, -o context.md.
    • Too big: --chunk TOKENS -o out.mdout.part1..N, each ≤ TOKENS under the active tokenizer. Files are never split mid-file unless one alone exceeds the budget (then split on line boundaries with "(continued)" markers). Pick TOKENS ≈ what one turn can afford, e.g. 30000–60000. Not with --outline.
    • Hard caps: --max-bytes N (total) and --max-file-bytes N (skip single huge files); omissions are noted in the pack header — mention them to the user.
  8. Images/scans: only read with --ocr (needs tesseract/ocrmypdf); otherwise they're listed but contribute no text.

Read the full file on GitHub · 55 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. yesterday Changed · +4 lines · +14 tokens per session dea5d3fc2ae9
  2. 6d ago First seen · 51 lines · 64 tokens per session scan A 29c8d92adafd

Subscribe to this mod's changes

context-packing is a skill published in the GitHub repository coltonbearden/carrel (1 stars, last pushed 2d ago), licensed MIT. It adds 78 tokens to every session and 1,247 once invoked, about $0.0004 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-31.

Related

Other skills, from other repositories

mnemon

Persistent memory CLI for LLM agents. Store facts, recall past knowledge, link related memories, manage lifecycle.

mnemon-dev/mnemon · 25 tokens

durable-session-state

Persist plans, scope decisions, evidence, and reviewer/critic verdicts to durable files during long or multi-phase tasks so work survives context compaction, session resumes, and handoffs. Use for swarm-mode tasks, before context grows large, when recording approval gates, and when resuming after compaction or a…

ZaxbyHub/opencode-swarm · 70 tokens

memory

Persistent, token-efficient project memory. When ON, maintains a .shob/memory/ folder of structured .md files so the full context of the project is NEVER lost across responses, sessions, or context compaction. Uses progressive disclosure — routes through a lightweight INDEX and loads only the files a task needs…

shobcoder/shob · 146 tokens

sivtr-memory

Retrieve shared local work memory: terminal activity, AI conversation history, prior decisions, validation evidence, debugging trails, recaps, and handoff context. Use before asking the user to repeat local work context.

Ariestar/sivtr · 46 tokens

brain-ingest

The process for digesting a conversation, document, or research result, classifying it, and writing it down as brain content (a root-page update or a new/updated page) through the brain CLI.

mindmuxai/brain.md · 48 tokens

kn-init

Use at the start of a new session to read project docs, understand context, and see current state.

knowns-dev/knowns · 23 tokens