Context packer

From ferologics/pi-skills · View interactive version

Context packer is an AI agent skill from the GitHub repository ferologics/pi-skills. Build LLM-ready code dumps with optional docs, then count tokens with tokencount (o200k-base) against a context budget (for example 272k for GPT-5).

How to use this skill

Skill file

Context Packer

Use this skill when the user wants to:

What it does

prepare-context.sh:

  1. Selects relevant project files (tracked files by default)
  2. Excludes common junk (generated files, prior dumps, lockfiles/env/sensitive files unless requested)
  3. Builds a fenced text dump (`path + ` + contents`) for all selected files
  4. Writes dump to <project>/prompt/<output>.txt (or /tmp/context-packer/... with --tmp-output)
  5. Writes a manifest of included files next to the dump
  6. Counts tokens with tokencount --encoding o200k-base
  7. Reports whether it fits the provided budget

Command

$HOME/dev/pi-skills/context-packer/prepare-context.sh <project_dir> [options]

Common invocations

# Default budget (272000), code + docs + tests pack
$HOME/dev/pi-skills/context-packer/prepare-context.sh ~/dev/pui

# Code-focused pack (exclude docs and tests)
$HOME/dev/pi-skills/context-packer/prepare-context.sh ~/dev/pui --no-docs --no-tests

# Include env/sensitive files explicitly (off by default for safety)
$HOME/dev/pi-skills/context-packer/prepare-context.sh ~/dev/pui --include-env --include-secrets

# Custom budget and output name
$HOME/dev/pi-skills/context-packer/prepare-context.sh ~/dev/pui \
    --budget 272000 \
    --output pui-gpt5.txt

# Fail with exit code 2 if over budget
$HOME/dev/pi-skills/context-packer/prepare-context.sh ~/dev/pui --fail-over-budget

Options

Requirements

If no clipboard tool is available, the script still writes output files; it just skips clipboard copy.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.