Repository navigation
Conversation
- scripts/select_for_encoding.py picks today's bills: state bills triage put in the encode-automatically band (modelability 80+) with no research row, no open review PR, and no recent or repeated failure, highest priority first, up to the daily cap. --record writes each run's outcome. - .github/workflows/auto-encode.yml runs daily after the bill pipeline, only when the AUTO_ENCODE_ENABLED repository variable is "true" (manual runs default to a dry run). Each bill runs `claude -p "/encode-bill ST BILL --ci"` one at a time with a per-bill budget, then records the outcome; logs are uploaded. - /encode-bill --ci never asks: checkpoint content goes into the PR body, structural or out-of-scope bills stop before any database write, and a result more than 50% off the external estimate (or with none) opens as a draft labelled needs-attention. Every run writes an outcome file the workflow checks. The PR step no longer cds into one person's checkout, and credentials load from .env.local, .env or the environment. - scripts/sql/012_add_auto_encode_fields.sql adds the status columns; the selector refuses to run without them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…unnel - /encode-bill --ci --no-writes encodes and scores a bill offline (compute_impacts.py --reform-json --output), writes the would-be PR body to /tmp/encode-bill-pr.md, and changes nothing: no Supabase write, no branch, no PR. auto-encode.yml exposes it as the no_writes input and uploads the PR body and analysis; such a run records no outcome. - A manual run on one named bill works before migrations 011/012, on the v1 scores, so the first live test needn't wait for them. - State triage issues gain an Auto-encode column (the PR link, needs new code, out of scope, run failed), and a bill encoding found structural or out of scope moves to the needs-a-person band. - scripts/intake_funnel.py: by session, imported, triaged by band, auto-encode outcomes, analyzed, published and the median days from introduction to approval; the workflow writes it to the run summary. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A preview on live data after migrations 009-012 picked three 2025-26 bills: v1 triage scored 197 older bills at 80+, and that backlog was never meant to be encoded automatically. The daily queue now requires a session starting in AUTO_ENCODE_MIN_SESSION_YEAR (2027) or later and a triage v2 score (triage_version); a manual run on one named bill skips both checks. Today's preview picks nothing: 227 older bills, and the three 2027 prefiles wait for their v2 scores. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Anthony added PUBLIC_API_CLIENT_ID and PUBLIC_API_CLIENT_SECRET as repo secrets on 3 December. #246 scores through the Public API when they are set; without this the auto-encode job never sees them and keeps scoring with compute_impacts.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolves the issue-build column fallback: the auto-encode columns stay first, with priority_signals in every set, and the issue keeps triage v2's current priority. select_for_encoding orders picks, and intake_funnel counts the bands, by the same current priority the state issues show (stored signals with today's stage, and companions in the funnel). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Dec 3, 2026
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.
Bills triage puts in the encode-automatically band (modelability 80+) now run
/encode-billheadless and come out as review PRs (Teamverse p452, due 8 January). A person still approves each analysis by merging its PR. This targets #244, whose triage bands and priority scores it reads.How it works
Pick (
scripts/select_for_encoding.py). Each day it takes state bills in the band that have:bill/{research-id}review PR;They go highest priority first, then modelability, then the earliest introduced, up to the daily cap. Federal bills are left out: they are too large for the runner.
Encode (
.github/workflows/auto-encode.yml, daily at 13:30 UTC, after the 11:00 bill pipeline). Each picked bill runsclaude -p "/encode-bill ST BILL --ci", one at a time, with--max-budget-usd./encode-bill --ci:needs-attention.bill-reviewandauto-encoded./tmp/encode-bill-outcome.json.Record (
select_for_encoding.py --record). It writesauto_encode_status, the attempt count, the run URL and the PR URL toprocessed_bills.claude -pexits 0 even when a command bails, so a missing outcome file counts as a failure.Guardrails
AUTO_ENCODE_ENABLEDistrue. Manual runs default todry_run, which only prints the picks.AUTO_ENCODE_DAILY_CAP, default 3, one bill at a timeAUTO_ENCODE_MAX_USDper bill, default 8, passed toclaude -p --max-budget-usdenv:, never inline${{ }}Testing it before switching it on
no_writesinput (/encode-bill --ci --no-writes). It runs the whole encoding and scores offline withcompute_impacts.py --reform-json --output. It writes nothing to Supabase and opens no branch or PR. It uploads the PR body it would have opened (/tmp/encode-bill-pr.md) and the analysis JSON, and records no outcome.The first live test is a manual run with
billset,dry_runoff andno_writeson.Seeing where bills stand
State triage issues gain an Auto-encode column: the PR link, "needs new code", "out of scope" or "run failed". A bill that encoding found structural or out of scope moves to the needs-a-person band.
scripts/intake_funnel.py, read only, reports for each session:Each run of the workflow writes it to the run summary. On live data today it shows 3 bills for 2027 (prefiles, all in the top band on v1 scores), 342 for 2026 and 1,222 for 2025. The band and days columns fill in once migrations 009–012 are applied.
Also in this PR
scripts/sql/012_add_auto_encode_fields.sqladdsauto_encode_status,auto_encode_attempts,auto_encode_attempted_at,auto_encode_run_urlandauto_encode_pr_url. The selector refuses to run without them, so a failing bill can't be retried every day./encode-bill's PR step usedcd /Users/pavelmakarchuk/state-research-tracker. It now goes to the repository root. Credentials load from.env.local(the repository's convention), else.env, else the environment.Checks
uv run --with "anthropic>=1.9" --with pytest --with pyyaml --with pypdf --with requests --with hypothesis pytest scripts/test_select_for_encoding.py scripts/test_intake_funnel.pyplus the triage and import tests: 149 passed. The new tests cover ordering and the cap, every skip reason, retry after a week, the session-aware research IDs and branch names, paging, the missing-migration error, and recording each outcome.ruff checkis clean.Not done yet
no_writeson, which works before the migrations.no_writesoff.AUTO_ENCODE_ENABLED.compute_impacts.py. When p451 lands,/encode-billwill score through the Public API and the comparison step instead. This PR's selection, guardrails and outcome contract stay the same.🤖 Generated with Claude Code