Skip to main content

vibepiler

A compiler for vibe-coded software.

A compiler takes one program, parses it, builds a symbol table, lowers it to an intermediate representation, runs optimization passes over that IR, and emits output. Vibepiler does the same thing to a whole project: every file is parsed with tree-sitter, every definition, import, call and reference is linked into one program graph, and a set of passes then finds what a compiler would prune: dead code, duplicated bodies, pass-through wrappers, cycles, one-implementation interfaces, declared-but-unused dependencies, swallowed exceptions, stubs.

It exists because software produced quickly with coding agents accumulates exactly that kind of bloat: helpers nobody calls, abstractions with a single implementation, three layers of indirection around one requests.get, dependencies added for one experiment. Software is deterministic, so this structure can be recovered mechanically and analyzed like a program.

Compiler phase Vibepiler Built on
lexing + parsing frontend/ parses every source file into a concrete syntax tree tree-sitter via tree-sitter-language-pack
symbol table + semantic analysis ir/builder.py extracts facts per file and links them across files (the "linker") tree-sitter trees + a scope-aware name resolver
intermediate representation ir/graph.py: a typed multigraph of modules, classes, functions, methods, variables, packages networkx
optimization passes passes/: dead code, duplicates, wrappers, cycles, complexity, hotspots, abstraction, bloat networkx algorithms + per-pass AST analysis
code generation backend/: JSON IR, DOT, Mermaid, interactive HTML, Markdown, terminal Graphviz-compatible DOT, cytoscape.js

Languages: Python, JavaScript/TypeScript (incl. JSX/TSX). Adding a language means adding one adapter file.

The program graph of vibepiler itself: modules as orbs sized by lines, a red wedge for the share of lines that could go, traffic moving along import and call edges, the size line in the header

report.html on vibepiler itself. Orbs are modules sized by lines; a red wedge is the share of a module's lines that could go; dots are import and call traffic; the header carries the size line: waste, tangle, bloat.

Quick start

You need uv (curl -LsSf https://astral.sh/uv/install.sh | sh). Nothing else: no clone, no install step. vibepiler is on PyPI, so pip install vibepiler works too.

# a project on disk (uvx vibepiler@0.4.13 pins a release)
uvx vibepiler compile path/to/project

# a repo on GitHub: owner/repo, owner/repo@branch, or any GitHub / git URL
uvx vibepiler compile igaurab/gpython

# the project you are standing in
cd my-vibe-coded-app && uvx vibepiler compile .

Using a coding agent? Add vibepiler to your harness: /plugin marketplace add NISH1001/vibepiler in Claude Code, then /vibepiler:compile.

Choosing what to compile

Name folders or files after the source to report on just those parts, and leave paths out with --exclude:

# two folders of a GitHub repo, without its migrations
uvx vibepiler compile owner/repo api/ services/ --exclude alembic/

# a GitHub folder link compiles that folder
vibepiler compile https://github.com/owner/repo/tree/main/frontend

# local folders work the same way; --exclude takes commas and repeats
vibepiler compile . backend/ api/ --exclude "**/gen/" --exclude scripts/

By default the whole source is still read and only the named paths are scored and reported. That is how a compiler builds one unit against the whole program: a route registered in main.py, or a function in services/ that only workers/ calls, is still alive when you name api/ services/. Add --isolate to read the named paths alone: it is faster, but anything that reaches them from outside is not seen. On one real monorepo, api/ services/ scores 3.7% waste; with --isolate it scores 56.9%, because the routes are wired up in main.py. Naming main.py too gets most of that back.

If you will run it more than once, install the command:

uv tool install vibepiler                                     # or: pipx install vibepiler, or pip install vibepiler
vibepiler compile .                                           # then just this
vibepiler compile owner/repo -Wall                            # -Wall also shows the info-level findings

Where the output goes

Everything is written to a vibepiler-out/ directory in the directory you ran the command from (vibepiler-out/<repo>/ for a remote target). Change it with -o some/dir.

vibepiler-out/
├── report.html         the interactive viewer: open this first
├── report.md           every finding grouped by pass, each with a suggested action
├── ir.json             the whole program graph, findings and metrics, for scripts and agents
├── graph.dot           module dependency graph (dot -Tsvg graph.dot -o graph.svg)
├── graph-symbols.dot   symbol-level graph
└── graph.mmd           Mermaid module graph, pasteable into a GitHub issue
open vibepiler-out/report.html            # macOS; xdg-open on Linux

The terminal shows the phase-by-phase progress, the warnings (first 60), and a "what can go" table. The files always contain everything.

Remote repos are shallow-cloned into ~/.cache/vibepiler/repos/ and reused on the next run (--refresh re-clones, --cache DIR relocates). File paths in the report are relative to that checkout.

Reading the result

  1. The size line at the top of the terminal output and of report.html: waste is lines that could go, tangle is structure harder than its job, bloat combines them. live is the share of definitions (locals, parameters, attributes, symbols, imports) that something reads, with the dead ones counted by kind. Lead with the lines, not the percentage.

  2. report.html → Overview: the "what can go" tiles, the entry points, and "Biggest wins". Orbs with a red wedge are modules with removable lines; click one for its findings and its own bloat block. Trace follows execution outward from any node:

    A trace from the CLI module: reached modules lit amber, dashed paths with moving particles, the rest dimmed

  3. Findings tab (or report.md): filter by pass and by finding type; the graph lights up the matches and "only flagged" isolates them. dead-code, duplicates, wrappers and abstraction remove the most lines per decision; cycles, complexity and hotspots tell you what is risky to touch.

  4. Semantic tab (-O3): every function on one map placed by meaning, coloured by health or by any measure with a live threshold, with calls flowing and copies tied together.

  5. Link tab: how much of the call graph was proven. A low "linked" percentage means dynamic dispatch; dead-code results stay safe (they are conservative), but there are fewer of them and the size line says how many lines are alive only by name.

Five ways to use it

1. Audit a repo you did not write. One command, no install, read the size line and the Findings tab.

uvx vibepiler compile owner/repo -O3

2. Shrink a codebase with the elimination loop. -R prints the plan, one edit per line with the lines it frees and how sure the tool is. Apply the top one, re-run against the previous ir.json, repeat until nothing moves.

vibepiler compile . -R -q                                   # the plan
# ...apply the top remark...
vibepiler compile . -R -q --baseline vibepiler-out/ir.json  # what moved

3. Let your coding agent do the loop. Every remark carries the file, the line, the action and a suggestion, so the plan is a to-do list an agent can execute. The plugin teaches Claude Code (and any agent that reads skills) to run it as /vibepiler:cleanup; without it, a prompt that works:

Run vibepiler compile . -R -q. Apply the first remark that is proven or inferred, run the tests, then re-run vibepiler with --baseline and show me what moved. Stop when the plan is empty or a remark looks wrong, and tell me which.

The tool never rewrites code itself; the agent or you do, and the next run checks the result.

4. Gate it in CI. Fail on severity, or on the score:

vibepiler compile . --fail-on warning -q
vibepiler compile . --fail-on bloat>0.25 -q
vibepiler size .                                   # the per-folder size report, for a PR comment

5. Script it. ir.json holds the whole graph, every finding and every metric; the Python API below gives the same objects in-process, including Bloat.of(node).

Develop on it

git clone https://github.com/NISH1001/vibepiler && cd vibepiler
uv sync
uv run vibepiler compile path/to/project
uv run pytest

The CLI (deliberately compiler-shaped)

vibepiler compile <path | owner/repo[@ref] | git url> [paths...] [-O0|-O1|-O2|-O3] [-W all|warning|error]
                         [--emit json,dot,mermaid,html,md] [-o out/] [--only pass,pass] [--skip pass]
                         [--exclude "glob,glob"]... [--isolate] [--lang python,typescript]
                         [--fail-on warning|error|bloat>0.25|live<0.9] [-q] [-v|--verbose]
                         [-R] [--baseline previous/ir.json] [--cache DIR] [--refresh]
                         [--max-tokens N] [--no-cache] [--model NAME]         # -O3 embedding: token cap, skip the cache, model
vibepiler size    <path> [paths...] [--exclude ...] [--isolate] [-O1|-O2|-O3] [--top N] [--max-tokens N] [--no-cache] [--model NAME]   # waste, tangle and bloat per folder
vibepiler graph   <path> [paths...] [--exclude ...] [--isolate] [--level module|symbol] [--format dot|mermaid|json] [--packages]
vibepiler paths   <path> --from <symbol> [--to <symbol>] [--depth N]
vibepiler similar <path> <symbol> [-n 10] [--max-tokens N] [--no-cache] [--model NAME]   # -O3 tier: nearest by meaning (functions, classes or modules)
vibepiler passes
  • -O0 builds the graph only. -O1 runs the linear passes. -O2 (default) adds the quadratic ones (duplicate detection). -O3 adds the embedding tier (see below).
  • -W is the minimum severity printed to the terminal. -Wall shows info findings. Everything is always in ir.json/report.md.
  • -v / --verbose prints what every stage is doing as it runs: the config file and settings in force, the files read and skipped (ignored, too large, unreadable), parse and link times with how many call sites were linked, each pass with its memory, the model load, how much of the embedding cache was reused, every embedding batch (functions, longest one, seconds, memory), and each file written with its size. Without it, a single line counts the embedding progress and disappears when the pass finishes. Logging goes through loguru and, as a library, vibepiler is silent until asked: from Python, Compiler(..., verbose=True) or vibepiler.compile(..., verbose=True) for one compile, from loguru import logger; logger.enable("vibepiler") for everything, or set VIBEPILER_DEBUG=1 to print every step to stderr. The embedding cache (~/.cache/vibepiler/embeddings/, one file per model and token cap) keeps what a run embeds: every 30 seconds it checkpoints the new vectors to a small part file of its own, and at the end merges everything into the shared file once, so an interrupted -O3 picks up where it left off and a big cache is not rewritten every half minute. Vectors cached under another cap are reused for functions too short for either cap to have cut.
  • --no-cache embeds every function afresh at -O3, reading nothing from the embedding cache and writing nothing to it (embedding_cache = false in config, use_cache=False from Python). To re-clone a remote repo instead, use --refresh.
  • The run ends with the folder and full path of every file it wrote, the HTML report first.
  • -R prints the missed-optimization remarks (after clang's -Rpass-missed): the elimination plan, one line per edit with the lines it frees and how sure the tool is.
  • --baseline previous/ir.json prints how waste, tangle and bloat moved since an earlier run. That is the loop: apply the top remark, re-run, repeat.
  • --fail-on warning, --fail-on bloat>0.25, --fail-on live<0.9 or any metric (cognitive>0.1, typed<0.8) makes it a CI gate.
  • paths... after the source are the folders or files to report on; --exclude (old name --ignore) leaves gitignore-style patterns out; --isolate reads the named paths alone. See Choosing what to compile.

What each tier does:

tier passes what it can tell you
-O0 none the program graph only: modules, symbols, imports, calls, inheritance, references
-O1 entry-points, dead-code, unused-imports, cycles, complexity, measures, wrappers, hotspots, bloat-score everything that follows from reachability and structure in linear time
-O2 + abstraction, bloat, duplicates needless interfaces and classes, dependency and exception boilerplate, structurally identical and near-identical functions
-O3 + semantic-duplicates, responsibilities, concepts meaning: functions that do the same job with different code, modules mixing unrelated jobs, and the concept map of the whole codebase

The bloat score runs at every level above -O0 and reflects only the passes that ran; it says which level it was measured at.

  • paths prints execution pathways: the call tree from a symbol, or every shortest path between two symbols (vibepiler paths . --from app.main.cli --to app.utils._impl).

What a run looks like:

vibepiler 0.1.0 compiling /work/myapp
[1/4] frontend  parsed 212 files (python: 180, typescript: 32)
[2/4] semantic  212 modules, 1840 symbols, 6210 edges; 71% of 9300 call sites linked
      pass entry-points       0 findings  12 ms
      pass dead-code         63 findings   4 ms
      pass unused-imports    41 findings   1 ms
      pass cycles             3 findings   2 ms
      ...
[3/4] optimize  -O2: 241 findings (12 error, 119 warning, 110 info)
[4/4] emit      wrote graph.dot, graph.mmd, ir.json, report.html, report.md to vibepiler-out

warning dead-code/dead-symbol  src/app/utils.py:14: function `unused_fn` is dead: never called or referenced
        Delete it (8 lines).
warning abstraction/single-implementation  src/app/core.py:6: abstract class `Base` has exactly one implementation (`Impl`)
        Delete `Base` and use `Impl` directly; add the interface back when a second implementation exists.
...
                          what can go
┏━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━┓
┃ category              ┃ found                              ┃ action  ┃
┡━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━┩
│ dead code             │ 63 symbols, 1,204 lines            │ delete  │
│ duplicate functions   │ 9 groups (310 lines), 14 near pairs│ merge   │
│ pass-through wrappers │ 17 (2 chains)                      │ inline  │
│ needless abstraction  │ 11                                 │ flatten │
│ dependency bloat      │ 4 unused, 1 undeclared             │ prune   │
│ defensive boilerplate │ 6 swallowed, 9 redundant try, 5 stubs │ remove │
└───────────────────────┴────────────────────────────────────┴─────────┘

Outputs

File What it is
report.html Self-contained interactive viewer organized by compiler phase: Parse (every file and its parse status), Link (name resolution: the call-resolution breakdown, each module's binding table, member names that could only be matched dynamically), Program graph (a living map: modules are orbs sized by lines with a red wedge for the share of lines that could go, traffic moves along import and call edges, unreachable code is grey and still; the layout is fixed and toggles never move nodes; double-click a module to open it, click a node and Trace to watch execution flow at a speed you choose; a bloat ≥ slider hides everything scored below it, and the Findings filters, by pass and by finding type, decide which nodes "only flagged" keeps and light the matches up), Semantic (-O3: every function placed by meaning, coloured by health or any measure with a threshold slider; see below), Passes (every finding with its suggestion, click to jump into the graph). The header carries the size line: waste, tangle, bloat.
report.md Summary with the size line and bloat per folder, "what can go" table, entry points, hotspots, complexity, concepts, the elimination plan, then every finding grouped by pass with a suggestion.
ir.json The whole IR: nodes (with all computed attributes), edges, diagnostics, metrics. Feed it to anything.
graph.dot, graph-symbols.dot Graphviz: dot -Tsvg vibepiler-out/graph.dot -o graph.svg. Cycle edges are red, unreachable nodes dashed, flagged nodes get a colored border.
graph.mmd Mermaid flowchart of the module graph, pasteable into GitHub issues / READMEs.

How the semantic graph is built

This is the part that corresponds to a compiler's front half. It is name-based and deliberately conservative: when it cannot prove where a call goes, it says so rather than guessing.

  1. Discover (frontend/loader.py): walk the tree, honor .gitignore plus built-in ignores (node_modules, .venv, dist, minified files, ...), pick a grammar by extension.
  2. Parse: tree-sitter gives a full concrete syntax tree per file, error-tolerant, no build step required.
  3. Extract facts (frontend/languages/<lang>.py): one adapter per language walks the tree once and records, per file:
    • definitions (module, class, function, method, variable) with qualified names like Impl.run, lines, decorators, bases, parameters, export status;
    • imports in every form (import a.b, from .x import y as z, import x from './y', require(), re-exports, import_module("a.b") and pytest.importorskip("a") with a literal name), each marked when it is type-only (under if TYPE_CHECKING:);
    • call sites as attribute chains (requests.get, self.run, utils.helper) with the enclosing scope (which function they live in; module-level code is attributed to the module itself, which is how if __name__ == "__main__": and app.listen() show up);
    • references (non-call uses: decorators, arguments, JSX elements, base classes, type annotations, including names inside string annotations like "Path | None");
    • entry hints (main guards, @app.get, @click.command, test_*, Next.js route files, ...);
    • type hints (Python): what a name holds when the source says so: a parameter annotation (db: Database, Optional[Database], "Database | None"), an annotated or constructor assignment (db = Database()), a call to a function with a return annotation (db = connect() with -> Database, -> Self), a field (self.db = db, a class-body db: Database), a property's return type. A name given two different classes, or rebound by for/with, holds no known class.
  4. Index modules: each file gets a canonical module name (app.core, src/utils/math) plus aliases for the ways vibe-coded repos actually import things (src.app.core, @/utils/math). For JS/TS the project's own config is read too (no node_modules, no build): tsconfig/jsconfig paths and baseUrl (with extends, comments allowed); every package.json in the tree, so @acme/shared from a workspace sibling, or a package importing itself (zustand/middleware), resolves to the package's source even when its main points at dist/ (the same path without the build folder, then under src/). That import still counts toward the importer's declared dependencies; a self-import is not an undeclared one. The modules a package exposes (main, module, exports, its "./*" subpaths) are entry modules, and what they re-export (export * from, export { x } from, through any chain) is the package's API, as a Python package's __init__ re-exports are. A barrel inside an app (utils/index.ts) is not, and neither is a private package below the root (a workspace package only its siblings use, and they link to it). Files the project runs are entry points: bin, paths in scripts (tsx src/db/seed.ts), run: steps of .github/workflows/*.yml, and relative paths a tool config names (setupFiles: ['./setupTests.ts'] in vitest.config.ts).
  5. Create nodes: every definition becomes a node; contains edges nest module → class → method.
  6. Resolve imports: each import is tried against the module index (submodule first, then member of a package); on failure it becomes an external package node. This produces the per-module binding table: helper → symbol app.utils.helper, utils → module app.utils, requests → package requests, impl_alias → symbol app.utils._impl. Function-local imports get their own scope. Python parent packages are added as implicit imports (importing app.utils executes app/__init__.py).
  7. Resolve inheritance: base-class chains go through the same binding table → inherits edges.
  8. Resolve calls and references: for a chain like a.b.c(...) inside scope S of module M:
    • self/cls/this → the enclosing class, then member lookup through the class and its resolved bases;
    • a typed receiver (db.query() with db: Database, self.db.query() with self.db = Database(), client.get() with client = Client() at module level) → the member of that class. Static types are enough because reachability already does virtual dispatch: reaching Base.run reaches every override below it (class hierarchy analysis). Through a class with a base we cannot see (a Protocol, an ABC, a framework class) the method name also counts as used, since code that never inherits from it may stand in for it;
    • a name defined in S or in M → that symbol;
    • a module binding → extend the dotted path, take the longest prefix that is a real module, then look the rest up as symbols (following package __init__ re-exports);
    • a member binding → first as a submodule, then as a symbol of the target module;
    • a package binding → calls edge to the package node, with the member path (requests.get) kept on the edge. Exact hits become calls/references edges. Partial hits (Config.value(...), module.CONST) become references. Calls on values of unknown type (impl.run() where impl is a local) are not guessed; their member names go into graph.meta["used_member_names"], which later passes use to stay conservative (a method named run is never reported dead while anything in the project calls .run()).
  9. Attach metadata: resolution statistics, parse errors, import usage flags per module.

The whole thing is one networkx.MultiDiGraph with contains, imports, calls, inherits, references edges; graph.module_graph() and graph.call_graph() give you the views the passes (and you) work on.

What it does not do: type inference. It reads the types the source states (annotations, constructors, return annotations) and goes no further: an untyped parameter, a container's elements (list[Foo]), a choice (Foo | Bar), a call on a call (Q().where().all()), getattr, string-based imports and framework magic stay unresolved. The report prints the resolution rate so you know how much of the call graph is proven. On the evaluation corpus the typed linker moved it from 46–68 % to 50–84 % of call sites (rich 68 → 84 %, httpx 63 → 74 %, requests 62 → 69 %, flask 51 → 57 %, django 46 → 50 %), and the dead code it newly found there (3 symbols, each checked by hand) was all real.

How it "optimizes"

Vibepiler never edits your code. Each pass is the analysis half of a compiler optimization; the transformation half is you (or your agent) acting on the diagnostics. Every finding has a pass, a code, a severity, a location and a concrete suggestion.

Pass Compiler analogue What it finds Severity
entry-points program roots / reachability Roots: main guards, CLI commands, routes, tasks, tests, framework hooks, exports of entry modules, what a top-level Python package re-exports from its __init__.py (narrowed by __all__), a unittest.TestCase subclass in any file, asv benchmarks (time_*, mem_*, ... and their setup in benchmarks/), Django's templatetags/, management/commands/ and database backends (backends/<name>/base.py), a function handed to a decorator reached through an object (@app.template_filter("x"), @handlers.append; one reached through a module, like @functools.cache, is taken to wrap it), a top-level function or class named by a dotted string ("pkg.processors.debug" in settings), your entry_patterns. Then forward reachability over calls/references/imports/inherits, plus: a live class with a framework base keeps all its methods and so what they call (Textual's on_mount); a class the package exports keeps its public methods and its bases' (library API, requests.Session.post); a use of a base-class member reaches every override, including a method that overrides an attribute. Marks every node reachable and is_root. (metrics only)
dead-code dead-code elimination Symbols with no inbound call/reference and not reachable from any root (dead-symbol); symbols used only by dead code (unreachable-symbol); JS exports nothing imports (unused-export); modules nothing imports or runs (unreachable-module). Source code that only tests reach is reported apart as test-only (info): alive, so never counted as waste, but nothing the program runs uses it. Never flags dunders, roots, methods whose name is called anywhere, or overrides of external base classes. warning / info
liveness liveness analysis / dead-store elimination Inside every function body, a backward dataflow analysis to a fixpoint: stores no read reaches, whether never read or overwritten first (dead-store); trailing parameters never read (unused-param); statements after a return, raise, break or continue (unreachable-code); branches on a literal constant (dead-branch). Across the project: instance attributes written and never read by that name anywhere (unused-attribute). Exempts underscore names, destructuring siblings, placeholders before a read parameter, overrides, decorated functions, entry points, dunders, stubs, data classes and classes with an unknown base. warning / info
unused-imports unused declarations Import bindings never used in their file (respects __all__, __init__/index re-export files, import x as x). info
cycles dependency analysis Strongly connected components of the module import graph, with the weakest edge to break. Imports inside a function or under if TYPE_CHECKING: do not run at import time, so they never close a cycle. warning (error for 6+ modules)
complexity control-flow analysis Per function: cyclomatic complexity (counted as radon counts it), cognitive complexity (SonarSource), Halstead volume, difficulty and effort, the maintainability index, length, nesting and parameter count; attaches the numbers to every function node and flags the ones past their thresholds (high-cognitive-complexity, high-complexity, long-function, deep-nesting, too-many-params). warning / info
measures static metrics Rolls the metrics up from every function to its class, module, folder and the repo. none
wrappers inlining Functions whose entire body is one call to another project function (pass-through-wrapper when the arguments are forwarded unchanged, thin-wrapper otherwise) and chains of them (indirection-chain). Skips decorated functions, roots, and overrides. warning / info
hotspots critical-path analysis Fan-in/fan-out per module, god modules, PageRank-central functions, hub functions. warning / info
abstraction devirtualization / indirection removal Abstract classes with exactly one implementation (single-implementation), base classes with one subclass and no other use, abstract classes with none, classes with a single real method (class-as-function), all-static classes (namespace-class), helpers called exactly once from the same module (single-use-helper, unless its caller is made of three or more such steps, or folding them back would take the caller over the cognitive limit), deep inheritance, tiny modules with one importer. Skips dataclasses, pydantic/ORM models, enums, exceptions. warning / info
bloat link-time pruning Dependencies declared in pyproject.toml / requirements*.txt / package.json but never imported (unused-dependency), imported packages not declared (undeclared-dependency; a script that declares its own in a PEP 723 # /// script block is honoured), except: pass (swallowed-exception), try/except that only re-raises (redundant-try), log-and-reraise, stub functions. warning / info
duplicates common-subexpression elimination Functions with identical AST shape ignoring identifiers and literals (duplicate-function), and near-identical ones by 4-gram Jaccard similarity (near-duplicate-function). -O2 only. warning / info
semantic-duplicates value numbering (semantic CSE) Functions that do the same job with different code, by embedding similarity. Only mutual nearest neighbours above the threshold are reported, so the list stays short and precise. -O3 only. warning / info
responsibilities function partitioning Modules whose functions cluster into several unrelated groups by meaning (a module that is really three modules). -O3 only. info

The order is the order of impact for agent-written code: dead code and abstraction findings usually remove the most lines per decision; cycles, complexity and hotspots are the map you need to do that safely.

The semantic tier (-O3)

Everything up to -O2 is exact: names, scopes, AST shapes. -O3 adds the one thing that is not mechanical, meaning, with a code embedding model that runs locally on the CPU, no PyTorch.

# one-off
uvx --from "vibepiler[semantic]" vibepiler compile . -O3

# installed
uv tool install "vibepiler[semantic]"
vibepiler compile owner/repo -O3
vibepiler similar . app.utils.sum_even      # the functions closest in meaning to one you point at
vibepiler similar . LivenessPass            # a class: the classes closest in meaning
vibepiler similar . src/app/utils.py        # a module (by its file): the modules closest in meaning
  • Default model: nomic-ai/CodeRankEmbed, a 137M-parameter encoder trained for code retrieval (CoIR 60.1, the best open model under 200M). The upstream release needs PyTorch and custom model code, so vibepiler runs an int8 ONNX build of it, nishparadox/CodeRankEmbed-onnx-int8 (138 MB, pinned to a commit), through fastembed: no PyTorch anywhere. Model files land in ~/.cache/vibepiler/models/; vectors are cached by content hash in ~/.cache/vibepiler/embeddings/, so only the first run of a repo pays for embedding.

  • Alternative: embedding_model = "jinaai/jina-embeddings-v2-base-code" (161M, code-trained, official int8 ONNX, 160 MB) if you would rather not depend on a community-converted model. Same speed and quality, but 5.1 GB peak memory on django against 3.0 GB, and slightly weaker separation.

  • Fast mode: embedding_model = "minishlab/potion-code-16M-v2", a 16M static code embedding model run with model2vec (pure numpy). Roughly 500x faster, weaker on "same job, different code"; use it on repos with tens of thousands of functions.

  • Nothing is truncated: each function or method is embedded whole (signature and body); the only limit is the model's 8,192-token context. Speed comes from sorting texts by length before batching, so a batch of short functions is never padded up to one long one. That beat truncating to 800 characters on every model measured. Tests and nested closures are skipped, since they are repetitive by design.

  • Why these: measured on labelled clones (CodeNet Python800: 2,000 programs, 20 solutions to each of 100 problems) and on three real repos (Apple M3 Max, CPU only, whole function bodies, length-sorted batches); full numbers in docs/eval/semantic:

    model code-trained finds same-job code (MAP@R)* functions/s (django, 8k fns) peak memory (django) notes
    CodeRankEmbed int8 yes 0.559 39 3.0 GB default: 132 MB model, loads in 0.5 s
    CodeRankEmbed fp32 (PyTorch) yes 0.580 27 6.2 GB the same model unquantized: tied on quality, 1.4× slower, twice the memory, a 912 MB install
    jina-embeddings-v2-base-code int8 yes 0.574 40 5.1 GB alternative
    BAAI/bge-small-en-v1.5 no 0.247 75 1.0 GB general text model, 33M; fastembed's build caps inputs at 512 tokens
    potion-code-16M-v2 (static) yes 0.247 19,000 0.2 GB fast mode

    * mean average precision at R: for each program, how many of its R true twins (other solutions to the same problem) rank above everything else; 1.0 is perfect. Code-trained transformers win regardless of size, which matches the June 2026 code-to-code retrieval benchmark (arXiv 2606.27401): contrastive training on code matters more than parameter count. Static models are fast because they average fixed per-token vectors, which is also why they cannot see past vocabulary.

  • semantic-duplicates: two functions are reported only when each is the other's nearest neighbour and their cosine similarity is above thresholds.semantic_similarity (per-model default: 0.72 for CodeRankEmbed, 0.82 for the jina model, 0.88 for bge-small, 0.90 for potion; cosine distributions differ a lot between models). That mutual-nearest-neighbour rule is what keeps the output honest: a 1,800-function repo has 1.6 million pairs, and a plain threshold would list thousands. Pairs the structural pass already reported are left out; so is a function and the function it calls (run and its _run read alike because one is the other's body, not a copy); same-named methods on different classes (interface implementations) and dunder methods are ignored. The list is capped at the 100 most similar pairs; metrics.semantic_duplicates.found counts them all, and -v says when the cap cut it.

  • responsibilities: within each module, functions are greedily clustered at thresholds.responsibility_similarity (per-model default). A module is reported when it has two to five groups of three or more functions that together cover most of it; a module that shatters into many tiny groups is just large, not mixed.

  • Swap the model with embedding_model = "..." in the config: any fastembed model name, or any minishlab/potion-* static model.

  • Without the extra installed, -O3 runs everything else and prints one line telling you what to install; it never fails the build.

What the tier produces, concretely:

  1. semantic-duplicates: pairs of functions that do the same job with different code. Structural duplicate detection (-O2) cannot see these; this is the one thing embeddings add that nothing else can.
  2. responsibilities: modules whose functions fall into several unrelated groups, each group labelled by the words its names share ({resolve · import} ×6, {emit · html} ×4).
  3. concepts: the whole codebase partitioned by meaning. Every function is linked to its nearest neighbours by cosine similarity; communities in that graph (Louvain, fixed seed) become concepts, labelled from identifier words, and concepts that sit close together group into themes. An interface implemented in every module, such as a run on every pass, is recognised as a pattern, not a scattered concern.

The Semantic tab draws all of it as one map. Every function is a dot placed by its embedding, so nearby means similar, wherever the files live; concept and theme labels sit on the functions they name. It is a plain <canvas> inside the single HTML file (no GPU, no library) and stays smooth with thousands of functions: drag to pan, scroll or pinch to zoom at the cursor, hover for names, click for detail.

The Semantic tab on vibepiler itself, light theme: 542 functions placed by meaning, coloured by health: tangled functions amber, copies crimson, the rest grey; themes labelled in capitals

The Semantic tab on vibepiler itself, coloured by health, in the light theme. Tangled functions (cognitive complexity over 15) are amber and cluster in the pass code; crimson pairs are functions that do the same job.

The map follows the page theme: a deep field on screen in the dark theme, paper in the light one, which is what the figures here use. Both colour sets are checked with a palette validator for colour-blind separation (the two problem colours stay apart under deuteranopia and protanopia) and contrast against their background, and an unused function is a ring, not only a colour, so the figures hold up in print and in greyscale.

  • Lenses. Map shows functions only. Flow animates calls from caller to callee: streams between concepts when zoomed out, single calls when zoomed in; hover or click a stream for the calls it carries. Copies ties duplicates together: solid for the same code, dashed for the same shape, dotted for the same meaning.
  • Colour. health (the default) gives each function its worst status: copied, tangled, unused or healthy, with problems drawn on top. Or colour by a measure (bloat, cognitive or cyclomatic complexity, maintainability, typed, documented, live, size, nesting, callers) and drag the threshold slider: functions past the line light from dim to bright and the rest fade. The slider starts at the compiler's own limit and steps through the values that occur, so every notch changes the picture. folder and theme show where code lives.
  • Classes and modules get a meaning too: the line-weighted mean of their functions' embeddings, so a module means what all of its code does, not only the top of the file, at no extra embedding cost. A class's or module's panel lists its closest classes or modules, and vibepiler similar takes a class or a file.
  • Click a function to see what leads to it and what it sets off (its call cone, up to three hops), its copies, its numbers and the first lines of its code.

Flow on vibepiler itself: Compiler.run selected, its call cone drawn as dashed streams, the side panel with its metrics as 0–1 bars, its calls and code

Flow with Compiler.run selected: the calls it sets off stream out to the passes and emitters. The panel shows every metric as a value in [0, 1] with its raw number under it: cognitive 40% (25, limit 15), cyclomatic 44% (18, limit 10), maintainability 0% (MI 33.7, limit 20), typed 86% (6 of 7).

The map coloured by cognitive complexity: the slider at 16, the 62 functions past SonarQube's limit of 15 lit from light amber to dark brown, the rest faded

Coloured by cognitive complexity, the slider starting just past the limit: 62 of 542 functions light up, darker the further past it they go.

The map is projected with PCA by default. Install vibepiler[map] to project with UMAP instead, which keeps neighbourhoods far better (seeded, so the map is the same on every run); it is a separate extra because umap-learn pulls in scikit-learn, scipy and numba, about 150 MB, and the rest of the tool should keep installing in seconds.

What it does and does not do: an embedding cannot tell parse from dump, so inverse operations will occasionally pair up. It is also not used anywhere exactness matters; call resolution, reachability and dead code stay deterministic, and lines the model thinks could merge are kept out of the bloat score.

Bloat, the score

Every function, class, module, folder and the repo gets one number in [0, 1]. It prints like size prints text, data and bss:

waste 1% (34 of 6326 lines; inferred 31, proven 3; +222 if the semantic pairs merge)   tangle 0.31 (high-complexity ×55, long-function ×13, mixed-responsibilities ×8)   bloat 31%   [-O3, 54% linked, nomic-ai/CodeRankEmbed:int8]
bloat = 1 − (1 − waste)(1 − tangle)
  • waste is lines that could go, over the unit's lines. Every finding claims a line budget on the symbol it is about; budgets are allocated largest-first and never exceed the symbol's lines or an enclosing class's or module's, so a function that is both dead and a stub counts once and the elimination plan sums exactly to the removable total. Each claim carries a confidence: proven (unused import, exact duplicate, redundant try), inferred (reachability and structure, which depend on how much of the call graph linked) or model (an embedding said so). Model lines are shown and planned but never scored.
  • tangle is structure harder than its job needs, each term derived from the finding's own numbers as (value − limit) / value against your thresholds, combined as a noisy OR. Containers take their children's tangle weighted by share of lines, then OR their own flags. Centrality is not tangle: a module everybody imports is normal.
  • The two combine as a probabilistic OR, so the score stays in range and one bad function cannot push a module past 1. Clean code is exactly 0.
finding lines charged action
dead or unreachable symbol or module, stub, one-implementation interface, pass-through or thin wrapper, indirection link all of it delete / fold
exact duplicate group every copy but the first fold
near or semantic duplicate pair the second copy, at model confidence fold
class-as-function, namespace class, one-subclass base, tiny module the shell: the container minus what it contains fold
single-use helper 2, the boundary itself fold
redundant try, swallowed exception, log-and-reraise 2, the clause delete / simplify
unused import 1 delete
finding tangle term
cognitive complexity, nesting, parameters, length over the threshold (value − threshold) / value
god module (fan − threshold) / fan
module in an import cycle share of its imports that stay inside the cycle
mixed responsibilities ½ · (groups − 1) / groups
deep inheritance (depth − 3) / depth

Rules that follow from the critique it went through before shipping: tests are scored but kept out of the repo and folder totals; modules are ranked by lines freed, with the score shown beside them as a density, because a 3,000-line module with 50 dead lines matters more than a 10-line module with 3; the score is stamped with the -O level, link rate and model it was measured under, since it is a property of the analysis, not of the code alone; and the semantic tier can list a pair but cannot move the score.

Every finding also carries an action, delete, fold or simplify, and the elimination plan (-R, and in report.md) orders them by lines freed. The loop is a fixpoint iteration: apply the top edit, re-run with --baseline, repeat until nothing moves. From Python, Bloat.of(node) and Bloat.of(program) give the same numbers as a value with .waste, .tangle and .score.

Bootstrapped on itself

The first thing it was run on was vibepiler. Nine rounds of the loop, each measured with --baseline by the vibepiler of its day:

Bloat and tangle over the ten bootstrap rounds, and the removable lines per round

Left: bloat and tangle, two unitless shares on one axis. Right: the lines the analysis could show removable. Vector versions for papers: docs/img/bootstrap.svg, docs/img/bootstrap.pdf; regenerate with uv run scripts/bootstrap_figure.py (the script declares matplotlib itself, PEP 723).

start round 1 round 2 round 3 round 4 round 5 round 6 round 7 round 8 round 9 round 10
removable lines shown by analysis 71 34 41 31 18 18 18 22 38 46 30
tangle (cognitive from round 7) 0.30 0.31 0.27 0.26 0.25 0.23 0.23 0.20 0.23 0.23 0.22
bloat 31% 31% 28% 26% 25% 23% 23% 20% 24% 23% 22%
live 100% (3362 of 3362) 100% (3536 of 3536) 100% (3912 of 3912) 100% (4184 of 4184) 100% (4604 of 4604) 100% (4807 of 4807)
most tangled function BloatScorePass.run 100 same AbstractionPass.run 57 read_manifests 43 BloatPass._dependencies 36 same, 37 _Extractor.visit (JS) 35 BloatPass._exceptions, cognitive 45 embed_texts, cognitive 47 BloatScorePass._report, cognitive 36 same

Round one was waste: five dead helpers in the tree-sitter wrapper left over from the first implementation, a constant nothing read, unused imports, the extract method every language adapter had copied, and two copies of the "does this class inherit from a framework" check. Rounds two and three were tangle: the tool's own scoring pass, at cyclomatic complexity 100, became five stages; the markdown emitter became one function per section; the CLI's printing moved into a terminal backend, which is what the mixed-responsibilities finding on cli.py meant; the abstraction and entry-point passes were split the same way.

Self-findings the owner rejected became fixes to the tool, which is the other half of the loop: a module constant used only as a default argument was reported dead (the extractor skipped identifier defaults); typer's decorated callback was called a stub (decorated stubs are registered with a framework on purpose); and round two briefly raised waste by 7 lines because the section functions it created were charged as single-use helpers, so the rule now recognises a caller with three or more such helpers as a function made of named steps, not indirection.

Round four split the manifest reader, the dead-code pass and the concept builder, folded the size line the terminal and the markdown report had each built, and taught the tool three things: a call resolved to a base-class method reaches every override (virtual dispatch, which had made a JavaScript constant look unreachable), umap imports under a different name than its distribution, and findings the owner judges intentional can be accepted in the config, counted and kept out of the plan, so the loop converges instead of repeating the same judgment calls.

Round five added the liveness pass, about a thousand lines, and ran it on itself. The new code arrived with 55 removable lines of its own: the two flow mixins had each copied a helper and a classify method, and a single-use helper sat at the bottom of one. Folding those took waste from 73 lines back to 18. Liveness found one genuine leftover in the old code, a th = program.config.thresholds in the abstraction pass that nothing had read since round three split that function, and vibepiler is now 3362 of 3362 definitions live. Its first self-run also found two bugs in its own rules, both fixed test-first: a middle segment such as self._model.embed is a read of _model, and uses |= ... mutates a set in place, so an augmented assignment is never a droppable store. The refactor briefly made every flow-shape method look dead, because the dispatch table named them as strings; it now holds the functions themselves, so the linker sees the calls.

Round six came after v0.2, which added choosing paths, reporting scope and test-only code. Those features took bloat from 23.1% back up to 23.7%, and most of that was one function: supporting a manifest per folder and PEP 723 script blocks had grown BloatPass._dependencies from complexity 37 to 51. It became five named steps (collect the imported packages, then for each manifest the ones it never uses and the ones it never declares), at 18, and the set of local module names is now built once instead of once per package. The decorator handling both language adapters had copied (visit_decorator, decorator_name, a proven duplicate and a 97% near-duplicate) moved into one shared DecoratorWalk, and the mirrored ProgramGraph.out_edges / in_edges pair was accepted as intentional. Waste went from 26 lines to 18 and bloat from 23.7% to 23.2%. The new test-only finding, run on itself, flags just vibepiler.compile: nothing inside the repo calls the public API except its tests, which is what a library looks like.

Round seven came with the metrics, and the first thing cognitive complexity did was find a linker bug. It reported two helpers inside the new cognitive() function as dead. They were live: a nested function that called its sibling linked to nothing, because a bare name was looked up only among the current scope's own children, never through the enclosing function. Fixing that took vibepiler's waste from 42 lines to 30 and its live score to 100%. Then the eight functions at the top of the cognitive table were split into named steps, the worst first: call and reference linking (75), import resolution (63), the JS export and class visitors (66, 59), CommonJS exports (57), duplicate detection and bloat's own claim classifier (54 each), the DOT emitter (51) and reachability (50). Each refactor was checked against a fingerprint of the whole output (every node, edge, finding and metric) on the fixtures and a frozen copy of vibepiler, and the visitors also against the previous commit on every syntactic form they handle; nothing moved. Cognitive went from 17.6% to 12.0% (worst function 75 → 45), cyclomatic from 18.9% to 14.5%.

Round eight came after four feature releases (semantic search at scale, logging, CLI and Python parity, the Claude Code plugin), which took bloat from 20% back to 24%: most of it is embed_texts, the batching and progress loop for embeddings, at cognitive 47. The self-run removed no code. It found four bugs in the analyzer instead, each fixed test-first. An import cycle through vibepiler/__init__.py was closed only by an if TYPE_CHECKING: import and a lazy import inside __getattr__, neither of which runs when the package loads, so imports inside a function or under TYPE_CHECKING no longer count toward cycles. complexipy read as an unused dependency because the tests load it through pytest.importorskip, which is now an import. vibepiler.compile read as test-only, so what a top-level package re-exports is now public API. A type-only import used in a string annotation read as unused, so names inside string annotations now count. Its own fix briefly made the Python visitor the most tangled function in the repo (cognitive 37 to 47); the new branches moved into named methods and it is back to 41.

Round nine came after the typed linker (v0.4.8), whose own new branches had made the Python visitor the most tangled function again (cognitive 48). At -O2 it started at bloat 10.6%, tangle 10.2%, 17 functions over cognitive 30; the nine worst were split into named steps: both language visitors became dispatch tables keyed on the node type, embed_texts became read the cache, embed what is missing with checkpoints, normalise; the exception, dependency and member-lookup code each lost a nested loop to a named helper; the linker's two scope walkers became one. Every step was checked against main on the 14 evaluation repos, every finding and the link statistics; nothing moved. At -O2 bloat went to 8.6%, tangle to 8.1%, and 9 functions are left over 30 (worst 36, was 48). At -O3, bloat went from 24.0% to 23.0%. The self-run also found a bug in the tool, fixed test-first: three of its eight "same job, different code" pairs were a function and the function it calls (Compiler.run and _run), which read alike because one is the other's body; those pairs are now left out, and the lines the semantic tier claims went from 147 to 75.

Round ten came after the Python gap fixes (v0.4.10) and the JS/TS linker, and worked waste, which had risen three rounds running (22, 38, 46, then 56 lines at its start). Most of it was single-use helpers, and most of those were the named steps earlier rounds had split out of tangled functions: every tangle round was charging itself waste. That is a rule bug, fixed test-first: a helper called once is still indirection, unless folding it back (with the caller's other single-use helpers) would take the caller over the cognitive limit, since its decisions would move into the caller; a helper that decides nothing never qualifies. On the 14 evaluation repos that drops single-use-helper findings from 204 to 166 and adds none; nothing else changes beyond the per-module summaries that count them. The code part: is_benchmark_file and the clamp behind _resolution were folded into their one caller, and the two extractors' copies of text became one. Removable lines went from 56 to 30, 20 of those 26 from the rule. At -O3 bloat went from 22.8% to 22.1%, at -O2 from 8.6% to 8.3%. The rest of the list was kept on purpose: a named condition in a long or chain (_implements, _only_handler), a concept with a name (_match, _slug, files_of), a public function (get_embedder), a loguru sink that holds state (PassLog).

What is left is honest: 77 functions over the cognitive limit, most of them tree-walkers that are long because the grammar is, and about 1,000 lines alive only by name with 64% of call sites linked (it was about 1,170 at 58% before the typed linker).

Liveness, the metric

Bloat counts lines. Liveness counts names: of everything a unit defines, how much does anything read?

live(U) = definitions in U that reach a use / definitions in U          (1.0 when U defines nothing)

High is good: 1.0 means every definition is used. It prints beside bloat on the size line, in vibepiler size, in the report's meter and node panel, and the viewer's colour switch tints the module wedges by it instead of by waste, without moving anything.

level definitions a definition reaches a use when
function, method its parameters and its stores to locals the dataflow analysis says the name is live right after the store
class its methods and instance attributes, plus everything inside its methods the method is reachable, referenced or kept by name; the attribute is read by that name somewhere in the project
module its top-level functions, classes, variables and imports, plus everything inside them the symbol is reachable, referenced or kept by name; the import is used
folder, repo the sum of the modules' counts, tests apart as above

The function level is the compiler's liveness analysis, solved backward over the body until nothing changes:

in[s]  = use[s] ∪ (out[s] − def[s])
out[s] = ⋃ in[s′] over every successor s′ of s

A store to v at s is dead when v is not in out[s]. That one rule catches a value that is never read and one that is overwritten before anyone reads it. Branches join their arms, loops iterate until the live set settles, return and raise start from nothing, every statement in a try may jump to its handlers and its finally, and a name a nested function reads is live everywhere. When the analysis is unsure, the name is live; a function that calls locals() or eval is skipped. On Python the findings are checked against ruff's F841 and ARG rules in the test suite: everything ruff flags, vibepiler flags, and the only extras are the two cases ruff does not look for, values overwritten before a read and destructurings with no name read.

live 66.7% (72 of 108 definitions; dead: 9 stores, 1 params, 1 attributes, 23 symbols, 2 imports)

Gate on it like bloat, --fail-on live<0.9; --baseline prints how it moved; from Python, result.liveness.value. It sits beside bloat, not inside it, until a comparison of the two rankings shows it carries information waste does not.

Metrics

The numbers reviewers know from SonarQube, radon and Visual Studio, for Python, JavaScript and TypeScript alike. Each is a Metric like bloat and live: a value in [0, 1] on every function, class, module, folder and the repo, with its raw numbers kept beside it. They are in report.md (a table, then one column per folder), on the Semantic map as measures with a threshold slider, and in ir.json; each one gates, --fail-on cognitive>0.1.

metric raw number per function value in [0, 1] better
cognitive cognitive complexity (G. Ann Campbell, SonarSource 2017): +1 per if, loop, catch, switch, ternary, plus its nesting depth; else/elif +1; each run of one boolean operator +1 how far functions go past 15, weighted by lines lower
cyclomatic McCabe's 1 + decision points, the number of tests full branch coverage needs how far functions go past 10, weighted by lines lower
mi maintainability index, Visual Studio's 0–100: (171 − 5.2 ln V − 0.23 CC − 16.2 ln LOC) · 100/171, V the Halstead volume how far functions fall below 20, weighted by lines lower
typed annotated parameters and returns (Python, TypeScript) annotated / slots higher
documented public functions, classes and modules with a docstring or a /** */ comment documented / public higher

A count goes to [0, 1] as its excess over a fixed limit, (c − limit) / c: 0 at or under the limit, 0.5 at twice it, never 1. A score where high is good goes as (limit − v) / limit below its limit. The limits are the published ones (SonarQube's 15 for cognitive complexity, McCabe's and NIST's 10 for cyclomatic, Visual Studio's 20 for MI) and each is a threshold you can change. A fixed limit, not the repo's own spread, so a value means the same thing in every repo and every run.

cognitive 0.13 (68 of 570 functions, 32% of lines, over 15; worst 47)
cyclomatic 0.15 (91 of 570 functions, 40% of lines, over 10; worst 35)
mi 0.00 (0 of 570 functions, 0% of lines, below 20; worst 27.6)
typed 94.5% (1526 of 1614 parameters and returns annotated)
documented 39.6% (194 of 490 public functions, classes and modules documented)

Reading the numbers

Every value is in [0, 1], but there are two kinds, and they read differently:

  • A share (typed, documented, and waste and live above) is a plain percentage. typed 94.5% means 94.5% of parameters and returns are annotated. These print as percentages.
  • An excess score (cognitive, cyclomatic, mi) is the share of complexity past the limit, weighted by lines. A function at 17 paths against a limit of 10 has 7 of its 17 paths over budget, (17 − 10) / 17 ≈ 0.41, and the module's score is that averaged over its lines. It mixes how widespread the problem is with how bad it is, so cyclomatic 0.40 is not "40% of functions are too complex": the same 0.40 comes from every function slightly over, or from half the code far over. These print as decimals so they are not read as shares.

Beside each excess score are the parts it mixes: how widespread (the functions over the limit and the share of lines in them, a true percentage) and how bad (the worst raw number). On vibepiler, cyclomatic is 0.15 while 40% of its lines sit in functions over the limit: the excess is widespread but mild.

Per function, the map, the findings and the tooltips show the raw number (cyclomatic 35, cognitive 22, MI 48) because the published limits are stated in those units; the map's slider adds the same 0–1 the reports roll up (35 · 0.71 past the limit of 10). In short: per-function measures are reported in their native units, and every aggregate is a 0–1 value computed from them, with the raw numbers kept beside it.

Cognitive complexity is what bloat's tangle counts: it measures how hard the code is to follow, which is what tangle means, where cyclomatic counts the paths a test suite has to cover. Halstead volume, difficulty and effort are stored on every function (attrs["halstead"]) and reach [0, 1] through the MI. Operands are identifier and literal tokens, operators every other token, the classic reading; radon counts only arithmetic and boolean operators, so its MI runs higher.

The test suite checks the numbers against the reference tools, which are dev-only: cyclomatic complexity agrees with radon on every Python function in vibepiler and gpython; cognitive complexity follows complexipy's rules and the Sonar paper's own JavaScript examples, and on vibepiler it is never below complexipy, which skips some expressions (a ternary inside +).

Configuration

Optional [tool.vibepiler] in pyproject.toml (or a vibepiler.toml):

[tool.vibepiler]
include = ["backend/", "services/"]   # report on these paths (default: the whole project)
exclude = ["migrations/**", "scripts/one_off_*.py"]   # leave these out ("ignore" is still read)
isolate = false                     # true: read only `include`, not the whole project
accept = ["class-as-function:*Embedder", "single-use-helper:*_id"]   # findings you have decided to keep: a code, or code:qualname-glob; counted, never reported
languages = ["python"]              # default: all detected
opt_level = 2
entry_patterns = ["*.lambda_handler", "jobs/*"]   # extra roots by qualname or file glob
treat_exports_as_roots = false      # default: only JS/TS entry modules (index, pages/, app/, ...)
embedding_model = "nomic-ai/CodeRankEmbed"   # -O3; or "jinaai/jina-embeddings-v2-base-code", or "minishlab/potion-code-16M-v2" (fast mode); --model on the command line, model= from Python
embedding_max_tokens = 4096          # -O3: tokens embedded per function, 0 for whole functions; memory grows with its square (one 8192-token function took 6.8 GB, 4096 takes 1.9, 2048 takes 0.8); --max-tokens on the command line
embedding_cache = true               # -O3: false embeds everything afresh and stores nothing; --no-cache on the command line

[tool.vibepiler.thresholds]
complexity = 10                     # cyclomatic, McCabe's limit
cognitive = 15                      # SonarQube's default; feeds tangle
maintainability = 20                # Visual Studio's poor band
function_loc = 60
nesting = 4
params = 6
duplicate_min_nodes = 25
near_duplicate_similarity = 0.85
god_module_fan = 10
single_use_helper_max_loc = 8
semantic_similarity = 0.72          # -O3; omit to use the per-model default
responsibility_similarity = 0.32    # -O3; omit to use the per-model default

Add to your coding agent harness

vibepiler ships as a Claude Code plugin with two Agent Skills: the agent learns to run vibepiler, read its report, and work through the elimination plan with your tests between edits.

Claude Code. Add this repo as a plugin marketplace, then install the plugin:

/plugin marketplace add NISH1001/vibepiler
/plugin install vibepiler@vibepiler

or, from a shell, claude plugin marketplace add NISH1001/vibepiler && claude plugin install vibepiler@vibepiler. claude plugin marketplace update picks up the latest from main. To try it in one folder only, without installing it globally, run both commands from that folder with --scope local (recorded in its .claude/settings.local.json, only for you). Then ask in plain words ("what is dead in this repo?", "clean up the duplicated helpers") or call a skill:

/vibepiler:compile                      # run vibepiler (-O2) and summarise: size line, top of the plan, worst complexity
/vibepiler:compile semantic backend/    # -O3 on one folder; real flags work too: /vibepiler:compile -O3 --exclude "**/gen/**"
/vibepiler:cleanup                      # the elimination loop: check a finding, edit, test, re-run with --baseline, repeat
/vibepiler:cleanup dead code only api/  # a narrower scope
skill does edits code
compile picks the run (semantic = -O3, quick = -O1, graph = -O0, folder names, any CLI flag), runs it with uvx when vibepiler is not installed, reads report.md, explains each number the way it is meant never
cleanup takes the top proven or inferred item, checks it against the code (string uses, registries, exports), makes the edit, runs your tests, recompiles against the last run; stops on a failing test or a judgment call, and never commits yes, in your working tree

Other harnesses. The skills are plain SKILL.md folders in the portable format, so any agent that reads Agent Skills can use them. Copy the ones you want from skills/ to where your agent looks:

git clone --depth 1 https://github.com/NISH1001/vibepiler /tmp/vibepiler
cp -r /tmp/vibepiler/skills/compile /tmp/vibepiler/skills/cleanup .agents/skills/     # OpenAI Codex (or ~/.agents/skills/)
cp -r /tmp/vibepiler/skills/compile /tmp/vibepiler/skills/cleanup .claude/skills/     # Claude Code without the plugin (or ~/.claude/skills/)

Copied skills are called without the plugin prefix (/compile, /cleanup) and do not update themselves. The skills run the latest vibepiler release from PyPI with uvx.

Using it from Python

Compiler(source) takes a project directory, a repo (owner/repo[@ref], a GitHub or git URL, cloned into ~/.cache/vibepiler), one source file, or a code string. For a directory or a repo, include= names the paths to report on, exclude= leaves patterns out and isolate=True reads the included paths alone; the same three chain as methods. A path must exist, and a named file is compiled whatever the ignore rules say. A string that is not on disk is source code when it has a newline, code-like characters, or parses cleanly; its grammar is the one that parses it with the fewest errors unless you pass language=. One file or a snippet is never checked against a folder's dependency manifest.

import vibepiler
from vibepiler import Compiler

result = Compiler("path/to/project").run(opt_level=2, emit=["json", "html"], out_dir="out")
result = Compiler("owner/repo", include=["api/", "services/"], exclude=["alembic/"]).run(emit=())
result = Compiler(".").include("backend/").exclude("**/gen/").isolate().run(emit=())   # the same, chained
result = Compiler("path/to/one_file.py").run(emit=())                # just that file; config from its folder
result = Compiler("def f():\n    return 1\n", language="python").run()   # a snippet; language is optional
result = vibepiler.compile("path/to/project", include=["api/"], emit=["json"], out_dir="out")   # the one-call form
result = Compiler(".", max_tokens=4096).run(opt_level=3)   # -O3 embeds up to 4096 tokens a function (0: whole functions); the rest of the config is the project's
result = Compiler(".", use_cache=False).run(opt_level=3)    # -O3 without reading or writing the embedding cache, as --no-cache
result = Compiler(".", verbose=True).run()                  # every stage's progress, as -v: to loguru's sinks (stderr by default), off again after
result = Compiler(".", languages=["python", "typescript"]).run()   # as --lang python,typescript
result = Compiler(".", model="minishlab/potion-code-16M-v2").run(opt_level=3)   # as --model: the fast static embedding model
result = Compiler("owner/repo", clone_dir="/tmp/clones", refresh=True).run()   # as --cache DIR --refresh: where to clone, and clone afresh
result.bloat.waste, result.bloat.score     # typed scores; result.scores has every one by label
result.liveness.value                      # share of definitions that reach a use: result.scores["live"]
program = result.program                   # result.diagnostics, result.graph and result.metrics are shortcuts into it
g = program.graph                       # ProgramGraph (networkx underneath)
for d in program.diagnostics:           # Diagnostic(pass_name, code, severity, message, file, line, node_id, suggestion, data)
    ...
dead = [n for n in g.nodes() if n.attrs.get("reachable") is False]
mg = g.module_graph()                   # nx.DiGraph of modules/packages
cg = g.call_graph()                     # nx.DiGraph of callables

Extending

  • New language: subclass LanguageSpec in src/vibepiler/frontend/languages/, implement module_name, extract, import_targets, package_target and the small AST hooks, register it in languages/__init__.py, add the extensions to frontend/loader.py. The builder and every pass are language-agnostic.
  • New pass: subclass Pass in src/vibepiler/passes/, return Diagnostics, append it to passes/registry.py. Passes may read the tree-sitter node behind any symbol via program.symbol_def(node).

Limitations and next steps

  • Liveness looks at locals, parameters and instance attributes. Class-level assignments and JavaScript class fields are not definitions yet, an augmented assignment (x += 1) is a read and never a dead store because it may mutate in place, and attributes are judged by name across the project, so a name read anywhere keeps every attribute of that name alive.

  • Name-based resolution, no types. A language-server backend (pyright / tsserver via LSP) would raise the resolution rate; the resolver is isolated in ir/builder.py for that reason.

  • Python and JS/TS only, for now. Go, Rust and Java grammars are already available through the language pack.

  • Analysis only; an --fix mode for the mechanical findings (unused imports, dead symbols) is the obvious next step.

  • The bloat denominator is physical lines, so blank lines, comments and docstrings count; logical source lines would be fairer to terse code. Generated code is not yet excluded.

  • The elimination plan orders edits by lines freed without simulating them: inlining a wrapper raises its caller's complexity, merging duplicates can create a hub. A graph-level what-if (delete, contract, identify on the networkx graph, then re-score) is the next step for the plan.

  • Concepts are seed-stable but not edit-stable: one deletion can reshuffle communities, which is why they are reported and mapped but never scored.

Design notes live in docs/superpowers/specs/.

License

MIT. See LICENSE.

Metadata

Release files for vibepiler 0.4.13

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vibepiler 0.4.13
File Size Uploaded Provenance Actions
vibepiler-0.4.13.tar.gz 298.4 kB Without provenance Details for vibepiler-0.4.13.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for vibepiler 0.4.13
File Interpreter ABI Platform Actions
vibepiler-0.4.13-py3-none-any.whl Python 3 none any Details for vibepiler-0.4.13-py3-none-any.whl

Total release size: 540.7 kB

Release files / vibepiler-0.4.13.tar.gz

Download URL vibepiler-0.4.13.tar.gz
Size 298.4 kB
Tags Source
SHA-256 checksum
How to use checksums
57a2df0e0e014b6f018007ac19ea6ef5970139bb8812da251e270c55e69a7af5
BLAKE2b-256 checksum
How to use checksums
b53836cce721e5d1b2ef4f01466be37f833258c206d02151f4c1501af3610a09
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / vibepiler-0.4.13-py3-none-any.whl

Download URL vibepiler-0.4.13-py3-none-any.whl
Size 242.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
59082e8f33c571647e02140df29dfa4d3331a365983007dee3213047be54c381
BLAKE2b-256 checksum
How to use checksums
b733a152df03501289635801a173be92487a5327212a213919b66ab19c64de0a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for vibepiler 0.4.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page