Skip to content

Audit A1: refine3D / multi-state / sampling policies against the code (2026-10-21)

Scope: the eight documents of the assignment. Code state: working tree at fd5b5bc8e (only src/main/cftc/*cartft_calc* dirty). All links and src/...f90 paths named in the eight documents resolve; every backticked identifier exists somewhere in src (checked mechanically). The findings below are what remains after that check. Line numbers are those of the document.

Also read, because they bear on the findings: the new untracked doc/policies/README.md and doc/policies/layering_and_project_ownership_policy.md (call it LPO), .github/skills/simple-refine3d/SKILL.md, simple-main-strategies/SKILL.md, simple-frac-update-trailing, simple-solve3d-importance-sampling.


doc/policies/3D/refine3D_policy.md (lines 1229; last commit 2026-10-20; verdict: stale in sections 6, 9, 10, 11; too long; ownership text of 2026-10-20 mostly verified)

Project read/write order (focus 1), checked line by line against simple_refine3D_strategy.f90: the distributed master's reprojection model on its own builder (materialize_reprojection_model_master, lines 586-616), prob_align_exec/volassemble_exec(write=.false.)/ commit_sigma2_exec on (params, build) (1344-1346, 1434, 1565), the three particle-field writes (1352/1357/prob_align's own write_segment_inside; 1389-1390 merge_algndocs(write=l_polish); 1592), out once before postprocess (1484), workers writing no project (only refine3D_exec documents), the empty-partition transaction (simple_strategy3D_matcher.f90:127-155), the removed entry points: all match. One rule is violated (first finding below).

  • [H][STALE] L328-337: "matching references are NOT multiplied by any envelope (2026-09-02) ... The matcher applies the spherical soft reference mask only" -> now: the _nu_filt references ARE multiplied by the active envelope after filtering (density envelope under automsk=yes, valid NU-evidence envelope under nu, density fallback), and the matcher multiplies non-NU references by the density envelope itself. Evidence: src/main/volume/simple_nu_state_filter.f90:157-167 ("MULTIPLIED BY THE ... ENVELOPE"); src/main/strategies/search/simple_matcher_refvol_utils.f90:412-418,428-460. Fix: replace the paragraph by the lag-by-one and fallback rule of automasking_policy.md "Reconstruction and reference use"; delete "no separate envref control" (an absence claim about a retired key). Same wrong claim at L899-901 ("never multiplied into a matching reference").
  • [H][CONTRADICTS] L328-337 and L899-901 vs 3D/automasking_policy.md L79-87 and 3D/refine3D_auto_policy.md L72-74 (both say the references are multiplied by the envelope). The two other documents match the code.
  • [M][STALE] L339-342: "valid only with filt_mode=nonuniform|nonuniform_lpset. automsk=yes with none, uniform, or fsc is rejected during parameter validation" -> now: only automsk=nu requires an NU filter mode; automsk=yes is accepted with any filt_mode (matcher applies the density envelope). Evidence: src/main/params/simple_parameters_phases.f90:902-905 (nu only), :911-914 (tight rejected with NU only). Contradicts refine3D_auto_policy.md L81-86 (which is right). Fix: "automsk=nu requires filt_mode=nonuniform|nonuniform_lpset; automsk=tight is rejected with NU filtering."
  • [M][VIOLATED] L176-184: "assembly and the PCG master do not write the project on this path" -> execute_rec3D_pcg_distributed_master writes the particle field to the project file unconditionally once per call (after setting res, res05, cfar), so a distributed rec_backend=pcg iteration writes the field once more than the stated three times. Evidence: src/main/strategies/parallelization/simple_rec3D_pcg_strategy.f90:931 (no write argument in the signature, line 494; assemble_refine3D_pcg forwards write=.false. only to filter_pcg_nonuniform_maps, simple_refine3D_strategy.f90:246-248). The same claim is in the restructuring report (Phase 5), .github/skills/simple-refine3d/SKILL.md ("project writes from assembly") and LPO section 5 rule 4 (not in LPO's ledger, section 8). Fix: code (give the PCG master the write flag the gridding path has), or state the PCG exception here.
  • [M][DRIFT] L157-159: "keeps prototype command lines for worker, probability, sigma, assembly, and postprocess steps" -> the probability and assembly prototypes are dead: cline_prob_align_distr (declared :100, set :1110/1119-1121) and cline_volassemble (:102) are never read; prob_align and assembly lines are built per iteration from cline (:1329, prepare_assembly_cline). Live prototypes: cline_rec3D (start reconstruction, :1209), cline_postprocess (:1491), cline_commit_sigma2 (only its nthr, :1564). Fix text, and delete the two dead members.
  • [M][DRIFT] L186-188: "which_iter <= startit with continue != yes is fresh" -> the code adds an exception the refine3D_auto bootstrap relies on: a fresh start still consumes the project's lp when the _nu_filt even reference of the same assembly is on disk. Evidence: simple_matcher_smpl_and_lplims.f90:134-161 (try_nu_project_working_lp). Add the exception; section 6 L359-364 lists the project handoff only for "a continuing" run.
  • [M][STALE] L1002-1008: "Trailing reconstruction blends even with previous even ... assembly trails the even and odd half-volumes first and then merges the trailed halves" -> trailing is in the accumulator domain (sums and rho per half, trailrec_stateNN* / pcg_trail_stateNN*); finished half maps are never blended (importance_sampling_fractional_update_policy.md L464-465 says so). Evidence: simple_volassemble_strategy.f90:138-255 (blend_trailing_accumulators). The sentence about "low-resolution even/odd docking insertion" has no counterpart in assembly (the only insertion is the matcher's blend_lowres_eo_for_registration, simple_matcher_refvol_utils.f90:622); drop it from this section. Fix: "assembly blends the previous chain's accumulators into the current partials (population rule, importance-sampling policy section 7), then restores".
  • [M][VIOLATED] L46-48 (parity) vs L1132-1140 (finalization): the distributed strategy stops on converged .and. iter >= startit + 2 (simple_refine3D_strategy.f90:1526), the shared-memory one has no such floor; combine_eo is honoured as a final extra iteration in distributed only (:1532-1550); on finalization only the shared-memory inmem_finalize_run removes vol/fsc entries of empty states (:990-1017), distr_finalize_run (:1616-1634) does not (a state with zero population keeps its carried-forward entry, :1445-1453). L1137 ("empty states are removed from os_out") is therefore true for shared memory only. Fix: state which rule is per strategy, or align the code.
  • [L][DRIFT] L204: "For multi-state distributed startup" -> shared memory does the same (inmem_initialize, :745-754, seed_multistate_startup_labels + assert_multistate_populations). Only difference: shared memory seeds when the field has at most one state bin.
  • [L][DRIFT] L129-134: "shared-memory refine3D ... use them [the commanders]" -> shared memory calls commander_prob_align(_neigh) and commander_commit_sigma2 but run_volassemble (the strategy module's own entry), not commander_volassemble (simple_refine3D_strategy.f90:927; also simple_rec3D_service.f90:263).
  • [L][DRIFT] L274-276: calc_final_rec "closes solve3D, refine3D_auto, refine3D_states and classify3D_refs" -> also refine3D_states_cavgs (simple_commanders_refine3D.f90:958); and without ML regularization (ml_reg=no or objfun=cc) it ships a cc map by reconstruct3D (simple_final_rec.f90:77-88,424-427), which section 5.1 never says.
  • [L][DRIFT] L1143-1145: the five-iteration PCG floor applies "to solve3D and refine3D_auto" -> to every calc_final_rec caller (prep_final_rec_cline -> configure_final_pcg_solve_budget, simple_final_rec.f90:430-433).
  • [L][DRIFT] L913-917: console strings are >>> MATCHING LOW-PASS LIMIT (THIS ITERATION) and >>> NU HANDOFF LP (NEXT) (simple_convergence.f90:365-368), not "NU HANDOFF LOW-PASS (NEXT)".
  • [L][DRIFT] L955-956: "maxits_pcg (default 2, capped at 8 in production)" -> 8 only produces a warning; 100 is the hard limit (simple_rec3D_pcg_strategy.f90:2065-2071).
  • [L][DRIFT] L55, L94: "simple_commanders_refine3D.f90 ... should stay thin" -> the module also hosts refine3D_auto (707 lines, with the 125-line prepare_state_work_project), refine3D_states, refine3D_states_cavgs (459), classify3D_refs (392) and bootstrap_rec3D; the ownership section names none of them. LPO section 8 lists the long commanders; say here which module owns what.
  • [M][GAP] Convergence contract of 3D refinement. Section 2 gives simple_refine3D_strategy "convergence checks" but no rule is stated except refine=cont (L698-710). Missing: single state converges on mean % search space scanned > fracsrch (default 99) and orientation overlap > overlap (default 0.99); independent multi-state on min state joint overlap > OVERLAP_STATE_JOINT (0.96) and frac_srch, scan_exit adds the scan alone; multivol_mode=input_oris* (refine3D_states) on state overlap mi_state > overlap; minits; lpexit (stage resolution exit); distributed floor iter >= startit+2; the shift search switches on when mean % scanned >= FRAC_SH_LIM (trs set from MSK_FRAC*msk, bounded MINSHIFT/MAXSHIFT, and copied into the job description by the master, :1574-1578). Evidence: simple_convergence.f90:455-560, simple_defs_conv.f90, simple_refine3D_strategy.f90:1526,1529. Proposal: new section "Convergence" after section 7.
  • [M][GAP] Who draws the iteration's sample, per mode. Only the probabilistic path is stated (importance policy section 1). Code and the skills (simple-refine3d "Common Traps", simple-solve3d-importance-sampling line 113) have four more rules: a distributed non-probabilistic fractional pass is drawn once by the master over the whole project and the workers reproduce it (master_draws_sample3D, simple_matcher_smpl_and_lplims.f90:273-290; master branch simple_refine3D_strategy.f90:1350-1354); the polish pass reproduces the discrete pass's sample; eval, sigma, update_missing and full updates are deterministic and not drawn by the master; shared memory draws in refine3D_exec (simple_strategy3D_matcher.f90:423-445). LPO section 3 ("A worker reproduces, never redraws (ruled)") is not true for these exceptions. Proposal: section 4 of this policy, one table (mode, who draws, who reproduces).
  • [M][GAP] Artifact table. Section 12 says assignment maps, partials, state volumes, FSC files, automasks and NU outputs "are explicit workflow contracts" but no policy lists them. Needed (writer, reader, lifetime, removal): reprojection_model_{even,odd}.bin and cart_refvols_{even,odd}.bin (simple_refine3D_fnames.f90:266-275); dist_part<NNN>.dat, dist_part_neigh_<NNN>.dat, assignment_part.dat (removed before generation, simple_prob_align_strategy.f90:372-387, and after a march); partial recvol_state<NN>_part<NNN>_{even,odd}.mrc + rho_ (removed every round, remove_partial_rec_files); pcg_raw_state* (deleted only after every state solved, simple_rec3D_pcg_strategy.f90:936-946); chains trailrec_state*/pcg_trail_state* with manifests; algndoc_<part>; sigma2 range, candidate and committed files; clssmp.bin; the sentinels JOB_FINISHED, COMMIT_SIGMA2_FINISHED, VOLASSEMBLE_FINISHED; BENCH/. Proposal: a table in section 11 (replaces the benchmark table, see STRUCTURE).
  • [M][GAP] Dropped and carried-forward states. determine_dropped_states drops a state with no partial on disk in a multi-state iteration (never all states) and carries its previous volume forward; a state whose realized fraction is < 0.001 with a chain restores from the chain, without a chain carries the previous volume forward, with neither stops with an error; the master registers nothing for a state with no map and keeps its input volume as reference (simple_volassemble_strategy.f90:1018-1077,160-206; simple_refine3D_strategy.f90:1442-1467). Only the trailing half is in the importance policy (L473-477). Proposal: section 9 "Empty and unreconstructed states".
  • [M][GAP] sigma_commit_deferred. The strategy skips its last canonical sigma2 commit when sigma_commit_deferred=yes and the iteration is final (canonical_sigma_commit_deferred, :1601-1607); solve3D sets it (simple_solve3D_controller.f90:598) and commits itself (simple_solve3D_utils.f90:801-811); the pose initialization forces no. Section 9.1 "Sigma ordering" mentions only "a stage-owned reconstruction ... before the final transaction is published". Name the key and the owner's obligation (commit before anything reads the store).
  • [M][GAP] update_missing pass. Used by refine3D_states, classify3D_refs and refine3D_states_cavgs as their terminal coverage pass (refine=greedy greedy_sampling=yes update_missing=yes volrec=no); the sampler takes only active rows with updatecnt==0 (sample4update_missing), and the key is refused with a probabilistic mode (simple_strategy3D_matcher.f90:432-434). Appears only as a passing mention (L298). Proposal: section 4 or importance policy section 5.
  • [M][GAP] Shared-memory project I/O order. Section 4 states the distributed order only. Shared memory writes the oritype segment at five points per iteration (after the model, :578; before prob_align, :859; after the matcher when gridding assembly follows, :889-890 (publish_before_file_assembly, stated only in importance policy section 8); around the polish, :895/:909; inmem_finalize_iteration, :970), re-reads it after the prob_align commander (:866), and each commander it calls builds its own params/builder from the file. LPO section 4 states the rule for "a commander calling a commander"; refine3D_policy should say which writes the shared-memory iteration owes its callees.
  • [L][GAP] multivol_mode (single|independent|input_oris_refine) selects the multi-state convergence rule only (simple_convergence.f90:511); derived by refine3D_states_controller and classify3D_refs, forbidden on solve3D. Not mentioned here.
  • [L][GAP] oritype=cls3D refinement (class averages as particles: vol_cavg instead of vol, map2ptcls in distr_finalize_run, lp read from os_cls3D) is visible in the strategy at six places and in one line of section 11.2; no rule says when it applies.
  • [L][GAP] Distributed start order (distr_initialize, :1062-1255): state labels -> canonical sigma2 (calc_pspec commander, then projinfo re-read) -> rnd_oris/set_projs writes -> start reconstruction by the reconstruct3D commander (volumes renamed to start volumes, unfiltered copies kept) -> invalidate_fresh_start_refs_from_volumes; each commander call is a project hand-over through the file. Not stated.
  • [L][GAP] inmem_execute_iteration takes the prob_align table commander as an argument of the strategy routine (run_prob_align(cline, xprob_tab)), the reason the routine cannot import it (LPO section 3); policy section 3 omits it.
  • [M][STRUCTURE] 1229 lines. Sections 5.1 (L238-316, 79 lines, 11 dated rulings), 8 (L398-877, 480 lines), 11.1 (L1023-1109) and 11.2 (L1143-1197) are mostly reference or history, not rules. Answer to the specific question: section 8 is mixed: "Probabilistic and matcher work" up to L450 and the per-state M-estimation (L732-809) and continuous-pose contracts (L528-730) are policy; "Dense-table assignment" and "Probability-table part files" (L452-526: 8 MiB reads, blocks of 256, size guards, "no internal procedures, so no heap trampolines") and "Probabilistic pre-step benchmark files and particle-frame shifts" (L811-877: bench file contents, "the only path since 2026-10-15; a developer key used to switch it on", approximation list) are implementation notes. Section 11 is mostly not policy: 11.1 is a reference of benchmark file formats with one benchmark number (L1031: "3,104 for a solve3D run of 94 refine3D iterations") and per-section contents of VOLASSEMBLE_BENCH/PCG_ASSEMBLE_BENCH (L1077-1101); only the rules (reports live in BENCH/, one file per family or partition, appended, never truncated, written through open_bench_report, clear BENCH/ before a second run, L1025-1032,1064-1069) belong in a policy. 11.2's final-map sharpening paragraph (L1146-1197, 50 lines) is a changelog with incident narrative (exp_gate, PfCRT, msp1, dates 2026-09-21..28, RELION comparison). Proposal: split into refine3D_policy.md (sections 1-7, 9, 10, 12 and a short 11, about 450 lines), a matcher/probability-table note under doc/implementation_notes/, the bench reference under doc/how2s/ (it already has the memory estimator guide) and the sharpening recipe into the PCG or a final-map policy.
  • [M][STRUCTURE] L1146-1197 duplicates 3D/reconstruct3D_pcg_policy.md L376-393 ("Automatic final-map sharpening ..."; that text points back here). One home.
  • [L][STRUCTURE] 30 dated mentions ("since 2026-09-06", "until 13 October 2026", "(ruling of 2026-10-20)" L138, "(since 2026-10-18; before, the counts reread the field ...)" L942-943); the "before this ..." clauses are history. No pointer to LPO (new) in sections 3-4; doc/policies/README.md row for this file does not mention per-state M-estimation.

doc/policies/3D/refine3D_auto_policy.md (lines 256; last commit 2026-10-13; verdict: minor drift)

  • [M][STALE] L36-37: "The matching low-pass handoff is the finest selected label with at least 1% of the signal voxels at that label or finer" -> the handoff is the finest member of the bank, independent of which labels won voxels; the 1% population is a diagnostic. Contradicts L33-35 of the same paragraph ("the finest member of the bank as the matching handoff") and NU/nonuniform_filtering_policy.md sections 8 and 12. Evidence: simple_nu_state_filter.f90:211-226 (get_nu_filter_bank_finest_lp). Delete the sentence.
  • [M][GAP] state=X with m_estimator=no|flex (work project refine3D_auto_stateXX.simple, selection by prune, single-state weight set) is implemented in this program (simple_commanders_refine3D.f90:161-168,484-606) and described only inside refine3D_policy.md section 8; this document says "single-state" and "refine3D_auto remains single-state" (L218) without the key. Add a section that points to refine3D_policy section 8 and states: state= needs mkdir=yes, the parent project is never written, the run directory's copy of the parent is deleted.
  • [L][DRIFT] L19: balance=no -> balance=none (no fails balance must be none, class or cavg, simple_parameters_phases.f90:710-713; simple_commanders_refine3D.f90:123).
  • [L][OLDNAME] L220-221: "or the ab initio workflows" -> name solve3D and solve3D_cavgs.
  • [L][DRIFT] L33: nonuniform_filtering_policy.md is ../NU/nonuniform_filtering_policy.md (no link, bare name).
  • [L][DRIFT] L137-141: "enforces a minimum of three iterations ... Once the overlap criterion (0.99) is met after the third iteration the run stops" -> minits is enforced through minits in the iteration counter of the stage, and the distributed strategy additionally requires iter >= startit + 2 (simple_refine3D_strategy.f90:1526); with the registration pass startit is 2.
  • [M][STRUCTURE] Section 5 L142-183 (registration pass) carries benchmark narrative (aldolase run 16, bgal and D2 at 7.6 A, PfCRT 8.9 A with 33 % and 17 % moved, 4.31/6.61 A against July's 3.61/4.03 A) and L137-140 a PfCRT result; dated rulings 2026-09-11/16/17/18/19 (14 dated mentions). The rule is: pass band = startup pair's FSC=regpass_fsc (0.143), lpstop never lp, skipped without a startup FSC, every active particle, refine=greedy at nspace=5000. Move the experiments to an implementation note.
  • Cross-check against the skills: no contradiction found.

doc/policies/3D/automasking_policy.md (lines 157; last commit 2026-10-03; verdict: current, three small items)

Matches the code on the modes, lag-by-one, fallback, PCG support (build_pcg_state_support, simple_rec3D_pcg_strategy.f90:155-213), FSC MODE kinds (simple_halfmap_diagnostics.f90:84-93), compatibility check (simple_vol_pproc_policy.f90).

  • [L][DRIFT] L17-18: "automsk=tight ... is rejected in 3D refinement" -> rejected by the UI choice list (yes|nu|no, simple_ui_params_common.f90:201-204) and by parameter validation only together with NU filtering (simple_parameters_phases.f90:911-914); a non-NU command line that carries tight passes validation.
  • [L][GAP] Which workflow switches automasking on, and from where: refine3D_auto default yes; refine3D_states, classify3D_refs default no (UI-offered yes|nu|no); refine3D_states_cavgs fixed no; solve3D only at its last stage (AUTOMSK_STAGE = NSTAGES, ENVFSC_STAGE, simple_solve3D_controller.f90:38-39), so a five-stage multi-state default run never automasks. The scope sentence (L5-6) names the programs but not the switch-on.
  • [L][STRUCTURE] "Validation criteria (automsk=nu, 2026-09-17)" L144-157 is a dated acceptance list that restates the rules above; the PfCRT incident (L48-59) is history that justifies "opt-in". Keep one sentence, point to pcg_priors_history.md.

doc/policies/3D/classify3D_refs_policy.md (lines 177; last commit 2026-10-10; verdict: minor drift)

  • [L][DRIFT] L16: UI is src/main/ui/simple/simple_ui_heterogeneity.f90 (new_classify3D_refs, :317), not simple_ui_refine3D.f90.
  • [M][GAP] The wrapper's settings are not stated although they decide behaviour: hard balance=cavg (falls back to none, and to none when update_frac > 0.99), trail_rec=yes, lplim_crit=0.5, multivol_mode=independent, combine_eo=no; defaults refine=prob_neigh with override prob_neigh|prob|shc, prob_neigh_mode=state|geom, nspace=5000, nspace_sub=500, filt_mode=nonuniform_lpset (also accepts none, nonuniform), ml_reg=yes, lpstart=10, lpstop=6, automsk=no, envfsc=no; block length 3 (STEP_IT); automatic maxits = 4 updates per particle x active/sample, between 10 and 50. Evidence: simple_commanders_refine3D.f90:1307-1356,1424-1449,1482-1492,1575. Section 4 L112-113 presents prob_neigh/state as "the effective internal policy" although both are overridable.
  • [M][GAP] No gating test exists: rg classify3D_refs finds no tester or registry entry (only the UI visibility test). Section 8 lists "user-side validation" only. State the test or state that none exists.
  • [M][CONTRADICTS] L176-177: "Compilation and runtime tests are performed by the user" vs CLAUDE.md ("Compile and run tests as part of the development cycle") and test_environment_policy.md; same sentence in refine3D_states_policy.md L208-209 and refine3D_states_cavgs_policy.md L236-237. Replace by the real test names or delete.
  • [L][STRUCTURE] No dated lines, no history: good. Lacks a first-lines status (README.md convention: "when it is a draft or carries an open validation, says so").

doc/policies/3D/separate_alignment_and_reconstruction_for_multistate_peak_mem_reduction.md (lines 131; last commit 2026-10-20; verdict: minor drift)

Phase barrier, one standalone reconstructor per (state, half), empty half writes a zero partial, weighted grouping (group_pinds_by_weights), particle buffer budget (ptcl_buffer_budget): verified.

  • [M][STALE] L19-22: "Workers must not construct the EO composite build%eorecvol ... volassemble owns build%eorecvol" -> eorecvol no longer exists anywhere in src or production (rg eorecvol: no hit); the builder's build_rec_eo_tbox is retired (simple_volassemble_strategy.f90:939). Volume assembly holds local reconstructor accumulators (even_rec, odd_rec, read_even_rec, read_odd_rec, sum_rec, :862). Fix: "workers hold one standalone half-map reconstructor; volassemble_exec is the first stage that holds both halves".
  • [L][STALE] L110-112 and L127-131: the OpenMP-offload kernel "may use an EO composite for nstates=1" and is an implementation anchor -> calc_3Drec_gpu (simple_reconstructor_openmpoffload.f90) has no caller anywhere in src and throws unless built with USE_OPENMP_OFFLOAD. Drop the anchor or say it is unreachable.
  • [L][DRIFT] L5-8: "The auto and multi commanders" -> refine3D_auto, refine3D_states, refine3D_states_cavgs, classify3D_refs; there is no "multi" commander.
  • [L][GAP] Invariant 3 ("every valid selected particle belongs to exactly one group") hides the skip rule: particles with an invalid state or even/odd label are skipped with a log line (group_pinds_by_state_eo, simple_matcher_3Drec.f90:182-229, log at :226), and an entirely empty state resets its FSC row (mark_empty_state, :372-376). State both.
  • [L][STRUCTURE] "Status" section is a dated-status line in disguise; "Verification" is a to-do list, not a rule.

doc/policies/heterogeneity/refine3D_states_policy.md (lines 209; last commit 2026-10-16; verdict: minor drift)

Controller facts verified: flex_pca only initializer, needs nstates >= 3, drops below two states -> error, STAGE2_NSPACE=2500, STAGE2_NSPACE_SUB=500, sampling 10,000/state capped 100,000, maxits = 4 x sweep within 10..50, cohort sampling on prob_neigh blocks, missing-update pass, m_estimator refused, vol_flex read-only fallback.

  • [L][DRIFT] L17: UI is simple_ui_heterogeneity.f90 (new_refine3D_states, :213), not simple_ui_refine3D.f90.
  • [L][DRIFT] L108-110: "the commander derives [multivol_mode and prob_neigh_mode] from pose_policy" -> refine3D_states_controller%normalize_inputs does (simple_refine3D_states_controller.f90:122-133).
  • [M][GAP] Settings and defaults of the workflow are not stated (the cavgs policy has the table, this one does not): hard balance=cavg (to none without selected class averages), trail_rec=yes, objfun=euclid, lplim_crit=0.5, incrreslim=no; defaults filt_mode=nonuniform_lpset with fsc|none also accepted and nonuniform refused, ml_reg=yes, lpstart=10, lpstop=6, overlap=0.99, automsk=no (yes|nu|no), envfsc=no, combine_eo=no (anything else refused), center=no, continue. Evidence: simple_commanders_refine3D.f90:777-835, simple_refine3D_states_controller.f90:206-232, UI simple_ui_heterogeneity.f90:213-275.
  • [L][GAP] The stage plan itself (simple_refine3D_stage_plan.f90) has no stated rule: blocks of 3 iterations (FREQUENCY_BLOCK_NITS), low-pass linear in Fourier index from lpstart to lpstop, reaching lpstop one block before the last, never finer than lpstop; a block may stop on the state-overlap target once the march-wide minimum (STAGE2_MINITS=5) is met while every block is still visited (run_frequency_march, :757-759). L162-163 states the visiting rule only.
  • [L][GAP] Wrapper-to-refine3D contract: the controller runs each block as a whole refine3D program (project handed over through the file; it reads ptcl3D back after every block for overlap and coverage). Link LPO section 4.
  • [M][CONTRADICTS] L208-209 "tests are performed by the user" vs CLAUDE.md; the registry has multistate_workflows, multistate_assignment, state_fixture (simple_test_registry.f90:90-94); simple_commanders_test_highlevel_msworkflows.f90 runs refine3D_states. Name them in section 8.
  • [L][STRUCTURE] L112-115 "(rulings of 2026-10-15; it ran 5,000 before)" is history; long cohort paragraph L137-154 mixes the contract with its statistics (1-(1-u)^k), which are already in the importance policy. One home.

doc/policies/heterogeneity/refine3D_states_cavgs_policy.md (lines 237; last commit 2026-10-20; verdict: current)

Every fixed setting, default, refused key, file name, count threshold (100 sub-averages, 100 rows per fit, min_neff 20, march of at most 10 iterations, explicit maxits >= 5), better-row rule, renumbering, commit order (one read, one write of the input project, simple_commanders_refine3D.f90:926,1292) and Developer visibility checked against the code.

  • [L][DRIFT] L56-58: floor nstates * max(1, nint(min_state_frac * 2N)) <= 2N -> the code counts active rows, 2N less halves that cls2D flags with state 0 (preflight, simple_commanders_refine3D.f90:1114-1123); say "active rows".
  • [L][CONTRADICTS] L236-237 "tests are performed by the user"; the gate flex_pca_blobs it names (L231-234) is in the registry (:110) and is the right thing to cite in section 11.

doc/policies/importance_sampling_fractional_update_policy.md (lines 573; last commit 2026-10-20; verdict: stale in section 5 (solve3D stage policy); sections 3, 4, 6-8 verified)

Verified: bookkeeping contracts (sample4update_reprod, get_group_update_counts, get_update_rows, sample4rec), the 2D carried-set rule (cavg_state.bin, cavg_contrib_part<N>.bin, carryover_needs_full_update), nested quota, clssmp.bin, trailing chain files and identities (pcgtrail-v3), 0.001 realized-fraction rule, l_ufrac_trec_defined, NSAMPLE_DEFAULT_2D, publish_before_file_assembly.

  • [M][STALE] L217-226 and L228-240 (and the invariant L531-533): "stages 1 and 2 use prob_neigh with prob_neigh_mode=shc"; multi-state default "stops after the prob phase and before prob_neigh, staged NU filtering, multi-state trailing reconstruction, and staged automasking" -> single state: prob_neigh/shc stages 1-2, prob 3-5, prob_neigh 6-8. Multi-state: refine=shc (not prob_neigh) stages 1-2, prob from stage 3, and prob_neigh with prob_neigh_mode=state from the first stage whose nspace reaches the multi-state cap 2,500 (stage 5, the last of the default run); stage 5 is NU-filtered (NU_FILTER_STAGE=5 since 2026-10-18); only trailing and automasking are absent. Evidence: simple_solve3D_controller.f90:33,336-355,470,710-715; solve3D/solve3D_policy.md section 6 (updated 2026-10-21). Fix: delete the stage list and point to solve3D_policy.md sections 4 and 6; keep the sampling-relevant facts (stochastic balanced sampling from stage 4, UPDATE_FRAC_MAX 0.9 and the full-sample switch).
  • [M][CONTRADICTS] same lines vs 3D/solve3D_policy.md section 6 ("Stage 5 is NU-filtered ... but runs no multi-state trailing reconstruction or staged automasking").
  • [M][DRIFT] L176-178: "while startit == 1, sample_ptcls4update2D keeps the initial subset sticky" -> only without fillin; with fillin=yes a fresh start samples by update count (simple_matcher_smpl_and_lplims.f90:324-333, the fix of 2026-10-20). L184-186 describes fillin as a coverage guard but not this consequence.
  • [L][DRIFT] L21-22: "the pre-alignment commander chooses the outer subset" -> prob_align_exec (strategy routine; L57-61 says so).
  • [L][DRIFT] L214-215: the cap UPDATE_FRAC_MAX is stated; the companion FULL_SAMPLE_SWITCH_FRAC (0.9: above nsample/active the stages run full updates and force_full_sampling_mode disables trailing) is not (simple_solve3D_controller.f90:56-57,717-725).
  • [M][GAP] Sampling hand-off for non-probabilistic distributed passes (master_draws_sample3D) and the polish/eval/sigma/update_missing exceptions: see refine3D_policy GAP. Sections 1 and 6 say only "sample-once-and-reuse" for the probabilistic path. Add to section 1.
  • [M][GAP] update_missing and sample4update_missing (the terminal coverage pass of refine3D_states/classify3D_refs/cavgs) are in no section.
  • [L][STRUCTURE] L411-412 "(class-average state note, Section 4.1)" is a dangling reference (no file named; the rule is also in doc/algorithms/sampling_and_fractional_updates.md and 2D/solve2D_policy.md). Section 7 (L409-505, 100 lines) restates the trailing chain that the simple-frac-update-trailing skill and reconstruct3D_pcg_policy.md also carry; section 5's solve3D stage list duplicates solve3D_policy.md. 573 lines: split sections 4 (2D) and 5-7 (3D) or reduce to the contracts.

Cross-cutting gaps in this cluster

  1. State weight set has no policy. Producer flex_pca; consumers reconstruct3D m_estimator=flex, volassemble (floor of rho under fractional weights, l_floor_rho), PCG worker and master, trailing chains (identity = generation + layout digest), refine3D_auto state=X, calc_final_rec, the probability table (ESS > 5), get_state_pops. Its files, manifest, kinds (PARTITION|KERNEL), discard_state_weight_set, publish_work_state, thresholds (0 gridding, PCG_WEIGHT_THRESHOLD 0.01 PCG) are spread over refine3D_policy section 8, the importance policy sections 3 and 7, the memory policy and refine3D_states_policy section 2. There is also no flex_pca policy under doc/policies/ at all (check_flex_dag.py runs in the fast gate). Proposal: heterogeneity/state_weight_set_policy.md plus a short flex_pca contract.
  2. 3D convergence contract (above); the same for the 2D check exists in solve2D_policy.md.
  3. Per-mode sample ownership and per-strategy parity ledger (distributed-only iteration floor, combine_eo, empty-state cleanup, PCG master write): none is in a policy; LPO section 8 does not list the PCG write.
  4. Artifact and lifetime table of one refine3D iteration (above); would also serve the layering policy's "Counts are static" item.
  5. Final-map recipe (calc_final_rec: which route when, sigma bootstrap criteria, cold PCG floor, sharpening) is split over refine3D_policy 5.1 and 11.2, reconstruct3D_pcg_policy.md, refine3D_states_policy 7 and the callers' policies; calc_final_rec_addon (solve3D_addon) is the second variant.
  6. Multi-state controller contract: refine3D_states_policy and refine3D_states_cavgs_policy share simple_refine3D_states_controller (typed refine3D_states_policy object) but no document states the controller's own contract (what each caller must set, order normalize_inputs -> resolve_states -> resolve_sampling -> read_maxits -> params%new -> validate -> initialize_states -> plan -> startup_maps -> run_march -> ensure_all_updated -> calc_final_rec, project hand-over by file between blocks). classify3D_refs repeats the planner use without the controller.
  7. Tests: no document in the cluster maps rules to tests. Existing guards: unit_pftc_align2D3D, unit_cart_align3D, lib_cart_align3D, cont_refine3D_1jxy, multistate_workflows, multistate_assignment, state_fixture, flex_pca_blobs, solve3D_addon; none for classify3D_refs, and none that counts project reads and writes per iteration.
  8. Skill/policy contradictions found: simple-refine3d SKILL.md and simple-main-strategies SKILL.md repeat the "no project write from assembly or the PCG master" rule that the PCG master breaks; no other contradictions with the skills in this cluster. CLAUDE.md vs "tests are performed by the user" in three policies.

Unverified

  • Scientific and benchmark statements (PfCRT, aldolase, bgal, exp_gate, msp1 numbers; "5.6x", "-150 against -77 to -83", "accuracy 0.57/0.97"): not checkable from code.
  • Dated rulings and "since 2026-xx" clauses: not checked against git log individually (only the 2026-10-16/18/20/21 changes bearing on the findings).
  • simple_state_weight_set internals beyond publish_work_state, flex_pca's producer claims (largest-weight labelling, reconstruct3D m_estimator=flex registration of vol/fsc), and the weight-set identity checks in the PCG chain header: only spot-checked.
  • Kernel-level claims of the particle-frame shift subsection (L811-877: memoize_shifted_ptcl, exact Nyquist-bin summation, lattice/quadratic step) and the continuous in-plane acceptance guards (L598-607): names exist, behaviour not traced.
  • select_particles eo_rebalance pairing by adjacent scores in symmetry-aware viewing bins (L227-236): flag default (yes), marker names (eo_group, eo_byindex) and repartition_selected_halves verified, pairing rule not.
  • Importance policy section 5 on clssmp.bin producers in solve3D (continuation and add-on rebuild, run manifest fields) and on fillin multi-state exceptions: solve3D territory, not traced.
  • NU policy section numbers cited by these documents (8, 10, 12) and the phase-randomization onset ("two shells later"): the other cluster's documents.
  • Test names of sub-suites (continuous in-plane in unit_pftc_align2D3D; cart calculator, pose optimizer, ... in unit_cart_align3D): the three program names are registered in simple_test_ui_class.f90; sub-suite names not opened.