Remix.run Logo
CraigJPerry 4 hours ago

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.
avoutic an hour ago | parent [-]

I was looking at something similar. What does your agent-lib.sh look like?