Documentation

Everything you need to integrate and use NeuronX Guard.

Contents Quick Start PR Commands API Reference Configuration GitHub Actions CI VS Code Extension Security Rules Supported Languages

Quick Start

1. Install the GitHub App

Go to github.com/apps/neuronx-guard and click Install. Select your repos.

2. Open a Pull Request

Guard reviews automatically on every PR open, update, or reopen. No configuration needed.

3. Get Your API Key

Log in at /guard/dashboard to get your API key for CI and VS Code integration.

PR Commands

Comment any of these on a Pull Request:

CommandDescription
/guard explainDetailed explanation of each finding with OWASP/CWE references, bad/good examples
/guard dismissCollapse review, record dismissed patterns (suppressed after 3x)
/guard re-reviewTrigger fresh review (useful after pushing fixes)
/guard qualityCode quality score (0-100, grade A-F) with trend
/guard leaderboardDeveloper leaderboard ranked by cleanest code
/guard reportCompliance-ready markdown report
/guard configShow current .neuronx-guard.yml config
/guard feedbackCollect reaction data from Guard's comments

NeuronX Platform Intelligence

Guard is powered by the NeuronX AI platform. Every review uses these platform features:

Pattern Database (23K+ patterns)

Before calling LLMs, Guard searches 23,000+ learned code patterns and 189,000 FAISS semantic vectors for known vulnerability matches. Instant results, zero API cost.

Auto-Fix Suggestions

Every issue includes an actionable fix. 40+ deterministic fixes for known issues (e.g., except:except Exception as e:), pattern-based reference code from the database, and LLM-generated repairs for complex errors.

Knowledge Graph Context

A 3,900-node knowledge graph with 38,700 edges enriches LLM review prompts with codebase context — related concepts, dependencies, and known patterns. This makes LLM reviews significantly more accurate.

Fix Coverage

Tested across 14 files in 10 languages: 56% of all issues include fix suggestions. Python and JavaScript achieve 93-100% fix coverage.

Competitive Features (GE17-GE20)

GE17: AI PR Summary

Every review includes a 3-5 bullet LLM-generated summary of what the PR does — changes, impact, risk. Not just issues, but a human-readable changelog.

GE18: Conversational Chat

Mention @neuronx-guard in any PR comment to ask questions: "Why is this dangerous?", "Fix this for me", "Is this safe?". Guard answers with full context from the diff + Knowledge Graph.

GE19: Quality Gates

Configurable thresholds that block merges. Set max_errors: 0 in .neuronx-guard.yml and Guard will fail the Check Run if any errors are found. Enterprise-grade CI enforcement.

quality_gate:
  enabled: true
  max_errors: 0
  max_warnings: 10
  max_cve_critical: 0
  block_merge: true

GE20: CWE/OWASP Classification

Every security finding tagged with CWE ID + OWASP 2021 Top 10 category. Example: SQL injection [CWE-89] [OWASP A03:2021]. Covers CWE-78, 89, 94, 208, 502, 798 and OWASP A02, A03, A07, A08.

Auto-Fix System

One-Click Fix Suggestions

Every issue includes a fix suggestion rendered as a GitHub suggestion block. Developers see a green "Apply suggestion" button — one click to fix. Zero risk.

Rollback

Comment /guard rollback to see all applied fixes. Use /guard rollback <id> to revert a specific fix. Every fix is tracked with original code, confidence score, and audit trail.

Fix Learning

When a developer applies Guard's suggestion, the fix pattern is recorded into the 23K pattern database. Guard gets smarter with every review — no competitor has a self-improving engine.

Code Duplication Detection (GE21)

Detects copy-pasted code blocks across files in the same PR. Uses token-based comparison — normalizes whitespace and strings, then compares sliding windows. Flags blocks of 6+ lines that are 80%+ similar.

Security Score Badge

Separate from the quality badge. Shows a security grade (A-F) based on CWE findings from your review history.

![Security](https://neuronx.jagatab.uk/api/github/security-badge/OWNER/REPO.svg)

Slack/Discord Notifications

Guard posts review summaries to your team's Slack or Discord channel after every review.

Setup

Set the webhook URL as an environment variable:

GUARD_SLACK_WEBHOOK_URL=https://hooks.slack.com/services/T.../B.../xxx
GUARD_DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/xxx/yyy

Or configure per-repo in .neuronx-guard.yml:

notifications:
  slack_webhook: https://hooks.slack.com/services/...
  discord_webhook: https://discord.com/api/webhooks/...

Notifications include: repo, PR number, title, author, issue count, errors/warnings, and review time.

Priority Review Queue

Pro and Team plan users get their reviews processed first. Free tier reviews go to the back of the Redis queue, paid plans go to the front. No configuration needed — automatic based on your plan.

Auto-Commit Fixes

Guard can commit deterministic fixes directly to your PR branch. Three modes:

ModeBehaviorRisk
suggestGitHub suggestion blocks — one-click apply (default)Zero
commitGuard creates a fix branch + Fix PRLow
autoCommit directly to PR branch (deterministic only, confidence ≥ 0.95)Medium

Configure in .neuronx-guard.yml:

auto_fix:
  enabled: true
  mode: auto
  confidence_threshold: 0.95
  max_fixes_per_pr: 5
  protected_files:
    - "*.lock"
    - "migrations/*"

Safety: AST validation, max 5 fixes/PR, protected files skipped, every fix tracked with rollback via /guard rollback.

API Reference

Base URL: https://neuronx.jagatab.uk

Public Endpoints (no auth required)

EndpointDescription
POST /api/github/webhookGitHub App webhook receiver
POST /api/guard/ci-reviewCI review — send diff, get issues back
GET /api/github/statusGuard integration status + feature list

Analytics Endpoints

EndpointDescription
GET /api/github/quality/{owner}/{repo}Quality score, grade, trend data
GET /api/github/analytics/{owner}/{repo}Review history, averages, trends
GET /api/github/leaderboard/{owner}/{repo}Developer leaderboard
GET /api/github/report/{owner}/{repo}/{pr}Compliance report (markdown or ?format=json)

CI Review Request

curl -X POST https://neuronx.jagatab.uk/api/guard/ci-review \
  -H "Content-Type: application/json" \
  -d '{
    "diff": "--- a/file.py\n+++ b/file.py\n@@ ...",
    "repo": "owner/repo",
    "pr_number": 1,
    "severity_threshold": "warning"
  }'

Response Format

{
  "issues_found": 3,
  "errors": 1,
  "warnings": 2,
  "review_time": "1.2",
  "issues": [
    {"file": "api/auth.py", "line": 14, "severity": "error",
     "message": "Hardcoded password detected"}
  ]
}

Configuration

Add .neuronx-guard.yml to your repo root (optional — all checks enabled by default):

enabled: true
checks:
  security: true        # 19 security patterns
  complexity: true      # AST cyclomatic complexity
  bare_except: true     # Bare except detection
  patterns: true        # Language-specific rules
  llm_review: true      # Multi-model LLM consensus
ignore_files:
  - "*.md"
  - "tests/*"
  - "docs/*"
  - "vendor/*"
severity_threshold: warning  # info | warning | error

# Custom rules (Pro feature):
custom_rules:
  - pattern: "TODO|FIXME|HACK"
    message: "Resolve before merging"
    severity: info
  - pattern: "print\\("
    message: "Debug print() — remove for production"
    severity: warning

Run /guard config on any PR to see active config.

GitHub Actions CI

Run Guard as a CI step — no GitHub App installation needed:

name: Guard Review
on: [pull_request]
jobs:
  guard:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with: { fetch-depth: 0 }
      - uses: sreejagatab/neuronx-platform/.github/actions/neuronx-guard@main
        with:
          severity-threshold: warning  # info, warning, error
          fail-on-error: true          # fail CI on errors
          scan-dependencies: true      # CVE scan
          max-issues: 20

Results appear in the GitHub Actions job summary.

VS Code Extension

# Install
cd vscode-extension && npm install && npx vsce package
code --install-extension neuronx-guard-1.0.0.vsix
SettingDefaultDescription
neuronxGuard.apiUrlhttps://neuronx.jagatab.ukGuard API URL
neuronxGuard.apiKey(empty)API key from dashboard
neuronxGuard.scanOnSavetrueAuto-scan on save
neuronxGuard.severityThresholdwarningMin severity to show

Ctrl+Shift+G to scan current file. Status bar shows issue count.

Security Rules (19)

CategoryPatterns
Hardcoded secretspassword=, api_key=, secret=, sk-*, ghp_*
Code injectioneval(), exec()
SQL injectionf-string SELECT/INSERT/UPDATE/DELETE, .execute(f"...")
Command injectionos.system(), subprocess shell=True
Unsafe deserializationpickle.loads()
Timing attacks== password comparison

Supported Languages (14)

LanguageRulesExamples
JavaScript/TypeScript7console.log, ==, var, innerHTML
Go5fmt.Print, panic, unsafe.Pointer
Java4System.out, printStackTrace, Runtime.exec
Rust4unwrap(), unsafe{}, panic!()
C/C++8gets(), strcpy(), system()
Ruby3send(params), constantize
PHP3mysql_query, echo $var, shell_exec
Shell4eval, rm -rf /, chmod 777, curl|sh
Kotlin2!!, Thread.sleep
Swift1try!

Plus nesting depth check (>6 levels) for all brace languages. Plus LLM review for any language.