Code Humanization
Transform AI-generated code to match your personal coding style.
Overview
PhantomDev's humanization engine learns your personal coding style from your repository history and applies it back to AI-assisted output. This helps maintain your unique coding signature while using AI tools.
How It Works
The humanization engine analyzes your past commits to learn:
Naming Conventions
How you name variables, functions, and classes (camelCase, snake_case, abbreviations).
Comment Style
Your comment patterns, verbosity, and preferred documentation style.
Code Structure
Your preferred code organization and formatting patterns.
Line Cadence
Typical line lengths and code density patterns.
Using Humanization
Humanize Staged Files
phantomdev humanize
Humanize Specific Files
phantomdev humanize --files src/main.rs
Control Entropy Level
phantomdev humanize --entropy 0.7
Dry Run
phantomdev humanize --dry-run
Transformations
The humanization engine applies the following transformations:
Variable Renaming
Rename variables to match your personal naming conventions.
Comment Injection
Add or remove comments to match your style.
Code Restructuring
Reorganize code to match your preferred structure.
Entropy Injection
Add natural variation to avoid predictable patterns.
Entropy Levels
Control the intensity of transformations with the entropy parameter:
Examples
Before (AI-generated)
// This function processes user input data
// It validates the input and returns a result
function processUserData(userData) {
// Check if user data is valid
if (!userData || !userData.id) {
return null;
}
// Return the processed data
return {
id: userData.id,
name: userData.name,
processed: true
};
}
After (Humanized)
function handleUser(data) {
if (!data?.id) return null;
return { id: data.id, name: data.name, ok: true };
}