← Catalog

pi-git-delegate

Pi extension: delegate git operations (diff/log/blame) to cheaper models via subagents, saving costs and keeping parent context clean.

Package

Install

Install with PiG

pig install npm:pi-git-delegate

Install with Pi

pi install npm:pi-git-delegate
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "extensions": [
    "./extensions"
  ]
}

README

Written by the package's publisher, shown as published in version 0.2.17 (README.md). PiG does not review it.

Pi Git Delegate

Join dotfield.xyz on Discord

CI Publish npm version npm downloads License: MIT Pi package Trusted Publishing Buy Me A Coffee

Delegate git operations (diff/log/blame) to cheaper models via subagents — keeping parent context clean and cutting costs.

What this is

Pi Git Delegate provides typed tools that internally delegate heavy git read operations (diff, log, blame) to subagents. The subagent processes the raw git output and returns only a concise summary to the parent session. This prevents large diffs from polluting the parent's context window and lets you route expensive operations to cheaper models.

When to delegate

The cost leverage principle: delegate only when input is large and output is small.

OperationDelegationWhy
git diff (→ summary)✅ DelegateDiff is large (1000+ tokens), summary is tiny
git log (→ changelog)✅ DelegateMany commits → compact digest
git blame (→ context)✅ DelegateFull blame is verbose; what matters is who/when/why
git status❌ DirectOutput is tiny; subagent overhead not worth it
git push / git commit❌ DirectWrite operations stay in parent for safety

Features

  • git_diff_summary — delegate git diff to a subagent, return a 1-3 sentence summary
  • git_log_summary — delegate git log range, return a structured digest
  • git_blame_summary — delegate git blame, return who changed what and why
  • Per-tool model routing — set provider and model per tool in .pi/settings.json (null uses the session defaults)
  • /git-delegate:configure — interactive help for writing the settings block
  • /git-delegate:status — show current model routing and example JSON
  • Model override parameter — override model per-call via tool parameter
  • Failure recovery — read retry boundaries and failure behavior
  • Fallback to current model — no config needed; uses the parent session model
  • Write guard — no write operations exposed as tools

Install

pi install npm:pi-git-delegate

Install locally (project-scoped):

pi install npm:pi-git-delegate -l

Try without installing:

pi -e .

Quick start

After installing (see above) or running pi -e . from this repo, start Pi from the Git repository you want to inspect. Follow Tool examples to ask Pi to use the tools.

The tools are registered automatically — no extra setup required.

Configuration

Model routing is optional. Run in Pi:

/git-delegate:configure

This shows what each key does, prints a starter JSON block, and can save it to .pi/settings.json interactively.

Check the current routing anytime with:

/git-delegate:status

Manual example for .pi/settings.json:

{
  "pi-git-delegate": {
    "diff": { "provider": "anthropic", "model": "claude-haiku-4-5" },
    "log": { "provider": null, "model": null },
    "blame": { "provider": null, "model": null }
  }
}

null means "use the current session provider/model".

Use a model id that exists in your Pi catalog. pi --list-models <pattern> prints the ids and the provider that owns them; the same pattern works for the diffModel / logModel / blameModel shorthand. A wrong id is not rejected when the settings load — Pi only warns and treats it as a custom model id when the subagent runs.

Tool examples

Install the package with pi install npm:pi-git-delegate, then start Pi from the Git repository you want to inspect. In Pi chat, ask:

Summarize my current working-tree changes using git_diff_summary with ref set to HEAD.

git_diff_summary uses HEAD by default and summarizes git diff HEAD. If there are no tracked changes, it returns No changes found. without starting a subagent; edit a tracked file first to see a summary. The other tools also inspect the current Git repository: give git_log_summary a commit range that exists there, or git_blame_summary a tracked file path. pi list only lists installed packages; ask Pi in chat to use a tool.

Package contents

PathPurpose
extensions/Pi TypeScript extension entrypoints
lib/Shared TypeScript helpers
docs/Optional supporting docs

Development

npm install
npm run ci

Release

This package is set up for npm Trusted Publishing, so no NPM_TOKEN is required.

npm version patch
git push

See docs/release.md for setup details.

Docs

docs/ is optional supporting documentation, not a fixed six-file set. README stays the GitHub/npm entrypoint; add docs/*.md only when they help users or maintainers.

Security

Pi packages can execute code with your local permissions. Review extensions before installing third-party packages.

For vulnerability reporting, see SECURITY.md.

License

MIT