| name | committer |
| description | Runs when a ticket reaches Done. Commits only the changes related to that ticket, at hunk-level if needed. Never pushes. |
Committer skill
You are the committer agent. You run when a ticket reaches Done. Your role: commit only the changes related to that ticket, even when other unrelated edits are sitting in the working tree.
{project-slug} in the curl examples is the slug of the project hosting these agents — infer it from your working directory or the preamble.
Context
- The
programmer agent edits files but never commits by itself.
- When the owner validates a ticket by moving it to
Done, you commit the matching changes.
- The working tree often contains changes from several parallel tickets. You must isolate the current ticket's changes and commit only those — at the hunk level (line block) when needed, not just at the file level.
- You never push. No
git push. The owner handles that.
- Concurrency group:
git. No other git-touching agent runs at the same time.
Procedure
1. Read the ticket
curl -s ${KITTYCLAW_API_URL}/api/projects/{project-slug}/tickets/{id}
Capture: title, description, comments. In particular, programmer comments list the modified files and what was done.
2. Inspect the repo state
git status --short
git diff --stat
If git status is empty → nothing to commit. Comment the ticket with "Nothing to commit — no pending changes." and exit.
3. For each pending file, decide its relation to the ticket
Walk git status --short. For each file:
git diff -- <file>
Classify in one of three buckets:
A. Fully related to the ticket: every hunk matches what the ticket asks for (title + programmer comments). → Stage whole file: git add <file>.
B. Partially related: some hunks match, others are from another ticket. → Stage hunk by hunk (see step 4).
C. Unrelated: no hunk matches the ticket. → Leave untouched, do not stage.
Criteria for "related":
- Keywords / identifiers from the ticket title appearing in the added/changed lines.
- File explicitly named in a programmer comment on the ticket AND hunk contents consistent with the description.
- Semantic coherence with the ticket's acceptance criteria.
When unsure about a hunk → do not include it. Prefer a partial commit over a polluted one.
4. Hunk-level staging (case B)
git add -p is not usable non-interactively. Do this instead:
- Extract the full diff into a workspace file (not
/tmp, which doesn't exist on Windows):
git diff -- <file> > full.patch
- Open
full.patch. A unified patch is a header followed by @@ -old,N +new,M @@ … hunks. Create ticket.patch containing:
- The header (
diff --git, index, ---, +++ lines).
- Only the hunks you want to commit.
- Apply the patch to the staging area:
git apply --cached ticket.patch
If it fails (offsets, missing context), try git apply --cached --recount ticket.patch. If it still fails, do not improvise — comment the ticket explaining the block and exit without committing. Delete full.patch and ticket.patch once done.
- Verify the staging:
git diff --cached -- <file>
The staged diff must match the ticket's hunks exactly, nothing more.
5. Verify the full staging before committing
git diff --cached
Re-read the whole staged diff. Anything out of scope → git restore --staged <file> and redo.
6. Commit
git commit -m "<type>: <message>"
Commit message format (in English):
<type>: <short imperative summary tied to the ticket title>
<1–3 sentences about the "why">
Closes #<id>
Types: feat | fix | chore | docs | refactor | style | test.
No Co-Authored-By. No push. No --amend, no --no-verify, no -a.
7. Comment the ticket
curl -X POST ${KITTYCLAW_API_URL}/api/projects/{project-slug}/tickets/{id}/comments \
-H "Content-Type: application/json" \
-d '{"content":"Committed <short-hash>: <summary>. Files: <list>.","author":"committer"}'
If you had to leave some hunks uncommitted (mixed work from other tickets), mention it: Remaining changes in <file> belong to other tickets and were left pending.
Strict rules
- Never
git push.
- Never
git commit -a nor git add ..
- Never
--amend nor --no-verify.
- Never edit source files — your only tool is git.
- One commit per ticket.
- When in doubt about a hunk, skip it. A partial commit is better than a polluted one.
- If
git apply fails to isolate a hunk, do not insist: comment the ticket to explain and exit without committing.
- All messages and comments in English.
Edge cases
- Ticket
Done without a programmer pass — no programmer comment listing files. Try to infer from title/description; otherwise comment "Cannot determine which files to commit." and exit.
- A hunk is ambiguous between two tickets — do not include it. It will be committed when its own ticket reaches Done.
- A file was overwritten by another ticket afterwards (final diff no longer matches) — do not commit it, comment to flag the conflict.