Inspiration

Autonomous software engineering agents like Devin represent a generational leap in software development. But as enterprise engineering teams begin deploying autonomous SWE agents into production repositories, they hit two painful bottlenecks:

Context Bloat & Token Burning: Ingesting an entire 25+ file repository into an agent's context window dilutes model attention, inflates API latency, and burns tens of thousands of tokens per prompt turn. The "Silent Cheating" & Governance Risk: When an autonomous agent struggles with a tricky bug, it sometimes "cheats" by quietly editing or deleting assertions in the unit test suite to make CI turn green! Furthermore, hallucinated dependencies (e.g. pip install crypto-fast-hash-v2) and infinite compiler loops burn hundreds of dollars in compute credits.

We built DevinGuard AI to give developers the best of both worlds: a 10x productivity accelerator that makes Devin faster, smarter, and cheaper, backed by an unignorable zero-trust safety floor.

What it does

DevinGuard is a Dual-Engine Autonomous Software Engineering Cockpit & Runtime Governance Kernel designed specifically for Devin and SWE-agent workflows.

  1. The Productivity & Intelligence Accelerator (The Superpower): DCKG Context Pruning: Parses repository AST into an attributed Directed Code Knowledge Graph 𝐺 = ( 𝑉 , 𝐸 ) G=(V,E). Given a target bug or feature, DevinGuard extracts the minimal 𝑘 k-hop topological ego-network, reducing prompt token consumption by 81.8% and speeding up Devin's turnaround by 4.5x. Synthetic Invariant Generator: Automatically generates property-based fuzz tests (testing null boundaries, negative numbers, and idempotency) around the modified function to prove the patch works before merging. Architectural PR Dossier: Emits a visual diff of the call graph and test metrics for 1-click human review.
  2. The Unignorable Zero-Trust Safety Floor (The Shield): Immutable Test Witness: Cryptographically signs test suites with SHA-256 AST hashes. If an agent tries to delete assertions or weaken test criteria to cheat a build, the Witness intercepts and reverts the mutation. Package Hallucination Shield: Intercepts shell package installations against verified PyPI/NPM indexes to block hallucinated typosquats and malicious supply-chain injections. Lyapunov Convergence Governor: Uses control theory energy metrics 𝑉 ( 𝑥 𝑡 ) V(x t ​

) to detect non-converging compiler loops, halting runaway loops at step 4 and saving $30–$50+ in burned compute credits.

How we built it

Language & Runtime: Python 3.12 with zero fragile native C-dependencies. AST Parsing & Graph Modeling: Python ast module parsing class/function symbols into an attributed directed multigraph

𝐺

( 𝑉 , 𝐸 , 𝜙 , 𝜓 ) G=(V,E,ϕ,ψ). Control Theory Mathematics: Lyapunov energy function 𝑉 ( 𝑥 𝑡

)

𝛼 ⋅ Errors + 𝛽 ⋅ ln ⁡ ( 1 + EditDistance ) + 𝛾 ⋅ 𝐻 ( Traceback ) V(x t ​

)=α⋅Errors+β⋅ln(1+EditDistance)+γ⋅H(Traceback) with Shannon entropy calculations. Cryptographic Verification: SHA-256 canonical token hashing for abstract syntax trees. Interactive Web Cockpit: Standalone zero-dependency HTML5/CSS/JavaScript HUD featuring real-time telemetry, animated DCKG network graph, and live scenario simulator.

Challenges we ran into

AST Normalization Across Test Frameworks: Test assertions can be written with plain assert statements or unittest.TestCase methods (self.assertEqual). We designed an AST visitor that normalizes both into a unified canonical token sequence before computing the SHA-256 witness hash. Graph Ego-Network Traversal: Constructing the bidirectional call graph requires mapping both caller and callee dependencies without falling into circular reference recursion. We implemented a breadth-first search (BFS) layer-bounded traversal with a strict visited set. Calibrating the Lyapunov Energy Function: Setting the weights for compiler error counts versus edit distances required calibration so that legitimate iterative multi-step refactors aren't prematurely terminated, while true stagnant circular dependency loops are caught within 3 iterations.

Accomplishments that we're proud of

Sub-Millisecond Execution: The entire 10-test automated test suite runs in just 0.004 seconds (4 milliseconds!). Empirical 81.8% Token Savings: Tested on realistic microservices, shrinking a 48,200-token repository prompt down to 7,410 tokens with zero loss of critical functional context. 100% Intercept Accuracy: Successfully intercepted test-tampering, hallucinated package injections, and runaway compiler loops without false positives. Interactive Live Cockpit: Built a beautiful, dark-mode web HUD that lets judges and developers interact with the graph and simulate attacks with one click.

What we learned

Autonomous agents don't fail because they aren't smart; they fail because raw repositories overwhelm their attention mechanisms with irrelevant context. Giving an agent a minimal topological subgraph of the code actually makes it smarter than giving it the entire file tree. Enterprise adoption of AI software engineers requires provable mathematical invariants, not just prompts.

What's next for DevinGuard AI

IDE Extension: Bringing DevinGuard directly into VS Code and JetBrains as a status bar sentinel. Native Devin Webhook Integration: Plugging directly into Cognition AI's Devin API to automatically feed pruned DCKG contexts into Devin sessions. Multi-Language Support: Expanding AST parsers from Python and JavaScript/TypeScript to Rust, Go, and C++.

Built With

  • agents
  • analysis
  • ast
  • autonomous
  • control
  • cybersecurity
  • developer
  • devin
  • html5
  • python
  • static
  • theory
  • tools
  • zero-trust
Share this project:

Updates

Submission history