Aider Integration
Integrate AIVory Guard with Aider, the powerful terminal-based AI pair programming tool, to scan AI-generated code for compliance and security issues.
- Terminal-native workflow - Scan code directly from your terminal alongside Aider
- Multiple integration options - Shell wrapper, pre-commit hooks, or direct prompts
- Git-aware scanning - Scan staged changes before committing
- 17+ compliance standards - OWASP, GDPR, HIPAA, PCI-DSS, and more
Prerequisites
Before you begin, ensure you have the following installed:
pip install aider-chatIntegration Options
Choose the integration method that best fits your workflow.
Option 1: Shell Wrapper
Create a wrapper script that automatically scans your code after every Aider session.
Create the Wrapper Script
Create ~/bin/aider-secure:
#!/bin/bash
# Run aider with automatic compliance scanning
# Start aider
aider "$@"
# After aider exits, scan changes
echo "Running AIVory compliance scan..."
npx --yes @aivorynet/guard scan .
Make It Executable
chmod +x ~/bin/aider-secure
Usage
Use the wrapper instead of aider:
aider-secure
~/bin to your PATH if it’s not already there. Add export PATH="$HOME/bin:$PATH" to your shell profile.
Option 2: Pre-commit Hook
Add AIVory scanning to your Git workflow to catch compliance issues before they’re committed.
Create the Hook
Add to .git/hooks/pre-commit:
#!/bin/bash
# AIVory compliance check before commit
npx --yes @aivorynet/guard scan --staged
if [ $? -ne 0 ]; then
echo "Compliance violations found. Fix before committing."
exit 1
fi
Make It Executable
chmod +x .git/hooks/pre-commit
Option 3: Direct Prompts
Ask Aider to run AIVory scans directly during your coding session.
Example Prompts
Please scan the code I just wrote using AIVory Guard:
npx --yes @aivorynet/guard scan filename.py
Run a compliance check on the authentication module:
npx --yes @aivorynet/guard scan src/auth/
API Key Configuration
For full access to all compliance standards and unlimited scans, configure your API key.
Set Environment Variable
export AIVORY_API_KEY="your_api_key_here"
.bashrc, .zshrc, etc.) to persist across sessions.
Get Your API Key
Get your API key from app.aivory.net/tokens.
Troubleshooting
Common Issues
Command Not Found
- Ensure npm/npx is installed and in your PATH
- Try running
npx --yes @aivorynet/guard --helpdirectly
API Key Not Working
- Verify the key is correctly exported:
echo $AIVORY_API_KEY - Check your key is valid at app.aivory.net/tokens
Pre-commit Hook Not Running
- Verify the hook is executable:
ls -la .git/hooks/pre-commit - Check hook permissions:
chmod +x .git/hooks/pre-commit
Wrapper Script Issues
- Ensure
~/binis in your PATH - Check script is executable:
chmod +x ~/bin/aider-secure
Advanced Configuration
Enable Specific Standards
Scan for specific compliance standards only:
npx --yes @aivorynet/guard scan --standards OWASP_TOP_10,GDPR .
Scan Options
| Flag | Description |
|---|---|
--staged |
Scan only staged files |
--standards |
Comma-separated list of standards |
--output json |
Output results as JSON |
--verbose |
Show detailed scan information |
Environment Variables
| Variable | Description |
|---|---|
AIVORY_API_KEY |
Your AIVory API key |
AIVORY_ENABLED_STANDARDS |
Default standards to check |
AIVORY_LOG_LEVEL |
Logging verbosity (debug, info, warn, error) |