πŸ‘€ Written & Reviewed by Bill (Lead Editor) β€’ Aug 30, 2026 β€’ ai-code

SNAFU Review 2026: An LLM flow that fixes bad names in your code

SNAFU is an agentic LLM flow that helps you fix 'naming things' in source code. It computes a Name Ambiguity Number for each symbol and walks you through an agentic pipeline to replace ambiguous names with clearer ones.

SNAFU

What SNAFU Does

SNAFU (Symbol Name Ambiguity Fixer-Upper) is an agentic LLM flow for the classic hard problem: naming things. For each symbol in a file, it computes a Name Ambiguity Number (NAN) β€” a measurable score for how ambiguous the name is β€” then walks you through a pipeline to replace it with a clearer name, with a human confirming the real meaning along the way.

Key Features

  • Quantifies name quality via Shannon entropy / perplexity (NAN)
  • Human-in-the-loop confirms the real meaning before any rename
  • Drops non-improving candidates (NAN delta ≀ 0) and sanity-checks survivors
  • Multi-language via Tree-sitter: Python, Ruby, C#, Java, JS, TS, PHP, Rust, Go
  • Any-LLM support (LiteLLM-style) with a simple CLI

Who Should Use SNAFU

Engineers cleaning up legacy or AI-generated code where names like process_data or handle hide intent. Useful in code review prep and onboarding hygiene.

Pros and Cons

Pros

  • Turns β€œname quality” into a measurable number
  • Conservative: human confirms meaning, weak renames dropped
  • Broad language support via Tree-sitter

Cons

  • Requires Python 3.14+ and an LLM API key
  • Name scoring is an LLM heuristic, not ground truth
  • Not all symbols extracted β€” focuses on the most relevant

Pricing

Free and open source under MIT.

FAQ

How is ambiguity measured?

Each symbol is scored with no context; the model returns interpretation probabilities, and NAN = 2 ** Shannon entropy (perplexity). Lower is clearer.

Which languages are supported?

Python natively, plus Tree-sitter extraction for Ruby, C#, Java, JavaScript, TypeScript, PHP, Rust, and Go.

Explore the best AI Coding tools

Related Articles

Subscribe to the 9bests weekly β€” get the full list free

Hand-picked AI tool reviews and updates every week. Subscribe to receive this full list + 7 more quick-reference sheets (writing / image / video / audio / chat models / data / API cost).

Subscribe free & get it β†’

Independent reviews β€” ratings aren't influenced by vendor payments Β· double opt-in Β· unsubscribe anytime