cd /news/ai-agents/assisted-by-print-an-assisted-by-har… · home topics ai-agents article
[ARTICLE · art-132730] src=gist.github.com ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

assisted-by: print an Assisted-by: HARNESS:MODEL trailer for an AI agent commit, from the agent session record

A developer published a script called assisted-by that prints an Assisted-by: trailer identifying the AI coding agent behind a commit, following the format documented by the Linux kernel. The tool reads the harness and model from the agent's own session record rather than the model's self-report, supports Claude Code and opencode, and exits silently when no agent session is found so commits get no trailer rather than a wrong one.

by read2 min views10 publishedAug 31, 2026

A script that prints an Assisted-by: trailer for the AI coding agent that runs it, in the format the Linux kernel documents:

Assisted-by: HARNESS:MODEL [TOOL1] [TOOL2]

The agent commits with it:

t=$(assisted-by); git commit ${t:+--trailer} ${t:+"$t"} -m "Fix the thing"

The two-expansion form works in sh, bash, and zsh, and passes no --trailer when the script prints nothing.

For example:

Assisted-by: claude-code:claude-opus-5 spekk

It reads the harness and the model from the agent's own session record, not from what the model says about itself. A model is not reliable about its own version, and no environment variable follows a model switch made in the middle of a session. When it finds no agent session or no model, it prints nothing and exits 1, so a commit gets no trailer rather than a wrong one.

Claude Code and opencode are supported.

mkdir -p ~/.local/bin
curl -fsSL https://gist.githubusercontent.com/whusterj/01be8cde934ed45ea5264c30163d9cf5/raw/assisted-by -o ~/.local/bin/assisted-by
chmod +x ~/.local/bin/assisted-by
git config --global trailer.assisted-by.ifExists addIfDifferent

~/.local/bin must be on your PATH. The ifExists entry keeps an amend or a rebase from adding a second copy of the trailer.

Then tell your agent to use it. The rule in my agent instructions is: commit with the form above, never type the trailer or a tool name by hand, and if the script fails, commit without the trailer and say so.

The first version was a global prepare-commit-msg hook under core.hooksPath. Git resolves that setting by precedence, and a repository's own core.hooksPath wins. Husky sets one on purpose, and Claude Code writes one as a side effect when it creates a worktree, so the hook silently stopped in those repositories. The reverse also held: a global core.hooksPath hides a repository's .git/hooks for every hook name the global directory does not chain, so a pre-commit framework hook went quiet with no error. The trailer is a fact about the agent session, not about the repository, so the mechanism now lives with the agent.

  • It needs python3 , andsqlite3 for opencode.
  • A specialized tool is listed only when the environment is configured for it. spekk is listed when the binary is installed and the repository has aspecs/ directory. Add a tool by adding a check in the script, not by hand on the command line.
  • A commit you make yourself gets no trailer, because the script sees no agent session.
  • git config assisted-by.enabled false turns the trailer off for a repository, for commits and pull requests alike. Unset means on.
  • assisted-by --pr prints the same line for a pull request description, and only in a repository that hasgit config assisted-by.pr true . Unset means off, so a pull request carries no attribution by default.

Turn off Claude Code's own Co-authored-by trailer in ~/.claude/settings.json:

{
  "attribution": {
    "commit": "",
    "pr": ""
  }
}
── more in #ai-agents 4 stories · sorted by recency
── more on @claude code 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/assisted-by-print-an…] indexed:0 read:2min 2026-08-31 ·