From 3d375ff0ac35278b5f03bfb6bae24b9c1e3b13c5 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 30 Jun 2026 12:18:44 +0000 Subject: [PATCH] chore(ratios): stamp executable source with strict ratios bookend MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bring PTCA into ratios compliance (msdmd RATIOS): every executable source file carries the single-line `ratios:` declaration on its first and last non-blank lines. Stamped 12 Python source files; values computed by skill-lib's canonical ratios_check.py compute functions, so `ratios_check.py` reports 0 drift / 0 misplaced on the covered set. Excluded (this pass): vendored .agents/ skill copies (must be re-propagated from canonical, not hand-edited), frontend/ React trees (separate pass), tests/ (out of the checker's scope), and legacy/ migration trees. Empty stub files are skipped (nothing to seal). Shebangs removed from 0 script(s): ratios placement is strict (first non-blank line), and these are invoked via `python …`/`-m`, so direct ./script execution was not relied upon. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_016MxbhVVRcSdqBTYuvyDR5L --- prime_core/__init__.py | 2 ++ prime_core/constants.py | 2 ++ prime_core/core.py | 2 ++ prime_core/fiq.py | 2 ++ ptca/__init__.py | 2 ++ ptca/constants.py | 2 ++ ptca/exchange.py | 2 ++ ptca/instance.py | 2 ++ ptca/primes.py | 2 ++ ptca/provenance.py | 2 ++ ptca/sentinels.py | 2 ++ ptca/tensor.py | 2 ++ 12 files changed, 24 insertions(+) diff --git a/prime_core/__init__.py b/prime_core/__init__.py index 1a6613e..3f1a2a1 100644 --- a/prime_core/__init__.py +++ b/prime_core/__init__.py @@ -1,3 +1,4 @@ +# ratios: loc_comments=45:13 imports_exports=4:1 calls_definitions=0:0 """prime_core — three-stratum PTCA core (tensor / circle / seed). Public surface (handoff §2 MODULE_BUILD): @@ -61,3 +62,4 @@ "SEED_ROUTING_STEP", "is_coherence_prime", ] +# ratios: loc_comments=45:13 imports_exports=4:1 calls_definitions=0:0 diff --git a/prime_core/constants.py b/prime_core/constants.py index 77c6948..bdd4128 100644 --- a/prime_core/constants.py +++ b/prime_core/constants.py @@ -1,3 +1,4 @@ +# ratios: loc_comments=55:58 imports_exports=2:1 calls_definitions=13:4 """Frozen composition counts and the coherence-prime guard for prime_core. Source provenance (IMPORTANT — unverified in this environment): @@ -128,3 +129,4 @@ def is_coherence_prime(p: int) -> bool: return False _build_coherence_up_to(p) return p in _coherence_known +# ratios: loc_comments=55:58 imports_exports=2:1 calls_definitions=13:4 diff --git a/prime_core/core.py b/prime_core/core.py index 1f762ba..58b7d53 100644 --- a/prime_core/core.py +++ b/prime_core/core.py @@ -1,3 +1,4 @@ +# ratios: loc_comments=104:53 imports_exports=6:8 calls_definitions=27:21 """prime_core.core — the three-stratum PTCA core builder. Stratification (handoff §1.1): scalar tensors are grafted into UCNS *circle* @@ -203,3 +204,4 @@ def build_core(spec: Optional[CoreSpec] = None, *, init: float = 1.0) -> Core: circles.append(compose_circle(fiqs, routing_step=spec.circle_routing_step)) seeds.append(compose_seed(circles, routing_step=spec.seed_routing_step)) return Core(seeds, spec) +# ratios: loc_comments=104:53 imports_exports=6:8 calls_definitions=27:21 diff --git a/prime_core/fiq.py b/prime_core/fiq.py index 2ded596..f48f801 100644 --- a/prime_core/fiq.py +++ b/prime_core/fiq.py @@ -1,3 +1,4 @@ +# ratios: loc_comments=72:32 imports_exports=2:3 calls_definitions=23:13 """fiq — the middle stratum object of a PTCA core. fiq (n.) the tensor holding the UCNS object. @@ -134,3 +135,4 @@ def wrap_tensor_fiq( """ payload = [v if isinstance(v, Scalar) else Scalar(v) for v in values] return Fiq(payload=payload, anchor=anchor, identity=identity) +# ratios: loc_comments=72:32 imports_exports=2:3 calls_definitions=23:13 diff --git a/ptca/__init__.py b/ptca/__init__.py index f6c8620..75c506c 100644 --- a/ptca/__init__.py +++ b/ptca/__init__.py @@ -1,3 +1,4 @@ +# ratios: loc_comments=54:25 imports_exports=8:1 calls_definitions=4:0 """ ptca-lib — Prime Tensor Core Architecture @@ -84,3 +85,4 @@ # version "__version__", ] +# ratios: loc_comments=54:25 imports_exports=8:1 calls_definitions=4:0 diff --git a/ptca/constants.py b/ptca/constants.py index 43e71b0..16ec733 100644 --- a/ptca/constants.py +++ b/ptca/constants.py @@ -1,3 +1,4 @@ +# ratios: loc_comments=33:22 imports_exports=0:0 calls_definitions=1:0 """ PTCA schema constants. @@ -60,3 +61,4 @@ ALPHA, # S8_RISK 0.0, # S9_AUDIT (append-only log, not scored) ) +# ratios: loc_comments=33:22 imports_exports=0:0 calls_definitions=1:0 diff --git a/ptca/exchange.py b/ptca/exchange.py index b5e88be..30df561 100644 --- a/ptca/exchange.py +++ b/ptca/exchange.py @@ -1,3 +1,4 @@ +# ratios: loc_comments=98:109 imports_exports=9:5 calls_definitions=14:8 """ Exchange mechanics — weighted scoring across sentinel channels. @@ -244,3 +245,4 @@ def batch_route( Each dict is passed as keyword arguments to :meth:`route`. """ return [self.route(**exc) for exc in exchanges] +# ratios: loc_comments=98:109 imports_exports=9:5 calls_definitions=14:8 diff --git a/ptca/instance.py b/ptca/instance.py index 177ee65..eca7139 100644 --- a/ptca/instance.py +++ b/ptca/instance.py @@ -1,3 +1,4 @@ +# ratios: loc_comments=191:104 imports_exports=9:1 calls_definitions=41:26 """ PTCAInstance — a PTCA-aware stateful model session. @@ -351,3 +352,4 @@ def __repr__(self) -> str: f"risk={self.risk_score:.3f}, " f"approved={self.approved})" ) +# ratios: loc_comments=191:104 imports_exports=9:1 calls_definitions=41:26 diff --git a/ptca/primes.py b/ptca/primes.py index ee41144..c26010b 100644 --- a/ptca/primes.py +++ b/ptca/primes.py @@ -1,3 +1,4 @@ +# ratios: loc_comments=22:11 imports_exports=2:3 calls_definitions=4:3 """ Prime-node axis for the PTCA tensor. @@ -43,3 +44,4 @@ def prime_for_node(idx: int) -> int: def is_prime_node(p: int) -> bool: """Return True if *p* is one of the 53 routing primes.""" return p in PRIME_TO_NODE +# ratios: loc_comments=22:11 imports_exports=2:3 calls_definitions=4:3 diff --git a/ptca/provenance.py b/ptca/provenance.py index b105942..e3286fe 100644 --- a/ptca/provenance.py +++ b/ptca/provenance.py @@ -1,3 +1,4 @@ +# ratios: loc_comments=58:79 imports_exports=6:5 calls_definitions=14:6 """ Provenance hashing — S1_PROVENANCE support. @@ -162,3 +163,4 @@ def extend_chain( ) blocks.append(block) return block +# ratios: loc_comments=58:79 imports_exports=6:5 calls_definitions=14:6 diff --git a/ptca/sentinels.py b/ptca/sentinels.py index ab357e8..2e8939e 100644 --- a/ptca/sentinels.py +++ b/ptca/sentinels.py @@ -1,3 +1,4 @@ +# ratios: loc_comments=133:37 imports_exports=6:10 calls_definitions=32:28 """ Sentinel channel definitions and live state. @@ -215,3 +216,4 @@ def to_dict(self) -> dict[str, Any]: "S8_RISK": dataclasses.asdict(self.s8), "S9_AUDIT": dataclasses.asdict(self.s9), } +# ratios: loc_comments=133:37 imports_exports=6:10 calls_definitions=32:28 diff --git a/ptca/tensor.py b/ptca/tensor.py index e6b90f0..7b7448d 100644 --- a/ptca/tensor.py +++ b/ptca/tensor.py @@ -1,3 +1,4 @@ +# ratios: loc_comments=101:48 imports_exports=3:1 calls_definitions=33:17 """ PTCA Tensor — 53 × 9 × 8 × 7 routing structure. @@ -182,3 +183,4 @@ def __repr__(self) -> str: def __len__(self) -> int: return self.SIZE +# ratios: loc_comments=101:48 imports_exports=3:1 calls_definitions=33:17