{"_id":"@_89/confidence-kernel","_rev":"3-48e6df3016c5754ca189a039911aa2df","name":"@_89/confidence-kernel","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.0":{"name":"@_89/confidence-kernel","version":"0.1.0","keywords":["confidence","scoring","history","decay","oracle","provenance","agent"],"license":"MIT","_id":"@_89/confidence-kernel@0.1.0","maintainers":[{"name":"haruhunab1320","email":"jakob@magickml.com"}],"dist":{"shasum":"6a993479f69c134d6d85d4506dd3437bab23f55c","tarball":"https://registry.npmjs.org/@_89/confidence-kernel/-/confidence-kernel-0.1.0.tgz","fileCount":5,"integrity":"sha512-4EiVstTbMhvsVMUZJeug9I+ETUvEVXTb74wmoL6rEX6XYcZqCzaRCys1jm2dZrFxtKTjAnsO/l0BYva4HF2+ZQ==","signatures":[{"sig":"MEUCIQDPczISpIl8JrNHPGW/hYOKoIzl+e6ZdHcsic0LhgdrtgIgEJn73yv+3791ygrjmyNSVrVhL+lpPKGa/gs4+koIB10=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":25528},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"bfd02538a8da5844bec901ac80d18fd688041fad","scripts":{"test":"vitest run","build":"tsup src/index.ts --format esm --dts --clean","typecheck":"tsc --noEmit","test:watch":"vitest","prepublishOnly":"npm run build"},"_npmUser":{"name":"haruhunab1320","email":"jakob@magickml.com"},"_npmVersion":"11.11.0","description":"Pure, host-agnostic confidence-scoring kernel: age-decayed success × efficiency × sample-saturation with a skip/suppress risk-posture knob, plus oracle-combine, drift detection, family pooling, and a journal interface.","directories":{},"_nodeVersion":"25.8.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.5","vitest":"^2.1.8","typescript":"^5.7.2"},"_npmOperationalInternal":{"tmp":"tmp/confidence-kernel_0.1.0_1784920108762_0.384454708129651","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@_89/confidence-kernel","version":"0.1.1","keywords":["confidence","scoring","history","decay","oracle","provenance","agent"],"license":"MIT","_id":"@_89/confidence-kernel@0.1.1","maintainers":[{"name":"haruhunab1320","email":"jakob@magickml.com"}],"dist":{"shasum":"daf44f9cd08cc0d11a2e8e07103d364366152e95","tarball":"https://registry.npmjs.org/@_89/confidence-kernel/-/confidence-kernel-0.1.1.tgz","fileCount":7,"integrity":"sha512-nQS+9i1S59uU+INTXE+mzDmj1nLF9OCHVtNr0DxXf1kzuML5TscoKt3oDEZudf1I4u/0XL9R2q/DivsJtckc2A==","signatures":[{"sig":"MEYCIQCL6fzT1f/o2jIXdwrshbFy0fmtvahXGtAVYqUQQXNUVwIhAMRjqL2Ur941cLuf5zPCcmrqnYO+Ru6VbaFaESbB8WEW","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":46297},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./package.json":"./package.json"},"gitHead":"875074ccd6c00fe8c72a6773b829138e80971936","scripts":{"test":"vitest run","build":"tsup src/index.ts --format esm,cjs --dts --clean","typecheck":"tsc --noEmit","test:watch":"vitest","prepublishOnly":"npm run build"},"_npmUser":{"name":"haruhunab1320","email":"jakob@magickml.com"},"_npmVersion":"11.11.0","description":"Pure, host-agnostic confidence-scoring kernel: age-decayed success × efficiency × sample-saturation with a skip/suppress risk-posture knob, plus oracle-combine, drift detection, family pooling, and a journal interface.","directories":{},"_nodeVersion":"25.8.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.5","vitest":"^2.1.8","typescript":"^5.7.2"},"_npmOperationalInternal":{"tmp":"tmp/confidence-kernel_0.1.1_1784926794706_0.3132011877824621","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@_89/confidence-kernel","version":"0.2.0","publishConfig":{"access":"public"},"description":"Pure, host-agnostic confidence-scoring kernel: age-decayed success × efficiency × sample-saturation with a skip/suppress risk-posture knob, plus oracle-combine, drift detection, family pooling, and a journal interface.","type":"module","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./package.json":"./package.json"},"scripts":{"build":"tsup src/index.ts --format esm,cjs --dts --clean","prepublishOnly":"npm run build","test":"vitest run","test:watch":"vitest","typecheck":"tsc --noEmit"},"keywords":["confidence","scoring","history","decay","oracle","provenance","agent"],"license":"MIT","devDependencies":{"tsup":"^8.3.5","typescript":"^5.7.2","vitest":"^2.1.8"},"gitHead":"aa86bf8b27fbcbba2f6c4c2ce109deefa28ad402","_id":"@_89/confidence-kernel@0.2.0","_nodeVersion":"25.8.1","_npmVersion":"11.11.0","dist":{"integrity":"sha512-wKXLC5Dc8V+0SRBWF1OFWv57u/sBwL4a0C5o+Kty9DLQ/AMOvlrgzIWsP5XTZJxEzA2qFoBWhshP+JYZKXunFQ==","shasum":"bf5565fd03dfe90132ba1747646744fb0a1094bf","tarball":"https://registry.npmjs.org/@_89/confidence-kernel/-/confidence-kernel-0.2.0.tgz","fileCount":7,"unpackedSize":48496,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQC12Q4NiDHZgTSnulQO1CB6CR56QSfDE7jRvS+tKocnoAIgGofB+ru6raxdnJpqvOITcG5lea8Nds6BroABlWK+dl4="}]},"_npmUser":{"name":"haruhunab1320","email":"jakob@magickml.com"},"directories":{},"maintainers":[{"name":"haruhunab1320","email":"jakob@magickml.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/confidence-kernel_0.2.0_1785024342992_0.8815481313761626"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-24T19:08:28.490Z","modified":"2026-07-26T00:05:43.326Z","0.1.0":"2026-07-24T19:08:28.916Z","0.1.1":"2026-07-24T20:59:54.850Z","0.2.0":"2026-07-26T00:05:43.134Z"},"license":"MIT","keywords":["confidence","scoring","history","decay","oracle","provenance","agent"],"description":"Pure, host-agnostic confidence-scoring kernel: age-decayed success × efficiency × sample-saturation with a skip/suppress risk-posture knob, plus oracle-combine, drift detection, family pooling, and a journal interface.","maintainers":[{"name":"haruhunab1320","email":"jakob@magickml.com"}],"readme":"# confidence-kernel\n\nPure, host-agnostic confidence scoring for outcome-labelled history.\n\nOne small library that factors out the math three separate systems\n(decision-pathfinder, Parallax, reasoning-tree) each re-derived: age-decayed\nsuccess rate × efficiency × sample-saturation, with a single **risk-posture\nknob** that captures the only axis on which those systems actually differ, plus\noracle-combine, drift detection, family pooling, and a journal interface.\n\nNo storage engine, no orchestration, no I/O. Hosts keep their own persistence and\nmap their records onto one normalized `HistoryRun` shape.\n\n```bash\nnpm install @_89/confidence-kernel\n```\n\n## The posture knob\n\nEvery host computes the same `raw = successRate × efficiency` and\n`sample = min(weightSum / saturationRuns, 1)`. They differ only in what a *sparse*\nhistory should do — which is exactly what \"posture\" selects:\n\n| Posture | `confidence` | Sparse history → | Use when the low-confidence action is… | Origin |\n|---|---|---|---|---|\n| `skip` | `raw × sample` | **0** | cheap/safe (re-ask the LLM). A confident prior *replaces* work. | decision-pathfinder |\n| `suppress` | `1 − sample × (1 − raw)` | **neutral 1.0** | costly (retry/escalate). The prior only ever *supplements*, min-combined with real checks. | Parallax |\n\nThe `curate` lifecycle (reasoning-tree) isn't a single formula — it's a\nweighted multi-signal health mix — so the kernel exposes its shared *primitives*\n(`ageDecayWeight`, `efficiencyFactor`, `detectDrift`, `applyProbation`,\n`shouldRetire`) to compose, rather than a `scoreHistory` posture.\n\n## Core API\n\n```ts\nimport { scoreHistory, makeHistoryOracle, combine, detectDrift, pool } from '@_89/confidence-kernel';\n\nconst score = scoreHistory(runs, {\n  posture: 'suppress',\n  halfLifeDays: 30,\n  saturationRuns: 8,\n  minRuns: 3,          // fewer runs → returns null (host emits neutral)\n  efficiency: 0.8,     // fixed number, or a fn over successful runs (default: shortest/avg steps)\n});\n// → { confidence, raw, sample, weightSum, detail } | null\n```\n\n- `scoreHistory(runs, opts)` — the scored prior.\n- `ageDecayWeight(ageDays, halfLifeDays, base)` — `base:'2'` = `2^(-t/h)`, `base:'e'` = `exp(-t·ln2/h)` (identical; pick to match a host's exact floats).\n- `efficiencyFactor(successfulRuns)` — default shortest/avg steps.\n- `detectDrift(runs, { recentN, driftThreshold })` — recent-vs-lifetime success collapse.\n- `combine(results, 'min' | 'mean')` — fold oracle results; `min` = \"as trustworthy as the weakest check\".\n- `makeHistoryOracle(loadRuns, opts)` — wrap `scoreHistory` as an `Oracle`, neutral fallback when thin. For hosts whose efficiency varies by subject (e.g. a per-role clean-decision rate loaded with the runs), pass `resolveEfficiency(subject, runs)` instead of the fixed `efficiency`; `formatDetail(score, subject, runs)` keeps the host's own wording.\n- `pool(runsByTag, tags)` — merge sibling buckets for cold-start transfer.\n- `applyProbation` / `shouldRetire` — curate lifecycle gates.\n- `InMemoryJournal`, `JsonlJournal` — reference `Journal` impls; hosts adapt their own store to the interface.\n\n## Migration cheatsheet\n\n**decision-pathfinder** (`RecommendationEngine`): replace the decay + composite\nscoring with `posture:'skip'`, `decayBase:'e'`, `saturationRuns:10`, passing your\nper-edge efficiency (global-shortest / edge-avg) as the `efficiency` number.\n\n**Parallax** (`decision-history.ts`): replace `scoreDecisionHistory()` with\n`posture:'suppress'`, `decayBase:'2'`, `halfLifeDays:30`, `minRuns:3`, passing the\nclean-decision rate as `efficiency`; `runHistoryOracle` → `makeHistoryOracle`;\nthe executor's min-combine → `combine(..., 'min')`.\n\n**reasoning-tree** (`skill-health.ts`): swap the efficiency + recency-decay\nprimitives for `efficiencyFactor` + `ageDecayWeight(halfLifeDays:7)`, the\nrecent-vs-lifetime check for `detectDrift`, and probation/fast-kill for\n`applyProbation`/`shouldRetire`; keep the domain health mix.\n\nThe golden tests in `test/golden.test.ts` reimplement each host's current formula\nand assert the kernel reproduces it bit-for-bit — run them as the acceptance bar\nfor each behavior-preserving migration.\n\n## Development\n\n```bash\nnpm test          # vitest\nnpm run typecheck # tsc --noEmit\nnpm run build     # tsup → dist (ESM + d.ts)\n```\n\nMIT\n","readmeFilename":"README.md"}