Pr context packer

From ferologics/pi-skills · View interactive version

Pr context packer is an AI agent skill from the GitHub repository ferologics/pi-skills. Build PR-focused context packs (PR description + git diff + full changed files + related files via Scribe), then budget-fit and token-check with o200k-base.

How to use this skill

Skill file

PR Context Packer

Use this skill when the user wants high-signal PR context for an LLM:

What it does

prepare-pr-context.sh:

  1. Resolves PR base (--base or auto-detect)
  2. Pulls GitHub PR title/body by default (via gh, with graceful fallback)
  3. Captures changed files + full git diff (base...HEAD)
  4. Includes full current content of changed files (safe filters applied)
  5. Optionally expands related files using Scribe covering-set (dependents included by default)
  6. Ranks related candidates and greedily fits them into remaining token budget
  7. Writes a single final text file plus manifests (changed/related/omitted + related-omitted + selection + scribe-target audit)
  8. Counts tokens with tokencount --encoding o200k-base and trims low-priority related files if needed

Command

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

Common invocations

# Typical PR pack (tmp output by default)
$HOME/dev/pi-skills/pr-context-packer/prepare-pr-context.sh ~/dev/mobile-1 --base origin/main

# Disable Scribe expansion (diff + changed files only)
$HOME/dev/pi-skills/pr-context-packer/prepare-pr-context.sh ~/dev/mobile-1 --base origin/main --no-scribe

# Keep output in repo prompt/ instead of /tmp
$HOME/dev/pi-skills/pr-context-packer/prepare-pr-context.sh ~/dev/mobile-1 --base origin/main --in-project-output

# Tight budget + fail if over
$HOME/dev/pi-skills/pr-context-packer/prepare-pr-context.sh ~/dev/mobile-1 --base origin/main --budget 180000 --fail-over-budget

Key options

Output manifests

For <output>.txt, the script writes:

Requirements

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.