Skip to content
Pranav-MathadPublic

About

Checks whether a codebase still keeps its own architecture decisions. Code finds and ranks the exceptions; AI only explains them. Built at hackaTUM 2026, CHECK24 track.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

CodeXray

CodeXray reads a large codebase and answers one question:

Are the architecture decisions of this project being kept, and where are they not?

It is our entry for the CHECK24 track of hackaTUM 2026, "Visualise and judge a codebase". The full specification is spec.md.

Detection, counting and ranking are done by ordinary code from the Git history and the source files. Every finding cites the commit, file and lines behind it. An AI model only writes prose on top of those facts, and the app marks every AI sentence as AI.

Status

Part State
Stage 1, ingest: history, snapshots, line origin, pull requests Works on all three repositories
Stage 2, parse: reading and linking files Works on all three repositories
Stage 3, model: the map of modules per snapshot Works on all three repositories
Stage 5, analyze: decisions, finding types, before and after Works on all three repositories
Stage 7, report: ranking, findings.json, the web bundle Works on all three repositories
Web app: the tabs Report, Findings (with finding detail), Map, Before and after, Approach, and the Decisions and Size screens Works on the three bundles and the two synthetic fixtures in web/public/bundles/; see Web app
Stage 6, judge: AI text for the shown findings Works with LLM_API_KEY set; answers are cached in the run folder, so a re-run makes no call
decisions propose: rules proposed from written decision documents Works with LLM_API_KEY set; writes proposals.yaml for review, and the reviewed rules are in rules/
check <base>..<head>: decisions a change breaks Works; lists each broken decision with file and line, and exits 1 when there is one
Stability table (spec.md §11.3) Measured on all three repositories: make robustness REPO=<id> after report measures it and rebuilds the report
Emerging-hotspots list (spec.md §12.2) Filled on all three repositories; the Change screen lists up to 25 files, highest z first (25 on Artemis, 18 on Shopware, 1 on Graylog)

The results in this repository include AI text. On each repository judge judged the 25 highest-ranked findings of four types (broken rule, cheap loop, foundation depending on features, overloaded class; job_b.types in src/codexray/settings/judge.yaml). 25, 24 and 25 of them (Artemis, Shopware, Graylog) have an AI claim and fix that passed every check; the one on Shopware whose answers failed keeps the fixed sentence built from the facts, as do all findings of the other types. Job C wrote 55, 122 and 88 module descriptions that passed their checks. The calls are in Token usage per analysis.

Prerequisites

  • uv. It installs Python 3.12 (.python-version) and the Python packages.

  • Node 22.12 or newer, the minimum the web build tool (Vite) states.

  • git.

  • Disk: per repository, a clone of 0.2 to 0.6 GB in repos/ and a run folder of 0.6 to 1.1 GB in runs/. The stability step keeps a second run (END one month earlier) inside the run folder, which then holds 1.2 to 2.1 GB; about 6.5 GB for all three.

  • Time, measured on the final runs on a 10-core machine with the clone already in repos/, while a second run of the same repository and other steps shared the machine:

    Repository ingest to report judge Stability step
    ls1intum/Artemis 6.9 min 2.8 min 12.2 min
    shopware/shopware 16.8 min 3.2 min 14.1 min
    Graylog2/graylog2-server 10.5 min 2.1 min 10.4 min

    Downloading the clone comes on top and was not measured.

make setup      # uv sync, then npm ci in web/
make check      # lint, Python tests, web typecheck, web tests, web build

Reproduce one repository from scratch

Artemis:

uv run codexray ingest https://github.com/ls1intum/Artemis.git --id artemis
uv run codexray parse   --repo artemis
uv run codexray model   --repo artemis
uv run codexray analyze --repo artemis
uv run codexray report  --repo artemis
uv run codexray judge   --repo artemis   # AI text for the shown findings; needs LLM_API_KEY
make robustness REPO=artemis             # the stability table, then the report again
make bundle REPO=artemis                 # copy the run's bundle into web/public/bundles/artemis
make web                                 # the web app at http://localhost:5173

The other two take the same commands with their own URL and id:

id URL
shopware https://github.com/shopware/shopware.git
graylog https://github.com/Graylog2/graylog2-server.git
  • ingest clones into repos/<id>/ and pins the repository to the commit in repos.yaml. Every later step uses that commit, never the newest one.
  • Output goes to runs/<id>/<END_SHA>/<params_hash>/ (spec.md §4.3). runs/ and repos/ are not committed.
  • A second run with the same commit and settings writes the same bytes. Compare two run folders with shasum -a 256.
  • Pull-request descriptions are fetched from GitHub only with a token in the GITHUB_TOKEN environment variable (named in src/codexray/settings/repository.yaml). Without it the run is complete, the prs table is empty, and manifest.json differs in its coverage.prs part. A later ingest with the token set fetches the missing pull requests into the same run.
  • judge reads the gateway key from the LLM_API_KEY environment variable. Without it, skip judge: the steps before it still give a complete report, with the fixed sentences built from the facts in place of AI text. make robustness makes no AI call.
  • make robustness ends by running report again, so the report carries the AI text and the stability table. If you skip it, run report again after judge.
  • The rules in rules/<id>.yaml are already reviewed and committed, so decisions propose (AI job A) is not part of a reproduction. It writes new proposals into the run folder for a person to review.
  • uv run codexray --help lists every command. Every step is safe to re-run.

Import any public repository

uv run codexray import https://github.com/<owner>/<name>   # every step, then the bundle
uv run codexray serve                                      # the app at http://127.0.0.1:8787
  • import runs ingest, parse, model, analyze, judge and report, then does what make bundle does. --id sets the short id; an id that already belongs to another repository is refused.
  • judge runs only when LLM_API_KEY is set; without it the report keeps the fixed sentences built from the facts, and the log says so.
  • No decisions are proposed for an imported repository, because a person reviews proposed rules first (spec.md §8.1). Its report checks the computed decisions and the pressure points. Rules reviewed later go in rules/<id>.yaml and the next import uses them.
  • serve serves the built app (cd web && npm run build) and the bundles as they are on disk, and adds a box on the first page to start an import from a link and follow its steps. It listens on 127.0.0.1 only and runs one import at a time. With make web running instead, the development server sends the box's requests to serve.
  • The app itself still loads static files only and never calls a model. On a static host there is no serve, and the import box is not shown.

Where the results are

  • results/<id>/: findings.json, manifest.json, decisions.yaml, usage.json, robustness.json and ARCHITECTURE_RULES.md of each run, copied byte for byte. results/README.md says what each file is.
  • web/public/bundles/<id>/: the files the web app loads for each repository. Run make web to browse them.
Repository Pinned commit Findings at END Decisions From rules/<id>.yaml Checkable by machine Bundle on disk
ls1intum/Artemis d8fc451 257 49 33 25 43 MB, 2,370 files
shopware/shopware ec8b714 213 66 65 9 33 MB, 2,348 files
Graylog2/graylog2-server 4912933 221 3 2 3 32 MB, 2,564 files

Each repository has 10 findings in the list to fix first. Besides the reviewed rules, Artemis has 15 measured habits, and all three have the built-in decision "production code does not depend on test code". A decision that is written but not checkable by machine (24 on Artemis, 57 on Shopware) is listed with its source and gives no finding.

Token usage per analysis

The ledger of every AI call the gateway answered for these three runs, summed from results/<id>/usage.json. The Trust screen shows the same rows. Job B writes the claim and fix for the 25 judged findings (three votes per finding, and one more call for a vote whose answer fails a check that allows a retry); job C writes a two-sentence description of each module.

Repository Job Model Calls Input tokens Prompt-cache reads Output tokens Cost
ls1intum/Artemis B claude-opus-5-5 90 247,068 136,983 63,844 $2.27
C claude-haiku-5-5 73 75,335 63,116 14,617 $0.02
Total 163 322,403 200,099 78,461 $2.28
shopware/shopware B claude-opus-5-5 101 237,444 152,994 63,843 $2.23
C claude-haiku-5-5 146 76,716 138,448 30,091 $0.03
Total 247 314,160 291,442 93,934 $2.25
Graylog2/graylog2-server B claude-opus-5-5 91 190,241 158,331 51,983 $1.80
C claude-haiku-5-5 106 65,437 107,908 20,944 $0.02
Total 197 255,678 266,239 72,927 $1.82
All three 607 892,241 757,780 245,322 $6.36
  • Input tokens are fresh input plus tokens written to the prompt cache. Tokens read from the prompt cache are counted apart and not priced. The cost is worked out from these counts at the prices in src/codexray/settings/judge.yaml; it is not taken from a bill.
  • Not in this table: AI job A. The rules in rules/<id>.yaml were proposed by decisions propose in an earlier run and then reviewed by a person. That run's ledger is in results/<id>/usage_job_a.json: 458 calls in all (Artemis 59, Shopware 393, Graylog 6), 1,083,824 input and 90,402 output tokens, $6.14. See results/README.md.
  • A re-run of judge answers from the cache in the run folder (judgements/cache/) and makes no call; the ledger counts only calls the gateway answered, so it does not grow. The stability step makes no AI call.
  • A finding without an AI answer that passed every check shows the fixed sentence built from the facts, marked as computed. Without judge the report is complete with those sentences (spec.md §8.7).

Stability of the ranking

make robustness REPO=<id> runs the five tests of spec.md §11.3 and writes robustness.json; the Trust screen shows the same rows. Each cell says how many of the top 5 and of the top 10 are still in the top 5 and top 10 under the test.

Test Artemis top 5 Artemis top 10 Shopware top 5 Shopware top 10 Graylog top 5 Graylog top 10
Identical re-run 5 10 5 10 5 10
Fresh AI run 5 10 5 10 5 10
5% of commits removed, fixed seed 5 9 5 10 4 10
End date moved back one month 4 7 4 6 5 9
Each weight changed by 20% 5 8 4 8 4 9
  • The target, at least 4 of the top 5 unchanged under each test, is met in every test on all three repositories.
  • Identical re-run: the findings came out byte for byte the same, and every analyze table had the same fingerprint.
  • Fresh AI run: the ranking with the stored AI answers against the ranking without them. The AI cannot move a finding, so this row is 5 of 5 and 10 of 10 by design. Beside it, the agreement of the separate votes: all votes agreed on 17 of 25 judged findings on Artemis (66 of 74 votes match the verdict), on 22 of the 24 with an AI answer on Shopware (69 of 72) and on 22 of 25 on Graylog (70 of 73).
  • The step took 12.2 minutes on Artemis, 14.1 on Shopware and 10.4 on Graylog on a 10-core machine while other runs shared it.

Web app

The web app shows one report per repository from the files in web/public/bundles/. It loads static files only: it needs no server of its own and never calls an AI model. Every AI sentence it shows was written by judge and stored in the bundle, and carries an "AI" badge; everything else is marked as computed.

make web                                    # development server at http://localhost:5173
cd web && npm run build && npm run preview  # build the static app into web/dist and serve it

web/dist works offline and from any static host, opened at its index.html: every view lives after the # of the address. make bundle REPO=<id> copies a run's bundle into web/public/bundles/<id>/ and lists it in web/public/bundles/index.json; build again to include it in web/dist.

Address (after #) Screen
/ every repository, with the finding to fix first and its decisions by status; how the pipeline works
/r/<id> Report: verdict, yardsticks, decisions, the simulated fix batch, the top findings
/r/<id>/decisions Decisions, reached from Report: each checked decision with its conformance over time, and the written ones that cannot be checked
/r/<id>/findings Findings: the ranked list and how the ranking is worked out
/r/<id>/findings/<slug> one finding: the reading of the code, the cited lines, the simulation, the priority
/r/<id>/map Map: the module grid. ?view=before|now|after, ?cell=<src>,<dst>, ?finding=<slug>, ?fix=<slug>
/r/<id>/change Before and after: before and after the compared date, structural events, hotspots
/r/<id>/trust Approach: coverage, limits, stability of the ranking, AI calls and their cost
/r/<id>/size Size, reached from Map: lines by module and file, and where the new lines landed

Some values show "not measured in this run" because the bundle does not carry them yet:

  • the rules hash;
  • the evidence behind the AI adoption date;
  • the authority of a decision that no finding cites;
  • the share of commits with an AI marker;
  • the expected and found labels of module links;
  • AI-marked changes against changes with no AI signal, by size band;
  • agreement of the links, and of the file to module assignment, with the comparison linkers;
  • the share of silent misses;
  • the after-fixes grid recoloured for the real repositories: the simulation counts links between modules on a different basis from the grid, so its changes are listed but not drawn on it.

Limits

  • Shopware and Graylog have no measured habit: no folder role met the settings for one there (habit in src/codexray/settings/analyze.yaml). Their decisions are the reviewed rules from rules/<id>.yaml (65 and 2) and the built-in one.
  • The "fresh AI run" stability row compares the ranking with and without the stored AI answers. It does not make a new call, so it does not show how the AI text would change on a run with the cache off.
  • A simulated fix that leaves its target link on the map is shown as "Simulated: the link remains" (on the finding page, "Fix simulated: the link remains."), not as checked: 29 of the 50 simulated fixes on Artemis, 1 of 19 on Shopware and 22 of 50 on Graylog.
  • The simulation works on link counts between modules, and a move moves the whole declaring file. Of the 119 simulated fixes, 14 are fixes that remove a link (Artemis 8, Shopware 5, Graylog 1): the link is taken away by assumption, so they are shown as "Effect if the link is removed", not as checked. Another 26 (Artemis 4, Shopware 9, Graylog 13) changed nothing on the map and are shown as "Not simulated".
  • When the AI answer names no fix action (for example when it judges the link to be intended wiring), the finding shows "No improvement proposed." and the AI's fix text is not shown. In the list to fix first that is 2 of 10 findings on Artemis, 5 of 10 on Shopware and none on Graylog.
  • The before-and-after view describes what changed. With three repositories and no comparison group it does not show cause.
  • AI markers are a minimum: tools can be set to leave none. Code without an explicit marker is "no AI signal".
  • Line origin is the last change to touch a line, which is not always the change that first wrote it.
  • Linking accuracy is agreement with separate comparison linkers, not with a compiler. Links made while the program runs (computed paths, settings files, reflection) are not seen.
  • Thresholds and ranking weights are judgements, kept in src/codexray/settings/.
  • Every run writes its own limits into manifest.json; the Trust screen lists them.

Layout

spec.md                  the specification: single source of truth
PRODUCT.md               who the web app is for and how it should speak
src/codexray/
  core/                  shared by every stage; changes are contract changes
    contracts.py           the records that cross lane boundaries
    schema/*.sql           database tables, one file per stage
    runs.py  db.py  settings.py
  settings/*.yaml        every threshold and weight, starting from the spec's "(initial)" values
  repository/ parse/ model/ decisions/ analyze/ judge/ report/ check/
                         one package per lane; each __init__.py is that lane's brief
  cli.py                 the command line
tests/                   Python tests; conftest.py builds a small repository to test on
schemas/                 JSON Schema generated from contracts.py
rules/                   reviewed decisions per analysed repository
repos.yaml               the three repositories and their pinned commits
results/                 findings, manifest, decisions, AI usage and stability of each repository's run
web/                     the static web app (React, Vite, TypeScript, Tailwind)
  src/App.tsx              the routes
  src/routes/              one file per screen: Landing, Overview, Decisions, Findings,
                           FindingDetail, MapPage, Change, Trust, Size
  src/components/cx/       shared parts: header, map grid, close-up, code pane, badges
  src/cx/                  the shapes the screens read, addresses, labels
  src/data/                the bundle loader and the adapter from bundle to screens
  scripts/                 contract types and the stored map layouts, run at bundle-build time
  public/bundles/        the bundles it loads: the three repositories and two synthetic fixtures
probes/                  measurement scripts behind the spec's numbers; kept as measured
docs/research/           the team's research documents and starter kits
docs/sponsor/            the sponsor deck and judging hints

The AI steps (judge and decisions propose) read the gateway key from the LLM_API_KEY environment variable. Copy .env.example to .env; never put the key in a file that is committed.

Working in parallel

CONTRIBUTING.md lists the lanes, what each one reads and writes, and the rule for changing something another lane depends on. TEAM_RULES.md holds the team's working rules.

About

Checks whether a codebase still keeps its own architecture decisions. Code finds and ranks the exceptions; AI only explains them. Built at hackaTUM 2026, CHECK24 track.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages