Inspiration

AI coding agents help teams ship faster, but that speed often comes with growing code bloat. A recent study evaluating 15 coding agents found that, compared with 473 open-source Python repositories, agent-generated code was 2.3× more verbose, had 20+ repetition patterns: https://arxiv.org/abs/2603.24755

Agents frequently generate redundant helpers, defensive branches, and edge-case logic that may never run in production. Static analysis can identify suspicious code, but it cannot prove whether a path is actually unused. We built RuntimE.Razor to give coding agents real runtime evidence, so they can remove dead code with confidence instead of guessing.

What it does

RuntimE.Razor is a Python library that uses AST analysis to instrument every logical branch in a service. It builds a complete execution graph and reports whenever a node is executed, along with its module, file, and exact line range. By collecting this telemetry which nodes have and have not been executed. A dedicated agent skill then reads the report, analyzes the unused paths, and helps coding agents identify and safely remove dead code. Principles of RuntimE.Razor

We built a coding agent skill that uses runtime context to safely remove more than 400 lines of dead code (https://github.com/OpenAI-Hackathon-ZSH/RuntimeSpy/pull/11), while a standard coding agent without this runtime context removed only four lines (https://github.com/OpenAI-Hackathon-ZSH/RuntimeSpy/pull/2).

How we built it

We built RuntimeSpy as a Python library that uses AST analysis to instrument every logical branch during compilation, creating a complete execution graph of the service. Whenever a node runs, it reports its usage together with the module, file, and exact line range.

We integrated RuntimeSpy into an e-commerce demo service and built the RuntimE.Razor backend and playground to generate traffic, collect telemetry, and visualize used and unused nodes. The system then produces a report of never-executed code paths, which a dedicated agent skill uses to help coding agents identify and safely remove dead code. Architecture

We used Codex and GPT-5.6 to build the project across three separate codebases, running three Codex sessions in parallel so we could develop them simultaneously. GPT-5.6 light mode handled fast iterations such as UI and copy changes, while Codex-5.6 advanced mode handled complex work including AST instrumentation and system-wide refactoring with deeper reasoning and high accuracy.

Challenges we ran into

The hardest challenge was instrumenting Python code without changing its behavior. We had to correctly handle nested branches, asynchronous functions, exceptions, decorators, and different AST node types while preserving the original source structure.

Accomplishments that we're proud of

We built an end-to-end system that turns Python source code into a live execution graph, collects node-level runtime telemetry, and presents coding agents with exact dead-code candidates. Each unused node is linked to its module and precise line range, making the report immediately actionable. We are especially proud that the coding-agent skill can use this evidence to reason about deletion candidates instead of relying only on static analysis. RuntimE.Razor Monitor RuntimE.Razor Console RuntimE.Razor Panel

What we learned

We learned that coding agents become significantly more useful when they are given production context rather than only source code. Static analysis tells an agent what might happen, while runtime telemetry tells it what actually happened. We also learned that AI coding tools work especially well when several sessions are used in parallel across clearly separated codebases, with lighter models handling fast iterations and deeper reasoning models handling architectural work.

What's next for RuntimE.Razor

Next, we plan to expand RuntimE.Razor beyond Python and support more programming languages. We also want to fully automate the cleanup workflow, allowing RuntimE.Razor to generate minimal code-simplification pull requests from runtime evidence.

Longer term, coding agents could learn from these reports, identify recurring over-building patterns, and adapt to each project’s architecture and coding style. This feedback loop would help agents generate leaner code over time, turning RuntimE.Razor into a foundation for self-improving coding agents.

Built With

+ 3 more
Share this project:

Updates

Submission history