REAEGIS
Platform Engines
ARE — Autonomous Remediation

ARE — Autonomous Remediation Engine

The Autonomous Remediation Engine (ARE) takes a finding, reads the source code, writes a fix, builds it, verifies it against 7 scanners in 3 passes, and creates a Change Request if all checks pass. It uses claude-opus-4-8 for code analysis and patch generation.

What the ARE does and does not do

Does:

  • Read actual source code (not just metadata)
  • Generate working code patches (unified diff format)
  • Build and compile the patched code
  • Run 3 scanner passes to verify the fix is effective and introduces no regressions
  • Create a Change Request for CCB approval
  • Route dual PRs: one to the compliance vault, one to the customer's staging branch

Does not:

  • Deploy to production (requires CCB approval and human review)
  • Fix all finding types (structural refactors and PS/PE/AT controls require human work)
  • Guarantee fixes for proprietary or obfuscated codebases
  • Work without write access to the repository

The 11-Step Pipeline

These steps are derived from the orchestrator source. Every step is logged to remediation_job_steps in the database.

StepNameDescription
1fetch_sourceDownloads the repository tarball at the base branch commit SHA
2detect_build_unitsDetects all build systems in the repo (workspace-aware, recursive)
3resolve_image_digestsResolves container image tags to SHA-256 digests from registries
4stage1_scanRuns all 7 scanners against base source to establish finding baseline
5claude_analysisSends findings + affected file contents to claude-opus-4-8 for analysis and patch generation
6apply_fixApplies the generated unified diff to produce the patched source tree
7build_verificationCompiles/builds the patched code; self-heals up to 3 times on build failure
8stage2_scanRuns scanners against patched source to verify the target finding is gone
9stage3_scanFinal scanner pass to confirm no regressions introduced by the fix
10rampart_gate_checkRuns RAMPART gates against the sandbox branch to verify gate compliance
11create_change_requestCreates a CCB Change Request; moves job to awaiting_approval status
ℹ️

Step 7 (build verification) can repeat as self_heal_1, self_heal_2, self_heal_3 if the initial build fails. The AI is given the build error and generates a corrected patch. After 3 failed attempts, the job fails rather than proceeding with an unverified patch.

The 3 Verification Stages

The ARE applies the "fail-closed" principle: a fix that cannot be fully verified is not promoted to a Change Request.

StageWhenWhat is checked
Stage 1Before patchBaseline scan — establishes what findings exist in the original source
Stage 2After patchVerifies the target finding is absent from the patched source
Stage 3Final passConfirms no regressions — no new findings introduced by the fix

If Stage 2 or Stage 3 fail, the job status is set to failed and a failure reason is recorded. No Change Request is created.

The 7 Scanners

All scanners run in parallel within each stage. Scanner output is normalized to a common schema before comparison.

#ScannerTypeNIST Controls
1GrypeSCA / CVESI-2, RA-5
2SemgrepCode security patternsSI-10, IA-5, SC-28
3OSV-ScannerCross-ecosystem vulnerabilitySA-12, SR-4
4TrufflehogSecrets in sourceIA-5, CM-6
5Native auditLanguage-native (npm audit, pip-audit, govulncheck, cargo audit, bundler-audit)SI-2, RA-5
6CheckovIaC misconfigurationCM-6, CM-7
7TrivyContainer / IaC vuln + configSI-2, CM-6

All 7 scanners run in parallel. A scanner that times out or is unavailable logs a warning and yields zero findings — it does not fail the job. Grype always runs and cannot be disabled.

Build System Support

The ARE auto-detects build systems using recursive manifest discovery:

LanguageBuild SystemVerification command
JavaScript / TypeScriptnpm, yarn, pnpmnpm install && npm run build
Pythonpippip install -r requirements.txt
Gogogo build ./...
RustCargocargo build
RubyBundlerbundle install
JavaMaven, Gradlemvn package / gradle build
C#.NETdotnet build

Workspace-aware discovery handles monorepos — each build unit is identified and built independently.

Fix Strategy Types

The AI selects one of six fix strategies based on finding type:

StrategyWhen used
version_bumpDependency with a fixed version available
code_fixCode-level vulnerability (injection, hardcoded secret, etc.)
config_changeIaC misconfiguration
dependency_removalUnused or unmaintained dependency
secret_rotationHardcoded credential (removes from source; rotation still required)
structural_refactorComplex architectural issue (confidence threshold must be met)

Job Lifecycle

Job created (status: pending)


status: scanning  (Steps 1–4)


status: analyzing  (Step 5)


status: patching  (Steps 6–7)


status: verifying  (Steps 8–10)


status: awaiting_approval  (Step 11 — CCB Change Request created)

      (CCB approves)

Dual PR routing:
  → Compliance vault internal PR (evidence)
  → Customer staging branch PR (code)

Fail-Closed Behavior

If any step fails, the job moves to failed status with a failure_reason. Failure reasons are logged to both remediation_job_steps and CHRONICLE. No code is pushed to any branch when a job fails.

Common failure reasons:

ReasonCause
no write access to repositoryGitHub App lacks write permissions
build verification failed after 3 attemptsThe AI could not generate a buildable fix
stage2 finding still presentThe fix did not actually remediate the target finding
stage3 regression detectedThe fix introduced a new vulnerability
job exceeded 30-minute total timeoutThe full pipeline exceeded the 30-minute budget

Change Control Board (CCB) integration

The ARE does not push code directly to any branch after verification. Instead, it creates a CCB Change Request and waits for approval. This is not a safety shortcut — it is the compliance-correct behavior under CM-3.

The Change Request created at Step 11 includes:

  • The finding being remediated (scanner, CVE ID or rule ID, severity)
  • The diff that will be applied
  • Stage 1, 2, and 3 scanner results
  • Build verification logs
  • Risk assessment generated by the AI
  • RAMPART gate check results for the sandbox branch

The CCB reviews these artifacts before approving. On approval, the ARE routes dual PRs.

Dual-PR routing and compliance significance

Every approved remediation creates two pull requests:

PRRepositoryBranchPurpose
Vault PRreaegis/compliance-vaultmainEvidence archival; Cosign-signed; permanent
Implementation PRCustomer repositoryBase branchActual code fix for human review and merge

Why two PRs?

The separation between compliance evidence and customer code is intentional. The vault PR preserves a signed, immutable record of the remediation — what was found, what was fixed, and when — regardless of what happens to the customer's repository. If the customer modifies the fix before merging, or does not merge it at all, the vault PR still documents that a working, verified fix was generated.

This separation satisfies CM-3(b) (which requires maintaining records of change requests and their disposition) independently of whether the change is applied.

Finding types the ARE can and cannot fix

Can fix autonomously:

Finding typeExampleARE behavior
SCA CVE with fixed version[email protected][email protected]Version bump in manifest; rebuild
Hardcoded secretAPI key in source fileRemoves from source; adds to secrets manager reference
IaC misconfigurationTerraform S3 bucket with public_read = trueConfig change to public_read = false
Dependency with known vulnerabilityrequests<2.32.2Version pin or removal if unused
Insecure code patternSQL query built with string concatenationParameterized query rewrite

Cannot fix autonomously (requires human work):

Finding typeWhy
PE/AT/PS control gapsNo source code to change; requires org process changes
Structural architectural findingsRisk of regression too high; confidence threshold not met
Secrets that have already been rotatedSource removal only; key rotation is out of scope
Proprietary/obfuscated dependenciesNo source available to analyze
STIG findings that require system-level changesCannot modify OS configuration

Confidence threshold

The ARE uses a confidence score (0.0–1.0) to decide whether to attempt a structural_refactor fix strategy. For all other strategies, it attempts the fix regardless of confidence. For structural_refactor:

  • Confidence ≥ 0.85: Attempt the fix
  • Confidence < 0.85: Report insufficient_confidence and exit gracefully without creating a PR

This threshold prevents the ARE from making large, complex code changes when it cannot reliably predict the outcome.

Prerequisites

  • REAEGIS GitHub App installed on the repository with write access
  • Repository has at least one build manifest (package.json, go.mod, requirements.txt, etc.)
  • Finding is of a type that the ARE can remediate (SCA CVEs, code patterns, IaC misconfigs, secrets)
⚠️

The ARE requires write access to push the sandbox branch and open pull requests. If the GitHub App installation does not have write access, the job fails immediately at Step 1 with "no write access to repository". This is intentional — the ARE does not work around missing permissions.

Monitoring ARE jobs

ARE jobs are visible in the Remediation tab of each finding. Each job shows:

  • Current status (pending, scanning, analyzing, patching, verifying, awaiting_approval, completed, failed)
  • Step-level logs for each of the 11 pipeline steps
  • Scanner output from all 3 stages
  • The generated diff (viewable inline before CCB approval)
  • Links to the sandbox branch and Change Request

Failed jobs include a failure_reason that explains which step failed and why. The most common failure reasons and their remediation:

Failure reasonAction
no write access to repositoryCheck GitHub App permissions; ensure Contents: Write is granted
build verification failed after 3 attemptsCheck if the repository has a working build locally; complex builds may need manual intervention
stage2 finding still presentThe scanner did not confirm the fix; check scanner output and fix manually
stage3 regression detectedThe fix introduced a new finding; review the diff and fix manually
job exceeded 30-minute total timeoutLarge repositories or complex builds; contact support

Related pages

Last verified: 2026-06-14 · Report an error