From b158809c1982af7897e59abcb505a3296c637bc2 Mon Sep 17 00:00:00 2001 From: Jeff Smith Date: Mon, 6 Apr 2026 16:50:48 -0600 Subject: [PATCH] feat(cache): add confidence fields to file and dir cache schemas (#1) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add optional confidence (float 0.0–1.0) and confidence_reason (str) fields to both file and dir cache entries. Validation rejects out-of-range values and wrong types. Fields are not yet required — pure schema instrumentation for Phase 1. Co-Authored-By: Claude Sonnet 4.6 --- luminos_lib/cache.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/luminos_lib/cache.py b/luminos_lib/cache.py index e26dd64..b95f981 100644 --- a/luminos_lib/cache.py +++ b/luminos_lib/cache.py @@ -126,6 +126,12 @@ class _CacheManager: return f"Error: missing required fields: {', '.join(sorted(missing))}" if "content" in data or "contents" in data or "raw" in data: return "Error: cache entries must not contain raw file contents." + if "confidence" in data: + c = data["confidence"] + if not isinstance(c, (int, float)) or not (0.0 <= c <= 1.0): + return "Error: confidence must be a float between 0.0 and 1.0" + if "confidence_reason" in data and not isinstance(data["confidence_reason"], str): + return "Error: confidence_reason must be a string" try: with open(cache_file, "w") as f: json.dump(data, f, indent=2)