← Catalog

@e4779/co-author

pi extension: auto-append Co-authored-by trailers with the model's identity

Extension

Install

Install with PiG

pig install npm:@e4779/co-author

Install with Pi

pi install npm:@e4779/co-author
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": [
    "./index.ts"
  ]
}

README

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

co-author

Adds a Co-authored-by: trailer to git commit commands the agent runs through the bash tool, naming the model that wrote the change.

What it does

On tool_call for bash, a command that runs the commit subcommand — git commit …, also behind global options such as git -c x=y commit — gets

--trailer "Co-authored-by: <Name> <email>"

inserted right after the commit token. Everything else is left alone: git log --grep commit, git commit-tree, dry runs, --help, and commits that already carry a --trailer.

The identity is looked up for the current model:

  1. ~/.pi/agent/coauthors.json — model.id → { "name", "email" }.
  2. Without a usable entry, one derived from the model id: zai/glm-5.4 → glm-5.4 <glm-5.4@ai.local>.

The map lives in the home directory

~/.pi/agent/coauthors.json is per user and per machine: it never ships with the package and is never read from the repository being committed. Format, one entry per model id:

{
  "zai/glm-5.4": { "name": "GLM-5.4", "email": "glm@example.invalid" }
}

Fail-open: a missing or invalid file, a model without an entry, or an entry that is not two plain strings falls back to the derived identity — a quote, a backtick, a $ or a backslash in either field would end the quoted trailer early on the command line. A model id that yields no identity leaves the command untouched.

Limits

A regex finds the commit, not a shell parser: git commit text inside an earlier quoted string or heredoc is matched first.