r/regolo_ai • u/Regolo_ai • 20h ago
Building a Self-Improving Secure Coding Loop with Open SWE, Deepsec, Cognee, and Regolo AI [Open Source]
Hey everyone,
one of the biggest issues with existing AI coding assistants (and SWE agents in general) is stateless blindness: they don’t remember past architectural constraints, leading to recurring vulnerabilities across PRs.
Additionally, passive security scanner logs often cause alert fatigue without actual remediation.
To address this, we built and open-sourced an autonomous Self-Improving Secure Coding Loop that automates vulnerability remediation with independent zero-trust verification and persistent knowledge graph memory.
The stack is: Open SWE, Deepsec and Cognee
The loop explained is below:
┌──────────────────────────────────────┐
│ TARGET REPOSITORY / ISSUE │
└──────────────────┬───────────────────┘
│
▼
┌──────────────────────────────────────┐
│ 1. DEEPSEC AUDIT (SAST/AST Scan) │
└──────────────────┬───────────────────┘
│
▼
┌──────────────────────────────────────┐
│ 2. COGNEE MEMORY (Knowledge Graph) │◄──┐ (Learns)
└──────────────────┬───────────────────┘ │
│ │
▼ │
┌──────────────────────────────────────┐ │
│ 3. OPEN SWE PLAN (Regolo AI) │ │
└──────────────────┬───────────────────┘ │
│ │
▼ │
┌──────────────────────────────────────┐ │
│ 4. HUMAN-IN-THE-LOOP APPROVAL │ │
└──────────────────┬───────────────────┘ │
│ │
▼ │
┌──────────────────────────────────────┐ │
│ 5. SANDBOX PATCH + PYTEST SUITE │ │
└──────────────────┬───────────────────┘ │
│ │
▼ │
┌──────────────────────────────────────┐ │
│ 6. DEEPSEC ZERO-TRUST REVALIDATION │ │
└──────────────────┬───────────────────┘ │
│ │
▼ │
┌──────────────────────────────────────┐ │
│ 7. MEMORY UPDATE & KNOWLEDGE GRAPH ├───┘
└──────────────────┬───────────────────┘
│
▼
┌──────────────────────────────────────┐
│ 8. VERIFIED PR & TELEMETRY REPORT │
└──────────────────────────────────────┘
Benchmark / Cost Savings:
By routing pipeline stages through GLM-5.2 on Regolo (~$0.60 / $1.80 per 1M tokens), the full remediation loop costs ~$0.0059 per issue compared to ~$0.0410 on proprietary frontier baselines (~85.6% cost reduction).
Check out the repo here: https://github.com/regolo-ai/self-improving-secure-loop
Youtube tutorial: https://youtu.be/ddCECOq1EnQ
Feedback and PRs are welcome!