check.py
python
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1
docs: MuseHub-first before ISR #74 — staging solidify NEXT
Human
2 days ago
| 1 | """Substrate health for Muse-backed regimes (K7 D2 / SD-14 guard).""" |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | from dataclasses import dataclass |
| 6 | from pathlib import Path |
| 7 | |
| 8 | from adapters.config import OverseerConfig |
| 9 | |
| 10 | MUSE_CORE_FILES = ("HEAD", "repo.json", "config.toml") |
| 11 | |
| 12 | |
| 13 | @dataclass(frozen=True) |
| 14 | class SubstrateReport: |
| 15 | """Result of a local substrate probe — no shell, no inference from docs.""" |
| 16 | |
| 17 | regime: str |
| 18 | state: str # healthy | hollow | missing | not_applicable |
| 19 | missing: tuple[str, ...] |
| 20 | remediation: str | None |
| 21 | message: str |
| 22 | |
| 23 | @property |
| 24 | def ok(self) -> bool: |
| 25 | return self.state in {"healthy", "not_applicable"} |
| 26 | |
| 27 | |
| 28 | def check_substrate(config: OverseerConfig, repo_root: Path) -> SubstrateReport: |
| 29 | """Verify Muse metadata exists when config declares a Muse-backed regime.""" |
| 30 | regime = config.vcs.regime |
| 31 | if regime == "git-only": |
| 32 | return SubstrateReport( |
| 33 | regime=regime, |
| 34 | state="not_applicable", |
| 35 | missing=(), |
| 36 | remediation=None, |
| 37 | message="git-only regime — Muse substrate not required", |
| 38 | ) |
| 39 | |
| 40 | muse_dir = repo_root / ".muse" |
| 41 | if not muse_dir.is_dir(): |
| 42 | return _broken( |
| 43 | regime, |
| 44 | state="missing", |
| 45 | missing=(".muse/",), |
| 46 | remediation="muse init .", |
| 47 | detail="config declares Muse canonical but .muse/ is absent (K7 D2 incomplete)", |
| 48 | ) |
| 49 | |
| 50 | missing = tuple( |
| 51 | rel |
| 52 | for name in MUSE_CORE_FILES |
| 53 | if not (muse_dir / name).is_file() |
| 54 | for rel in (f".muse/{name}",) |
| 55 | ) |
| 56 | if missing: |
| 57 | return _broken( |
| 58 | regime, |
| 59 | state="hollow", |
| 60 | missing=missing, |
| 61 | remediation="muse init --force .", |
| 62 | detail=( |
| 63 | "hollow .muse/ — config claims " |
| 64 | f"{regime} but core Muse files missing (K7 D2 incomplete)" |
| 65 | ), |
| 66 | ) |
| 67 | |
| 68 | return SubstrateReport( |
| 69 | regime=regime, |
| 70 | state="healthy", |
| 71 | missing=(), |
| 72 | remediation=None, |
| 73 | message=f"Muse substrate healthy ({regime})", |
| 74 | ) |
| 75 | |
| 76 | |
| 77 | def _broken( |
| 78 | regime: str, |
| 79 | *, |
| 80 | state: str, |
| 81 | missing: tuple[str, ...], |
| 82 | remediation: str, |
| 83 | detail: str, |
| 84 | ) -> SubstrateReport: |
| 85 | missing_label = ", ".join(missing) |
| 86 | return SubstrateReport( |
| 87 | regime=regime, |
| 88 | state=state, |
| 89 | missing=missing, |
| 90 | remediation=remediation, |
| 91 | message=f"{detail}; missing: {missing_label}", |
| 92 | ) |
File History
2 commits
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1
docs: MuseHub-first before ISR #74 — staging solidify NEXT
Human
2 days ago
sha256:4671b7f787ddbe63ced31c895b688c77ab495653b65a730b423329f26b3c1439
feat: K1-P1 complete — agent provenance, build-verification…
Sonnet 4.6
patch
54 days ago