BioSight/harness/loader.py
allaun e0b2283972 feat(phi): full docstring + verification hardening pass
Every function in all 5 phi modules now has:
- Google-style docstring with Args/Returns/Examples
- Verified behavior via doctest examples (46 total)
- Self-verification assertion blocks on direct execution

Verification results:
  charclass: 10 doctests, 16 assertions  — PASS
  ast_parse: 21 doctests, 7 assertions   — PASS
  consistency: 6 assertions               — PASS
  embed: multiple assertions              — PASS
  output: 15 doctests, 16 assertions      — PASS
  CLI wrapper: 3 checks                   — PASS
  End-to-end: 9 equation domains          — PASS

Also added:
- .opencode/opencode.jsonc (gemma4 MCP config)
- phi/AGENTS.md (module-level contract)
- phi/test_phi.py (unittest test file)
- phi/encoding_rationale.md (design docs)
- dag/ (project dependency graph)
- harness/ (Lean formalism constraints)
- 7-Pipeline/ (rigour verification harness)

Build: python3 -W error -m py_compile — 0 warnings
2026-06-24 03:57:50 -05:00

34 lines
965 B
Python

import sys
import os
def load_harness(name):
path = f"harness/{name}.md"
if not os.path.exists(path):
return f"Harness '{name}' not found at {path}"
with open(path, 'r') as f:
content = f.read()
# Extract the content between ## Context and ## Reference Anchors
lines = content.split('\n')
harness_body = []
in_body = False
for line in lines:
if line.startswith("## Context"):
in_body = True
continue
if line.startswith("## Core Quirks") and in_body:
# We keep the quirks section
pass
if line.startswith("## Reference Anchors") and in_body:
break
if in_body:
harness_body.append(line)
return "\n".join(harness_body)
if __name__ == "__main__":
if len(sys.argv) < 2:
print("Usage: python3 harness/loader.py <harness_name>")
else:
print(load_harness(sys.argv[1]))