Personal_AI_Infrastructure icon indicating copy to clipboard operation
Personal_AI_Infrastructure copied to clipboard

Freshness grade counts auto-generated files, so the board reads C even when every file a human reviews is an A

Open bak3r opened this issue 2 months ago • 2 comments

What happens

TelosFreshness.ts tracks two derived files, principal_telos and architecture_summary, both with is_auto_generated: true. Nobody reviews these files directly. You review their sources, and the generators rewrite them. assembleContextFreshness() still includes them in overall_pct, overall_grade, fresh_count and most_stale.

On my install every human-owned context file was graded A, but the board showed an overall C because the two derivatives were graded "never reviewed".

This is next to #1780, but it's a different problem. #1780 fixed which file the stale notice names (tie-break toward the source). It did not change what is graded.

Fix

Keep the derivatives in files, so dashboards can still list them, but leave them out of every score and count. Add graded_total so a client can tell the two populations apart.

--- a/LifeOS/install/LIFEOS/TOOLS/TelosFreshness.ts
+++ b/LifeOS/install/LIFEOS/TOOLS/TelosFreshness.ts
@@ -256,7 +256,11 @@
 export interface ContextFreshness {
   files: FileFreshness[];
+  /** Every file read, generated ones included. */
   total: number;
+  /** Files a human can actually review: `total` minus auto-generated derivatives.
+   *  Every count and score below is computed over THIS population. */
+  graded_total: number;
   fresh_count: number;
@@ -680,20 +684,29 @@
-function assembleContextFreshness(files: FileFreshness[], now: Date): ContextFreshness {
-  const staleFiles = files.filter((file) => file.stale);
-  const most_stale = pickMostStale(files, staleFiles);
-
-  const overall_pct = files.length
-    ? Math.round(files.reduce((sum, f) => sum + f.pct, 0) / files.length)
+/**
+ * Auto-generated derivatives (PRINCIPAL_TELOS, ARCHITECTURE_SUMMARY) are never
+ * reviewed by a human; you review their SOURCE. They stay in `files` so the
+ * board can still show them, but are excluded from every score and count.
+ */
+export function gradedFiles(files: FileFreshness[]): FileFreshness[] {
+  return files.filter((file) => !file.is_auto_generated);
+}
+
+function assembleContextFreshness(files: FileFreshness[], now: Date): ContextFreshness {
+  const graded = gradedFiles(files);
+  const staleFiles = graded.filter((file) => file.stale);
+  const most_stale = pickMostStale(graded, staleFiles);
+
+  const overall_pct = graded.length
+    ? Math.round(graded.reduce((sum, f) => sum + f.pct, 0) / graded.length)
     : 0;
-  const overall_grade = aggregateGrade(files.map((f) => f.grade));
+  const overall_grade = aggregateGrade(graded.map((f) => f.grade));
 
   return {
     files,
     total: files.length,
-    fresh_count: files.length - staleFiles.length,
+    graded_total: graded.length,
+    fresh_count: graded.length - staleFiles.length,
     stale_count: staleFiles.length,
--- a/LifeOS/install/LIFEOS/PULSE/modules/telos.ts
+++ b/LifeOS/install/LIFEOS/PULSE/modules/telos.ts
@@ -134,4 +134,5 @@
       return Response.json({
         total: c.total,
+        graded_total: c.graded_total,
         fresh_count: c.fresh_count,

Because most_stale is now picked only from graded files, the #1780 tie-break can no longer land on a derivative. It's harmless to keep it anyway.

Verified

This has run on my install since 2026-08-26. Unit tests cover gradedFiles(): derivatives are excluded, a board made only of derivatives grades nothing rather than zero, and human-owned files pass through unchanged. After the change, the board went from C to the grade of the human-owned files.

bak3r avatar Sep 21 '26 05:09 bak3r

This is Shiva, Eugene's AI Assistant, reporting on Eugene's behalf.

Confirmed — overall_pct/grade included auto-generated derivatives nobody reviews directly, dragging the score down artificially. Added a gradedFiles() filter and a separate graded_total so the board reflects human-reviewed content.

Environment: ThinkPad, Ubuntu 24.04.4 LTS, Ryzen AI 9 HX PRO 370, Bun 1.3.11.

waveman2020-sudo avatar Sep 23 '26 19:09 waveman2020-sudo

Thanks @bak3r. Auto-generated derivatives stay in the file list but no longer count toward the grade or any count, and the summary carries graded_total so clients can tell the two populations apart (LIFEOS/TOOLS/TelosFreshness.ts). Next release carries it.

danielmiessler avatar Oct 03 '26 04:10 danielmiessler