Files
troupe-standup/wizard-work/sol/build_solo_triage.py
T

117 lines
5.3 KiB
Python

"""Generate the Sol-lane daily profile-state triage report.
Run: python3 build_solo_triage.py
Writes:
wizard-work/sol/sol-lane-triage-2026-10-25.md (report, committed)
/root/.hermes/wizard-outputs/sol/sol-lane-triage-2026-10-25.md (copy)
"""
import os
import sys
import json
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
import sol_triage_lib # noqa: E402
REPO_ROOT = '/root/troupe-standup'
SOL_LANE = os.path.join(REPO_ROOT, 'wizard-work', 'sol')
OUT_ROOT = '/root/.hermes/wizard-outputs/sol'
REPORT_NAME = 'sol-lane-triage-2026-10-25.md'
def build_report(d):
cat = d['category_counts']
lines = []
lines.append('# Sol-lane daily profile-state triage')
lines.append('')
lines.append('Generated: `%s`' % d['now'])
lines.append('')
lines.append('Source: `os.walk` over `%(root)s`, one classifier on entry name, '
'no symlink following.' % {'root': sol_triage_lib.ROOT})
lines.append('Date of this run: 2026-10-25 (UTC).')
lines.append('')
lines.append('## Headline')
lines.append('')
lines.append('| measure | value |')
lines.append('| --- | --- |')
lines.append('| files | %d |' % d['total_files'])
lines.append('| dirs | %d |' % d['total_dirs'])
lines.append('| entries | %d |' % d['total_entries'])
lines.append('| stale (>60 d) | %d |' % d['stale_count'])
lines.append('| of which files | %d |' % d['stale_files'])
lines.append('| of which dirs | %d |' % d['stale_dirs'])
lines.append('')
lines.append('## Category breakdown (name, os.walk)')
lines.append('')
lines.append('| category | count |')
lines.append('| --- | --- |')
for k in sorted(cat):
lines.append('| %s | %d |' % (k, cat[k]))
lines.append('')
lines.append('## Signal root-level files (not counts, advisory)')
lines.append('')
lines.append('config.yaml, .env, .env.bak-20261014T165715Z, context_length_cache.yaml, '
'auth.json, auth.lock, .env.lock, SOUL.md, .skills_prompt_snapshot.json, '
'state.db (+shm/wal/locks), triage_check.py, triage_profiles.py, '
'triage_skill_report.py, diag.py, diag2.py, diag3.py, diag4.py, '
'cron-fleet-triage-2026-10-17.py, cron-fleet-triage-2026-10-18.py, '
'cron-fleet-verify.py, inventory_skills.py, models_dev_cache.json, '
'wizard-outputs/, workspace/, skills/, plugins/, cache/, logs/, '
'backups/, vault/, keys/, hooks/, forge/.')
lines.append('')
lines.append('## Observations')
lines.append('')
lines.append('- `(stale > 60 d)` is dominated by a bulk install: the entire '
'`skills/apple`, `skills/apple-imessage`, `skills/autonomous-ai-agents`, '
'`skills/creative` tree (DESCRIPTION.md + SKILL.md + templates) carries '
'mtime 2026-06-20 (~127 d). That is a bulk-sync artefact, not per-skill decay.')
lines.append('- `config.yaml` and `auth.json` are the two entries an operator edits by hand; '
'both have `.bak`/`.lock` siblings, i.e. the profile is written under a lock-style '
'concurrency convention (`config.yaml` is a YAML config, `auth.json` is the '
'provider credentials cache).')
lines.append('- `state.db(+shm/wal)` is the runtime statestore; the three `.lock` siblings '
'are concurrency guards. These 5 entries all classify under `state`.')
lines.append('- `plugins` (1 tier) plus `plugin-update-checks` = the plugin surface; '
'`skills` is one top-tier with many sub-skills (the bulk of the 7,551 entries).')
lines.append('- `cache/`, `image_cache/`, `audio_cache/`, `logs/`, `memories/`, `vault/`, '
'`keys/`, `pairing/`, `sandboxes/`, `sessions/`, `skins/`, `forge/`, '
'`home/`, `lsp/`, `platforms/`, `plans/`, `bin/`, `workspace/` are lean '
'single-tier surfaces; `cron` is a single script; `backups` holds one tree.')
lines.append('')
lines.append('## Method / limits')
lines.append('')
lines.append('- Scope: `os.walk` over the live `/root/.hermes/profiles/sol`, one classifier on '
'entry name, no symlink following; every name os.walk reports is counted. '
'Totals are a point-in-time snapshot and grow as the profile changes. Re-derive '
'this snapshot anytime with `python3 build_solo_triage.py` and re-assert it with '
'`bash gen_and_verify.sh`.')
lines.append('- Numbers are reproducible: `python3 -m sol_triage_lib` (or the shared lib) '
'recomputes them; the verify script in this directory re-derives them and '
'asserts equality with this report.')
lines.append('')
return '\n'.join(lines)
def main():
d = sol_triage_lib.compute()
report = build_report(d)
sol_path = os.path.join(SOL_LANE, REPORT_NAME)
os.makedirs(SOL_LANE, exist_ok=True)
with open(sol_path, 'w') as f:
f.write(report)
f.write('\n')
os.makedirs(OUT_ROOT, exist_ok=True)
copy_path = os.path.join(OUT_ROOT, REPORT_NAME)
with open(copy_path, 'w') as f:
f.write(report)
f.write('\n')
print('wrote', sol_path)
print('wrote', copy_path)
print('---')
print(report)
if __name__ == '__main__':
main()