-
-
Notifications
You must be signed in to change notification settings - Fork 9
feat(agent-workflow): add git command verification hook for Claude Code #682
Copy link
Copy link
Closed
Labels
To DoReady for developmentReady for developmentagent-devopsCI/CD pipeline agentCI/CD pipeline agentagent-qaTesting and verification agentTesting and verification agentagent-retrospectiveLearning extraction agentLearning extraction agentarea-infrastructureBuild, CI/CD, configurationBuild, CI/CD, configurationarea-promptsAgent prompts and templatesAgent prompts and templatesarea-workflowsGitHub Actions workflowsGitHub Actions workflowsautomationAutomated workflows and processesAutomated workflows and processesbugSomething isn't workingSomething isn't workingdocumentationImprovements or additions to documentationImprovements or additions to documentationenhancementNew feature or requestNew feature or requestpriority:P1Important: Affects user experience significantly, high business valueImportant: Affects user experience significantly, high business value
Milestone
Metadata
Metadata
Assignees
Labels
To DoReady for developmentReady for developmentagent-devopsCI/CD pipeline agentCI/CD pipeline agentagent-qaTesting and verification agentTesting and verification agentagent-retrospectiveLearning extraction agentLearning extraction agentarea-infrastructureBuild, CI/CD, configurationBuild, CI/CD, configurationarea-promptsAgent prompts and templatesAgent prompts and templatesarea-workflowsGitHub Actions workflowsGitHub Actions workflowsautomationAutomated workflows and processesAutomated workflows and processesbugSomething isn't workingSomething isn't workingdocumentationImprovements or additions to documentationImprovements or additions to documentationenhancementNew feature or requestNew feature or requestpriority:P1Important: Affects user experience significantly, high business valueImportant: Affects user experience significantly, high business value
Summary
Create a Claude Code hook that intercepts git commands and verifies the current branch matches the expected PR context before executing commit operations.
Background
From PR co-mingling retrospective (PR #669): Agents made commits without branch awareness, leading to cross-PR contamination. This hook provides runtime verification during agent execution.
Specification
Category: Agent automation protection
Integration: Claude Code PreToolUse hook
Verification Logic
Before any
git commitorgit pushcommand:git branch --show-currentbranchfield)Example Flow
Architecture Constraint
Claude Code PreToolUse hooks are non-interactive subprocesses. Stdin carries a JSON payload from Claude Code. The hook cannot prompt for user input. Exit codes are the only communication channel:
The hook provides just-in-time documentation through its block message, giving the agent actionable remediation paths at the moment of failure.
Testing
Related
Acceptance Criteria
Notes
This complements #681 (pre-commit hook) by adding runtime verification during agent execution. The pre-commit hook catches errors at commit time; this hook catches them before the agent even attempts the commit.