Published June 6, 2026 | Version 2.0.0

CodeTruth Agent V2: A Deterministic Pre-Modification Governance Layer for Python Code Changes

Authors/Creators

Description

CodeTruth Agent V2 is an open-source deterministic governance layer for Python code changes. The system analyzes candidate Python function pairs using semantic similarity and behavioral analysis, producing SAFE, REVIEW, or BLOCK governance decisions before any code modification is attempted.

V2 extends V1's rule-based safe-merge reasoning with three analysis stages: semantic similarity scoring via local sentence-transformer embeddings, AST-based behavioral signature classification across ten operation categories, and multi-signal fusion with opposing-behavior detection. No large language model participates in the governance decision path; all decisions are deterministic, explainable, and reproducible.

Evaluation Results:

The system was evaluated on eight open-source Python repositories:

• 7,862 files analyzed.
• 1,241 function-pair analyses.
• 0 pipeline errors across all evaluation runs.
• 4 opposing-behavior detections, all classified as GENUINE.
• 60% of sampled BLOCK decisions classified as governance-significant.

Key Contribution:

A 14-pair precision audit introduces a three-category classification of BLOCK decisions: governance-significant distinctions, family-pattern noise, and embedding-model limitations. This characterization documents both the governance value of V2's detections and the structural sources of over-flagging.

Code and Data:

Full source code, evaluation reports, reproducibility instructions, and supporting documentation are available at:

https://github.com/Zeeshan78699/CodeTruthAgent

License: GPL-3.0:

Keywords: software engineering, code governance, semantic analysis, behavioral analysis, repository intelligence, deterministic systems, AI governance, static analysis, Python.

Files

codetruth_v2.pdf

Files (281.5 kB)

Name Size Download all
md5:08d516fb2ad15ddfdc1778b77c482b8b
243.2 kB Preview Download
md5:78020e38b6bde9d4930760bdfefa25c0
38.3 kB Download

Additional details

Related works

Is supplement to
Software: https://github.com/Zeeshan78699/CodeTruthAgent (URL)

Dates

Available
2026-06-06
Initial publication

Software

Repository URL
https://github.com/Zeeshan78699/CodeTruthAgent
Programming language
Python
Development Status
Active