sol: add sol-profile file triage 2026-10-31 (ACTIVE/STALE/ARTIFACT)

This commit is contained in:
sol committed 2026-10-31 06:04:43 +00:00
1 parent c4f68678ea
commit 46ed920871
4 files changed
+230

No files matched your search

+88
View File
@@ -0,0 +1,88 @@
#!/usr/bin/env python3
# CHECK — sol-profile file triage classifier (2026-10-31).
#
# Exit 0 iff an INDEPENDENT recompute straight from the live sol profile
# matches the committed JSON's tier counts (ACTIVE/STALE/ARTIFACT), the JSON
# row count equals the live regular-file count, and the expected tier counts
# (ACTIVE=7961 STALE=267 ARTIFACT=126, files=8354) hold.
import os, json, datetime, sys, re
ROOT = "/root/.hermes/profiles/sol"
JSON_PATH = "/root/.hermes/wizard-outputs/sol/sol-profile-file-class-2026-10-31.json"
MD_PATH = "/root/.hermes/wizard-outputs/sol/sol-profile-file-class-2026-10-31.md"
ARTIFACT_DIRS = {"audio_cache", "image_cache", "cache", "__pycache__", "backups", "bin", "hooks",
"keys", ".pytest_cache", ".ruff_cache", ".mypy_cache", ".tox", "node_modules"}
ARTIFACT_EXTS = {".db", ".sqlite", ".sqlite3", ".sqlite3-journal", ".lock", ".pyc", ".pyo", ".bak",
".orig", ".tmp", ".part", ".gz", ".tgz", ".zip", ".dump", ".log"}
EXPECTED = {"ACTIVE": 7961, "STALE": 267, "ARTIFACT": 126}
EXPECTED_FILES = 8354
def recompute():
counts = {"ACTIVE": 0, "STALE": 0, "ARTIFACT": 0}
n_files = 0
for dirpath, dirnames, filenames in os.walk(ROOT):
for fn in filenames:
p = os.path.join(dirpath, fn)
relp = os.path.relpath(p, ROOT)
if any(relp.startswith(ad + os.sep) for ad in ARTIFACT_DIRS):
t = "ARTIFACT"
else:
ext = os.path.splitext(fn)[1].lower()
if ext in ARTIFACT_EXTS:
t = "ARTIFACT"
else:
st = os.stat(p)
m = datetime.datetime.fromtimestamp(st.st_mtime, datetime.timezone.utc)
days = (datetime.datetime.now(datetime.timezone.utc) - m).total_seconds() / 86400.0
t = "ACTIVE" if days <= 45 else "STALE"
counts[t] += 1
n_files += 1
return counts, n_files
def main():
live_counts, live_n = recompute()
with open(JSON_PATH) as f:
records = json.load(f)
json_counts = {"ACTIVE": 0, "STALE": 0, "ARTIFACT": 0}
for _, t in records:
json_counts[t] += 1
print("OK: recompute ACTIVE=%d STALE=%d ARTIFACT=%d files=%d" % (
live_counts["ACTIVE"], live_counts["STALE"], live_counts["ARTIFACT"], live_n))
print("OK: committed JSON ACTIVE=%d STALE=%d ARTIFACT=%d rows=%d" % (
json_counts["ACTIVE"], json_counts["STALE"], json_counts["ARTIFACT"], len(records)))
failures = []
if live_counts != json_counts:
failures.append("recompute != committed JSON: %s != %s" % (live_counts, json_counts))
if live_n != len(records):
failures.append("live file count %d != JSON rows %d" % (live_n, len(records)))
if live_n != EXPECTED_FILES:
failures.append("live file count %d != expected %d" % (live_n, EXPECTED_FILES))
for tier, want in EXPECTED.items():
if live_counts.get(tier) != want:
failures.append("%s live=%d expected=%d" % (tier, live_counts.get(tier), want))
md = ""
try:
md = open(MD_PATH).read()
except OSError:
md = ""
for tier in ("ACTIVE", "STALE", "ARTIFACT"):
# MD table rows: "| ACTIVE | 7961 | ..."
m = re.search(r"\|\s*%s\s*\|\s*(\d+)\s*\|" % tier, md)
if m and int(m.group(1)) != EXPECTED[tier]:
failures.append("MD %s count %s != expected %d" % (tier, m.group(1), EXPECTED[tier]))
if failures:
print("FAIL: " + "; ".join(failures), file=sys.stderr)
sys.exit(1)
print("PASS: sol-profile file triage verified (ACTIVE=7961 STALE=267 ARTIFACT=126, files=8354)")
sys.exit(0)
if __name__ == "__main__":
main()
@@ -0,0 +1,92 @@
import os, json, datetime
root = "/root/.hermes/profiles/sol"
now = datetime.datetime.now(datetime.timezone.utc)
cutoff = datetime.timedelta(days=45)
ARTIFACT_DIRS = {"audio_cache", "image_cache", "cache", "__pycache__", "backups", "bin", "hooks",
"keys", ".pytest_cache", ".ruff_cache", ".mypy_cache", ".tox", "node_modules"}
ARTIFACT_EXTS = {".db", ".sqlite", ".sqlite3", ".sqlite3-journal", ".lock", ".pyc", ".pyo", ".bak",
".orig", ".tmp", ".part", ".gz", ".tgz", ".zip", ".dump", ".log"}
records = []
dead_dirs = 0
for dirpath, dirnames, filenames in os.walk(root):
rel = os.path.relpath(dirpath, root)
real_dirs = [d for d in dirnames if d not in {".git"}]
if not real_dirs and rel != ".":
dead_dirs += 1
for fn in filenames:
p = os.path.join(dirpath, fn)
relp = os.path.relpath(p, root)
tier = None
if any(relp.startswith(ad + os.sep) for ad in ARTIFACT_DIRS):
tier = "ARTIFACT"
else:
ext = os.path.splitext(fn)[1].lower()
if ext in ARTIFACT_EXTS:
tier = "ARTIFACT"
else:
st = os.stat(p)
m = datetime.datetime.fromtimestamp(st.st_mtime, datetime.timezone.utc)
days = (now - m).total_seconds() / 86400.0
tier = "ACTIVE" if days <= 45 else "STALE"
records.append([relp, tier])
n_active = sum(1 for _, t in records if t == "ACTIVE")
n_stale = sum(1 for _, t in records if t == "STALE")
n_artifact = sum(1 for _, t in records if t == "ARTIFACT")
json_path = "/root/.hermes/wizard-outputs/sol/sol-profile-file-class-2026-10-31.json"
with open(json_path, "w") as f:
json.dump(records, f)
md = []
md.append("# Sol-Profile File Triage — 2026-10-31")
md.append("")
md.append("Deterministic classification of every regular file under `/root/.hermes/profiles/sol/`.")
md.append("No LLM judgement: every verdict derives from filesystem mtime + lock/content markers.")
md.append("")
md.append("## Tier counts")
md.append("")
md.append("| tier | count | meaning |")
md.append("|---|---|---|")
md.append("| ACTIVE | %d | mtime within 45 days |" % n_active)
md.append("| STALE | %d | mtime older than 45 days (review) |" % n_stale)
md.append("| ARTIFACT | %d | lock/DB/cache/backup/blob marker |" % n_artifact)
md.append("| DEAD | %d | empty directories (non-actionable) |" % dead_dirs)
md.append("")
md.append("## Rules")
md.append("")
md.append("1. ARTIFACT: path under a lock/DB/cache/backup dir (audio_cache, image_cache, cache, __pycache__,")
md.append(" backups, bin, hooks, keys, .pytest_cache, .ruff_cache, .mypy_cache, .tox, node_modules), or")
md.append(" extension in .db .sqlite .lock .pyc .bak .orig .tmp .gz .zip .dump .log.")
md.append("2. ACTIVE: regular file with mtime within the last 45 days of generation time.")
md.append("3. STALE: regular file with mtime older than 45 days (review).")
md.append("4. DEAD: empty directories (non-actionable; not part of the file table).")
md.append("")
md.append("## Sample (first 3 per tier, sorted)")
md.append("")
for tier in ("ACTIVE", "STALE", "ARTIFACT"):
md.append("### %s" % tier)
rows = sorted([r for r, t in records if t == tier])
for r in rows[:3]:
md.append("- `%s`" % r)
md.append("")
md.append("## Verification")
md.append("")
md.append("- Re-enumerate the filesystem and recompute tiers with the same rules; assert counts equal")
md.append(" ACTIVE=7961 STALE=267 ARTIFACT=126.")
md.append("- Run: `python3 check_sol_profile_file_class_2026-10-31.py` (exit 0 = report is correct).")
md.append("")
md.append("## Generator")
md.append("")
md.append("- `gen_sol_profile_file_class_2026-10-31.py` (stdlib only).")
md.append("")
md_path = "/root/.hermes/wizard-outputs/sol/sol-profile-file-class-2026-10-31.md"
with open(md_path, "w") as f:
f.write("\n".join(md))
print("records:", len(records))
print("ACTIVE:", n_active, "STALE:", n_stale, "ARTIFACT:", n_artifact, "DEAD dirs:", dead_dirs)
@@ -0,0 +1 @@
[["_gen_daily_ledger_json.py", "ACTIVE"], [".env.bak-20261014T165715Z", "ACTIVE"], ["config.yaml", "ACTIVE"], ["state.db.auto-maintenance.lock", "ARTIFACT"], ["state.db-shm", "ACTIVE"], ["SOUL.md", "ACTIVE"], ["inventory_skills.py", "ACTIVE"], ["diag4.py", "ACTIVE"], ["_gen_daily_triage.py", "ACTIVE"], ["state.db.quarantine.lock", "ARTIFACT"], ["cron-fleet-verify.py", "ACTIVE"], ["triage_profiles.py", "ACTIVE"], ["models_dev_cache.etag", "ACTIVE"], ["projects.db", "ARTIFACT"], ["models_dev_cache.json", "ACTIVE"], ["config.yaml.bak-20261014T165715Z", "ACTIVE"], ["cron-fleet-triage-2026-10-18.py", "ACTIVE"], [".env", "ACTIVE"], ["gen_sol_profile_triage.py", "ACTIVE"], ["gateway.lock", "ARTIFACT"], ["cron-fleet-triage-2026-10-17.py", "ACTIVE"], ["context_length_cache.yaml", "ACTIVE"], ["auth.lock", "ARTIFACT"], ["_gen_daily_ledger_report.py", "ACTIVE"], ["context_length_cache.yaml.lock", "ARTIFACT"], ["diag.py", "ACTIVE"], ["state.db-wal", "ACTIVE"], [".skills_prompt_snapshot.json", "ACTIVE"], ["state.db", "ARTIFACT"], ["triage_skill_report.py", "ACTIVE"], ["diag3.py", "ACTIVE"], [".env.lock", "ARTIFACT"], ["_check_repo_json.py", "ACTIVE"], ["_verify_daily_triage.py", "ACTIVE"], ["triage_check.py", "ACTIVE"], ["verify_skills.py", "ACTIVE"], ["state.db.fts_rebuild.lock", "ARTIFACT"], ["diag2.py", "ACTIVE"], ["_gen_daily_triage_fresh.py", "ACTIVE"], ["auth.json", "ACTIVE"], ["lsp/package-lock.json", "ACTIVE"], ["lsp/package.json", "ACTIVE"], ["lsp/node_modules/.package-lock.json", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/README.md", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/License.txt", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/thirdpartynotices.txt", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/package.json", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/eslint.config.js", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/browser/main.d.ts", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/browser/main.js", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/notebook.d.ts", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/showDocument.d.ts", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/inlineCompletion.js", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/semanticTokens.js", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/inlineValue.js", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/workspaceFolder.d.ts", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/callHierarchy.d.ts", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/api.d.ts", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/textDocuments.d.ts", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/moniker.js", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/linkedEditingRange.d.ts", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/api.js", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/textDocumentContent.d.ts", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/moniker.d.ts", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/fileOperations.d.ts", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/progress.d.ts", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/workspaceFolder.js", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/inlineValue.d.ts", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/callHierarchy.js", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/fileOperations.js", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/diagnostic.d.ts", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/showDocument.js", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/server.d.ts", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/inlayHint.js", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/configuration.d.ts", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/semanticTokens.d.ts", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/typeHierarchy.js", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/inlineCompletion.d.ts", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/inlayHint.d.ts", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/textDocumentContent.js", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/foldingRange.js", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/foldingRange.d.ts", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/typeHierarchy.d.ts", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/server.js", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/progress.js", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/linkedEditingRange.js", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/Line truncated
@@ -0,0 +1,49 @@
# Sol-Profile File Triage — 2026-10-31
Deterministic classification of every regular file under `/root/.hermes/profiles/sol/`.
No LLM judgement: every verdict derives from filesystem mtime + lock/content markers.
## Tier counts
| tier | count | meaning |
|---|---|---|
| ACTIVE | 7961 | mtime within 45 days |
| STALE | 267 | mtime older than 45 days (review) |
| ARTIFACT | 126 | lock/DB/cache/backup/blob marker |
| DEAD | 825 | empty directories (non-actionable) |
## Rules
1. ARTIFACT: path under a lock/DB/cache/backup dir (audio_cache, image_cache, cache, __pycache__,
backups, bin, hooks, keys, .pytest_cache, .ruff_cache, .mypy_cache, .tox, node_modules), or
extension in .db .sqlite .lock .pyc .bak .orig .tmp .gz .zip .dump .log.
2. ACTIVE: regular file with mtime within the last 45 days of generation time.
3. STALE: regular file with mtime older than 45 days (review).
4. DEAD: empty directories (non-actionable; not part of the file table).
## Sample (first 3 per tier, sorted)
### ACTIVE
- `.env`
- `.env.bak-20261014T165715Z`
- `.skills_prompt_snapshot.json`
### STALE
- `skills/apple/DESCRIPTION.md`
- `skills/apple/apple-notes/SKILL.md`
- `skills/apple/apple-reminders/SKILL.md`
### ARTIFACT
- `.env.lock`
- `auth.lock`
- `backups/config/config.yaml.good.20261011-153550`
## Verification
- Re-enumerate the filesystem and recompute tiers with the same rules; assert counts equal
ACTIVE=7961 STALE=267 ARTIFACT=126.
- Run: `python3 check_sol_profile_file_class_2026-10-31.py` (exit 0 = report is correct).
## Generator
- `gen_sol_profile_file_class_2026-10-31.py` (stdlib only).