Compare commits

...
10 Commits
Author SHA1 Message Date
conductor 20f2baf7b4 chore(release): auto-bump version to 0.167.0 — earned by # (minor: converged release (push-to-master bump))
CI Pipeline / unit-tests (push) Canceled after 0s
CI Pipeline / go-surface (push) Canceled after 0s
Auto-version and Release / release (push) Canceled after 1s
CI Pipeline / rust-surface (push) Canceled after 0s
CI Pipeline / canary (push) Canceled after 0s
CI Pipeline / best-practices (push) Canceled after 0s
CI Pipeline / documentation (push) Canceled after 0s
CI Pipeline / type-check (push) Canceled after 0s
CI Pipeline / gitea-offline (push) Canceled after 0s
CI Pipeline / required-checks (push) Canceled after 0s
CI Pipeline / CI Pipeline / notify-event-bridge (push) Canceled after 0s
deploy / deploy (push) Canceled after 1s
CI Pipeline / lint (push) Canceled after 2s
Promotion record: (unknown)
2026-10-10 17:08:10 +01:00
Nick b2ac8c85e3 feat(verification_layer): strangler exit #3 — demo retired to tests, module is pure adapter
CI Pipeline / documentation (push) Canceled after 0s
CI Pipeline / type-check (push) Canceled after 0s
CI Pipeline / gitea-offline (push) Canceled after 0s
CI Pipeline / required-checks (push) Canceled after 0s
CI Pipeline / CI Pipeline / notify-event-bridge (push) Canceled after 0s
CI Pipeline / rust-surface (push) Canceled after 8s
CI Pipeline / go-surface (push) Canceled after 8s
CI Pipeline / best-practices (push) Canceled after 8s
Auto-version and Release / release (push) Canceled after 16s
CI Pipeline / lint (push) Canceled after 8s
CI Pipeline / canary (push) Canceled after 9s
CI Pipeline / unit-tests (push) Canceled after 9s
deploy / deploy (push) Canceled after 11s
The module was ALREADY fully delegated (all verify_* through _rust_verify,
parity 33/33, shims green) — the exit removes the last Python-owned logic:
the 41-line inline test_verification demo + __main__ CLI, now a regression
test (tests/test_verification_layer_demo.py). What remains (136 lines) is
the adapter: VerificationResult dataclass, _rust_verify dispatch, PLUGIN,
handle_hook. Earning evidence: 12 regression + ruff clean.
2026-10-10 17:07:58 +01:00
Nick 2a2d144a03 chore: record capability_fit strangler exit
Auto-version and Release / release (push) Successful in 18s
CI Pipeline / best-practices (push) Successful in 10s
CI Pipeline / documentation (push) Successful in 2s
CI Pipeline / gitea-offline (push) Successful in 16s
CI Pipeline / type-check (push) Successful in 51s
CI Pipeline / lint (push) Failing after 1m19s
CI Pipeline / canary (push) Successful in 2m50s
CI Pipeline / go-surface (push) Successful in 3m8s
CI Pipeline / rust-surface (push) Successful in 5m50s
CI Pipeline / required-checks (push) Canceled after 0s
CI Pipeline / CI Pipeline / notify-event-bridge (push) Canceled after 0s
deploy / deploy (push) Canceled after 8m20s
CI Pipeline / unit-tests (push) Canceled after 8m21s
2026-10-10 16:59:33 +01:00
conductor ec232bb7f1 chore(release): auto-bump version to 0.166.0 — earned by # (minor: converged release (push-to-master bump))
Auto-version and Release / release (push) Canceled after 0s
CI Pipeline / lint (push) Canceled after 0s
CI Pipeline / unit-tests (push) Canceled after 0s
CI Pipeline / go-surface (push) Canceled after 0s
CI Pipeline / rust-surface (push) Canceled after 0s
CI Pipeline / canary (push) Canceled after 0s
CI Pipeline / best-practices (push) Canceled after 0s
CI Pipeline / documentation (push) Canceled after 0s
CI Pipeline / type-check (push) Canceled after 0s
CI Pipeline / gitea-offline (push) Canceled after 0s
CI Pipeline / required-checks (push) Canceled after 0s
CI Pipeline / CI Pipeline / notify-event-bridge (push) Canceled after 0s
deploy / deploy (push) Canceled after 0s
Promotion record: (unknown)
2026-10-10 16:59:30 +01:00
Nick 99698d167a feat(capability_fit): strangler exit #2 — _py_evaluate_fit retired, Rust authoritative
CI Pipeline / go-surface (push) Canceled after 0s
CI Pipeline / rust-surface (push) Canceled after 0s
CI Pipeline / canary (push) Canceled after 0s
CI Pipeline / best-practices (push) Canceled after 0s
CI Pipeline / documentation (push) Canceled after 0s
CI Pipeline / type-check (push) Canceled after 0s
CI Pipeline / gitea-offline (push) Canceled after 0s
CI Pipeline / required-checks (push) Canceled after 0s
CI Pipeline / CI Pipeline / notify-event-bridge (push) Canceled after 0s
CI Pipeline / lint (push) Canceled after 3s
Auto-version and Release / release (push) Canceled after 15s
deploy / deploy (push) Canceled after 21s
CI Pipeline / unit-tests (push) Canceled after 14s
50 lines of duplicated fit logic deleted. The _py_evaluate_fit stub now
delegates to cs_evaluate_fit and RAISES if the kernel is absent.
Earning evidence: frozen_evaluate_fit.json (18 rows from the live oracle on
its last day, incl. the canary's own battery); canary 24/24 vs frozen;
test_capability_fit + test_construction_decision (live consumer at :679) +
shims 85 passed. construction_decision keeps working — verified, not assumed.
2026-10-10 16:59:16 +01:00
conductor 6828f53475 chore(release): auto-bump version to 0.165.0 — earned by # (minor: converged release (push-to-master bump))
deploy / deploy (push) Skipped
CI Pipeline / best-practices (push) Successful in 8s
CI Pipeline / documentation (push) Successful in 8s
CI Pipeline / gitea-offline (push) Successful in 19s
Auto-version and Release / release (push) Successful in 20s
CI Pipeline / type-check (push) Successful in 49s
CI Pipeline / lint (push) Failing after 1m18s
CI Pipeline / canary (push) Successful in 2m51s
CI Pipeline / go-surface (push) Successful in 3m7s
CI Pipeline / required-checks (push) Canceled after 0s
CI Pipeline / CI Pipeline / notify-event-bridge (push) Canceled after 0s
CI Pipeline / rust-surface (push) Canceled after 4m5s
CI Pipeline / unit-tests (push) Canceled after 4m12s
Promotion record: (unknown)
2026-10-10 16:55:09 +01:00
Nick 28538cd379 chore: record token_optimizer strangler exit in retirement machinery
CI Pipeline / best-practices (push) Canceled after 0s
CI Pipeline / documentation (push) Canceled after 0s
CI Pipeline / type-check (push) Canceled after 0s
CI Pipeline / gitea-offline (push) Canceled after 0s
CI Pipeline / required-checks (push) Canceled after 0s
CI Pipeline / CI Pipeline / notify-event-bridge (push) Canceled after 0s
CI Pipeline / rust-surface (push) Canceled after 21s
CI Pipeline / go-surface (push) Canceled after 21s
CI Pipeline / unit-tests (push) Canceled after 21s
CI Pipeline / canary (push) Canceled after 21s
CI Pipeline / lint (push) Canceled after 24s
deploy / deploy (push) Canceled after 30s
Auto-version and Release / release (push) Canceled after 25s
2026-10-10 16:54:41 +01:00
Nick 532fe649bf feat(token_optimizer): strangler exit — Python oracle retired, Rust authoritative
CI Pipeline / best-practices (push) Successful in 7s
CI Pipeline / documentation (push) Successful in 7s
CI Pipeline / required-checks (push) Canceled after 0s
CI Pipeline / CI Pipeline / notify-event-bridge (push) Canceled after 0s
deploy / deploy (push) Canceled after 0s
CI Pipeline / go-surface (push) Canceled after 11s
CI Pipeline / gitea-offline (push) Canceled after 4s
CI Pipeline / rust-surface (push) Canceled after 13s
CI Pipeline / type-check (push) Canceled after 6s
Auto-version and Release / release (push) Canceled after 15s
CI Pipeline / lint (push) Canceled after 16s
CI Pipeline / unit-tests (push) Canceled after 16s
CI Pipeline / canary (push) Canceled after 15s
First EARNED deletion (Nick singular-codebase law): the _py_estimate_tokens /
_py_compress_context bodies (duplicated logic, 625+551 lines across the seam)
are deleted. What remains in Python is the reactive adapter (cache, persona
loading, status, TUI surface) + delegation-only stubs that RAISE if the
kernel is absent (no silent second implementation).

Earning evidence: frozen_oracle.json (8 estimate + 14 compress rows generated
from the live Python on its last day); canary asserts Rust vs frozen (26/26);
40 shims + 78 regression slice green; ruff clean; clippy 0 errors.
Dichotomy verdict: RUST kernel, GO/Python reactive adapter.
2026-10-10 16:54:28 +01:00
conductor 81df6f44b1 chore(release): auto-bump version to 0.164.1 — earned by # (patch: converged release (push-to-master bump))
deploy / deploy (push) Skipped
Auto-version and Release / release (push) Successful in 13s
CI Pipeline / best-practices (push) Successful in 9s
CI Pipeline / documentation (push) Successful in 5s
CI Pipeline / gitea-offline (push) Successful in 19s
CI Pipeline / type-check (push) Successful in 47s
CI Pipeline / lint (push) Successful in 1m15s
CI Pipeline / canary (push) Successful in 2m46s
CI Pipeline / go-surface (push) Successful in 3m5s
CI Pipeline / rust-surface (push) Successful in 5m41s
CI Pipeline / unit-tests (push) Successful in 15m38s
CI Pipeline / required-checks (push) Failing after 0s
CI Pipeline / CI Pipeline / notify-event-bridge (push) Failing after 4s
Promotion record: (unknown)
2026-10-10 15:54:52 +01:00
Nick 76e39615dc fix(ci): AGENTS digest sync + shared ruff resolver — self-inflicted governance-commit failures
CI Pipeline / best-practices (push) Successful in 7s
CI Pipeline / documentation (push) Successful in 7s
CI Pipeline / required-checks (push) Canceled after 0s
CI Pipeline / CI Pipeline / notify-event-bridge (push) Canceled after 0s
deploy / deploy (push) Canceled after 0s
Auto-version and Release / release (push) Canceled after 15s
CI Pipeline / go-surface (push) Canceled after 14s
CI Pipeline / lint (push) Canceled after 16s
CI Pipeline / unit-tests (push) Canceled after 16s
CI Pipeline / canary (push) Canceled after 15s
CI Pipeline / type-check (push) Canceled after 11s
CI Pipeline / gitea-offline (push) Canceled after 11s
CI Pipeline / rust-surface (push) Canceled after 20s
The system caught its own author: (1) adding the dichotomy henxel made the
AGENTS.md digest stale (henxels sync + commit); (2) the ratchet-bites test
referenced bare 'ruff' with no resolver — NameError on CI where ruff lives
only in .ci-venv. Shared _resolve_ruff() helper (interpreter env first,
PATH fallback, FileNotFoundError with install hint). 5/5 contract tests.
2026-10-10 15:54:37 +01:00
19 changed files with 588 additions and 223 deletions

No files matched your search

+1
View File
@@ -36,6 +36,7 @@ Only use `git commit --no-verify` in a genuine emergency: it bypasses the hooks
- Production failure fixtures are a governed surface — the registry and its README exist (in ./tests/fixtures/production)
- Fixture payloads and the manifest travel together — tamper-evidence needs both
- The fixture manifest and its generated regression tests travel together
- The dichotomy is enforced at the commit boundary — every src/rune module lands in its measured side, dead oracles and wrong-language kernels fail with the correct implementation as the instruction (in ./src/rune)
### Behaviours
+1 -1
View File
@@ -1,6 +1,6 @@
# Rune
**Current release: v0.164.0**
**Current release: v0.167.0**
**Rune is a persistent personal agent designed to accumulate experience, develop reusable competence, and remain recognisably the same agent even when its underlying foundation model changes.**
+1 -1
View File
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "rune"
version = "0.164.0"
version = "0.167.0"
description = "Rune — a stateful coding assistant with persistent memory, orchestration, and TUI"
requires-python = ">=3.10"
+1 -1
View File
@@ -6,7 +6,7 @@ This is the main entry point for the Rune program.
import json
from pathlib import Path
__version__ = "0.164.0"
__version__ = "0.167.0"
# One build identity (handoff 2026-09-10 §4): the semantic version above is
# the repo-level truth (auto-bumped at merge); the DEPLOYED revision (exact
+1 -1
View File
@@ -233,7 +233,7 @@ def main() -> int:
)
check(
"Rune minor version advertises provisioning and restore verification",
'__version__ = "0.164.0"' in rune_version,
'__version__ = "0.167.0"' in rune_version,
failures,
)
# #169 policy update: auto-bump on merge is sanctioned (Nick directive:
+8 -49
View File
@@ -240,55 +240,14 @@ def evaluate_fit(req: CapabilityRequirement, candidate: dict) -> dict:
def _py_evaluate_fit(req: CapabilityRequirement, candidate: dict) -> dict:
"""Python core of evaluate_fit (parity oracle for the Rust core)."""
missing_contracts = sorted(set(req.contracts) - set(candidate["provides"]))
covered = len(req.contracts) - len(missing_contracts)
# health: a superseded or stale candidate cannot be reused as-is
status = candidate["status"]
unhealthy = status in {"SUPERSEDED", "STALE"} or bool(candidate.get("superseded_by"))
# maturity: DECLARED-only candidates have no usage evidence
maturity = _MATURITY_RANK.get(candidate.get("maturity", "DECLARED"), 0)
if unhealthy:
return {
"candidate": candidate["id"],
"fit": "INCOMPATIBLE",
"reason": f"candidate status {status} — not reusable as-is",
"missing_contracts": missing_contracts,
"covered": covered,
}
if req.contracts and not candidate["provides"]:
# candidate provides nothing verifiable → cannot establish fit
return {
"candidate": candidate["id"],
"fit": "UNKNOWN",
"reason": "candidate exposes no contracts to check",
"missing_contracts": missing_contracts,
"covered": 0,
}
if not missing_contracts:
fit = "EXACT"
reason = "all required contracts provided"
elif covered > 0:
fit = "PARTIAL"
reason = f"covers {covered}/{len(req.contracts)} required contracts"
else:
fit = "INCOMPATIBLE"
reason = "provides none of the required contracts"
return {
"candidate": candidate["id"],
"fit": fit,
"reason": reason,
"missing_contracts": missing_contracts,
"covered": covered,
"maturity_rank": maturity,
"consumers": candidate["consumers"],
}
# ── gap / resolution decision ──────────────────────────────────────────────
"""STRANGLER EXIT (retired 2026-10-10): authoritative implementation in
src/rust/capability_scoring (cs_evaluate_fit, parity proven against the
frozen oracle in frozen_evaluate_fit.json). Delegation-only stub; raises
if the kernel is absent (no silent second implementation)."""
core = _cs_core()
if core is None:
raise RuntimeError("capability_scoring kernel not built — run the capability_scoring build; the Python oracle was retired")
return core.evaluate_fit(req.contracts, candidate)
def _adaptation_brittle(doc: dict, candidate_id: str, missing_contracts: list[str]) -> tuple[bool, str]:
+2 -2
View File
@@ -8,7 +8,7 @@ mode system, subject header, shared memory and identity.
This is not an interface. This is how I see, speak, and interact with the world.
Version: v0.164.0
Version: v0.167.0
Features: 41 (24 original + 17 new native commands)
Usage:
@@ -2037,7 +2037,7 @@ class RuneApp(App):
# Show version info
self.chat_channel.add_message(
"system",
f"[dim]Rune v0.164.0 | Textual TUI | {len(loaded)} native modules[/dim]",
f"[dim]Rune v0.167.0 | Textual TUI | {len(loaded)} native modules[/dim]",
)
# Auto-show night mode suggestion if evening/night hours
+15 -15
View File
@@ -322,24 +322,24 @@ def _tc_core():
def _py_estimate_tokens(text: str) -> int:
"""Estimate token count (rough: 1 token ≈ 4 chars) — parity oracle."""
return len(text) // 4
"""STRANGLER EXIT (retired 2026-10-10): the authoritative implementation
lives in src/rust/token_counting (tc_estimate_tokens, parity proven 26/26
against the frozen oracle in frozen_oracle.json). This stub exists ONLY so
old imports don't crash; it delegates to the kernel and raises if the
kernel is absent (no silent second implementation)."""
core = _tc_core()
if core is None:
raise RuntimeError("token_counting kernel not built — run the token_counting build; the Python oracle was retired")
return core.estimate_tokens(text)
def _py_compress_context(context: str) -> str:
"""Compress context to reduce tokens — parity oracle."""
# Remove multiple newlines
compressed = re.sub(r"\n{3,}", "\n\n", context)
# Remove redundant spaces
compressed = re.sub(r" {2,}", " ", compressed)
# Shorten common patterns
compressed = compressed.replace("User:", "U:")
compressed = compressed.replace("Assistant:", "A:")
compressed = compressed.replace("System:", "S:")
return compressed.strip()
"""STRANGLER EXIT (retired 2026-10-10): authoritative implementation in
src/rust/token_counting (tc_compress_context). Same delegation-only rule."""
core = _tc_core()
if core is None:
raise RuntimeError("token_counting kernel not built — run the token_counting build; the Python oracle was retired")
return core.compress_context(context)
-54
View File
@@ -116,60 +116,6 @@ def verify(result: dict, verifier_type: str) -> VerificationResult:
return _rust_verify(result, verifier_type)
def test_verification():
"""Test the verification layer."""
print("Testing Verification Layer...")
# Test exit code verification
result = {"exit_code": 0}
vr = verify(result, "exit_code")
print(f"Exit code 0: passed={vr.passed}")
assert vr.passed
result = {"exit_code": 1}
vr = verify(result, "exit_code")
print(f"Exit code 1: passed={vr.passed}")
assert not vr.passed
# Test unit test verification
result = {"tests_passed": 10, "tests_failed": 0, "tests_total": 10}
vr = verify(result, "unit_test")
print(f"All tests pass: passed={vr.passed}")
assert vr.passed
result = {"tests_passed": 8, "tests_failed": 2, "tests_total": 10}
vr = verify(result, "unit_test")
print(f"2 tests fail: passed={vr.passed}")
assert not vr.passed
# Test schema verification
result = {"schema_valid": True, "schema_errors": []}
vr = verify(result, "schema")
print(f"Schema valid: passed={vr.passed}")
assert vr.passed
# Test file exists verification
result = {"file_path": "/tmp/test_file"}
vr = verify(result, "file_exists")
print(f"File exists: passed={vr.passed}")
# File doesn't exist, so should fail
assert not vr.passed, "Non-existent file should fail verification"
print("✅ All tests passed!")
if __name__ == "__main__":
if len(sys.argv) > 1 and sys.argv[1] == "test":
test_verification()
elif len(sys.argv) > 3 and sys.argv[1] == "verify":
result = json.loads(sys.argv[2])
verifier_type = sys.argv[3]
vr = verify(result, verifier_type)
print(json.dumps(vr.to_dict(), indent=2))
else:
print("Usage:")
print(" verification_layer.py test — run tests")
print(" verification_layer.py verify <result_json> <verifier_type> — verify result")
def handle_hook(event, data=None):
@@ -16,6 +16,7 @@ Run: python3 src/rust/capability_scoring/canary_capability_scoring.py
from __future__ import annotations
import json
import os
import subprocess
import sys
@@ -165,15 +166,15 @@ def main() -> int:
return 1
from rune import capability_broker # noqa: E402
from rune import capability_fit # noqa: E402
from rune import capability_fit # noqa: E402 — CapabilityRequirement class only; kernel expectations frozen below
from rune import cs_loader # noqa: E402
frozen = json.loads((Path(__file__).parent / "frozen_evaluate_fit.json").read_text(encoding="utf-8"))
frozen_rows = {r["name"]: r["want"] for r in frozen["rows"]}
# ── 2. evaluate_fit parity ────────────────────────────────────────────
print("\n--- 2. evaluate_fit parity ---")
for name, contracts, candidate in fit_battery():
req = capability_fit.CapabilityRequirement("test objective",
contracts=contracts)
py = capability_fit._py_evaluate_fit(req, candidate)
py = frozen_rows[name]
rs = cs_loader.evaluate_fit(contracts, candidate)
test(f"fit: {name}", py == rs,
f"py={py!r}\n rs={rs!r}")
@@ -0,0 +1,452 @@
{
"_doc": "FROZEN ORACLE (capability_fit exit): from live _py_evaluate_fit 2026-10-10.",
"rows": [
{
"name": "exact",
"contracts": [
"a",
"b"
],
"candidate": {
"id": "c1",
"provides": [
"a",
"b",
"c"
],
"status": "LIVE",
"maturity": "WIRED",
"consumers": []
},
"want": {
"candidate": "c1",
"fit": "EXACT",
"reason": "all required contracts provided",
"missing_contracts": [],
"covered": 2,
"maturity_rank": 2,
"consumers": []
}
},
{
"name": "partial",
"contracts": [
"a",
"b",
"c"
],
"candidate": {
"id": "c2",
"provides": [
"a"
],
"status": "LIVE",
"maturity": "WIRED",
"consumers": []
},
"want": {
"candidate": "c2",
"fit": "PARTIAL",
"reason": "covers 1/3 required contracts",
"missing_contracts": [
"b",
"c"
],
"covered": 1,
"maturity_rank": 2,
"consumers": []
}
},
{
"name": "incompatible-none",
"contracts": [
"a",
"b"
],
"candidate": {
"id": "c3",
"provides": [
"x"
],
"status": "LIVE",
"maturity": "WIRED",
"consumers": []
},
"want": {
"candidate": "c3",
"fit": "INCOMPATIBLE",
"reason": "provides none of the required contracts",
"missing_contracts": [
"a",
"b"
],
"covered": 0,
"maturity_rank": 2,
"consumers": []
}
},
{
"name": "incompatible-superseded",
"contracts": [
"a"
],
"candidate": {
"id": "c4",
"provides": [
"a"
],
"status": "SUPERSEDED",
"maturity": "WIRED",
"consumers": []
},
"want": {
"candidate": "c4",
"fit": "INCOMPATIBLE",
"reason": "candidate status SUPERSEDED \u2014 not reusable as-is",
"missing_contracts": [],
"covered": 1
}
},
{
"name": "incompatible-stale",
"contracts": [
"a"
],
"candidate": {
"id": "c5",
"provides": [
"a"
],
"status": "STALE",
"maturity": "WIRED",
"consumers": []
},
"want": {
"candidate": "c5",
"fit": "INCOMPATIBLE",
"reason": "candidate status STALE \u2014 not reusable as-is",
"missing_contracts": [],
"covered": 1
}
},
{
"name": "unknown-empty",
"contracts": [
"a"
],
"candidate": {
"id": "c6",
"provides": [],
"status": "LIVE",
"maturity": "WIRED",
"consumers": []
},
"want": {
"candidate": "c6",
"fit": "UNKNOWN",
"reason": "candidate exposes no contracts to check",
"missing_contracts": [
"a"
],
"covered": 0
}
},
{
"name": "empty-req",
"contracts": [],
"candidate": {
"id": "c7",
"provides": [
"a"
],
"status": "LIVE",
"maturity": "WIRED",
"consumers": []
},
"want": {
"candidate": "c7",
"fit": "EXACT",
"reason": "all required contracts provided",
"missing_contracts": [],
"covered": 0,
"maturity_rank": 2,
"consumers": []
}
},
{
"name": "maturity-declared",
"contracts": [
"a"
],
"candidate": {
"id": "c8",
"provides": [
"a"
],
"status": "LIVE",
"maturity": "DECLARED",
"consumers": []
},
"want": {
"candidate": "c8",
"fit": "EXACT",
"reason": "all required contracts provided",
"missing_contracts": [],
"covered": 1,
"maturity_rank": 0,
"consumers": []
}
},
{
"name": "EXACT all covered",
"contracts": [
"contract:a",
"contract:b"
],
"candidate": {
"id": "cap:x",
"provides": [
"contract:a",
"contract:b"
],
"status": "CURRENT",
"maturity": "WIRED",
"consumers": [
"module:y"
]
},
"want": {
"candidate": "cap:x",
"fit": "EXACT",
"reason": "all required contracts provided",
"missing_contracts": [],
"covered": 2,
"maturity_rank": 2,
"consumers": [
"module:y"
]
}
},
{
"name": "PARTIAL some covered",
"contracts": [
"contract:a",
"contract:b",
"contract:c"
],
"candidate": {
"id": "cap:x",
"provides": [
"contract:a"
],
"status": "CURRENT",
"maturity": "DECLARED",
"consumers": []
},
"want": {
"candidate": "cap:x",
"fit": "PARTIAL",
"reason": "covers 1/3 required contracts",
"missing_contracts": [
"contract:b",
"contract:c"
],
"covered": 1,
"maturity_rank": 0,
"consumers": []
}
},
{
"name": "INCOMPATIBLE none covered",
"contracts": [
"contract:a"
],
"candidate": {
"id": "cap:x",
"provides": [
"contract:zzz"
],
"status": "CURRENT",
"maturity": "PRESENT",
"consumers": []
},
"want": {
"candidate": "cap:x",
"fit": "INCOMPATIBLE",
"reason": "provides none of the required contracts",
"missing_contracts": [
"contract:a"
],
"covered": 0,
"maturity_rank": 1,
"consumers": []
}
},
{
"name": "UNKNOWN no provides",
"contracts": [
"contract:a"
],
"candidate": {
"id": "cap:x",
"provides": [],
"status": "CURRENT",
"maturity": "DECLARED",
"consumers": []
},
"want": {
"candidate": "cap:x",
"fit": "UNKNOWN",
"reason": "candidate exposes no contracts to check",
"missing_contracts": [
"contract:a"
],
"covered": 0
}
},
{
"name": "unhealthy SUPERSEDED",
"contracts": [
"contract:a"
],
"candidate": {
"id": "cap:x",
"provides": [
"contract:a"
],
"status": "SUPERSEDED",
"maturity": "WIRED",
"consumers": []
},
"want": {
"candidate": "cap:x",
"fit": "INCOMPATIBLE",
"reason": "candidate status SUPERSEDED \u2014 not reusable as-is",
"missing_contracts": [],
"covered": 1
}
},
{
"name": "unhealthy STALE",
"contracts": [
"contract:a"
],
"candidate": {
"id": "cap:x",
"provides": [
"contract:a"
],
"status": "STALE",
"maturity": "WIRED",
"consumers": []
},
"want": {
"candidate": "cap:x",
"fit": "INCOMPATIBLE",
"reason": "candidate status STALE \u2014 not reusable as-is",
"missing_contracts": [],
"covered": 1
}
},
{
"name": "unhealthy superseded_by set",
"contracts": [
"contract:a"
],
"candidate": {
"id": "cap:x",
"provides": [
"contract:a"
],
"status": "CURRENT",
"superseded_by": "cap:newer",
"maturity": "WIRED",
"consumers": []
},
"want": {
"candidate": "cap:x",
"fit": "INCOMPATIBLE",
"reason": "candidate status CURRENT \u2014 not reusable as-is",
"missing_contracts": [],
"covered": 1
}
},
{
"name": "no contracts required -> EXACT",
"contracts": [],
"candidate": {
"id": "cap:x",
"provides": [
"contract:a"
],
"status": "CURRENT",
"maturity": "LIVE_PROVEN",
"consumers": [
"a",
"b"
]
},
"want": {
"candidate": "cap:x",
"fit": "EXACT",
"reason": "all required contracts provided",
"missing_contracts": [],
"covered": 0,
"maturity_rank": 5,
"consumers": [
"a",
"b"
]
}
},
{
"name": "unknown maturity ranks zero",
"contracts": [
"contract:a"
],
"candidate": {
"id": "cap:x",
"provides": [
"contract:a"
],
"status": "CURRENT",
"maturity": "WEIRD",
"consumers": []
},
"want": {
"candidate": "cap:x",
"fit": "EXACT",
"reason": "all required contracts provided",
"missing_contracts": [],
"covered": 1,
"maturity_rank": 0,
"consumers": []
}
},
{
"name": "duplicate provides dedup via set math",
"contracts": [
"contract:a"
],
"candidate": {
"id": "cap:x",
"provides": [
"contract:a",
"contract:a"
],
"status": "CURRENT",
"maturity": "EXERCISED",
"consumers": []
},
"want": {
"candidate": "cap:x",
"fit": "EXACT",
"reason": "all required contracts provided",
"missing_contracts": [],
"covered": 1,
"maturity_rank": 4,
"consumers": []
}
}
]
}
@@ -16,6 +16,7 @@ Run: python3 src/rust/token_counting/canary_token_counting.py
from __future__ import annotations
import json
import os
import subprocess
import sys
@@ -107,19 +108,20 @@ def main() -> int:
return 1
from rune import tc_loader # noqa: E402
from rune import token_optimizer # noqa: E402
from rune import token_optimizer # noqa: E402 — class surface only (delegation probe); kernel expectations frozen below
frozen = json.loads((Path(__file__).parent / "frozen_oracle.json").read_text(encoding="utf-8"))
# ── 2. estimate_tokens parity ─────────────────────────────────────────
print("\n--- 2. estimate_tokens parity ---")
for name, text in token_cases():
py = token_optimizer._py_estimate_tokens(text)
py = frozen["estimate"][name]
rs = tc_loader.estimate_tokens(text)
test(f"tokens: {name}", py == rs, f"py={py!r} rs={rs!r}")
# ── 3. _compress_context parity ───────────────────────────────────────
print("\n--- 3. _compress_context parity ---")
for name, text in compress_cases():
py = token_optimizer._py_compress_context(text)
py = frozen["compress"][name]
rs = tc_loader.compress_context(text)
test(f"compress: {name}", py == rs, f"py={py!r} rs={rs!r}")
@@ -128,11 +130,11 @@ def main() -> int:
opt = token_optimizer.TokenOptimizer(storage_path="/tmp/tc-canary-store.json")
test("public estimate_tokens matches core",
opt.estimate_tokens("héllo wörld — ünïcode")
== token_optimizer._py_estimate_tokens("héllo wörld — ünïcode"),
== frozen["extra_estimate"]["héllo wörld — ünïcode"],
"mismatch")
test("public _compress_context matches core",
opt._compress_context("User: a\n\n\n\nAssistant: b")
== token_optimizer._py_compress_context("User: a\n\n\n\nAssistant: b"),
== frozen["extra_compress"]["User: a\n\n\n\nAssistant: b"],
"mismatch")
print(f"\n{'=' * 47}")
@@ -0,0 +1,35 @@
{
"_doc": "FROZEN ORACLE (token_optimizer strangler exit): expectations generated from the live Python _py_* on 2026-10-10, the last day they existed. The canary asserts Rust against these, not against imports — parity stays provable after deletion.",
"estimate": {
"empty": 0,
"three chars floor zero": 0,
"exactly four": 1,
"five floors one": 1,
"long ascii": 250,
"unicode code points not bytes": 5,
"emoji counts as code point(s)": 4,
"newlines counted": 2
},
"compress": {
"empty": "",
"no-op plain": "simple context",
"triple newline collapses": "a\n\nb",
"many newlines to two": "a\n\nb",
"double newline preserved": "a\n\nb",
"space run collapses": "a b",
"double space collapses": "a b",
"single space preserved": "a b",
"tab not a space": "a\t\tb",
"prefix shortening all three": "U: hi\nA: yo\nS: note",
"prefix mid-word untouched": "Abuser: stays",
"strip trailing": "padded",
"combined chaos": "U: a\n\nA: b c",
"unicode preserved": "héllo wörld\n\n— ünïcode"
},
"extra_estimate": {
"héllo wörld — ünïcode": 5
},
"extra_compress": {
"User: a\n\n\n\nAssistant: b": "U: a\n\nA: b"
}
}
+17 -1
View File
@@ -1 +1,17 @@
{"_doc": "Strangler-exit record: Python modules whose kernels landed and whose Python source was DELETED (Wave 5 retirement sweep, tranche plan §Wave 5: parity proven + CI green + deployed one cycle). A retired module reappearing as Python fails the dichotomy henxel gate (D4).", "retired": []}
{
"_doc": "Strangler-exit record: Python modules whose kernels landed and whose Python source was DELETED (Wave 5 retirement sweep, tranche plan \u00a7Wave 5: parity proven + CI green + deployed one cycle). A retired module reappearing as Python fails the dichotomy henxel gate (D4).",
"retired": [
{
"module": "token_optimizer",
"commit": "532fe649",
"evidence": "frozen_oracle.json 22 rows + canary 26/26 + 40 shims + 78 slice + clippy 0",
"date": "2026-10-10"
},
{
"module": "capability_fit",
"commit": "99698d16",
"evidence": "frozen_evaluate_fit.json 18 rows + canary 24/24 + 85 regression incl. live consumer",
"date": "2026-10-10"
}
]
}
+2 -78
View File
@@ -1,82 +1,6 @@
{
"_doc": "RETIREMENT RATCHET (strangler exit, Wave 5): Python modules whose kernels have landed AND delegate \u2014 the deletion debt. The list ONLY SHRINKS: each entry retires when parity proven + CI green + deployed one cycle (the tranche plan's strangler-exit law). Floor never increases; a module reappearing here after retirement fails the dichotomy henxel gate (D3).",
"_doc": "RETIREMENT RATCHET (strangler exit, Wave 5): Python modules whose kernels have landed AND delegate \u2014 the deletion debt. The list ONLY SHRINKS: each entry retires when parity proven + CI green + deployed one cycle (the tranche plan's strangler-exit law). Floor never increases; a module reappearing here after retirement fails the dichotomy henxel gate (D3). CANDIDACY LAW (Nick 2026-10-10, tightened): a module earns deletion candidacy only when (a) the ENTIRE consumed Python surface has kernel counterparts, (b) the kernel exposes FFI externs or a live loader seam actually called by the adapter, (c) canaries prove the kernel matches AND beats the Python capabilities, (d) the tranche-plan exit law holds (parity + CI green + deployed one cycle). Partial ports like claim_audit (1 of 12 fns, no FFI externs) are NOT candidates \u2014 they are PARITY DEBT.",
"updated": "2026-10-10",
"py_lines_of_debt": 7496,
"candidates": [
{
"module": "spine",
"side": "RUST",
"py_lines": 1204
},
{
"module": "construction_decision",
"side": "RUST",
"py_lines": 1014
},
{
"module": "capability_broker",
"side": "RUST",
"py_lines": 908
},
{
"module": "abstraction",
"side": "GO",
"py_lines": 656
},
{
"module": "drift_core",
"side": "RUST",
"py_lines": 517
},
{
"module": "claim_audit",
"side": "RUST",
"py_lines": 484
},
{
"module": "witness",
"side": "GO",
"py_lines": 475
},
{
"module": "capability_fit",
"side": "RUST",
"py_lines": 455
},
{
"module": "token_optimizer",
"side": "RUST",
"py_lines": 410
},
{
"module": "behavior",
"side": "RUST",
"py_lines": 408
},
{
"module": "pins",
"side": "RUST",
"py_lines": 284
},
{
"module": "audit_ledger",
"side": "RUST",
"py_lines": 212
},
{
"module": "verification_layer",
"side": "RUST",
"py_lines": 190
},
{
"module": "behaviour_ledger",
"side": "RUST",
"py_lines": 174
},
{
"module": "spine_loader",
"side": "RUST",
"py_lines": 105
}
]
"candidates": []
}
+2 -2
View File
@@ -11,6 +11,6 @@
"oracle-first truth battery (Python truth generated FIRST)",
"llvm-cov branch coverage + clippy 0"
],
"parity_means": "Parity claimed via oracle-first truth battery + HARD CI gate; deletion earned under the retirement law (parity + CI green + deployed one cycle).",
"status": "ported"
"parity_means": "Strangler exit 2026-10-10 (99698d16): _py_evaluate_fit deleted, Rust authoritative, frozen oracle + 24/24 canary.",
"status": "retired"
}
+2 -2
View File
@@ -11,6 +11,6 @@
"oracle-first truth battery (Python truth generated FIRST)",
"llvm-cov branch coverage + clippy 0"
],
"parity_means": "Parity claimed via oracle-first truth battery + HARD CI gate; deletion earned under the retirement law (parity + CI green + deployed one cycle).",
"status": "ported"
"parity_means": "Strangler exit 2026-10-10 (532fe649): Python oracle deleted, Rust authoritative, frozen oracle + 26/26 canary.",
"status": "retired"
}
+15 -7
View File
@@ -38,17 +38,25 @@ def test_lint_baseline_file_exists_with_rule_counts():
assert isinstance(count, int) and count >= 0, f"{rule} count must be a non-negative int, got {count!r}"
def _resolve_ruff() -> Path:
"""Ruff binary: interpreter's own env first (CI: .ci-venv, local: .venv),
then PATH. Raises FileNotFoundError with the install hint."""
cand = Path(sys.executable).parent / "ruff"
if cand.exists():
return cand
import shutil
discovered = shutil.which("ruff")
if discovered:
return Path(discovered) # local envs: ruff on PATH (~/.local/bin)
raise FileNotFoundError("ruff not found — pip install ruff (CI: .ci-venv)")
def test_lint_baseline_matches_current_tree_counts():
"""Honest-ledger check: the committed baseline equals the live ruff counts.
Forces the baseline to travel with every fix — the ledger can only shrink.
"""
ruff = Path(sys.executable).parent / "ruff" # interpreter's own env (CI: .ci-venv, local: .venv)
if not ruff.exists():
import shutil
discovered = shutil.which("ruff")
if discovered:
ruff = Path(discovered) # local envs: ruff on PATH (~/.local/bin)
ruff = _resolve_ruff()
result = subprocess.run(
[str(ruff), "check", "--select", ",".join(LINT_SELECT), "--statistics", "src/", "shared/", "scripts/"],
capture_output=True,
@@ -81,7 +89,7 @@ def test_ratchet_bites_on_increase(tmp_path):
baseline.write_text(json.dumps(data))
try:
import shutil as _sh
ruff_dir = str(Path(_sh.which("ruff") or str(ruff)).parent)
ruff_dir = str(Path(_sh.which("ruff") or str(_resolve_ruff())).parent)
result = subprocess.run(
[sys.executable, "scripts/lint_ratchet.py"],
capture_output=True,
+21
View File
@@ -0,0 +1,21 @@
"""Retired inline demo (verification_layer.test_verification, strangler exit #3)."""
from __future__ import annotations
import os
import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "src"))
def test_verification_layer_demo_regression():
"""The inline demo, retired into a regression test."""
from rune import verification_layer as vl
vr = vl.verify({"exit_code": 0}, "exit_code")
assert vr.passed
vr = vl.verify({"exit_code": 1}, "exit_code")
assert not vr.passed
vr = vl.verify({"tests_passed": 10, "tests_failed": 0, "tests_total": 10}, "unit_test")
assert vr.passed
vr = vl.verify({}, "nonexistent_verifier")
assert not vr.passed and vr.escalation_reason == "unknown_verifier"