
Problem: When AI assistants like IBM Bob automatically refactor legacy code, they have no awareness of how risky a file is. A module coupled with a dozen other services, with 12% test coverage, and untouched for four years carries enormous blast radius — yet most AI tools treat it the same as a freshly written utility function. Solution — Alcy Legacy Guardian: a Bob Skill that enforces a risk checkpoint before any modernization is dispatched. It performs three fully implemented static analyses on Python source code: (1) an AST-based dependency and coupling scanner that detects imports, function calls, and unresolved global variables; (2) a test coverage detector that discovers pytest and unittest test files and computes a coverage ratio; and (3) a git commit-age inspector using subprocess git log with filesystem mtime fallback. These feed a weighted scoring formula (0–100) that classifies code as low, medium, or high risk and generates architectural blockers. When risk exceeds 70, the skill automatically generates a characterization test suite that dynamically executes the original code in an isolated scope and freezes real return values as pytest assertions — preventing AI regressions. After the safety harness is in place, the skill calls IBM watsonx.ai (Granite 3 8B Instruct) to produce modernized Python 3.12 code with PEP 484 type annotations, validates the output with ast.parse, and returns a unified git diff. Target users are engineering teams managing aging Python codebases. They interact through a React + TypeScript dashboard backed by a Node.js/Express gateway (auth, job lifecycle, PostgreSQL) and the FastAPI AI microservice — two fully implemented, independently running services.
27 Sep 2026