Enforce git-tracked, diff-first workflow for all agent file operations.
git diff before finalizing. Wait for approval.1. git checkout -b <descriptive-branch-name>
2. Make the changes (create/edit files)
3. git diff # Show the user what changed
4. Wait for user approval (👍 or explicit "go ahead")
5. git add -A && git commit -m "<clear message>"
6. git push origin <branch-name>
7. Show the user: branch name, commit hash, diff summary
1. Make the edit
2. Show inline diff (before/after) in chat
3. On approval: commit + push on current branch
When showing diffs in chat, use fenced code blocks with diff syntax highlighting:
~~~
- old line
+ new line
~~~
For large diffs (>50 lines), summarize the key changes in bullet points first, then offer the full diff on request.
/tmp/, session state, working buffersThis skill works alongside existing git workflows. It doesn't replace PR review processes — it adds transparency to the agent's own work so the user always knows what changed and can verify it.
Use scripts/git-guardian.sh for common operations:
# Start tracked work
scripts/git-guardian.sh start "description of work"
# → Creates branch, logs start time
# Show what changed
scripts/git-guardian.sh diff
# → Pretty-prints staged + unstaged changes
# Commit with message
scripts/git-guardian.sh commit "what changed and why"
# → Stages all, commits, shows summary
# Wrap up and push
scripts/git-guardian.sh finish
# → Pushes branch, shows commit log, provides review link
共 1 个版本