pi-git-agent
AI-first Git CLI automation — atomic AI commits, co-change relations (git-agent related), native extension guard for git commit/add, and workspace initialization (native /git-agent menu, no skill surface)
Package details
Install pi-git-agent from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:pi-git-agent- Package
pi-git-agent- Version
0.7.3- Published
- Aug 27, 2026
- Downloads
- 723/mo · 30/wk
- Author
- fradser
- License
- MIT
- Types
- extension
- Size
- 36.3 KB
- Dependencies
- 1 dependency · 3 peers
Pi manifest JSON
{
"extensions": [
"./index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
Git Agent for Pi 
English | 简体中文
A Pi coding-agent package that turns git-agent into a native /git-agent command menu: atomic AI commits, co-change relations, and a guard that blocks raw git commit in favor of the atomic-commit workflow. No skill surface.
Overview
- Atomic Commits: splits staged changes into up to 5 logically distinct commits with AI-generated conventional messages (
git-agent commit). - Co-change Relations: mined from git history to reveal files and test suites that change together (
git-agent related). - Native Extension Guard:
extensions/validate-commit.tsintercepts rawgit committool calls, locally embeds bounded session context in the block reason, and points the agent directly atgit-agent --intent. Normalgit addcalls remain allowed. The rootindex.tscomposes all extension modules for Pi. - Session-Grounded Commits:
extensions/session-context.tsexposes thesession_contexttool, which reads the live session entries so commit intents are built from what the user actually asked for, not a compressed one-liner. - Automatic Model Identity Resolution:
git-agentauto-detects agent environment variables (PI_MODEL,CLAUDE_CODE_MODEL,CODEX_MODEL,MODEL), so no manual co-author flags are needed.
Usage
Type /git-agent to open the native menu:
git-agent workflows:
❯ 1. Commit changes (procedures/commit.md)
2. Commit and push (procedures/commit-and-push.md)
3. Init / optimize (procedures/init.md)
4. Related files & tests (procedures/related.md)
Or pass a workflow keyword to skip the menu:
/git-agent commit # commit with intent built from session context
/git-agent commit --co-author "Alice <a@example.com>"
/git-agent related src/foo.ts # co-change for specific files
/git-agent related --tests src/
/git-agent init # regenerate scopes + .gitignore
Each selection embeds the full procedure (procedures/*.md) into a follow-up message via pi.sendUserMessage. Commit enforcement stays in the post-tool harness guard rather than a system-prompt guidance injection. When raw git commit is blocked, the guard locally extracts bounded session context so the agent can invoke git-agent --intent without a separate session_context round.
Installation
# published
pi install npm:pi-git-agent
# or from this repo: pi install /path/to/git-agent/pi-git-agent
Requires the git-agent CLI on PATH (built from the sibling git-agent-cli/ directory in this repo).
Files
pi-git-agent/
├── index.ts # Pi package entrypoint
├── src/
│ └── index.ts # extension composition root
├── extensions/
│ ├── menu.ts # /git-agent command menu
│ ├── session-context.ts # session_context tool (intent source for commits)
│ ├── validate-commit.ts # blocks raw git commit and embeds session context
│ └── lib/session-context-core.ts # shared local context extraction
├── procedures/
│ ├── commit.md # atomic AI commit workflow
│ ├── commit-and-push.md # commit + push workflow
│ ├── init.md # scope/.gitignore regeneration
│ └── related.md # co-change queries
└── references/
├── cli.md # git-agent CLI reference
└── coauthor-attribution.md