feat(arch): implement 'Code as Thought' architecture and formalize PSF Consensus Loop
This commit is contained in:
44
projects/org-skill-memex/tests/simulate_audit.py
Normal file
44
projects/org-skill-memex/tests/simulate_audit.py
Normal file
@@ -0,0 +1,44 @@
|
||||
import re
|
||||
import os
|
||||
|
||||
def simulate_memex_audit(file_path):
|
||||
if not os.path.exists(file_path):
|
||||
return {"status": "error", "message": "File not found"}
|
||||
|
||||
errors = []
|
||||
with open(file_path, 'r', encoding='utf-8') as f:
|
||||
lines = f.readlines()
|
||||
|
||||
for i, line in enumerate(lines):
|
||||
if re.match(r'^\*{3,10} ', line):
|
||||
current_headline = line.strip()
|
||||
found_created = False
|
||||
in_properties = False
|
||||
# Look ahead for PROPERTIES and CREATED
|
||||
for j in range(i + 1, min(i + 20, len(lines))):
|
||||
if ":PROPERTIES:" in lines[j]:
|
||||
in_properties = True
|
||||
if in_properties and ":CREATED:" in lines[j]:
|
||||
found_created = True
|
||||
break
|
||||
if in_properties and ":END:" in lines[j]:
|
||||
break
|
||||
if re.match(r'^\*+ ', lines[j]): # Hit another headline
|
||||
break
|
||||
|
||||
if not found_created:
|
||||
errors.append(f"Missing :CREATED: for {current_headline} (Line {i+1})")
|
||||
|
||||
return {"status": "fail" if errors else "success", "file": file_path, "errors": errors}
|
||||
|
||||
if __name__ == "__main__":
|
||||
inbox_files = [f for f in os.listdir('.') if f.startswith('inbox-') and f.endswith('.org')]
|
||||
for f in inbox_files:
|
||||
result = simulate_memex_audit(f)
|
||||
print(f"--- Audit: {f} ---")
|
||||
print(f"Status: {result['status'].upper()}")
|
||||
print(f"Errors Found: {len(result['errors'])}")
|
||||
if result['errors']:
|
||||
print("First 3 errors:")
|
||||
for e in result['errors'][:3]:
|
||||
print(f" - {e}")
|
||||
Reference in New Issue
Block a user