Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e1d5ace328 | ||
|
|
44225afa88 | ||
|
|
0f5a5f927d | ||
|
|
ca986124a5 | ||
|
|
cfbe5b34cc | ||
|
|
0a7d0b7386 | ||
|
|
3b67c63482 | ||
|
|
d9fb666e6b | ||
|
|
fd71815026 | ||
|
|
ab1ce8661b | ||
|
|
265e558d3f | ||
|
|
20f2baf7b4 | ||
|
|
b2ac8c85e3 | ||
|
|
2a2d144a03 | ||
|
|
ec232bb7f1 | ||
|
|
99698d167a | ||
|
|
6828f53475 | ||
|
|
28538cd379 | ||
|
|
532fe649bf | ||
|
|
81df6f44b1 | ||
|
|
76e39615dc | ||
|
|
46b26fa993 | ||
|
|
c6b9091f39 | ||
|
|
388c6e3076 | ||
|
|
5ccd26f8f1 | ||
|
|
775591d76c | ||
|
|
5c134537f7 | ||
|
|
a50466744f | ||
|
|
b8745ab455 | ||
|
|
04b1af323d | ||
|
|
5347890ef5 | ||
|
|
6f16487203 | ||
|
|
e0bf43ed8b | ||
|
|
1a341b7de3 | ||
|
|
f48d46dc7a | ||
|
|
3150ea124e | ||
|
|
082d753bed | ||
|
|
0666c042fe | ||
|
|
4752db026d | ||
|
|
2c19cd0793 | ||
|
|
2ec9091229 | ||
|
|
956802dc39 | ||
|
|
6ad7a9efce | ||
|
|
b6af845c89 | ||
|
|
96e27fdaa2 | ||
|
|
86ac65b501 | ||
|
|
b27bd271d8 | ||
|
|
89b3cf7b25 | ||
|
|
40619a3eb5 |
No files matched your search
+66
-66
@@ -199,6 +199,9 @@ jobs:
|
||||
# the tmpfs (2026-10-07: venv creation failed disk-full across
|
||||
# every job). Keep the 3 newest; drop the rest.
|
||||
cd /tmp && ls -dt rune-ci-target-* 2>/dev/null | tail -n +4 | xargs -r rm -rf
|
||||
# deploy-test cache: rust targets accumulate ~15G (every crate's
|
||||
# release dir). The staged source survives; targets rebuild.
|
||||
find /tmp/rune-deploy-test/src/rust -maxdepth 2 -name target -type d 2>/dev/null | xargs -r rm -rf
|
||||
- name: go vet + go test + go build
|
||||
run: |
|
||||
for dir in src/go/*/; do
|
||||
@@ -207,7 +210,7 @@ jobs:
|
||||
cd "$dir"
|
||||
go vet ./...
|
||||
go test ./... -v || { echo "::error::go test failed in $dir"; exit 1; }
|
||||
OUT_DIR="/tmp/go-bins"
|
||||
OUT_DIR="/tmp/go-bins-${{ gitea.run_id }}"
|
||||
mkdir -p "$OUT_DIR"
|
||||
go build -o "$OUT_DIR/go-$(basename "$dir")" .
|
||||
cd - > /dev/null
|
||||
@@ -222,130 +225,124 @@ jobs:
|
||||
run: |
|
||||
cd src/go/adaptive-router
|
||||
go test ./... -run TestParityAgainstPythonOracle -v
|
||||
- name: operator-deep evidence-kernel parity gate (HARD — #2479 batch: #30 kernels)
|
||||
run: |
|
||||
cd src/go/operator-deep && go build -o /tmp/operator-deep-${{ gitea.run_id }} . && go test -run "TestOperator30Parity|TestVerificationAndOutcomeContract|TestTaskIdentityParity|TestWindowParity" -v
|
||||
- name: curator-core candidate-decay parity gate (HARD — #2479 batch: ledger decay + journal render + cosine)
|
||||
run: |
|
||||
cd src/go/curator-core && go build -o /tmp/curator-core .
|
||||
/tmp/curator-core replay truth_candidate_decay.json
|
||||
cd src/go/curator-core && go test -run TestCandidateDecayParity -v
|
||||
cd src/go/curator-core && go build -o /tmp/curator-core-${{ gitea.run_id }} . && /tmp/curator-core-${{ gitea.run_id }} replay truth_candidate_decay.json && go test -run TestCandidateDecayParity -v
|
||||
- name: cron-engine parity gate (HARD — #2479 batches 1+126: parser + lifecycle)
|
||||
run: |
|
||||
cd src/go/cron-engine && go build -o /tmp/cron-engine .
|
||||
/tmp/cron-engine replay truth.json
|
||||
cd src/go/cron-engine && go test -run TestLifecycleParity -v
|
||||
cd src/go/cron-engine && go build -o /tmp/cron-engine-${{ gitea.run_id }} . && /tmp/cron-engine-${{ gitea.run_id }} replay truth.json && go test -run TestLifecycleParity -v
|
||||
- name: goal-engine parity gate (HARD — #2479 batches 2+129: verifier + lifecycle)
|
||||
run: |
|
||||
cd src/go/goal-engine && go build -o /tmp/goal-engine .
|
||||
/tmp/goal-engine replay truth.json
|
||||
cd src/go/goal-engine && go test -run TestLifecycleParity -v
|
||||
cd src/go/goal-engine && go build -o /tmp/goal-engine-${{ gitea.run_id }} . && /tmp/goal-engine-${{ gitea.run_id }} replay truth.json && go test -run TestLifecycleParity -v
|
||||
- name: provider-budget parity gate (HARD — #2479 batches 3+146: budget + ties/headers/rpm)
|
||||
run: |
|
||||
cd src/go/provider-budget && go build -o /tmp/provider-budget .
|
||||
/tmp/provider-budget replay truth.json
|
||||
cd src/go/provider-budget && go build -o /tmp/provider-budget-${{ gitea.run_id }} .
|
||||
/tmp/provider-budget-${{ gitea.run_id }} replay truth.json
|
||||
- name: event-wait parity gate (HARD — #2479 batch 4, oracle replay)
|
||||
run: |
|
||||
cd src/go/event-wait && go build -o /tmp/event-wait .
|
||||
/tmp/event-wait replay truth.json
|
||||
cd src/go/event-wait && go build -o /tmp/event-wait-${{ gitea.run_id }} .
|
||||
/tmp/event-wait-${{ gitea.run_id }} replay truth.json
|
||||
- name: memory-consolidation parity gate (HARD — #2479 batches 5+131: scoring + constructors)
|
||||
run: |
|
||||
cd src/go/memory-consolidation && go build -o /tmp/memory-consolidation .
|
||||
/tmp/memory-consolidation replay truth.json
|
||||
cd src/go/memory-consolidation && go test -run TestConstructorParity -v
|
||||
cd src/go/memory-consolidation && go build -o /tmp/memory-consolidation-${{ gitea.run_id }} . && /tmp/memory-consolidation-${{ gitea.run_id }} replay truth.json && go test -run TestConstructorParity -v
|
||||
- name: release-notes parity gate (HARD — #2479 batches 6+135: render + parser edges)
|
||||
run: |
|
||||
cd src/go/release-notes && go build -o /tmp/release-notes .
|
||||
/tmp/release-notes replay truth.json
|
||||
cd src/go/release-notes && go build -o /tmp/release-notes-${{ gitea.run_id }} .
|
||||
/tmp/release-notes-${{ gitea.run_id }} replay truth.json
|
||||
- name: model-profiles parity gate (HARD — #2479 batches 7+145: detection + edge pins)
|
||||
run: |
|
||||
cd src/go/model-profiles && go build -o /tmp/model-profiles .
|
||||
/tmp/model-profiles replay truth.json
|
||||
cd src/go/model-profiles && go build -o /tmp/model-profiles-${{ gitea.run_id }} .
|
||||
/tmp/model-profiles-${{ gitea.run_id }} replay truth.json
|
||||
- name: model-routing parity gate (HARD — #2479 batches 8+136: rank + cost-override)
|
||||
run: |
|
||||
cd src/go/model-routing && go build -o /tmp/model-routing .
|
||||
/tmp/model-routing replay truth.json
|
||||
cd src/go/model-routing && go build -o /tmp/model-routing-${{ gitea.run_id }} .
|
||||
/tmp/model-routing-${{ gitea.run_id }} replay truth.json
|
||||
- name: work-manager parity gate (HARD — #2479 batches 9+137+156: batching + lifecycle)
|
||||
run: |
|
||||
cd src/go/work-manager && go build -o /tmp/work-manager .
|
||||
/tmp/work-manager replay truth.json
|
||||
cd src/go/work-manager && go test -run TestLifecycleParity -v
|
||||
cd src/go/work-manager && go build -o /tmp/work-manager-${{ gitea.run_id }} . && /tmp/work-manager-${{ gitea.run_id }} replay truth.json && go test -run TestLifecycleParity -v
|
||||
- name: core-server parity gate (HARD — #2479 batches 10+138: envelopes + extraction/identity)
|
||||
run: |
|
||||
cd src/go/core-server && go build -o /tmp/core-server .
|
||||
/tmp/core-server replay truth.json
|
||||
cd src/go/core-server && go build -o /tmp/core-server-${{ gitea.run_id }} .
|
||||
/tmp/core-server-${{ gitea.run_id }} replay truth.json
|
||||
- name: builder-bridge parity + improvement gate (HARD — #2479 batches 11+139: render/LRU + TTL/refresh/key)
|
||||
run: |
|
||||
cd src/go/builder-bridge && go build -o /tmp/builder-bridge .
|
||||
/tmp/builder-bridge replay truth.json
|
||||
cd src/go/builder-bridge && go build -o /tmp/builder-bridge-${{ gitea.run_id }} .
|
||||
/tmp/builder-bridge-${{ gitea.run_id }} replay truth.json
|
||||
- name: voicebox parity + improvement gate (HARD — #2479 batches 12+140: hook + full manifest)
|
||||
run: |
|
||||
cd src/go/voicebox && go build -o /tmp/voicebox .
|
||||
/tmp/voicebox replay truth.json
|
||||
cd src/go/voicebox && go build -o /tmp/voicebox-${{ gitea.run_id }} .
|
||||
/tmp/voicebox-${{ gitea.run_id }} replay truth.json
|
||||
- name: voice-sync parity gate (HARD — #2479 batches 35+143: extract + unicode/generate)
|
||||
run: |
|
||||
cd src/go/voice-sync && go build -o /tmp/voice-sync .
|
||||
/tmp/voice-sync replay truth.json
|
||||
cd src/go/voice-sync && go build -o /tmp/voice-sync-${{ gitea.run_id }} .
|
||||
/tmp/voice-sync-${{ gitea.run_id }} replay truth.json
|
||||
- name: progressive-escalation parity gate (HARD — #2479 batches 44+147: full truth table)
|
||||
run: |
|
||||
cd src/go/progressive-escalation && go build -o /tmp/progressive-escalation .
|
||||
/tmp/progressive-escalation replay truth.json
|
||||
cd src/go/progressive-escalation && go build -o /tmp/progressive-escalation-${{ gitea.run_id }} .
|
||||
/tmp/progressive-escalation-${{ gitea.run_id }} replay truth.json
|
||||
- name: message-queue parity gate (HARD — #2479 batches 61+148: full pattern table)
|
||||
run: |
|
||||
cd src/go/message-queue && go build -o /tmp/message-queue .
|
||||
/tmp/message-queue replay truth.json
|
||||
cd src/go/message-queue && go build -o /tmp/message-queue-${{ gitea.run_id }} .
|
||||
/tmp/message-queue-${{ gitea.run_id }} replay truth.json
|
||||
- name: outcome-ledger parity gate (HARD — #2479 batches 49+151: stats + live fixture)
|
||||
run: |
|
||||
cd src/go/outcome-ledger && go build -o /tmp/outcome-ledger .
|
||||
/tmp/outcome-ledger replay truth.json
|
||||
cd src/go/outcome-ledger && go build -o /tmp/outcome-ledger-${{ gitea.run_id }} .
|
||||
/tmp/outcome-ledger-${{ gitea.run_id }} replay truth.json
|
||||
- name: auto-context parity gate (HARD — #2479 batches 50+157: oracle-exact keywords)
|
||||
run: |
|
||||
cd src/go/auto-context && go build -o /tmp/auto-context .
|
||||
/tmp/auto-context replay truth.json
|
||||
cd src/go/auto-context && go build -o /tmp/auto-context-${{ gitea.run_id }} .
|
||||
/tmp/auto-context-${{ gitea.run_id }} replay truth.json
|
||||
- name: night-mode parity gate (HARD — #2479 batches 60+167: state-machine cores)
|
||||
run: |
|
||||
cd src/go/night-mode && go build -o /tmp/night-mode .
|
||||
cd src/go/night-mode && go test -run TestLifecycleParity -v
|
||||
cd src/go/night-mode && go build -o /tmp/night-mode-${{ gitea.run_id }} . && go test -run TestLifecycleParity -v
|
||||
- name: sleep-time parity gate (HARD — #2479 batches 11+168: transcript kernels)
|
||||
run: |
|
||||
cd src/go/sleep-time && go build -o /tmp/sleep-time .
|
||||
cd src/go/sleep-time && go test -run TestTranscriptKernels -v
|
||||
cd src/go/sleep-time && go build -o /tmp/sleep-time-${{ gitea.run_id }} . && go test -run TestTranscriptKernels -v
|
||||
- name: response-adapter parity gate (HARD — #2479 batches 109+170: parsers + provenance)
|
||||
run: |
|
||||
cd src/go/response-adapter && go build -o /tmp/response-adapter .
|
||||
/tmp/response-adapter replay truth.json
|
||||
cd src/go/response-adapter && go build -o /tmp/response-adapter-${{ gitea.run_id }} .
|
||||
/tmp/response-adapter-${{ gitea.run_id }} replay truth.json
|
||||
- name: standardized-providers parity gate (HARD — #2479 batches 62+171: registry + connect gate)
|
||||
run: |
|
||||
cd src/go/standardized-providers && go build -o /tmp/standardized-providers .
|
||||
/tmp/standardized-providers replay truth.json
|
||||
cd src/go/standardized-providers && go test -run TestConnectDecisionParity -v
|
||||
cd src/go/standardized-providers && go build -o /tmp/standardized-providers-${{ gitea.run_id }} . && /tmp/standardized-providers-${{ gitea.run_id }} replay truth.json && go test -run TestConnectDecisionParity -v
|
||||
- name: recall-uplift parity gate (HARD — #2479 batches 78+172: full expansion table)
|
||||
run: |
|
||||
cd src/go/recall-uplift && go build -o /tmp/recall-uplift .
|
||||
/tmp/recall-uplift replay truth.json
|
||||
cd src/go/recall-uplift && go build -o /tmp/recall-uplift-${{ gitea.run_id }} .
|
||||
/tmp/recall-uplift-${{ gitea.run_id }} replay truth.json
|
||||
- name: forge-core parity + improvement gate (HARD — #2479 batches 13+106+141: resolvers + lattice restore)
|
||||
run: |
|
||||
cd src/go/forge-core && go build -o /tmp/forge-core .
|
||||
/tmp/forge-core replay truth.json
|
||||
cd src/go/forge-core && go build -o /tmp/forge-core-${{ gitea.run_id }} .
|
||||
/tmp/forge-core-${{ gitea.run_id }} replay truth.json
|
||||
- name: forge-client parity gate (HARD — #2479 batch 133, oracle replay)
|
||||
run: |
|
||||
cd src/go/forge-client && go build -o /tmp/forge-client .
|
||||
/tmp/forge-client replay truth.json
|
||||
cd src/go/forge-client && go build -o /tmp/forge-client-${{ gitea.run_id }} .
|
||||
/tmp/forge-client-${{ gitea.run_id }} replay truth.json
|
||||
- name: elastic-cognition parity + improvement gate (HARD — #2479 batches 14+117: +budget/parse kernels)
|
||||
run: |
|
||||
cd src/go/elastic-cognition && go build -o /tmp/elastic-cognition .
|
||||
/tmp/elastic-cognition replay truth.json
|
||||
/tmp/elastic-cognition replay src/go/elastic-cognition/truth_budget_parse.json
|
||||
cd src/go/elastic-cognition && go build -o /tmp/elastic-cognition-${{ gitea.run_id }} .
|
||||
/tmp/elastic-cognition-${{ gitea.run_id }} replay truth.json
|
||||
/tmp/elastic-cognition-${{ gitea.run_id }} replay truth_budget_parse.json
|
||||
- name: auto-tasks parity + improvement gate (HARD — #2479 batches 15+144: adjacency + action/seq/gates)
|
||||
run: |
|
||||
cd src/go/auto-tasks && go build -o /tmp/auto-tasks .
|
||||
/tmp/auto-tasks replay truth.json
|
||||
cd src/go/auto-tasks && go build -o /tmp/auto-tasks-${{ gitea.run_id }} .
|
||||
/tmp/auto-tasks-${{ gitea.run_id }} replay truth.json
|
||||
- name: model-connect parity + improvement gate (HARD — #2479 batches 16+113: clean-name parser + edge top-up)
|
||||
run: |
|
||||
cd src/go/model-connect && go build -o /tmp/model-connect .
|
||||
/tmp/model-connect replay truth.json
|
||||
cd src/go/model-connect && go build -o /tmp/model-connect-${{ gitea.run_id }} .
|
||||
/tmp/model-connect-${{ gitea.run_id }} replay truth.json
|
||||
- name: yamllint (all workflow files — would have caught the parser bugs)
|
||||
run: |
|
||||
pip install yamllint 2>/dev/null || true
|
||||
# The runner's system python3 has NO PyYAML (PEP 668 blocks the
|
||||
# pip install; || true swallowed it — this step failed on its first
|
||||
# ever execution, run 23342). Self-contained venv, same shape as
|
||||
# the lint job's environment step.
|
||||
python3 -m venv .yaml-venv
|
||||
.yaml-venv/bin/pip install --disable-pip-version-check -q pyyaml
|
||||
for f in .gitea/workflows/*.yml; do
|
||||
python3 -c "import yaml; yaml.safe_load(open('$f'))" || { echo "YAML INVALID: $f"; exit 1; }
|
||||
.yaml-venv/bin/python -c "import yaml; yaml.safe_load(open('$f'))" || { echo "YAML INVALID: $f"; exit 1; }
|
||||
done
|
||||
echo "All workflow YAML files valid"
|
||||
|
||||
@@ -357,6 +354,9 @@ jobs:
|
||||
echo "$UNFORMATTED"
|
||||
exit 1
|
||||
fi
|
||||
- name: memory-store-deep text-kernel parity gate (HARD — #2479 batch: fts/mapreduce/entities)
|
||||
run: |
|
||||
cd src/go/memory-store-deep && go build -o /tmp/msd-${{ gitea.run_id }} . && go test -run "TestTextKernelsParity|TestDriftRerankBlendParity" -v
|
||||
- name: go race detector (every module's test suite under -race)
|
||||
run: |
|
||||
for dir in src/go/*/; do
|
||||
|
||||
@@ -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,6 +1,6 @@
|
||||
# Rune
|
||||
|
||||
**Current release: v0.156.2**
|
||||
**Current release: v0.170.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.**
|
||||
|
||||
|
||||
@@ -145,3 +145,6 @@ henxels:
|
||||
changed_with:
|
||||
when: tests/fixtures/production/manifest.json
|
||||
expect: tests/fixtures/production/test_production_fixtures.py
|
||||
- henxel: "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
|
||||
dichotomy_language_verdict: true
|
||||
@@ -189,3 +189,179 @@ def new_rune_modules_have_canary_or_test_coverage(param, file, root):
|
||||
f"legacy debt goes in docs/module-coverage-debt.md (tracked, not silent)"
|
||||
)
|
||||
|
||||
|
||||
|
||||
@statement("dichotomy_language_verdict", help="every src/rune module lands in its measured dichotomy side — wrong-language kernels, dead oracles, and regressions fail with the correct implementation as the instruction")
|
||||
def dichotomy_language_verdict(param, file, scope):
|
||||
"""The dichotomy gate (Nick, 2026-10-10): the language law enforced at the
|
||||
commit boundary, with machine-actionable feedback for Rune/MiMo-Rune.
|
||||
|
||||
Authority: store/rebase/classification.json (the measured W0 map —
|
||||
per-module side + evidence). Three violations, each with a specific
|
||||
remediation instruction:
|
||||
|
||||
D1 WRONG-LANGUAGE KERNEL — a module classified RUST has no matching
|
||||
Rust crate/kernel surface while a Go directory claims its name:
|
||||
the deterministic core landed on the reactive side.
|
||||
D2 DEAD ORACLE — a module classified GO/RUST has a ported kernel
|
||||
(src/go/<name>/ or src/rust/<name>/ exists) but the Python module
|
||||
has zero delegation refs (cc_loader / <name>_loader / go-surface
|
||||
call). The port shipped; the adapter never calls it — a facade.
|
||||
D3 REGRESSION — a module classified GO or RUST has NO port directory
|
||||
at all AND the ratchet floor says it was already ported: progress
|
||||
went backwards.
|
||||
|
||||
Feedback format: each failure names the verdict, the measured evidence,
|
||||
and the literal next step (target path + oracle-first battery +
|
||||
contract-first), so the builder agent can act without re-deriving.
|
||||
"""
|
||||
import json
|
||||
import os
|
||||
import re as _re
|
||||
|
||||
if not (file.startswith("src/rune/") and file.endswith(".py")):
|
||||
return None
|
||||
stem = Path(file).stem
|
||||
if stem.startswith(("canary_", "test_", "__")):
|
||||
return None
|
||||
|
||||
root = scope.root
|
||||
try:
|
||||
cls = json.loads((root / "store" / "rebase" / "classification.json").read_text())
|
||||
except (OSError, json.JSONDecodeError):
|
||||
return None # no measured map: the audit instrument owns coverage; do not guess
|
||||
rec = cls.get(stem)
|
||||
if not isinstance(rec, dict):
|
||||
return None
|
||||
side = rec.get("side", "")
|
||||
if side not in ("GO", "RUST", "TUI-LAST"):
|
||||
return None
|
||||
|
||||
go_dir = root / "src" / "go" / stem
|
||||
rust_dir = root / "src" / "rust" / stem
|
||||
evidence = str(rec.get("evidence", ""))[:160]
|
||||
|
||||
# D1 — wrong-language kernel: a GO-classified module must not own a Rust
|
||||
# crate that shadows its name, and vice versa.
|
||||
if side == "RUST" and go_dir.is_dir() and not rust_dir.is_dir():
|
||||
# Wave-3 kernels live in cognition_core by design (cc_<stem> externs).
|
||||
# A RUST-classified module whose kernel exists there is correctly landed
|
||||
# even without a same-named crate.
|
||||
cc = root / "src" / "rust" / "cognition_core" / "src" / "lib.rs"
|
||||
if cc.exists() and f"cc_{stem}" in cc.read_text(encoding="utf-8", errors="replace"):
|
||||
return None
|
||||
return (
|
||||
f"DICHOTOMY D1 (wrong-language kernel): {stem} is measured RUST "
|
||||
f"({evidence}) but src/go/{stem}/ exists with no src/rust/{stem}/. "
|
||||
f"FIX: port the deterministic core to src/rust/{stem}/ (oracle-first "
|
||||
f"truth battery from the Python module, parity-replayed as a HARD CI "
|
||||
f"gate, construction contract FIRST per the absolute-scaffolding law), "
|
||||
f"then retire the Go directory. Feedback path: scripts/dichotomy_audit.py"
|
||||
)
|
||||
if side == "GO" and rust_dir.is_dir() and not go_dir.is_dir():
|
||||
return (
|
||||
f"DICHOTOMY D1 (wrong-language kernel): {stem} is measured GO "
|
||||
f"({evidence}) but src/rust/{stem}/ exists with no src/go/{stem}/. "
|
||||
f"FIX: the reactive surface belongs in src/go/{stem}/ (parity battery "
|
||||
f"+ HARD CI gate + contract first), then retire the Rust crate."
|
||||
)
|
||||
|
||||
# D2 — dead oracle: the port exists but the Python module never delegates.
|
||||
# Delegation forms (all observed in the codebase): cc_loader/_cc_core,
|
||||
# sibling *_loader imports (ep_loader, qm_loader, ms_loader...), direct
|
||||
# ctypes/CDLL. Known pre-existing facades live in the DICHOTOMY DEBT file
|
||||
# (store/rebase/dichotomy_debt.json) — tracked, only-shrinks; a NEW facade
|
||||
# (not in the debt list) fails with the wiring instruction.
|
||||
ported = go_dir.is_dir() or rust_dir.is_dir()
|
||||
if ported and side in ("GO", "RUST"):
|
||||
text = scope.read_text(file) or ""
|
||||
delegating = bool(
|
||||
_re.search(
|
||||
r"import\s+\w*loader\b|from\s+[\w.]+\s+import\s+\w*loader|"
|
||||
r"_cc_core|cc_loader|ctypes|CDLL|go_surface|RUNE_\w+_CORE",
|
||||
text,
|
||||
)
|
||||
)
|
||||
is_loader = stem.endswith("_loader") or stem == "cc_loader"
|
||||
if not delegating and not is_loader:
|
||||
target = f"src/rust/{stem}/" if rust_dir.is_dir() else f"src/go/{stem}/"
|
||||
try:
|
||||
debt = set(json.loads(
|
||||
(root / "store" / "rebase" / "dichotomy_debt.json").read_text()
|
||||
).get("facades", []))
|
||||
except (OSError, json.JSONDecodeError):
|
||||
debt = set()
|
||||
if stem in debt:
|
||||
return None # tracked debt — visible in the debt file, list only shrinks
|
||||
return (
|
||||
f"DICHOTOMY D2 (dead oracle): {stem} has a ported kernel at "
|
||||
f"{target} but the Python module has ZERO delegation references "
|
||||
f"(no cc_loader/_cc_core/*_loader/ctypes call). The port is a "
|
||||
f"facade — production still runs the Python path. FIX: wire the "
|
||||
f"delegation (tier_manager pattern: kernel when available, _py_* "
|
||||
f"parity floor otherwise, both pinned by tests). Pre-existing "
|
||||
f"facades go in store/rebase/dichotomy_debt.json (tracked, "
|
||||
f"list only shrinks). Feedback: scripts/dichotomy_audit.py"
|
||||
)
|
||||
|
||||
# D3 — regression: the ratchet says this module was ported (kernel dir in
|
||||
# git HEAD) but the working tree lost it.
|
||||
if side in ("GO", "RUST") and not ported:
|
||||
ratchet = root / "store" / "rebase" / "ported_ratchet.json"
|
||||
try:
|
||||
ratcheted = set(json.loads(ratchet.read_text()).get("ported", []))
|
||||
except (OSError, json.JSONDecodeError, AttributeError):
|
||||
ratcheted = set()
|
||||
if stem in ratcheted:
|
||||
return (
|
||||
f"DICHOTOMY D3 (regression): {stem} is ratcheted as ported but no "
|
||||
f"src/go/{stem}/ or src/rust/{stem}/ exists in the tree — ported "
|
||||
f"work was deleted. RESTORE the kernel directory (git history has "
|
||||
f"it); the ratchet floor never decreases."
|
||||
)
|
||||
|
||||
# D5 — intent-unconsulted landing: a ported kernel (Go dir or Rust
|
||||
# crate exists) whose intent file still says not_started means the batch
|
||||
# never consulted the module's WHY. Parity is judged against intent, not
|
||||
# just behavior — consult store/scaffold/intent/<stem>.json, satisfy its
|
||||
# laws, and advance its status (not_started → facade → ported → retired).
|
||||
if side in ("GO", "RUST", "TUI-LAST"):
|
||||
if go_dir.is_dir() or rust_dir.is_dir():
|
||||
try:
|
||||
intent_status = json.loads(
|
||||
(root / "store" / "scaffold" / "intent" / f"{stem}.json").read_text()
|
||||
).get("status", "")
|
||||
except (OSError, json.JSONDecodeError):
|
||||
intent_status = ""
|
||||
if intent_status == "not_started":
|
||||
return (
|
||||
f"DICHOTOMY D5 (intent-unconsulted landing): {stem} has a "
|
||||
f"ported kernel but its intent file "
|
||||
f"(store/scaffold/intent/{stem}.json) still says "
|
||||
f"not_started — the batch never consulted the module's WHY. "
|
||||
f"FIX: read the intent file, satisfy its laws, set parity_means "
|
||||
f"for this module, and advance status to ported (or facade if "
|
||||
f"delegation is not yet wired). Parity is judged against "
|
||||
f"intent, not just behavior."
|
||||
)
|
||||
|
||||
# D4 — retired-module resurrection: a module in the retirement ratchet
|
||||
# (strangler exit completed — parity proven + CI green + deployed) must
|
||||
# NOT reappear as a Python file. Singular codebase law.
|
||||
if side in ("GO", "RUST") and not os.path.isdir(f"src/go/{stem}") and not os.path.isdir(f"src/rust/{stem}"):
|
||||
try:
|
||||
retired = set(json.loads(
|
||||
(root / "store" / "rebase" / "retired_modules.json").read_text()
|
||||
).get("retired", []))
|
||||
except (OSError, json.JSONDecodeError):
|
||||
retired = set()
|
||||
if stem in retired and (root / file).exists():
|
||||
return (
|
||||
f"DICHOTOMY D4 (retired-module resurrection): {stem} completed the "
|
||||
f"strangler exit (parity + CI green + deployed) and its Python was "
|
||||
f"deleted — but src/rune/{stem}.py exists again. The dichotomy is a "
|
||||
f"SINGULAR codebase: do not resurrect retired Python; extend the "
|
||||
f"kernel in its Go/Rust home instead. (See store/rebase/retired_modules.json.)"
|
||||
)
|
||||
|
||||
return None
|
||||
+1
-1
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "rune"
|
||||
version = "0.156.2"
|
||||
version = "0.170.0"
|
||||
description = "Rune — a stateful coding assistant with persistent memory, orchestration, and TUI"
|
||||
requires-python = ">=3.10"
|
||||
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package main
|
||||
|
||||
// drift_rerank.go — #2479 memory_store batch 2: the drift-aware re-rank
|
||||
// BLEND kernel (combined = original*0.7 + drift*0.3, stable sort desc).
|
||||
// The DB reads and drift_core.compute_value calls stay in the Python
|
||||
// reactive seam (SQLite + cross-crate); the deterministic blend is here.
|
||||
// Oracle: src/rune/memory_store.py _drift_rerank's blend section.
|
||||
|
||||
import "sort"
|
||||
|
||||
// DriftRerankBlend — entries carry {"id", "orig", "drift"}; returns ids
|
||||
// sorted by combined score desc (stable — Python sort stability parity).
|
||||
func DriftRerankBlend(entries []map[string]any) []string {
|
||||
type scored struct {
|
||||
id string
|
||||
score float64
|
||||
seq int
|
||||
}
|
||||
ss := make([]scored, 0, len(entries))
|
||||
for i, e := range entries {
|
||||
id, _ := e["id"].(string)
|
||||
orig, _ := e["orig"].(float64)
|
||||
drift, _ := e["drift"].(float64)
|
||||
ss = append(ss, scored{id: id, score: orig*0.7 + drift*0.3, seq: i})
|
||||
}
|
||||
sort.SliceStable(ss, func(a, b int) bool { return ss[a].score > ss[b].score })
|
||||
out := make([]string, len(ss))
|
||||
for i, s := range ss {
|
||||
out[i] = s.id
|
||||
}
|
||||
return out
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
package main
|
||||
|
||||
// text_kernels.go — #2479 memory_store batch: the FTS conjunctive query
|
||||
// builder, the map-reduce lost-in-the-middle mitigation, and the
|
||||
// entities-to-JSON serializer. Oracle: src/rune/memory_store.py; truth rows
|
||||
// in truth_text_kernels.json. The SQLite seam stays Python (reactive).
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"sort"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Stopwords51 — the measured stopword set (51 words) from memory_store.
|
||||
var Stopwords51 = map[string]bool{
|
||||
"about": true, "after": true, "also": true, "and": true, "are": true,
|
||||
"been": true, "but": true, "each": true, "for": true, "from": true,
|
||||
"have": true, "her": true, "him": true, "his": true, "how": true,
|
||||
"into": true, "its": true, "just": true, "likes": true, "more": true,
|
||||
"needs": true, "not": true, "only": true, "over": true, "prefers": true,
|
||||
"some": true, "such": true, "than": true, "that": true, "the": true,
|
||||
"them": true, "then": true, "there": true, "they": true, "this": true,
|
||||
"under": true, "very": true, "wants": true, "was": true, "were": true,
|
||||
"what": true, "when": true, "where": true, "which": true, "while": true,
|
||||
"who": true, "why": true, "will": true, "with": true, "you": true,
|
||||
"your": true,
|
||||
}
|
||||
|
||||
// FTSQueryConjunctive — CONJUNCTIVE FTS5 MATCH (implicit AND; Salton,
|
||||
// Fox & Wu 1983). Words >3 chars minus stopwords; falls back to >2-char
|
||||
// tokens; empty query returns as-is; max 8 terms, quoted.
|
||||
func FTSQueryConjunctive(query string) string {
|
||||
lower := strings.ToLower(query)
|
||||
fields := strings.Fields(lower)
|
||||
var toks []string
|
||||
for _, t := range fields {
|
||||
if len(t) > 3 && !Stopwords51[t] {
|
||||
toks = append(toks, t)
|
||||
}
|
||||
}
|
||||
if len(toks) == 0 {
|
||||
for _, t := range fields {
|
||||
if len(t) > 2 {
|
||||
toks = append(toks, t)
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(toks) == 0 {
|
||||
return query
|
||||
}
|
||||
if len(toks) > 8 {
|
||||
toks = toks[:8]
|
||||
}
|
||||
quoted := make([]string, len(toks))
|
||||
for i, t := range toks {
|
||||
quoted[i] = "\"" + t + "\""
|
||||
}
|
||||
return strings.Join(quoted, " ")
|
||||
}
|
||||
|
||||
// FTSQuery — backward-compat alias.
|
||||
func FTSQuery(query string) string { return FTSQueryConjunctive(query) }
|
||||
|
||||
// MapReducePy — lost-in-the-middle mitigation: chunk, take top-3 per chunk
|
||||
// (relevance desc, falling back to score then 0.5), reduce by score desc.
|
||||
// Short inputs pass through unchanged.
|
||||
func MapReducePy(entries []map[string]any, chunkSize int) []map[string]any {
|
||||
if chunkSize <= 0 {
|
||||
chunkSize = 10
|
||||
}
|
||||
score := func(e map[string]any) float64 {
|
||||
if r, ok := e["relevance"].(float64); ok {
|
||||
return r
|
||||
}
|
||||
if s, ok := e["score"].(float64); ok {
|
||||
return s
|
||||
}
|
||||
return 0.5
|
||||
}
|
||||
if len(entries) <= chunkSize {
|
||||
return entries
|
||||
}
|
||||
var mapped []map[string]any
|
||||
for i := 0; i < len(entries); i += chunkSize {
|
||||
end := i + chunkSize
|
||||
if end > len(entries) {
|
||||
end = len(entries)
|
||||
}
|
||||
chunk := entries[i:end]
|
||||
sort.SliceStable(chunk, func(a, b int) bool { return score(chunk[a]) > score(chunk[b]) })
|
||||
top := 3
|
||||
if top > len(chunk) {
|
||||
top = len(chunk)
|
||||
}
|
||||
mapped = append(mapped, chunk[:top]...)
|
||||
}
|
||||
sort.SliceStable(mapped, func(a, b int) bool { return score(mapped[a]) > score(mapped[b]) })
|
||||
return mapped
|
||||
}
|
||||
|
||||
// EntitiesToJSON — json.dumps(list(entities) if entities else []).
|
||||
// Python json.dumps default separators (', ' / ': ') parity via the
|
||||
// byte state machine (same shape as operator-deep's).
|
||||
func EntitiesToJSON(entities []map[string]any) string {
|
||||
var b []byte
|
||||
if entities == nil {
|
||||
b, _ = json.Marshal([]any{})
|
||||
} else {
|
||||
b, _ = json.Marshal(entities)
|
||||
}
|
||||
var out strings.Builder
|
||||
inStr := false
|
||||
esc := false
|
||||
for i, c := range b {
|
||||
if inStr {
|
||||
out.WriteByte(c)
|
||||
if esc {
|
||||
esc = false
|
||||
} else if c == '\\' {
|
||||
esc = true
|
||||
} else if c == '"' {
|
||||
inStr = false
|
||||
}
|
||||
continue
|
||||
}
|
||||
switch c {
|
||||
case '"':
|
||||
inStr = true
|
||||
out.WriteByte(c)
|
||||
case ',':
|
||||
out.WriteByte(c)
|
||||
if i+1 < len(b) {
|
||||
out.WriteByte(' ')
|
||||
}
|
||||
case ':':
|
||||
out.WriteByte(c)
|
||||
if i+1 < len(b) {
|
||||
out.WriteByte(' ')
|
||||
}
|
||||
default:
|
||||
out.WriteByte(c)
|
||||
}
|
||||
}
|
||||
return out.String()
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
[
|
||||
{
|
||||
"op": "blend",
|
||||
"inputs": [
|
||||
{
|
||||
"id": "e1",
|
||||
"orig": 0.9,
|
||||
"drift": 0.2
|
||||
},
|
||||
{
|
||||
"id": "e2",
|
||||
"orig": 0.5,
|
||||
"drift": 0.9
|
||||
},
|
||||
{
|
||||
"id": "e3",
|
||||
"orig": 0.7,
|
||||
"drift": 0.7
|
||||
},
|
||||
{
|
||||
"id": "e4",
|
||||
"orig": 0.1,
|
||||
"drift": 1.0
|
||||
},
|
||||
{
|
||||
"id": "e5",
|
||||
"orig": 0.6,
|
||||
"drift": 0.6
|
||||
}
|
||||
],
|
||||
"want": [
|
||||
"e3",
|
||||
"e1",
|
||||
"e2",
|
||||
"e5",
|
||||
"e4"
|
||||
]
|
||||
},
|
||||
{
|
||||
"op": "blend",
|
||||
"inputs": [
|
||||
{
|
||||
"id": "a",
|
||||
"orig": 0.5,
|
||||
"drift": 0.5
|
||||
},
|
||||
{
|
||||
"id": "b",
|
||||
"orig": 0.5,
|
||||
"drift": 0.5
|
||||
},
|
||||
{
|
||||
"id": "c",
|
||||
"orig": 0.4,
|
||||
"drift": 0.7
|
||||
}
|
||||
],
|
||||
"want": [
|
||||
"a",
|
||||
"b",
|
||||
"c"
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,35 @@
|
||||
package main
|
||||
|
||||
// truth_drift_rerank_test.go — blend-kernel parity gate.
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestDriftRerankBlendParity(t *testing.T) {
|
||||
raw, err := os.ReadFile("truth_drift_rerank.json")
|
||||
if err != nil {
|
||||
t.Fatalf("truth_drift_rerank.json missing: %v", err)
|
||||
}
|
||||
var rows []struct {
|
||||
Inputs []map[string]any `json:"inputs"`
|
||||
Want []string `json:"want"`
|
||||
}
|
||||
if err := json.Unmarshal(raw, &rows); err != nil {
|
||||
t.Fatalf("unparseable: %v", err)
|
||||
}
|
||||
for i, c := range rows {
|
||||
got := DriftRerankBlend(c.Inputs)
|
||||
if len(got) != len(c.Want) {
|
||||
t.Errorf("row %d: got %d want %d", i, len(got), len(c.Want))
|
||||
continue
|
||||
}
|
||||
for j := range got {
|
||||
if got[j] != c.Want[j] {
|
||||
t.Errorf("row %d[%d]: got %q want %q", i, j, got[j], c.Want[j])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
[
|
||||
{
|
||||
"op": "fts",
|
||||
"q": "black coffee",
|
||||
"want": "\"black\" \"coffee\""
|
||||
},
|
||||
{
|
||||
"op": "fts",
|
||||
"q": "the a of",
|
||||
"want": "\"the\""
|
||||
},
|
||||
{
|
||||
"op": "fts",
|
||||
"q": "How does the splice work in rust",
|
||||
"want": "\"does\" \"splice\" \"work\" \"rust\""
|
||||
},
|
||||
{
|
||||
"op": "fts",
|
||||
"q": "x y z",
|
||||
"want": "x y z"
|
||||
},
|
||||
{
|
||||
"op": "fts",
|
||||
"q": "",
|
||||
"want": ""
|
||||
},
|
||||
{
|
||||
"op": "fts",
|
||||
"q": "Fts5 AND query OR stuff",
|
||||
"want": "\"fts5\" \"query\" \"stuff\""
|
||||
},
|
||||
{
|
||||
"op": "fts",
|
||||
"q": "one two three four",
|
||||
"want": "\"three\" \"four\""
|
||||
},
|
||||
{
|
||||
"op": "mapreduce",
|
||||
"entries": [
|
||||
{
|
||||
"id": 0,
|
||||
"relevance": 0.9,
|
||||
"text": "e0"
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"relevance": 0.5,
|
||||
"text": "e1"
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"relevance": 0.7,
|
||||
"text": "e2"
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"relevance": 0.95,
|
||||
"text": "e3"
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"relevance": 0.1,
|
||||
"text": "e4"
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"relevance": 0.85,
|
||||
"text": "e5"
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"relevance": 0.6,
|
||||
"text": "e6"
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"relevance": 0.75,
|
||||
"text": "e7"
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
"relevance": 0.3,
|
||||
"text": "e8"
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"relevance": 0.2,
|
||||
"text": "e9"
|
||||
},
|
||||
{
|
||||
"id": 10,
|
||||
"relevance": 0.65,
|
||||
"text": "e10"
|
||||
},
|
||||
{
|
||||
"id": 11,
|
||||
"relevance": 0.4,
|
||||
"text": "e11"
|
||||
}
|
||||
],
|
||||
"chunk_size": 4,
|
||||
"want": [
|
||||
3,
|
||||
0,
|
||||
5,
|
||||
7,
|
||||
2,
|
||||
10,
|
||||
6,
|
||||
11,
|
||||
8
|
||||
]
|
||||
},
|
||||
{
|
||||
"op": "mapreduce",
|
||||
"entries": [
|
||||
{
|
||||
"id": 0,
|
||||
"relevance": 0.9,
|
||||
"text": "e0"
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"relevance": 0.5,
|
||||
"text": "e1"
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"relevance": 0.7,
|
||||
"text": "e2"
|
||||
}
|
||||
],
|
||||
"chunk_size": 10,
|
||||
"want": [
|
||||
0,
|
||||
1,
|
||||
2
|
||||
]
|
||||
},
|
||||
{
|
||||
"op": "entities_json",
|
||||
"entities": [
|
||||
{
|
||||
"a": 1
|
||||
}
|
||||
],
|
||||
"want": "[{\"a\": 1}]"
|
||||
},
|
||||
{
|
||||
"op": "entities_json",
|
||||
"entities": [],
|
||||
"want": "[]"
|
||||
},
|
||||
{
|
||||
"op": "entities_json",
|
||||
"entities": null,
|
||||
"want": "[]"
|
||||
},
|
||||
{
|
||||
"op": "ctx_alias",
|
||||
"q": "black coffee",
|
||||
"want": "\"black\" \"coffee\""
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,61 @@
|
||||
package main
|
||||
|
||||
// truth_text_kernels_test.go — #2479 memory_store batch parity gate.
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"os"
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestTextKernelsParity(t *testing.T) {
|
||||
raw, err := os.ReadFile("truth_text_kernels.json")
|
||||
if err != nil {
|
||||
t.Fatalf("truth_text_kernels.json missing: %v", err)
|
||||
}
|
||||
var rows []struct {
|
||||
Op string `json:"op"`
|
||||
Q string `json:"q"`
|
||||
Entries []map[string]any `json:"entries"`
|
||||
Chunk int `json:"chunk_size"`
|
||||
Entity []map[string]any `json:"entities"`
|
||||
Want json.RawMessage `json:"want"`
|
||||
}
|
||||
if err := json.Unmarshal(raw, &rows); err != nil {
|
||||
t.Fatalf("unparseable: %v", err)
|
||||
}
|
||||
for i, c := range rows {
|
||||
switch c.Op {
|
||||
case "fts", "ctx_alias":
|
||||
got := FTSQueryConjunctive(c.Q)
|
||||
var want string
|
||||
_ = json.Unmarshal(c.Want, &want)
|
||||
if got != want {
|
||||
t.Errorf("row %d fts %q: got %q want %q", i, c.Q, got, want)
|
||||
}
|
||||
case "mapreduce":
|
||||
got := MapReducePy(c.Entries, c.Chunk)
|
||||
var wantIDs []float64
|
||||
_ = json.Unmarshal(c.Want, &wantIDs)
|
||||
if len(got) != len(wantIDs) {
|
||||
t.Errorf("row %d mapreduce: got %d rows want %d", i, len(got), len(wantIDs))
|
||||
continue
|
||||
}
|
||||
for j, id := range wantIDs {
|
||||
gid, _ := got[j]["id"].(float64)
|
||||
if gid != id {
|
||||
t.Errorf("row %d mapreduce[%d]: got id %v want %v", i, j, gid, id)
|
||||
}
|
||||
}
|
||||
case "entities_json":
|
||||
got := EntitiesToJSON(c.Entity)
|
||||
var want string
|
||||
_ = json.Unmarshal(c.Want, &want)
|
||||
if got != want {
|
||||
t.Errorf("row %d entities_json: got %q want %q", i, got, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
var _ = reflect.DeepEqual
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package main
|
||||
|
||||
// conversation_window.go — #2479 operator batch 3: the conversation-window
|
||||
// kernel (ConversationStateRepository.window semantics: last n of the
|
||||
// channel bucket, append order, idempotent-by-msg_id appends, n<=0 →
|
||||
// empty) and the get_status assembly shape. Oracle:
|
||||
// src/rune/orchestration/conversation_state.py window(); truth rows in
|
||||
// truth_window.json.
|
||||
|
||||
// WindowKernel — msgs is the channel bucket in append order; returns the
|
||||
// last n (chronological). Mirrors Python list[-n:].
|
||||
func WindowKernel(msgs []map[string]any, n int) []map[string]any {
|
||||
if n <= 0 {
|
||||
return []map[string]any{}
|
||||
}
|
||||
if n >= len(msgs) {
|
||||
out := make([]map[string]any, len(msgs))
|
||||
copy(out, msgs)
|
||||
return out
|
||||
}
|
||||
out := make([]map[string]any, n)
|
||||
copy(out, msgs[len(msgs)-n:])
|
||||
return out
|
||||
}
|
||||
|
||||
// AppendIdempotent — bucket append, idempotent by msg_id (the repo's
|
||||
// in-memory contract; persistence stays in the Python adapter).
|
||||
func AppendIdempotent(bucket []map[string]any, msg map[string]any) []map[string]any {
|
||||
id, _ := msg["msg_id"].(string)
|
||||
for _, m := range bucket {
|
||||
if mid, _ := m["msg_id"].(string); mid == id {
|
||||
return bucket
|
||||
}
|
||||
}
|
||||
return append(bucket, msg)
|
||||
}
|
||||
|
||||
// StatusAssembly — get_status's shape: identity/role/current_task/
|
||||
// active_model + the counter keys (counters arrive computed).
|
||||
func StatusAssembly(identity, role, currentTask, activeModel string, counters map[string]int) map[string]any {
|
||||
out := map[string]any{
|
||||
"identity": identity,
|
||||
"role": role,
|
||||
"current_task": currentTask,
|
||||
"active_model": activeModel,
|
||||
}
|
||||
for k, v := range counters {
|
||||
out[k] = v
|
||||
}
|
||||
return out
|
||||
}
|
||||
@@ -0,0 +1,205 @@
|
||||
package main
|
||||
|
||||
// kernels30.go — #2479 operator batch: the P1-07 (#30) evidence kernels that
|
||||
// operator-deep's first wave didn't cover. Oracle: src/rune/rune_operator.py
|
||||
// _memory_query_from_trace / _observation_from_compaction /
|
||||
// _verification_and_outcome / _probe_failure_classes. Truth battery:
|
||||
// truth_operator30.json, replayed in-repo + HARD CI gate.
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Bounded300 collapses text to one line bounded to limit chars (P1-07 #30).
|
||||
// Exported alias for the CLI layer; bounded() in main.go is identical.
|
||||
func Bounded300(text string, limit int) string { return bounded(text, limit) }
|
||||
|
||||
// MemoryQueryFromTrace — admitted blocks become {name: tokens}; dropped ride
|
||||
// through with reasons. Observable selection state only.
|
||||
func MemoryQueryFromTrace(trace map[string]any, taskID string) map[string]any {
|
||||
blocks, _ := trace["blocks"].([]any)
|
||||
admitted := map[string]any{}
|
||||
dropped := []any{}
|
||||
for _, b := range blocks {
|
||||
bm, ok := b.(map[string]any)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
name, _ := bm["name"].(string)
|
||||
tokens, _ := bm["tokens"].(float64)
|
||||
if admittedFlag, _ := bm["admitted"].(bool); admittedFlag {
|
||||
admitted[name] = tokens
|
||||
} else {
|
||||
dropped = append(dropped, map[string]any{"name": name, "tokens": tokens})
|
||||
}
|
||||
}
|
||||
mt, _ := trace["memory_tokens"].(float64)
|
||||
return map[string]any{
|
||||
"task_id": taskID,
|
||||
"admitted": admitted,
|
||||
"dropped": dropped,
|
||||
"memory_tokens": int(mt),
|
||||
}
|
||||
}
|
||||
|
||||
// ObservationFromCompaction — one compaction event → Observation.
|
||||
// detail = json.dumps of the four keys, sort_keys=True (Python parity:
|
||||
// archived, failed, persisted, triggered — alphabetical).
|
||||
func ObservationFromCompaction(event map[string]any, taskID string) map[string]any {
|
||||
toInt := func(k string) int {
|
||||
if f, ok := event[k].(float64); ok {
|
||||
return int(f)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
summary := fmt.Sprintf("history compacted: %d -> %d tokens, %d turns summarized",
|
||||
toInt("tokens_before"), toInt("tokens_after"), toInt("turns_summarized"))
|
||||
detailKeys := []string{"archived", "failed", "persisted", "triggered"}
|
||||
detailMap := map[string]any{}
|
||||
for _, k := range detailKeys {
|
||||
detailMap[k] = event[k]
|
||||
}
|
||||
db, _ := json.Marshal(detailMap)
|
||||
// Python json.dumps default separators (', ' / ': ') parity:
|
||||
db = pythonDumpSpacing(db)
|
||||
return map[string]any{
|
||||
"task_id": taskID,
|
||||
"kind": "compaction",
|
||||
"summary": bounded(summary, 300),
|
||||
"detail": bounded(string(db), 300),
|
||||
}
|
||||
}
|
||||
|
||||
// VerificationAndOutcome — the frozen method contract: 'exit_code' when a
|
||||
// run_command tool event completed successfully, 'test' when run_tests did,
|
||||
// else 'none'. passed = response.success AND no error/failed event. The
|
||||
// none-branch returns verification=null (never self-report) + an Outcome
|
||||
// whose verification_id is empty.
|
||||
func VerificationAndOutcome(success bool, toolEvents []map[string]any, degraded []string, taskID string) map[string]any {
|
||||
method := "none"
|
||||
evidence := ""
|
||||
for _, ev := range toolEvents {
|
||||
if ev["kind"] != "completed" {
|
||||
continue
|
||||
}
|
||||
result, _ := ev["result"].(map[string]any)
|
||||
if result == nil || result["success"] != true {
|
||||
continue
|
||||
}
|
||||
req, _ := ev["request"].(map[string]any)
|
||||
name, _ := req["name"].(string)
|
||||
if name == "run_command" && method == "none" {
|
||||
method = "exit_code"
|
||||
r, _ := result["result"].(string)
|
||||
if r == "" {
|
||||
r = "run_command exit 0"
|
||||
}
|
||||
evidence = bounded(r, 300)
|
||||
} else if name == "run_tests" {
|
||||
method = "test"
|
||||
r, _ := result["result"].(string)
|
||||
if r == "" {
|
||||
r = "run_tests passed"
|
||||
}
|
||||
evidence = bounded(r, 300)
|
||||
break
|
||||
}
|
||||
}
|
||||
hasToolFailure := false
|
||||
for _, ev := range toolEvents {
|
||||
if ev["kind"] == "error" || ev["kind"] == "failed" {
|
||||
hasToolFailure = true
|
||||
break
|
||||
}
|
||||
}
|
||||
passed := success && !hasToolFailure
|
||||
status := "completed"
|
||||
if !success {
|
||||
status = "failed"
|
||||
}
|
||||
// sorted-dedup degraded (Python: sorted(set(degraded)))
|
||||
seen := map[string]bool{}
|
||||
var dg []string
|
||||
for _, d := range degraded {
|
||||
if !seen[d] {
|
||||
seen[d] = true
|
||||
dg = append(dg, d)
|
||||
}
|
||||
}
|
||||
sort.Strings(dg)
|
||||
|
||||
out := map[string]any{
|
||||
"method": method,
|
||||
"evidence": evidence,
|
||||
"passed": passed,
|
||||
"status": status,
|
||||
"degraded": dg,
|
||||
"verification_id": "",
|
||||
}
|
||||
if method != "none" && passed {
|
||||
out["verification_id"] = "vr_" + taskID // id minted by the adapter; kernel returns the contract
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// ProbeFailureClasses — the exception classes the probe handler must never
|
||||
// leak into chat. The Python oracle returns the class NAME tuple (import-
|
||||
// available case): OSError, ValueError, TypeError, KeyError, and
|
||||
// ProbeBudgetExceeded when evidence_probe imports. Budget handling stays in
|
||||
// the Python adapter (task-scoped dirs); the kernel pins the CONTRACT.
|
||||
func ProbeFailureClasses(includeBudget bool) []string {
|
||||
classes := []string{"OSError", "ValueError", "TypeError", "KeyError"}
|
||||
if includeBudget {
|
||||
classes = append(classes, "ProbeBudgetExceeded")
|
||||
}
|
||||
return classes
|
||||
}
|
||||
|
||||
// pythonDumpSpacing re-spaces Go's compact JSON to Python json.dumps
|
||||
// defaults: ", " after items and ": " after keys (top level only — the
|
||||
// detail map is flat).
|
||||
func pythonDumpSpacing(b []byte) []byte {
|
||||
// Flat map, one level: transform compact Go JSON to Python json.dumps
|
||||
// default separators. State machine over bytes; strings tracked.
|
||||
var out strings.Builder
|
||||
inStr := false
|
||||
esc := false
|
||||
for i, c := range b {
|
||||
if inStr {
|
||||
out.WriteByte(c)
|
||||
if esc {
|
||||
esc = false
|
||||
} else if c == '\\' {
|
||||
esc = true
|
||||
} else if c == '"' {
|
||||
inStr = false
|
||||
}
|
||||
continue
|
||||
}
|
||||
switch c {
|
||||
case '"':
|
||||
inStr = true
|
||||
out.WriteByte(c)
|
||||
case ',':
|
||||
out.WriteByte(c)
|
||||
if i+1 < len(b) {
|
||||
out.WriteByte(' ')
|
||||
}
|
||||
case ':':
|
||||
out.WriteByte(c)
|
||||
if i+1 < len(b) {
|
||||
out.WriteByte(' ')
|
||||
}
|
||||
default:
|
||||
out.WriteByte(c)
|
||||
}
|
||||
}
|
||||
return []byte(out.String())
|
||||
}
|
||||
|
||||
// droppedBlockParity guard: Python dict drops preserve first-seen order —
|
||||
// the _re.Dropped slice must NOT be re-sorted. (Asserted in the truth rows.)
|
||||
var _ = strings.TrimSpace
|
||||
@@ -0,0 +1,53 @@
|
||||
package main
|
||||
|
||||
// task_identity.go — #2479 operator batch 2: the task-identity decision
|
||||
// kernel (send_task's canonical #18 opening: amend vs create vs lineage),
|
||||
// the follow-up regex, and the status counters (repo-vocabulary mapping
|
||||
// created→pending). Oracle: src/rune/rune_operator.py; truth rows in
|
||||
// truth_task_identity.json.
|
||||
|
||||
// IsFollowUp delegates to the existing kernel in main.go (isFollowUp).
|
||||
func IsFollowUp(description string) bool { return isFollowUp(description) }
|
||||
|
||||
// TaskIdentity — the send_task decision kernel: AMEND when an active task
|
||||
// exists on the channel and (it is running OR the description is a
|
||||
// follow-up); CREATE (with parent lineage) otherwise.
|
||||
func TaskIdentity(activeExists bool, activeStatus, description string) string {
|
||||
if activeExists && (activeStatus == "running" || IsFollowUp(description)) {
|
||||
return "amend"
|
||||
}
|
||||
return "create"
|
||||
}
|
||||
|
||||
// TaskCountersFull — counters from the canonical repo records; repo
|
||||
// vocabulary mapped to the legacy buckets (created→pending). When no
|
||||
// records exist (fresh store), fall back to the in-memory task list.
|
||||
func TaskCountersFull(records []map[string]any, tasks []map[string]any) map[string]int {
|
||||
buckets := map[string]int{"pending": 0, "running": 0, "completed": 0}
|
||||
if len(records) > 0 {
|
||||
for _, r := range records {
|
||||
st, _ := r["status"].(string)
|
||||
switch st {
|
||||
case "created", "pending":
|
||||
buckets["pending"]++
|
||||
case "running":
|
||||
buckets["running"]++
|
||||
case "completed":
|
||||
buckets["completed"]++
|
||||
}
|
||||
}
|
||||
return map[string]int{"tasks_pending": buckets["pending"], "tasks_running": buckets["running"], "tasks_completed": buckets["completed"]}
|
||||
}
|
||||
for _, t := range tasks {
|
||||
st, _ := t["status"].(string)
|
||||
switch st {
|
||||
case "pending":
|
||||
buckets["pending"]++
|
||||
case "running":
|
||||
buckets["running"]++
|
||||
case "completed":
|
||||
buckets["completed"]++
|
||||
}
|
||||
}
|
||||
return map[string]int{"tasks_pending": buckets["pending"], "tasks_running": buckets["running"], "tasks_completed": buckets["completed"]}
|
||||
}
|
||||
@@ -0,0 +1,199 @@
|
||||
[
|
||||
{
|
||||
"op": "probe_classes",
|
||||
"want": [
|
||||
"OSError",
|
||||
"ValueError",
|
||||
"TypeError",
|
||||
"KeyError",
|
||||
"ProbeBudgetExceeded"
|
||||
]
|
||||
},
|
||||
{
|
||||
"op": "mq",
|
||||
"trace": {
|
||||
"blocks": [
|
||||
{
|
||||
"name": "constitution",
|
||||
"tokens": 400,
|
||||
"admitted": true
|
||||
},
|
||||
{
|
||||
"name": "history",
|
||||
"tokens": 900,
|
||||
"admitted": false
|
||||
},
|
||||
{
|
||||
"name": "pins",
|
||||
"tokens": 120,
|
||||
"admitted": true
|
||||
}
|
||||
],
|
||||
"memory_tokens": 520
|
||||
},
|
||||
"want": {
|
||||
"admitted": {
|
||||
"constitution": 400,
|
||||
"pins": 120
|
||||
},
|
||||
"dropped": [
|
||||
{
|
||||
"name": "history",
|
||||
"tokens": 900
|
||||
}
|
||||
],
|
||||
"memory_tokens": 520
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "obs_compaction",
|
||||
"event": {
|
||||
"tokens_before": 8000,
|
||||
"tokens_after": 3000,
|
||||
"turns_summarized": 12,
|
||||
"triggered": true,
|
||||
"archived": false,
|
||||
"failed": 0,
|
||||
"persisted": "yes"
|
||||
},
|
||||
"want": {
|
||||
"kind": "compaction",
|
||||
"summary": "history compacted: 8000 -> 3000 tokens, 12 turns summarized",
|
||||
"detail": "{\"archived\": false, \"failed\": 0, \"persisted\": \"yes\", \"triggered\": true}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "obs_degraded",
|
||||
"degraded": [
|
||||
"voice",
|
||||
"cache",
|
||||
"voice"
|
||||
],
|
||||
"want": [
|
||||
{
|
||||
"kind": "degraded",
|
||||
"summary": "subsystem unavailable: cache"
|
||||
},
|
||||
{
|
||||
"kind": "degraded",
|
||||
"summary": "subsystem unavailable: voice"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"op": "verif_exit",
|
||||
"success": true,
|
||||
"tool_events": [
|
||||
{
|
||||
"kind": "completed",
|
||||
"request": {
|
||||
"call_id": "c1",
|
||||
"name": "run_command",
|
||||
"arguments": {},
|
||||
"source": "op"
|
||||
},
|
||||
"result": {
|
||||
"success": true,
|
||||
"result": "r"
|
||||
}
|
||||
}
|
||||
],
|
||||
"degraded": [],
|
||||
"want": {
|
||||
"method": "exit_code",
|
||||
"passed": true,
|
||||
"status": "completed",
|
||||
"vid": true,
|
||||
"degraded": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "verif_test",
|
||||
"success": true,
|
||||
"tool_events": [
|
||||
{
|
||||
"kind": "completed",
|
||||
"request": {
|
||||
"call_id": "c1",
|
||||
"name": "run_command",
|
||||
"arguments": {},
|
||||
"source": "op"
|
||||
},
|
||||
"result": {
|
||||
"success": true,
|
||||
"result": "r"
|
||||
}
|
||||
},
|
||||
{
|
||||
"kind": "completed",
|
||||
"request": {
|
||||
"call_id": "c1",
|
||||
"name": "run_tests",
|
||||
"arguments": {},
|
||||
"source": "op"
|
||||
},
|
||||
"result": {
|
||||
"success": true,
|
||||
"result": "r"
|
||||
}
|
||||
}
|
||||
],
|
||||
"degraded": [],
|
||||
"want": {
|
||||
"method": "test",
|
||||
"passed": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "verif_none",
|
||||
"success": true,
|
||||
"tool_events": [],
|
||||
"degraded": [
|
||||
"voice"
|
||||
],
|
||||
"want": {
|
||||
"v_is_none": true,
|
||||
"status": "completed",
|
||||
"degraded": [
|
||||
"voice"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "verif_toolfail",
|
||||
"success": true,
|
||||
"tool_events": [
|
||||
{
|
||||
"kind": "completed",
|
||||
"request": {
|
||||
"call_id": "c1",
|
||||
"name": "run_command",
|
||||
"arguments": {},
|
||||
"source": "op"
|
||||
},
|
||||
"result": {
|
||||
"success": true,
|
||||
"result": "r"
|
||||
}
|
||||
},
|
||||
{
|
||||
"kind": "failed",
|
||||
"request": {
|
||||
"call_id": "c1",
|
||||
"name": "web",
|
||||
"arguments": {},
|
||||
"source": "op"
|
||||
},
|
||||
"result": {
|
||||
"success": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"degraded": [],
|
||||
"want": {
|
||||
"passed": false,
|
||||
"status": "completed",
|
||||
"vid": ""
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,138 @@
|
||||
package main
|
||||
|
||||
// truth_operator30_test.go — #2479 operator-batch parity gate: replays
|
||||
// truth_operator30.json (generated from the LIVE Python oracle
|
||||
// src/rune/rune_operator.py) through the Go kernels.
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"os"
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
type op30Row struct {
|
||||
Op string `json:"op"`
|
||||
Trace map[string]any `json:"trace"`
|
||||
Event map[string]any `json:"event"`
|
||||
Degraded []string `json:"degraded"`
|
||||
Success *bool `json:"success"`
|
||||
ToolEvents []map[string]any `json:"tool_events"`
|
||||
Want map[string]any `json:"want"`
|
||||
WantList []map[string]any `json:"want_list"`
|
||||
WantStrings []string `json:"want_strings"`
|
||||
}
|
||||
|
||||
// toF normalizes JSON numbers (float64 on decode) vs kernel ints.
|
||||
func toF(v any) float64 {
|
||||
switch x := v.(type) {
|
||||
case float64:
|
||||
return x
|
||||
case int:
|
||||
return float64(x)
|
||||
case int64:
|
||||
return float64(x)
|
||||
default:
|
||||
return -1e308
|
||||
}
|
||||
}
|
||||
|
||||
func TestOperator30Parity(t *testing.T) {
|
||||
raw, err := os.ReadFile("truth_operator30.json")
|
||||
if err != nil {
|
||||
t.Fatalf("truth_operator30.json missing: %v", err)
|
||||
}
|
||||
var rows []struct {
|
||||
Op string `json:"op"`
|
||||
Trace map[string]any `json:"trace"`
|
||||
Event map[string]any `json:"event"`
|
||||
Degraded []string `json:"degraded"`
|
||||
Want json.RawMessage `json:"want"`
|
||||
WantList []map[string]any `json:"want_list"`
|
||||
WantStrings []string `json:"want_strings"`
|
||||
}
|
||||
if err := json.Unmarshal(raw, &rows); err != nil {
|
||||
t.Fatalf("unparseable: %v", err)
|
||||
}
|
||||
// wire into the ops CLI style: each kernel callable from the test
|
||||
for i, c := range rows {
|
||||
switch c.Op {
|
||||
case "probe_classes":
|
||||
got := ProbeFailureClasses(true)
|
||||
var want []string
|
||||
_ = json.Unmarshal(c.Want, &want)
|
||||
if !reflect.DeepEqual(got, want) {
|
||||
t.Errorf("row %d probe_classes: got %v want %v", i, got, want)
|
||||
}
|
||||
case "mq":
|
||||
got := MemoryQueryFromTrace(c.Trace, "t1")
|
||||
want := map[string]any{}
|
||||
_ = json.Unmarshal(c.Want, &want)
|
||||
if !reflect.DeepEqual(got["admitted"], want["admitted"]) {
|
||||
t.Errorf("row %d mq admitted: got %v want %v", i, got["admitted"], want["admitted"])
|
||||
}
|
||||
if !reflect.DeepEqual(got["dropped"], want["dropped"]) {
|
||||
t.Errorf("row %d mq dropped: got %v want %v", i, got["dropped"], want["dropped"])
|
||||
}
|
||||
if toF(got["memory_tokens"]) != toF(want["memory_tokens"]) {
|
||||
t.Errorf("row %d mq memory_tokens: got %v want %v", i, got["memory_tokens"], want["memory_tokens"])
|
||||
}
|
||||
case "obs_compaction":
|
||||
got := ObservationFromCompaction(c.Event, "t1")
|
||||
want := map[string]any{}
|
||||
_ = json.Unmarshal(c.Want, &want)
|
||||
for _, k := range []string{"kind", "summary", "detail"} {
|
||||
if got[k] != want[k] {
|
||||
t.Errorf("row %d obs_compaction %s: got %v want %v", i, k, got[k], want[k])
|
||||
}
|
||||
}
|
||||
case "obs_degraded":
|
||||
got := degradedObservations(c.Degraded, "t1")
|
||||
var wantList []map[string]any
|
||||
_ = json.Unmarshal(c.Want, &wantList)
|
||||
// oracle want_list carries {kind, summary}; Go returns summaries
|
||||
for j, w := range wantList {
|
||||
wantSummary := w["summary"].(string)
|
||||
if got[j] != wantSummary {
|
||||
t.Errorf("row %d obs_degraded[%d]: got %q want %q", i, j, got[j], wantSummary)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestVerificationAndOutcomeContract(t *testing.T) {
|
||||
mk := func(name, kind string, success bool) map[string]any {
|
||||
return map[string]any{
|
||||
"kind": kind,
|
||||
"request": map[string]any{"name": name},
|
||||
"result": map[string]any{"success": success, "result": "r"},
|
||||
}
|
||||
}
|
||||
// exit_code path
|
||||
got := VerificationAndOutcome(true, []map[string]any{mk("run_command", "completed", true)}, nil, "t1")
|
||||
if got["method"] != "exit_code" || got["passed"] != true || got["status"] != "completed" {
|
||||
t.Errorf("exit_code: got %v", got)
|
||||
}
|
||||
if got["verification_id"] == "" {
|
||||
t.Errorf("exit_code: verification_id must be set when passed")
|
||||
}
|
||||
// test precedence over exit_code
|
||||
got2 := VerificationAndOutcome(true, []map[string]any{mk("run_command", "completed", true), mk("run_tests", "completed", true)}, nil, "t1")
|
||||
if got2["method"] != "test" {
|
||||
t.Errorf("test precedence: got %v", got2["method"])
|
||||
}
|
||||
// none-branch: no evidence ran — verification must NOT be claimed
|
||||
got3 := VerificationAndOutcome(true, nil, []string{"voice"}, "t1")
|
||||
if got3["method"] != "none" || got3["verification_id"] != "" {
|
||||
t.Errorf("none-branch: got %v", got3)
|
||||
}
|
||||
if !reflect.DeepEqual(got3["degraded"], []string{"voice"}) {
|
||||
t.Errorf("none-branch degraded: got %v", got3["degraded"])
|
||||
}
|
||||
// tool failure falsifies: passed=false, verification_id empty even with method
|
||||
got4 := VerificationAndOutcome(true, []map[string]any{mk("run_command", "completed", true), mk("web", "failed", false)}, nil, "t1")
|
||||
if got4["passed"] != false || got4["verification_id"] != "" {
|
||||
t.Errorf("toolfail: got %v", got4)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,207 @@
|
||||
[
|
||||
{
|
||||
"op": "identity",
|
||||
"active_status": "running",
|
||||
"desc": "anything",
|
||||
"exists": true,
|
||||
"want": "amend"
|
||||
},
|
||||
{
|
||||
"op": "identity",
|
||||
"active_status": "pending",
|
||||
"desc": "yes please do that",
|
||||
"exists": true,
|
||||
"want": "amend"
|
||||
},
|
||||
{
|
||||
"op": "identity",
|
||||
"active_status": "pending",
|
||||
"desc": "new completely different task",
|
||||
"exists": true,
|
||||
"want": "create"
|
||||
},
|
||||
{
|
||||
"op": "identity",
|
||||
"active_status": null,
|
||||
"desc": "new task",
|
||||
"exists": false,
|
||||
"want": "create"
|
||||
},
|
||||
{
|
||||
"op": "identity",
|
||||
"active_status": "completed",
|
||||
"desc": "ok",
|
||||
"exists": true,
|
||||
"want": "amend"
|
||||
},
|
||||
{
|
||||
"op": "identity",
|
||||
"active_status": "completed",
|
||||
"desc": "new task",
|
||||
"exists": true,
|
||||
"want": "create"
|
||||
},
|
||||
{
|
||||
"op": "followup",
|
||||
"desc": "yes",
|
||||
"want": true
|
||||
},
|
||||
{
|
||||
"op": "followup",
|
||||
"desc": "yeah",
|
||||
"want": true
|
||||
},
|
||||
{
|
||||
"op": "followup",
|
||||
"desc": "yep",
|
||||
"want": true
|
||||
},
|
||||
{
|
||||
"op": "followup",
|
||||
"desc": "yup",
|
||||
"want": true
|
||||
},
|
||||
{
|
||||
"op": "followup",
|
||||
"desc": "ok",
|
||||
"want": true
|
||||
},
|
||||
{
|
||||
"op": "followup",
|
||||
"desc": "okay",
|
||||
"want": true
|
||||
},
|
||||
{
|
||||
"op": "followup",
|
||||
"desc": "sure",
|
||||
"want": true
|
||||
},
|
||||
{
|
||||
"op": "followup",
|
||||
"desc": "please do",
|
||||
"want": true
|
||||
},
|
||||
{
|
||||
"op": "followup",
|
||||
"desc": "go ahead",
|
||||
"want": true
|
||||
},
|
||||
{
|
||||
"op": "followup",
|
||||
"desc": "continue",
|
||||
"want": true
|
||||
},
|
||||
{
|
||||
"op": "followup",
|
||||
"desc": "do it",
|
||||
"want": true
|
||||
},
|
||||
{
|
||||
"op": "followup",
|
||||
"desc": "proceed",
|
||||
"want": true
|
||||
},
|
||||
{
|
||||
"op": "followup",
|
||||
"desc": "sounds good",
|
||||
"want": true
|
||||
},
|
||||
{
|
||||
"op": "followup",
|
||||
"desc": "approved",
|
||||
"want": true
|
||||
},
|
||||
{
|
||||
"op": "followup",
|
||||
"desc": "confirm",
|
||||
"want": true
|
||||
},
|
||||
{
|
||||
"op": "followup",
|
||||
"desc": "that works",
|
||||
"want": true
|
||||
},
|
||||
{
|
||||
"op": "followup",
|
||||
"desc": "lgtm",
|
||||
"want": true
|
||||
},
|
||||
{
|
||||
"op": "followup",
|
||||
"desc": "Yes please",
|
||||
"want": true
|
||||
},
|
||||
{
|
||||
"op": "followup",
|
||||
"desc": "OK then",
|
||||
"want": true
|
||||
},
|
||||
{
|
||||
"op": "followup",
|
||||
"desc": "LGTM ship it",
|
||||
"want": true
|
||||
},
|
||||
{
|
||||
"op": "followup",
|
||||
"desc": "yellow",
|
||||
"want": false
|
||||
},
|
||||
{
|
||||
"op": "followup",
|
||||
"desc": "okayish",
|
||||
"want": false
|
||||
},
|
||||
{
|
||||
"op": "followup",
|
||||
"desc": "",
|
||||
"want": false
|
||||
},
|
||||
{
|
||||
"op": "followup",
|
||||
"desc": "no",
|
||||
"want": false
|
||||
},
|
||||
{
|
||||
"op": "counters",
|
||||
"records": [
|
||||
{
|
||||
"status": "created"
|
||||
},
|
||||
{
|
||||
"status": "pending"
|
||||
},
|
||||
{
|
||||
"status": "running"
|
||||
},
|
||||
{
|
||||
"status": "running"
|
||||
},
|
||||
{
|
||||
"status": "completed"
|
||||
}
|
||||
],
|
||||
"tasks": [],
|
||||
"want": {
|
||||
"tasks_pending": 2,
|
||||
"tasks_running": 2,
|
||||
"tasks_completed": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"op": "counters",
|
||||
"records": [],
|
||||
"tasks": [
|
||||
{
|
||||
"status": "pending"
|
||||
},
|
||||
{
|
||||
"status": "running"
|
||||
}
|
||||
],
|
||||
"want": {
|
||||
"tasks_pending": 1,
|
||||
"tasks_running": 1,
|
||||
"tasks_completed": 0
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,60 @@
|
||||
package main
|
||||
|
||||
// truth_task_identity_test.go — #2479 operator-batch-2 parity gate.
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"os"
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestTaskIdentityParity(t *testing.T) {
|
||||
raw, err := os.ReadFile("truth_task_identity.json")
|
||||
if err != nil {
|
||||
t.Fatalf("truth_task_identity.json missing: %v", err)
|
||||
}
|
||||
var rows []struct {
|
||||
Op string `json:"op"`
|
||||
ActiveStatus *string `json:"active_status"`
|
||||
Desc string `json:"desc"`
|
||||
Exists bool `json:"exists"`
|
||||
Records []map[string]any `json:"records"`
|
||||
Tasks []map[string]any `json:"tasks"`
|
||||
Want interface{} `json:"want"`
|
||||
}
|
||||
if err := json.Unmarshal(raw, &rows); err != nil {
|
||||
t.Fatalf("unparseable: %v", err)
|
||||
}
|
||||
for i, c := range rows {
|
||||
switch c.Op {
|
||||
case "identity":
|
||||
got := TaskIdentity(c.Exists, orEmpty(c.ActiveStatus), c.Desc)
|
||||
if got != c.Want.(string) {
|
||||
t.Errorf("row %d identity: got %q want %q", i, got, c.Want)
|
||||
}
|
||||
case "followup":
|
||||
got := IsFollowUp(c.Desc)
|
||||
if got != c.Want.(bool) {
|
||||
t.Errorf("row %d followup %q: got %v want %v", i, c.Desc, got, c.Want)
|
||||
}
|
||||
case "counters":
|
||||
got := TaskCountersFull(c.Records, c.Tasks)
|
||||
want := c.Want.(map[string]interface{})
|
||||
for _, k := range []string{"tasks_pending", "tasks_running", "tasks_completed"} {
|
||||
if got[k] != int(want[k].(float64)) {
|
||||
t.Errorf("row %d counters %s: got %v want %v", i, k, got[k], want[k])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func orEmpty(s *string) string {
|
||||
if s == nil {
|
||||
return ""
|
||||
}
|
||||
return *s
|
||||
}
|
||||
|
||||
var _ = reflect.DeepEqual
|
||||
@@ -0,0 +1,107 @@
|
||||
[
|
||||
{
|
||||
"op": "window",
|
||||
"msgs": [
|
||||
{
|
||||
"msg_id": "m0",
|
||||
"channel_id": "c1",
|
||||
"content": "msg 0"
|
||||
},
|
||||
{
|
||||
"msg_id": "m1",
|
||||
"channel_id": "c1",
|
||||
"content": "msg 1"
|
||||
},
|
||||
{
|
||||
"msg_id": "m3",
|
||||
"channel_id": "c1",
|
||||
"content": "msg 3"
|
||||
}
|
||||
],
|
||||
"n": 2,
|
||||
"want": [
|
||||
{
|
||||
"msg_id": "m1"
|
||||
},
|
||||
{
|
||||
"msg_id": "m3"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"op": "window",
|
||||
"msgs": [
|
||||
{
|
||||
"msg_id": "m0",
|
||||
"channel_id": "c1",
|
||||
"content": "msg 0"
|
||||
},
|
||||
{
|
||||
"msg_id": "m1",
|
||||
"channel_id": "c1",
|
||||
"content": "msg 1"
|
||||
},
|
||||
{
|
||||
"msg_id": "m3",
|
||||
"channel_id": "c1",
|
||||
"content": "msg 3"
|
||||
}
|
||||
],
|
||||
"n": 0,
|
||||
"want": []
|
||||
},
|
||||
{
|
||||
"op": "window",
|
||||
"msgs": [
|
||||
{
|
||||
"msg_id": "m0",
|
||||
"channel_id": "c1",
|
||||
"content": "msg 0"
|
||||
},
|
||||
{
|
||||
"msg_id": "m1",
|
||||
"channel_id": "c1",
|
||||
"content": "msg 1"
|
||||
},
|
||||
{
|
||||
"msg_id": "m3",
|
||||
"channel_id": "c1",
|
||||
"content": "msg 3"
|
||||
}
|
||||
],
|
||||
"n": 9,
|
||||
"want": [
|
||||
{
|
||||
"msg_id": "m0"
|
||||
},
|
||||
{
|
||||
"msg_id": "m1"
|
||||
},
|
||||
{
|
||||
"msg_id": "m3"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"op": "window",
|
||||
"msgs": [
|
||||
{
|
||||
"msg_id": "m2",
|
||||
"channel_id": "c2",
|
||||
"content": "msg 2"
|
||||
}
|
||||
],
|
||||
"n": 1,
|
||||
"want": [
|
||||
{
|
||||
"msg_id": "m2"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"op": "window",
|
||||
"msgs": [],
|
||||
"n": 3,
|
||||
"want": []
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,52 @@
|
||||
package main
|
||||
|
||||
// truth_window_test.go — #2479 operator-batch-3 parity gate.
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"os"
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestWindowParity(t *testing.T) {
|
||||
raw, err := os.ReadFile("truth_window.json")
|
||||
if err != nil {
|
||||
t.Fatalf("truth_window.json missing: %v", err)
|
||||
}
|
||||
var rows []struct {
|
||||
Msgs []map[string]any `json:"msgs"`
|
||||
N int `json:"n"`
|
||||
Want []map[string]any `json:"want"`
|
||||
}
|
||||
if err := json.Unmarshal(raw, &rows); err != nil {
|
||||
t.Fatalf("unparseable: %v", err)
|
||||
}
|
||||
for i, c := range rows {
|
||||
got := WindowKernel(c.Msgs, c.N)
|
||||
if len(got) != len(c.Want) {
|
||||
t.Errorf("row %d window n=%d: got %d rows want %d", i, c.N, len(got), len(c.Want))
|
||||
continue
|
||||
}
|
||||
for j := range got {
|
||||
gid, _ := got[j]["msg_id"].(string)
|
||||
wid, _ := c.Want[j]["msg_id"].(string)
|
||||
if gid != wid {
|
||||
t.Errorf("row %d window[%d]: got %q want %q", i, j, gid, wid)
|
||||
}
|
||||
}
|
||||
}
|
||||
// idempotent-append contract
|
||||
bucket := []map[string]any{{"msg_id": "m1"}}
|
||||
bucket = AppendIdempotent(bucket, map[string]any{"msg_id": "m2"})
|
||||
bucket = AppendIdempotent(bucket, map[string]any{"msg_id": "m1"})
|
||||
if len(bucket) != 2 {
|
||||
t.Errorf("idempotent append: bucket grew to %d", len(bucket))
|
||||
}
|
||||
// status assembly shape
|
||||
st := StatusAssembly("rune", "operator", "t1", "m1", map[string]int{"tasks_pending": 2})
|
||||
if st["identity"] != "rune" || st["tasks_pending"] != 2 {
|
||||
t.Errorf("status assembly: got %v", st)
|
||||
}
|
||||
var _ = reflect.DeepEqual
|
||||
}
|
||||
@@ -6,7 +6,7 @@ This is the main entry point for the Rune program.
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
__version__ = "0.156.2"
|
||||
__version__ = "0.170.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
|
||||
|
||||
@@ -233,7 +233,7 @@ def main() -> int:
|
||||
)
|
||||
check(
|
||||
"Rune minor version advertises provisioning and restore verification",
|
||||
'__version__ = "0.156.2"' in rune_version,
|
||||
'__version__ = "0.170.0"' in rune_version,
|
||||
failures,
|
||||
)
|
||||
# #169 policy update: auto-bump on merge is sanctioned (Nick directive:
|
||||
|
||||
@@ -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]:
|
||||
|
||||
+15
-61
@@ -108,51 +108,14 @@ def compute_value(entry: dict, current_goals: List[str] | None = None) -> float:
|
||||
|
||||
def _py_compute_value(entry: dict, current_goals: List[str] | None = None,
|
||||
now: str | None = None) -> float:
|
||||
"""Python core of compute_value (parity oracle for the Rust core).
|
||||
`now` is an ISO-8601 string; None resolves the wall clock (production)."""
|
||||
proven = entry.get("wash_count", 0) or 0 # column name preserved for compatibility
|
||||
imp = entry.get("importance", 0.5) or 0.5
|
||||
|
||||
# Proven use factor: logarithmic scaling (diminishing returns)
|
||||
proven_factor = min(1.0, math.log1p(proven) / math.log1p(PROVEN_USES_THRESHOLD))
|
||||
|
||||
# Recency factor: exponential decay
|
||||
now_dt = datetime.fromisoformat(now) if now else datetime.now(timezone.utc)
|
||||
recency = 1.0
|
||||
last_accessed = entry.get("last_accessed") or entry.get("last_washed")
|
||||
if last_accessed:
|
||||
try:
|
||||
last = datetime.fromisoformat(last_accessed)
|
||||
hours_since = max(0.1, (now_dt - last).total_seconds() / 3600)
|
||||
recency = max(0.1, 1.0 / (1.0 + hours_since / (RECENCY_HALF_LIFE_DAYS * 24)))
|
||||
except (ValueError, TypeError):
|
||||
recency = 0.5
|
||||
|
||||
# Reliability factor: based on access pattern consistency
|
||||
# (placeholder — full implementation needs access history tracking)
|
||||
reliability = min(1.0, proven / max(1, RELIABILITY_WINDOW))
|
||||
|
||||
# Goal relevance factor: keyword overlap with current goals
|
||||
goal_relevance = 0.5 # default when no goals provided
|
||||
if current_goals:
|
||||
text = entry.get("text", "").lower()
|
||||
goal_words = set()
|
||||
for g in current_goals:
|
||||
goal_words.update(g.lower().split())
|
||||
text_words = set(text.split())
|
||||
overlap = len(goal_words & text_words)
|
||||
goal_relevance = min(1.0, overlap / max(1, len(goal_words) * 0.3))
|
||||
|
||||
# Weighted combination
|
||||
value = (
|
||||
WEIGHT_PROVEN_USES * proven_factor
|
||||
+ WEIGHT_IMPORTANCE * imp
|
||||
+ WEIGHT_RECENCY * recency
|
||||
+ WEIGHT_RELIABILITY * reliability
|
||||
+ WEIGHT_GOAL_RELEVANCE * goal_relevance
|
||||
)
|
||||
|
||||
return round(value, 4)
|
||||
"""STRANGLER EXIT (retired 2026-10-10): authoritative implementation in
|
||||
src/rust/memory_scoring (ms_compute_value — adversarial edges fixed:
|
||||
non-numeric/out-of-domain wash_count ERRORS via the envelope, bool parity
|
||||
preserved). Delegation-only stub; raises if the kernel is absent."""
|
||||
core = _ms_core()
|
||||
if core is None:
|
||||
raise RuntimeError("memory_scoring kernel not built — run the memory_scoring build; the Python oracle was retired")
|
||||
return core.compute_value(entry, current_goals, now if now is not None else _now_iso(None))
|
||||
|
||||
|
||||
# ═══════════════════════════════════════════════════════════════════════════════
|
||||
@@ -180,22 +143,13 @@ def check_promotion_eligibility(entry: dict) -> Tuple[bool, str]:
|
||||
|
||||
def _py_check_promotion_eligibility(entry: dict,
|
||||
now: str | None = None) -> Tuple[bool, str]:
|
||||
"""Python core of check_promotion_eligibility (parity oracle)."""
|
||||
wash = entry.get("wash_count", 0) or 0
|
||||
status = entry.get("rock_status", "washable")
|
||||
|
||||
if status == "rock":
|
||||
return False, "already rock"
|
||||
|
||||
if wash < PROVEN_USES_THRESHOLD:
|
||||
return False, f"proven_uses {wash} < threshold {PROVEN_USES_THRESHOLD}"
|
||||
|
||||
value = _py_compute_value(entry, now=now)
|
||||
if value < 0.6:
|
||||
return False, f"value {value:.3f} < 0.6 minimum"
|
||||
|
||||
return True, f"wash_count={wash}, value={value:.3f}"
|
||||
|
||||
"""STRANGLER EXIT (retired 2026-10-10): authoritative implementation in
|
||||
src/rust/memory_scoring (ms_check_promotion_eligibility). Delegation-only
|
||||
stub; raises if the kernel is absent."""
|
||||
core = _ms_core()
|
||||
if core is None:
|
||||
raise RuntimeError("memory_scoring kernel not built — run the memory_scoring build; the Python oracle was retired")
|
||||
return core.check_promotion_eligibility(entry, now if now is not None else _now_iso(None))
|
||||
|
||||
def promote_entry(db, entry_id: int) -> dict:
|
||||
"""Promote an entry through the lifecycle: washable → established → rock.
|
||||
|
||||
+9
-11
@@ -170,17 +170,15 @@ def recall(context, limit=4):
|
||||
|
||||
|
||||
def _py_pin_recall(recs, term, limit=4):
|
||||
out = []
|
||||
for rec in recs:
|
||||
if rec.get("state") != "open":
|
||||
continue
|
||||
p = _project(rec)
|
||||
if term in p["topic"].lower() or term in p["context"].lower():
|
||||
out.append(p)
|
||||
if len(out) >= limit:
|
||||
break
|
||||
return out
|
||||
|
||||
"""STRANGLER EXIT (retired 2026-10-10): authoritative implementation in
|
||||
src/rust/cognition_core (cc_pins_recall — parity proven against the frozen
|
||||
oracle in frozen_pins_recall.json, real pin shapes). Delegation-only stub;
|
||||
raises if the kernel is absent (no silent second implementation)."""
|
||||
from rune.identity_anchors import _cc_core
|
||||
core = _cc_core()
|
||||
if core is None:
|
||||
raise RuntimeError("cognition_core kernel not built — run the cognition_core build; the Python oracle was retired")
|
||||
return core.pins_recall(recs, term, limit)
|
||||
|
||||
def list_pins(open_only=False, limit=30):
|
||||
"""The pinboard: all pins (open + resolved) by default, newest first."""
|
||||
|
||||
@@ -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.156.2
|
||||
Version: v0.170.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.156.2 | Textual TUI | {len(loaded)} native modules[/dim]",
|
||||
f"[dim]Rune v0.170.0 | Textual TUI | {len(loaded)} native modules[/dim]",
|
||||
)
|
||||
|
||||
# Auto-show night mode suggestion if evening/night hours
|
||||
|
||||
+32
-349
@@ -461,176 +461,14 @@ def _deployed_source_files() -> list[str]:
|
||||
|
||||
|
||||
def _py_build_from_inputs(inputs: dict) -> dict:
|
||||
"""Deterministic full projection from GATHERED inputs. Same inputs →
|
||||
byte-identical doc (modulo generated_at). This is the Python core; the
|
||||
Rust core (project.rs) must produce structurally identical output."""
|
||||
doc = new_doc()
|
||||
ts = inputs["now"]
|
||||
|
||||
# 1. subsystem structure — from the Spine store if it already owns
|
||||
# membership (Phase B+), else from the manual manifest (Phase A).
|
||||
existing = inputs["existing"]
|
||||
seeded = False
|
||||
if existing:
|
||||
rels = [r for r in existing["relationships"] if r["type"] == "belongs_to"]
|
||||
if rels:
|
||||
seeded = True
|
||||
# CARRY EVERYTHING FORWARD — open-world requirement. Filtering
|
||||
# by known kinds/types here would silently destroy tasks,
|
||||
# contracts, capabilities, and any future entity class on every
|
||||
# refresh (the exact TOO-CLOSED failure the contract forbids;
|
||||
# observed live: task bindings vanished through build()).
|
||||
# Module-level facts (imports, tests, maturity) are RE-DERIVED
|
||||
# below onto the carried state; everything else passes through.
|
||||
doc["entities"].extend(json.loads(json.dumps(existing["entities"])))
|
||||
doc["relationships"].extend(json.loads(json.dumps(existing["relationships"])))
|
||||
doc["observations"].extend(json.loads(json.dumps(existing.get("observations", []))))
|
||||
if not seeded:
|
||||
mp = inputs.get("manifest_path")
|
||||
if inputs.get("manifest") is not None and not mp:
|
||||
# gather-supplied manifest data (the Rust-parity path): ingest
|
||||
# the dict directly — no file to re-read
|
||||
_ingest_umbrellas_data(doc, inputs["manifest"])
|
||||
else:
|
||||
# through the PUBLIC ingest_umbrellas (reads + raises like the
|
||||
# original build; monkeypatchable for isolation tests)
|
||||
ingest_umbrellas(doc, Path(mp) if mp else None)
|
||||
|
||||
# 2. module-level structural facts from actual code
|
||||
graph = inputs["graph"]
|
||||
registry = inputs["registry"]
|
||||
tested = set(inputs["tested"])
|
||||
present = set(inputs["present_modules"])
|
||||
mods = {e["id"].split(":", 1)[1] for e in doc["entities"] if e["kind"] == "module"}
|
||||
# T21.4 §21.4G: the ENTRY POINT is invisible to the import graph
|
||||
# (nothing imports __main__) but is a real runtime path — seed it
|
||||
# deterministically whenever the file exists.
|
||||
if inputs["main_present"] and "__main__" not in mods:
|
||||
add_entity(
|
||||
doc,
|
||||
id="module:__main__",
|
||||
kind="module",
|
||||
maturity="PRESENT",
|
||||
identities={"path": "src/rune/__main__.py", "role": "TUI entry point (python3 -m rune)"},
|
||||
evidence_refs=["entry-point:python3 -m rune"],
|
||||
)
|
||||
mods.add("__main__")
|
||||
for m in sorted(mods):
|
||||
mid = f"module:{m}"
|
||||
e = entity(doc, mid)
|
||||
|
||||
# Re-derivation uses the HIGH-WATER path (add_entity upgrades only,
|
||||
# never logs): fresh evidence may be lower than the store's earned
|
||||
# state on any given pass, and that is not a demotion event — it is
|
||||
# a build. Explicit promote() logging is for evidence-gated API calls.
|
||||
def _derive(state: str, ev: str) -> None:
|
||||
add_entity(doc, id=mid, kind="module", maturity=state, evidence_refs=[ev])
|
||||
|
||||
if m in present:
|
||||
assert e is not None # membership loop guarantees presence
|
||||
e["identities"]["source"] = f"src/rune/{m}.py"
|
||||
_derive("PRESENT", f"source:{m}.py")
|
||||
consumers = sorted(c for c, deps in graph.items() if m in deps and c != m)
|
||||
deps = sorted(d for d in graph.get(m, []) if d in mods and d != m)
|
||||
for c in consumers:
|
||||
rel = add_relationship(
|
||||
doc, type="consumed_by", from_id=mid, to_id=f"module:{c}", evidence_refs=[f"ast-import:{m}"]
|
||||
)
|
||||
_authority_observed(doc, rel, "ast-import-projector")
|
||||
for d in deps:
|
||||
rel = add_relationship(
|
||||
doc, type="depends_on", from_id=mid, to_id=f"module:{d}", evidence_refs=[f"ast-import:{m}"]
|
||||
)
|
||||
_authority_observed(doc, rel, "ast-import-projector")
|
||||
# WIRED: importers exist, or registry wiring (canary registry)
|
||||
if consumers or m in registry:
|
||||
_derive("WIRED", f"ast-imports:{len(consumers)}" if consumers else "canary-registry")
|
||||
# EXERCISED: dedicated test or canary exercise
|
||||
if m in tested:
|
||||
_derive("EXERCISED", f"tests/test_{m}.py")
|
||||
elif m in registry:
|
||||
_derive("EXERCISED", "canary-registry-exercise")
|
||||
|
||||
# 3. runtime/deployment observation (dynamic, bounded)
|
||||
obs = inputs["deployed_obs"]
|
||||
if obs:
|
||||
_authority_observed(doc, None, "deploy-identity-projector") # generation bump
|
||||
deployed_sources = set(inputs["deployed_sources"])
|
||||
dep = add_entity(
|
||||
doc,
|
||||
id="deployment:current",
|
||||
kind="deployment_surface",
|
||||
identities=obs,
|
||||
evidence_refs=["_build_identity.json"],
|
||||
maturity="LIVE_PROVEN",
|
||||
)
|
||||
for e in doc["entities"]:
|
||||
if e["kind"] == "module" and e["identities"].get("source", "") in deployed_sources:
|
||||
rel = add_relationship(
|
||||
doc,
|
||||
type="deployed_as",
|
||||
from_id=e["id"],
|
||||
to_id="deployment:current",
|
||||
evidence_refs=[f"deployed-tree:{obs['deployed_sha']}"],
|
||||
)
|
||||
_authority_observed(doc, rel, "deploy-identity-projector")
|
||||
doc["observations"].append({"kind": "deployed_identity", **obs, "observed_at": ts})
|
||||
|
||||
# 4. meta-scaffold surface projection (H-meta): rust crates, Go
|
||||
# surfaces, configs, workflows — every part of rune modeled.
|
||||
projected = project_meta_surfaces(doc, inputs)
|
||||
if projected:
|
||||
_authority_observed(doc, None, "meta-surface-projector")
|
||||
|
||||
# 4b. manifest canaries as first-class entities (H-meta): the seeded
|
||||
# path skips ingest, and ingest only made the EDGE — the canary
|
||||
# entity itself was never created, leaving obligated_canary edges
|
||||
# pointing at nothing (observed live: zero canary entities in the
|
||||
# spine before this projector).
|
||||
manifest = inputs.get("config_manifest")
|
||||
if manifest:
|
||||
canary_files = set(inputs["canary_files"])
|
||||
for name, u in manifest.get("umbrellas", {}).items():
|
||||
for canary in u.get("canaries", []):
|
||||
mid = f"module:{canary}"
|
||||
add_entity(
|
||||
doc,
|
||||
id=mid,
|
||||
kind="module",
|
||||
tags=["code", "canary"],
|
||||
identities={"source": f"src/rune/{canary}.py"},
|
||||
evidence_refs=[f"umbrella-manifest#{name}"],
|
||||
maturity="PRESENT" if canary in canary_files else "DECLARED",
|
||||
)
|
||||
add_relationship(
|
||||
doc,
|
||||
type="obligated_canary",
|
||||
from_id=f"subsystem:{name}",
|
||||
to_id=mid,
|
||||
evidence_refs=[f"umbrella-manifest#{name}"],
|
||||
)
|
||||
|
||||
# reconcile: facts owned by projectors that no longer observe them
|
||||
# become STALE (marked, never deleted — history survives; open-world
|
||||
# preservation applies to everything, staleness is the truth marker)
|
||||
staled = reconcile_authorities(doc)
|
||||
for s in staled:
|
||||
doc["observations"].append({"kind": "fact_staled", **s, "observed_at": ts})
|
||||
|
||||
# exact-duplicate observation suppression (carry-forward + this pass
|
||||
# both record deployed_identity etc.); distinct repeats are history
|
||||
seen_obs = set()
|
||||
unique_obs = []
|
||||
for o in doc["observations"]:
|
||||
key = json.dumps(_sorted(o), sort_keys=True)
|
||||
if key not in seen_obs:
|
||||
seen_obs.add(key)
|
||||
unique_obs.append(o)
|
||||
doc["observations"] = unique_obs
|
||||
doc["generated_at"] = ts
|
||||
return doc
|
||||
|
||||
|
||||
"""STRANGLER EXIT (retired 2026-10-10): authoritative implementation in
|
||||
src/rust/rune_spine (parity proven against the frozen oracle in
|
||||
frozen_spine_oracle.json). Delegation-only stub; raises if the kernel
|
||||
is absent (no silent second implementation)."""
|
||||
core = _rust_core()
|
||||
if core is None:
|
||||
raise RuntimeError("rune_spine kernel not built — run the rune_spine build; the Python oracle was retired")
|
||||
return core.project(inputs)
|
||||
def _ingest_umbrellas_data(doc: dict, data: dict) -> int:
|
||||
"""The original ingest_umbrellas with the file read lifted out (H3-spine
|
||||
gather boundary). Raises ValueError on a Spine-generated view, exactly
|
||||
@@ -742,100 +580,14 @@ def _gather_drift_inputs() -> dict:
|
||||
|
||||
|
||||
def _py_drift_from_inputs(doc: dict, inputs: dict) -> list[dict]:
|
||||
"""Architectural drift classes from GATHERED inputs. Python core; the
|
||||
Rust core (drift.rs) must produce identical output on the same inputs."""
|
||||
out = []
|
||||
graph = inputs["graph"]
|
||||
registry = inputs["registry"]
|
||||
tested = set(inputs["tested"])
|
||||
mods = {e["id"].split(":", 1)[1] for e in doc["entities"] if e["kind"] == "module"}
|
||||
|
||||
# 1. registered but absent (canary registry names a non-existent module)
|
||||
for m in registry:
|
||||
if m not in mods:
|
||||
out.append(
|
||||
{
|
||||
"class": "registered_but_absent",
|
||||
"entity": f"module:{m}",
|
||||
"detail": "in canary registry, no source file",
|
||||
}
|
||||
)
|
||||
|
||||
# 2. present but unowned (runtime source file outside every subsystem).
|
||||
# Excludes canary files (governed by the canary contract, not umbrella
|
||||
# membership) and package plumbing (__init__/__main__).
|
||||
for stem in inputs["src_stems"]:
|
||||
if stem.startswith(("canary_", "__")):
|
||||
continue
|
||||
if stem not in mods:
|
||||
out.append(
|
||||
{
|
||||
"class": "present_but_unowned",
|
||||
"entity": f"module:{stem}",
|
||||
"detail": "src/rune runtime module with no subsystem membership",
|
||||
}
|
||||
)
|
||||
|
||||
# 3. registered but no static importers — OBSERVATION, not a death
|
||||
# verdict: registry dispatch and entry points wire dynamically
|
||||
# (task_gate via capability_broker, rune_tui via entry point).
|
||||
# Interpretation belongs to cognition; Spine reports the fact.
|
||||
for m in sorted(mods & set(registry)):
|
||||
importers = [c for c, deps in graph.items() if m in deps and c != m]
|
||||
if not importers:
|
||||
dyn = "no dedicated test either" if m not in tested else "dedicated test exists"
|
||||
out.append(
|
||||
{
|
||||
"class": "registered_no_static_importers",
|
||||
"entity": f"module:{m}",
|
||||
"detail": f"zero static importers; dynamic wiring possible; {dyn}",
|
||||
}
|
||||
)
|
||||
|
||||
# 4. deployed identity drift (source version vs deployment authority)
|
||||
obs = inputs["deployed_obs"]
|
||||
src_version = inputs["src_version"]
|
||||
if obs and src_version and obs["deployed_version"] != src_version:
|
||||
out.append(
|
||||
{
|
||||
"class": "version_surfaces_disagree",
|
||||
"detail": f"source {src_version} != deployed {obs['deployed_version']}",
|
||||
}
|
||||
)
|
||||
|
||||
# 4b. evidence staleness (adapter freshness): maturity claims whose
|
||||
# evidence references predate the current store generation are STALE
|
||||
# observations, never silently current — "not checked" != "healthy".
|
||||
for e in doc["entities"]:
|
||||
if e.get("maturity") in ("EXERCISED", "LIVE_PROVEN") and not e.get("evidence_refs"):
|
||||
out.append(
|
||||
{
|
||||
"class": "evidence_conflict",
|
||||
"entity": e["id"],
|
||||
"detail": f"claims {e['maturity']} with zero evidence refs",
|
||||
}
|
||||
)
|
||||
|
||||
# 4c. stale facts — owned by an authority that no longer observes them
|
||||
for rel in doc["relationships"]:
|
||||
if rel.get("status") == "STALE":
|
||||
out.append(
|
||||
{
|
||||
"class": "stale_fact",
|
||||
"entity": f"{rel['from']}->{rel['to']}",
|
||||
"detail": f"{rel['type']} edge; authority {rel.get('authority')} no longer observes it",
|
||||
}
|
||||
)
|
||||
|
||||
# 5. relationship disappeared (store claims consumers that no longer import)
|
||||
for r in relationships(doc, type="consumed_by"):
|
||||
m = r["from"].split(":", 1)[1]
|
||||
c = r["to"].split(":", 1)[1]
|
||||
if m not in graph.get(c, set()):
|
||||
out.append({"class": "relationship_disappeared", "detail": f"{c} no longer imports {m} (stale store edge)"})
|
||||
return out
|
||||
|
||||
|
||||
"""STRANGLER EXIT (retired 2026-10-10): authoritative implementation in
|
||||
src/rust/rune_spine (parity proven against the frozen oracle in
|
||||
frozen_spine_oracle.json). Delegation-only stub; raises if the kernel
|
||||
is absent (no silent second implementation)."""
|
||||
core = _rust_core()
|
||||
if core is None:
|
||||
raise RuntimeError("rune_spine kernel not built — run the rune_spine build; the Python oracle was retired")
|
||||
return core.drift(doc, inputs)
|
||||
def drift(doc: dict) -> list[dict]:
|
||||
"""Architectural drift classes. Reuses authorities' verdicts; never
|
||||
duplicates their logic. Deterministic output. H3-spine: gathers the
|
||||
@@ -865,63 +617,14 @@ def snapshot(doc: dict, label: str = "") -> Path:
|
||||
|
||||
|
||||
def _py_export_umbrellas(doc: dict) -> dict:
|
||||
"""Python core of export_umbrellas (H3-spine: the Rust core in query.rs
|
||||
must produce identical output modulo generated_at)."""
|
||||
umbrellas: dict = {}
|
||||
for e in doc["entities"]:
|
||||
if e["kind"] != "subsystem":
|
||||
continue
|
||||
name = e["id"].split(":", 1)[1]
|
||||
umbrellas[name] = {
|
||||
"description": e["identities"].get("description", ""),
|
||||
"modules": [],
|
||||
"depends_on": [],
|
||||
"mirrors": [],
|
||||
}
|
||||
# faithful reproduction: emit canaries only when the ingested
|
||||
# authority carried them (the legacy contract omits empty lists)
|
||||
if e.get("ext", {}).get("canaries"):
|
||||
umbrellas[name]["canaries"] = sorted(e["ext"]["canaries"])
|
||||
for r in doc["relationships"]:
|
||||
if r["type"] == "belongs_to" and r["from"].startswith("module:"):
|
||||
mod = r["from"].split(":", 1)[1]
|
||||
# #416 decision: dunder modules (__init__, __main__) are not
|
||||
# umbrella-coverage surface — the coverage gate excludes
|
||||
# canary_/test_/__-prefixed stems, and the view must agree with
|
||||
# the gate or regeneration stays an unrunnable repair.
|
||||
if mod.startswith("_"):
|
||||
continue
|
||||
sub = r["to"].split(":", 1)[1]
|
||||
if sub in umbrellas:
|
||||
umbrellas[sub]["modules"].append(r["from"].split(":", 1)[1])
|
||||
elif r["type"] == "depends_on" and r["from"].startswith("subsystem:"):
|
||||
sub = r["from"].split(":", 1)[1]
|
||||
if sub in umbrellas:
|
||||
umbrellas[sub]["depends_on"].append(r["to"].split(":", 1)[1])
|
||||
elif r["type"] == "mirrors" and r["from"].startswith("subsystem:"):
|
||||
sub = r["from"].split(":", 1)[1]
|
||||
if sub in umbrellas:
|
||||
umbrellas[sub]["mirrors"].append(r["to"].split(":", 1)[1])
|
||||
elif r["type"] == "obligated_canary" and r["from"].startswith("subsystem:"):
|
||||
sub = r["from"].split(":", 1)[1]
|
||||
if sub in umbrellas:
|
||||
umbrellas[sub]["canaries"].append(r["to"].split(":", 1)[1])
|
||||
for u in umbrellas.values():
|
||||
u["modules"].sort()
|
||||
u["depends_on"].sort()
|
||||
u["mirrors"].sort()
|
||||
if "canaries" in u:
|
||||
u["canaries"].sort()
|
||||
return {
|
||||
"_comment": "GENERATED by rune.spine — compatibility view for legacy "
|
||||
"umbrella consumers. DO NOT EDIT: structural truth lives in "
|
||||
"store/spine/current.json; edits here are flagged by spine drift.",
|
||||
GENERATED_VIEW_MARKER: True,
|
||||
"generated_at": now(),
|
||||
"umbrellas": dict(sorted(umbrellas.items())),
|
||||
}
|
||||
|
||||
|
||||
"""STRANGLER EXIT (retired 2026-10-10): authoritative implementation in
|
||||
src/rust/rune_spine (parity proven against the frozen oracle in
|
||||
frozen_spine_oracle.json). Delegation-only stub; raises if the kernel
|
||||
is absent (no silent second implementation)."""
|
||||
core = _rust_core()
|
||||
if core is None:
|
||||
raise RuntimeError("rune_spine kernel not built — run the rune_spine build; the Python oracle was retired")
|
||||
return core.export_umbrellas(doc, now())
|
||||
def export_umbrellas(doc: dict) -> dict:
|
||||
"""Generate the legacy umbrella view FROM Spine. Output only — the old
|
||||
consumers (CI gate, henxels) read this during migration. Never ingest.
|
||||
@@ -978,34 +681,14 @@ def query(doc: dict, entity_id: str) -> dict:
|
||||
|
||||
|
||||
def _py_query(doc: dict, entity_id: str) -> dict:
|
||||
"""Python core of query (parity oracle for the Rust core)."""
|
||||
e = entity(doc, entity_id)
|
||||
if e is None:
|
||||
return {"error": "not found", "id": entity_id}
|
||||
return {
|
||||
"id": entity_id,
|
||||
"uri": spine_uri(entity_id),
|
||||
"kind": e["kind"],
|
||||
"owner": [r["to"] for r in relationships(doc, from_id=entity_id, type="belongs_to")],
|
||||
"dependencies": sorted({r["to"] for r in relationships(doc, from_id=entity_id, type="depends_on")}),
|
||||
"consumers": sorted(
|
||||
{r["to"] for r in relationships(doc, from_id=entity_id, type="consumed_by")}
|
||||
| {r["from"] for r in relationships(doc, to_id=entity_id, type="consumed_by")}
|
||||
),
|
||||
"contracts_implements": sorted(r["to"] for r in relationships(doc, from_id=entity_id, type="implements")),
|
||||
"contracts_consumes": sorted(r["to"] for r in relationships(doc, from_id=entity_id, type="consumes")),
|
||||
"state": {
|
||||
"maturity": e.get("maturity"),
|
||||
"observed_at": e.get("observed_at"),
|
||||
"resolved_status": resolve_status(e),
|
||||
"superseded_by": e.get("superseded_by"),
|
||||
"aliases": e.get("aliases", []),
|
||||
},
|
||||
"evidence": e.get("evidence_refs", []),
|
||||
"impact_frontier": impact_frontier(doc, [entity_id]),
|
||||
}
|
||||
|
||||
|
||||
"""STRANGLER EXIT (retired 2026-10-10): authoritative implementation in
|
||||
src/rust/rune_spine (parity proven against the frozen oracle in
|
||||
frozen_spine_oracle.json). Delegation-only stub; raises if the kernel
|
||||
is absent (no silent second implementation)."""
|
||||
core = _rust_core()
|
||||
if core is None:
|
||||
raise RuntimeError("rune_spine kernel not built — run the rune_spine build; the Python oracle was retired")
|
||||
return core.query(doc, entity_id)
|
||||
# ── authority/projector ownership + reconciliation (hardening T3/T4) ──────
|
||||
#
|
||||
# A projected fact carries `authority` = the projector that owns it. On
|
||||
|
||||
+15
-15
@@ -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)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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": []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
{
|
||||
"_doc": "FROZEN ORACLE (pins exit) \u2014 REAL pin shapes (context inside details).",
|
||||
"recs": [
|
||||
{
|
||||
"item_id": "alpha exit",
|
||||
"state": "open",
|
||||
"details": "{\"question\": \"q1\", \"outcome\": \"o1\", \"context\": \"ctx one\", \"reason\": \"\", \"source\": \"session\"}"
|
||||
},
|
||||
{
|
||||
"item_id": "beta",
|
||||
"state": "resolved",
|
||||
"details": "{\"question\": \"q2\", \"outcome\": \"o2\", \"context\": \"exit here\", \"reason\": \"\", \"source\": \"session\"}"
|
||||
},
|
||||
{
|
||||
"item_id": "gamma",
|
||||
"state": "open",
|
||||
"details": "{\"question\": \"q3\", \"outcome\": \"o3\", \"context\": \"\", \"reason\": \"\", \"source\": \"session\"}"
|
||||
},
|
||||
{
|
||||
"item_id": "delta",
|
||||
"state": "open",
|
||||
"details": "{\"question\": \"q4\", \"outcome\": \"o4\", \"context\": \"exit context here\", \"reason\": \"\", \"source\": \"session\"}"
|
||||
}
|
||||
],
|
||||
"rows": [
|
||||
{
|
||||
"term": "exit",
|
||||
"limit": 4,
|
||||
"want": [
|
||||
{
|
||||
"topic": "alpha exit",
|
||||
"question": "q1",
|
||||
"outcome": "o1",
|
||||
"context": "ctx one",
|
||||
"status": "open",
|
||||
"reason": ""
|
||||
},
|
||||
{
|
||||
"topic": "delta",
|
||||
"question": "q4",
|
||||
"outcome": "o4",
|
||||
"context": "exit context here",
|
||||
"status": "open",
|
||||
"reason": ""
|
||||
}
|
||||
],
|
||||
"rust": [
|
||||
{
|
||||
"topic": "alpha exit",
|
||||
"question": "q1",
|
||||
"outcome": "o1",
|
||||
"context": "ctx one",
|
||||
"status": "open",
|
||||
"reason": ""
|
||||
},
|
||||
{
|
||||
"topic": "delta",
|
||||
"question": "q4",
|
||||
"outcome": "o4",
|
||||
"context": "exit context here",
|
||||
"status": "open",
|
||||
"reason": ""
|
||||
}
|
||||
],
|
||||
"match": true
|
||||
},
|
||||
{
|
||||
"term": "exit",
|
||||
"limit": 1,
|
||||
"want": [
|
||||
{
|
||||
"topic": "alpha exit",
|
||||
"question": "q1",
|
||||
"outcome": "o1",
|
||||
"context": "ctx one",
|
||||
"status": "open",
|
||||
"reason": ""
|
||||
}
|
||||
],
|
||||
"rust": [
|
||||
{
|
||||
"topic": "alpha exit",
|
||||
"question": "q1",
|
||||
"outcome": "o1",
|
||||
"context": "ctx one",
|
||||
"status": "open",
|
||||
"reason": ""
|
||||
}
|
||||
],
|
||||
"match": true
|
||||
},
|
||||
{
|
||||
"term": "alpha",
|
||||
"limit": 4,
|
||||
"want": [
|
||||
{
|
||||
"topic": "alpha exit",
|
||||
"question": "q1",
|
||||
"outcome": "o1",
|
||||
"context": "ctx one",
|
||||
"status": "open",
|
||||
"reason": ""
|
||||
}
|
||||
],
|
||||
"rust": [
|
||||
{
|
||||
"topic": "alpha exit",
|
||||
"question": "q1",
|
||||
"outcome": "o1",
|
||||
"context": "ctx one",
|
||||
"status": "open",
|
||||
"reason": ""
|
||||
}
|
||||
],
|
||||
"match": true
|
||||
},
|
||||
{
|
||||
"term": "zzz",
|
||||
"limit": 4,
|
||||
"want": [],
|
||||
"rust": [],
|
||||
"match": true
|
||||
},
|
||||
{
|
||||
"term": "context",
|
||||
"limit": 4,
|
||||
"want": [
|
||||
{
|
||||
"topic": "delta",
|
||||
"question": "q4",
|
||||
"outcome": "o4",
|
||||
"context": "exit context here",
|
||||
"status": "open",
|
||||
"reason": ""
|
||||
}
|
||||
],
|
||||
"rust": [
|
||||
{
|
||||
"topic": "delta",
|
||||
"question": "q4",
|
||||
"outcome": "o4",
|
||||
"context": "exit context here",
|
||||
"status": "open",
|
||||
"reason": ""
|
||||
}
|
||||
],
|
||||
"match": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
{
|
||||
"_doc": "FROZEN ORACLE (drift_core exit).",
|
||||
"rows": [
|
||||
{
|
||||
"name": "cv0",
|
||||
"entry": {
|
||||
"wash_count": 0,
|
||||
"importance": 0.5,
|
||||
"last_accessed": null
|
||||
},
|
||||
"want": 0.375,
|
||||
"rust": 0.375,
|
||||
"match": true
|
||||
},
|
||||
{
|
||||
"name": "cv1",
|
||||
"entry": {
|
||||
"wash_count": 25,
|
||||
"importance": 0.9,
|
||||
"last_accessed": "2026-10-09T00:00:00+00:00"
|
||||
},
|
||||
"want": 0.8405,
|
||||
"rust": 0.8405,
|
||||
"match": true
|
||||
},
|
||||
{
|
||||
"name": "cv2",
|
||||
"entry": {
|
||||
"wash_count": 5,
|
||||
"importance": 0.3,
|
||||
"last_accessed": "2026-06-01T00:00:00+00:00",
|
||||
"text": "memory about rust kernels"
|
||||
},
|
||||
"want": 0.3537,
|
||||
"rust": 0.3537,
|
||||
"match": true
|
||||
},
|
||||
{
|
||||
"name": "cv3",
|
||||
"entry": {
|
||||
"wash_count": 100,
|
||||
"importance": 1.0,
|
||||
"last_accessed": "2026-10-10T11:00:00+00:00",
|
||||
"text": "rust kernels and memory"
|
||||
},
|
||||
"want": 0.9497,
|
||||
"rust": 0.9497,
|
||||
"match": true
|
||||
},
|
||||
{
|
||||
"name": "cv_goals",
|
||||
"entry": {
|
||||
"wash_count": 5,
|
||||
"importance": 0.3,
|
||||
"last_accessed": "2026-06-01T00:00:00+00:00",
|
||||
"text": "memory about rust kernels"
|
||||
},
|
||||
"goals": [
|
||||
"rust kernels"
|
||||
],
|
||||
"want": 0.4037,
|
||||
"rust": 0.4037,
|
||||
"match": true
|
||||
}
|
||||
],
|
||||
"promotion_rows": [
|
||||
{
|
||||
"name": "pe_0_washable",
|
||||
"entry": {
|
||||
"wash_count": 0,
|
||||
"rock_status": "washable",
|
||||
"importance": 0.7,
|
||||
"last_accessed": "2026-10-09T00:00:00+00:00"
|
||||
},
|
||||
"want": [
|
||||
false,
|
||||
"proven_uses 0 < threshold 20"
|
||||
],
|
||||
"rust": [
|
||||
false,
|
||||
"proven_uses 0 < threshold 20"
|
||||
],
|
||||
"match": true
|
||||
},
|
||||
{
|
||||
"name": "pe_5_washable",
|
||||
"entry": {
|
||||
"wash_count": 5,
|
||||
"rock_status": "washable",
|
||||
"importance": 0.7,
|
||||
"last_accessed": "2026-10-09T00:00:00+00:00"
|
||||
},
|
||||
"want": [
|
||||
false,
|
||||
"proven_uses 5 < threshold 20"
|
||||
],
|
||||
"rust": [
|
||||
false,
|
||||
"proven_uses 5 < threshold 20"
|
||||
],
|
||||
"match": true
|
||||
},
|
||||
{
|
||||
"name": "pe_25_washable",
|
||||
"entry": {
|
||||
"wash_count": 25,
|
||||
"rock_status": "washable",
|
||||
"importance": 0.7,
|
||||
"last_accessed": "2026-10-09T00:00:00+00:00"
|
||||
},
|
||||
"want": [
|
||||
true,
|
||||
"wash_count=25, value=0.790"
|
||||
],
|
||||
"rust": [
|
||||
true,
|
||||
"wash_count=25, value=0.790"
|
||||
],
|
||||
"match": true
|
||||
},
|
||||
{
|
||||
"name": "pe_10_rock",
|
||||
"entry": {
|
||||
"wash_count": 10,
|
||||
"rock_status": "rock",
|
||||
"importance": 0.7,
|
||||
"last_accessed": "2026-10-09T00:00:00+00:00"
|
||||
},
|
||||
"want": [
|
||||
false,
|
||||
"already rock"
|
||||
],
|
||||
"rust": [
|
||||
false,
|
||||
"already rock"
|
||||
],
|
||||
"match": true
|
||||
},
|
||||
{
|
||||
"name": "pe_30_washable",
|
||||
"entry": {
|
||||
"wash_count": 30,
|
||||
"rock_status": "washable",
|
||||
"importance": 0.7,
|
||||
"last_accessed": "2026-10-09T00:00:00+00:00"
|
||||
},
|
||||
"want": [
|
||||
true,
|
||||
"wash_count=30, value=0.805"
|
||||
],
|
||||
"rust": [
|
||||
true,
|
||||
"wash_count=30, value=0.805"
|
||||
],
|
||||
"match": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -70,6 +70,9 @@ pub extern "C" fn ms_compute_value(arg: *const c_char) -> *mut c_char {
|
||||
let now = get_str(&a, "now").ok_or("arg.now required")?.to_string();
|
||||
let goals = get(&a, "goals").cloned();
|
||||
let v = scoring::compute_value(&entry, goals.as_ref(), &now);
|
||||
if !v.is_finite() {
|
||||
return Err("compute_value: non-numeric or out-of-domain wash_count (oracle: TypeError/ValueError)".to_string());
|
||||
}
|
||||
Ok(pyjson::Json::Num(v))
|
||||
});
|
||||
envelope(result)
|
||||
|
||||
@@ -37,6 +37,9 @@ fn obj_get<'a>(v: &'a Json, key: &str) -> Option<&'a Json> {
|
||||
fn as_num(v: Option<&Json>) -> Option<f64> {
|
||||
match v {
|
||||
Some(Json::Num(n)) => Some(*n),
|
||||
// Python bool IS int (True==1): log1p(True) works. Parity demands it.
|
||||
Some(Json::Bool(true)) => Some(1.0),
|
||||
Some(Json::Bool(false)) => Some(0.0),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
@@ -148,9 +151,26 @@ pub fn parse_iso(s: &str) -> Option<f64> {
|
||||
// ── compute_value ───────────────────────────────────────────────────────────
|
||||
|
||||
pub fn compute_value(entry: &Json, goals: Option<&Json>, now_iso: &str) -> f64 {
|
||||
// TYPE PARITY: Python raises TypeError on non-numeric wash_count
|
||||
// (log1p on a str). A string/bool/object wash_count must error, not
|
||||
// silently default to 0.0.
|
||||
if let Some(wc) = obj_get(entry, "wash_count") {
|
||||
match wc {
|
||||
Json::Num(_) | Json::Null | Json::Bool(_) => {}
|
||||
_ => return f64::NAN,
|
||||
}
|
||||
}
|
||||
let proven = num_or(obj_get(entry, "wash_count"), 0.0);
|
||||
let imp = num_or(obj_get(entry, "importance"), 0.5);
|
||||
|
||||
// ORACLE PARITY (adversarial edges, test_constitutional_adversarial):
|
||||
// Python log1p raises TypeError on non-numbers and ValueError on
|
||||
// proven <= -1. The envelope must ERROR, never silently score.
|
||||
// (NaN.min(1.0) == 1.0 in Rust would INVERT the edge: negative wash
|
||||
// counts would score proven_factor=MAX. Fail loud instead.)
|
||||
if !proven.is_finite() || proven <= -1.0 {
|
||||
return f64::NAN; // sentinel: the FFI layer converts to Err
|
||||
}
|
||||
let proven_factor = (proven.ln_1p() / PROVEN_USES_THRESHOLD.ln_1p()).min(1.0);
|
||||
|
||||
let mut recency = 1.0;
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
{
|
||||
"_doc": "DICHOTOMY DEBT (dichotomy_language_verdict D2): pre-existing ported-but-never-delegated facades. Tracked debt \u2014 the list ONLY shrinks; new facades fail the henxels gate. Each entry is wired off per the dichotomy tranche batches.",
|
||||
"updated": "2026-10-10",
|
||||
"facades": [
|
||||
"attention_capsule",
|
||||
"build_basis",
|
||||
"cache",
|
||||
"capability_ledger",
|
||||
"cognitive_budgeter",
|
||||
"construction_activation",
|
||||
"construction_commands",
|
||||
"construction_depth",
|
||||
"construction_intent",
|
||||
"construction_interface",
|
||||
"construction_mode",
|
||||
"construction_pattern",
|
||||
"construction_patterns_builtin",
|
||||
"construction_projection",
|
||||
"context_pressure",
|
||||
"contracts",
|
||||
"dependency_tracker",
|
||||
"drift_cache",
|
||||
"drift_ledger",
|
||||
"drift_observability",
|
||||
"drift_resume",
|
||||
"failure_recovery",
|
||||
"graph_memory",
|
||||
"graph_projection",
|
||||
"impact_preview",
|
||||
"inference_trace",
|
||||
"intent_continuity",
|
||||
"iteration",
|
||||
"layout_contract",
|
||||
"memory_selector",
|
||||
"microkernel",
|
||||
"outcome_ledger",
|
||||
"programme_continuation",
|
||||
"programme_gates",
|
||||
"progressive_escalation",
|
||||
"project_registry",
|
||||
"prompt_sync",
|
||||
"recall_uplift",
|
||||
"response_adapter",
|
||||
"route_risk_flags",
|
||||
"rune_profiler",
|
||||
"rune_spinner",
|
||||
"salience_gate",
|
||||
"scaffold",
|
||||
"self_improve",
|
||||
"shard_manager",
|
||||
"structural_migration",
|
||||
"structural_model",
|
||||
"structural_store",
|
||||
"subconscious_pass",
|
||||
"system_registry",
|
||||
"task_gate",
|
||||
"task_persist",
|
||||
"testing_mode",
|
||||
"time_awareness",
|
||||
"toolchain",
|
||||
"voice_hybrid",
|
||||
"voice_sync",
|
||||
"voicebox",
|
||||
"wait_guard",
|
||||
"wait_guard_corpus",
|
||||
"warm_neuron_store"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
{
|
||||
"_doc": "DICHOTOMY RATCHET (dichotomy_language_verdict D3): the floor of ported modules. Never decreases; every dichotomy batch extends it. A ratcheted module whose kernel directory disappears fails the henxels gate.",
|
||||
"updated": "2026-10-10",
|
||||
"ported": [
|
||||
"abstraction",
|
||||
"attention_capsule",
|
||||
"audit_ledger",
|
||||
"behavior",
|
||||
"behaviour_ledger",
|
||||
"build_basis",
|
||||
"cache",
|
||||
"capability_broker",
|
||||
"capability_fit",
|
||||
"capability_ledger",
|
||||
"claim_audit",
|
||||
"cognitive_budgeter",
|
||||
"construction_activation",
|
||||
"construction_commands",
|
||||
"construction_decision",
|
||||
"construction_depth",
|
||||
"construction_intent",
|
||||
"construction_interface",
|
||||
"construction_mode",
|
||||
"construction_pattern",
|
||||
"construction_patterns_builtin",
|
||||
"construction_projection",
|
||||
"context_pressure",
|
||||
"contracts",
|
||||
"dependency_tracker",
|
||||
"drift_cache",
|
||||
"drift_core",
|
||||
"drift_ledger",
|
||||
"drift_observability",
|
||||
"drift_resume",
|
||||
"failure_recovery",
|
||||
"graph_memory",
|
||||
"graph_projection",
|
||||
"impact_preview",
|
||||
"inference_trace",
|
||||
"intent_continuity",
|
||||
"iteration",
|
||||
"layout_contract",
|
||||
"memory_selector",
|
||||
"microkernel",
|
||||
"outcome_ledger",
|
||||
"pins",
|
||||
"programme_continuation",
|
||||
"programme_gates",
|
||||
"progressive_escalation",
|
||||
"project_registry",
|
||||
"prompt_sync",
|
||||
"recall_uplift",
|
||||
"response_adapter",
|
||||
"route_risk_flags",
|
||||
"rune_profiler",
|
||||
"rune_spinner",
|
||||
"salience_gate",
|
||||
"scaffold",
|
||||
"self_improve",
|
||||
"shard_manager",
|
||||
"spine",
|
||||
"spine_loader",
|
||||
"structural_migration",
|
||||
"structural_model",
|
||||
"structural_store",
|
||||
"subconscious_pass",
|
||||
"system_registry",
|
||||
"task_gate",
|
||||
"task_persist",
|
||||
"testing_mode",
|
||||
"time_awareness",
|
||||
"token_optimizer",
|
||||
"toolchain",
|
||||
"verification_layer",
|
||||
"voice_hybrid",
|
||||
"voice_sync",
|
||||
"voicebox",
|
||||
"wait_guard",
|
||||
"wait_guard_corpus",
|
||||
"warm_neuron_store",
|
||||
"witness"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"_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"
|
||||
},
|
||||
{
|
||||
"module": "verification_layer",
|
||||
"commit": "b2ac8c85",
|
||||
"evidence": "fully delegated pre-exit (33/33 parity) + demo retired to tests + 12 regression",
|
||||
"date": "2026-10-10"
|
||||
},
|
||||
{
|
||||
"module": "drift_core",
|
||||
"commit": "fd718150",
|
||||
"evidence": "adversarial divergence FIXED pre-exit (NaN.min inversion + silent str default) + frozen 10 rows + 15/15 adversarial + 138 regression",
|
||||
"date": "2026-10-10"
|
||||
},
|
||||
{
|
||||
"module": "pins",
|
||||
"commit": "0a7d0b73",
|
||||
"evidence": "frozen real-shape oracle 5/5 + 207 regression",
|
||||
"date": "2026-10-10"
|
||||
},
|
||||
{
|
||||
"module": "behavior",
|
||||
"commit": "pending",
|
||||
"evidence": "no duplicated logic (math in habitmath.rs, SQL in Python) + parity_behavior 16/16",
|
||||
"date": "2026-10-10"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +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). 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": []
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for __init__ \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "__init__",
|
||||
"why": "Rune \u2014 stateful coding assistant with elastic cognition.",
|
||||
"side": "RUST",
|
||||
"side_evidence": "package init: version/build-info reads only (deterministic metadata)",
|
||||
"laws": [
|
||||
"deterministic pure kernel (no wall clock \u2014 inputs carry time)",
|
||||
"no file IO in kernels (adapter owns persistence)",
|
||||
"FFI envelope ABI (read_arg/arg_json/envelope)",
|
||||
"oracle-first truth battery (Python truth generated FIRST)",
|
||||
"llvm-cov branch coverage + clippy 0"
|
||||
],
|
||||
"parity_means": "Not yet ported. Parity means: kernel in its measured side, oracle-first truth battery, HARD CI gate, delegation wired, then retirement earned.",
|
||||
"status": "not_started"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for __main__ \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "__main__",
|
||||
"why": "Rune TUI \u2014 the body. Entry point for `python3 -m rune`.\"\"\"",
|
||||
"side": "RETIRES",
|
||||
"side_evidence": "bootstrap glue subsumed by the Go runtime env contract",
|
||||
"laws": [
|
||||
"retired \u2014 no replacement; consumers must not import"
|
||||
],
|
||||
"parity_means": "Not yet ported. Parity means: kernel in its measured side, oracle-first truth battery, HARD CI gate, delegation wired, then retirement earned.",
|
||||
"status": "not_started"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for abstraction \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "abstraction",
|
||||
"why": "Abstraction pipeline \u2014 converts raw episodes into reusable knowledge.",
|
||||
"side": "GO",
|
||||
"side_evidence": "RE-CLASSIFIED (Nick's dichotomy): sqlite3 (storage-backed); network/concurrency imports: ['urllib']; deterministic/state domain. Network/threading is the primary purpose \u2014 this module initiates, responds, or routes. Reactive \u2192 Go.",
|
||||
"laws": [
|
||||
"reactive/entry surface (no deterministic kernels hiding here)",
|
||||
"oracle-first truth battery (generated from the live Python oracle)",
|
||||
"HARD CI parity gate (replay + in-package test, not swallowable)",
|
||||
"construction contract FIRST (absolute-scaffolding law)",
|
||||
"parity + improvement note (defect fixed, measured gain, or honest parity-only)"
|
||||
],
|
||||
"parity_means": "Audited 2026-10-10: LLM-first reactive orchestrator (GO by design); Go abstraction dir is the parity twin; cc kernel fallback via cc_loader. The Python IS the adapter \u2014 no exit candidacy, correctly placed.",
|
||||
"status": "ported"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for adaptive_router \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "adaptive_router",
|
||||
"why": "adaptive_router.py \u2014 canonical adaptive route authority (ADAPT-2, #291;\nrevised per handoff 2026-09-10 \u00a73\u2013\u00a77: progressive evidence routing).",
|
||||
"side": "GO",
|
||||
"side_evidence": "reactive/initiating domain",
|
||||
"laws": [
|
||||
"reactive/entry surface (no deterministic kernels hiding here)",
|
||||
"oracle-first truth battery (generated from the live Python oracle)",
|
||||
"HARD CI parity gate (replay + in-package test, not swallowable)",
|
||||
"construction contract FIRST (absolute-scaffolding law)",
|
||||
"parity + improvement note (defect fixed, measured gain, or honest parity-only)"
|
||||
],
|
||||
"parity_means": "Not yet ported. Parity means: kernel in its measured side, oracle-first truth battery, HARD CI gate, delegation wired, then retirement earned.",
|
||||
"status": "not_started"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for attention_capsule \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "attention_capsule",
|
||||
"why": "Attention Capsule \u2014 compact working set for cognitive work.",
|
||||
"side": "RUST",
|
||||
"side_evidence": "no network/reactive markers \u2014 pure compute defaults to the deterministic backend",
|
||||
"laws": [
|
||||
"deterministic pure kernel (no wall clock \u2014 inputs carry time)",
|
||||
"no file IO in kernels (adapter owns persistence)",
|
||||
"FFI envelope ABI (read_arg/arg_json/envelope)",
|
||||
"oracle-first truth battery (Python truth generated FIRST)",
|
||||
"llvm-cov branch coverage + clippy 0"
|
||||
],
|
||||
"parity_means": "NOT parity: kernel exists but the Python module never delegates. Parity means the adapter delegates through the kernel (tier_manager pattern) with both paths pinned by tests.",
|
||||
"status": "facade"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for audit_ledger \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "audit_ledger",
|
||||
"why": "audit_ledger.py \u2014 HMAC-chained tamper-evident promotion ledger.",
|
||||
"side": "RUST",
|
||||
"side_evidence": "deterministic/state domain",
|
||||
"laws": [
|
||||
"deterministic pure kernel (no wall clock \u2014 inputs carry time)",
|
||||
"no file IO in kernels (adapter owns persistence)",
|
||||
"FFI envelope ABI (read_arg/arg_json/envelope)",
|
||||
"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"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for auto_context \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "auto_context",
|
||||
"why": "Auto-context plugin \u2014 runs memory recall on every user message and writes\nresults to a context file that can be injected into the model's view.",
|
||||
"side": "GO",
|
||||
"side_evidence": "network/concurrency imports: ['subprocess']",
|
||||
"laws": [
|
||||
"reactive/entry surface (no deterministic kernels hiding here)",
|
||||
"oracle-first truth battery (generated from the live Python oracle)",
|
||||
"HARD CI parity gate (replay + in-package test, not swallowable)",
|
||||
"construction contract FIRST (absolute-scaffolding law)",
|
||||
"parity + improvement note (defect fixed, measured gain, or honest parity-only)"
|
||||
],
|
||||
"parity_means": "Not yet ported. Parity means: kernel in its measured side, oracle-first truth battery, HARD CI gate, delegation wired, then retirement earned.",
|
||||
"status": "not_started"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for auto_tasks \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "auto_tasks",
|
||||
"why": "Automatic task extraction \u2014 conversation becomes tracked tasks.",
|
||||
"side": "GO",
|
||||
"side_evidence": "sqlite3 (storage-backed); network/concurrency imports: ['subprocess']",
|
||||
"laws": [
|
||||
"reactive/entry surface (no deterministic kernels hiding here)",
|
||||
"oracle-first truth battery (generated from the live Python oracle)",
|
||||
"HARD CI parity gate (replay + in-package test, not swallowable)",
|
||||
"construction contract FIRST (absolute-scaffolding law)",
|
||||
"parity + improvement note (defect fixed, measured gain, or honest parity-only)"
|
||||
],
|
||||
"parity_means": "Not yet ported. Parity means: kernel in its measured side, oracle-first truth battery, HARD CI gate, delegation wired, then retirement earned.",
|
||||
"status": "not_started"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for behavior \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "behavior",
|
||||
"why": "Behavioral patterns \u2014 scoped corrections and habit formation.",
|
||||
"side": "RUST",
|
||||
"side_evidence": "sqlite3 (storage-backed); deterministic/state domain",
|
||||
"laws": [
|
||||
"deterministic pure kernel (no wall clock \u2014 inputs carry time)",
|
||||
"no file IO in kernels (adapter owns persistence)",
|
||||
"FFI envelope ABI (read_arg/arg_json/envelope)",
|
||||
"oracle-first truth battery (Python truth generated FIRST)",
|
||||
"llvm-cov branch coverage + clippy 0"
|
||||
],
|
||||
"parity_means": "Strangler exit 2026-10-10: no Python-owned decision math (habitmath.rs authoritative, SQL stays Python); parity_behavior 16/16.",
|
||||
"status": "retired"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for behaviour_ledger \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "behaviour_ledger",
|
||||
"why": "behaviour_ledger.py \u2014 T19 \u00a719F/19G/19I: the canonical Behaviour\nValidation Ledger.",
|
||||
"side": "RUST",
|
||||
"side_evidence": "deterministic/state domain",
|
||||
"laws": [
|
||||
"deterministic pure kernel (no wall clock \u2014 inputs carry time)",
|
||||
"no file IO in kernels (adapter owns persistence)",
|
||||
"FFI envelope ABI (read_arg/arg_json/envelope)",
|
||||
"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"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for build_basis \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "build_basis",
|
||||
"why": "build_basis.py \u2014 T18 \u00a718C: durable versioned RESEARCH BASIS for\nconstruction (V1 rule F: RESEARCH INFORMS STRUCTURE).",
|
||||
"side": "RUST",
|
||||
"side_evidence": "no network/reactive markers \u2014 pure compute defaults to the deterministic backend",
|
||||
"laws": [
|
||||
"deterministic pure kernel (no wall clock \u2014 inputs carry time)",
|
||||
"no file IO in kernels (adapter owns persistence)",
|
||||
"FFI envelope ABI (read_arg/arg_json/envelope)",
|
||||
"oracle-first truth battery (Python truth generated FIRST)",
|
||||
"llvm-cov branch coverage + clippy 0"
|
||||
],
|
||||
"parity_means": "NOT parity: kernel exists but the Python module never delegates. Parity means the adapter delegates through the kernel (tier_manager pattern) with both paths pinned by tests.",
|
||||
"status": "facade"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for build_mode \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "build_mode",
|
||||
"why": "build_mode.py \u2014 Build mode orchestrator for Rune TUI.",
|
||||
"side": "GO",
|
||||
"side_evidence": "network/concurrency imports: ['subprocess']",
|
||||
"laws": [
|
||||
"reactive/entry surface (no deterministic kernels hiding here)",
|
||||
"oracle-first truth battery (generated from the live Python oracle)",
|
||||
"HARD CI parity gate (replay + in-package test, not swallowable)",
|
||||
"construction contract FIRST (absolute-scaffolding law)",
|
||||
"parity + improvement note (defect fixed, measured gain, or honest parity-only)"
|
||||
],
|
||||
"parity_means": "Not yet ported. Parity means: kernel in its measured side, oracle-first truth battery, HARD CI gate, delegation wired, then retirement earned.",
|
||||
"status": "not_started"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for builder_bridge \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "builder_bridge",
|
||||
"why": "builder_bridge.py \u2014 MiMo builder bridge (thin adapter over Rune Core).",
|
||||
"side": "GO",
|
||||
"side_evidence": "reactive/initiating domain",
|
||||
"laws": [
|
||||
"reactive/entry surface (no deterministic kernels hiding here)",
|
||||
"oracle-first truth battery (generated from the live Python oracle)",
|
||||
"HARD CI parity gate (replay + in-package test, not swallowable)",
|
||||
"construction contract FIRST (absolute-scaffolding law)",
|
||||
"parity + improvement note (defect fixed, measured gain, or honest parity-only)"
|
||||
],
|
||||
"parity_means": "Not yet ported. Parity means: kernel in its measured side, oracle-first truth battery, HARD CI gate, delegation wired, then retirement earned.",
|
||||
"status": "not_started"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for builder_bridge_cli \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "builder_bridge_cli",
|
||||
"why": "builder_bridge_cli.py \u2014 CLI wrapper around rune.builder_bridge.preflight.",
|
||||
"side": "GO",
|
||||
"side_evidence": "reactive/initiating domain",
|
||||
"laws": [
|
||||
"reactive/entry surface (no deterministic kernels hiding here)",
|
||||
"oracle-first truth battery (generated from the live Python oracle)",
|
||||
"HARD CI parity gate (replay + in-package test, not swallowable)",
|
||||
"construction contract FIRST (absolute-scaffolding law)",
|
||||
"parity + improvement note (defect fixed, measured gain, or honest parity-only)"
|
||||
],
|
||||
"parity_means": "Not yet ported. Parity means: kernel in its measured side, oracle-first truth battery, HARD CI gate, delegation wired, then retirement earned.",
|
||||
"status": "not_started"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for cache \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "cache",
|
||||
"why": "Cache system \u2014 event-driven, write-once-derive-twice, compression for context not display.",
|
||||
"side": "GO",
|
||||
"side_evidence": "sqlite3 (storage-backed); network/concurrency imports: ['threading']",
|
||||
"laws": [
|
||||
"reactive/entry surface (no deterministic kernels hiding here)",
|
||||
"oracle-first truth battery (generated from the live Python oracle)",
|
||||
"HARD CI parity gate (replay + in-package test, not swallowable)",
|
||||
"construction contract FIRST (absolute-scaffolding law)",
|
||||
"parity + improvement note (defect fixed, measured gain, or honest parity-only)"
|
||||
],
|
||||
"parity_means": "NOT parity: kernel exists but the Python module never delegates. Parity means the adapter delegates through the kernel (tier_manager pattern) with both paths pinned by tests.",
|
||||
"status": "facade"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for canary_audit_ledger \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "canary_audit_ledger",
|
||||
"why": "canary_audit_ledger.py \u2014 Python canary for slice-2 ports 1-6.",
|
||||
"side": "TEST-INFRA",
|
||||
"side_evidence": "canary/test module",
|
||||
"laws": [
|
||||
"test/canary only \u2014 never a production dependency"
|
||||
],
|
||||
"parity_means": "Not yet ported. Parity means: kernel in its measured side, oracle-first truth battery, HARD CI gate, delegation wired, then retirement earned.",
|
||||
"status": "not_started"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for canary_cognitive_strata \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "canary_cognitive_strata",
|
||||
"why": "Cognitive strata canary: no-change suppression + toggle independence.",
|
||||
"side": "TEST-INFRA",
|
||||
"side_evidence": "canary/test module",
|
||||
"laws": [
|
||||
"test/canary only \u2014 never a production dependency"
|
||||
],
|
||||
"parity_means": "Not yet ported. Parity means: kernel in its measured side, oracle-first truth battery, HARD CI gate, delegation wired, then retirement earned.",
|
||||
"status": "not_started"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for canary_context_broker \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "canary_context_broker",
|
||||
"why": "Context-broker canary: admission, fail-loud, absence proof, compaction.",
|
||||
"side": "TEST-INFRA",
|
||||
"side_evidence": "canary/test module",
|
||||
"laws": [
|
||||
"test/canary only \u2014 never a production dependency"
|
||||
],
|
||||
"parity_means": "Not yet ported. Parity means: kernel in its measured side, oracle-first truth battery, HARD CI gate, delegation wired, then retirement earned.",
|
||||
"status": "not_started"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for canary_conversation_state \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "canary_conversation_state",
|
||||
"why": "Conversation-state canary: canonical task + message ledgers stay alive.",
|
||||
"side": "TEST-INFRA",
|
||||
"side_evidence": "canary/test module",
|
||||
"laws": [
|
||||
"test/canary only \u2014 never a production dependency"
|
||||
],
|
||||
"parity_means": "Not yet ported. Parity means: kernel in its measured side, oracle-first truth battery, HARD CI gate, delegation wired, then retirement earned.",
|
||||
"status": "not_started"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for canary_full_system \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "canary_full_system",
|
||||
"why": "canary_full_system.py \u2014 Full system canary with all wiring.",
|
||||
"side": "TEST-INFRA",
|
||||
"side_evidence": "canary/test module",
|
||||
"laws": [
|
||||
"test/canary only \u2014 never a production dependency"
|
||||
],
|
||||
"parity_means": "Not yet ported. Parity means: kernel in its measured side, oracle-first truth battery, HARD CI gate, delegation wired, then retirement earned.",
|
||||
"status": "not_started"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for canary_gitea_automation \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "canary_gitea_automation",
|
||||
"why": "Contract canary for Gitea templates, labels, and backups.\"\"\"",
|
||||
"side": "TEST-INFRA",
|
||||
"side_evidence": "canary/test module",
|
||||
"laws": [
|
||||
"test/canary only \u2014 never a production dependency"
|
||||
],
|
||||
"parity_means": "Not yet ported. Parity means: kernel in its measured side, oracle-first truth battery, HARD CI gate, delegation wired, then retirement earned.",
|
||||
"status": "not_started"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for canary_gitea_delegation \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "canary_gitea_delegation",
|
||||
"why": "Gitea delegation canary: offline round trip, no network access.\"\"\"",
|
||||
"side": "TEST-INFRA",
|
||||
"side_evidence": "canary/test module",
|
||||
"laws": [
|
||||
"test/canary only \u2014 never a production dependency"
|
||||
],
|
||||
"parity_means": "Not yet ported. Parity means: kernel in its measured side, oracle-first truth battery, HARD CI gate, delegation wired, then retirement earned.",
|
||||
"status": "not_started"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for canary_gitea_pipeline \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "canary_gitea_pipeline",
|
||||
"why": "Contract canary for the mandatory Gitea push pipeline.\"\"\"",
|
||||
"side": "TEST-INFRA",
|
||||
"side_evidence": "canary/test module",
|
||||
"laws": [
|
||||
"test/canary only \u2014 never a production dependency"
|
||||
],
|
||||
"parity_means": "Not yet ported. Parity means: kernel in its measured side, oracle-first truth battery, HARD CI gate, delegation wired, then retirement earned.",
|
||||
"status": "not_started"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for canary_memory_synthesis \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "canary_memory_synthesis",
|
||||
"why": "Memory and synthesis canary: item-ID cursor + cumulative chain.\"\"\"",
|
||||
"side": "TEST-INFRA",
|
||||
"side_evidence": "canary/test module",
|
||||
"laws": [
|
||||
"test/canary only \u2014 never a production dependency"
|
||||
],
|
||||
"parity_means": "Not yet ported. Parity means: kernel in its measured side, oracle-first truth battery, HARD CI gate, delegation wired, then retirement earned.",
|
||||
"status": "not_started"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for canary_native \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "canary_native",
|
||||
"why": "Canary \u2014 verifies all native imports work correctly.",
|
||||
"side": "TEST-INFRA",
|
||||
"side_evidence": "canary/test module",
|
||||
"laws": [
|
||||
"test/canary only \u2014 never a production dependency"
|
||||
],
|
||||
"parity_means": "Not yet ported. Parity means: kernel in its measured side, oracle-first truth battery, HARD CI gate, delegation wired, then retirement earned.",
|
||||
"status": "not_started"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for canary_orchestration_foundation \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "canary_orchestration_foundation",
|
||||
"why": "Foundation canary: one spine, one authority, deterministic chain.\"\"\"",
|
||||
"side": "TEST-INFRA",
|
||||
"side_evidence": "canary/test module",
|
||||
"laws": [
|
||||
"test/canary only \u2014 never a production dependency"
|
||||
],
|
||||
"parity_means": "Not yet ported. Parity means: kernel in its measured side, oracle-first truth battery, HARD CI gate, delegation wired, then retirement earned.",
|
||||
"status": "not_started"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for canary_p0_04 \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "canary_p0_04",
|
||||
"why": "P0-04 pipeline-removal canary (#20).",
|
||||
"side": "TEST-INFRA",
|
||||
"side_evidence": "canary/test module",
|
||||
"laws": [
|
||||
"test/canary only \u2014 never a production dependency"
|
||||
],
|
||||
"parity_means": "Not yet ported. Parity means: kernel in its measured side, oracle-first truth battery, HARD CI gate, delegation wired, then retirement earned.",
|
||||
"status": "not_started"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for canary_p0_05 \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "canary_p0_05",
|
||||
"why": "P0-05 native-tools canary (#21).",
|
||||
"side": "TEST-INFRA",
|
||||
"side_evidence": "canary/test module",
|
||||
"laws": [
|
||||
"test/canary only \u2014 never a production dependency"
|
||||
],
|
||||
"parity_means": "Not yet ported. Parity means: kernel in its measured side, oracle-first truth battery, HARD CI gate, delegation wired, then retirement earned.",
|
||||
"status": "not_started"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for canary_p0_07 \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "canary_p0_07",
|
||||
"why": "P0-07 inference-trace canary (#23).",
|
||||
"side": "TEST-INFRA",
|
||||
"side_evidence": "canary/test module",
|
||||
"laws": [
|
||||
"test/canary only \u2014 never a production dependency"
|
||||
],
|
||||
"parity_means": "Not yet ported. Parity means: kernel in its measured side, oracle-first truth battery, HARD CI gate, delegation wired, then retirement earned.",
|
||||
"status": "not_started"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for canary_p1_01 \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "canary_p1_01",
|
||||
"why": "P1-01 capability-authority canary (#24).",
|
||||
"side": "TEST-INFRA",
|
||||
"side_evidence": "canary/test module",
|
||||
"laws": [
|
||||
"test/canary only \u2014 never a production dependency"
|
||||
],
|
||||
"parity_means": "Not yet ported. Parity means: kernel in its measured side, oracle-first truth battery, HARD CI gate, delegation wired, then retirement earned.",
|
||||
"status": "not_started"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for canary_p1_02 \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "canary_p1_02",
|
||||
"why": "P1-02 capsule-fidelity canary (#25).",
|
||||
"side": "TEST-INFRA",
|
||||
"side_evidence": "canary/test module",
|
||||
"laws": [
|
||||
"test/canary only \u2014 never a production dependency"
|
||||
],
|
||||
"parity_means": "Not yet ported. Parity means: kernel in its measured side, oracle-first truth battery, HARD CI gate, delegation wired, then retirement earned.",
|
||||
"status": "not_started"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for canary_p1_03 \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "canary_p1_03",
|
||||
"why": "P1-03 memory-selection canary (#26).",
|
||||
"side": "TEST-INFRA",
|
||||
"side_evidence": "canary/test module",
|
||||
"laws": [
|
||||
"test/canary only \u2014 never a production dependency"
|
||||
],
|
||||
"parity_means": "Not yet ported. Parity means: kernel in its measured side, oracle-first truth battery, HARD CI gate, delegation wired, then retirement earned.",
|
||||
"status": "not_started"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for canary_p1_06 \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "canary_p1_06",
|
||||
"why": "P1-06 model/provider-routing canary (#29).",
|
||||
"side": "TEST-INFRA",
|
||||
"side_evidence": "canary/test module",
|
||||
"laws": [
|
||||
"test/canary only \u2014 never a production dependency"
|
||||
],
|
||||
"parity_means": "Not yet ported. Parity means: kernel in its measured side, oracle-first truth battery, HARD CI gate, delegation wired, then retirement earned.",
|
||||
"status": "not_started"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for canary_p1_07 \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "canary_p1_07",
|
||||
"why": "P1-07 runtime-objects canary (#30).",
|
||||
"side": "TEST-INFRA",
|
||||
"side_evidence": "canary/test module",
|
||||
"laws": [
|
||||
"test/canary only \u2014 never a production dependency"
|
||||
],
|
||||
"parity_means": "Not yet ported. Parity means: kernel in its measured side, oracle-first truth battery, HARD CI gate, delegation wired, then retirement earned.",
|
||||
"status": "not_started"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for canary_query_memory \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "canary_query_memory",
|
||||
"why": "canary_query_memory.py \u2014 Canary for query memory system.",
|
||||
"side": "TEST-INFRA",
|
||||
"side_evidence": "canary/test module",
|
||||
"laws": [
|
||||
"test/canary only \u2014 never a production dependency"
|
||||
],
|
||||
"parity_means": "Not yet ported. Parity means: kernel in its measured side, oracle-first truth battery, HARD CI gate, delegation wired, then retirement earned.",
|
||||
"status": "not_started"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for canary_resource_authority \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "canary_resource_authority",
|
||||
"why": "Resource authority canary: unknown rejected, outage deterministic, one authority.\"\"\"",
|
||||
"side": "TEST-INFRA",
|
||||
"side_evidence": "canary/test module",
|
||||
"laws": [
|
||||
"test/canary only \u2014 never a production dependency"
|
||||
],
|
||||
"parity_means": "Not yet ported. Parity means: kernel in its measured side, oracle-first truth battery, HARD CI gate, delegation wired, then retirement earned.",
|
||||
"status": "not_started"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for canary_rune_entry \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "canary_rune_entry",
|
||||
"why": "canary_rune_entry.py \u2014 H1 canary for the Go first-call shim.",
|
||||
"side": "TEST-INFRA",
|
||||
"side_evidence": "canary/test module",
|
||||
"laws": [
|
||||
"test/canary only \u2014 never a production dependency"
|
||||
],
|
||||
"parity_means": "Not yet ported. Parity means: kernel in its measured side, oracle-first truth battery, HARD CI gate, delegation wired, then retirement earned.",
|
||||
"status": "not_started"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for canary_rune_serve \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "canary_rune_serve",
|
||||
"why": "canary_rune_serve.py \u2014 H2 parity battery (T4.3, contract\nBUILDER-2026-10-04T08:32:43Z-cli).",
|
||||
"side": "TEST-INFRA",
|
||||
"side_evidence": "canary/test module",
|
||||
"laws": [
|
||||
"test/canary only \u2014 never a production dependency"
|
||||
],
|
||||
"parity_means": "Not yet ported. Parity means: kernel in its measured side, oracle-first truth battery, HARD CI gate, delegation wired, then retirement earned.",
|
||||
"status": "not_started"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for canary_schema_migration \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "canary_schema_migration",
|
||||
"why": "Schema-migration canary: migrate once, idempotent re-run, wiring proof.",
|
||||
"side": "TEST-INFRA",
|
||||
"side_evidence": "canary/test module",
|
||||
"laws": [
|
||||
"test/canary only \u2014 never a production dependency"
|
||||
],
|
||||
"parity_means": "Not yet ported. Parity means: kernel in its measured side, oracle-first truth battery, HARD CI gate, delegation wired, then retirement earned.",
|
||||
"status": "not_started"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for canary_spine_meta \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "canary_spine_meta",
|
||||
"why": "canary_spine_meta.py \u2014 meta-scaffold canary (H-meta).",
|
||||
"side": "TEST-INFRA",
|
||||
"side_evidence": "canary/test module",
|
||||
"laws": [
|
||||
"test/canary only \u2014 never a production dependency"
|
||||
],
|
||||
"parity_means": "Not yet ported. Parity means: kernel in its measured side, oracle-first truth battery, HARD CI gate, delegation wired, then retirement earned.",
|
||||
"status": "not_started"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for canary_surface_parity \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "canary_surface_parity",
|
||||
"why": "Surface parity canary: same root for every entry path, offline.\"\"\"",
|
||||
"side": "TEST-INFRA",
|
||||
"side_evidence": "canary/test module",
|
||||
"laws": [
|
||||
"test/canary only \u2014 never a production dependency"
|
||||
],
|
||||
"parity_means": "Not yet ported. Parity means: kernel in its measured side, oracle-first truth battery, HARD CI gate, delegation wired, then retirement earned.",
|
||||
"status": "not_started"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for canary_tui_drift \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "canary_tui_drift",
|
||||
"why": "canary_tui_drift.py \u2014 Canary for TUI drift system wiring.",
|
||||
"side": "TEST-INFRA",
|
||||
"side_evidence": "canary/test module",
|
||||
"laws": [
|
||||
"test/canary only \u2014 never a production dependency"
|
||||
],
|
||||
"parity_means": "Not yet ported. Parity means: kernel in its measured side, oracle-first truth battery, HARD CI gate, delegation wired, then retirement earned.",
|
||||
"status": "not_started"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for canary_tui_transport \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "canary_tui_transport",
|
||||
"why": "canary_tui_transport.py \u2014 H4 slice 1 battery (T4.5, contract\nBUILDER-2026-10-04T10:32:00Z-cli).",
|
||||
"side": "TEST-INFRA",
|
||||
"side_evidence": "canary/test module",
|
||||
"laws": [
|
||||
"test/canary only \u2014 never a production dependency"
|
||||
],
|
||||
"parity_means": "Not yet ported. Parity means: kernel in its measured side, oracle-first truth battery, HARD CI gate, delegation wired, then retirement earned.",
|
||||
"status": "not_started"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for canary_unbounded \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "canary_unbounded",
|
||||
"why": "canary_unbounded.py \u2014 Canary for unbounded memory system.",
|
||||
"side": "TEST-INFRA",
|
||||
"side_evidence": "canary/test module",
|
||||
"laws": [
|
||||
"test/canary only \u2014 never a production dependency"
|
||||
],
|
||||
"parity_means": "Not yet ported. Parity means: kernel in its measured side, oracle-first truth battery, HARD CI gate, delegation wired, then retirement earned.",
|
||||
"status": "not_started"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for capability_broker \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "capability_broker",
|
||||
"why": "Capability broker \u2014 maps user intent to relevant plugins.",
|
||||
"side": "RUST",
|
||||
"side_evidence": "deterministic/state domain",
|
||||
"laws": [
|
||||
"deterministic pure kernel (no wall clock \u2014 inputs carry time)",
|
||||
"no file IO in kernels (adapter owns persistence)",
|
||||
"FFI envelope ABI (read_arg/arg_json/envelope)",
|
||||
"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"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for capability_fit \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "capability_fit",
|
||||
"why": "capability_fit.py \u2014 Requirement-fit capability discovery + gap decision.",
|
||||
"side": "RUST",
|
||||
"side_evidence": "deterministic/state domain",
|
||||
"laws": [
|
||||
"deterministic pure kernel (no wall clock \u2014 inputs carry time)",
|
||||
"no file IO in kernels (adapter owns persistence)",
|
||||
"FFI envelope ABI (read_arg/arg_json/envelope)",
|
||||
"oracle-first truth battery (Python truth generated FIRST)",
|
||||
"llvm-cov branch coverage + clippy 0"
|
||||
],
|
||||
"parity_means": "Strangler exit 2026-10-10 (99698d16): _py_evaluate_fit deleted, Rust authoritative, frozen oracle + 24/24 canary.",
|
||||
"status": "retired"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for capability_ledger \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "capability_ledger",
|
||||
"why": "capability_ledger.py \u2014 T19 \u00a719D: compact versioned Capability\nLedgers \u2014 local re-entry context packets.",
|
||||
"side": "RUST",
|
||||
"side_evidence": "deterministic/state domain",
|
||||
"laws": [
|
||||
"deterministic pure kernel (no wall clock \u2014 inputs carry time)",
|
||||
"no file IO in kernels (adapter owns persistence)",
|
||||
"FFI envelope ABI (read_arg/arg_json/envelope)",
|
||||
"oracle-first truth battery (Python truth generated FIRST)",
|
||||
"llvm-cov branch coverage + clippy 0"
|
||||
],
|
||||
"parity_means": "NOT parity: kernel exists but the Python module never delegates. Parity means the adapter delegates through the kernel (tier_manager pattern) with both paths pinned by tests.",
|
||||
"status": "facade"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for cc_loader \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "cc_loader",
|
||||
"why": "ctypes loader for the Rust cognition_core (R2 W3.1).",
|
||||
"side": "RUST",
|
||||
"side_evidence": "ctypes FFI binding to libcognition_core (deterministic kernel membrane; no network imports)",
|
||||
"laws": [
|
||||
"deterministic pure kernel (no wall clock \u2014 inputs carry time)",
|
||||
"no file IO in kernels (adapter owns persistence)",
|
||||
"FFI envelope ABI (read_arg/arg_json/envelope)",
|
||||
"oracle-first truth battery (Python truth generated FIRST)",
|
||||
"llvm-cov branch coverage + clippy 0"
|
||||
],
|
||||
"parity_means": "Not yet ported. Parity means: kernel in its measured side, oracle-first truth battery, HARD CI gate, delegation wired, then retirement earned.",
|
||||
"status": "not_started"
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for chat_bubble \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "chat_bubble",
|
||||
"why": "Chat Bubble Widget \u2014 styled message bubbles for the TUI.",
|
||||
"side": "TUI-LAST",
|
||||
"side_evidence": "textual/rich imports: ['rich', 'textual']",
|
||||
"laws": [
|
||||
"stays Textual until Wave 7 (Bubble Tea LAST by law)",
|
||||
"no deterministic kernels in the TUI layer"
|
||||
],
|
||||
"parity_means": "Not yet ported. Parity means: kernel in its measured side, oracle-first truth battery, HARD CI gate, delegation wired, then retirement earned.",
|
||||
"status": "not_started"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for claim_audit \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "claim_audit",
|
||||
"why": "ACTIVE claim-audit layer \u2014 prevents unsupported strong claims at generation.",
|
||||
"side": "RUST",
|
||||
"side_evidence": "sqlite3 (storage-backed); deterministic/state domain",
|
||||
"laws": [
|
||||
"deterministic pure kernel (no wall clock \u2014 inputs carry time)",
|
||||
"no file IO in kernels (adapter owns persistence)",
|
||||
"FFI envelope ABI (read_arg/arg_json/envelope)",
|
||||
"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"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for cognitive_budgeter \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "cognitive_budgeter",
|
||||
"why": "Cognitive Budgeter \u2014 decides how much cognition an event deserves.",
|
||||
"side": "RUST",
|
||||
"side_evidence": "deterministic/state domain",
|
||||
"laws": [
|
||||
"deterministic pure kernel (no wall clock \u2014 inputs carry time)",
|
||||
"no file IO in kernels (adapter owns persistence)",
|
||||
"FFI envelope ABI (read_arg/arg_json/envelope)",
|
||||
"oracle-first truth battery (Python truth generated FIRST)",
|
||||
"llvm-cov branch coverage + clippy 0"
|
||||
],
|
||||
"parity_means": "NOT parity: kernel exists but the Python module never delegates. Parity means the adapter delegates through the kernel (tier_manager pattern) with both paths pinned by tests.",
|
||||
"status": "facade"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for connection_pool \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "connection_pool",
|
||||
"why": "Connection Pool \u2014 reuse database connections instead of creating new ones.",
|
||||
"side": "GO",
|
||||
"side_evidence": "sqlite3 (storage-backed); network/concurrency imports: ['threading']",
|
||||
"laws": [
|
||||
"reactive/entry surface (no deterministic kernels hiding here)",
|
||||
"oracle-first truth battery (generated from the live Python oracle)",
|
||||
"HARD CI parity gate (replay + in-package test, not swallowable)",
|
||||
"construction contract FIRST (absolute-scaffolding law)",
|
||||
"parity + improvement note (defect fixed, measured gain, or honest parity-only)"
|
||||
],
|
||||
"parity_means": "Not yet ported. Parity means: kernel in its measured side, oracle-first truth battery, HARD CI gate, delegation wired, then retirement earned.",
|
||||
"status": "not_started"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for construction_activation \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "construction_activation",
|
||||
"why": "construction_activation.py \u2014 the activation dispatcher.",
|
||||
"side": "RUST",
|
||||
"side_evidence": "deterministic/state domain",
|
||||
"laws": [
|
||||
"deterministic pure kernel (no wall clock \u2014 inputs carry time)",
|
||||
"no file IO in kernels (adapter owns persistence)",
|
||||
"FFI envelope ABI (read_arg/arg_json/envelope)",
|
||||
"oracle-first truth battery (Python truth generated FIRST)",
|
||||
"llvm-cov branch coverage + clippy 0"
|
||||
],
|
||||
"parity_means": "NOT parity: kernel exists but the Python module never delegates. Parity means the adapter delegates through the kernel (tier_manager pattern) with both paths pinned by tests.",
|
||||
"status": "facade"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for construction_commands \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "construction_commands",
|
||||
"why": "construction_commands.py \u2014 T16 \u00a716J: bounded validated inbound\ncommand interface for future Substrate integration.",
|
||||
"side": "RUST",
|
||||
"side_evidence": "deterministic/state domain",
|
||||
"laws": [
|
||||
"deterministic pure kernel (no wall clock \u2014 inputs carry time)",
|
||||
"no file IO in kernels (adapter owns persistence)",
|
||||
"FFI envelope ABI (read_arg/arg_json/envelope)",
|
||||
"oracle-first truth battery (Python truth generated FIRST)",
|
||||
"llvm-cov branch coverage + clippy 0"
|
||||
],
|
||||
"parity_means": "NOT parity: kernel exists but the Python module never delegates. Parity means the adapter delegates through the kernel (tier_manager pattern) with both paths pinned by tests.",
|
||||
"status": "facade"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for construction_decision \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "construction_decision",
|
||||
"why": "construction_decision.py \u2014 live Need \u2192 Decision \u2192 Construction Contract.",
|
||||
"side": "RUST",
|
||||
"side_evidence": "deterministic/state domain",
|
||||
"laws": [
|
||||
"deterministic pure kernel (no wall clock \u2014 inputs carry time)",
|
||||
"no file IO in kernels (adapter owns persistence)",
|
||||
"FFI envelope ABI (read_arg/arg_json/envelope)",
|
||||
"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"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"_doc": "INTENT LEDGER (scaffolding, Nick 2026-10-10): the WHY for construction_depth \u2014 what it exists FOR, what side it belongs on, what laws its port must satisfy, and what 'parity' means for it. Parity is judged against intent, not just behavior.",
|
||||
"module": "construction_depth",
|
||||
"why": "construction_depth.py \u2014 proportional Scaffolding depth selection.",
|
||||
"side": "RUST",
|
||||
"side_evidence": "deterministic/state domain",
|
||||
"laws": [
|
||||
"deterministic pure kernel (no wall clock \u2014 inputs carry time)",
|
||||
"no file IO in kernels (adapter owns persistence)",
|
||||
"FFI envelope ABI (read_arg/arg_json/envelope)",
|
||||
"oracle-first truth battery (Python truth generated FIRST)",
|
||||
"llvm-cov branch coverage + clippy 0"
|
||||
],
|
||||
"parity_means": "NOT parity: kernel exists but the Python module never delegates. Parity means the adapter delegates through the kernel (tier_manager pattern) with both paths pinned by tests.",
|
||||
"status": "facade"
|
||||
}
|
||||
Loaded 100 of 227 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user