Repository navigation
Stop the data skill steering agents to microimpute and uk-data - #108
Merged
Merged
Conversation
The policyengine-data skill told agents that uk-data's Enhanced FRS feeds the UK Microcosm build and that UK imputations land in policyengine-uk-data, listed microdf among the packages Microcosm replaced, said microcosm-fit succeeds only ad hoc scripts, and called the old stack's algorithms exactly what Microcosm's operators do. Microcosm UK imputes WAS wealth, LCFS consumption, ETB VAT and services, SPI incomes and salary sacrifice itself with microcosm-fit (uk_runtime), and policyengine.py's bundle serves the Enhanced FRS only as a named overlay. uk-data's build still imputes with microimpute 1.8.1. microdf stays, since policyengine-core depends on it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- State the UK default as what policyengine.py does (defaults UK simulations to microcosm_uk_2024_25, serves enhanced_frs_2024_25 only by name) instead of a be-verb identity. - Mark the QRF contrast as an example and say microcosm-fit weights every fit unless the caller passes weights="none"; "has no unweighted default" and "by construction" left out the opt-out. - Drop "lower is better" and the italics on "packages". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 of 4 tasks
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Microcosm's QRF caps a forest at 4,096 samples per leaf when its target takes 2 to 32 distinct values (qrf.py _fit_forest, test_qrf.py), so the skill now says so, and it sets microimpute's weight_col opt-in beside microcosm-fit's weights="none" opt-out. The section heading no longer implies that microcalibrate and L0 are archived. The UK stage list splits in two, introduces WAS, LCFS and ETB, and names the salary-sacrifice source, and three restated facts go. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The salary-sacrifice stage gets its own sentence: it trains on the FRS respondents with pay whom the survey asked about salary sacrifice. The institutional paragraph says "previous-stack fit", matching the section's other names for the old packages, and the QRF paragraph re-wraps under 100 characters. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis
marked this pull request as ready for review
November 8, 2026 20:27
MaxGhenis
added a commit
that referenced
this pull request
Nov 9, 2026
#108 edited skills/policyengine-data/SKILL.md without rebuilding the manifest, so main's copy lacked that edit. Rebuilding adds the edited artifact, one new overlap pair and the 113 scores the edit moves, and updates repo_coverage. Built from the same corpus, main's builder and this branch's give the same 326 pairs and the same scores. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
anth-volk
added a commit
that referenced
this pull request
Nov 10, 2026
Regenerated with `uv run python scripts/build_manifest.py`. Besides the new skill, its bundle entries and edges, and the bundles' 4.2.0 version, the rebuild also picks up what earlier merges left unbuilt: the policyengine-data skill's description and target repositories from #108. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis
added a commit
that referenced
this pull request
Nov 11, 2026
#108 edited skills/policyengine-data/SKILL.md without rebuilding the manifest, so main's copy lacked that edit. Rebuilding adds the edited artifact, one new overlap pair and the 113 scores the edit moves, and updates repo_coverage. Built from the same corpus, main's builder and this branch's give the same 326 pairs and the same scores. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis
added a commit
that referenced
this pull request
Nov 11, 2026
…nd keep overlaps in artifact order (#107) * Stop the manifest build without PyYAML and check the manifest in CI - build_manifest.py exits 1, writing nothing, when it can't import PyYAML, instead of falling back to a subset parser that turned numbers into strings and dropped nested fields (which broke the Analyses page). It also stops, naming the file, on frontmatter that isn't a YAML mapping. The subset parser and the regex category fallback are gone. - The dashboard's manifest hooks run the builder through uv. manifest:safe keeps the committed manifest when the build can't run. - --check builds the manifest without writing it and exits 1 when the copy on disk differs anywhere but generated_at. A new CI job runs it on Linux under Python 3.11 and 3.14. - IDF comes from decimal's correctly rounded ln rather than math.log, which rounds as each platform's C library does; shared_terms break ties by term. - Overlap pairs stay in artifact order, so a one-skill edit rewrites only the scores it moves (#106's edit: 242 changed lines instead of 1,084). The drawer and the Duplicates view sort pairs by score themselves. - Tests: a builder without PyYAML, frontmatter types and errors, --check, overlap order, guards against the built-in sum() and math.log, and a Hypothesis property that overlaps ignore artifact and word order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Check the manifest under Python 3.15 in CI, and report a non-object manifest Python 3.15 has shipped (CPython is at 3.15.2), so the manifest job's newer entry moves from 3.14 to 3.15. The job's comment called its pair the oldest and newest Python the repo supports, which 3.14 no longer is. The test job already runs 3.15.2. On macOS, the committed manifest matches a fresh build under every Python from 3.11 to 3.15. --check printed a traceback when the file on disk held JSON that wasn't an object. It now says so and exits 1, and a test covers that case and invalid JSON. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Rebuild the manifest on top of #108 #108 edited skills/policyengine-data/SKILL.md without rebuilding the manifest, so main's copy lacked that edit. Rebuilding adds the edited artifact, one new overlap pair and the 113 scores the edit moves, and updates repo_coverage. Built from the same corpus, main's builder and this branch's give the same 326 pairs and the same scores. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Read the builder's inputs as UTF-8, and pin main()'s exit on bad frontmatter Review r3 found that every read used the locale's encoding. Under a Latin-9 locale on Python 3.11, the build stopped on frontmatter that is fine ("unacceptable character #x0080"); on Windows before 3.15 it would misread the same text. Every read now goes through read_utf8, and the manifest is written as UTF-8 with "\n" line endings. - test_builder_never_uses_the_locale_encoding runs the build and --check with EncodingWarning as an error, so any read or write that leaves the encoding out fails it on every Python version. - test_bad_frontmatter_makes_the_script_exit_1_and_write_nothing pins the exit status that CI's --check and the predev hook rely on. - The CI manifest job installs dependencies in its own step, and its error no longer calls every failure a stale manifest. - The IDF comment counts (n, df) pairs, not ratios, and says how the decimal result becomes a float. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Rebuild the manifest on top of #92 #92 edited the SKILL.md of three skills (policyengine, policyengine-tools, policyengine-uk), a reference file of a fourth, the reform-comparator agent and all eight bundles without rebuilding the manifest, so main's committed manifest no longer matched its sources. On main's corpus, main's builder and this branch's give the same 324 pairs and scores; only overlap order and 7 shared_terms lists differ. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
The
policyengine-dataskill steered agents to the old data stack. PolicyEngine archived microimpute on 2026-11-08 (PolicyEngine/microimpute#224), and Microcosm imputes PolicyEngine's microdata withmicrocosm-fit. This PR correctsskills/policyengine-data/SKILL.mdto match.microcosm_uk_2024_25and serves the Enhanced FRS only by name;microcosm-fitinuk_runtime, where new UK imputation work goes; the text names each stage's source survey.policyengine-us-dataone says PolicyEngine archived microimpute on 2026-11-08, tells agents to open no PRs or issues there, and notes that PyPI keeps all of its releases, including the 1.8.1 that uk-data pins.microcosm-fitand new calibration onmicrocosm-calibrate, never on microimpute, microcalibrate or L0.microcosm-fitnow succeeds microimpute as well as ad hoc scripts,microcosm-calibratesucceeds microcalibrate and L0 (l0-python), andmicrocosm-framesucceeds microdf only inside Microcosm.weights="none".microimputeandmicrocalibrateto the triggers, so an agent about to reach for either one loads this skill. To stay under the 1,024-character Codex limit (now 1,019), "conditional models" became "models", "build/release gates" became "release gates", and "calibration diagnostics dashboard" became "calibration dashboard".Evidence from code
gh api repos/PolicyEngine/microimpute:"archived": true,updated_at2026-11-08T06:31:54Z; PolicyEngine/microimpute#224 merged 2026-11-08T06:27:46Zuv.lock:889-891pins 1.8.1 fromhttps://pypi.org/simplepackages/microcosm-build/src/microcosm/build/uk_runtime/:was_wealth.py:900,935,lcfs_consumption.py:1935,1990,etb_vat.py:371,373andetb_services.py:481,489callRegimeGatedQRF;spi_income.py:3566andsalary_sacrifice.py:880loadmicrocosm.fit.QRF(an alias ofRegimeGatedQRF,microcosm/fit/__init__.py:118)was_wealth.py:205-222(student_loan_balanceamong the outputs);student_loans.py:93uk/source_stages.jsonstage note 47 ("The QRF trains only on the 2024-25 FRS asked subset with pay");uk_runtime/salary_sacrifice.py:95-98(SALSAC_TRAINING_POPULATION: FRS channel,salary_sacrifice_asked == 1 and employment_income > 0)uk/source_stages.jsonstage notes 22, 30, 31, 32 ("Ports incumbent WAS round-8 wealth imputation", "Ports the incumbent LCFS consumption QRF", "Ports ETB VAT imputation", "Ports ETB public-services QRF")uk/gates.jsonuk_input_mass_parity(terminal,release_blocking,enhanced_frs_2024_25.h5at revision a9e52499);uk_runtime/terminal_gates.py:81src/policyengine/data/bundle/manifest.json:106(default_dataset: microcosm_uk_2024_25),:261-271(dataset_overlays.uk.enhanced_frs_2024_25);src/policyengine/provenance/manifest.py:756-776(an overlay "can never alter default resolution")policyengine_uk_data/utils/qrf.py:9(from microimpute.models import QRF), used by theincome,wealth,vat,salary_sacrifice,consumption,frs_onlyandservices/etbimputations;uv.lock:889-890(microimpute1.8.1)pyproject.toml:26(microdf_python>=1.0.0); no Microcosmpyproject.tomlnames microdf, and Microcosm'suv.lockpulls it in only through policyengine-core, policyengine-uk and policyengine-usl0-pythonpyproject.toml:6; uk-datapyproject.toml:42weight_colmicroimpute/models/imputer.py:222(weight_coldefaults toNone; when set,fitresamples the training rows by it,:222-300) andqrf.py:167(nomax_samples_leaf); main e4cbe025d:imputer.py:247takes the sameweight_coland hands it to the forest assample_weight(qrf.py:178-212); quantile-forest 1.4.1, which uk-data locks (uv.lock:1783-1784), and 1.4.2 both defaultmax_samples_leafto 1weights="none"packages/microcosm-fit/src/microcosm/fit/qrf.py: the defaultmax_samples_leaf=None(:1740) keeps all leaf samples (:1712-1719);_fit_forestraises it to_DISCRETE_Y_LEAF_BOUND = 4_096(:925) when the forest's pre-bootstrap target has 2 to_DISCRETE_Y_UNIQUE_MAX = 32(:917) distinct values and the caller leftmax_samples_leafunset (:1006-1030), andpackages/microcosm-fit/tests/engine_free/shared/test_qrf.py:548-568asserts the cap; the fit reads a Frame's typed weights by default, treats"none"as its only unweighted path, and raises on a DataFrame without explicit weights (qrf.py:1767-1772)microimpute/comparisons/metrics.py:33-56(quantile_lossfor numeric variables,log_lossfor categorical ones)microcosm/fit/held_out.py(module docstring; the package defines no scoring function besidescategorical_scores)Not in this PR
dashboard/src/data/manifest.jsonalone. A rebuild would change the data skill's inferredtarget_repos(adding policyengine-core, dropping policyengine.py) and reshuffle about 1,600 lines of overlap scores. Require PyYAML for the dashboard manifest, check it on Linux in CI, and keep overlaps in artifact order #107 and the repo-coverage branch regenerate the manifest wholesale, and the dashboard'sprebuildhook rebuilds it anyway.INVESTIGATEissues to policyengine-uk-data (targets/claude/agents/report-logger.md:61,200,203,273-277,tests/pipeline/test_country_routing.py,.github/workflows/analyze-policy.yml), although policyengine.py defaults UK simulations to Microcosm.skills/policyengine/SKILL.md:250-253says the pre-2026 datasets "are gone", though policyengine.py still servesenhanced_frs_*by name. Route UK data issues to the repo that builds the run's dataset #110 fixes both.uv run pytest --ignore=tests/test_skill_examples.py: 208 passed.build_claude_wrapper.pycopies the file unchanged.🤖 Generated with Claude Code