Skip to content
RAKSHAK

RAKSHAK

closing the gap between detection and remediation.

Created on 8th March 2026

•

RAKSHAK

RAKSHAK

closing the gap between detection and remediation.

The problem RAKSHAK solves

Modern software teams are buried under a flood of security alerts. Static analysis tools like Semgrep can scan a codebase in seconds and surface dozens — sometimes hundreds — of vulnerabilities. But finding a bug and fixing it are two very different things.

Today, the typical remediation workflow looks like this:

A scanner flags a vulnerability.
A developer is assigned to investigate it.
They context-switch out of their current work, read the alert, trace the code, understand the flaw, write a fix, test it, and push a PR.
Repeat — for every single alert.
This gap between detection and remediation is where real risk lives. Every day a vulnerability sits unpatched is another day it can be exploited.

RAKSHAK closes that gap. It doesn't just detect vulnerabilities — it automatically heals them. Using a combination of static analysis (Semgrep) and a large language model, RAKSHAK:

Clones the target repository
Scans it for security vulnerabilities
Sends each bug to an AI model with surrounding code context
Applies the AI-generated patch back to the source file
Re-scans to verify the fix actually worked — retrying up to 3 times per bug type
What previously took a developer hours per vulnerability now happens autonomously in minutes, with a real-time dashboard to track every fix.

Challenges we ran into

Challenge 1 — Figuring Out How to Send Bugs to the AI
One of the earliest and trickiest problems was deciding what to actually send to the AI model when asking it to fix a vulnerability.

My first instinct was to send the entire source file. But that approach hit walls fast — large files blew past token limits, the model would get distracted by unrelated code, and responses were slow and inconsistent.

The breakthrough came when I landed on the context window pattern: instead of the full file, I extract only a ±20 line window around each vulnerability — just enough code for the AI to understand what's happening, without overwhelming it. Overlapping windows from nearby bugs in the same file are merged into a single, clean chunk.

This approach has real, concrete benefits:

🎯 Precision — The AI focuses only on the relevant code, producing more accurate and targeted fixes.
⚡ Speed — Sending ~40 lines instead of hundreds (or thousands) dramatically reduces inference time.
💰 Token Efficiency — Fewer tokens per request means lower API costs and fewer rate-limit issues.
🔁 Reliability — Smaller, focused prompts are far less likely to confuse the model or cause hallucinated changes to unrelated parts of the code.
🔗 Merge Logic — When multiple bugs are close together in the same file, their windows are intelligently merged, so the AI sees the full relevant region in one go rather than receiving fragmented, overlapping requests.
This pattern — surgical context extraction over full-file dumps — became a core design principle of the pipeline.

Challenge 2 — Running Out of Gemini API Credits
The initial version of RAKSHAK used the Google Gemini API as its AI backbone. It worked well — Gemini is fast and capable — but there was a painful catch: API credits ran out fast.

Running a full remediation loop on even a moderately vulnerable codebase could trigger dozens of AI calls. Each retry, each re-scan, each re-attempt consumed credits. During development and testing, I kept hitting the rate limit wall, which would halt the entire pipeline mid-run. This made iterating and demoing the project frustrating and unreliable.

The fix? Go open source and free.

I switched to CodeQwen, a code-specialized open-source LLM, running on Kaggle's free GPU environment (T4 / P100). The model is loaded inside a Kaggle notebook and exposed as a local API endpoint using ngrok, which tunnels it to a public URL that RAKSHAK can call just like any other REST API.

The benefits of this shift were significant:
Zero API cost — Kaggle provides free GPU compute, so there are no per-request charges.
No rate limits — The model runs on hardware I control (within Kaggle's session), so there's no throttling or quota exhaustion mid-demo.
Code-specialized model — CodeQwen is trained specifically on code, making it well-suited for security patch generation.
Drop-in compatible — The switch required only changing the endpoint URL and request format in
healer.py
; the rest of the pipeline stayed untouched.
Flexible — The architecture still supports Gemini as a fallback, so either model can be used depending on the environment.
This change made the pipeline genuinely free to run and demo — no credit card, no quota anxiety, no surprise rate limits.

Discussion

Builders also viewed

See more projects on Devfolio