den-dynamiske-rettsstaten/CLAUDE.md
Kjell Tore Guttormsen e6e9d3c74d
fix: correct findings from the pre-publication quality check
Seventeen independent read-only reviews (figures and sources, the diagnosis
tool, the mathematics, simulation numbers, appendix C, references, claims,
language, layout, summary and slides, README and repo, cross-document
consistency), each followed by an independent verifier. Every fix below was
checked against the source or recomputed before it was applied.

Norwegian diagnosis (paper/norge_2025.json, README):
- The prison outflow mixed units: it multiplied "cases handled" (16 000) by
  the share of enforced cases. It now uses enforced cases (KDI annual report
  2025, p. 70: 5 180 in the community = 58 %, so about 3 750 in prison), and
  the queue excludes sentences waiting for electronic monitoring.
- Result changes: prison and police/prosecution tie at utilisation 1,09; the
  tool points to prison on backlog growth. README says the difference is
  smaller than the uncertainty and lists the sensitivity (1,06 to 1,10).
- Police backlog taken directly from POD report 1/2026 fig. 3.2.1 (31 908
  vs 30 295); page references to the courts report corrected (15 and 18).

diagnose.py:
- Norwegian error messages instead of tracebacks for bad input; same
  expansion threshold as sim.py; tie message; honest wording when no
  forecast is given, when the constraint is the first link, and when a
  backlog grows with no link above full utilisation.

Note, summary and slides (PDFs rebuilt: 58, 2 and 16 pages):
- b_sat in (13') lacked the factor 1/T-bar; lowest trust in appendix C is
  0,33, not 0,47; nine numbers rounded or quoted wrongly; one sensitivity
  sentence was wrong for mu_4; the abstract claimed more police effort does
  not reduce crime, which the model contradicts.
- The decommissioning rule is described as the code implements it.
- Three references corrected, one added (Srivastav et al. 2019).
- Core sentence quoted verbatim in README and section 9.
- Layout: duplicate hyperref targets, the overfull box in table 1, three
  figures with colliding labels, one stranded heading.
- Summary and slides no longer say "not tested on Norwegian data"; slide 16
  gives the repository address.

sim.py and paper/data/ are untouched.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 15:46:23 +01:00

26 lines
3 KiB
Markdown

# den-dynamiske-rettsstaten
## Context
Concept note (Norwegian, LaTeX) and its simulation code. The principle: enforcement effort should track how much, and how seriously, laws are actually broken. Published as open, non-commercial material. Readers are Norwegian, so README and paper are in Norwegian (bokmål); CLAUDE.md and code comments may stay as they are.
## Stack
- `paper/sim.py`: Python 3, numpy + scipy (pinned in `requirements.txt`). Writes `paper/data/*.dat`, which pgfplots in the LaTeX source reads.
- `paper/*.tex`: LaTeX. `main.tex` and `notat.tex` build with pdflatex, `karusell.tex` with xelatex (font Inter from TeX Live). `main.tex` = the note (inputs `part1`-`part4`, `refs`), `notat.tex` = 2-page summary, `karusell.tex` = slides. Shared `preamble.tex`. Bibliography is a hand-written `thebibliography` in `refs.tex`.
- `pdf/`: the published PDFs. They are build output committed on purpose; rebuild and replace them together with source changes.
## Conventions
- The core sentence must be quoted verbatim everywhere: «Innsatsen for å håndheve lover og regler bør løpende stå i forhold til hvor mye, og hvor alvorlig, de faktisk brytes.» Short form of the clarification: «Straffebud og strafferammer ligger fast.»
- Any change to `sim.py` must keep `paper/data/` byte-identical unless the change is meant to alter results; then text, figures and PDFs change in the same commit.
- Licensing is split: text (`pdf/`, `paper/*.tex`, `README.md`, `CHANGELOG.md`, `CLAUDE.md`) is CC BY 4.0 (`LICENSE-CC-BY-4.0.txt`); code and data (`paper/sim.py`, `paper/diagnose.py`, `paper/eksempel_domstol.json`, `paper/norge_2025.json`, `requirements.txt`, `paper/data/`) are MIT (`LICENSE`). New files follow the same split.
- Never commit anything under `private/` (working documents: peer review, change list, social-media drafts, original source zip).
## Commands
- Setup: `python3 -m venv .venv && .venv/bin/pip install -r requirements.txt`
- Run simulation (about 2 min, from `paper/`): `../.venv/bin/python sim.py`
- Bottleneck diagnosis from own numbers (stdlib only, from `paper/`): `python3 diagnose.py eksempel_domstol.json`; must reproduce section 9.5 (utilization 1,28, +19 % capacity). `python3 diagnose.py norge_2025.json` must match the table in README (1,09 / 1,04 / 0,88 / 1,09).
- Reproduction check after a run: `git status paper/data` shows no changes (verified 2026-11-10: 22/22 files identical with Python 3.14.0, numpy 2.5.4, scipy 1.18.1)
- LaTeX build (from `paper/`, TeX Live 2026 in `/Library/TeX/texbin`): `pdflatex main.tex` and `pdflatex notat.tex` three times each, `xelatex karusell.tex` twice; copy to `pdf/` (verified 2026-11-10: main 58 pages, notat 2, karusell 16, no undefined references). Build in a scratch copy of `paper/` to keep aux files out of the repo, and give each run a time limit: one pdflatex run has been seen to hang.
## Workflow
- Repository starts private under `ktg/`; moving it to `open/` is the operator's decision.
- Run the repo-standard skill before publishing.