decision-system S4b: evidence-loop levers (ConfidenceBand.claimed, EvidenceLadder, StopRule, StakeReducer, CostModel) #1262
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#1262
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 predict loop needs fixed numbers: the band that a claim gets, the next rung of evidence, when to stop, which stake-reducing moves apply, and what each route costs in Jared-minutes. Today
ConfidenceBandhas onlyLEVELSandself.of_percent.EvidenceLadder,StopRule,StakeReducer, andCostModeldo not exist. The design is indocs/decision-system/levers.md(ConfidenceBand, levers 4 to 6,CostModel). This ticket is the second of three S4 tickets. It usesWrongCostandAnswerSource::Resultfrom S4a.Approach
All five objects are deterministic. None calls a model.
ConfidenceBandbecomes a value withvalueandcitations. It keepsLEVELS = [50, 65, 80, 90]andself.of_percentunchanged, becauseCalibrationReportcallsof_percent.claimed(value, citations)takes the highest level at or belowvalue(50 when none). Whencitationsis empty, it drops one level. The drop stops at 50.reaches?(required)is true whenrequiredisnilor whenvalue >= required.EvidenceLadder::RUNGSholds the five rungs of lever 4:indexactioncost_minutes:known_preferences:store_search:read_code_and_adrs:experiment:ask_jarednilnext_rung(after:, source:)returnsRUNGS[after + 1]when that rung exists and its index is at or belowsource.max_rung. Else it returnsnil.StopRule#stop?(band:, required:, next_rung:, risk_minutes:)returns true in three cases, checked in this order: (1)band.reaches?(required); (2)next_rungisnil; (3)next_rung.cost_minutes.to_f > risk_minutes. Else it returns false. The caller computesrisk_minutesas P(wrong) × wrong-cost minutes.StakeReducer#options(row)returns the moves ofMOVES = %i[reversible defer split]for whichrow.supports?(move)is true, inMOVESorder. This order is the O-1 AFK default fromdocs/decision-system/decisions-register.md: reversible option first, then defer. Never wait.CostModelholdsREWORK_MINUTES = { low: 5, medium: 30, high: 240 }.ping_minutesdefaults to 10. This is the O-6 AFK default, marked as a guess.minutes_per_dollar:andpredict_dollars:have no default.predict_minutesispredict_dollars * minutes_per_dollar.Required work:
ConfidenceBandwithvalue,citations,claimed,lower, andreaches?, and keepof_percent— check: presentdef self.claimedinplugins/os-me/lib/os_me/confidence_band.rbEvidenceLadderwithRung,RUNGS, andnext_rung— check: presentdef next_rung(after:, source:)inplugins/os-me/lib/os_me/evidence_ladder.rbStopRule— check: presentdef stop?(band:, required:, next_rung:, risk_minutes:)inplugins/os-me/lib/os_me/stop_rule.rbStakeReducer— check: presentMOVES = %i[reversible defer split]inplugins/os-me/lib/os_me/stake_reducer.rbCostModel— check: presentREWORK_MINUTES = { low: 5, medium: 30, high: 240 }inplugins/os-me/lib/os_me/cost_model.rbAcceptance criteria
(85, ["ADR-0272"]),(95, ["c"]),(65, ["c"]), and(40, ["c"]), whenConfidenceBand.claimedruns, then the band values are 80, 90, 65, and 50, and the first band has the citations["ADR-0272"].(85, []),(90, []),(65, []), and(50, []), whenConfidenceBand.claimedruns, then the band values are 65, 80, 50, and 50.reaches?runs withnil, 70, and 85, then it returns true, true, and false. Given a band of 90, whenreaches?(85)runs, then it returns true.factssource (max_rung2), whenEvidenceLadder#next_rungruns withafter:0, 1, and 2, then it returns the rung(1, :store_search, 0.2), the rung(2, :read_code_and_adrs, 1.0), andnil.experimentsource, whennext_rungruns withafter:2 and 3, then it returns the rung(3, :experiment, 10.0)andnil. Given arulesource, whennext_rungruns withafter:0 and 1, then it returns the rung(1, :store_search, 0.2)andnil. Given atastesource, whennext_rung(after: 0)runs, then it returnsnil.risk_minutes100.0, whenStopRule#stop?runs, then it returns true (stop reason 1).nil), andrisk_minutes100.0, whenStopRule#stop?runs, then it returns true (stop reason 2).risk_minutes6.0, whenStopRule#stop?runs, then it returns true (stop reason 3). Given the same band and the next rung 2 (1.0 minutes) withrisk_minutes84.0 or 1.0, then it returns false.:deferand:reversible, whenStakeReducer#optionsruns, then it returns[:reversible, :defer]. Given a row that supports all three moves, then it returns[:reversible, :defer, :split]. Given a row that supports none, then it returns[].CostModel.new(minutes_per_dollar: 4.0, predict_dollars: 0.25), when it runs, thenping_minutesis 10,predict_minutesis 1.0, andwrong_minutesreturns 5, 30, and 240 for wrong costs at the levels:low,:medium, and:high. Givenping_minutes: 20, thenping_minutesis 20.Owner sketch
Non-goals
RouteSelector,RowRouter,RouteLog, andReviewOrder(S5).risk_minutesmethod. The caller computes it.StakeReducerreadsrow.supports?(move)only.os-me-routeCLI (S4c).PredictLoopskill text. The orchestrator writes it through the fast path.Blocked by: #1246 (
WrongCost,AnswerSource::Result).Origin
DESIGN(docs/decision-system/levers.md).VERDICT: CREATE (user-approved stage split of #1246; backlog search only)
Work started on branch ticket-1262 (/os-sdlc:implement, S4b).
Resolution
Done: S4b built: ConfidenceBand.claimed, EvidenceLadder, StopRule, StakeReducer, CostModel; implementation 128 complete.
Evidence: Branch ticket-1262, Runner commit; diff-test, lint, suite and required-work gates green; contract audit passed first time; five new test files.
Follow-ups: none