spark: add Hermes Agent system verification script and report

This commit is contained in:
spark committed 2026-10-27 22:24:41 +00:00
1 parent e0ee5cbd48
commit fff82e64ee
2 files changed
+164

No files matched your search

@@ -0,0 +1,23 @@
{
"status": "verified",
"checks": [
{
"check": "wizard_dir",
"status": "pass",
"path": "/root/.hermes/wizard-outputs/spark"
},
{
"check": "python_files",
"status": "pass",
"count": 22
},
{
"check": "prime_factorizer_syntax",
"status": "pass"
},
{
"check": "prime_factorizer_tests",
"status": "pass"
}
]
}
+141
View File
@@ -0,0 +1,141 @@
#!/usr/bin/env python3
"""
Hermes Agent Skill System Verification
Verifies that the skill system is functional and returns verifiable results.
Exit codes:
0 - All verifications passed
1 - One or more verifications failed
This script produces output that can be independently verified.
"""
import json
import sys
import os
import subprocess
def check_file_exists(path):
"""Check if a file exists and is readable."""
return os.path.isfile(path) and os.access(path, os.R_OK)
def check_directory_exists(path):
"""Check if a directory exists and is accessible."""
return os.path.isdir(path) and os.access(path, os.R_OK | os.X_OK)
def run_python_code(code):
"""Run Python code safely and return result."""
try:
result = subprocess.run(
['python3', '-c', code],
capture_output=True,
text=True,
timeout=10
)
return result.returncode == 0, result.stdout.strip(), result.stderr.strip()
except Exception as e:
return False, '', str(e)
def main():
print("=" * 60)
print("Hermes Agent Skill System Verification")
print("=" * 60)
print()
checks_passed = 0
checks_failed = 0
results = []
# Check 1: Verify wizard-outputs directory exists
wizard_dir = '/root/.hermes/wizard-outputs/spark'
if check_directory_exists(wizard_dir):
print(f"[PASS] Wizard outputs directory: {wizard_dir}")
checks_passed += 1
results.append({'check': 'wizard_dir', 'status': 'pass', 'path': wizard_dir})
else:
print(f"[FAIL] Wizard outputs directory not found: {wizard_dir}")
checks_failed += 1
results.append({'check': 'wizard_dir', 'status': 'fail', 'path': wizard_dir})
# Check 2: Count Python files in wizard outputs
try:
py_count = len([f for f in os.listdir(wizard_dir) if f.endswith('.py') and f.startswith('test_') or f == 'prime_factorizer.py'])
print(f"[PASS] Python files in wizard outputs: {py_count}")
checks_passed += 1
results.append({'check': 'python_files', 'status': 'pass', 'count': py_count})
except Exception as e:
print(f"[FAIL] Could not count Python files: {e}")
checks_failed += 1
results.append({'check': 'python_files', 'status': 'fail', 'error': str(e)})
# Check 3: Verify prime_factorizer.py exists and is valid Python
prime_file = os.path.join(wizard_dir, 'prime_factorizer.py')
if check_file_exists(prime_file):
syntax_ok, stdout, stderr = run_python_code(f"import ast; ast.parse(open('{prime_file}').read())")
if syntax_ok:
print(f"[PASS] prime_factorizer.py has valid Python syntax")
checks_passed += 1
results.append({'check': 'prime_factorizer_syntax', 'status': 'pass'})
else:
print(f"[FAIL] prime_factorizer.py syntax error: {stderr}")
checks_failed += 1
results.append({'check': 'prime_factorizer_syntax', 'status': 'fail', 'error': stderr})
else:
print(f"[FAIL] prime_factorizer.py not found")
checks_failed += 1
results.append({'check': 'prime_factorizer_syntax', 'status': 'fail'})
# Check 4: Run the prime_factorizer test
test_file = os.path.join(wizard_dir, 'test_prime_factorizer.py')
if check_file_exists(test_file):
result = subprocess.run(
['python3', test_file],
capture_output=True,
text=True,
cwd=wizard_dir
)
if result.returncode == 0:
print(f"[PASS] Prime factorizer tests passed")
checks_passed += 1
results.append({'check': 'prime_factorizer_tests', 'status': 'pass'})
else:
print(f"[FAIL] Prime factorizer tests failed")
checks_failed += 1
results.append({'check': 'prime_factorizer_tests', 'status': 'fail'})
else:
print(f"[FAIL] test_prime_factorizer.py not found")
checks_failed += 1
results.append({'check': 'prime_factorizer_tests', 'status': 'fail'})
# Check 5: Verify hermes_verification_report.json can be written
report_path = os.path.join(wizard_dir, 'hermes_verification_report.json')
try:
with open(report_path, 'w') as f:
json.dump({'status': 'verified', 'checks': results}, f, indent=2)
if check_file_exists(report_path):
print(f"[PASS] Verification report written: {report_path}")
checks_passed += 1
results.append({'check': 'report_write', 'status': 'pass'})
else:
print(f"[FAIL] Could not write verification report")
checks_failed += 1
results.append({'check': 'report_write', 'status': 'fail'})
except Exception as e:
print(f"[FAIL] Could not write verification report: {e}")
checks_failed += 1
results.append({'check': 'report_write', 'status': 'fail', 'error': str(e)})
# Summary
print()
print("=" * 60)
print(f"SUMMARY: {checks_passed} passed, {checks_failed} failed")
if checks_failed == 0:
print("VERIFICATION RESULT: PASS")
else:
print("VERIFICATION RESULT: FAIL")
print("=" * 60)
return 0 if checks_failed == 0 else 1
if __name__ == '__main__':
sys.exit(main())