I've had good success with something along these lines but perhaps a bit more raw:
- claude takes a -p option
- i have a bunch of tiny scripts, each script is an agent but it only does one tiny task
- scripts can be composed in a unix pipeline
For example: $ git diff --staged | ai-commit-msg | git commit -F -
Where ai-commit-msg is a tiny agent: #!/usr/bin/env bash
# ai-commit-msg: stdin=git diff, stdout=conventional commit message
# Usage: git diff --staged | ai-commit-msg
set -euo pipefail
source "${AGENTS_DIR:-$HOME/.agents}/lib/agent-lib.sh"
SYSTEM=$(load_skills \
core/unix-output.md \
core/be-concise.md \
domain/git.md \
output/plain-text.md)
SYSTEM+=$'\n\nTask: Given a git diff on stdin, output a single conventional commit message. One line only.'
run_agent "$SYSTEM"
And you can see to keep the agents themselves tiny, they rely on a little lib to load the various skills and optionally apply some guard / post-exec validator. Those validators are usually simple grep or whatever to make sure there were no writes outside a given dir but sometimes they can be to enforce output correctness (always jq in my examples so far...). In theory the guard could be another claude -p call if i needed a semantic instruction.
Do you have examples of these commit messages? I have yet to see an AI write a good commit message. At least when compared to good commit messages -- if it just does better than "wip" or "fix stuff" that's not a high bar.
My skills/domain/git.md looks like this:
So it produces messages like:My issue with this kind of message is that it doesn't convey intent well enough. This kind of commit message will always be like "remove check from handleUser" instead of "fix authorization in xyz case". But I assume these are different schools of commits -- I prefer commits which convey WHY, not WHAT, much like source code comments.
I was looking at something similar. What does your agent-lib.sh look like?
Something like this: https://github.com/craigjperry2/tiny-agents/blob/main/lib/ag...
That is probably a private repo? 404, so not something I can access