Zero-Hallucination Semantic Code Audit

Your CI asks if the code compiles.
Ditto asks if you just rewrote existing logic.

Duplication tools match text copy-pastes. Ditto compiles the AST, maps intentions using AI, and executes pure functions side-by-side in a V8 sandbox to verify behavioral drift.Built for large scale. Verified by Node.js, not by AI guessing.

What Ditto Does

Ditto finds functions that do the same thing written completely differently, then executes them on the same inputs to prove whether they disagree.

  1. Parsing ASTts-morph walk over every function, method and arrow
  2. Fingerprinting functionsone LLM call per function, constant context
  3. Embedding fingerprintsintent and behaviour — never the function name
  4. Clusteringcosine similarity + signature/purity compatibility
  5. Adjudicating clustersflagship model reads one cluster at a time
  6. Probing for divergenceexecuting pure members on adversarial inputs

Indexed Repositories (Verified Clones)

The AI-Agent Slop Crisis

How coding assistants and context limitations are quietly degrading modern corporate codebases.

Today, over 80% of software engineers use AI coding tools (Copilot, Cursor, Devin) daily. These tools write code extremely fast, but they have a fatal design flaw: they operate as local optimizers. Because models are context-constrained and rely on basic vector RAG lookup, they cannot examine your entire codebase before writing a line of code.

When an AI agent needs a simple date helper or string formatter, it doesn't search deep private subdirectories — it simply re-implements the logic from scratch under a different name in a new file.

The correctness cliff: Over months, you accumulate four functions doing the same job written completely differently. Standard CI accepts this because each copy passes its own file-level tests in isolation. But they behave slightly differently on edge cases, causing silent behavioral drift that breaks production.

Ditto acts as a persistent Semantic Memory Layer. Instead of letting slop compile, Ditto indexes your repository's behavioral intent, clusters clones, and proves where they diverge by executing them side-by-side.

Top-Tier Architecture: Zero-Hallucination Verification

1. AST Parser

Instead of simple text-grepping, Ditto compiles code into an Abstract Syntax Tree using ts-morph. Grabs all functions—including file-local, private, and nested declarations.

2. AI Fingerprinting

Translates logic into behavior templates using structured LLM outputs. AI does not judge code quality; it acts as a translator, removing variable names, styles, and format biases.

3. Matrix Pruning

Compares summaries using vector embeddings. To bypass the costly O(N²) LLM comparison limit, Ditto uses fast in-memory cosine similarity math to prune millions of pairs in milliseconds.

4. V8 worker_threads

The killer step: Ditto executes pure functions in isolated worker threads against adversarial boundary values. If they disagree on output, it renders proof. Reality, not model opinions.

i

Why Ditto is Not an "AI Wrapper" or Bloat

Many modern developer tools are simple prompts wrapped in an Express server, running full-codebase lookups that blow context windows and cost thousands of dollars. Ditto is an actual static analyzer combined with sandbox execution.

AI is strictly load-bearing in two isolated stages where regex patterns fail: normalizing structural differences into behavioral summaries, and guessing interesting inputs (empty values, limits, sign-flips).

The heavy lifting—grouping functions, extracting code syntax, running isolates, and compiling diffs—uses hard, deterministic algorithms.

By executing the code in Node worker threads, we take the LLM out of the final verdict. When Ditto tells you a budget parser is broken, it's because V8 ran the functions side-by-side and got different answers.

The Blindspot — Token Matchers vs Semantic CI

Capability
Traditional Tools (jscpd, Sonar)
Ditto (Semantic CI)
Identifies Type 1–3 Clones
🟢 Yes (exact or modified text duplicates)
🟢 Yes (as low-risk near-duplicates)
Identifies Type-4 Clones
🔴 No (different code structure = 0 matching)
🟢 Yes (matches intent, ignores code details)
Analyzes Non-Exported Code
🟢 Yes (indexes raw text streams)
🟢 Yes (ast-walk grabs file-local methods)
Behavioral Verification
🔴 None (static character analysis only)
🟢 Live sandbox runs prove disagreements

Roadmap: End-to-End Slop Prevention

Ditto Guard — scan a pull request

Live

Ditto checks whether each function a PR adds reinvents one you already have — and executes the pure ones to prove where they disagree.

≈ $0.01 (₹1) per pull request — we only fingerprint the functions the PR adds, not the whole repo.

Active Demo

Stage 1: Repository Memory

Run static AST walk and cosine matrix clustering to detect and catalog semantic duplicate clusters and behavioral conflicts in existing code.

Live Now

Stage 2: Ditto Guard (PR)

Lightweight per-PR check that only analyzes the diff (~$0.01 per check), flags functions that reinvent existing logic, and executes the pure ones to prove where they disagree.

Roadmap

Stage 3: MCP Agent Pre-flight

Integrates into coding agents (Cursor, Devin) via the Model Context Protocol. Let agents query Ditto's index and reuse code *before* re-implementing.