@davesheffer/hunch 0.19.0 → 0.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -640,19 +640,26 @@ export function applyVerdict(draft, v) {
640
640
  // Penalize weak grounding; (0.5 + 0.5*grounded) ∈ [0.5,1], so this only lowers.
641
641
  const confidence = Math.min(draft.confidence, Math.round(draft.confidence * (0.5 + 0.5 * grounded) * 100) / 100);
642
642
  const source = draft.source.includes("verified") ? draft.source : `${draft.source}+verified`;
643
- return { ...draft, alternatives_rejected, consequences, confidence, grounded, source };
644
- }
645
- /** Run the Critic pass and apply it, degrading to the un-audited draft on any failure
646
- * or when the provider can't verify (deterministic / no CLI). Never throws. */
643
+ return { ...draft, alternatives_rejected, consequences, confidence, grounded, source, verifyOutcome: "applied" };
644
+ }
645
+ /** Run the Critic pass and apply it, degrading to the un-audited draft when the
646
+ * provider can't verify (deterministic / no CLI) or the call keeps failing. Never
647
+ * throws. Marks the OUTCOME on the draft (applied / unavailable / failed) so the
648
+ * degradation is visible in telemetry instead of silent. Retries once: under --deep
649
+ * the Critic call stacks after sampling, and a single transient failure on that
650
+ * extra call shouldn't drop the audit. */
647
651
  export async function verifyDecisionSafe(verifier, input, draft) {
648
652
  if (!verifier?.verifyDecision)
649
- return draft;
650
- try {
651
- return applyVerdict(draft, await verifier.verifyDecision(input, draft));
652
- }
653
- catch {
654
- return draft;
653
+ return { ...draft, verifyOutcome: "unavailable" };
654
+ for (let attempt = 0; attempt < 2; attempt++) {
655
+ try {
656
+ return applyVerdict(draft, await verifier.verifyDecision(input, draft));
657
+ }
658
+ catch {
659
+ /* transient (network / unparseable verdict) — retry once, then give up */
660
+ }
655
661
  }
662
+ return { ...draft, verifyOutcome: "failed" };
656
663
  }
657
664
  const clamp01 = (n) => (Number.isFinite(n) ? Math.max(0, Math.min(1, n)) : 1);
658
665
  // ---- prompt + parsing helpers --------------------------------------------
@@ -94,6 +94,10 @@ export async function syncCommit(store, root, sha, opts = {}) {
94
94
  synthBits.push(`agreement=${draft.agreement}`);
95
95
  if (draft.grounded != null)
96
96
  synthBits.push(`grounded=${draft.grounded}`);
97
+ // The Critic was requested (--verify/--deep) but didn't apply — surface WHY
98
+ // (unavailable / failed) so a skipped audit is never mistaken for a clean one.
99
+ else if (draft.verifyOutcome && draft.verifyOutcome !== "applied")
100
+ synthBits.push(`verify=${draft.verifyOutcome}`);
97
101
  const synthEvidence = `synth:${synthBits.join(" ")}`;
98
102
  const components = store.json.loadAll("components");
99
103
  const relatedComponents = components
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@davesheffer/hunch",
3
- "version": "0.19.0",
3
+ "version": "0.19.1",
4
4
  "license": "Apache-2.0",
5
5
  "author": "Dave Sheffer <dave.sheffer1@gmail.com>",
6
6
  "description": "Hunch — an Engineering Memory OS: a persistent, git-native reasoning graph over a codebase, exposed to Claude Code via MCP.",