(= (conf-to-w $c) (if (< $c 0.99) (/ $c (- 1.0 $c)) 99.0))
(= (w-gap $cur $tgt) (let* (($wn (conf-to-w $cur)) ($wt (conf-to-w $tgt))) (- $wt $wn)))
(= (action-efficiency memory-query) 0.5)
(= (action-efficiency web-search) 0.4)
(= (action-efficiency metta-revision) 0.8)
(= (action-efficiency metta-deduction) 0.3)
(= (action-cost memory-query) 1)
(= (action-cost web-search) 3)
(= (action-cost metta-revision) 0)
(= (action-cost metta-deduction) 0)
(= (best-action $gap) (if (> $gap 0.8) metta-revision (if (> $gap 0.3) memory-query metta-deduction)))
(= (sources-needed-est $cur $tgt) (let $wg (w-gap $cur $tgt) (if (< $wg 0.5) 1 (if (< $wg 1.5) 2 3))))
(= (gate-decision $c) (if (> $c 0.6) act seek))
(= (evidence-plan $cur $tgt $budget) (let* (($gate (gate-decision $cur)) ($gap (w-gap $cur $tgt)) ($best (best-action $gap)) ($srcs (sources-needed-est $cur $tgt)) ($eff (action-efficiency $best)) ($cost (action-cost $best)) ($capped (if (< $budget $srcs) $budget $srcs))) (if (== $gate act) (plan gate act no-seek confidence $cur) (if (< $gap 0.01) (plan gate seek at-target conf $cur) (plan gate seek w-gap $gap best $best eff $eff cost $cost sources $capped budget-remaining (- $budget $capped))))))
!(evidence-plan 0.3 0.65 5)
!(evidence-plan 0.5 0.85 2)
!(evidence-plan 0.8 0.65 3)
!(evidence-plan 0.75 0.9 1)
