Multi-Agent Code Refactor & Audit Crew
Legacy code to audit-ready remediation
Modernising legacy code usually starts with an audit. This build runs the deterministic analysis in plain Python, then uses a three-agent crew to refactor the code, write tests and prepare a pull request that a human reviews before merge.
Benefits
Low, predictable cost
Parsing and the 17-rule scanner need no model. Only three model calls are made per run.
Compliance mapping
Findings map to NIST CSF, OWASP and CWE so they can feed audit evidence.
Review-ready output
Refactored module, pytest suite, git diff and a PR description with an approval checklist.
Extensible
Add your own rules and plug the crew into CI.
How it works
- 1.Parse the file (AST) and score technical debt
- 2.Scan with 17 security rules (CWE-mapped)
- 3.Agent 1 analyses, Agent 2 refactors, Agent 3 writes tests
- 4.Generate diff and PR description
- 5.Human sign-off for security, engineering and compliance
How to use it
Install
pip install -r requirements.txtRun the offline tests
pytest testsRun the crew on the bundled demo file
python main.pyRun on your own module
python main.py path/to/legacy_module.pyOffline demo: security scanner on the bundled demo file
Captured from a real run of the scanner only, which needs no API key. The full crew run (refactor, tests, PR) requires your own LLM API key (OpenAI by default, Anthropic Claude supported) and is not shown here.
scan of mini_auth.py (no model used)
total=12 critical=7
SEC-002 CWE-798 Critical
SQLI-001 CWE-89 Critical
DESER-001 CWE-502 Critical
CMD-001 CWE-78 Critical
CMD-002 CWE-78 Critical
CMD-002 CWE-78 Critical
SQLI-002 CWE-89 Critical
SEC-003 CWE-798 High
CRYPTO-001 CWE-327 High
NET-001 CWE-295 High
CRYPTO-003 CWE-338 Medium
ERR-001 CWE-390 MediumRead the results honestly
- •The demo file is intentionally vulnerable and written for this build.
- •Refactored output is generated by a model and must be reviewed and tested by people before merge.
- •The full crew run (refactor, tests and PR) requires an LLM API key that you supply, set in a local .env file (OpenAI by default, Anthropic Claude supported), and makes live model calls. Only the scanner and parser run without one.
- •The crew has not been benchmarked on large codebases.
Reference build demonstrated on synthetic data, not a client deployment. Names of third-party products describe what the build runs on and do not imply endorsement or partnership.
Want this adapted to your environment?
We tailor it to your data, systems and approval process, and measure results on your own cases.
Talk to Us