Skip to content

feat(agent-v1): add pre_bash_call/post_bash_call types for shell comm…#1312

Open
blanet wants to merge 1 commit into
git-ai-project:mainfrom
blanet:main
Open

feat(agent-v1): add pre_bash_call/post_bash_call types for shell comm…#1312
blanet wants to merge 1 commit into
git-ai-project:mainfrom
blanet:main

Conversation

@blanet
Copy link
Copy Markdown
Contributor

@blanet blanet commented May 8, 2026

The agent-v1 protocol previously only supported file-edit attribution (human/ai_agent types). This left a gap: when third-party agents execute shell commands (e.g. cargo fmt, npm install) that modify files, those changes were invisible to git-ai.

Add two new payload types to the agent-v1 protocol:

  • pre_bash_call: triggers a filesystem stat snapshot before command execution
  • post_bash_call: diffs against the pre-snapshot to discover changed files

These map directly to the existing PreBashCall/PostBashCall events that all built-in presets (claude, codex, cursor, etc.) already use. The orchestrator, bash_tool stat-diff engine, and daemon require no changes.

Note: The public docs at usegitai.com/docs/cli/add-your-agent should be updated to document the new types.

Closes #1313


Open in Devin Review

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

@blanet blanet force-pushed the main branch 3 times, most recently from 6258a06 to 6e72b75 Compare May 8, 2026 12:27
@svarlamov svarlamov self-assigned this May 8, 2026
@svarlamov
Copy link
Copy Markdown
Member

Hey @blanet thank you so much for the contribution! This was on my todo list, so extra appreciate it!

Quick question, do you mind also adding tool_use_id input into pre/post file edit hooks as well? We have to make it optional on those calls (for backwards compatibility), but I think it's good to bring into line with how most of our other presets work these days

@blanet
Copy link
Copy Markdown
Contributor Author

blanet commented May 9, 2026

Hey @blanet thank you so much for the contribution! This was on my todo list, so extra appreciate it!

Quick question, do you mind also adding tool_use_id input into pre/post file edit hooks as well? We have to make it optional on those calls (for backwards compatibility), but I think it's good to bring into line with how most of our other presets work these days

@svarlamov Done! Added optional tool_use_id to human and ai_agent as well. It's #[serde(default)] so fully backward compatible.

…and attribution

The agent-v1 protocol previously only supported file-edit attribution
(human/ai_agent types). This left a gap: when third-party agents execute
shell commands (e.g. cargo fmt, npm install) that modify files, those
changes were invisible to git-ai.

Add two new payload types to the agent-v1 protocol:
- pre_bash_call: triggers a filesystem stat snapshot before command execution
- post_bash_call: diffs against the pre-snapshot to discover changed files

These map directly to the existing PreBashCall/PostBashCall events that all
built-in presets (claude, codex, cursor, etc.) already use. The orchestrator,
bash_tool stat-diff engine, and daemon require no changes.

Note: The public docs at usegitai.com/docs/cli/add-your-agent should be
updated to document the new types.

Change-Id: I5786f59a4db94d5b9ec7716ec1cae9d1e3512fcd
Reported-By: gujunxi@bytedance.com
@svarlamov svarlamov removed their assignment May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

agent-v1 protocol lacks support for shell command attribution

2 participants