Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
162 changes: 125 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ It is our entry for the CHECK24 track of hackaTUM 2026, "Visualise and judge a c
The full specification is [spec.md](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.
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

Expand All @@ -23,11 +24,17 @@ source files. Every finding cites the commit, file and lines behind it.
| 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) | `make robustness REPO=<id>` after `report` measures it (13 to 21 minutes per repository on 4 cores) and rebuilds the report |
| Emerging-hotspots list | Not filled yet |

The results in this repository were made without AI calls: the finding text is the fixed
sentences built from the facts.
| 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 Report 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](#token-usage-per-analysis).

## Prerequisites

Expand All @@ -36,10 +43,18 @@ sentences built from the facts.
- 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/`; about 4 GB for all three.
- Time: a whole run took 4.7 minutes on Artemis, 9.2 on Shopware and 4.7 on Graylog on a
10-core laptop, with the clone already in `repos/`. Downloading the clone comes on top
and was not measured.
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.

```sh
make setup # uv sync, then npm ci in web/
Expand All @@ -56,8 +71,10 @@ uv run codexray parse --repo artemis
uv run codexray model --repo artemis
uv run codexray analyze --repo artemis
uv run codexray report --repo artemis
make bundle REPO=artemis # copy the run's bundle into web/public/bundles/artemis
make web # the web app at http://localhost:5173
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:
Expand All @@ -76,42 +93,113 @@ The other two take the same commands with their own URL and id:
- 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.
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.

## Where the results are

- [`results/<id>/`](results/): `findings.json`, `manifest.json` and `decisions.yaml` of
each run, copied byte for byte. [results/README.md](results/README.md) says what each
file is.
- [`results/<id>/`](results/): `findings.json`, `manifest.json`, `decisions.yaml`,
`usage.json`, `robustness.json` and `ARCHITECTURE_RULES.md` of each run, copied byte for
byte. [results/README.md](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 | Whole run | Findings at END | Decisions | Bundle on disk |
|---|---|---|---|---|---|
| ls1intum/Artemis | `d8fc451` | 4.7 min | 219 | 16 | 42 MB |
| shopware/shopware | `ec8b714` | 9.2 min | 179 | 1 | 32 MB |
| Graylog2/graylog2-server | `4912933` | 4.7 min | 189 | 1 | 31 MB |
| 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.
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

| Repository | AI calls | Tokens in | Tokens out | Cost |
|---|---|---|---|---|
| ls1intum/Artemis | 0 | 0 | 0 | $0 |
| shopware/shopware | 0 | 0 | 0 | $0 |
| Graylog2/graylog2-server | 0 | 0 | 0 | $0 |

No AI call was made: the AI jobs (`judge` and `decisions propose`) are not built on this
branch, and the report is complete without AI text.
The ledger of every AI call the gateway answered for these three runs, summed from
`results/<id>/usage.json`. The Report 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 covered: AI job A. The rules in `rules/<id>.yaml` were proposed by `decisions
propose` in an earlier run and then reviewed by a person. No ledger of that run is
committed, so its calls, tokens and cost are not in this table and this repository
cannot state them.
- 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.
- With AI text switched off (the "AI text" switch in the app, kept in the address as
`ai=off`), every finding shows the fixed sentence built from the facts. 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 Report 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.

## Limits

- Shopware and Graylog have one decision each, the built-in "production code does not
depend on test code": no folder role met the settings for a measured habit there
(`habit` in `src/codexray/settings/analyze.yaml`), and decisions from written documents
need `decisions propose`, which is not built.
- 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 grid, "Fix simulated: the link remains"), not as checked: 32 of the 50
simulated fixes on Artemis, 10 of 19 on Shopware and 35 of 50 on Graylog.
- 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
Expand Down Expand Up @@ -142,16 +230,16 @@ tests/ Python tests; conftest.py builds a small repository to
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 and decisions of each repository's run
results/ findings, manifest, decisions, AI usage and stability of each repository's run
web/ the static web app (React, Vite, TypeScript)
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, once built, 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.
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

Expand Down
46 changes: 29 additions & 17 deletions results/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Results

The output of one full run of CodeXray on each of the three repositories, copied byte for
byte from the run folder `runs/<id>/<END_SHA>/<params_hash>/`. The web app's copy of each
run is in [`web/public/bundles/<id>/`](../web/public/bundles/).
byte from the run folder `runs/<id>/<END_SHA>/<params_hash>/`. Each run went from `ingest`
to `report`, then `judge` (AI jobs B and C) and the stability step. The web app's copy of
each run is in [`web/public/bundles/<id>/`](../web/public/bundles/).

| Folder | Repository | Pinned commit (`repos.yaml`) |
|---|---|---|
Expand All @@ -14,9 +15,12 @@ run is in [`web/public/bundles/<id>/`](../web/public/bundles/).

| File | Holds |
|---|---|
| `findings.json` | Every finding at the pinned commit, ranked, with its evidence (commit, file and lines) and its priority. The first ten are the list to fix first. |
| `findings.json` | Every finding at the pinned commit, ranked, with its evidence (commit, file and lines), its priority, its judgement and its simulation result. The first ten are the list to fix first. A judgement with `status: "ai"` is AI text that passed every check; `status: "template"` is the fixed sentence built from the facts. |
| `manifest.json` | The pinned commit, `params_hash`, tool and grammar versions, the settings in effect, what was read and what was not, and the limits of the run. |
| `decisions.yaml` | The decisions that were checked: measured habits and the built-in ones, with their source. |
| `decisions.yaml` | The decisions that were checked: the reviewed rules from `rules/<id>.yaml`, measured habits and the built-in one, each with its source. |
| `usage.json` | The AI usage ledger: one entry per call the gateway answered (job, model, tokens, cost). The README sums it per job and model. |
| `robustness.json` | The stability table of spec.md §11.3: the five tests, the overlap of the top 5 and top 10 with the baseline, rank-biased overlap, and the vote agreement of the judged findings. |
| `ARCHITECTURE_RULES.md` | The reviewed decisions in plain sentences, each naming its source, for a rules file that AI coding agents read (spec.md §11.5). |

## How to reproduce

Expand All @@ -29,22 +33,30 @@ 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 # needs LLM_API_KEY
make robustness REPO=artemis # the stability table, then the report again
```

`ingest` pins the repository to the commit in `repos.yaml`. The three files then sit in
`ingest` pins the repository to the commit in `repos.yaml`. The files then sit in
`runs/artemis/<END_SHA>/<params_hash>/` and can be compared with the ones here
(`shasum -a 256`).
(`shasum -a 256`). Without `LLM_API_KEY`, skip `judge`: the report is complete with the
fixed sentences, and `findings.json` and `usage.json` differ from the ones here.

These runs fetched pull-request descriptions with a token in `GITHUB_TOKEN` (the variable
named in `src/codexray/settings/repository.yaml`). Without it the run is still complete,
the `prs` table is empty, and `manifest.json` differs in its `coverage.prs` part.

## What is not here yet, and why

- **`usage.json`** (the AI usage ledger): no AI call was made for these results. The AI
jobs (`codexray judge`, `codexray decisions propose`) are not built on this branch, so
calls, tokens and cost are 0 for each repository and the finding text is the fixed
sentences built from the facts. A hand-written ledger would be an invented result.
- **`robustness.json`** (the stability table): the stability stage is not merged yet.
- **`judgements/`**: there are no AI responses to cache.
- **`codexray.duckdb`**: 0.6 to 1.1 GB per repository. It is rebuilt by the commands above.
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.

## What is not here, and why

- **The ledger of AI job A** (`decisions propose`): the rules in `rules/<id>.yaml` were
proposed in an earlier run and then reviewed. That run's `usage.json` and
`proposals.yaml` are not committed, so the calls, tokens and cost of job A are not
recorded in this repository.
- **`judgements/`**: the stored AI answers and the answer cache. The judgements that are
shown are already in `findings.json` and the web bundle. Without the cache, `judge` on a
fresh clone makes new calls, and the AI text can differ.
- **`simulation_batch.json`**: the batch of cheap-loop fixes; its result is in the web
bundle's `report.json`.
- **`codexray.duckdb`** and the stability step's second run (`robustness/`): 0.6 to 1.1 GB
each per repository. They are rebuilt by the commands above.
Loading