feat: automate Assisted-by commit trailer for Claude Code#586
Conversation
Automatically credits the LLM model(s) used in a commit with an `Assisted-by` trailer, per the convention adopted in #582. E.g.: Assisted-by: Claude:Opus-4.8 [claude-code] How it works: - A Claude Code PostToolUse hook (.claude/hooks/write-assisted-by-signal.ts, wired in .claude/settings.json) reads the current model from the session transcript after each edit and accumulates one trailer per unique model into a repo-scoped signal file under .git/. Written in TypeScript and run via Node's native type-stripping (node >= 22.18); fails open on older Node. - .githooks/prepare-commit-msg appends the trailers at commit time, with a 1-hour freshness window and a corruption guard on the timestamp. - .githooks/post-commit clears the signal so later human-only commits aren't credited. - A 'prepare' npm script installs the git hooks on 'yarn install'. - includeCoAuthoredBy is disabled so the built-in Co-Authored-By trailer doesn't compete with Assisted-by. Assisted-by: Claude:Opus-4.8 [claude-code]
The Assisted-by PostToolUse hook runs TypeScript through Node's native type-stripping, which requires Node >= 22.18. Pin a compatible Node via .tool-versions (asdf-compatible, read by mise) so contributors' language managers select a version that supports it. Assisted-by: Claude:Opus-4.8 [claude-code]
|
Thanks for sharing this with us for visibility. We also tried something similar with hooks inside Claude-config. Regardless of what we decide to keep, this is for me a welcome addition. |
|
I want to understand about your rationale about separating this from the other repo (which is still experimental). I am still unsure what direction makes sense for a big team and if one place for all makes sense |
|
Thanks for tagging and working on this 🚀 This is a great example of something that could fit into our experimental repo for Claude configs (skills and related tooling), as @MounirDhahri mentioned. |
|
Thanks both! 🙏🏼 Some thoughts:
For example: # bin/setup
yarn install
# enroll in AI Assisted-by trailers (artsy/assisted-by) — pick one:
npx --yes @artsy/assisted-by install
# or, without Node:
curl -fsSL https://raw.githubusercontent.com/artsy/assisted-by/main/install.sh | sh
On where it'd live: I get the instinct to place this within artsy/claude-config. That said, since the byline mechanism isn't Claude-specific, this might be a chance to rename the repo to something broader like |
Totally agree on broadening it beyond Claude. I'm somewhat cautious about using the term 'AI tooling' because the label 'AI' sounds very broad/vague, and terminology based on current technology trends can become outdated quickly Since this is really multi agent and multi skill (hooks, real agentic tooling...), I'd lean toward Leaning agent-____ or resonance myself. Curious where you land! |
|
The Python script I use already matches Assisted-by: Claude... alongside Co-Authored-By and reviewer/footer. The only thing I would need to add is a breakdown per model. This PR solves the detection problem effectively and adds more precision to the data. This is a sample of the data collected and the report |
|
@dblandin I renamed the repo to https://github.com/artsy/agent-tooling and after this PR lands, all the old reference will be changed. |
|
Closing in favor of https://github.com/artsy/agent-tooling/pull/20 |
Description
Automatically credits the LLM model(s) used in a commit with an
Assisted-bytrailer, per the convention adopted in #582. E.g.:Would love for others to pull this down locally and try it out. Don't forget to run
yarn install.cc/ @MounirDhahri and @egdbear as you were recently experimenting with some related automation.
How it works
.git/..githooks/prepare-commit-msgappends the trailers at commit time, with a 1-hour freshness window..githooks/post-commitclears the signal so later human-only commits aren't credited.includeCoAuthoredByoption is disabled so the built-inCo-Authored-Bytrailer doesn't compete withAssisted-by.Notes & caveats
A few things worth surfacing for anyone reviewing this:
Assisted-bydata, but we haven't settled how (or whether) we'll actually consume it — what the detector reads, where it runs, what questions we point it at. This PR is about capturing the signal cleanly now so the option exists; the analysis side is still to be figured out.Assisted-bytrailer convention itself is agent-agnostic, but capturing it automatically for other agents/harnesses (Cursor, Copilot, etc.) would need separate adaptation if we decide to take this further.Potential follow-up: reuse across repos
This PR wires the feature directly into this repo. A natural next step is to extract it into a shared npm devDependency (e.g.
@artsy/ai-assisted-by) that a repo pulls in and installs from its prepare script.