Claude Code plugin · MIT · v0.22.0

New to the codebase? So is your coding agent.

anatomiya reads your repository and its git history, then teaches Claude Code what a senior teammate teaches you in your first week: where files go, which helpers already exist, how tests are written here, and what has to change together.

Every rule it hands the agent is counted from your code, with the count beside it, so Claude can tell a habit from an accident.

> /plugin marketplace add crisnahine/anatomiya
> /plugin install anatomiya@crisnahine
> /anatomiya:scan
Plate 1An area file, as Claude loads it
# packages/element/tests  26 files
kinds: 13 .ts, 13 .tsx (JSX); 23 test files; 3 vitest specs

possibly-absent values are read with ?., not asserted with !
  178 of 182 sites across 10 of 26 files, 31 authors  (partial: some sites are not visible statically)
  except "packages/element/tests/binding.test.tsx" (2 sites)

most files here import: @excalidraw/excalidraw/tests/helpers/api (81%), @excalidraw/common (65%)
async functions handle their own failures: no convention. 0 of 142 sites (ratio)  (partial: some sites are not visible statically)
module-level bindings are const: 59 of 59 sites (matches model default)
  1. The area: a directory, and how many files its counts were taken over.
  2. A stated rule: a habit that cleared every gate.
  3. Its evidence: conforming sites out of the sites where the construct appears, files holding one out of the eligible files, and how many people wrote them.
  4. Each exception, named by its file.
  5. No convention: the gate in parentheses stopped it, so it prints as a count.
  6. A habit the model already follows: a count here, and check still holds the branch to it.
excalidraw at 438d898, written by anatomiya 0.18.0, trimmed to eight of its lines. The whole file

The problem

The conventions are in your code. The agent starts from zero.

An agent writing code in your repository has no memory of the last review, and the conventions it needs are rarely written down: they are what the existing code happens to do. A reviewer catches the mismatch, the agent fixes it, and the next task starts over.

2×

At Google, developers in their first year typically get more than twice as many review comments per change.

Sadowski et al., ICSE-SEIP 2018

83.8%

of 567 pull requests written with Claude Code across 157 projects were merged, against 91.0% for a matched set written by people. The authors name project-specific style rules as a weak spot.

Watanabe et al., arXiv:2509.14745

1.87×

In 617 pull requests to one Python project, agent-written code repeated logic the project already had about 1.87 times as much as code written by people.

Huang et al., MSR 2026

In a session

What Claude gets, and when

anatomiya hands each part of the map to Claude at the moment it matters. Every block below is output from a public repository, at the commit the README or the usage guide names.

Every session: the house rules

The overview is in context on every turn, before Claude reads or writes anything: where things live, how tests are laid out, and which areas state rules. In a long session it is handed back about every 30k tokens.

---
generator: anatomiya
---

# Repository map

Facts counted from this repository's own code, per directory.
A claim states how many sites conform out of how many were eligible; "no convention" means the gate in parentheses stopped it, and its sites may still all agree.

Read a file before editing it: these notes load when you read, not when you grep.
When unsure what this code does, read it, grep it, or run it instead of guessing, and say what you could not verify.
When a change is asked for, follow what this repository already does and carry it through instead of stopping at a suggestion.
Report your work as it happened: never a test, a read or a check you did not run, and never a site changed to get past a rule, which you fix or say why you left; where this map or the plugin that wrote it is wrong about the code, tell the user and ask whether to file it at github.com/crisnahine/anatomiya/issues.

## What lives where

...

## Areas (38)

- 38 areas, each in its own file, loaded when you read one of its files

## Not covered

- 15 source files sit in no area (at the repository root, under the per-directory floor, or under a name no glob can spell)
- 122 files hold a language this map does not read (84 .scss, 33 .mdx, 3 .css, 2 .html); 128 configuration, data or prose files are counted by extension, and no row reads them (.json, .md, .yml); 2 files say a generator wrote them, so nothing here is counted from them
- memory, GC and I/O behaviour: runtime only, nothing static to count; a string is read only as an import path, JSX text, a doc comment, a quoted object key, a few Rails arguments (migration options, table and column names and SQL, method names, a spec's subject) or the URL path a route declares in JavaScript, Ruby, Python, Java, C# or Rust; i18n keys, CSS classes, event names, messages, links and request paths are not

Generated files: 39 under .claude/rules/anatomiya-*.md
Any other file there was not written by this tool.
The overview of excalidraw at 438d898; its "What lives where" section is trimmed here. From the usage guide.

When Claude opens a file: that directory's rules

An area file loads the moment Claude reads a file under it: each habit that cleared the gates with its evidence, and a count for each one that did not.

---
generator: anatomiya
paths:
  - "packages/element/tests/**/*.{cjs,cts,js,jsx,mjs,mts,ts,tsx}"
---

# packages/element/tests  26 files

kinds: 13 .ts, 13 .tsx (JSX); 23 test files; 3 vitest specs

imports used only as types are marked import type
  78 of 78 sites across 20 of 26 files, 35 authors  (partial: some sites are not visible statically)

relative imports are written without the file extension
  68 of 68 sites across 22 of 26 files, 37 authors
  not counted: a specifier naming a directory, an asset, or a .coffee or .es6 source, and a dynamic import()

possibly-absent values are read with ?., not asserted with !
  178 of 182 sites across 10 of 26 files, 31 authors  (partial: some sites are not visible statically)
  except "packages/element/tests/binding.test.tsx" (2 sites)
  except "packages/element/tests/duplicate.test.tsx" (2 sites)

most files here import: @excalidraw/excalidraw/tests/helpers/api (81%), @excalidraw/common (65%)
failure is returned, not thrown: no convention. 0 of 1 site (ratio)  (partial: some sites are not visible statically)
module-level bindings are const: 59 of 59 sites (matches model default)
async functions handle their own failures: no convention. 0 of 142 sites (ratio)  (partial: some sites are not visible statically)
optional values are read with ?.: no convention. 1 of 2 sites (ratio)  (partial: some sites are not visible statically)
module-level functions are assigned to variables, not declared with function: no convention. 34 of 38 sites (ratio)
defaults are taken with ??, not ||: no convention. 1 of 5 sites (ratio)
collections are iterated with for...of, not .forEach: no convention. 16 of 31 sites (ratio)  (partial: some sites are not visible statically)
test cases are declared with it(), not test(): 538 of 540 sites (matches model default)
assertions are written with expect(): 1947 of 1947 sites (matches model default)  (partial: some sites are not visible statically)
functions in files that hold JSX are named camelCase: 11 of 11 sites (matches model default)
type aliases carry no prefix: no convention. 4 of 4 sites (concentration)
files here that hold no JSX are named camelCase: no convention. 10 of 10 sites (evidence)
packages/element/tests in excalidraw at 438d898, in full. From the usage guide.

Before a new file: what your history ships with it

Before a Write, an Edit or a notebook edit, a hook says what the default branch's history ships with that kind of file, or that a test is going where its siblings keep none. On every other write it says nothing.

anatomiya: lib/rubocop/cop/style/reverse_first.rb
  A .rb file added here ships with a new .md file in "changelog": 97 of the last 100 changes that added one.
  A .rb file added here ships with an edit to "config/default.yml": 100 of the last 100 changes that added one.
  A .rb file added here ships with an edit to "lib/rubocop.rb": 99 of the last 100 changes that added one.
  Make those changes in the same change, or say why this file does not need them.
rubocop at f009b33, the first write of a new cop, before the file exists.

When its turn adds code: the helper you already have

When a turn adds code, one subagent looks for an existing function that does the same job, starting from the code index, and Claude is asked to call it. In mastodon every session without anatomiya wrote its own URL comparison, and every session with it called compareUrls.

- const toPageKey = (href: string) => {
-   try {
-     const url = new URL(href, window.location.href);
-     return `${url.origin}${url.pathname}${url.search}`;
-   } catch {
-     return null;
-   }
- };
+ import { compareUrls } from '../utils/compare_urls';

  export const CurrentPageBadge: FC<{ href: string; currentHref: string }> = ({
    href,
    currentHref,
  }) => {
-   const pageKey = toPageKey(href);
-   if (pageKey === null || pageKey !== toPageKey(currentHref)) {
+   if (!compareUrls(href, currentHref)) {
      return null;
    }
One session from each arm on Claude Opus 5.5, trimmed to the lines that differ: red is without anatomiya, green is with it.

Whenever it asks: the code index

Each scan indexes every function, method, class and type a file declares at its top level or in a class, with its parameters, its place, the first sentence of its doc and how many files import it. /anatomiya:find asks it in plain words, and a name in any casing works.

/anatomiya:find uuid v7
The 6 of 9995 indexed definitions closest to "uuid v7", as of the last scan:
uuid_v7()  crates/atuin-common/src/utils.rs:34  fn, 19 files import it
NotUuidV7  crates/atuin-octavo/src/pb.rs:19  type, 1 file imports it
atuin, in Rust. Ask this repository's own index below.

Before you review: what this branch broke

/anatomiya:check compares the branch with its merge base, uncommitted work included, and lists each habit the branch broke at the line that broke it. Nothing is blocked, and --format github turns each finding into a pull request annotation.

FIX  "app/controllers/api/v1/bookmark_folders_controller.rb":3  classes here inherit Api::BaseController
  BookmarkFoldersController: 58 of 59 baseline sites conform
1 MUST-FIX, 2 FIX, 0 NIT

MUST-FIX  "lib/rubocop/cop/style/reverse_first.rb":1  a .rb file added to "lib/rubocop/cop/style" ships with an edit to "config/default.yml"
  all 100 of the last 100 changes that added one; no "config/default.yml"
A mastodon controller that inherits ApplicationController, and a rubocop cop written alone. MUST-FIX means the code you accepted has no exception to the habit at all.

In the background, a checkout, a pull or a commit starts a refresh, so the map keeps up on its own. The checks measure against a baseline that moves only with commits that came to your default branch from the remote, so Claude cannot lower the bar it is judged by.

Live, in your browser

Ask this repository's code index

This box runs the plugin's own find.mjs, copied unchanged, over the index a scan wrote for this repository at bae9a75: 2,504 definitions. It is the ranking the end-of-turn reuse check hands its subagent.

  • A rare word counts for more than a common one.
  • A function many files import ranks higher.
  • A test ranks behind the function it covers.
  • Six hits at most, and each line is what the command prints.

Pick a phrase above, or type your own.

    Measured, ties included

    The helper your repository already has

    14 small tasks in 13 open-source repositories, each asking for code the repository already had a function for. 20 sessions with anatomiya and 20 without, per task, on two models. No prompt named the function, and every check was fixed in a scenario file before the first session ran.

    542 of 560sessions called the existing function with anatomiya

    291 of 560did without it

    with anatomiya without sessions of 20 that called the helper Bold marks a difference with p below 0.05, by Fisher's exact test
    TaskClaude Opus 5.5Claude Haiku 5.5
    mastodon: a "You are here" badgecompareUrls20 of 20 with anatomiya, 0 of 20 without, p below 0.0520 of 20 with anatomiya, 0 of 20 without, p below 0.05
    forem: a contrast warningWCAG contrast helper20 of 20 with anatomiya, 2 of 20 without, p below 0.0520 of 20 with anatomiya, 10 of 20 without, p below 0.05
    whitehall: an external link helperis_external?20 of 20 with anatomiya, 1 of 20 without, p below 0.0520 of 20 with anatomiya, 3 of 20 without, p below 0.05
    mastodon: a link policyTagManager#local_url?20 of 20 with anatomiya, 15 of 20 without, p below 0.0511 of 20 with anatomiya, 1 of 20 without, p below 0.05
    eslint: a linter test (picked by a rule)unIndent17 of 20 with anatomiya, 1 of 20 without, p below 0.0517 of 20 with anatomiya, 0 of 20 without, p below 0.05
    openfoodnetwork: a Stimulus controller (picked by a rule)showHttpError20 of 20 with anatomiya, 19 of 20 without20 of 20 with anatomiya, 7 of 20 without, p below 0.05
    cal.diy: an app key reader (picked by a rule)getAppKeysFromSlug20 of 20 with anatomiya, 9 of 20 without, p below 0.0520 of 20 with anatomiya, 0 of 20 without, p below 0.05
    CTFd: an admin report routePython · admins_only20 of 20 with anatomiya, 20 of 20 without20 of 20 with anatomiya, 17 of 20 without
    BookStack: the admin role's usersPHP · Role::getSystemRole20 of 20 with anatomiya, 2 of 20 without, p below 0.0520 of 20 with anatomiya, 19 of 20 without
    gitea: a count of inactive usersGo · db.GetEngine20 of 20 with anatomiya, 20 of 20 without18 of 20 with anatomiya, 20 of 20 without
    DolphinScheduler: a schedule readerJava · JSONUtils.parseObject20 of 20 with anatomiya, 20 of 20 without19 of 20 with anatomiya, 20 of 20 without
    Bitwarden: an import batch recordC# · CoreHelpers.GenerateComb20 of 20 with anatomiya, 20 of 20 without20 of 20 with anatomiya, 20 of 20 without
    atuin: a script run's idRust · uuid_v720 of 20 with anatomiya, 5 of 20 without, p below 0.0520 of 20 with anatomiya, 0 of 20 without, p below 0.05
    KotlinConf: an empty list messageKotlin · PreviewHelper20 of 20 with anatomiya, 20 of 20 without20 of 20 with anatomiya, 20 of 20 without

    It did not win everywhere

    Of the 28 task and model pairs, anatomiya changed the result in 16, and the arm without it never did better by a margin a test can tell from chance. Most of the rest are ties at or near 20, where the helper is the repository's idiom and a session finds it without a map: gitea calls db.GetEngine from 246 files. On gitea with Claude Haiku 5.5 the arm without anatomiya did better, 20 against 18, and both misses called the repository's own db.Count, which calls GetEngine itself.

    It costs tokens. Across these tasks the median session with anatomiya cost 2.0 to 5.5 times as much as one without.

    How it works

    Counted, gated, delivered

    A scan reads your tracked files once and writes a map Claude Code loads on its own. Four hooks keep it current and speak at the moments above. The scan runs on your machine, and anatomiya itself sends nothing anywhere.

    What a scan does

    1. Collects the corpus from git ls-files and nothing else, so an .env or a key file never enters it, and leaves out fixture, vendor and build directories.
    2. Finds the areas: any directory holding enough source.
    3. Parses each file once in a pool of child processes: oxc-parser for JavaScript and TypeScript, Ruby's own prism, and seven tree-sitter grammars for Python, PHP, Go, Java, C#, Rust and Kotlin.
    4. Counts per area across 68 dimensions, plus one pass over git log for who wrote what and which files change together.
    5. Applies the gates, and prints whatever fails one as a count.
    6. Writes the map into .claude/rules/, each file's body forty lines at most, and the facts, the pin and the code index beside it.

    What runs in a Claude Code session

    1. refresh looks in the background when a session starts and whenever HEAD moves, and rescans where anything the map depends on changed.
    2. echo hands the overview back once the model has read on past its last copy.
    3. notice speaks before a Write, an Edit or a notebook edit, only where the history or the test layout has something to say about that path.
    4. reuse asks one subagent for a function that already does the job when a turn adds code.
    5. check runs the same counts at the merge base and in the working tree, and reports what the branch introduced.
    Plate 2The anatomy of a claim

    178 of 182 sites across 10 of 26 files

    178 conforming
    sites that match the pattern
    182 candidates
    sites in this area where the construct appears at all
    10 applicability
    files holding at least one candidate
    26 eligible files
    files in the area written in the dimension's languages, less any whose syntax it could not read

    A count becomes a stated rule only past every gate: at least 0.90 of sites, a Wilson lower bound on the same counts, evidence spread over enough files and authors, and a pinned baseline, so the agent's own output cannot raise the bar it is judged against. A habit the model already follows prints as a count, so the map spends context only where Claude would go wrong. The 381 numbered decisions behind this, each with the measurement that forced it, are in DECISIONS.md.

    Quick start

    Install in three commands

    The plugin installs its three runtime dependencies itself. After the first scan, a checkout, a pull or a commit keeps the map current.

    1. 1

      Add the marketplace

      /plugin marketplace add crisnahine/anatomiya
    2. 2

      Install the plugin

      /plugin install anatomiya@crisnahine
    3. 3

      Scan your repository

      /anatomiya:scan

    What it needs

    • Node 22 or newer, on the PATH Claude Code runs hooks with.
    • git 2.31 or newer, and the history itself, for what ships together.
    • For Ruby, ruby with prism 1.x: Ruby 3.4 ships it.
    • Linux, macOS or Windows: CI runs the suite and an end-to-end scan, pin and check on all three.

    The commands

    /anatomiya:scan
    writes the map and the code index
    /anatomiya:check
    reports what the branch broke, as MUST-FIX, FIX or NIT
    /anatomiya:find
    looks a job up in the code index
    /anatomiya:pin
    accepts the current code as the baseline, by hand
    /anatomiya:doctor
    says which parser engines loaded
    /anatomiya:setup
    installs the parser packages where an install stopped short
    Run it without Claude Code, or in CI
    git clone https://github.com/crisnahine/anatomiya
    cd anatomiya && npm install --ignore-scripts
    node plugins/anatomiya/bin/anatomiya.mjs scan /path/to/your/repo
    node plugins/anatomiya/bin/anatomiya.mjs check /path/to/your/repo --format github

    --format github prints one annotation per finding, and --format json gives a job the same answer as a record. Cursor and GitHub Copilot get the same map with scan --targets cursor,copilot, without the hooks.

    Keep the map out of git
    exclude="$(git rev-parse --git-common-dir)/info/exclude"
    echo '.claude/rules/anatomiya-*.md' >> "$exclude"
    echo '.claude/anatomiya/' >> "$exclude"
    echo '.cursor/rules/anatomiya-*.mdc' >> "$exclude"
    echo '.github/instructions/anatomiya-*.instructions.md' >> "$exclude"

    A team can commit the map instead, and the background refresh then leaves it alone. The usage guide has every option and edge case.

    Limits

    What it will not do

    Read this before deciding.

    • It does not catch bugs. Of 317 defect comments measured across ten repositories, 1 was preventable by a map like this one. It catches code that works and does not belong.
    • It is not a linter. It enforces nothing, and a rule your linter already enforces is wasted in the map.
    • A directory's file loads on a read. An agent that only greps and runs cat gets the overview and not the directory's file.
    • A habit that just changed can lag. A ship-together rule stays until the newest changes outweigh it.
    • Some lines are fixed sentences. Every overview asks Claude to read before editing, to look instead of guessing, and to finish the change; the usage guide lists each one and what it rests on.

    Questions

    Questions you should ask first

    Does it send my code anywhere?

    No. It runs on your machine. The only command that goes online is /anatomiya:setup, which installs the parser packages from npm. The reuse search is an ordinary subagent in your own session.

    Will it block a commit or a merge?

    No. Nothing it writes blocks a commit, a push or a merge. check reports, and you decide.

    What if the map says something wrong?

    Every rule carries its evidence, and every overview tells Claude that where the map and the code disagree, the code is right. The map rebuilds itself on the next checkout or pull. Where a line is wrong, an issue with the line and its directory is the fastest fix.

    Which languages?

    JavaScript, TypeScript, JSX, Flow, Ruby and Rails in depth, and the script blocks of Vue and Svelte. Python, PHP, Go, Java, C#, Rust and Kotlin get the layout, their tests, the code index and a few habits each, and the views written in ERB, HAML, Slim, Blade, Razor, Jinja, Twig and Go templates get the reuse check.

    Does it work outside Claude Code?

    Cursor and GitHub Copilot get the same map, written where each one reads it. The hooks are Claude Code's, so those tools get the map and not the notice, the reuse check or the background refresh.

    What does it cost?

    It is free and MIT licensed. What you pay is tokens: the overview on every session, 2.3 to 3.4 KB on the repositories measured, a directory's file when Claude opens a file there, and one subagent on each turn that adds code.