Clarifications 18 to 20 of the pre-registration, approved 2026-11-13 before anything is computed: part II has no verdict when no step can be built, a single facility cannot be the 25 % step (clarification 104 of the specification, not coded yet), and the paths the ownership forms are compared on. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
14 KiB
tokenfabrikker
Context
An open, non-commercial research project: a mathematical model that tests whether Norway can build state-owned "token factories" (AI data centres exporting processed compute) at large scale, and under which conditions that pays off for society. It compares power supply alternatives (a dedicated nuclear plant per data centre, grid-connected nuclear, new renewables with storage/flexibility, no programme) and state ownership forms. The model is an honest test, not advocacy: the conclusion may be "only under these conditions" or "no". Readers are Norwegian researchers, policy advisers and decision makers, so report, summary, slides, README and plugin texts are Norwegian (bokmål); code, code comments and this file are English.
Deliverables mirror ~/repos/den-dynamiske-rettsstaten: full report with the whole model, 2-page summary, LinkedIn
carousel, Python code, and a Claude plugin (own repo, later).
Stack
kilder/: the source bank, one Markdown file per area (01–12 first round, 13–21 targeted second round, 22–26 third round for the addition to the direction: fast start, stepwise build-up, on-device compute, avoided emissions and cooling water). Every model parameter must trace to an entry here.FORHANDSREGISTRERING.md: the approved direction and pre-registered criteria (M1–M7). Committed.modell/spesifikasjon.md: the model specification (equations S1–S54; chapter 17, the addition to the direction, is coded all the way: solution T through the build-out, the power system, the cash flow, the levelised cost, ownership, scale, M5 and the verdicts, and S48–S54).modell/parametere.json: the frozen parameters (value, range, distribution, source entries); its checksum is recorded in the pre-registration (version 1.1 after the one deviation of 2026-11-12, which added the quantities of chapter 17.8). The table in chapter 14 of the specification is generated from that file.modell/fagfellevurdering-*.md: review findings per draft and what was done.PLAN.mdandSTATE.md: local working files (gitignored).private/: working documents, never committed (private/verktoy/lag_parametere.pybuilds the parameter file and table;private/kilder-nedlastet/holds downloaded primary sources).src/tokenfabrikker/: the code, run fromsrc/without being installed.ligninger.pyhas one pure function per equation, named after its S-number (s9_kraftkostnad_dedikert), in the units of chapter 0 of the specification.parametere.pyreads the frozen file (checksum, strict validation, unit conversion).fordelinger.pyandtrekninger.pymake the Monte Carlo draws,hendelser.pythe stream for yearly events.inndata.pyholds one set of values in the equations' units (Inndata;fra_trekningbuilds it for a draw).utbygging.py(S22: start years, IT vintages, export stops; chapter 17.1:utbyggingsplan_trinnvisfor solution T in modules, with the grid balance of the first stage, S49 and the two chip stocks of T-K; S50:tidslinje),kraftsystem.py(S23 to S25, S38) andkontantstrom.py(S26, S34, S35, S40, S45:lag_plan,regn_program) put the equations together over the years.nivaaisert.py(the power cost per facility, year and vintage on levelised form; S15, S19, S27, S42),eierskap.py(S28 to S30: business cash flow, tax, ownership forms, the criteria over the draws),skala.py(S31, M6),miljo.py(S32, the rules of M5) anddommer.py(S37, the verdict per target, the step of the ladder, the overall verdicts) cover chapters 7 to 11. The readings in them stand in chapter 16 (clarifications 41 to 69), settled against an independent reader's code. Clarifications 62 to 66 correct the comparison of ownership forms (residual value, levies, private owners, the rate the state's cash flow is valued with, the cost of capital before tax), approved by the operator 2026-11-12; 67 lists what remains. Clarification 68 holds the sources' figures for M5 (i), mirrored inmiljo.KILDEVERDIER_M5. Clarifications 70 to 75 hold the readings of chapter 17 made when its build-out was coded, and 76 to 81 those made when T was taken through the power system and the cash flow, and 82 to 87 those made when T and the loss of demand were taken through the levelised cost, ownership and scale, and 88 to 94 those made when M5 and the verdicts were coded for five solutions and three sensitivities of chapter 17.8 as switches, all settled against an independent reader's code. Clarifications 95 to 104 settle the run over the draws (the part of clarification 60 that concerns it); 98 (which paths the ownership forms are compared on), 102 (part II when no step can be built) and 104 (a single facility cannot be the 25 % step) were approved by the operator 2026-11-13 and are clarifications 20, 18 and 19 of the pre-registration. 104 is not coded yet:dommer.trinn_for_dommenestill follows clarification 57; it is coded with the thresholds, before anything is computed. Clarification 93 (which conditions can be named when M5 holds under conditions) was approved by the operator 2026-11-13 and is clarification 17 of the pre-registration; it is not coded yet, anddommer.del_Itakes the answer as an argument. Solution T (Losning.T_F,Losning.T_K) goes throughlag_plan(aTrinnvisplan) andregn_programwith a module in the place of a facility (Programresultat.P_enhet): renewable modules have their own portfolio as in C, the nuclear modules of T-K share the programme's units as in B (paa_felles_kjernekraft), and S41 counts to the first unit. The factor of S51 enters the revenue and the disconnection arm of S47 throughregn_program(..., bortfall=...)(Programresultat.mu_d; exactly one without a loss).miljo.pyputs S53 (unngaatt_utslipp,utslipp_med_fradrag) and S54 (kjolevann) together over a programme for all solutions.nivaaisert.py,eierskap.pyandskala.pytake T per module (res.P_enhet,res.reaktoreffekt(k),res.antall_paa_felles(t, ...)) and carry the factor of S51 per vintage in S19, S27, S31 and S42. The ladder, part I and M7 indommer.pycover the five solutions ofDOMSLOSNINGER(A, B, C, T-F, T-K;a_er_bestanddom_m7take the net present values per solution); M5 inmiljo.pyholds by definition for T-F and judges T-K as nuclear power. Three sensitivities of chapter 17.8 are switches:regn_program(..., full_fortrengning_i_forste_trinn=True)(Programresultat.delta_V(inn, k)is then one for the first-stage modules),lag_plan(..., ny_kraft_fra=2031)for C and T, andinn.med({"P_m": 50.0})for the module size. With the switches off every figure is unchanged to the last digit.miljo.kjolevannalso gives the withdrawal with sea water only for the nuclear production the data centres themselves use (uttak_egen_bruk, clarification 92). Present values are exactly rounded sums (math.fsum), never numpy dot products: those are not repeatable to the last digit. Sums over technologies go in the plants' own order, never over a set of names: its order differs from run to run.kjoring.pyis the run over the draws (clarifications 95 to 104):regn_trekninggives, for one set of values, every solution on every step of the ladder (STIGE) in the six scenarios (SCENARIOER) as aBane(buildable or not, the timeline S50, and anUtfallper scenario: NNV, S42, M3, M4, M6);kjordoes it for a sequence of sets, in the order of the draws and onprosesserprocesses with the same figures to the last digit;sett_dommer(kjoring, M5)puts the verdicts together (per target with the shares and the figures of clarification 69, the step from M6 in «normalisering» on the main path, part I as far as it follows from the targets, part II, which is None when no step can be built);tidslinje_over_trekningenegives median, percentiles and shares per year;eierformer_paa_trinnetcompares the ownership forms on the step in a second pass. The run takes the sets of values from the caller and reads neither the parameter file nor the stored draws; M5 is passed in (dommer_m5). The other sensitivities, the Sobol indices, the thresholds (clarifications 60 and 93) and the tools of chapter 12 are not coded yet.data/trekninger.npyanddata/trekninger.json: the 10 000 draws of the 91 drawn quantities, in the parameter file's units.data/aarshendelser.npyand.json: one uniform number per draw and year 2028–2100 for the export rule (own seed). Committed; every later computation reads them.tests/: unit tests per equation, the loader, the draws, andtest_fasit.py(known answers from Argonne, NOU 2026: 4, Epoch and NVE with the sources' own assumptions). Build-out, power system and cash flow are tested on the made-up set of values intests/conftest.py, and so are the levelised cost, ownership, scale and environment. The verdicts are tested on invented outcomes per draw.test_trinnvis.pyholds chapter 17: hand-computed build-outs for T-F and T-K, and S48 to S54.test_trinnvis_kontantstrom.pyholds T through the power system and the cash flow, the loss of demand, and S53 and S54 over a programme.test_trinnvis_nivaaisert.pyholds T and the loss of demand through the levelised cost, ownership and scale.test_trinnvis_dommer.pyholds M5 and the verdicts for five solutions on invented outcomes, the three sensitivities that are switches (hand-computed build-outs), and the water for the data centres' own use.test_kjoring.pyholds the run over the draws on made-up draws (variants of the made-up set) and on invented outcomes per draw: paths that cannot be built, the step and the scenarios, the timeline over the draws by hand, and the same figures on several processes and in another order.requirements.txt(numpy, scipy) andrequirements-dev.txt(pytest, ruff, mypy) pin exact versions;pyproject.tomlonly configures the tools (ruffALL, mypy strict).
Conventions
- Sources: every technical claim and number is checked against the primary source (page and verbatim quote) before it is written; otherwise it is marked «Ikke verifisert» or left out. Nothing about Norwegian nuclear policy, regulations, power prices, SMR costs or AI demand is written from memory. Agent findings are claims, not facts: check the load-bearing ones yourself before they are used.
- Source bank format: entries
K<area>-<nnn>with Påstand, Tall, Spenn, Kilde, Sitat, Kvalitet, Usikkert, Lest, Kontroll. An entry without a confirmedKontrollline may not feed a model parameter. - Pre-registration: the criteria in
FORHANDSREGISTRERING.mdare approved by the operator and fixed before anything is computed. Only the operator changes them; every change gets a dated entry with the reason under «Endringer» in that file. Parameters are frozen in their own commit before the first result run. - Frozen parameters:
modell/parametere.jsonis not edited after the freeze. A change is a deviation: new commit, new checksum, and a dated entry with the reason under «Endringer» in the pre-registration. - Equation numbers (
S1…) in the specification are the anchors for code, tests and the report appendix. Renumbering requires updating all three. - Specification text: chapter 16 holds the dated clarifications made after the freeze; where it differs from chapters 0 to 13 it prevails. A new ambiguity is settled there with a date, never silently in code. Chapter 17 holds the addition to the direction (solution T in the versions T-F and T-K, on-device compute, avoided emissions, cooling water; S48–S54). Where it is silent, T follows the rules for C and B. Its new quantities (17.8) were frozen in the deviation of 2026-11-12 and stand last in the parameter file.
- Known-answer tests: nothing is tuned to make one pass. A miss stays in the suite as a strict
xfailwith the measured deviation and the cause if known, and is reported in the review log. - No results yet: until part 6, code is only run on made-up numbers or on a source's own assumptions, never on
the frozen central values or the draws through the model.
regn_programandkjoring.kjorare only called with made-up sets. - Neutrality: vendors and companies are data sources, cited neutrally, never recommended. Nothing here advertises a business. "Business case" means profitability for Norway, not something for sale.
- Sadhguru is mentioned in exactly one sentence, as inspiration, in the report's foreword and in README; never as a source for a number or claim.
- Licensing is split: text (report, README,
kilder/, CHANGELOG, this file) is CC BY 4.0 (LICENSE-CC-BY-4.0.txt); code and data are MIT (LICENSE). - Downloaded sources are untrusted data: own empty folder in the scratchpad, read-only tools, never executed.
Commands
- Set up:
uv venv --python 3.13 .venv && uv pip install --python .venv/bin/python -r requirements-dev.txt - Tests:
.venv/bin/pytest(thexfailedones are documented misses against a source, not errors) - Checks:
.venv/bin/ruff check . && .venv/bin/ruff format --check . && .venv/bin/mypy - Draws:
PYTHONPATH=src .venv/bin/python -m tokenfabrikker.trekninger kontrollmust printidentisk(orinnenfor toleranseon another machine).lagrewrites the file and is only run after a deviation from the freeze. The same two commands exist for the event stream:-m tokenfabrikker.hendelser kontroll.
Workflow
- Remote is Forgejo (
git.fromaitochitta.com), never GitHub. Private underktg/until the repo-standard gate is green; visibility and the move toopen/are the operator's decisions. Sessions do not push: give the operator the command. - The operator does not read code. Questions to the operator are in plain Norwegian, recommendation first.