An autonomous GitHub Action that reviews pull requests, fixes bugs, and runs a dedicated security scan — all governed by node9.
On every push to a non-main branch, the agent runs a four-step pipeline:
| Step | What happens |
|---|---|
| 1. Fix loop | Reads changed files, fixes real bugs, runs tests (up to 6 turns) |
| 2. Safety check | Reverts AI changes if tests break after fixes |
| 3. Code review | Reviews the agent's own fixes — posts as 🔍 node9 Code Review on your PR |
| 4. Security review | Data-flow pass on the original diff — posts as 🔒 node9 Security Review on your PR |
Two possible outcomes:
- Agent found nothing to fix — one PR (yours), two review comments on it
- Agent fixed bugs — your PR gets review comments + a separate
[node9] AI fixesPR with the agent's changes for you to review
Create .github/workflows/node9-review.yml in your repo:
name: node9 AI PR Reviewon:
push:
branches: ['**', '!main', '!master', '!node9/**']jobs:
review:
runs-on: ubuntu-latestpermissions:
contents: writepull-requests: writesteps:
- uses: actions/checkout@v4with:
fetch-depth: 0
- name: Configure gitrun: | git config user.name "node9[bot]" git config user.email "bot@node9.ai" git fetch origin main - uses: node9-ai/node9-pr-agent@v1with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}node9_api_key: ${{ secrets.NODE9_API_KEY }}github_token: ${{ secrets.GITHUB_TOKEN }}test_cmd: 'npm test'In your repo: Settings → Secrets and variables → Actions
| Secret | Required | Description |
|---|---|---|
ANTHROPIC_API_KEY | Yes | Anthropic API key — console.anthropic.com |
NODE9_API_KEY | No | node9 SaaS key for audit trail — node9.ai |
That's it. Push to any feature branch and the agent runs automatically.
| Input | Required | Default | Description |
|---|---|---|---|
anthropic_api_key | Yes | — | Anthropic API key |
github_token | Yes | — | GitHub token for PR operations |
node9_api_key | No | — | node9 SaaS key for audit trail |
test_cmd | No | npm test | Command to run tests |
base_ref | No | main | Base branch to diff against |
Examples for test_cmd: pytest, cargo test, go test ./..., npm run build && npm test
After each push to a feature branch, the agent posts two comments on your PR:
🔍 node9 Code Review — logic and correctness review of the agent's own fixes (or the original diff if no fixes were needed)
🔒 node9 Security Review — focused data-flow analysis of the original PR diff, looking for:
- User-controlled inputs reaching filesystem sinks (
path.join,open()) - Execution sinks (
exec,spawn,subprocess) - Network sinks (URLs constructed from input)
- Deserialization of untrusted input
- Validation gaps (blocklist vs allowlist, unanchored regex)
Findings are rated HIGH / MEDIUM / LOW.
The agent runs with node9 in standard mode — every tool call (file read, file write, bash command) is logged to the node9 audit trail and dangerous operations are blocked.
Prompt injection mitigations:
- Security review instructions live in the system message, separate from the untrusted diff
- The diff is explicitly labelled as untrusted data in the user message
- Model output is scanned for
GITHUB_TOKEN,ANTHROPIC_API_KEY, andNODE9_API_KEYbefore posting to GitHub
Tool safety:
- File reads and writes are sandboxed to
GITHUB_WORKSPACEviasafe_path() - Tool inputs are validated against an allowlist before dispatch
- Branch names are sanitized to prevent shell injection
Apache 2.0 — see LICENSE.