decision-system S5b: review order and 5% sample CLIs #1265
Labels
No labels
P0
P1
P2
P3
bug
category/code-change
category/cross-repo
category/eval-run
category/investigation
category/no-test-target
category/owner-ruling
category/prose-artifact
category/recurring-chore
category/structure
category/umbrella
crc-refactor
create
delete
enhancement
filed-by/agent
filed-by/user
frozen
lint-rule
needs-info
needs-triage
next
plugin/cc-architect
plugin/os
plugin/os-adr
plugin/os-aidd-lint
plugin/os-backlog
plugin/os-context
plugin/os-doc-hygiene
plugin/os-sdlc
plugin/os-vault
project/cc-os
ready-for-agent
ready-for-human
recurring
review
rule-proposal
update
waiting
wayfinder:grilling
wayfinder:map
wayfinder:map
wayfinder:research
wayfinder:task
wayfinder:task
wontfix
worklist/deviations
worklist/lint-rule
worklist/new-implement-build
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
jared/cc-os#1265
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The reports of os-sdlc flows list predicted rulings for optional review in the order the run made them. The row with the largest expected loss can be last. Rows that a run decides alone and does not list (mechanical rows) never get a check, so no one sees an error at high confidence. The design is in
docs/decision-system/review.md(ReviewOrder,RandomSample). This ticket is the second of two S5 tickets. It usesCalibrationPriorfrom S5.Approach
All new classes live in os-me (
plugins/os-me/lib/os_me/). O-9 is ruled: os-sdlc calls the os-me CLIs as a subprocess and gets no new code.CalibrationPrior#hit_rate(band:, source:)returnsband / 100.0. It ignoressourceuntil calibration data replaces the prior (S10). This is the claimed band taken as the hit rate.ReviewItemis a value withid(String),level(Symbol::low,:medium,:high),source(Symbol), andband(Integer).novel?is true whensourceis:taste.CostModel#wrong_minutestakes the item, because it reads onlylevel.ReviewOrder#sort(items)sorts by three keys, in this order:cost.wrong_minutes(item) × (1 − calibration.hit_rate(band: item.band, source: item.source)).sort_byis not stable, so this key is necessary.)RandomSample#pick?(key)is true whenDigest::SHA256.hexdigest("sample:#{key}").to_i(16) % 100 < 5. The stringsample:is the fixed salt. The same key always gives the same answer, as inOsMe::Split. The caller makes the key unique for each row and each run, for examplefast-batch/<batch>/<id>.Two
OsMe::CLIcommands (binos-me-eval):sample KEY: exit 0 whenRandomSample#pick?(KEY)is true, else exit 1. It prints nothing.review-order ITEMS_FILE: each line of the file is JSON{"id":"A","level":"medium","source":"facts","confidence":84}. The command makes the band withConfidenceBand.of_percent(confidence), sorts withReviewOrder(CostModel.new(minutes_per_dollar: 1.0, predict_dollars: 0.5),CalibrationPrior.new), and prints the ids, one for each line.Orchestrator work (after this ticket merges, fast path, not in the pipeline):
decision-tiers.md"Final judgment round", step 5: write one JSON line for each predicted row (id,levelfrom theos-me-routeJSON,source, the predicted confidence) and list the rows under "Predicted rulings (optional review)" in the order thatos-me-eval review-orderprints.decision-tiers.md"What you do with each tier", mechanical: runruby ~/.claude/plugins/os-me/bin/os-me-eval sample <flow>/<run>/<id>. On exit 0, list the row under "Decided by the run (optional review)" with the marksampled.fast-batchreport table and thecrc-refactorphase 7 Review section at these steps, with the textReviewOrder.bin/refresh-plugins. Gate: one fast-batch run lists the predicted rows in the new order and writesroute-log.jsonl.Required work:
hit_rate(band:, source:)toCalibrationPrior— check: presentdef hit_rate(band:, source:)inplugins/os-me/lib/os_me/calibration_prior.rbReviewItemwithnovel?— check: presentdef novel?inplugins/os-me/lib/os_me/review_item.rbReviewOrderwithsort— check: presentdef sort(items)inplugins/os-me/lib/os_me/review_order.rbRandomSamplewithpick?— check: present"sample:#{key}"inplugins/os-me/lib/os_me/random_sample.rbsample KEYandreview-order ITEMS_FILEtoOsMe::CLI— check: presentdef review_order(items_file)inplugins/os-me/lib/os_me/cli.rbAcceptance criteria
CalibrationPrior.new, whenhit_rate(band: 80, source: :facts)runs, then it returns0.8.A(:medium,:facts, band 80),B(:high,:precedent, band 90), andC(:low,:taste, band 50), in that order, whenReviewOrder#sortruns withCostModel.new(minutes_per_dollar: 1.0, predict_dollars: 0.5)andCalibrationPrior.new, then the ids are["B", "A", "C"](expected losses about 24, 6, and 2.5).D(:medium,:facts, band 80) andE(:medium,:taste, band 80), in that order, whenReviewOrder#sortruns, then the ids are["E", "D"].FandG, both:medium,:facts, band 80, in that order, whenReviewOrder#sortruns, then the ids are["F", "G"].F1toF100, whenRandomSample#pick?runs on each, then it returns true forF17only.fast-batch/b1/35, whenRandomSample#pick?runs two times, then it returns true both times; forfast-batch/b1/34it returns false both times.F17, whenos-me-eval sample F17runs, then the exit status is 0 and stdout is empty; forF16, the exit status is 1 and stdout is empty.{"id":"A","level":"medium","source":"facts","confidence":84},{"id":"B","level":"high","source":"precedent","confidence":90},{"id":"C","level":"low","source":"taste","confidence":50}, whenos-me-eval review-order ITEMS_FILEruns, then stdout is exactlyB\nA\nC\nand the exit status is 0.{"id":"A","level":"huge","source":"facts","confidence":84}, whenos-me-eval review-order ITEMS_FILEruns, then the exit status is not 0 and stdout is empty.Owner sketch
Non-goals
OneThingSelectorandSessionLedger(S9).decision-tiers.mdchange as orchestrator work.Blocked by: #1247 (
CalibrationPrior).Origin
DESIGN(docs/decision-system/review.md).VERDICT: CREATE (user-approved; backlog search only)
Work started on branch ticket-1265 (/os-sdlc:implement, S5b).
Resolution
Done: S5b built: CalibrationPrior#hit_rate, ReviewItem, ReviewOrder, RandomSample, os-me-eval sample and review-order; implementation 132 complete.
Evidence: Branch ticket-1265, Runner commit; one test-review round; suite, lint and required-work gates green; contract audit passed first time; 10 dispatches, 6 min 30 s.
Follow-ups: Skill text (decision-tiers.md final judgment round, fast-batch, crc-refactor) to call os-me-route and the review-order/sample CLIs is orchestrator work for S5, done next on main.