InTouch Hub · Blue Isle Software

code-review-on-change

AI-powered code review triggered by source file changes

Code Review on Change — YAML Workflow

Automated AI code review triggered by source file changes. When files change in a watched directory, InTouch captures the git diff, sends it to Claude for review, and posts the results to your team.

How It Works

  1. A Trigger File watches your source code directory for changes
  2. When a file changes, this workflow fires
  3. Bash runs git diff to capture what changed
  4. Claude reviews the diff — bugs, security, performance, error handling
  5. The review is posted to your team via any messaging channel

Setup

1. Edit the Workflow

Open code-review-on-change.yaml and update:

# In the get-diff task, change the project path:
script: |
  cd /home/user/projects/myapp    # <-- your repo path
  git diff HEAD~1 --unified=5 --stat
  echo "---DIFF---"
  git diff HEAD~1 --unified=5
# In the review task, change the connection name:
connection: claude-api              # <-- your Anthropic connection name
# In the notify-team task, change the contact:
contactNames: "dev-team"         # <-- your contact or group name

2. Create an Anthropic Connection

In the UI: Connections > Add Connection

3. Create a Trigger File

In the UI: Automation > Trigger Files > Add

4. Link the Workflow to the Trigger

In the UI: Workflow Management > code-review-on-change > Triggers

Link the trigger file you created to this workflow.

5. Create a Contact

In the UI: Users & Privileges > Subscribers

Create a contact (or group) named dev-team with the channels your team uses — Slack, Teams, email, etc.

Customization

Change the Review Focus

Edit the systemPrompt in the review task:

systemPrompt: |
  You are a senior code reviewer. Focus on:
  - Security vulnerabilities (SQL injection, XSS, auth bypasses)
  - Performance issues (N+1 queries, unnecessary allocations)
  - Error handling gaps (uncaught exceptions, missing null checks)
  # Add your own priorities here

Change the Diff Range

The default reviews the last commit (HEAD~1). Change for different scenarios:

# Last 3 commits
git diff HEAD~3 --unified=5

# Changes since a branch point
git diff main...HEAD --unified=5

# Only staged changes
git diff --cached --unified=5

# Changes in the last hour
git diff HEAD@{1.hour.ago} --unified=5

Change the AI Model

model: claude-sonnet-4-6      # balanced (default)
model: claude-opus-4-6        # most thorough
model: claude-haiku-4-5-20251001  # fastest, cheapest

Filter by File Type

Add file type filters to the git diff:

# Only review Python files
git diff HEAD~1 --unified=5 -- "*.py"

# Only review Kotlin and Java
git diff HEAD~1 --unified=5 -- "*.kt" "*.java"

# Exclude test files
git diff HEAD~1 --unified=5 -- . ":!**/test/**"

Cost

Notes