Skip to content

🎭 [FEATURE] Personality-Driven Code Voice β€” AI That Writes Code in the Style of Legendary ProgrammersΒ #17

Description

@MindFuq001

Overview

Every great programmer has a voice β€” a distinctive way of naming things, structuring logic, handling errors, and leaving comments. This feature allows opencode-android to generate code in the stylistic voice of legendary programmers, historical movements, or even your own past self.


The Concept

Code style is more than formatting. It's a fingerprint of thought. Linus Torvalds writes brutally direct C with contempt for abstraction. John Carmack writes obsessively performance-conscious loops that read like machine poetry. Grace Hopper wrote with military precision and extraordinary clarity for its time.

The Code Voice Engine (CVE) learns and applies these stylistic voices to any code generation task.


Available Voices (V1)

Voice Style Characteristics Best For
Pragmatist Gets it done, minimum abstractions, readable Prototypes, MVPs
The Purist SOLID, DRY, clean interfaces, pattern-perfect Long-term codebases
The Berserker Raw performance, zero allocations, bit manipulation Games, audio, graphics
The Poet Self-documenting code, beautiful naming, prose-like comments SDKs, libraries
The Paranoid Defensive everywhere, null-checks, bounds validation Financial, medical apps
The Rebel Breaks conventions creatively, unconventional but brilliant Experimental projects
Your Past Self Learned from YOUR commit history Consistency across time

Technical Implementation

Style Vector Extraction

Each voice is encoded as a style vector across 24 dimensions:

data class CodeStyleVector(
    val abstractionPreference: Float,      // 0=concrete, 1=abstract
    val functionLengthBias: Float,         // 0=short, 1=long
    val commentDensity: Float,
    val errorHandlingStyle: ErrorStyle,    // THROW / RETURN_NULL / RESULT_TYPE / SILENT
    val namingVerbosity: Float,            // 0=terse (n, i, x), 1=verbose (userAccountId)
    val immutabilityBias: Float,           // 0=mutable, 1=val-everywhere
    val patternUsage: PatternProfile,      // how often design patterns are applied
    val cycleComplexityTarget: IntRange,   // preferred McCabe complexity range
    // ... 16 more dimensions
)

Your Past Self Voice

The most personal feature: CVE analyzes your last 500 commits to extract your personal style vector. Then, even if your coding style has drifted over years, it can generate new code that sounds like you at your best.

fun learnFromCommitHistory(commits: List<Commit>): CodeStyleVector {
    val styleObservations = commits
        .flatMap { it.changedFiles }
        .filter { it.language == Language.KOTLIN }
        .map { StyleAnalyzer.extractVector(it.diff) }
    return StyleVectorAggregator.weighted(
        observations = styleObservations,
        recencyBias = 0.3f  // recent commits weighted higher
    )
}

UI Design

  • Voice Selector Dial: A circular dial in the toolbar lets you blend between any two voices in real time (e.g., 70% Purist + 30% Berserker)
  • Live Preview: As you adjust the dial, a sample function re-renders in real time to show how the voice change affects output
  • Voice Snapshot: Save a custom blended voice and share it with your team as a .codevoice config file
  • Voice Drift Alert: If the AI detects your actual code is drifting away from your chosen voice, it gently notifies you

Acceptance Criteria

  • All V1 voices produce measurably distinct code across 5+ style dimensions
  • Voice blending dial updates live preview in < 500ms
  • "Your Past Self" analysis processes 500 commits in < 30 seconds
  • .codevoice files are portable and importable by teammates
  • Voice selection persists per-project, not globally
  • Accessibility: voice names are descriptive, not requiring prior coding culture knowledge

"You don't just write code. You write in a voice. Now you can choose it deliberately."

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions