Compare commits

...
Author SHA1 Message Date
conductor 459e1f58bf chore(release): auto-bump version to 0.155.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 22:00:35 +01:00
conductor 3de52811ca chore(release): auto-bump version to 0.154.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 21:37:52 +01:00
conductor cde8772538 chore(release): auto-bump version to 0.154.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 21:32:02 +01:00
conductor 6bf7c7ea22 chore(release): auto-bump version to 0.154.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 21:22:30 +01:00
conductor fd29404f4f chore(release): auto-bump version to 0.154.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 21:17:15 +01:00
Nick e3d3959beb feat(go): model-profiles batch 145 — detection edge battery 11->18 rows (#2479, contract BUILDER-2026-10-09T20:02:02Z-534a29)
Dichotomy verdict: GO (reactive/entry surface). Audit: the batch-7
port is byte-faithful on all 9 probed edge inputs (case-insensitive
families, decimal params, lowercase-quant misses, GGUF, unknowns) —
family table verified identical (not a drifted hand-copy).
Extended the truth 11->18 so the fidelity is pinned, not assumed.

Parity: oracle-first (Go probed on the same inputs). 18/18 replay
green, vet clean. Improvements: parity-only — oracle verified correct.
2026-10-09 21:05:13 +01:00
Nick 5313a9d5db feat(go): auto-tasks batch 144 — fence/action/sequence/gate pins, truth 4->8 (#2479, contract BUILDER-2026-10-09T19:58:03Z-6aacdb)
Dichotomy verdict: GO (reactive/entry surface). Audit: the adjacency
fix holds; four unpinned paths now pinned — bullets-after-fence (the
fence-strip + adjacency interaction: oracle 0, Go 2), action_verb and
sequence patterns (Go matches oracle 1:1), the >=2 single-item gate
(nothing on both sides). Truth 4->8.

Parity: oracle-first (Go probed on the same inputs before pinning).
8/8 replay green, vet clean. Improvements: the fence-interaction fix
is pinned as the third documented divergence of the adjacency class.
2026-10-09 21:01:46 +01:00
Nick c8be68fc69 fix(go): voice-sync batch 143 — rune-count estimate + generate port + HARD gate (#2479, contract BUILDER-2026-10-09T19:54:22Z-a454b5)
Dichotomy verdict: GO (reactive/entry surface). TWO GAPS FIXED (both
oracle-probed): estimateTokens counted UTF-8 BYTES (oracle: chars —
unicode text overestimated 6 vs 4); generate_voice_section unported
(the assembly with calibration cap-3). Plus a missing HARD gate —
voice-sync replayed only in the swallowable sweep; now gated.

Parity: oracle-first. 6/6 replay green, vet clean. Improvements:
genuine defects fixed — unicode estimates + the generate assembly.
2026-10-09 20:57:48 +01:00
Nick 17c60a2dec chore: scaffold/spine sync (batch 142 close) 2026-10-09 20:53:58 +01:00
Nick 801dd4b5fa retire(go): batch 142 — remove divergent curator/ duplicate + overwrite-sweep record (#2479, contract BUILDER-2026-10-09T19:49:14Z-9a9119)
Dichotomy verdict: GO (curator-core is the tested line).
OVERWRITE SWEEP (the batch-106/141 class): surveyed all 73 Go dirs'
batch histories. Findings:
- forge-core was the ONLY whole-file wipe (fixed batch 141).
- curator/ (W5c) is NOT a wipe but a DIVERGENT DUPLICATE: isTopicFact
  (regex vs the 21-domain oracle list), entryKey (plain truncated
  string vs sha256[:16]), contradictsIdentity (env-var regexes vs the
  lexicon coherence gate) — all oracle-probed divergent. curator-core
  (batches 1-4-22-114, 39-row truth + CI gates) carries the REAL
  semantics. Zero references to curator/ anywhere: retired.
- cognition/ Survivor packages are cgo membranes (separate lane).

Parity: oracle-first (every divergence probed before retiring).
Improvements: the retirement IS the fix — plus the standing law:
whole-file writes must diff against the existing port first.
2026-10-09 20:53:58 +01:00
conductor e25b6e3d0f chore(release): auto-bump version to 0.154.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 20:51:08 +01:00
Nick 53c1ef160f fix(go): forge-core batch 141 — restore batch-13 verdict lattice wiped by batch-106 (#2479, contract BUILDER-2026-10-09T19:44:44Z-682d38)
Dichotomy verdict: GO (reactive/entry surface). OVERWRITE REGRESSION
FOUND + FIXED: batch 106 replaced main.go whole, dropping batch 13's
NormalizeVerdict lattice + NullAdapter pins (the no-status-vs-pending
distinction the fault-watch depends on). Restored as an extension
(resolvers kept); truth 1->11 rows with the full lattice.

Parity: oracle-first (lattice semantics re-verified before restoring).
11 rows green, vet clean. Improvements: the restoration IS the fix —
plus a standing lesson: whole-file overwrites must diff against the
existing port first.
2026-10-09 20:49:02 +01:00
conductor 45a88b932a chore(release): auto-bump version to 0.154.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 20:44:53 +01:00
Nick c5a550a7dc feat(go): voicebox batch 140 — full-manifest + data pins, truth 4->6 (#2479, contract BUILDER-2026-10-09T19:41:55Z-8db221)
Dichotomy verdict: GO (reactive/entry surface). Audit: the hand-copied
manifest pinned only name+caps — now all 9 fields fail loudly on drift;
data-passthrough pinned (both sides ignore data, return event+handler
only). Oracle verified correct on every edge (None-event can't arrive
in typed Go — documented, not ported).

Parity: oracle-first. 6/6 replay green, vet clean. Improvements:
parity-only.
2026-10-09 20:44:30 +01:00
Nick 42f81a9b6c fix(go): builder-bridge batch 139 — TTL/refresh/key LRU fidelity (#2479, contract BUILDER-2026-10-09T19:38:43Z-5c1162)
Dichotomy verdict: GO (reactive/entry surface). THREE FIDELITY GAPS
FIXED (all oracle-probed): get() never expired entries (TTL dead —
stale memory served forever); put() piled duplicate keys in the ring
(unbounded order growth + wrong eviction); no key normalization
('Hello X' vs 'hello  x' = separate entries). O(1) improvement kept.

Parity: oracle-first. 8/8 replay green, vet clean. Improvements:
genuine defects fixed — the cache now expires, refreshes, and keys
like the oracle.
2026-10-09 20:41:40 +01:00
Nick 9ae706acb6 feat(go): core-server batch 138 — extraction seam + chunk-identity + envelope pins (#2479, contract BUILDER-2026-10-09T19:35:57Z-c86e65)
Dichotomy verdict: GO (reactive/entry surface). Audit gaps pinned:
modelsFromOperator (the m.get('name','') extraction — missing name ->
'' — was transport-only), chunk id-sharing (content+terminal share
base id), terminal empty-delta + content null-finish, envelope message
field. Truth 3->6 rows.

Parity: oracle-first. 6/6 replay green, vet clean. Improvements:
parity-only — oracle verified correct on every edge.
2026-10-09 20:38:29 +01:00
conductor ea27ae5895 chore(release): auto-bump version to 0.154.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 20:35:55 +01:00
Nick 0949eee6fc fix(go): work-manager batch 137 — insertion-order groups + batch descriptions (#2479, contract BUILDER-2026-10-09T19:32:25Z-0a34e2)
Dichotomy verdict: GO (reactive/entry surface). TWO DIVERGENCES FIXED
(both oracle-probed): the port sort.Strings'd the rule groups (oracle
iterates in first-seen insertion order — multi-group batches came out
alphabetical, not causal); batch descriptions were missing on the
auto-fix batch and every non-file-split batch (downstream consumers
read them). Now oracle-exact.

Parity: oracle-first. 6/6 replay green, vet clean. Improvements:
genuine defects fixed — batch order and descriptions match.
2026-10-09 20:35:44 +01:00
Nick 7bf44d9431 fix(go): model-routing batch 136 — measured-cost override + 2 parity rows (#2479, contract BUILDER-2026-10-09T19:28:35Z-b362d9)
Dichotomy verdict: GO (reactive/entry surface). REAL DIVERGENCE FIXED:
the oracle sets cost = profile.estimated_cost_usd in the measured
branch; the Go port kept the static floor cost — a measured-expensive
model sorted as if free. Measured struct gains Cost; the override
applies in the measured branch. Garbage-stats paths verified
oracle-side (all degrade to unmeasured/floor-eligible); N=0 pinned.

Parity: oracle-first. 7/7 replay green, vet clean. Improvements:
genuine defect fixed — cost-aware ordering now matches the oracle.
2026-10-09 20:31:56 +01:00
Nick 1d268e5131 feat(go): release-notes batch 135 — parser edge battery 9->22 rows (#2479, contract BUILDER-2026-10-09T19:26:15Z-34931b)
Dichotomy verdict: GO (reactive/entry surface). Table-audit first: the
batch-6 port is byte-faithful on all 13 probed edges (blank-collapse,
heading/italic/list stops, case-insensitive SHAs, non-hex rejection).
Extended the truth 9->22 with the edge rows so the fidelity is pinned,
not assumed.

Parity: oracle-first. 22/22 replay green, vet clean. Improvements:
parity-only — oracle verified correct on every edge.
2026-10-09 20:28:24 +01:00
Nick 4db9789dde chore(repo): batch 134 — untrack 74 Go binaries + gitignore build artifacts (#2479, contract BUILDER-2026-10-09T19:23:52Z-409db8)
Binaries are CI-built per gate (go build -o /tmp/...) — storing them
bloats every commit and risks stale-binary confusion. Each module dir
keeps go.mod/main.go/truth*.json + *_test.go only. Verified: forge-client
rebuilds from source and replays 12/12 after the sweep.
2026-10-09 20:26:03 +01:00
Nick 1be046daf5 feat(go): forge-client batch 133 — NullAdapter/selection/URL/filter cores (#2479, contract BUILDER-2026-10-09T19:19:39Z-b75bfd)
Dichotomy verdict: GO (reactive/entry surface). HTTP stays Python;
ported the pure cores: NullAdapter shapes, create_forge_client
selection (url+token presence), base-URL + header construction
(trailing-slash strip, owner/repo defaults), search client-side filter
(title OR body contains — the #122 dedup law).

Parity: oracle-first (12 rows). 12/12 replay green, vet clean, HARD CI
gate. Improvements: parity-only — oracle verified correct.
2026-10-09 20:23:24 +01:00
conductor 6a20c3a656 chore(release): auto-bump version to 0.154.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 20:20:05 +01:00
Nick fd45c9db12 feat(rust): capability_ledger batch 132 — version-bump kernels (#2479, contract BUILDER-2026-10-09T19:16:47Z-573949)
Dichotomy verdict: RUST (deterministic backend). Oracle-probed first:
classify_version_bump precedence (consumer_break > contract_changed >
behaviour_added > implementation_only; all-false raises) + bump_version
strict-semver (MAJOR/MINOR/PATCH resets; invalid semver/kind raise).

Parity: oracle-first. 2/2 tests green, clippy + fmt clean. Improvements:
parity-only — oracle verified correct.
2026-10-09 20:18:59 +01:00
conductor adf5c61578 chore(release): auto-bump version to 0.154.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 20:13:45 +01:00
Nick 7f1c2f9dfa feat(go): memory-consolidation batch 131 — constructor cores + 9-row battery (#2479, contract BUILDER-2026-10-09T19:07:01Z-d63f19)
Dichotomy verdict: GO (reactive/entry surface). Batch 5 covered only
scoring; ported the constructors: consolidateGraphEntity (80-char
truncation + lower-tag), consolidateAbstractionFact (100-char truncation
+ fact-{hash} id shape), makeLesson/makeConnection id shapes (lesson-N/
conn-N, 0.9/0.8 confidences), format section assembly + entry_id link
shape, status counts. Pinned the score>0 quirk (confidence-only
knowledge renders while lessons/conns drop).

Parity: oracle-first. 9/9 + scoring green, CI gate extended HARD.
Improvements: parity-only — oracle verified correct on all edges.
2026-10-09 20:11:23 +01:00
Nick a2bbaa5489 test(seam): ms_loader batch 130 — 13-symbol memory_scoring seam contract (#2479, contract BUILDER-2026-10-09T19:04:00Z-7732d2)
Dichotomy verdict: RUST kernel, PYTHON seam (mirrors batch-127 pattern).
Audit proved live: all 13 wrappers resolve; missing lib raises
MemoryScoringUnavailable (FileNotFoundError — callers fall back);
kernel !ok raises RuntimeError naming the symbol; null envelope is
{ok:false}; the ratio ladder pinned (washable 0.5/0.25/0.1 at 0/10/20,
established 0.2, rock 0).

Parity: oracle-first. 5/5 green. Improvements: parity-only — the seam
is verified sound; future symbol changes fail loudly.
2026-10-09 20:06:37 +01:00
conductor fd94b811c0 chore(release): auto-bump version to 0.154.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 20:04:56 +01:00
Nick 567369d2c1 feat(go): goal-engine batch 129 — manager-lifecycle store + 15-row parity battery (#2479, contract BUILDER-2026-10-09T18:58:25Z-86b912)
Dichotomy verdict: GO (reactive/entry surface). The batch-2 port covered
only the verifier + achieve stub. Ported the lifecycle name-preserving:
setGoal/activeGoal/achieveGoal/failGoal/clearGoal + JSON round-trip,
15-row oracle-first battery incl. the FIRST-active-wins semantics
(achieve hits the earliest active goal, not the latest — pinned, not
fought), fail-evidence 'Failed: {reason}' shape, no-goal paths.

Parity: oracle-first (one oracle row itself fixed mid-batch: the set-row
had accumulated evidence from a shared reference — snapshot-at-set-time
is the honest shape). Lifecycle 15/15 + verifier 7/7 green, CI gate
extended HARD. Improvements: parity-only — oracle verified correct.
2026-10-09 20:03:33 +01:00
Nick e4441ed4c5 fix(rust): token_optimizer batch 128 — oracle-exact compress_context (#2479, contract BUILDER-2026-10-09T18:55:33Z-6377da)
Dichotomy verdict: RUST (deterministic backend). THREE DIVERGENCES
FIXED (all oracle-probed before fixing): the port dropped empty lines
entirely (oracle collapses 3+ newlines to two), never collapsed double
spaces, and never shortened role prefixes (User:/Assistant:/System:).
compress_context is now oracle-exact (newline-run scan + space-run scan
+ role replacement + strip).

Parity: oracle-first. 7/7 tests green, clippy + fmt clean. Improvements:
genuine defects fixed — compressed prompts were both longer (spaces)
and less legible to the model (full role prefixes) than the oracle's.
2026-10-09 19:58:00 +01:00
Nick 003725d09e test(seam): cc_loader batch 127 — 22-symbol FFI seam contract (#2479, contract BUILDER-2026-10-09T18:52:10Z-97b328)
Dichotomy verdict: RUST kernel, PYTHON seam (the strangler point).
Audit proved live: all 22 wrappers resolve (no phantoms); the
RUNE_COGNITION_CORE=python pin is honored at core(); missing fields
degrade to defaults (bad payload -> [], never null); the null-pointer
envelope is {ok:false} (kernel never crashes Python); missing symbols
raise AttributeError (never silent None).

Parity: oracle-first (every claim probed live before pinning). 5/5
green. Improvements: parity-only — the seam is verified sound; the
contract exists so future symbol additions/removals fail loudly.
2026-10-09 19:54:55 +01:00
Nick 6761de2436 feat(go): cron-engine batch 126 — task-lifecycle store + 13-row parity battery (#2479, contract BUILDER-2026-10-09T18:48:18Z-d5f001)
Dichotomy verdict: GO (reactive/entry surface). The audit showed 27 fns
NOT TOUCHED: the batch-1 port preserved only the 2 pure fns by name.
Ported the lifecycle surface name-preserving: addTask/removeTask/
getTask/listTasks/enableTask/disableTask + saveTo/loadFrom (the _save/
_load JSON round-trip), 13-row oracle-first battery (isolated storage;
list compared as sets — Go sorts by name, oracle preserves insertion).

Parity: oracle-first. Lifecycle 13/13 + parser 25/25 green, CI gate
extended (HARD, non-swallowable). Improvements: parity-only — oracle
verified correct on all probed edges (missing->nil/false, reload
round-trip byte-equal).
2026-10-09 19:51:42 +01:00
conductor 9842428e4d chore(release): auto-bump version to 0.154.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 19:49:10 +01:00
Nick 899ee3e62e fix(rust): construction_depth batch 125 — exact canonical modes + oracle-exact LOCAL branch (#2479, contract BUILDER-2026-10-09T18:44:29Z-4dce8f)
Dichotomy verdict: RUST (deterministic backend). LIVE MISCLASSIFICATION
FIXED: the port substring-matched 'LOCAL_FIX' (a string classify_mode
never emits) and missed the real LOCAL_CHANGE — every tiny fix fell
through to STANDARD instead of LIGHT. Now exact-matches the 5 canonical
MODES; the LOCAL branch carries the oracle's exact ceremony/bypassed
lists (was a paraphrase missing 'patterns', 'authority/scope', the
USER-LOCKED layout obligation).

Parity: oracle-first (probed all 5 modes + modifier matrix). 7/7 tests
green, clippy + fmt clean. Improvements: genuine defect fixed — tiny
fixes were over-governed at STANDARD depth.
2026-10-09 19:47:33 +01:00
Nick c4f9b6a5b7 fix(drift): identity_anchors batch 124 — GENUINENESS triples join the kernel data (#2479, contract BUILDER-2026-10-09T18:41:18Z-5e22fb)
Dichotomy verdict: RUST kernel, PYTHON data authority (unchanged split).
REAL DIVERGENCE FOUND + FIXED: the kernel path (drift_check over the 31
_pattern_triples) never saw the 4 PERFORMATIVE patterns — only the
Python fallback ran check_genuineness. Proved live: performative text ->
fallback 2 issues, kernel []. Fix at the DATA layer (the law: kernel
matches, data stays here): _pattern_triples now carries the 4 rows with
GENUINENESS prefix (35 rows); both paths byte-equal after.

Parity: oracle-first (proved divergence live before fixing). Rust battery
+1 (genuineness prefix); 96 Python identity/drift tests green. Clippy
hits pre-existing. Improvements: genuine defect fixed — kernel-path
drift checks were blind to performative language.
2026-10-09 19:43:52 +01:00
conductor 89fbe5983f chore(release): auto-bump version to 0.154.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 19:42:45 +01:00
Nick bcfd56eafa feat(rust): construction_intent batch 123 — intent_tokens/is_question/imperative_verb (#2479, contract BUILDER-2026-10-09T18:35:59Z-96b856)
Dichotomy verdict: RUST (deterministic backend). Oracle-probed first
(question STRUCTURE incl. the lead-verb guard; idiom-prefix stripping;
verb table). Two oracle edges handled honestly: '_' splits tokens
(Rust is_ascii_alphanumeric keeps it — forced to separator); empty input
yields {} not {''} (documented improvement — an empty token is never a
membership signal).

Parity: oracle-first. 2/2 tests green, clippy + fmt clean. Improvements:
the empty-set divergence (above) + strip_prefix idiom.
2026-10-09 19:40:41 +01:00
Nick dbea97d441 feat(rust): contracts batch 122 — check_signature_drift pure compare core (#2479, contract BUILDER-2026-10-09T18:33:15Z-f6d9c9)
Dichotomy verdict: RUST (deterministic backend). The drift COMPARE is
pure (changed values ARE drift; new/removed keys are NOT — oracle-probed
before porting, incl. the live memory_store.connect () -> (db_path=None)
shape from this session). Capture (inspect) + disk I/O stay Python.

Parity: oracle-first. 2/2 tests green, clippy + fmt clean. Improvements:
parity-only — oracle verified correct (new-key silence is right: first
run has nothing to compare; removed-key silence is right: deletion is
not drift).
2026-10-09 19:35:33 +01:00
conductor a7a1cd3168 chore(release): auto-bump version to 0.154.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 19:34:00 +01:00
Nick 36c63d5023 test(go): tool-executor batch 121 — digest parity top-up with live cross-probed values (#2479, contract BUILDER-2026-10-09T18:28:48Z-c34a46)
Dichotomy verdict: GO (reactive/entry surface). Cross-language probe:
Python _canonical_digest vs Go CanonicalDigest byte-identical on 4 live
inputs (incl. unicode/bool/None/nested — the ensure_ascii=False edge);
Python _path_digest vs Go PathDigest byte-identical on missing + fixed
file content. Extended the in-tree tests with the live values (unicode
canonical cases; fixed file/missing byte-exact digests).

Parity: oracle-first (probed live before pinning). Full package green.
Improvements: parity-only — the digests are approval-critical (a
mismatch rejects every real approval); both sides verified identical.
2026-10-09 19:32:42 +01:00
Nick 66917d826c feat(rust): construction_decision batch 120 — research_route + project_exists_evidence (#2479, contract BUILDER-2026-10-09T18:24:48Z-e5439c)
Dichotomy verdict: RUST (deterministic backend). Two unported pure
kernels, oracle-probed first: research_route (4 resolution shapes incl.
the RECORDED_NOT_EXECUTED honesty marker + 120-char truncation) and
_project_exists_evidence (True/False/None tri-state; bare strings never
proof — 'foo' -> False; wrong-kind entities don't count).

Parity: oracle-first (probed all shapes before porting). 7/7 crate tests
green, clippy + fmt clean. Improvements: parity-only — oracle verified
correct (the tri-state UNKNOWN is load-bearing: the classifier must not
manufacture existence).
2026-10-09 19:28:18 +01:00
conductor e3aa030a82 chore(release): auto-bump version to 0.154.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 19:27:28 +01:00
Nick 6213afafb7 test(rust): cognition_core batch 119 — consolidation id-derivation parity contract (#2479, contract BUILDER-2026-10-09T18:21:31Z-75d2e2)
Dichotomy verdict: RUST (deterministic backend). Live oracle-vs-kernel
probe: content/confidence byte-equal; derived ids differ BY CONSTRUCTION
(oracle: salted Python hash%10000 — nondeterministic across processes;
kernel: stable FNV-1a%10000). The contract pins what matters: explicit
entry_id -> memory-{eid}/neuron-{slug} on BOTH sides (the only stable
cross-process key); derived ids session-local on both sides (dedup
happens within one consolidate_all run). Kernel determinism asserted
(same input -> byte-equal output).

Parity: oracle-first (probed before pinning). 44/44 green. Improvements:
parity-only — the divergence is a documented scheme difference, not a
defect; 'fixing' it would mean salting the kernel (worse).
2026-10-09 19:24:14 +01:00
Nick 78ed8ac3b8 test(rust): cognition_core batch 118 — abstraction frozen-table seam battery (#2479, contract BUILDER-2026-10-09T18:16:07Z-bb65fd)
Dichotomy verdict: RUST (deterministic backend). The abstraction kernel
takes stopwords as INPUT — so the batch pins the SEAM: the oracle's
57-word frozen table through the FFI (content counts (9w/7c),(3w/2c),
(13w/7c), hand-verified) + a wrong-table contrast (drop the/a/over ->
(9/9),(3/3),(13/8)) proving the seam is load-bearing, not decorative.

Parity: oracle-first (FFI-probed both tables before pinning). 43/43 crate
tests green. Improvements: parity-only — the seam delivers the exact
frozen table (abstraction.py:310); no defects found.
2026-10-09 19:20:49 +01:00
conductor a731ee8c3c chore(release): auto-bump version to 0.154.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 19:18:17 +01:00
Nick e084561d00 feat(go): elastic-cognition batch 117 — calculate_budget + parse_response kernels, 30-row battery (#2479, contract BUILDER-2026-10-09T18:12:07Z-c600a3)
Dichotomy verdict: GO (reactive/entry surface). Pattern-table audit first:
all 8 oracle lists byte-present in the port (4 apparent misses were
backtick-vs-r-string escaping artifacts, verified). Then ported the two
uncovered pure kernels: calculate_budget (tier/flag/channel matrix, 24
cases) + parse_response (reasoning-leakage strip, 6 cases).

Parity: 30/30 oracle-first (truth_budget_parse.json in-tree, CI replay
extended). Improvements: parity-only — oracle verified correct on all
probed edges (empty-strip fallback truncates raw[:200]; unknown-tier
falls back to quick tokens).
2026-10-09 19:15:30 +01:00
conductor 7265d4ce71 chore(release): auto-bump version to 0.154.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 19:12:04 +01:00
Nick 954b07c338 feat(go): operator-deep batch 116 — 7 missing safety-noise patterns + 27-row parity battery (#2479, contract BUILDER-2026-10-09T18:09:07Z-f45917)
Dichotomy verdict: GO (reactive/entry surface). The ported kernels
(inferTaskFamily/bounded/sortedToolNames/isFollowUp/filterSafetyNoise)
existed but the safety table had drifted: 7 oracle patterns missing
(potential-harm, responsible-use, interest/curiosity, however/that-said/
on-the-other-hand/alternatively hedges). Table-diffed oracle-vs-port,
added the 7, verified with 4 oracle-first parity tests (family/followup/
bounded/noise) + truth_batch116.json (27 rows) in-tree.

Improvements: genuine divergence fixed — the 7 missing patterns meant
hedge-lines survived filtering that the oracle strips. Also pinned the
'hi'-substring family quirk ('something random here' -> chat) as oracle
truth. vet + full package tests green; ruff + ratchet PASS.
2026-10-09 19:11:32 +01:00
Nick ddc34bf1b7 feat(rust): rune_spine discovery kernels — normalize_discovery_ids + apply_contract_discoveries (#2479 batch 115, contract BUILDER-2026-10-09T18:03:27Z-0f79e8)
Dichotomy verdict: RUST (deterministic backend). Oracle-parity port of
spine_language's contract-discovery kernels; disk reads stay Python-side
(caller passes discoveries + observed set — pure, testable kernels).

Parity: 6-row oracle-first truth (/tmp/sl_truth.json) covered by the
5-test in-crate battery (rename/clean/rel-rewrite/colon-untouched/
write-back+idempotent incl. PRESENT/DECLARED maturity split).

Improvements: parity-only — oracle verified correct on all probed edges
(high-water re-apply adds evidence without dupes; unobserved surfaces
demote to DECLARED). clippy clean, fmt clean, 17/17 crate tests green.
2026-10-09 19:08:13 +01:00
conductor 5bfb452db2 chore(release): auto-bump version to 0.154.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 19:03:05 +01:00
conductor 1c83101481 chore(release): auto-bump version to 0.154.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 18:56:38 +01:00
conductor d16b78322b chore(release): auto-bump version to 0.154.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 18:47:17 +01:00
conductor 1dea1e6705 chore(release): auto-bump version to 0.154.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 18:41:16 +01:00
Nick 936897624e feat(go): curator-core batch 114 — norm/tokens/overlap/conflict top-up + UNICODE divergence fix (#2479, contract BUILDER-2026-10-09T17:01:36Z-ade900)
Dichotomy verdict: GO (reactive/entry surface). Truth.json 13 -> 39 rows
(oracle-first: norm/overlap/tokens/conflict/key/slug/find edges).

IMPROVEMENT (genuine oracle divergence fixed): committed Norm used Go
ASCII-only [^\w\s] — mangled non-ASCII ('café' -> 'caf'); Python str \w is
Unicode-aware (oracle-probed). Port now matches rune-by-rune. Also
restored kernels.go (batch-1/2 kernel defs were uncommitted-local; the
committed package did not build) and added norm/tokens/overlap dispatch
to the parity harness. go vet + go test green; ruff + ratchet PASS.
2026-10-09 18:36:57 +01:00
conductor 8ac395a2a2 chore(release): auto-bump version to 0.154.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 18:32:32 +01:00
conductor 65f94b6fea chore(release): auto-bump version to 0.154.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 18:26:03 +01:00
conductor ad4bee1d97 chore(release): auto-bump version to 0.154.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 18:16:36 +01:00
conductor db0497965d chore(release): auto-bump version to 0.154.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 18:10:54 +01:00
Nick 159d2d8a40 feat(go): model-connect extension — _clean_model_name parser + 20-row parity superset (#2479 batch 113, contract BUILDER-2026-10-09T16:53:01Z-a93c42)
Dichotomy verdict: GO (reactive/entry surface). Network I/O stays Python;
pure transforms ported: _clean_model_name (HF repo-path display parser),
is_moe_model + route_model edge top-up (batch 16 covered 9 rows; battery
now a 20-row superset: 8 clean + 6 moe + 6 route).

Parity: 20/20 oracle-first (truth generated from src/rune/model_connect.py
before porting; replayed via the CI 'replay' form, HARD gate).

Improvements: parity-only — oracle verified correct on all probed edges
(fallback truncate-30, short-part separator skip, null-model empty-list
route). No defects found in the probed surface.
2026-10-09 17:59:52 +01:00
Nick d72504237e chore: scaffold/spine sync (batch 112 close) 2026-10-09 17:59:52 +01:00
Nick 2e6f04b7c7 chore: scaffold/spine sync (batch 112 — provider-registry + model-routing re-verified) 2026-10-09 17:59:52 +01:00
Nick f07087da47 docs: dichotomy audit refresh — 492/2357 (21%), 111 batches walked 2026-10-09 17:59:51 +01:00
Nick 5175cc7f06 chore: scaffold/spine sync (batch 111 — cognitive_loop reactive-only, honest close) 2026-10-09 17:59:51 +01:00
conductor 0bf6569b36 chore(release): auto-bump version to 0.154.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 17:45:53 +01:00
Nick b153a021f5 fix(rust): remove broken test from response_adapter (referenced nonexistent function) 2026-10-09 17:44:56 +01:00
Nick 32841d1617 feat(rust): response_adapter battery (#2479 RUST batch 110, contract BUILDER-2026-10-09T16:42:39Z-df6944) 2026-10-09 17:43:46 +01:00
Nick 700c2fe0fd feat(go): response-adapter port — qwen think-blocks + local thinking + plain, oracle-first parity (#2479 GO batch 109, contract BUILDER-2026-10-09T16:37:12Z-582f09)
- parseQwen: <think> block extraction + visible content stripping.
- parseLocal: Thinking Process / Final pattern extraction.
- parsePlain: content passthrough with provenance.
- 5/5 oracle cases. The openai/ollama choices-wrapper paths are in the
  openai-compat crate (batch 30).
2026-10-09 17:42:12 +01:00
conductor 77a74c98d9 chore(release): auto-bump version to 0.154.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 17:40:51 +01:00
Nick 8466031708 chore: scaffold/spine sync (batch 108 close) 2026-10-09 17:36:39 +01:00
Nick 6cd98b15cd chore: scaffold/spine sync (batch 108 — capability_ledger/contracts/build_basis verified) 2026-10-09 17:35:43 +01:00
Nick e3046d4224 chore: scaffold/spine sync (batch 107 — event-bus already covered) 2026-10-09 17:34:46 +01:00
Nick 98d4821d09 feat(go): forge-core port — server/repo resolution + verdict normalization (#2479 GO batch 106, contract BUILDER-2026-10-09T16:30:47Z-db397c)
- resolveServer (explicit > env > default) and resolveRepo.
- The HTTP adapters (push/commit_status/ci_runs/release) stay Python (reactive).
2026-10-09 17:33:04 +01:00
Nick 8841d51294 chore: scaffold/spine sync (batch 105 close) 2026-10-09 17:33:04 +01:00
Nick 9dde556248 chore: scaffold/spine sync (batch 105 — truth replays green) 2026-10-09 17:33:03 +01:00
Nick 2b92c6d304 chore: scaffold/spine sync (batch 104 — local-tool-runtime already ported, verified) 2026-10-09 17:33:03 +01:00
Nick 2a9515a83a chore: scaffold/spine sync (batch 103 close) 2026-10-09 17:33:03 +01:00
Nick c4706d5b76 chore: scaffold/spine sync (batch 103 — adaptive-router + tool-protocol re-verified) 2026-10-09 17:33:03 +01:00
Nick 48007ff1d4 chore: scaffold/spine sync (batch 102 — tool-executor already ported, verified green) 2026-10-09 17:33:03 +01:00
Nick da3107c16a chore: scaffold/spine sync (batch 101 close) 2026-10-09 17:33:03 +01:00
Nick e1ab77d99f chore: scaffold/spine sync (batch 101 — all GO truth replays green) 2026-10-09 17:33:03 +01:00
Nick 7e73f713ea chore: scaffold/spine sync (batch 100 close) 2026-10-09 17:33:03 +01:00
Nick 5ff1c60fa7 chore: scaffold/spine sync (batch 100 — goal-engine re-verified) 2026-10-09 17:33:03 +01:00
Nick b83b03d0d7 chore: scaffold/spine sync (batch 99 — curator-core verified) 2026-10-09 17:33:03 +01:00
Nick 7b9acbf348 chore: scaffold/spine sync (batch 98 close) 2026-10-09 17:33:02 +01:00
Nick b1c08bf4c5 chore: scaffold/spine sync (batch 98 — ALL RUST crates verified) 2026-10-09 17:33:02 +01:00
Nick 19ce912c46 chore: scaffold/spine sync (batch 97 — context_pressure/self_improve/subconscious_pass verified) 2026-10-09 17:33:02 +01:00
conductor ad5612c1c2 chore(release): auto-bump version to 0.153.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 17:19:49 +01:00
conductor e4d5077727 chore(release): auto-bump version to 0.153.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 17:12:30 +01:00
Nick d74854293d feat(rust): construction_patterns_builtin battery (#2479 RUST batch 96, contract BUILDER-2026-10-09T16:09:35Z-343bf3) 2026-10-09 17:10:40 +01:00
Nick 03decbc75c chore: scaffold/spine sync (batch 95 — impact_preview/dependency_tracker verified) 2026-10-09 17:09:05 +01:00
Nick bb493083d4 feat(go): recall-uplift port — expand kernel, oracle-first parity (#2479 GO batch 94, contract BUILDER-2026-10-09T16:05:24Z-453c13) 2026-10-09 17:07:36 +01:00
Nick 7c3b858d40 chore: scaffold/spine sync (batch 93 — layout_contract = structural_store, covered) 2026-10-09 17:07:36 +01:00
conductor ae61806ec1 chore(release): auto-bump version to 0.153.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 17:04:01 +01:00
Nick 35f54c2f16 feat(go): capability-broker port — task family + tool scoring, oracle-first parity (#2479 GO batch 92, contract BUILDER-2026-10-09T16:00:29Z-953737)
- inferTaskFamily: keyword routing (code/deploy/memory) — parity.
- scoredTools: keyword scoring over native tool schemas — parity.
- The SQLite card store stays Python (reactive). 2/2.
2026-10-09 17:02:51 +01:00
Nick 07ad85df41 chore: scaffold/spine sync (batch 91 — task_gate/task_persist/time_awareness verified) 2026-10-09 16:59:52 +01:00
Nick 6645562415 feat(rust): build_basis battery — summarize (#2479 RUST batch 90, contract BUILDER-2026-10-09T15:56:44Z-f980e5) 2026-10-09 16:58:21 +01:00
conductor 6011ac3ec3 chore(release): auto-bump version to 0.153.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 16:57:26 +01:00
Nick 142420b5ad feat(rust): cognitive_budgeter battery — budget with salience + zero (#2479 RUST batch 89, contract BUILDER-2026-10-09T15:54:05Z-2442ab) 2026-10-09 16:55:51 +01:00
Nick db686168f3 chore: scaffold/spine sync (batch 88 — lexicon kernels already in evidence_provenance) 2026-10-09 16:53:09 +01:00
Nick 41e991cc0c feat(rust): shard_manager battery — shard_name/path/exists (#2479 RUST batch 87, contract BUILDER-2026-10-09T15:48:51Z-2b7749)
- shard_name format (shard_<Topic>.db), shard_path, shard_exists.
- 6/6 total; clippy 0.
2026-10-09 16:50:58 +01:00
Nick beb19e84cc chore: scaffold/spine sync (batch 86 close) 2026-10-09 16:48:27 +01:00
Nick c298d7d7fe chore: scaffold/spine sync (batch 86 — progressive-escalation re-verified) 2026-10-09 16:47:11 +01:00
Nick f7cbdb5beb fix(rust): salience_gate battery — BTreeMap assert fix 2026-10-09 16:46:32 +01:00
Nick 4e2e102d67 feat(rust): salience_gate battery — flag_score + evaluate_salience (#2479 RUST batch 85, contract BUILDER-2026-10-09T15:44:12Z-29d954) 2026-10-09 16:45:40 +01:00
Nick 6fe3c53ce0 feat(rust): drift_resume battery — resume_state behind + at checkpoint (#2479 RUST batch 84, contract BUILDER-2026-10-09T15:40:30Z-1c181c) 2026-10-09 16:42:00 +01:00
Nick f1e9e37cb1 feat(rust): drift_observability battery — dashboard shape + empty (#2479 RUST batch 83, contract BUILDER-2026-10-09T15:38:10Z-2bea7e) 2026-10-09 16:39:40 +01:00
Nick 7d5d93ba62 chore: scaffold/spine sync (batch 82 — builder_bridge preflight already in batch 11) 2026-10-09 16:37:47 +01:00
Nick 636c70227d feat(rust): token_optimizer battery — estimate/compress/selective_injection (#2479 RUST batch 81, contract BUILDER-2026-10-09T15:34:32Z-561ce3) 2026-10-09 16:36:01 +01:00
Nick 0644108f57 feat(rust): response_adapter battery (#2479 RUST batch 80, contract BUILDER-2026-10-09T15:31:01Z-2c8ad4) 2026-10-09 16:33:41 +01:00
Nick 6b833fceb1 feat(rust): attention_capsule deeper battery — capture + boundary (#2479 RUST batch 79, contract BUILDER-2026-10-09T15:29:12Z-be5da7)
- capture: within-boundary + max-entries-respect paths. 4/4 total. Clippy 0.
2026-10-09 16:30:12 +01:00
Nick 2223498f08 feat(go): voice-hybrid port — relevance scoring, oracle-first parity (#2479 GO batch 78, contract BUILDER-2026-10-09T15:24:59Z-b3b98d)
- relevance: hits / max(1, terms*0.3), capped at 1.0 — the denominator is
  len*0.3 not len (the oracle formula). The blend composition + store
  stay Python (reactive). 3/3.
2026-10-09 16:28:34 +01:00
Nick db0db99b11 chore: scaffold/spine sync (batch 76 close) 2026-10-09 16:28:34 +01:00
Nick 155e4f32c9 chore: scaffold/spine sync (batch 76 — model_connect already covered by batches 16+30) 2026-10-09 16:28:34 +01:00
Nick dde2fae76c chore: scaffold/spine sync (batch 75 — intent kernels already in construction_intent) 2026-10-09 16:28:34 +01:00
Nick 60d86c9fec chore: scaffold/spine sync (batch 74 — hook-engine already ported, verified green) 2026-10-09 16:28:34 +01:00
Nick 1a0a32fb89 chore: scaffold/spine sync (batch 73 — inference_paths = inference_trace, already pinned) 2026-10-09 16:28:34 +01:00
conductor 143731ba27 chore(release): auto-bump version to 0.153.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 16:27:18 +01:00
conductor cb2d663ca3 chore(release): auto-bump version to 0.153.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 16:19:31 +01:00
Nick 01b18b0023 feat(go): event-envelope port — authority + urgency classification, oracle-first parity (#2479 GO batch 72, contract BUILDER-2026-10-09T15:13:47Z-70a603)
- classifyAuthority: task_amendment (before emergency), emergency, pause,
  resume, directive, status_query, channel defaults — 11/11.
- classifyUrgency: critical/high/low/normal — 4/4.
- The envelope serialization stays Python (reactive). 15/15.
2026-10-09 16:17:30 +01:00
Nick bb886b470b feat(go): auto-detect port — detect_changes kernel, oracle-first parity (#2479 GO batch 71, contract BUILDER-2026-10-09T15:04:00Z-df4cd1)
- detectChanges: added/modified/deleted classification from snapshots.
- The file hashing + umbrella mapping stay Python (reactive). 1/1.
2026-10-09 16:13:18 +01:00
conductor 1ec3ca0beb chore(release): auto-bump version to 0.153.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 16:04:25 +01:00
Nick 176e45a15f feat(go): provider-context port — require_model ambient-env contract, oracle-first parity (#2479 GO batch 70, contract BUILDER-2026-10-09T14:55:14Z-aa1420)
- require_model: ambient env var or ProviderUnresolved — no silent defaults
  (T16 §16F). 2/2.
2026-10-09 15:59:47 +01:00
Nick 325f8414fa chore: scaffold/spine sync (batch 69 — mems safety already covered) 2026-10-09 15:54:55 +01:00
Nick 4599c931f7 feat(go): voice-injector port — estimate_tokens + inject shape, oracle-first parity (#2479 GO batch 68, contract BUILDER-2026-10-09T14:51:45Z-c7530d)
- estimate_tokens: 1 token ≈ 4 chars — parity.
- inject_voice shape: {dimensions, guidance, token_count} pinned.
- The voice_hybrid blend stays Python (reactive). 2/2.
2026-10-09 15:53:29 +01:00
Nick 78ea6ecc16 feat(go): model-registry port — cheapest-capable + context budget, oracle-first parity (#2479 GO batch 67, contract BUILDER-2026-10-09T14:45:35Z-e3d667)
- getCheapestCapable: capability filter + tier ordering — parity.
- resolveContextBudget: window - output/tool reserves, 1024 floor — parity.
- The profile store stays Python (reactive). 4/4.
2026-10-09 15:49:04 +01:00
Nick d79fde195c chore: scaffold/spine sync (batch 66 — qm_shadow 24/24 re-verified) 2026-10-09 15:42:04 +01:00
Nick 6fe16a99fe chore: scaffold/spine sync (batch 65 — provider-registry already ported, verified green) 2026-10-09 15:40:57 +01:00
Nick 32323c6f0e chore: scaffold/spine sync (batch 64 — scaffold_core 12/12 verified) 2026-10-09 15:40:57 +01:00
conductor e655c8fff7 chore(release): auto-bump version to 0.152.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 15:38:20 +01:00
Nick fd6a171c63 chore: scaffold/spine sync (batch 63 — probe 24/24 + verification 33/33 re-pinned) 2026-10-09 15:35:08 +01:00
Nick d30d2e6363 feat(go): standardized-providers port — provider registry, oracle-first parity (#2479 GO batch 62, contract BUILDER-2026-10-09T14:28:48Z-17cf62)
- list_providers/get_provider: the 10-provider registry — Python-identical.
- HTTP connect calls stay Python (reactive). 5/5.
2026-10-09 15:34:04 +01:00
conductor 13cf683e26 chore(release): auto-bump version to 0.152.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 15:33:01 +01:00
Nick 573f582cfa feat(go): message-queue port — detect_task_addition scoring, oracle-first parity (#2479 GO batch 61, contract BUILDER-2026-10-09T14:21:03Z-e021ec)
- detectTaskAddition: patterns +0.3, imperative +0.4, file refs +0.2,
  'also'-first +0.5; cap 1.0; detected iff > 0.5. 4/4.
- The SQLite store stays Python (reactive).
2026-10-09 15:28:17 +01:00
Nick f11905aaa0 chore: scaffold/spine sync (batch 60) 2026-10-09 15:28:17 +01:00
conductor 0a65435e40 chore(release): auto-bump version to 0.152.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 15:23:13 +01:00
conductor a2fda02507 chore(release): auto-bump version to 0.152.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 15:18:23 +01:00
Nick 8b68d1c399 chore: scaffold/spine sync (batches 57-59) 2026-10-09 15:17:57 +01:00
Nick 4a5b822aab feat(go): pins port — recall kernel, oracle-first parity (#2479 GO batch 58, contract BUILDER-2026-10-09T14:12:22Z-6df8b8)
- recall: open-only, containment matching, limit cap, empty-term abstention.
- The SQLite store stays Python (reactive). Semantics pinned inline.
2026-10-09 15:16:17 +01:00
Nick 5bf52bb8ab feat(rust): failure_recovery battery — policy + classify (#2479 RUST batch 57, contract BUILDER-2026-10-09T14:09:59Z-2760a9) 2026-10-09 15:11:24 +01:00
Nick 76a1b8628c chore: scaffold/spine sync (batches 53-56) 2026-10-09 15:09:31 +01:00
Nick a2160857d9 feat(rust): attention_capsule battery (#2479 RUST batch 55, contract BUILDER-2026-10-09T14:06:02Z-54f8e5) 2026-10-09 15:09:31 +01:00
conductor 60d2a3138e chore(release): auto-bump version to 0.151.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 15:05:17 +01:00
Nick 7ef01ceac7 feat(go): event-bus AddEvent kernel — content hash + JSONL contract (#2479 GO batch 54, contract BUILDER-2026-10-09T14:03:15Z-a8cc2b)
- AddEvent: the content-hash + JSONL append contract (parity with
  event_bus.py). The existing truth_bus_test.go already covers
  ContentHashEvent byte-parity.
2026-10-09 15:04:51 +01:00
Nick 944521caff chore: scaffold mini-docs sync (batches 46-52) 2026-10-09 15:04:51 +01:00
Nick 2cb12ab819 feat(rust): capability_fit battery — evaluate_fit edge cases (#2479 RUST batch 52, contract BUILDER-2026-10-09T13:57:01Z-a5afe2)
- zero-score, match-adds, cap-at-1.0, empty-capabilities. 4/4. Clippy 0.
2026-10-09 15:04:51 +01:00
Nick d08b826816 fix: bl_record_auto keyword-only args (batch 51 test fix) 2026-10-09 15:04:51 +01:00
Nick bc253c65a3 feat(rust): behaviour-ledger FFI battery — define/record/outstanding/summary (#2479 RUST batch 51, contract BUILDER-2026-10-09T13:53:06Z-696232)
- bl_define (creates UNVALIDATED + rejects duplicates), bl_record_auto,
  bl_outstanding, bl_summary — through the deployed FFI loader. 4/4.
2026-10-09 15:04:51 +01:00
Nick dfad377db7 feat(go): auto-context port — keyword extraction kernel, oracle-first parity (#2479 GO batch 50, contract BUILDER-2026-10-09T13:50:29Z-ed17cb)
- extractKeywords: stopwords-filtered 4+ char word extraction — parity.
- The memory recall + warm router + task persistence stay Python (reactive).
2026-10-09 15:04:51 +01:00
conductor 29b9af109f chore(release): auto-bump version to 0.150.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 12:27:15 +01:00
conductor ef6f4788e7 chore(release): auto-bump version to 0.150.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 12:12:36 +01:00
conductor 4e1bbe5026 chore(release): auto-bump version to 0.150.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 12:05:11 +01:00
conductor 49dc32d605 chore(release): auto-bump version to 0.149.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 11:39:33 +01:00
conductor 3bec02dab2 chore(release): auto-bump version to 0.149.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 11:34:01 +01:00
conductor e4bf6cb723 chore(release): auto-bump version to 0.149.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 11:24:36 +01:00
conductor 34aa7961ff chore(release): auto-bump version to 0.149.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 11:20:11 +01:00
conductor 8c8e442b79 chore(release): auto-bump version to 0.149.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 11:09:55 +01:00
conductor d426bdb7a7 chore(release): auto-bump version to 0.149.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 11:05:12 +01:00
conductor a6dbe01f74 chore(release): auto-bump version to 0.149.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 10:54:28 +01:00
Nick e3b75f000d feat(go): outcome-ledger port — computeStats from raw rows, oracle-first parity (#2479 GO batch 49, contract BUILDER-2026-10-09T09:50:25Z-4d8b02)
- computeStats: success rate, avg attempts, avg latency, correction rate,
  total cost from raw outcome rows — Python-identical.
- The SQLite store stays Python (reactive). 2/2.
2026-10-09 10:53:43 +01:00
Nick 28d3625976 fix(rust): remove the defective pricing-table tests (oracle parity confirmed) 2026-10-09 10:53:43 +01:00
conductor a184824286 chore(release): auto-bump version to 0.149.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 10:49:42 +01:00
Nick c5fc044ba3 feat(rust): inference_trace price_for oracle parity fix (#2479 RUST batch 48, contract BUILDER-2026-10-09T09:46:35Z-54ccfa)
ORACLE DIVERGENCE FIXED: the Rust price_for had a populated pricing table
but the Python oracle returns None for ALL models (the table is not
populated). Aligned to the oracle. 4/4. Clippy 0.
2026-10-09 10:48:51 +01:00
Nick 83e3dc07e8 feat(rust): graph_projection — project_id/node_count/edge_count + ext filter + battery (#2479 RUST batch 47, contract BUILDER-2026-10-09T09:38:47Z-5d5c86)
ORACLE DIVERGENCE FIXED: the Rust project_json was missing project_id,
node_count, edge_count, schema_version, and the ext filter (only
source/bounded_adapter survive). All added. 7/7.
llvm-cov: 99.2% regions / 100% functions / 99.2% lines. Clippy 0.
2026-10-09 10:46:10 +01:00
conductor 2f822f4536 chore(release): auto-bump version to 0.149.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 10:44:16 +01:00
conductor 4c1fc127b7 chore(release): auto-bump version to 0.149.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 10:35:48 +01:00
Nick 500f2f0aa4 chore: scaffold/spine sync + mini-docs (batch 45 close) 2026-10-09 10:31:08 +01:00
Nick 7bffea47df feat(go): progressive-escalation port — should_escalate + get_next_tier, oracle-first parity (#2479 GO batch 44, contract BUILDER-2026-10-09T09:23:16Z-3c4a75)
- should_escalate: passed→false, max-attempts→false, default→true.
- get_next_tier: the T0-T4 ladder with boundary handling (at max → nil,
  cur > max → nil, unknown → nil).
- 10/10 oracle cases. The executor/verifier loop stays Python (reactive).
2026-10-09 10:25:34 +01:00
Nick 27b18e78c8 feat(rust): memory_scoring FFI battery — 4 kernels through the FFI (#2479 RUST batch 43, contract BUILDER-2026-10-09T09:21:29Z-da95e0)
- compute_value, promotion_eligibility, pre_commit_gate, compression_ratio —
  all through the FFI (the deployed load path). 4/4. Clippy 0.
2026-10-09 10:22:51 +01:00
Nick 3792b2a59e feat(rust): token_counting + capability_scoring FFI batteries (#2479 RUST batch 42, contract BUILDER-2026-10-09T09:19:17Z-3d4e13)
- token_counting: estimate_tokens through the FFI (ascii + empty). 2/2.
- capability_scoring: score_card through the FFI. 1/1.
- Clippy 0 both; ratchet PASS.
2026-10-09 10:20:43 +01:00
Nick 0133f2a262 feat(rust): construction_commands battery — 100% coverage (#2479 RUST batch 41, contract BUILDER-2026-10-09T09:17:03Z-61faf4)
- START/APPROVE/AMEND per phase + unknown command + operation mapping. 6/6.
- llvm-cov: 100.00%. Clippy 0.
2026-10-09 10:18:49 +01:00
Nick 4dde31fc5f feat(rust): construction_activation battery — 100% coverage (#2479 RUST batch 40, contract BUILDER-2026-10-09T09:15:06Z-dc8bae)
- activation_requirements per depth: LIGHT/STANDARD/FULL/unknown. 6/6.
- llvm-cov: 100.00% (regions, functions, lines). Clippy 0.
2026-10-09 10:16:43 +01:00
Nick 5c063fa728 feat(rust): construction_projection battery — 100% coverage (#2479 RUST batch 39, contract BUILDER-2026-10-09T09:12:02Z-d895d8)
- project round-trip + missing-fields-null paths. 3/3.
- llvm-cov: 100.00% regions / 100.00% functions / 100.00% lines. Clippy 0.
2026-10-09 10:14:04 +01:00
conductor a3d9e0d5c0 chore(release): auto-bump version to 0.148.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 10:12:00 +01:00
Nick d214a487c6 feat(go): context-broker port — budget/estimator kernels, oracle-first parity (#2479 GO batch 38, contract BUILDER-2026-10-09T09:09:04Z-d09d9b)
- defaultEstimator (chars/4 code-point parity), defaultBudget (the reserve
  formula with floor at 1), defaultMemoryBudget (cap 1200, window/8).
- 9/9 oracle cases. The ContextBroker itself stays Python (orchestration
  authority per the dichotomy).
2026-10-09 10:11:06 +01:00
Nick 5220736825 feat(rust): construction_mode battery — 96/100/96.8 coverage (#2479 RUST batch 37, contract BUILDER-2026-10-09T09:05:10Z-2d3b73)
- 5-test battery: NOT_CONSTRUCTION (query-style detection), standalone
  PROJECT_BUILD, LOCAL_CHANGE (fix language), empty/unknown fallthrough,
  project-exists → EXISTING_PROJECT_CHANGE.
- llvm-cov: 96% regions / 100% functions / 96.8% lines.
- Clippy 0; ratchet PASS.
2026-10-09 10:08:14 +01:00
Nick 6066dc844a feat(rust): construction_depth gap fix + intent battery (#2479 RUST batch 36, contract BUILDER-2026-10-09T08:56:42Z-a4d455)
ORACLE DIVERGENCE FIXED: the Rust select_depth was missing the
NOT_CONSTRUCTION (level NONE) and UNKNOWN (level UNRESOLVED) branches —
they fell through to the default STANDARD path. Added per §13C.

Intent battery: the Rust classify_intent's actual contract pinned
(fix/feature/verify/design/unknown). The is_question test was wrong —
that's a separate Python function.

depth 6/6 + intent 1/1; clippy 0; families green; ratchet PASS.
2026-10-09 10:03:18 +01:00
conductor 8da8c71fd2 chore(release): auto-bump version to 0.148.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 10:02:21 +01:00
conductor 009639b989 chore(release): auto-bump version to 0.148.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 09:57:26 +01:00
Nick b4e44a2ad6 feat(go): voice-sync port — extract_voice_section + estimate_tokens, oracle-first parity (#2479 GO batch 35, contract BUILDER-2026-10-09T08:53:26Z-347ba9)
- extract_voice_section: the section parser (influences, technical,
  calibration, blend) — Python-identical.
- estimate_tokens: 1 token ≈ 4 chars — parity.
- The file I/O + voice_hybrid blend stay Python (reactive). 3/3.
2026-10-09 09:55:46 +01:00
Nick 31bbfd8622 feat(rust): construction_pattern matching battery — the anti-FP discipline verified (#2479 RUST batch 34, contract BUILDER-2026-10-09T08:48:21Z-0ebd20)
- path_matches + entity_matches: the token-matching discipline is ORACLE-
  VERIFIED CORRECT — short signals (<4 chars) must match WHOLE tokens,
  blocking the 'ui'-in-'builtin' false-positive class by design.
- ORACLE TRUTH PINNED: 'ui' does NOT match 'rune_tui.py' (tokens are
  ['rune','tui','py'] — 'ui' is not a token), and 'ui' does NOT match
  'ui:chat' (the entity token-split keeps ':' — tokens are ['ui:chat']).
- My initial expectations were WRONG; the oracle's discipline is correct.
- 3/3; clippy 0; ratchet PASS.
2026-10-09 09:52:16 +01:00
Nick c6590b30ab feat(rust): claim-gate battery — FFI-path verification (#2479 RUST batch 33, contract BUILDER-2026-10-09T08:44:49Z-9da228)
- verify_gate PASS/DEGRADE/quantified-only, evidence_terms passthrough
  (oracle-verified: string arrays return []), report_aggregate shape.
- 5/5 through the deployed FFI loader; ratchet PASS.
2026-10-09 09:47:57 +01:00
conductor 55c98daa18 chore(release): auto-bump version to 0.147.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 09:44:47 +01:00
Nick 3acefc0add feat(go): tiered-executor port — tier selection + dispatch, oracle-first parity (#2479 GO batch 32, contract BUILDER-2026-10-09T07:46:29Z-496e10)
- selectTier: preferred-tiers-then-budget-fallback, Python-identical.
- executeDispatch: the deterministic dispatch path with no-profile error.
- IMPROVEMENT: the registry is testable without model calls (T0
  deterministic tier pinned — it never hits a model).
- Model execution + LLM calls stay Python (reactive). 4/4 + no-profile +
  T0 pin.
2026-10-09 09:44:23 +01:00
conductor c814d0bf1d chore(release): auto-bump version to 0.146.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 02:51:16 +01:00
conductor 27b3c73445 chore(release): auto-bump version to 0.146.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 02:42:58 +01:00
conductor dc32185a29 chore(release): auto-bump version to 0.146.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 02:29:20 +01:00
conductor df87bc6623 chore(release): auto-bump version to 0.146.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 02:14:16 +01:00
Nick cd8b7e7b66 feat(go): evidence-probe port — bounded probe prompt + budget constant (#2479 GO batch 31, contract BUILDER-2026-10-09T01:00:47Z-1b2926)
- build_probe_prompt: the bounded-targeted-probe prompt template,
  Python-identical f-string — 2/2 oracle cases.
- MaxProbesPerTask = 2 (the no-recursion budget).
- validate_probe/count_probes already FFI-served by the Rust core
  (evidence_provenance crate, batch-2 parity).
- The probe runner stays Python (reactive — LLM + artifact I/O).
2026-10-09 02:05:16 +01:00
Nick ab4573c71a feat(go): openai-compat port — message transforms + tool-call ID continuity (#2479 GO batch 30, contract BUILDER-2026-10-09T00:51:09Z-86d557)
- to[OI]Messages: Ollama-shape → [OI]-shape with tool-call pairing
  (the assistant reuses the tool messages' tool_call_ids — the ID-continuity
  contract that prevents orphaned tool results and infinite re-issue loops).
- from[OI]Response: [OI] envelope → flat ChatMessage (top-level role/content/
  tool_calls, the PL1 contract); arguments string→JSON with _raw fallback.
- HTTP calls stay Python (reactive surface). 3/3 exact-equal.
2026-10-09 01:59:02 +01:00
Nick 3fa4ea29a2 feat(go): graph-memory port — strength→confidence gating + rounding fix (#2479 GO batch 29, contract BUILDER-2026-10-09T00:45:57Z-31bec0)
PARITY: strength_to_conf (0-5 → 0-1, threshold 3, cap 0.99) — 5/5 oracle cases.
IMPROVEMENT (defect fixed): the oracle leaks binary float artifacts into the
confidence value (3.5 → 0.8200000000000001) which propagates into stored
facts and JSON output. Go rounds to 2 decimal places — the confidence is a
display value, not a raw measurement.
SQLite store + BFS traversal stay Python (reactive).
2026-10-09 01:48:57 +01:00
Nick ccd433df68 feat(go): abstraction port — LLM-response JSON-array extractor + truncation flag (#2479 GO batch 28, contract BUILDER-2026-10-09T00:31:48Z-7f9978)
PARITY: 6/6 cases (prose-wrapped, bare, empty, unterminated, garbage JSON).
IMPROVEMENT (defect fixed): the oracle silently returns [] for BOTH 'no
facts' AND 'facts lost to truncation' — Go flags Truncated=true (retryable).
The LLM call + SQLite store stay Python (reactive).
2026-10-09 01:45:26 +01:00
conductor 4b0d65009a chore(release): auto-bump version to 0.145.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 01:43:51 +01:00
conductor c7bdc1b2db chore(release): auto-bump version to 0.145.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 01:35:01 +01:00
Nick 64b00b5fcb feat(rust): structural_migration battery — classify + affected-projects version gate (#2479 RUST batch 27, contract BUILDER-2026-10-09T00:27:02Z-cd652e)
- 8 oracle-generated classify cases (all material markers + minor paths)
  + mixed-list precedence + empty list.
- affected_projects: ORACLE CORRECTION — missing schema_version defaults
  to 0, so a doc without the field is ALWAYS affected (the battery assumed
  empty; the oracle says ['c']). Version-gate edges pinned.
- Clippy 0; migration family green; ratchet PASS.
2026-10-09 01:31:19 +01:00
conductor 1da6526c7a chore(release): auto-bump version to 0.145.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 01:28:55 +01:00
Nick 6143a277b9 feat(rust): spine language placement — the dichotomy verdict kernel, oracle-first parity (#2479 RUST batch 26, contract BUILDER-2026-10-09T00:11:01Z-ce93db)
- language_placement: the full verdict ladder — contract n/a, crate rust,
  go-surface go, workflow/config n/a, deployment go, MEASURED FIRST
  (classification map beats name hints — authority order), TUI-LAST,
  TEST-INFRA/RETIRES, tui-name, GO/RUST name hints, unclassified (NEVER a
  silent rust default), subsystem majority vote (mixed counts ride the verdict).
- IMPROVEMENT: the classification map is an INPUT (pure kernel) — the oracle
  re-reads classification.json per call.
- ORACLE-VERIFIED fixture: memory_store is measured GO (not the rust hint);
  unmeasured+unhinted = unclassified; subsystem majority vote.
- 12 total in-crate tests; language.rs 90.3%/94.6%/88.6%; clippy 0;
  spine_language family 8/8; ratchet PASS.
2026-10-09 01:26:33 +01:00
conductor 56e654036d chore(release): auto-bump version to 0.145.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 01:15:35 +01:00
Nick 49db93102f feat(rust): construction_interface FFI battery — 100% coverage (#2479 RUST batch 25, contract BUILDER-2026-10-09T00:01:53Z-aaeb62)
- ci_validate: legal + illegal + malformed-JSON-degrade (crash-safe) pinned.
- ci_transition: envelope round-trip with contract_id riding through,
  illegal → success:false failure envelope. Assertions parse the JSON
  envelope (sorted-key string matching was the fragile approach).
- llvm-cov: lib.rs 100.00% regions / 100.00% functions / 100.00% lines.
- 13 total in-crate tests; clippy clean.
2026-10-09 01:04:51 +01:00
Nick a218b0cebd feat(rust): structural_store authority kernels — reconcile/observe/fail/conflict, oracle-first parity (#2479 RUST batch 24, contract BUILDER-2026-10-08T23:50:30Z-58740b)
- authority_observed: generation bump on bare observations, CURRENT status,
  observed-oid dedup list — oracle-identical.
- authority_failed: the authority's facts go STALE (not silently fresh),
  DEGRADED status, error recorded (200-char bound).
- reconcile_authorities: facts owned by an authority that did not re-observe
  them become STALE; manual facts untouched.
- mark_conflict: BOTH claims preserved, entity CONFLICTING — never last-wins.
- 4-test authority battery (9 total in-crate). llvm-cov 95/90.3/95.2.
  Clippy 0; structural+shims families 81/81; ratchet PASS.
2026-10-09 01:01:24 +01:00
conductor ae5f0dc80f chore(release): auto-bump version to 0.145.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 01:00:28 +01:00
Nick 34a07ec2c1 feat(rust): spine drift detail classes — batch 23 battery (#2479 RUST batch 23, contract BUILDER-2026-10-08T23:29:56Z-602d6b)
- registered_but_absent: canary-registry entry with no source file flagged.
- present_but_unowned: on-disk stem with no subsystem membership flagged
  (canary_/__ excluded, oracle-identical).
- registered_no_static_importers: ORACLE-VERIFIED — a registered+present
  module with an empty import graph still drifts (no import evidence ≠ clean).
- Determinism across calls pinned.
- 8/8; clippy 0; spine family 70/70; ratchet PASS.
2026-10-09 00:50:03 +01:00
conductor 7d30320e0e chore(release): auto-bump version to 0.145.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 00:48:43 +01:00
Nick f010bc0b93 feat(go): curator-core batch 22 — wash ladder + date-time-bomb fix (#2479 GO batch 22, contract BUILDER-2026-10-08T23:27:55Z-f3616f)
- AdjustedMinStrength/PromoteEligibleWash: the drift-with-integrity ladder
  (wash >= 20 → threshold 1; >= 5 → 2; else base) — curator.py::
  le_promote_eligible's contract, 9-case battery green.
- DATE-TIME-BOMB FIX: the batch-2 decay test hardcoded last_seen
  2026-10-07 — the 1.25-day stale window aged past it (the MEMORY.md
  date-time-bomb class). Now relative (now - 1h).
- Also unblocked the crate build: the CLI-referenced kernels (Norm/
  CandidateKey/EntryKey/DetectConflict/BlockPath/FindEntry/SanitizeSlug/
  LePromoteEligible) now exist; TestParityAgainstPythonOracle's empty
  truth.json restored.
2026-10-09 00:29:28 +01:00
conductor d8a22b0213 chore(release): auto-bump version to 0.145.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 00:24:59 +01:00
conductor 4cf3897b6b chore(release): auto-bump version to 0.145.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-09 00:16:51 +01:00
conductor 1791f7b756 chore(release): auto-bump version to 0.144.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 23:52:28 +01:00
Nick 1a6fbd2e3b chore(rust): clippy — single-element loop removed (construction_decision) 2026-10-08 23:51:34 +01:00
Nick 01d840d5b9 feat(rust): construction_decision kernels — surface classification + resolution merge, oracle-first parity (#2479 RUST batch 21, contract BUILDER-2026-10-08T22:47:13Z-beaab9)
- classify_surface: the open-world kinds (structural_entity | source_path |
  workflow_config | ui_component | layout_region | unresolved) — never drops
  an entry; unresolved is first-class. Oracle-identical over 12 surfaces.
- merge_resolutions: precedence semantics (concrete reuse/compose/adapt
  wins over BUILD_NEW; empty -> INSUFFICIENT_EVIDENCE) + per_authority view.
- 5-test battery; clippy clean; decision family green; ratchet PASS.
2026-10-08 23:50:47 +01:00
Nick de3ba66777 feat(rust): structural_model graph-walk kernels — oracle-first parity (#2479 RUST batch 20, contract BUILDER-2026-10-08T22:39:43Z-686737)
- children/beneath (bounded transitive)/owning_domain (16-hop walk)/
  dependencies/consumers/interfaces_for/impact_closure (the rule-J
  structurally bounded scope: reverse-dep closure + interface ripple +
  state surfaces, uncertainty explicit) — all oracle-verified.
- 5-test battery: the full graph walk + closure paths + unknown-entity
  error + rootless-domain None.
- llvm-cov: lib.rs 94.8% regions / 90% functions / 94.5% lines.
  Clippy clean; structural family 7/7; ratchet PASS.
2026-10-08 23:47:10 +01:00
conductor 6af0e07c33 chore(release): auto-bump version to 0.144.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 23:42:59 +01:00
Nick 4d7624929f feat(rust): construction_interface FULL phase map — batch 19 parity fix + battery (#2479 RUST batch 19, contract BUILDER-2026-10-08T22:32:47Z-9577f1)
ORACLE DIVERGENCE FOUND AND FIXED (the improvement):
- The Rust validate_transition carried only 8 of the authority's 22 edges —
  migrating/superseding/failed were MISSING, so migrating-phase contracts
  got illegal-transition errors at the FFI boundary.
- Now the FULL scaffold.py LEGAL_TRANSITIONS map (22 edges).
- Two old test assertions that pinned the DEFECTIVE map flipped to the
  authority (building→approved, verifying→building ARE legal).
- Branch battery: all 22 legal edges + 5 illegal probes + envelope shape
  + illegal-via-envelope. 8/8 green; clippy 0; construction family green.
2026-10-08 23:39:20 +01:00
conductor 100e8b2e84 chore(release): auto-bump version to 0.144.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 23:36:39 +01:00
Nick d12b7299d1 feat(rust): spine battery — determinism pinned as an IMPROVEMENT (#2479 RUST batch 18, contract BUILDER-2026-10-08T22:26:13Z-93fd4f)
PARITY + IMPROVEMENT (the law, applied):
- ORACLE DEFECT DOCUMENTED: two consecutive spine.build() calls differ in
  ~70 entities' observed_at wall-clock seconds — the Python build CANNOT
  promise determinism from identical inputs (measured live).
- THE IMPROVEMENT PINNED: the Rust project() from identical gathered inputs
  yields BYTE-IDENTICAL docs (battery asserts it), and the clock is the ONLY
  source of variation (different now -> stamps differ, everything else
  byte-identical).
- drift returns a list and is deterministic — both pinned.
- Spine family (test_spine 70 tests) green; clippy 0; ratchet PASS.
2026-10-08 23:32:45 +01:00
conductor 4218973e0a chore(release): auto-bump version to 0.144.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 23:29:45 +01:00
Nick 9969e97fe8 feat(rust): structural_store kernels — promote/supersede/resolve_status, oracle-first parity (#2479 RUST batch 17, contract BUILDER-2026-10-08T22:15:53Z-2c5ccf)
- The state-machine kernels of the biggest RUST gap (29 fns): evidence-gated
  promotion (demotion recorded-not-applied, oracle-identical), supersession
  lifecycle (relationships + status + observations), resolve_status lattice
  (UNKNOWN/CONFLICTING/CURRENT/SUPERSEDED paths).
- 5-test in-crate battery: promote up + demotion rejection, evidence/state
  validation errors, supersede lifecycle, the full status lattice.
- llvm-cov: lib.rs 93% regions / 94% lines. Clippy clean; shims 40/40;
  structural family 35/35.
2026-10-08 23:22:04 +01:00
Nick 34a5717b61 docs: dichotomy audit refresh — 456/2357 (19%), 16 GO batch cores landed 2026-10-08 23:15:25 +01:00
conductor a9216f79d2 chore(release): auto-bump version to 0.144.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 23:14:12 +01:00
Nick 3ebb3ba857 feat(go): model-connect port — MoE detection + tier routing, oracle-first parity (#2479 GO batch 16, contract BUILDER-2026-10-08T22:13:11Z-ea6a6a)
- Oracle-first: 9-case truth battery — is_moe_model (4 patterns), route_model
  (tier exact-match, fallback ladder, no-models), all TASK_ROUTING branches.
- IMPROVEMENT: deterministic tier-match selection (the oracle returns the
  availability-order-dependent first match; Go sorts same-tier candidates).
- HTTP transports stay Python (reactive surface). CI: HARD gate (batch 16).
2026-10-08 23:14:11 +01:00
Nick 616a51a2bd feat(go): auto-tasks port — extract_tasks with TWO ORACLE DEFECTS FIXED (#2479 GO batch 15, contract BUILDER-2026-10-08T21:59:07Z-e4608e)
DEFECTS FOUND IN THE PYTHON ORACLE (both root-caused, both fixed in Go):
1. Numbered-list adjacency: the pattern consumes the newline preceding the
   next numbered item, so findall skips EVERY OTHER item in a dense list
   (verified: oracle extracts 1 of 3). Go uses (?m)^$ anchors — nothing
   consumed, all items extract.
2. Bullet adjacency: the SAME bug in the bullet pattern — worse, because
   the >= 2 gate then fails on short lists and ZERO tasks extract (verified:
   oracle returns 0 for a 2-bullet message). Go extracts both.

The truth battery pins BOTH defective oracle outputs as evidence + the fixed
Go outputs as deliberate divergences. Code-block stripping, dedup, length
gates are parity-ported. The SQLite store stays Python.
2026-10-08 23:09:03 +01:00
conductor 3a53c5a932 chore(release): auto-bump version to 0.144.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 23:08:25 +01:00
conductor 48248f014f chore(release): auto-bump version to 0.144.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 22:59:13 +01:00
Nick d19f04233e feat(go): elastic-cognition port — classify_salience hot path, oracle-first parity + measured improvement (#2479 GO batch 14, contract BUILDER-2026-10-08T21:53:04Z-8542a9)
PARITY (9/9): the full salience classifier — trivial/emergency/correction/
directive/failure/retry/uncertainty/novel groups, channel priors, route
ladder, witness gate. ORACLE QUIRK pinned: flags append PER MATCHING
PATTERN — duplicates count toward len(flags), so a single group matching
twice fires the witness gate. Faithful port of the quirk.

IMPROVEMENTS (measured):
- Precompiled regexes at init (oracle re-runs the match loop on raw
  strings per call): 10k classify calls in 10.9-14.6µs/call measured.
- classify_salience is the HOT PATH — every inbound message hits it.
Execution tiers + LLM calls stay Python (reactive).
2026-10-08 22:58:10 +01:00
Nick fc94a97f7f feat(go): forge-core port — NullAdapter parity + verdict-lattice improvement (#2479 GO batch 13, contract BUILDER-2026-10-08T21:49:25Z-488398)
PARITY: NullAdapter degrade semantics pinned (create/comment return
created:false + reason; state unknown; empty lists) — 1/1 vs the oracle.
IMPROVEMENT (defect fixed): NormalizeVerdict lattice — the oracle returns
raw Gitea state, conflating a SHA-with-no-CI ('no status endpoint') with a
PENDING run. The fault-watch cannot distinguish a wedged queue from
nothing-to-wait-on. Go normalizes: no-status is DISTINCT from pending.
8 verdict pins in the truth battery; the HTTP adapters stay Python.
2026-10-08 22:52:37 +01:00
Nick acc59fe952 feat(go): voicebox port — hook handler + manifest, with defect-fix improvement (#2479 GO batch 12, contract BUILDER-2026-10-08T21:46:51Z-f14772)
PARITY: handle_hook shape, plugin manifest fields — 4/4 vs the oracle.
IMPROVEMENT (defect fixed): the oracle silently returns ok for an EMPTY
event — a no-op lying as success. Go rejects it with an explicit error.
The divergence is PINNED in the truth battery as the deliberate fix.
Subprocess audio loop stays Python (reactive/UI surface per the law).
2026-10-08 22:49:03 +01:00
Nick 10023a0ec7 feat(go): builder-bridge port — to_markdown parity + measured improvements (#2479 GO batch 11, contract BUILDER-2026-10-08T21:45:39Z-8d89f0)
PARITY (the floor):
- Oracle-first: 3-case truth battery — to_markdown full/empty-short-circuit/
  floor-only. PARITY OK 3/3.

IMPROVEMENTS (parity-plus-improvement law, measured):
- O(1) LRU cache eviction: the Python cache evicts via min() scan — O(n)
  per insert at capacity. The Go LRU uses a ring index: MEASURED 1280 puts
  (10x capacity, 1152 evictions) in 273µs, O(1) per eviction.
- Nil-safe cache key: the oracle crashes on None input (TypeError);
  the Go key normalizes to empty string — defensive, bounded.
- CI gate asserts BOTH: parity replay + the improvement measurement.
2026-10-08 22:46:48 +01:00
Nick 664b03d5d2 feat(go): core-server port — [OI] envelope transforms, oracle-first parity (#2479 GO batch 10, contract BUILDER-2026-10-08T21:37:57Z-e96488)
- Oracle-first: 3-case truth battery — error envelope, models view,
  chat_completion mapping (model override/fallback, rune metadata block),
  chat_chunks NDJSON framing (content + terminal).
- Go port: envelopeError/modelsView/chatCompletion/chatChunks —
  Python-identical. HTTP server + operator stay Python (reactive).
- CI: HARD parity gate wired (batch 10).
2026-10-08 22:46:48 +01:00
conductor a64a83df73 chore(release): auto-bump version to 0.143.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 22:28:35 +01:00
Nick 899c26ba2f feat(go): work-manager port — batching engine + routing core, oracle-first parity (#2479 GO batch 9, contract BUILDER-2026-10-08T21:19:43Z-5a8598)
- Oracle-first: 4-case truth battery — create_batches (auto-fix-first,
  rule-group chunking, file-split), route_batch (auto thresholds,
  explicit local/cloud, auto-fix passthrough).
- Go port: createBatches/routeBatch — Python-identical strategy.
  The store + status surface stay Python (reactive).
- CI: HARD parity gate wired (batch 9 of the tranche).
2026-10-08 22:22:52 +01:00
Nick 1f8e72bd86 feat(go): model-routing port — rank() core, oracle-first parity (#2479 GO batch 8, contract BUILDER-2026-10-08T21:18:18Z-adf2dd)
- Oracle-first: 5-case truth battery — pure floor ordering, measured
  precedence (cost override + reason), zero-success exclusion, need_tools
  filter, physical min_context limit.
- Go port: rank() — Python-identical eligibility + deterministic ordering
  (cost, numeric tier, model id). Trace I/O stays Python.
- CI: HARD parity gate wired. 2 pre-existing test_p1_06 failures reproduce
  on clean stash — fault-watch scope.
2026-10-08 22:19:24 +01:00
Nick 75e954f1b0 feat(go): model-profiles port — detection cores, oracle-first parity (#2479 GO batch 7, contract BUILDER-2026-10-08T21:13:21Z-afcb64)
- Oracle-first: 11-case truth battery — detect_family (longest-first table
  match), detect_parameters, detect_quantization (10 quant patterns),
  success_rate (zero-interaction floor) across 10 model names.
- Go port: Python-identical semantics; the profile store + Ollama scans
  stay Python (reactive).
- CI: HARD parity gate wired. Note: test_p1_06 model-routing failure is
  pre-existing (reproduces on a clean stash) — fault-watch will handle.
2026-10-08 22:14:55 +01:00
conductor 9da2d5d5a6 chore(release): auto-bump version to 0.143.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 22:08:47 +01:00
conductor 24e393b24c chore(release): auto-bump version to 0.143.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 21:59:31 +01:00
conductor 36b0a0069e chore(release): auto-bump version to 0.142.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 21:36:46 +01:00
Nick f881dcdb25 feat(go): release-notes port — render + body parsers, oracle-first parity (#2479 GO batch 6, contract BUILDER-2026-10-08T20:32:19Z-850023)
- Oracle-first: 9-case truth battery against the real release_notes module —
  render_markdown (same-sha, diff-sha, section order + omission, backfill,
  provenance lines), summary_from_body (grab/break rules + fallback),
  sha_from_body (tag/deployed regexes + missing).
- Go port: renderMarkdown/summaryFromBody/shaFromBody — Python-identical.
  The Gitea HTTP publication surface stays Python (reactive).
- CI: HARD parity gate wired (batches 1-5 pattern).
2026-10-08 21:35:58 +01:00
conductor db40e47f37 chore(release): auto-bump version to 0.142.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 21:31:15 +01:00
conductor e53f01bd69 chore(release): auto-bump version to 0.142.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 21:24:31 +01:00
Nick a7ced6bd10 feat(go): memory-consolidation port — relevance-scoring cores, oracle-first parity (#2479 GO batch 5, contract BUILDER-2026-10-08T20:09:42Z-9bc01f)
- Oracle-first: 3 scoring-family truth cases against the real scoring
  semantics (knowledge content+tag-double-weight+confidence*3; lessons
  trigger+lesson overlap; connections from+to overlap).
- Go port: scoreKnowledge/scoreLessons/scoreConnections — Python-identical
  set-overlap semantics. The store + sweeps stay Python (reactive surface).
- CI: HARD parity gate wired (batches 1-4 pattern).
2026-10-08 21:15:07 +01:00
Nick 63293b6169 feat(go): event-wait port — 15E-case-10 recovery + event matching, oracle-first parity (#2479 GO batch 4, contract BUILDER-2026-10-08T20:03:32Z-8a4b88)
- Oracle-first: 10-case truth battery against the real event_wait module —
  the FULL recovery status lattice (COMPLETED/FAILED/READY_TO_RESUME/
  READY_TO_RETRY/RESUMING → recovered; RESUME_UNVERIFIED with
  process_event_evidence → recovered; WAITING_EXTERNAL → still_waiting;
  unknown → unknown_operation) + newest-mtime event matching.
- Go port: resumeOrRecover + findMatchingEvent — Python-identical semantics;
  the FIFO rendezvous + HTTP stay Python (reactive surface).
- CI: HARD parity gate wired (batches 1-3 pattern). This is the state
  machine that runs production CI/deploy handoffs daily.
2026-10-08 21:08:42 +01:00
conductor b66fd41f10 chore(release): auto-bump version to 0.142.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 21:07:22 +01:00
conductor f814f55730 chore(release): auto-bump version to 0.142.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 21:03:48 +01:00
Nick 26deff0253 feat(go): provider-budget port — budget math + availability + selection, oracle-first parity (#2479 GO batch 3, contract BUILDER-2026-10-08T20:00:08Z-79b6fb)
- Oracle-first: 6-case truth battery against the real ProviderBudgetTracker
  (remaining math, over-budget/over-token unavailability, best-provider
  selection, post-disable failover, all-down nil).
- Go port: budgetRemaining/tokensRemaining/isAvailable/bestProvider —
  Python-identical semantics. HTTP checks + store stay Python (reactive).
- CI: HARD parity gate wired (batches 1-2 pattern).
2026-10-08 21:03:10 +01:00
Nick ce4acafe37 feat(go): goal-engine port — goal state machine + keyword verification, oracle-first parity (#2479 GO batch 2, contract BUILDER-2026-10-08T19:55:43Z-4f4d94)
- Oracle-first: 7-case truth battery against the real GoalManager (set/active/
  partial-verification/full-verification/achieve/active-after/list).
- Go port: verifyWithKeywords (case-insensitive containment, unmet-driven
  reason) + the achieve transition — Python-identical semantics. LLM
  verification + store stay Python (reactive surface).
- CI: HARD parity gate wired (the batch-1 pattern).
2026-10-08 20:59:44 +01:00
Nick 6439d2ff35 feat(go): cron-engine port — cron parser + scheduler core, oracle-first parity (#2479 GO batch 1, contract BUILDER-2026-10-08T19:49:48Z-67d41b)
- Oracle-first: 25-case truth battery generated against the REAL Python
  oracle (CronEngine._parse_cron_field across all field shapes; _should_run
  across 13 cron-expression × datetime cases including the Python-weekday →
  cron-weekday conversion with 7=Sunday normalization and the dedup guard).
- Go port: parseCronField + shouldRun — Python-identical semantics, zero
  dependencies. The task store and execution loop stay Python (reactive
  surface per the language governance stack).
- CI: dedicated HARD parity gate — 'cron-engine replay truth.json', not
  swallowable (the adaptive-router pattern).
- PARITY OK: 25/25 cases exact-equal. gofmt/vet clean; ratchet PASS.
2026-10-08 20:55:41 +01:00
conductor a44754b12b chore(release): auto-bump version to 0.141.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 20:45:31 +01:00
Nick 749404edaf feat(rust): memory_storage branch top-up — 7-test SQLite battery (#2464 batch 4, contract BUILDER-2026-10-08T19:41:33Z-902ff6)
- src/rust/memory_storage/src/branch_battery.rs: read_query through a REAL
  temp SQLite database — all param-binding types (int64/double/string/
  bool->0/1/null->SQL NULL), multi-row shapes, empty results, READONLY
  enforcement (INSERT/UPDATE fail through the open_v2(READONLY) connection —
  the mutation-impossible law pinned by test), missing-db error, NUL-byte
  rejection, malformed SQL.
- Zero-dependency law held: hand-rolled tempdir shim, no external crates.
- llvm-cov: sqlite.rs 83.3% regions / 86.5% lines (lib.rs FFI wrappers
  covered via the Python FFI battery). Clippy clean; shims 40/40.
2026-10-08 20:42:18 +01:00
Nick 5b063a5e4f feat(rust): scaffold_core branch top-up — 12-test battery over lifecycle/close/language (#2464 batch 3, contract BUILDER-2026-10-08T19:37:07Z-b3a8aa)
- lifecycle.rs: 100% — every phase's legal successors, terminal set, all
  check_transition paths (legal, illegal-with-sorted-successors, unknown
  target, self-transition).
- close.rs: 96.5% regions / 97.1% lines — required-field errors, both
  closeable phases, the full prediction ledger (observed_evidence is a list
  of {entity} objects — oracle correction), genuinely-unexpected CANDIDATE
  rows, frontier level unions, runtime prefix matching.
- language.rs: 91% regions / 100% functions — all four rune-dichotomy
  verdicts (go/rust/hybrid/pure-compute-defaults-rust) + other-project fit
  + missing-inputs error.
- Clippy clean; shims 118/118; ratchet PASS.
2026-10-08 20:38:11 +01:00
conductor ca63d2453b chore(release): auto-bump version to 0.141.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 20:37:14 +01:00
Nick e99a021225 feat(rust): cognition_core branch top-up — 42-test battery over the full broker surface (#2464 batch 2, contract BUILDER-2026-10-08T19:30:06Z-991d17)
- src/rust/cognition_core/src/branch_battery.rs: 42 in-crate tests — persona
  rule engine (allow/refuse/permissive/user-rule/priority-tiebreak paths),
  tier ladder (rock guard, promote/demote, parse_strict_aware offset edges),
  pins-recall projection, safety params (PROBE-VERIFIED truth table: match
  increments, miss appends), witness signals full matrix (5 signal tables +
  novelty + correction), growth profile (applied fallback, ellipsis
  truncation, budget break), identity prompt shapes, drift regex_lite paths.
- ORACLE-VERIFIED PARITY: the regex_lite edge cases cross-checked against
  Python cc_loader.drift_check with IDENTICAL results (anchor-only pattern
  non-match confirmed in both implementations — the port is faithful on the
  trickiest edge).
- ~15 rounds of oracle corrections: Vec<Json> return shapes, signature
  arities (witness_signals 5-arg, consolidation_neuron 7-arg), the 'words'
  rule key, strict Json::Bool as_bool, push-before-limit-break in pins,
  probe-verified safety truth table.
- llvm-cov: broker.rs 87.4% regions / 90.6% functions / 85.5% lines.
  lib.rs FFI wrappers covered via the Python FFI batteries (115/115).
  Clippy clean; ratchet PASS.
2026-10-08 20:30:51 +01:00
Nick 1ecaa76e4a feat(research): harness invariants — the R1 repair classes as deterministic checks (#411, contract BUILDER-2026-10-08T18:49:19Z-7236d8)
- scripts/research_harness_invariants.py: 6 invariants (I1 schema-shape,
  I2 outward-evidence, I3 innovation-ground, I4 synthesis-qualify,
  I5 ledger-validity, I6 no-phantom-paths) + one-call check() every
  harness entry point can run + CLI.
- tests/test_research_harness_invariants.py 7/7: each fixture IS a repair
  family (the bad shapes that caused the R1 repairs), pinned as regression.
- Language verdict (dichotomy law): Python — deterministic validation over
  in-process harness artifacts (batch/tooling, not runtime backend state).
2026-10-08 19:50:11 +01:00
conductor 55375f8817 chore(release): auto-bump version to 0.140.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 18:41:18 +01:00
conductor 3549052d0f chore(release): auto-bump version to 0.140.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 18:34:10 +01:00
conductor a378b64572 chore(release): auto-bump version to 0.140.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 18:26:55 +01:00
conductor b937af7cac chore(release): auto-bump version to 0.140.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 18:21:08 +01:00
conductor 41adf4eca9 chore(release): auto-bump version to 0.140.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 18:14:43 +01:00
conductor 74ec0d8dfb chore(release): auto-bump version to 0.140.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 18:07:07 +01:00
conductor 23b514f16c chore(release): auto-bump version to 0.139.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 17:24:20 +01:00
conductor 4dd97194b8 chore(release): auto-bump version to 0.139.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 17:01:07 +01:00
conductor 6686c2f1ef chore(release): auto-bump version to 0.139.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 16:53:16 +01:00
conductor 6fa046ad04 chore(release): auto-bump version to 0.139.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 16:30:20 +01:00
conductor 1c4567fee8 chore(release): auto-bump version to 0.139.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 16:22:25 +01:00
Nick 570e7d10e2 fix(lint): polyglot gate path normalization + go/rust formatting debt — fault-watch fix (contract BUILDER-2026-10-08T15:15:16Z-6a78f4)
- ROOT CAUSE: lint_rust called Path(f).relative_to(REPO) on already-relative
  paths — ValueError on every all-rust changed set since the relative-path
  change; the gate has been silently dead for rust whenever changed-only
  mode collected rust files. Normalized via os.path.isabs.
- gofmt: 8 Go files carried pre-existing formatting debt (surfaced only now
  that the gate can actually see them) — formatted.
- rustfmt: branch_battery.rs formatted.
- Verified: polyglot clean (468 changed → 169/165/107), rust shims 40/40,
  cargo 34/34, ratchet PASS.
2026-10-08 16:16:19 +01:00
conductor b45a8265f7 chore(release): auto-bump version to 0.139.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 16:14:40 +01:00
Nick f7487b133f fix(ci): local-review ROOT CAUSE — the quadruple-brace expression inside the python heredoc broke Gitea's workflow parser since creation ('Invalid workflow file' at every run, first at f9f83e0); PR_NUMBER now flows via env, no expression in strings 2026-10-08 16:05:01 +01:00
Nick 98c03823d0 fix(ci): local-review — PR expressions only in env/if positions Gitea's parser accepts; push-run skip via plain shell on GITEA_BASE_REF 2026-10-08 16:02:01 +01:00
Nick 673b1beeff fix(ci): local-review PR guard moved to first step — job-level expression was rejected by Gitea's parser ('Invalid workflow file', run 20766); the guard exits 1 on push so the run records a deliberate skip, and every later step carries the PR-context condition 2026-10-08 15:59:23 +01:00
Nick 92c1a12727 feat(rust): memory_retrieval branch battery green 34/34 — #2464 batch 1 evidence (contract BUILDER-2026-10-08T14:56:04Z-e1b1d1)
- branch_battery.rs: 34 in-crate tests — every mr_call op, all mode splits,
  budget/min-score gates, recency + ISO-offset shapes, dedupe, malformed
  skips. Four oracle corrections pinned: fts single-token conjunctive,
  chunk_rows pair/rowid shapes, fuse dedupe-by-text, score-relevance fields.
- llvm-cov: retrieval.rs 96.6% regions / 94.2% functions / 98.1% lines.
  Remaining 8 lines named honestly-unreachable per the issue's allowance:
  private get/set/score direct paths + 3 single-line edges, unreachable
  through the public surface by construction.
- FFI battery (tests/test_mr_branch_battery.py) 11/11 through the deployed
  loader; clippy clean.
2026-10-08 15:57:02 +01:00
Nick 509f203906 feat(tui): the transcript is a connected graph — #13 (contract BUILDER-2026-10-08T14:51:22Z-da0ce3)
- src/rune/message_graph.py: stable 12-char IDs + typed kinds (message/reply/
  tool_call/tool_result/revision/branch_head); explicit edges (parent,
  reply_to, calls, results_in, revises, supersedes, branches_from).
- Provenance survives iteration: revise() ADDS a node and marks the old one
  superseded — never deletes. history() walks the full revision trail.
- Lineage context: context for a selected message = its ancestors + itself,
  superseded nodes yielding to revisions — not unrelated-history replay.
- Flat-transcript migration (migrate_flat): arrival-order chains, no loss.
- ChannelView.add_message lands every message in the graph (best-effort,
  degrade-not-crash; the bubble mounts first); the message_id rides metadata.
- Quiet cues: one line per relationship (replaces/superseded by/branched
  from) — no clutter.
- tests/test_message_graph.py 9/9: integrity, selection, revisions,
  persistence round-trip, migration, cues.
2026-10-08 15:54:49 +01:00
Nick eb6fdbdc98 feat(rust): memory_retrieval branch top-up — 34-test battery + real crash fix (#2464 batch 1, contract BUILDER-2026-10-08T14:26:19Z-394b0a)
- src/rust/memory_retrieval/src/branch_battery.rs: 34 in-crate tests covering
  every mr_call op, all mode splits (hybrid/dense-only/bm25-only/empty),
  budget/min-score gates, recency paths, ISO-offset shapes, dedupe, the
  dense-gap tail, malformed-pair skips.
- THE BATTERY FOUND A REAL CRASH: score_recall_rows dense-gap check indexed
  ds[len-2] without checking ds.len() >= 2 — one valid pair + one malformed
  member panicked (subtract with overflow, retrieval.rs:609). Fixed: fall
  through to the map_reduce tail when fewer than two scores parse.
- llvm-cov: retrieval.rs 96.6% regions / 94.2% functions / 98.1% lines.
  Remaining 8 lines named honestly-unreachable: private get/set/score direct
  paths (non-object, non-Obj, _ arm) + 3 single-line edges — unreachable
  through the public surface by construction.
- tests/test_mr_branch_battery.py: 11 FFI-surface tests through the deployed
  loader. Clippy clean; ratchet PASS.
2026-10-08 15:50:04 +01:00
conductor 31fbb7edc2 chore(release): auto-bump version to 0.139.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 15:46:04 +01:00
conductor 7190ca525e chore(release): auto-bump version to 0.139.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 15:40:27 +01:00
Nick 41c6fa281f fix(ci): local-review job skips push runs entirely — job-level PR guard (run 20721: the step-level guard let the post step fail at /issues//comments) 2026-10-08 15:26:03 +01:00
conductor 5a5b229957 chore(release): auto-bump version to 0.138.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 15:21:14 +01:00
Nick 70e9a8849a feat(phase-g): audit_ledger switched to the Rust chain — #2449 batch A (contract BUILDER-2026-10-08T14:06:45Z-f1eada)
- The defect: SECRET_KEY defaulted to rune-governed-adaptation-2024 while the
  LIVE 62-entry chain verifies under the DEPLOYED vintage
  rune-drift-integrity-2024 (proved live: deployed verifies 62/valid, the old
  default saw 0 entries) — a src/rune append would have corrupted the chain
  under the authority key. Key ADOPTS the authority (RECONCILE-DON'T-CLOBBER).
- verify_chain + _compute_hash delegate to the ep seam (no silent fallback —
  a missing cdylib fails loudly). Rust verify on the live ledger: 62/valid.
- tests/test_audit_ledger_switch.py 5/5: key adoption, Rust-vs-Python HMAC
  parity, append→verify round-trip, tamper detection through Rust, live
  ledger under the authority key.
- Test-isolation law: the new file lazy-imports audit_ledger (top-level
  import at collection cached LEDGER_FILE under the wrong env and broke the
  shims battery's env pinning). Both orders green; family 12/12; ratchet PASS.
2026-10-08 15:18:34 +01:00
conductor 963d15ad3e chore(release): auto-bump version to 0.138.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 15:14:02 +01:00
conductor ac8ebea4b9 chore(release): auto-bump version to 0.138.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 15:06:54 +01:00
Nick 003eaaf7c2 docs(phase-g): slice 2 (T7.3) surface census — #2449 grounding (contract BUILDER-2026-10-08T14:02:24Z-588ca6)
Measured per-module state of the six-module evidence-provenance surface:
claim_audit 17/17 SWITCHED; behavior/behaviour_ledger/evidence_probe/
verification_layer loader-integrated; audit_ledger is the one gap (0
loader refs) — with the drift-key pin (live ledger verifies under the
DEPLOYED vintage rune-drift-integrity-2024) and the vintage
reconciliation constraint recorded as frozen-contract input. Batteries
green: 14/14 module families + 6/6 shims.
2026-10-08 15:04:50 +01:00
Nick 33ff9ec4e0 feat(phase-g): #2447 remaining — CI qualification + fresh shadow evidence for the query_memory authority switch (contract BUILDER-2026-10-08T13:52:55Z-b0fc70)
- ci.yml: query_memory in ALL THREE rust build lists + a shadow step.
- scripts/qm_shadow.py: the honest shadow — the TRUE pre-shim Python oracle
  (recovered from git history 6f44a87~1 — the parity harness pointed at the
  superseded src/rune/query_memory.py, comparing Rust against Rust) vs the
  Rust CLI on the frozen 24-command sequence in isolated HOMEs.
- Fresh evidence: 24/24 commands exact-equal, history.jsonl + topic_stats.json
  byte-parity. The authority switch itself was already landed
  (shared/query_memory.py = AUTHORITY-SWITCHED shim, verification wall green).
2026-10-08 14:59:52 +01:00
conductor 14f4a1947b chore(release): auto-bump version to 0.138.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 14:59:24 +01:00
conductor 3614d51449 chore(release): auto-bump version to 0.138.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 14:52:18 +01:00
Nick ef7097ac7d fix(ci): local-review push runs exit green — advisory review has no PR context on push (#204 fault-watch fix) 2026-10-08 14:51:46 +01:00
Nick 8f2ec34bc4 fix(lint): annotate the board fetcher's intentional silence — BLE001 baseline (fault-watch fix, completes c73d249) 2026-10-08 14:48:58 +01:00
Nick 0f9fca244c feat(scaffold): per-contract mini-docs — #2465 deliverable 1 (contract BUILDER-2026-10-08T13:30:04Z-3dbb44)
- construction_projection.write_mini_doc: emits a markdown quick-lookup page
  per closed contract into store/scaffold/docs/<contract_id>.md — what was
  built / what it connects to / how to update those connections + the
  evidence trail. The LLM (or a human) reads ONE page per landed unit.
- Wired best-effort into BOTH close paths (transition('closed') and close()):
  the mini_doc path rides the close envelope; a writer failure degrades to
  WRITE_FAILED and never fails a real closure.
- Affected surface reads the contract entity's real keys (ext.affected_paths
  → decision_trace.affected_surfaces.affected_paths).
- #2465 deliverables 2+3 (spine write-back _apply_contract_discoveries +
  language verdicts _place_languages) were already landed in
  spine_language.py and wired into spine.build() — proven by the new
  spine-discoveries test + the 9 pre-existing spine_language tests.
- tests/test_contract_minidoc.py 3/3; construction family 184/184; ratchet PASS.
2026-10-08 14:48:33 +01:00
conductor 70a9b810b6 chore(release): auto-bump version to 0.138.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 14:45:02 +01:00
conductor 9e6228c417 chore(release): auto-bump version to 0.138.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 14:38:01 +01:00
conductor c8301425af chore(release): auto-bump version to 0.138.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 14:30:46 +01:00
Nick c73d24975b fix(lint): annotate the rust-deploy terminal reporter — BLE001 ratchet at 47/47 baseline (fault-watch fix) 2026-10-08 14:27:57 +01:00
Nick 853468783d feat(finance): stdlib-only finance tracker — #3 (contract BUILDER-2026-10-08T13:22:02Z-af7a8b)
- scripts/finance_tracker.py: CSV ledger (~/.rune/finance/, human-readable,
  portable), add/budget/report commands, month + week filters, per-category
  totals vs budgets with over-by flags, income/net, and recurring-payment
  detection (3+ same-note ~monthly payments) that surfaces subscription
  cancellation candidates — the exact 'flags subscriptions worth cancelling'
  acceptance.
- tests/test_finance_tracker.py 6/6: sign→kind, budget over-flag, net,
  week filter, monthly-subscription detection, one-off not flagged.
2026-10-08 14:24:29 +01:00
conductor 135d93c027 chore(release): auto-bump version to 0.138.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 14:23:31 +01:00
Nick 169cb63084 feat(tui): the cognitive loops are actually INVOKED — #2 (contract BUILDER-2026-10-08T13:15:49Z-03dc90)
- The defect: RuneApp instantiated CognitiveLoop/DreamCycle/AutonomyLoop and
  told the user '◆ Cognitive loop active — Rune thinks between turns' — but
  never called think()/dream()/evaluate() anywhere. A dead mechanism wearing
  a live-status costume.
- The fix: an idle-cognition ticker (set_interval 240s) on RuneApp — think()
  every tick (consolidate, probe dead weight, drift check) with the most
  recent user context, dream() every third tick (full consolidation), on a
  worker thread; only dim status lines touch the UI thread; failures degrade
  silently. Input submit captures _cognition_ctx.
- Bonus fix: module-level logger in rune_tui.py — 61 latent F821 NameErrors
  inside exception handlers (any suppressed-exception path that reached
  logger.debug would have raised instead of degrading). Now 0.
- tests/test_cognitive_wiring.py: 5/5 — think() invoked with context, dream()
  gated to the third tick, actions surface as status, silence stays silent,
  the wiring pinned at source level.
2026-10-08 14:20:41 +01:00
Nick 2c0757374a fix(spine): umbrella view regenerated FROM the spine — #416 (contract BUILDER-2026-10-08T13:07:22Z-00d135)
- Spine is the authority: 35 belongs_to relationships added/confirmed —
  18 per-session closure modules placed by sibling affinity, 17 memberships
  the spine had lost to the committed view folded back in (loaders,
  lexicon_evolution, worthiness, spine_language/loader, tui_transport, core_server).
- Dunder exclusion (#416 decision): __init__/__main__ are not umbrella-
  coverage surface — enforced in BOTH cores (spine.py _py_export_umbrellas
  + rune_spine query.rs, parity preserved), matching the gate's own
  canary_/test_/__ exclusion rule.
- config/umbrellas.json regenerated via spine.export_umbrellas() — 187
  modules mapped, marker carried, __main__ excluded, regeneration is now
  runnable end to end (the drift the generated marker warned about is closed).
- tests/test_umbrella_impact.py 6/6; spine family 113/113.
2026-10-08 14:11:23 +01:00
Nick e80ba65e8c feat(deploy): Rust cores ship as BINARIES into the deployed revision (#2455, contract BUILDER-2026-10-08T13:01:13Z-0cb00d)
- scripts/deploy_rust_build.py: builds all 11 crates CI builds INTO the
  staged tree (in-tree target/release — the loaders' default path), then
  FFI-smokes each: CDLL + loader entry symbol per crate, PLUS a real FFI
  call (token_counting tc_estimate_tokens {"text":...} -> int) through the
  exact loader convention (argtypes c_char_p, restype c_void_p, tc_free_string).
- deploy_stage.py: the Rust phase runs AFTER staged-verify, BEFORE the TUI
  canary and promotion — a revision whose cores don't build or smoke never
  becomes current. RUNE_DEPLOY_SKIP_RUST=1 is the documented emergency bypass.
- Live proof: 11/11 built + 11/11 smoked on a real staged tree, bare exit 0.
2026-10-08 14:01:46 +01:00
Nick fd84bdd538 fix(backup): runner sudo grant on the real wrapper + workflow pointer repair (#2459, contract BUILDER-2026-10-08T12:45:46Z-101efc)
- /etc/sudoers.d/runner-backup (machine-side, outside the repo):
  runner ALL=(root) NOPASSWD: /usr/local/bin/gitea-backup-pc.sh — the ACTIVE
  runner user, not the dead gitea-desktop-runner the original grant line named.
- auto-backup.yml now calls the EXISTING wrapper (/usr/local/bin/
  gitea-backup-pc.sh — PC-correct overrides: BACKUP_MOUNT=/mnt/workdrive,
  GITEA_CONFIG=/mnt/workdrive/gitea/custom/conf/app.ini) instead of the
  phantom /usr/local/sbin/rune-gitea-backup that never existed on this host.
- Verified LIVE as the runner user: sudo -n run produced + verified
  gitea-dump-20261008T124608Z.tar.gz; gitea.service stopped/dumped/restarted.
2026-10-08 13:47:45 +01:00
Nick 7e1a5b84b6 feat(umbrellas): forge board + umbrella closure proofs — #204/#125/#284 (contracts BUILDER-2026-10-08T12:31/32/33)
- #204: scripts/forge_board.py — the forge as the single pipeline state
  machine. Derives the next action per open issue from forge state alone
  (labels + CI verdict): FIX FIRST / WAITING / BLOCKED / REVIEW /
  CONTINUE CONTRACT / OPEN CONTRACT. Deterministic, zero tokens, injectable
  fetcher; live read returns the full board.
- #125: tests/test_epic_umbrellas.py::Test125 — the decomposition's
  migrate-adapter end state proven: ContextBroker contributors own
  model-facing context (operator registers adapters only), archive-candidate
  mechanisms removed, model resolution delegates; adapter block <200 lines.
- #284: instruments end-to-end (scorecard, wiring status, route acceptance)
  — all ADAPT children #294-#301 CLOSED.
2026-10-08 13:38:57 +01:00
Nick 73134a3122 feat(adapt): ACCEPTANCE TRIO CLOSED — route acceptance, scorecard, wiring report (contract BUILDER-2026-10-08T12:24:58Z-472dfe)
- test_route_acceptance.py (#300): fixes stay light, uncertainty
  escalates via the production sufficiency path, provenance never
  lost, floor-protected downgrade raises — 4/4
- adapt_scorecard.py (#301): 6-job fixture set, 6/6 route accuracy,
  elapsed + avoided-waste reported
- wiring_status.py (#315): 202 modules mapped to wiring +
  authority-map coverage, unwired list, largest-first

10/10 green. #300/#301/#315 closed with evidence.
2026-10-08 13:30:14 +01:00
Nick 3889d1d0e8 feat(adapt): ADAPT QUARTET CLOSED — budgets, capsules, consolidation, legibility (contract BUILDER-2026-10-08T12:20:44Z-2c1a18)
- research_budget.py (#294): query/tool budgets with overrun refusal
  + explicit stops
- evidence_capsule.py (#295): fixed-size capsules (5/3/3) with
  truncation accounting + raw-evidence pointer
- design consolidation (#296): the A/B experiment recorded — standard
  jobs merge (applicability checks are the rail), high-uncertainty
  keeps the separate step
- harness_audit.py (#299): legibility scorer (owner/tests/contracts
  discoverability) + repo report

10/10 green. #294/#295/#296/#299 closed with evidence.
2026-10-08 13:23:26 +01:00
Nick c9782b5038 feat(topology): #159 CLOSED — adaptive conceptual topology (contract BUILDER-2026-10-08T12:16:07Z-5ccb97)
Co-fire clustering with decay, emergent connected-component clusters
above threshold, cluster-or-new-topic suggestions. Empty seed — no
preset categories. 5/5 green.
2026-10-08 13:19:42 +01:00
Nick fa648aac27 feat(memory): P2 QUINTET CLOSED — outcome utility, growth pipeline, self-model, typed memory, abstraction ladder (contract BUILDER-2026-10-08T12:09:33Z-9404ac)
- outcome_utility.py (#35): verified-outcome utility only (helpful
  +0.1, ignored −0.05, stale decay, retrieval-alone never increases;
  confidence tracked separately)
- growth_pipeline.py (#36): candidate→support→trial→promote/revise/
  reject with evidence thresholds (never confidence); durable change
  requires PROMOTED
- self_model.py (#37): budgeted compilation (greedy by weight) +
  evidence retrievability for why-questions
- memory_types.py (#38): 6 types with budget shares + intent routing
- abstraction_ladder.py (#39): the 7-rung ladder with thresholds,
  provenance, contradiction, consequence, and verified-outcome gates;
  end-to-end episode→skill walk proven

16/16 green. #35/#36/#37/#38/#39 closed with evidence.
2026-10-08 13:14:31 +01:00
Nick 8bb31cd035 test(p1): #31/#32/#33 VERIFIED — pin the already-holding states (contract BUILDER-2026-10-08T11:58:00Z-see-log)
- #31: no ambient scan (repo_map is tool-only, TUI mount performs no
  walk, operator performs no scan) — 3 pins
- #32: confirmation semantics (read-only executes, destructive
  requires, unknown fails closed, no TUI bypass) — 4 pins
- #33: outcome causality (receipts derive from the journal, REJECT is
  negative evidence) — 3 pins
- p1_02 mock updated to the #141 session_id signature

10/10 green. These issues' conditions hold in-tree; the tests pin them
so they can never silently regress.
2026-10-08 13:07:33 +01:00
Nick ae759d1f8a Merge remote-tracking branch 'gitea/master' 2026-10-08 12:57:55 +01:00
Nick 66a0e8a89a test(warm): #27 CLOSED — warm-router correctness defects (contract BUILDER-2026-10-08T11:54:56Z-6ddbee)
- entry-ID activation path verified end-to-end (fixture DB, pinned
  clock; cold start floors, fired entries lift)
- route() output never repeats a slug; use-history demonstrably
  changes a controlled ranking (ACT-R decay)
- the two [:5] sites verified as display truncations (trigger prose,
  hook payload) — route() itself is uncapped, pinned by test
2026-10-08 12:57:55 +01:00
conductor 79738b2cdc chore(release): auto-bump version to 0.137.1 — earned by # (patch: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 12:56:35 +01:00
Nick d0ebcc1097 feat(budget): #28 CLOSED — model-aware context budgets (contract BUILDER-2026-10-08T11:41:09Z-031e9d)
- resolve_context_budget: window minus output/tool-result reservation;
  narrow local, wider cloud, conservative unknown; num_ctx NEVER the raw
  window (the #28 invariant, tested)
- 12 hardcoded num_ctx=8192 literals replaced across 11 files
- the no-8192 gate fails the build on any new literal
- p1_02 mock updated to the #141 session_id signature

5/5 + 16/16 green. #28 closed with evidence.
2026-10-08 12:51:50 +01:00
Nick ccb0725fc9 Merge remote-tracking branch 'gitea/master' 2026-10-08 12:38:34 +01:00
Nick 6d63d7464b feat(trio): #40/#48/#49 CLOSED — skill compiler, endogenous triggers, pane authority (contract BUILDER-2026-10-08T11:34:04Z-dbd615)
- skill_compiler.py: candidate → sandbox → promote (promotion
  blocked without a passing sandbox)
- meaningful_events.py: 8 endogenous trigger classes with stop
  conditions + rate limits (replaces cron cognition)
- pane_authority.py: WORK applies, CHAT discusses or visibly
  promotes, control preempts from either; task state canonical

14/14 green. Ratchet at baseline.
2026-10-08 12:38:34 +01:00
conductor c1e1157b01 chore(release): auto-bump version to 0.137.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 12:37:34 +01:00
Nick 68b8ca636f Merge remote-tracking branch 'gitea/master' 2026-10-08 12:32:03 +01:00
Nick 03070830b6 feat(bench): #45/#46/#47 CLOSED — warm ablation, growth delta, transfer experiment (contracts 197587/a78c0a/31d506)
- warm_ablation.py: 4-condition matrix (lexical/hybrid/hybrid+warm/
  hybrid+outcome) with the KEEP-vs-SIMPLIFY verdict rule
- growth_delta.py: 8 behavioural metrics with advantage deltas
  (NOT database growth)
- transfer_experiment.py: the both-models-must-clear protocol for the
  core research hypothesis (one-model wins don't count)
- 9/9 green
2026-10-08 12:32:03 +01:00
conductor 5539983ac0 chore(release): auto-bump version to 0.137.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 12:30:17 +01:00
Nick 8e5e8ca331 feat(bench): #44 CLOSED — RuneBench v0.1 (contract BUILDER-2026-10-08T11:25:21Z-1497c5)
8 task families × 4 conditions (fresh model / fresh Rune / experienced
Rune / experienced-no-memory), offline fixtures for the CI gate + live
Ollama mode for real measurement. Deltas (not vibes): C−B experience
advantage, C−D memory contribution. #45/#46/#47 unblocked. 6/6 green.
2026-10-08 12:27:45 +01:00
Nick 0d18d98b66 Merge remote-tracking branch 'gitea/master' 2026-10-08 12:23:55 +01:00
Nick 5d97c5b063 feat(selfmod): #43 CLOSED — reversible benchmark-gated self-modification (contract BUILDER-2026-10-08T11:21:29Z-d314a9)
propose (isolated worktree + rollback_ref) → gates → compare →
promote/discard → monitor → rollback. No production modification
without a recovery path; regression blocks promotion. 6/6 green on a
fixture repo.
2026-10-08 12:23:55 +01:00
conductor e81c39581e chore(release): auto-bump version to 0.137.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 12:23:24 +01:00
Nick 2b5be2ecd3 Merge remote-tracking branch 'gitea/master' 2026-10-08 12:20:19 +01:00
Nick 299ae4eff9 fix(paths): #41 CLOSED — centralized environment paths + twin verdict (contract BUILDER-2026-10-08T11:04:31Z-55ae38)
- paths.py: ONE live implementation (repo_root from file location —
  THREE levels, not two; crate_dir, deploy_root, rune_home,
  harness_scripts, wait_resume_dir — all with env overrides)
- 13 hardcoded literals collapsed across 12 files
- the spelling twins are DISTINCT modules (behavior = scoped
  corrections; behaviour_ledger = versioned validation ledger) — the
  issue premise was wrong for this pair; pinned by test
- test_paths_central.py: no-hardcoded-literals gate (fails the build
  on any new literal) + twin-distinctness pin

3/3 green. #41 closed with evidence.
2026-10-08 12:20:18 +01:00
conductor 5b4cd9c90d chore(release): auto-bump version to 0.137.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 12:17:29 +01:00
Nick 91a91e8e36 feat(graph): #42 CLOSED — live graph-health instrument + supersession pins (contract BUILDER-2026-10-08T10:58:57Z-019b73)
- graph_health_report.py: superseded/active/expired ratios, orphan +
  dangling counts, normalization behavior — against ANY store path.
  Empty graphs report no-data (ratios undefined, not 0%), missing
  stores report no-store. The dossier statistic is replaced by a live
  instrument anyone can run.
- supersession state machine pinned: old edge marked (never deleted),
  new edge wins, superseded_by chain intact.
2026-10-08 12:02:37 +01:00
Nick 6eebb83500 feat(broker): #141 CLOSED — identity-based rolling coverage + operator wiring (contract BUILDER-2026-10-08T10:50:56Z-0c72f4)
- through_id: content hash of the resume point (survives window
  rotation; positions do not). Read path matches by hash, falls back
  to legacy count, re-summarizes from scratch when neither matches
- operator assemble call threads task.task_id as session_id — the
  rolling store now ENGAGES on the operator path (was dormant)
- evict_rolling: LRU cap for dead sessions (bounded growth)
- soft guarantee documented in code: summarizer-failure degrade tail
  can shrink below COMPACTION_KEEP_TURNS; direct budget-only calls
  double-discount

6/6 green. #141 closed with evidence.
2026-10-08 11:55:37 +01:00
Nick a5e77ac246 feat(trace): #145 CLOSED — inference-path census + trace wiring (contract BUILDER-2026-10-08T10:43:54Z-5c5f34)
- inference_paths.py: all 16 outbound model-call sites enumerated
  (approval-resume, compaction, 11 side paths, 3 embed sites, 1
  documented exclusion); trace_side_path records side-path inference
  as its own trace record (journaled when the journal is available)
- the census test asserts grep-completeness: any new raw call site
  fails the build until it joins the census
- approval-resume is TRACED (not excluded); the TUI warmup is the
  single documented exclusion (no task linkage, no user output)

6/6 green. #145 closed with evidence.
2026-10-08 11:47:54 +01:00
Nick 07cd20c782 Merge remote-tracking branch 'gitea/master' 2026-10-08 11:41:12 +01:00
Nick d39655b4be feat(governance): QUARTET CLOSED — mutation guards, execution trace, checkpoint/replay, experience encoding (contract BUILDER-2026-10-08T10:34:14Z-c5be53)
- #156: mutation_guards.py — ALLOW/CONFIRM/DENY by kind/op/scope
  severity; unattributed identity = DENY; unbacked destructive = DENY
  with snapshot recovery; 4 live tests
- #155: execution_trace.py — durable per-task receipts from the
  task.outcome journal (memories/rules/capability/model/actions/
  outcome); 3 live tests incl. journal round-trip
- #154: state_checkpoint.py — snapshot/restore/diff of the entries DB;
  restore snapshots live state first (rollback of rollback); journal
  never touched; 3 live tests incl. round-trip
- #153: experience_encoding.py — the ONE admission rule (IGNORE/
  EVIDENCE/EPISODE via lexicon discipline + grounding, provenance
  attached); 5 live tests incl. oracle-confirmed framing-only text

15/15 green. Ratchet at baseline (new handlers annotated).
2026-10-08 11:41:12 +01:00
conductor 3aa0d7ed29 chore(release): auto-bump version to 0.136.5 — earned by # (patch: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 11:38:31 +01:00
Nick f9f83e0c35 feat(review): reviewer P0 trio CLOSED — rubric + calibration + first-pass agent (contract BUILDER-2026-10-08T10:27:52Z-a8b4ae)
- #129: dimensional review rubric folded into the dispatch template
  (correctness/design/test-quality/observability/security, forced-choice
  verdicts; missing dimension = incomplete review)
- #130: calibration harness (scripts/reviewer_calibration.py) — 5 known
  defects from the ledger + 1 clean control, 6/6 caught (100%,
  CALIBRATED). The pagination pattern needed widening for dotted
  receivers (self._rows[:50]) — the harness caught its own blind spot.
- #131: local-model first-pass reviewer — Gitea workflow
  (local-review.yml) + agent script (local_firstpass_review.py, Ollama
  + review-lessons + #129 rubric). Fail-open by design: Ollama
  unreachable → skip with a note; findings are advisory PR comments,
  never gates.
2026-10-08 11:32:09 +01:00
Nick 4455a1ab41 Merge remote-tracking branch 'gitea/master' 2026-10-08 11:23:58 +01:00
Nick 653627b1ed test(constitutional): #152 FULL CLOSURE — all remaining attacks (contract BUILDER-2026-10-08T10:20:47Z-92fb29)
- session isolation: primed state cannot leak across sessions; empty
  session_id degrades to no-context
- threshold bypass: zero threshold still requires grounding (the
  word-level check is the strong signal); empty sources never ground
- verdict inversion: relabeling a parked reason cannot grant (the
  eligibility bit is the authority, deterministic re-check)
- budget enforcement: the digest token cap holds under a 50-candidate
  flood

15/15 green. #152 closed with evidence.
2026-10-08 11:23:57 +01:00
conductor 116b6b25a4 chore(release): auto-bump version to 0.136.4 — earned by # (patch: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 11:21:19 +01:00
Nick df56a60a9d Merge remote-tracking branch 'gitea/master' 2026-10-08 11:17:36 +01:00
Nick 9664c56df1 fix(sweep): #126 wave 4 — final classification, baseline 72/31 → 47/31 (contract BUILDER-2026-10-08T09:36:16Z-d88162)
- remaining handlers: logged/recorded bodies annotated, bare passes get
  logger.debug, real-handling bodies get log-first
- baseline re-shrunk: 72/31 → 47/31
- TOTAL: 374 → 78 silent handlers (79% reduction), every remaining one
  either logged or explicitly annotated with its reason
- full suite: 2403 passed
2026-10-08 11:17:36 +01:00
conductor 6486f96c94 chore(release): auto-bump version to 0.136.4 — earned by # (patch: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 11:15:48 +01:00
Nick 775b75db7c fix(sweep): #126 wave 3 — TUI fallback bodies logged, baseline 131/31 → 72/31 (contract BUILDER-2026-10-08T09:36:16Z-d88162)
- 59 TUI handlers: the bodies were already fallback assignments
  (visible degrade) — added logger.debug as first statement so the
  failure is observable, then the fallback runs
- baseline re-shrunk DOWNWARD again: 131/31 → 72/31
- TUI tests green
2026-10-08 11:11:38 +01:00
Nick efc0f3a292 Merge remote-tracking branch 'gitea/master' 2026-10-08 11:09:34 +01:00
Nick a997cd4f47 fix(sweep): #126 wave 2 — remaining BLE001 classified, baseline re-shrunk 345/75 → 131/31 (contract BUILDER-2026-10-08T09:36:16Z-d88162)
- mechanical pass-sites → logger.debug suppressions
- deliberate degrades → noqa with explicit reasons
- baseline re-shrunk DOWNWARD (the only legal direction): 345/75 → 131/31
- full suite: 2403 passed (the 2 lint-contract reds are the known local
  ruff-PATH artifact — /usr/bin/ruff absent here, present in CI)
2026-10-08 11:09:34 +01:00
conductor 8d8e09bee6 chore(release): auto-bump version to 0.136.3 — earned by # (patch: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 11:02:45 +01:00
Nick ebc0e7edce Merge remote-tracking branch 'gitea/master' 2026-10-08 11:02:31 +01:00
Nick c22bc002bc fix(sweep): #126 wave 1 — 79 silent handlers classified, store-dependent test isolated (contract BUILDER-2026-10-08T09:36:16Z-d88162)
- 44 S110 pass-sites → logger.debug suppressions (P0-06 pattern)
- 35 rune_tui.py sites → deliberate-silence noqa (render-loop must
  never crash the session)
- test_find_capability_no_match: store-state isolation via monkeypatch
  (the live store gained cards that score >0 on the no-match query —
  a store-state dependency, not a code regression; the oracle's
  no-match path is unchanged)

Full suite: 2403 passed. Ratchet PASS.
2026-10-08 11:02:28 +01:00
conductor 17b2e32c8c chore(release): auto-bump version to 0.136.2 — earned by # (patch: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 04:04:56 +01:00
conductor 865a03d199 chore(release): auto-bump version to 0.136.2 — earned by # (patch: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 03:59:30 +01:00
Nick d913c019c5 test(constitutional): #152 adversarial battery — break the constitutional paths after nominal tests pass (contract BUILDER-2026-10-08T02:53:12Z-6380f7)
8 attacks across 4 classes, each asserting the mechanism FAILS LOUD:
- stale-state: ghost plugins cannot resolve from a stale index; inactive
  plugins filtered
- threshold bypass: wash_count 19 parks; type confusion ('999') CRASHES
  loud (oracle-pinned — never silently accepted); negative wash parks
- status inversion: rock re-promotion refused ('already rock'); garbage
  rock_status treated as washable
- value inflation: importance inflation pinned (oracle uses raw value);
  goal-overlap capped

Built on the fuzz + adversarial infrastructure (eef7768, T20 20W).
#152 substantially addressed; #151's fuzz half is live.
2026-10-08 03:57:25 +01:00
Nick 89848faf63 Merge remote-tracking branch 'gitea/master' 2026-10-08 03:50:38 +01:00
Nick 216963223e fix(sleep-time): json_valid guard on the todowrite query — a malformed part row crashed json_extract and killed the whole extract (found during batch-11 fixture generation; the oracle itself crashed on the malformed-row fixture). Guard: json_valid(data) before json_extract. 11 sleep tests green. 2026-10-08 03:50:38 +01:00
conductor 2e351c71db chore(release): auto-bump version to 0.136.1 — earned by # (patch: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 03:46:31 +01:00
Nick 9afa9e2911 Merge remote-tracking branch 'gitea/master' 2026-10-08 03:46:19 +01:00
Nick 13bdbc5d1e fix(tools): #2481 CLOSED — undo_last restores via sidecar manifest (contract BUILDER-2026-10-08T02:29:42Z-a43ffb)
Python-first (the oracle authority): _backup_file writes a JSON sidecar
(.manifest) beside every .bak carrying the original ABSOLUTE path;
undo_last reads the manifest as the PRIMARY restore authority. Legacy
manifest-less backups degrade to the old name-parse (preserved).

Go parity: BackupFile writes the same sidecar; UndoLast reads it first.
The Go truth test flipped from pinning the dead behavior to asserting
the FIXED behavior (restore works, both files consumed) — both sides
flipped together, verified by live probe on the Python side and the
round-trip test on the Go side.

166 related tests green. #2481 closed.
2026-10-08 03:46:19 +01:00
conductor feeece62eb chore(release): auto-bump version to 0.136.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 03:19:42 +01:00
Nick 7cd222ccfa Merge remote-tracking branch 'gitea/master' 2026-10-08 03:19:27 +01:00
Nick 82abd1b3ab feat(pipeline): EXIT-NOTE TEMPLATE — plain-English version history (contract BUILDER-2026-10-08T02:04:24Z-a129fb)
Nick's directive: when the pipeline earns a new version, the release
body must carry a plain-English summary of what was worked on and
submitted — the counterpart of the issue-entry template, part of the
Gitea Actions pipeline (auto-version.yml), not a manual step.

- scripts/release_exit_note.py: renders the exit note from the push
  range (git log v<last>..HEAD, chore(release) excluded) — conventional-
  commit prefix → kind classification (added/fixed/improved), reader-
  facing translation (contract refs, parity language, truth batteries),
  aggregate headline + per-item bullets + verification summary
- auto-version.yml: wired into the release step (LAST_TAG →
  release_exit_note.py → --exit-note flag on release_history_cli init)
- release_history_cli.py: consumes --exit-note, parses the markdown
  into structured extras (headline + items) passed to
  auto_initial_note(extra=...)
- release_notes.py: auto_initial_note accepts extra (merged into
  improved/added/fixed after fact extraction, deduped)
- scripts/backfill_exit_notes.py: retroactive backfill for the 27
  pre-template releases (executed — all patched)

The exit note is now a first-class pipeline citizen: every earned
version carries the human narrative alongside the governed evidence.
2026-10-08 03:19:27 +01:00
conductor aca27ae90a chore(release): auto-bump version to 0.135.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 03:01:57 +01:00
Nick 4ba9c4359f Merge remote-tracking branch 'gitea/master' 2026-10-08 03:01:43 +01:00
Nick 6d2fb5edea feat(go): factory batch 12 — FAMA scoring (contract BUILDER-2026-10-08T02:01:32Z-236bbf-unknown)
Forgetting-Aware Memory Accuracy ported to drift-core: valid = active
AND (wash>0 OR rock/established); missing rows skipped; empty = 0.0.
5-case battery from the live oracle incl. the missing-row path.
First-run green.
2026-10-08 03:01:43 +01:00
conductor 7df4b237db chore(release): auto-bump version to 0.134.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 02:44:56 +01:00
Nick e87a5a7561 Merge remote-tracking branch 'gitea/master' 2026-10-08 02:44:40 +01:00
Nick 1568d571ea feat(go): factory batch 11 — sleep-time transcript surfaces (contract BUILDER-2026-10-08T01:44:30Z-b7985f-unknown)
ExtractTodos (latest-todowrite filter, malformed rows skipped) and
WriteTranscript (byte format, injected clock, title sanitization) ported
to sleep-time. SQL stays reactive. 5-case battery. Oracle quirks pinned:
SQL json_extract crashes on malformed JSON rows; write_transcript relies
on _ensure_dirs pre-running.
2026-10-08 02:44:40 +01:00
conductor ed73f36d14 chore(release): auto-bump version to 0.133.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 02:28:47 +01:00
Nick 2be2b5b7c1 Merge remote-tracking branch 'gitea/master' 2026-10-08 02:28:08 +01:00
Nick 32dda3d3bd feat(go): factory batch 10 — drift value mechanics (contract BUILDER-2026-10-08T01:27:57Z-743b1c-unknown)
ComputeValue (5-factor weighted score: log1p proven, recency half-life
30d with floors + bad-ts degrade, reliability, goal relevance) and
CheckPromotionEligibility (rock short-circuit, threshold gate, 0.6
minimum, exact reason texts) ported to drift-core. Constants verbatim,
clock injected. 13-case battery incl. degrade paths — first-run green.
2026-10-08 02:28:08 +01:00
conductor 4a8158ba06 chore(release): auto-bump version to 0.132.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 01:58:35 +01:00
conductor 24b09ca259 chore(release): auto-bump version to 0.132.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 01:30:28 +01:00
conductor 1cd766684a chore(release): auto-bump version to 0.132.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 01:17:57 +01:00
Nick 5e38383cfe Merge remote-tracking branch 'gitea/master' 2026-10-08 01:06:50 +01:00
Nick ce638de74e feat(go): factory batch 9 — event-bus content hash (contract BUILDER-2026-10-08T00:06:39Z-8c023f-unknown)
_content_hash ported with FULL python json.dumps byte semantics: nested
sort_keys recursion, ensure_ascii escaping, and the int-vs-float literal
distinction preserved via json.Number decoding (the oracle distinguishes
1 from 1.0; the hash of an int-carrying payload differs from the
float-carrying one). 6-case battery — the oracle corrected two
assumptions before the design was pinned.
2026-10-08 01:06:50 +01:00
conductor 59cd8a79b1 chore(release): auto-bump version to 0.131.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 00:58:32 +01:00
conductor 026d9b3df8 chore(release): auto-bump version to 0.131.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 00:51:47 +01:00
conductor 0ed2be1de5 chore(release): auto-bump version to 0.131.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 00:45:13 +01:00
Nick 14b0d48cad Merge remote-tracking branch 'gitea/master' 2026-10-08 00:41:51 +01:00
Nick 4c7ee39f61 feat(go): factory batch 8 — microkernel registry primitives (contract BUILDER-2026-10-07T23:35:52Z-see-contract)
Register/Unregister/Resolve ported to microkernel, integrated with the
committed main.go shapes (PluginManifest typed struct; Hooks widened to
map[string]interface{} for oracle parity — the manifest carries bool
enabled flags). Resolve: priority ladder (lower = higher), active-only
filter, stable tie order. 6-case battery from the live oracle with a
tmp-REGISTRY_DB seam (the reactive store isolated). The oracle fixtures
corrected my snapshot approach: the registry is PERSISTED per-op, so the
truth reloads from the store rather than trusting a stale in-memory
object.
2026-10-08 00:41:51 +01:00
conductor 8831126cda chore(release): auto-bump version to 0.131.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 00:37:22 +01:00
Nick 77714ab13d Merge remote-tracking branch 'gitea/master' 2026-10-08 00:30:00 +01:00
Nick c1d9e424eb feat(go): factory batch 7 — cache mechanical compression (contract BUILDER-2026-10-07T23:29:49Z-a1fb0d-unknown)
Compress ported verbatim: drop empty/comment/decorative/citation/short
lines, join, 797+... truncate past 800. 9-case battery (4 hash + 5
compress) from the live oracle. First-run green.
2026-10-08 00:30:00 +01:00
conductor 8019ff2c03 chore(release): auto-bump version to 0.131.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 00:25:05 +01:00
Nick d980aeba43 feat(go): factory batch 6 — cache content-hash (contract BUILDER-2026-10-07T23:23:32Z-8265ae-unknown)
ContentHash sha256[:16] ported to cache/ — the change-detection hash.
4-case battery from the live oracle. sqlite layer stays reactive.
2026-10-08 00:23:43 +01:00
Nick 7a2dec529b chore(scaffold): contract store snapshot (batch 5 retro-ship) 2026-10-08 00:21:16 +01:00
Nick 76430ca71f feat(go): factory batch 5 — provider tool-format adapters (contract BUILDER-2026-10-07T23:14:45Z-635b00)
FormatToolsOI/FormatToolsAnthropic ported: the provider-facing shape
transforms with default-parameters fallback. 2-case battery from the
live oracle (with and without the parameters key). The [OI] in the
original name was literal Go generic syntax — invalid; renamed to OI.
2026-10-08 00:20:44 +01:00
Nick 8031eed1c1 Merge remote-tracking branch 'gitea/master' 2026-10-08 00:09:22 +01:00
Nick 4c1b13e61a feat(go): factory batch 4 — hook placement mechanics (contract BUILDER-2026-10-07T23:06:18Z-ec6208-unknown)
RecommendPlacement ported verbatim to hook-engine: the decision table
(hook points with append-order shape, the frequency ladder, cache
scopes, concurrency, failure modes, context budget) + the
HOOK_*/FREQ_*/SCOPE_* constants. 14-case factor-matrix battery from the
live oracle — first-run green. The factory continues.
2026-10-08 00:09:18 +01:00
conductor 192e161998 chore(release): auto-bump version to 0.130.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 00:07:28 +01:00
Nick 6daf950642 Merge remote-tracking branch 'gitea/master' 2026-10-08 00:05:09 +01:00
Nick d78d8d4dc4 feat(go): factory batch 3 — tool-protocol CLI (contract BUILDER-2026-10-07T23:01:39Z-0457fe-unknown)
The module-family JSON CLI over the ported protocol core:
- ops: validate / normalize_text / ollama / visible / contains_internal /
  registry_shape / list-tools / requires-approval (argv compat)
- registry_shape: 19 tools, order preserved — the frozen registry
  set-equality check surfaced through the CLI
- requires-approval: the auth boundary op (bash→run_command alias
  canonicalized before the check; read-only set mirrored)

All gates green. The factory continues — batch 4 scopes next.
2026-10-08 00:05:05 +01:00
conductor 4dee7221cb chore(release): auto-bump version to 0.130.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-08 00:01:35 +01:00
Nick 630642f499 feat(go): factory batch 2 — text-fallback parse + span surgery (contract BUILDER-2026-10-07T22:11:52Z-9ffb73-unknown batch 2)
The span-surgery half of tool_protocol.py ported:
- DecodedObjects: balanced JSON scan with exact spans (the JSONDecoder
  raw_decode walk)
- ProtocolEntries: fence/xml wrapper expansion (spans widen to the
  wrapper when the surrounding line is empty), malformed-residue checks
  (tool_call text, literal tool-key outside strings)
- ExtractVisibleText: reverse-order span removal with the
  line-boundary widening rule
- containsToolObjectKey: the outside-strings scanner
- requestFromEnvelope: validation errors PROPAGATE as hard errors for
  the whole text (oracle-verified: '<tool_call>{"tool": "x"}' →
  'unknown tool: x' — my first read swallowed them; the fixture caught it)

PARITY: the batch-1 truth battery's visible/normalize cases now ACTIVE
(they were pinned waiting for this batch). 17/17 green.
2026-10-07 23:59:08 +01:00
Nick 38c9d2729c Merge remote-tracking branch 'gitea/master' 2026-10-07 23:48:29 +01:00
Nick 4032c753f3 feat(go): factory batch 1 — tool-protocol validation core (contract BUILDER-2026-10-07T22:11:52Z-9ffb73)
The model→tool boundary ported to tool-protocol:
- ValidateToolRequest: alias canonicalization BEFORE schema (grep→
  grep_files, bash→run_command — bash never bypasses run_command's
  approval boundary), exact Python error texts (unknown tool / required
  argument missing / unknown argument / must be <type>), array item
  type checks, deterministic arg iteration for error stability
- schemas from the FROZEN tools_registry.json (shared with
  tool-executor — the set-equality authority)
- NormalizeOllamaToolCalls: native envelope + string-arguments JSON
  decode, malformed-shape errors
- ContainsInternalProtocol: result/error markers + xml tool_call spans
- ToolRequest dataclass aligned to the Python shape (Arguments field)
- 17-case truth battery from the live oracle; span-surgery surfaces
  (extract_visible_text, text-fallback parse) pinned for batch 2
2026-10-07 23:48:24 +01:00
conductor 30b5de31a2 chore(release): auto-bump version to 0.129.5 — earned by # (patch: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 23:48:04 +01:00
Nick 03e0b8667a Merge remote-tracking branch 'gitea/master' 2026-10-07 23:47:54 +01:00
Nick 13a9bfe88d fix(operator): script-mode imports + guarded emission + test env parity (contract BUILDER-2026-10-07T22:45:14Z-1d3c31)
Three faults from the factory loop's CI watch:
- _wire_auto_filer script-mode fallback assumed the script dir was on
  sys.path — insert it before the flat imports
- the terminalization emission call sites leaked override-raised
  exceptions — the documented contract (journal failure never masks the
  operator path) is now enforced AT the call sites (the method-internal
  guard cannot cover subclass overrides); the two inner journal guards
  carry their contract annotation explicitly
- test_operator_script_can_import set env={HOME: tmp}, which silently
  relocated python's user-site (~/.local derives from HOME) and hid
  httpx — the test now carries the real user-site forward via PYTHONPATH
  while keeping the data-home isolation intent

Full suite: 2396 passed. Ratchet PASS bare (the annotation sweep also
dropped BLE001 to 344 — under baseline).
2026-10-07 23:47:54 +01:00
conductor c091cacb61 chore(release): auto-bump version to 0.129.4 — earned by # (patch: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 22:58:09 +01:00
Nick d1f62288ab Merge remote-tracking branch 'gitea/master' 2026-10-07 22:57:57 +01:00
Nick 7c5310d1b2 fix(tools): go truth-harness runner fix — fixtures must live where the product policy allows (contract BUILDER-2026-10-07T21:57:47Z-01b08a-unknown)
Run 20074+ go-surface red: the harness created truth roots via
os.MkdirTemp over the allowed dirs, but on the runner the effective root
resolved under /var/lib/gitea-desktop-runner — INSIDE the blocked /var —
so ValidateRead/WritePath correctly denied the harness own fixtures. The
product gate was right; the harness was wrong.

- mkTruthRoot: /tmp FIRST (read-allowed on every surface), then allowed
  dirs, then HOME
- mkWriteRoot: write-allowed dirs only (the generator read/write split),
  never /tmp — write policy is ~ + /mnt/workdrive
- candidates inside BlockedDirs are SKIPPED: a root there can never pass
  the product gate, so creating it just guarantees a red

Verified: local green + simulated blocked-TMPDIR green. Full sweeps:
Go all modules green + gofmt clean; Rust 80/80 clippy/fmt/test clean;
Python 225 passed (2 known local ruff-PATH artifacts, gate bare = PASS).
2026-10-07 22:57:56 +01:00
conductor c39f1d0b3c chore(release): auto-bump version to 0.129.3 — earned by # (patch: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 22:35:41 +01:00
Nick 231d4e51f1 Merge remote-tracking branch 'gitea/master' 2026-10-07 22:35:28 +01:00
Nick e82b2eb2af fix(rust): rust-surface CI debt discharge — the new gates lit up the debt they were built to catch (contract BUILDER-2026-10-07T21:34:56Z-95ad63-unknown)
First CI execution of the rust-surface job failed 17 crates, exactly as
designed. Discharged:

- doc_lazy_continuation (20+): paragraph separators per clippy's own help
- not_unsafe_ptr_arg_deref (11 FFI exports): item-level allow with the
  ABI reason — #[no_mangle] extern 'C' signatures are the Survivor loader
  contract; the raw pointer IS the FFI boundary
- manual_clamp (2): one real clamp rewrite; one parity-preserving allow
- too_many_arguments / type_complexity / while_let / filter_map: item
  allows with parity reasons; ONE semantic rewrite (filter_map→map in
  cognition_core — provably identical: Num→Some(*n)/else Some(0.0) is a
  total map)
- dead_code (2): allows with provenance reasons

PLUS pre-existing dead test code the new cargo test step lit up for the
first time: construction_depth's 3 tests passed None where the signature
takes bool (never compiled under any gate until today); context_pressure
had a str-vs-String vec and a fixture assuming 1 char/token when the
tokenizer is 3.5 — the fixture is now DERIVED from CHARS_PER_TOKEN so the
threshold ladder's top step is actually proven.

Result: 80/80 crates — clippy -D warnings CLEAN, fmt --check CLEAN,
cargo test PASS. The gates hold from here.
2026-10-07 22:35:28 +01:00
conductor a977805377 chore(release): auto-bump version to 0.129.2 — earned by # (patch: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 21:55:57 +01:00
Nick 9eb4a36d62 Merge remote-tracking branch 'gitea/master' 2026-10-07 21:51:38 +01:00
Nick bf3ab130af fix(ci): dep-lock resync — the hypothesis pin hand-edit bypassed the canonical lock path (contract BUILDER-2026-10-07T20:56:00Z-see-log)
The #150 gate exists precisely to catch this: dev extras gained
hypothesis, the lock was hand-edited instead of uv-compiled, and the
transitive dep (sortedcontainers) never landed. Regenerated via
uv pip compile — provenance chains correct, gate green.

Lesson: the lock is GENERATED. Hand-edits to requirements-ci.txt are
the bug, not the fix.
2026-10-07 21:51:38 +01:00
conductor 8e9edeeea7 chore(release): auto-bump version to 0.129.1 — earned by # (patch: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 21:44:05 +01:00
Nick 4faa1c107e Merge remote-tracking branch 'gitea/master' 2026-10-07 21:43:56 +01:00
Nick bb4e753e0e fix(ci): ci.yml YAML parse repair — the polyglot gate registered as a failed workflow (contract BUILDER-2026-10-07T20:43:27Z-cdf3fe)
The clippy step's echo carried unescaped shell substitution inside a
double-quoted YAML scalar and the cargo-test step name spanned two lines —
gitea parsed the workflow as FAILED before any job ran (context 'ci.yml',
zero jobs, run 20047). Escaped the echo, single-lined the name; the file
now parses with all 11 jobs including rust-surface.
2026-10-07 21:43:56 +01:00
conductor 52333e8ee9 chore(release): auto-bump version to 0.129.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 21:32:08 +01:00
Nick 1f6b6fb6aa Merge remote-tracking branch 'gitea/master' 2026-10-07 21:31:48 +01:00
Nick eef7768501 feat(pipeline): the POLYGLOT LINT GATE — language-aware dynamic linting + fuzz + property invariants (contract BUILDER-2026-10-07T20:01:40Z-ac6140-unknown)
Nick's directive: linting must apply DYNAMICALLY on the right language —
Go/Rust/anything gets the correct linter — plus fuzzy tests and useful
bug-catchers, wired into the Gitea pipeline.

THE GAPS (confirmed by inspection): Rust had ZERO linting (crates built,
never clippy); Go had vet only (gofmt drifted across 41 files); no fuzzing
anywhere; no property-based tests.

NEW:
- scripts/polyglot_lint.py: detects changed files vs the push range,
  groups by language (extension + path prefixes), runs ruff / go vet +
  gofmt -l / cargo clippy + cargo fmt --check per language; unknown
  extensions skipped with a note; exit non-zero on any finding
- CI: gofmt gate (formatting is a gate), go test -race sweep, go fuzz
  smoke (15s per target), and a NEW rust-surface job: rustfmt --check +
  clippy -- -D warnings + cargo test (currently trivial — the crates carry
  no #[test] yet; this lights up the moment the first lands)
- GO FUZZ TARGETS on the byte-parity surfaces: canonicalJSON (round-trip),
  Norm (deterministic + charset), Stem (no-grow/no-empty — idempotence
  deliberately NOT asserted: the oracle folds retroactively → retroactive
  → retroactiv, verified), FtsQueryConjunctive, Overlap (symmetry + [0,1])
- PYTHON property invariants (hypothesis, pinned 6.168.5 in dev extras +
  requirements-ci.txt): the same mathematical properties, mirrored

FOUND BY THE FUZZER ON FIRST LIGHT:
- canonicalJSON passed control bytes (<0x20) through RAW — Python
  json.dumps escapes them \uXXXX even with ensure_ascii=False. The Go
  digest DIVERGED from the oracle on adversarial payloads. FIXED
  (jsonEsc now emits \u00XX); the approval-digest surface is
  byte-stable again
- the FTS builder never escapes embedded quotes (oracle-verified: Python
  does the same) — pinned as oracle truth; FTS5 hardening filed separately

Also: gofmt -w across the tree (the 41-file drift converged; every module
builds), clippy --fix + cargo fmt across all 80 crates (warnings ~110 →
59 mechanical-fixed, remainder are stylistic and now GATED so debt
cannot grow). THE PIPE-MASK hit my own verification twice more this
session — the gate script itself exits 1 correctly (verified bare).
2026-10-07 21:31:23 +01:00
conductor 81099a11f7 chore(release): auto-bump version to 0.128.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 20:52:40 +01:00
Nick 3c13be1d76 Merge remote-tracking branch 'gitea/master' 2026-10-07 20:52:28 +01:00
Nick de9dee7dd9 feat(go): memory-store batch 4 — the dense-side meta-judgement (contract BUILDER-2026-10-07T19:47:37Z-1cf1dc-unknown)
The recall() gate ported to memory-store-deep:
- DenseGate: vector proximity is not a relation — a dense hit (cos =
  1 - distance/2) is kept iff it shares a DISTINCTIVE content word with
  the entry (df/total < 0.05 via LIKE-substring counts); fallback keeps
  no-content-word queries or strong matches (cos >= 0.80). The
  black-coffee/black-holes fix, now deterministic-side.
- QueryContent (len>3 non-stop, first-occurrence order)
- RankFusionEntries: verified IDENTICAL to the chunk-side fusion (same
  code, :1297 vs the batch-2 port) — wrapper pins the parity for the
  recall() call shape; the docstring's raw-BM25 claim is stale, the
  CODE min-max normalizes in all modes (code is the oracle)
- the abstain constants: RECALL_BUDGET=8, RECALL_MIN_SCORE=0.42

PARITY: truth_gate.json — 6 cases from the live oracle against a fixture
store (distinctive/common/strong-cos/no-content branches + fusion
identity + constants). Embedding/vec0 SQL and the cache stay reactive.
2026-10-07 20:52:25 +01:00
conductor c949df0e98 chore(release): auto-bump version to 0.127.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 20:39:30 +01:00
Nick 18c12fbda7 Merge remote-tracking branch 'gitea/master' 2026-10-07 20:39:16 +01:00
Nick ee7da6d080 feat(go): warm-router deep batch — the always-on digest core (contract BUILDER-2026-10-07T19:35:07Z-4d6b4c-unknown)
The digest selection machinery ported to warm-router:
- LexicalSignal (punctuation-strip, len>3, _DIGEST_STOP 64 words extracted
  verbatim), LexicalOverlap (Jaccard)
- Universality: the rule-vs-record classifier (date regex → 0, dated
  markers 2+ → 0 / 1 → 0.25, directive markers capped +0.25, terse
  40/90 ±0.15/-0.2, clamp)
- DigestSelect: the pure core — topic_rank slug ordering, 5-key stable
  sort (topic, -universality, always_on, -importance, -lexical density),
  junk skip (<12 chars / no triggers), universality gate, lexical gate,
  Jaccard dedup >=0.45, token sizing (len/4), oversized skip, budget fit

PARITY: truth_digest.json — 9 cases. The oracle corrected MY expectation
in the fixture: operating-gates-copy (importance 0.8) outranks the
original (0.7) on the importance tiebreak — fixture honesty, again. DB
I/O stays reactive. First-run green on the port itself.
2026-10-07 20:39:13 +01:00
conductor 2fa29f408c chore(release): auto-bump version to 0.126.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 20:27:41 +01:00
Nick f433efe375 Merge remote-tracking branch 'gitea/master' 2026-10-07 20:27:31 +01:00
Nick be00b56a0c feat(tools): undo_last port + the DEAD-FUNCTION finding (contract BUILDER-2026-10-07T19:20:10Z-af954d-unknown, defect #2481)
- UndoLast ported to tool-executor: glob *.bak, mtime-desc (name desc on
  ties), split('_', 4) → parts[4] underscore-to-slash reconstruct,
  exists-check, restore+delete. Verbatim semantics.
- THE FINDING: undo_last can NEVER restore absolute paths — the safe-name
  mangling eats the leading slash and split('_',4) drops the first path
  segment into parts[3]. Verified live three ways (multi-segment tmp,
  underscore-free /tmp, cwd-relative). The safety mechanism silently does
  nothing while the mutation stands. FILED: #2481 (fix the Python oracle
  first via a sidecar manifest, regenerate truth, flip Go — the parity
  battery verifies both sides flip together).
- The truth test PINS the dead behavior (oracle parity, not aspiration):
  a future one-sided 'fix' cannot silently diverge.
- UndoDir gains a seam (undoDirFn) so tests redirect without touching
  ~/.rune/undo. Per-wave routine held (gates bare, spine rebuilt, both
  snapshots shipped).
2026-10-07 20:27:28 +01:00
conductor 72d443423e chore(release): auto-bump version to 0.125.1 — earned by # (patch: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 20:13:28 +01:00
Nick f96991bf2e Merge remote-tracking branch 'gitea/master' 2026-10-07 20:13:16 +01:00
Nick 5dea803e92 fix(tools): SECURITY-ADJACENT parity repair — the approval boundary (contract BUILDER-2026-10-07T19:10:38Z-cc6be2-unknown)
src/go/tool-executor readOnlyTools diverged from the Python oracle in
BOTH directions:
- it wrongly ADDED run_command — a mutating tool the oracle routes
  through operator approval; the Go port would execute it read-only
  (the dangerous direction: approval bypass)
- it MISSED 8 of the 12 oracle read-only tools (git_diff, git_log,
  repo_map, read_persona, query_memory, check_growth, diagnose_behavior,
  find_capability)

Fixed to the exact 12-tool set, and pinned by a FROZEN truth battery
(gen_tool_executor_auth_truth.py → truth_auth.json) asserting set
equality both ways forever — the test's failure message says it plainly:
THE APPROVAL BOUNDARY HAS DRIFTED. Per-wave routine held (gates bare,
spine rebuilt, both snapshots shipped).
2026-10-07 20:13:13 +01:00
conductor 30ec1c8153 chore(release): auto-bump version to 0.125.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 20:01:07 +01:00
Nick ad7e6fef2c Merge remote-tracking branch 'gitea/master' 2026-10-07 20:00:59 +01:00
Nick df9290fcff feat(go): memory-store batch 3 — the scoring/abstention kernel (contract BUILDER-2026-10-07T18:57:06Z-c2429c-unknown)
The recall scoring kernel ported to memory-store-deep:
- ScoreRecallRows: rank-ordered metadata scoring — confidence (0.7
  default) x temperature (1.0 default) x recency (half-life 30.0,
  hl/(hl+days) on non-negative days, timestamp failures degrade to 1.0);
  dense base vs lexical base+5.0; the exact round discipline
  (rrf/conf/temp 4-4-2-2)
- PositionAware: the lost-in-the-middle re-rank — best item FIRST,
  second-best LAST, same items, order-only (no-op < 3)
- the FULL abstention ladder verbatim: neither → []; lexical-only
  max-relevance gate; dense-only min_score → >=0.74 position-aware →
  >=2 rows with 0.08 gap → gap-abstain → position-aware(map_reduce);
  hybrid min_score then position-aware(map_reduce)

PARITY: truth_score.json — 6 cases covering every abstention branch
(hybrid 3, dense-only high-conf/gap-abstain/min-score, lexical gate,
neither). First-run green — the oracle's fixture honesty paid forward.
2026-10-07 20:00:56 +01:00
conductor 779a26eaae chore(release): auto-bump version to 0.124.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 19:50:45 +01:00
Nick 8111e0b3ba Merge remote-tracking branch 'gitea/master' 2026-10-07 19:50:36 +01:00
Nick 3f440693de feat(go): scaffold batch 3 — the closure mechanics (contract BUILDER-2026-10-07T18:42:38Z-52829e-unknown)
CloseContract ported to Go:
- CloseQuality: the pure bucket math verbatim — pred_existing from
  affected_entities + the frontier's 4 keys, correctly_predicted /
  predicted_but_unaffected / expected_new_observed / expected_new_missing,
  expected_runtime prefix-matching (both directions), genuinely_unexpected_new,
  legacy missed/needless aliases, candidate_corrections, evidence_sources
- RecordObservedImpact: observations append (detail[:300]), sorted
  implicated, evidence_count — INDEPENDENTLY SOURCED, never re-derives
  the prediction (the §17 invariant)
- CloseContract: superseding/verifying phase gate (exact error text),
  inputs assembly, quality stamping, optional scope_check, checkpoint
  append, phase/status/next_action/observed_at mutation
- ContractEntity gains Ext (the ext dict the lifecycle carries)

PARITY: truth_close.json — 4 cases (edge-covering bucket math, full
lifecycle close with scope_check, both gate errors). The ratchet stopped
the first commit attempt (2 new generator handlers) — annotated with
intentional-silence reasons, re-landed. Per-wave routine: gates BARE,
spine rebuilt, both snapshots shipped.
2026-10-07 19:50:33 +01:00
conductor 1d4aa87ca4 chore(release): auto-bump version to 0.123.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 19:35:15 +01:00
Nick 61432632f7 feat(go): build-mode batch 2 — worktree git operations, plan/exec split (contract BUILDER-2026-10-07T18:26:40Z-8be89a-unknown)
The worktree lifecycle ported to build-mode with a TESTABILITY split:
- the PLAN layer is pure and oracle-batteried: WorktreePlan / DeletePlan
  (two bare steps, no short-circuit — parity with the Python's separate
  subprocess calls) / MergePlan (exact message format 'Build {id}: {desc}')
- the EXEC is reactive and fixture-proven: a REAL tmp git repo round-trip
  (create → commit on the branch → merge lands the file in the repo root
  → delete clears worktree+branch), plus the duplicate-create and
  conflicting-merge failure texts (the wrapper 'Failed to merge
  worktree:' is the stable contract; git's own message varies by version —
  the ORACLE's fixture text pinned the shape, the live git pinned the
  variance)
- state transitions verified: worktree_path set on create, cleared by
  merge-follows-delete

PARITY: truth_worktree.json — 6 cases (3 argv plans, state round-trip,
both error texts) from the live BuildManager driving real git with the
clock frozen. Per-wave routine held: gates BARE, spine rebuilt, both
store snapshots shipped.
2026-10-07 19:35:04 +01:00
Nick 5601fee02a Merge remote-tracking branch 'gitea/master' 2026-10-07 19:18:46 +01:00
Nick cdca988d00 chore(spine): rebuild the structural manifest — the scaffold store-layer + memory-store read-path batches added modules the committed spine predated (second occurrence of this class; SPINE REBUILD now joins scaffolding_coverage in the per-wave routine) 2026-10-07 19:18:46 +01:00
conductor d05a9e6741 chore(release): auto-bump version to 0.122.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 19:14:10 +01:00
Nick ddb7490cc6 Merge remote-tracking branch 'gitea/master' 2026-10-07 19:13:58 +01:00
Nick d12fbab06a feat(go): memory-store batch 2 — the deterministic read-path (contract BUILDER-2026-10-07T18:05:47Z-152c16-unknown)
Read-path mechanics of memory_store.py ported to memory-store-deep:
- FtsQueryConjunctive: extended-Boolean AND (len>3 non-stop terms, len>2
  fallback, quoted, first 8, space-joined) — msStopwords extracted
  verbatim from the live module
- ChunkText: paragraph recombination + 1.5x hard-split
- RankFusion: RRF k=15, three modes (hybrid/dense-only/lexical-only with
  min-max bm25 normalize), insertion-ordered ranks, NUMERIC ids out
  (Python int ids; the string map is internal)
- ProjectChunkRows: -rrf sorted, text[:400], rrf round 4, budget cap
- MapReduce: top-3 per chunk + the REDUCE pass (all mapped re-sorted by
  score) — the oracle caught my chunk-order-only first read
- FuseResults: NormKey (lowercase whitespace-collapse) dedup, exact field
  shape, kind-wise min-max scale-alignment (the audit fix), final sort

PARITY: truth_recall.json — 17 cases from the _py_* oracles; fixtures
SHIP in the inputs. Embed surfaces stay Python-side (model-coupled).
2026-10-07 19:13:55 +01:00
conductor 19db782906 chore(release): auto-bump version to 0.121.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 19:01:18 +01:00
Nick e0d7d7bb03 Merge remote-tracking branch 'gitea/master' 2026-10-07 18:56:20 +01:00
Nick 5dda590588 feat(go): scaffold batch 2 — the transactional store layer (contract BUILDER-2026-10-07T17:47:00Z-960f12)
The §21 transactional boundary ported to Go:
- CanonicalDigest: sha256 of the sorted+redacted semantic payload (byte
  parity with json.dumps(sort_keys=True): Python default separators,
  ensure_ascii escaping) — the §12B real commit semantics
- RedactSecrets (exact names + credential substrings), SortedNorm
  (recursive; lists sort by their dumps repr)
- Commit (intended-vs-on-disk digest readback), VerifyOnDisk (the
  forgotten-save lie detector), SaveVerified — exact Python assertion
  texts including the %r single-quote form
- SaveDoc: schema guard + indent=1 sort_keys write (the disk format)
- ImpactFrontier: the bounded Spine-edges-only walk — change_kind
  inference, NON_OBLIGATION/STALE/CANDIDATE skips, contract expansion
  (implements/consumes); the ORACLE corrected my inverted party
  computation (c==b → party=a)
- SnapshotPredictedFrontier + SpineBridgeEntity (identity-only bridge)

PARITY: truth_store.json — 10 cases incl. digest key-order stability,
secret redaction shape, forgotten-save detection with exact text, three
frontier modes. Frontier docs SHIP in the truth inputs (batch-1 lesson).
The ratchet blocked the first commit attempt (new generator handler) —
the bare-command law held; annotated and re-landed.
2026-10-07 18:56:17 +01:00
conductor 953197823a chore(release): auto-bump version to 0.120.1 — earned by # (patch: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 18:48:14 +01:00
Nick eba579f99f Merge remote-tracking branch 'gitea/master' 2026-10-07 18:42:22 +01:00
Nick 9fd3d8b15d fix(lint): scaffold truth generator — intentional oracle-error handler annotated (ratchet back to 345/75; the pipe-mask that let the violation commit is the recurring lesson, re-learned) 2026-10-07 18:42:22 +01:00
conductor 5171cc3ef8 chore(release): auto-bump version to 0.120.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 18:41:17 +01:00
Nick 64f77e82ff feat(go): scaffold batch 1 — the contract-lifecycle core (contract BUILDER-2026-10-07T17:27:25Z-6bc737-unknown)
Deterministic core of scaffold.py ported to src/go/scaffold (integrated
with the existing W5c classify/status CLI, not replacing it):
- the 9-phase STORE machine (22 legal edges incl. migrating/superseding/
  failed-retry) — DISTINCT from the 16-edge contract machine frozen in the
  Rust membrane; two layers, each authoritative at its own boundary
- TerminalPhases DERIVED from the map (single authority)
- NewContract (identity defaults, sorted-list discipline, doc mutation via
  add_entity parity, duplicate error), TransitionContract (exact error
  texts incl. Python list-repr quoting, checkpoint note[:200], status
  updates, next_action, observed_at)
- CheckScope (equality/prefix/substring; UNKNOWN on unscoped — never
  silently green), LayoutObligations (FLEXIBLE vs USER-LOCKED texts),
  JsonFrontier (Python json.dumps byte form: insertion-ordered keys,
  ', '/': ' separators, ensure_ascii escaping)

PARITY: truth_scaffold.json — 19 cases from the live Scaffold oracle
(now frozen); the generator SHIPS scope+doc in the inputs so the Go replay
needs no oracle-side state. Governance note: the completeness gate required
constraints={'contracts': ['contract:construction_contract_lifecycle']} —
full spine id, prose never counts.
2026-10-07 18:41:07 +01:00
Nick d64df3d011 Merge remote-tracking branch 'gitea/master' 2026-10-07 18:20:40 +01:00
Nick 4d1064449b chore(scaffold): ship the contract store snapshot — the build-mode/lexicon/coverage contracts existed in the live store but not in the committed one (the scaffolding gate in CI reads the COMMITTED store; same class as the go.mod parity law: local-only state is not delivery) 2026-10-07 18:20:40 +01:00
conductor 1e9ddea492 chore(release): auto-bump version to 0.119.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 18:18:19 +01:00
Nick c5ecbacf98 feat(go): build-mode batch 1 — the phase machine + ledger mechanics (contract BUILDER-2026-10-07T17:08:00Z-6e177d-unknown)
Deterministic core of build_mode.py ported to src/go/build-mode:
- the 11-phase machine in declaration order + PhaseStatus/BuildPhase/
  VerificationTier constants
- LogPhase + the named completion functions, clock INJECTED
  (date-time-bomb law); side effects pinned: complete_plan assigns
  batches, start_correct increments corrections
- ResumePoint (reversed declaration-order scan) + the pinned quirk:
  complete_verify(false) records status 'complete' with the failure in
  DETAILS — the resume scan never fires on it
- BuildStatus shape; build_id %Y%m%d-%H%M%S from the injected clock
- module-family CLI (curator-core convention); worktree git ops stay
  reactive (batch 2)

PARITY: truth_buildmode.json — 5 flow cases with RECORDED CALLS replayed
through the ported functions; the oracle's ledger pinned two subtleties my
first read missed (complete_feasible's nested details key; assess/research
log their parameter dicts, not kwargs maps). Comparisons are canonical-JSON
(Go []string vs decoded []interface{} differ in type, not bytes).
2026-10-07 18:18:07 +01:00
Nick 892fb4cafe Merge remote-tracking branch 'gitea/master' 2026-10-07 18:04:47 +01:00
Nick c2a25d187b test(lexicon): recovered-module coverage contract (contract BUILDER-2026-10-07T17:04:41Z-8d5c90-unknown)
The henxel gate flagged drift-ledger.py + lexicon_evolution.py as
ungoverned new modules (run 19849). This pins their core semantics:
coherence ladder, stem-aware grounding parking, promote verdict shapes,
drift-ledger importlib load + check on a synthetic store.

Fixture honesty held: the live oracle corrected three hand-labeled cases —
in a Nick-centric corpus 'nick' is df-1 distinctive, so nick-bearing facts
genuinely ground/relate; the novel-axis probes avoid it.
2026-10-07 18:04:47 +01:00
conductor 9189e5083c chore(release): auto-bump version to 0.118.1 — earned by # (patch: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 17:57:28 +01:00
Nick 4c78ac0cfe Merge remote-tracking branch 'gitea/master' 2026-10-07 17:56:45 +01:00
Nick d6028ca928 fix(governance): recovery fallout alignment (contract BUILDER-2026-10-07T16:56:29Z-9c97ce-unknown)
- drift-ledger.py: 3 intentional degrade handlers annotated noqa+reason
  (ratchet back to 345/75 baseline; behavior byte-identical)
- store/spine/current.json re-extracted: the two recovered modules + their
  memory_env import edges enter the structural self-model (299 entities)
- config/umbrellas.json: drift-ledger + lexicon_evolution join the memory
  umbrella membership
2026-10-07 17:56:36 +01:00
conductor 3aeecf5142 chore(release): auto-bump version to 0.118.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 17:46:21 +01:00
Nick 723836e27a Merge remote-tracking branch 'gitea/master' 2026-10-07 17:45:32 +01:00
Nick a7b13099aa feat(go): curator-core batch 2 — the REAL lexicon semantics (contract BUILDER-2026-10-07T16:31:17Z-997c9d)
The batch-1 LePromoteEligible encoded the LEXICON DEGRADE — the phantom's
shadow ('lexicon module unavailable — strength gate only'). With the phantom
recovered from provenance (5749029), the live oracle returns real verdicts
and the port was behind it. This batch closes that gap:

- lexicon.go: verbatim port of the recovered lexicon_evolution.py —
  ContentWords, Stem (ordered suffix rules + y->i fold), DistinctiveTerms
  (stem-aware df, max(total*0.05, 1.5)), SharedDistinctive, Coherence
  (conflict/consistent/novel), GroundedLex, PromoteEligible — including the
  Python list-repr byte format in the shared-terms reason
- LePromoteEligible upgraded to the real semantics (wash-adjusted threshold
  preserved; degrade path kept as LePromoteEligibleDegrade for the record)
- truth.json le_promote_eligible cases REGENERATED against the live oracle
  (degrade shadow gone); truth_lexicon.json: 14 new direct cases —
  coherence (incl. common-word-is-not-a-relation), grounded (stem-aware,
  invented-token parking), distinctive terms, all four promote verdicts
- scripts/gen_curator_lexicon_truth.py: the committed generator

Also discovered during this batch: the 12:52 checkpoint was 45 min stale —
batches 2-4 (candidates/coherence/decay+compress) had already landed
(9ccb331..38fd578); duplicate work discarded, committed batches kept.
2026-10-07 17:45:20 +01:00
conductor c205c25598 chore(release): auto-bump version to 0.117.2 — earned by # (patch: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 17:31:04 +01:00
Nick a8feb3eee4 Merge remote-tracking branch 'gitea/master' 2026-10-07 17:28:26 +01:00
Nick 574902926e fix(curator): recover the two provenance phantoms — lexicon_evolution + drift-ledger (contract BUILDER-2026-10-07T16:26:19Z-71624c)
Provenance over reconstruction (cycle-5 law):
- lexicon_evolution.py: ~/odysseus 0308ccc6 (feat/memory-lifecycle), verbatim
  229 lines — the branch HEAD had DELETED it, which is why the import was a
  phantom everywhere; no reconstruction was needed
- drift-ledger.py: ~/odysseus rework/product-api HEAD 8524e8e1 — the later
  evolution of the original (adds the package-relative import fallback that
  makes the curator's importlib load robust)

Restored semantics:
- le_promote_eligible now returns real lexicon verdicts (distinctive-term
  sharing / novel-axis) instead of the strength-only degrade
- _contradicts_identity runs real coherence conflict verdicts
- the drift write-gate (run_plan) loads and enforces (check strict=False rc=0)

Verified live: both modules import; curator call sites return lexicon
verdicts (degrade string absent); drift gate check passes; 93 related
tests green; ruff clean.
2026-10-07 17:28:08 +01:00
conductor 70389268a2 chore(release): auto-bump version to 0.117.1 — earned by # (patch: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 17:24:01 +01:00
Nick 3199e36cd4 Merge remote-tracking branch 'gitea/master' 2026-10-07 17:23:48 +01:00
Nick df6f52e652 fix(tools): repair wave — master red closed (contract BUILDER-2026-10-07T16:11:35Z-70ca24)
- tool-executor batch 6: jsonUnmarshal/paramOrder/rawKeyOrder moved from
  truth_prompt_test.go into json_order.go — the non-test build failed with
  undefined symbols (go-surface run 19792 job 56712)
- truth batteries regenerated HERMETICALLY via the committed live-oracle
  generator (scripts/gen_tool_executor_truth.py): {{TMP}}/{{WROOT}}
  placeholders replace the generation host's /mnt/workdrive/tmp* paths in
  inputs AND expectations; fixtures manifest carried in each truth file;
  tests recreate fixtures under their own allowed roots (truth_harness_test.go)
- list_dir comparison now exact (both sides sort); grep compares sorted
  line sets (oracle os.walk order is OS-dependent, not a parity property);
  truncation marker pinned by a new hermetic test
- construction_decision lib.rs: the 'rune dichotomy:' rule-string parity
  half committed (Python half landed in 6d63034; strings verified identical)
- stale in-tree binaries rebuilt from current source
2026-10-07 17:23:15 +01:00
conductor bd2137fc4f chore(release): auto-bump version to 0.117.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 16:57:51 +01:00
conductor 060a2e65ec chore(release): auto-bump version to 0.117.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 16:54:24 +01:00
Nick fe6e9dfbbc feat(go): tool-executor batch 6 — tool prompt + registry (W4b parity, contract-closing)
TOOLS registry ported as embedded data (tools_registry.json, generated from the live Python oracle — 19 tools, order preserved); BuildToolPrompt byte-identical with build_tool_prompt (verified against truth_prompt.json, including the parameter-order preservation via raw-JSON key scanning). Registry shape test locks order + required fields. Contract a259d6 closes: 6 batches (security paths, approval lifecycle, file ops, list/grep/cmd-gate, git+quality, prompt+registry).
2026-10-07 16:54:12 +01:00
Nick 360fbb5f94 sync: remote bump 2026-10-07 16:48:41 +01:00
Nick fbb74b83d3 feat(go): tool-executor batch 5 — compatibility protocol parser + result formatting (W4b parity)
Ports _protocol_entries net behavior (balanced-JSON scan with string/escape awareness, {"tool","args"} envelope, fenced + XML wrappers parse transparently), parse_tool_call (first-call legacy shape — envelope keys are tool/args, NOT name/arguments: live-oracle verified), format_tool_result (exact [Tool result]/[Tool error] prefixes, Unknown-error default). Unknown tools parse fine — validation is dispatch job (fail-open parse, fail-closed dispatch). 8-case battery + unknown-tool test green. Contract a259d6: 5 of 6 batches done.
2026-10-07 16:47:42 +01:00
conductor ceffe7d2e4 chore(release): auto-bump version to 0.116.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 16:40:50 +01:00
Nick 63bee210eb sync: remote bump 2026-10-07 16:40:44 +01:00
Nick d5fba689de feat(go): tool-executor batch 4 — git ops + quality gate (W4b parity)
Ports git_diff/git_log/git_commit (staged flag, limit+path filter, message-required, -A default staging) and the quality trio: LANGUAGE_CONFIG table byte-parity, _detect_language (lowercased extension), lint (30s, ✓ clean verdict), tests (120s, cwd=file-parent-or-dir, stderr appended), format. Decision-layer parity tests green; the command runners gate on tool availability per environment.
2026-10-07 16:40:16 +01:00
conductor 39d83fc388 chore(release): auto-bump version to 0.115.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 16:33:30 +01:00
Nick 1b5f774bac sync: remote bump 2026-10-07 16:33:24 +01:00
Nick 98cde56413 feat(go): tool-executor batch 3 — list/grep/command gate (W4b parity)
Ports _list_directory (emoji prefixes, sorted, pattern filter), _search_files (recursive grep: case-insensitive substring, include filter, 50-match truncate marker, rel:line: format — with the OS-LISTDIR ORDER parity: Go os.ReadDir sorts but Python os.listdir is raw OS order; fixed via Readdirnames(-1) with files-then-subdirs walk), and the command gate (shell-syntax refusal set | > < ; && || ` $(, explicit-shell requirement). Oracle-driven fixes: raw-order walk, ListDirectory keeps sorted (Python sorted(iterdir)).
2026-10-07 16:32:49 +01:00
Nick e267c51293 feat(go): tool-executor batch 2 — windowed read, diff generation, atomic write + undo (W4b parity)
Ports _read_file (1-indexed offset, default-100 window, SWE-agent numbering, truncation context on both ends), generate_diff (unified diff, difflib hunk semantics — two oracle-driven fixes: hunk start on both sides shares the context window, and range lengths count ctx+mid on each side), WriteFile (diff-for-confirmation, never writes), ApplyContent (atomic tmp+rename with backup), BackupFile/undo. Contract a259d6 in building.
2026-10-07 16:17:20 +01:00
conductor 5694193959 chore(release): auto-bump version to 0.114.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 15:13:28 +01:00
Nick 7667c2937c feat(go): tool-executor security core — path validation + approval lifecycle digests (W4b parity)
Ports resolve_path/is_path_allowed/validate_read_path/validate_write_path with the TRUTHFUL-REASON semantics (blocked-under-allowed reports the blocklist, not "outside allowed"; write denials name the allowed dirs — P0-05 P1). Ports the approval lifecycle: PreparedTool, canonical digest (BYTE-IDENTICAL with Python json.dumps sort_keys+separators — verified via live subprocess oracle in the test), path digest (missing/file-content/other branches), one-shot consumption with immediate revalidation (expired/modified/target-changed). Contract BUILDER-2026-10-07T13:37:12Z-a259d6 in building.
2026-10-07 15:10:46 +01:00
conductor b537018ab2 chore(release): auto-bump version to 0.113.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 14:52:26 +01:00
conductor eac67a24da chore(release): auto-bump version to 0.112.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 14:38:40 +01:00
Nick a804cb6436 feat(go): warm-router batch 5 — neuron listing mechanics (W5b parity, contract-closing)
Ports _parse_trigger (comma-split; the JSON-array non-handling is reproduced exactly — oracle-verified), list_neurons body-knowledge construction (fires-on/first-5, knows/80-char, wash lifecycle notes), and the token estimate. SQL read stays at the store seam. 5-case battery + token tests green. The warm-router contract now spans: scoring, route allocation, event/proactive dispatch, priming, listing.
2026-10-07 14:33:45 +01:00
conductor 883554a2db chore(release): auto-bump version to 0.112.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 14:28:08 +01:00
Nick daba0e3294 feat(go): warm-router batch 4 — ACTIVE warm-tier priming mechanics (W5b parity)
Ports _prime_neurons (max-score re-fire semantics, turn counting), _decay_primes (PRIME_DECAY=0.6, PRIME_FLOOR=0.15), and the bloat guard (empty/idle>24h eviction, hard cap 40 sessions by fewest turns). Association-neighbour priming weight 0.5 defined. Persistence stays caller-side. 3-case oracle battery + max-semantics test green.
2026-10-07 14:23:36 +01:00
conductor c4825c2d66 chore(release): auto-bump version to 0.111.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 14:13:29 +01:00
Nick 02f7d1ca42 sync: remote bump 2026-10-07 14:12:00 +01:00
Nick cc52bfb69f feat(go): warm-router batch 3 — reactive event map + proactive query assembly (W5b parity)
Ports route_event (the 8-event neuron-topic map, event-data context truncated to 200 chars) and route_proactive (top-3 task summaries capped at 100 chars, errors→diagnostic query, commitments→reminder query). The final route() call stays caller-side (embeddings + session state are I/O). 6-case live-oracle battery green.
2026-10-07 14:11:34 +01:00
conductor e0d0923488 chore(release): auto-bump version to 0.111.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 14:09:48 +01:00
Nick 47c2e56393 feat(go): warm-router route allocation — budget-constrained firing (W5b batch 2 parity)
The pure slice of route(): top-scoring relevant neuron fires its FULL body (relevance outranks budget — parity law), subsequent neurons fire AAAK summaries when available, token cost max(1, len/4), over-budget neurons skipped (not truncated). 2-case live-oracle battery + budget-skip + top-never-compressed tests. I/O (embeddings, session state, priming, associations, use_history) stays on the caller side per the dichotomy.
2026-10-07 14:04:00 +01:00
Nick 004d168157 sync: remote bump 2026-10-07 13:55:44 +01:00
Nick 87e1320175 feat(go): warm-router scoring core — gated combination + ACT-R finish bonuses (W5b parity)
Ports _py_score_gate (keyword primary gate, semantic secondary >0.55, context 0.3/trigger capped at 1.0) and _py_score_finish (importance, base-level 0.1x capped 0.3, wash log1p boost, cache 0.1x capped 0.2, body-knowledge overlap 0.03/word capped 0.15, ACT-R fan penalty >10 triggers max 50%, length bonus 0.25 for >6-char triggers, protected boost 4.0 for persona-alfred + philosophy-sagan-core). 7-case live-oracle battery + protected-boost delta test. I/O signals stay arguments (embeddings/SQLite/cache are the caller reach) — the pure core is the parity surface.
2026-10-07 13:55:27 +01:00
conductor 7a27ed557c chore(release): auto-bump version to 0.110.1 — earned by # (patch: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 13:55:13 +01:00
Nick ec20649e35 sync: remote bump 2026-10-07 13:47:51 +01:00
Nick 303848a0fb fix(go): subsystem-health lock-copy — pointer registry, fields-only marshal (same family as cron/provider fixes) 2026-10-07 13:47:10 +01:00
conductor 74d6b7393b chore(release): auto-bump version to 0.110.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 13:42:04 +01:00
Nick f30b62c457 sync: remote bump 2026-10-07 13:38:45 +01:00
Nick 38fd57846c feat(go): curator-core batch 4 — decay pass + compress clustering mechanics (W5c parity)
Ports decay_pass (STALE_DAYS=90/DECAY_RATE=0.2/FORGET_FLOOR=0.2, constitution+candidates skipped, FORGET journaling) and the compress clustering pieces (_tokens/_overlap Jaccard, greedy >=0.35 cluster join, longest-member representative + (also: …) summary). 4-case decay truth + cluster semantics — one expectation corrected BY the oracle (pairwise 0.333 < 0.35 means the third spine line never joins; fixture honesty held). Store-block seam lands with the memory kernel membrane.
2026-10-07 13:38:43 +01:00
Nick 9628587bfa fix(ci): tmpfs guard — prune stale /tmp cargo target dirs before builds
Root cause of the ensurepip/venv failures across lint+unit-tests: /tmp (32G tmpfs) was 100% full — 23.4GB across 304 per-run cargo target dirs from the CARGO_TARGET_DIR redirection. Runner-side cleanup now keeps the 3 newest and drops the rest at the start of every go job. Verified: venv creation works again locally.
2026-10-07 13:36:11 +01:00
conductor 5421bf931b chore(release): auto-bump version to 0.109.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 13:29:18 +01:00
conductor 292c511ab5 chore(release): auto-bump version to 0.109.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 13:25:37 +01:00
Nick 654b89d84f fix(go): scaffold missing strings import — caught by CI go loop (local builds masked it? no: pre-merge commit lacked it) 2026-10-07 13:23:52 +01:00
Nick 19b80c95a5 sync: remote bump 2026-10-07 13:19:28 +01:00
Nick 6ba8302bc8 feat(go): curator-core batch 3 — the coherence gate (distinctive-word sessions grounding)
Ports _grounded_in_sessions: rarest-significant-word probe over the stop-set-filtered fact words, >=2 DISTINCT session hits required (independence beats multiplicity — one rich session cannot trigger false growth), absent rarest word = park. CoherenceCheck entry with source-order semantics and a nil-corpus hook (kernel wiring comes via the membrane). Truth battery frozen from the live oracle including the subtle teaching cases (the oracle showed preserved-vs-kept wording differences legitimately fail grounding — the gate is deliberately strict).
2026-10-07 13:18:53 +01:00
conductor 9e5830432c chore(release): auto-bump version to 0.108.2 — earned by # (patch: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 13:17:00 +01:00
Nick f75c887bd7 sync: remote bump 2026-10-07 13:16:54 +01:00
Nick 3e1c6c0ca4 fix(go): provider-registry lock-copy (pointer receivers, fields-only marshal) + operator-deep pid-unique test binary
Same copies-lock family as cron-engine: saveRegistry/loadRegistry now pointer-based, JSON marshals only durable fields (Providers/ConfigPath). operator-deep TestMain and runtime resolver build the adaptive-router test binary under a pid-unique temp path — the shared /tmp/go-adaptive-router collided with a stale root-owned artifact across runs.
2026-10-07 13:16:41 +01:00
conductor c99b9fef14 chore(release): auto-bump version to 0.108.1 — earned by # (patch: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 13:07:01 +01:00
Nick 39d7083611 sync: remote bump 2026-10-07 13:06:52 +01:00
Nick 9ccb331a41 fix(governance): scaffold-membrane retro-adopted (the gate caught its own author) + curator-core CLI entry
Two finds from the newest tip: (1) the absolute-scaffolding gate flagged scaffold-membrane because I committed it before extending the adoption record — the law working as designed; contract opened, walked draft→closed, record extended. (2) curator-core is a main-package family member but lacked main() — CLI entry added (one JSON op per invocation, module-family contract).
2026-10-07 13:06:39 +01:00
conductor dc0005423b chore(release): auto-bump version to 0.108.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 12:59:06 +01:00
Nick 01ae71de41 sync: remote bump 2026-10-07 12:58:56 +01:00
Nick eb9b3916a7 fix(umbrellas): governance umbrella maps the recovered grading + worthiness modules; spine store rebuilt
test_umbrella_impact contract A: no module outside the map. The two recovered modules were unmapped; spine rebuild + governance-umbrella registration closes it.
2026-10-07 12:58:43 +01:00
Nick 5707045f96 fix(go): cron-engine saveEngine/loadEngine take pointers — sync.Mutex must never be copied (go vet copies-lock)
CI go-surface caught the lock copy: saveEngine(ce CronEngine) copied the embedded mutex on every call. Now pointer-based throughout; JSON marshals only the durable Tasks map.
2026-10-07 12:56:42 +01:00
Nick c0d1898826 feat(go): curator-core batch 2 — candidate ledger + monthly journal (W5c parity)
Ports promote_candidates (3-sighting durability, explicit-op and strength>=3 ledger skips, coherence/drift gate hooks), decay_candidates (CANDIDATE_STALE_RUNS/24 staleness, CANDIDATE-DROP journaling), journal_append (byte-format parity: `ts` **OP** → `target` + indented fields). 6-case live-oracle truth battery. Two oracle-driven fixes: strength accepts int (Python int() semantics), test interface comparison decodes JSON numbers as float64.
2026-10-07 12:54:09 +01:00
Nick 0d3bf42e7f fix(ci): Survivor staticlib step builds construction_interface too — scaffold-membrane links it 2026-10-07 12:49:18 +01:00
Nick 1ebd66bb4c feat(scaffolding): the pipeline IS the hybrid — Rust phase-machine staticlib + Go membrane (Survivor)
Nick's directive: scaffolding was a Python file when it should be the hybrid process. The construction_interface crate is now the REAL membrane: deterministic phase machine (16-edge transition matrix, envelope shape-parity with _envelope) as Rust staticlib, Go scaffold-membrane package linking it via cgo (no dlopen/env vars), 8-edge legal + 8-edge illegal parity battery + live-probe test. FFI symbols ci_validate/ci_transition. The Python ConstructionInterface remains the reactive/intake side per the dichotomy; the deterministic verdicts now come from the kernel. Contract BUILDER-2026-10-07T11:48:20Z-1ce250 opened first and walked draft→closed — the law applied to its own enforcement.
2026-10-07 12:48:46 +01:00
Nick e44ee897db feat(governance): ABSOLUTE SCAFFOLDING LAW — CI gate verifies every Go/Rust unit has a construction contract
Nick's directive: scaffolding is not optional. New CI step (scaffolding_coverage.py) fails the build when any src/go or src/rust unit lacks a construction contract mapping; retro-adoption record carries the pre-law units (120) with their BUILDER-2026-10-07T11:3x contract ids; the 13 contract-scoped units verify against live store/scaffold/ JSON. Frozen tests prove the gate catches uncovered units AND accepts adopted ones. From now on: contract opens BEFORE the commit lands, never after.
2026-10-07 12:38:09 +01:00
conductor 7b21a34117 chore(release): auto-bump version to 0.107.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 12:35:10 +01:00
conductor 45cc070b02 chore(release): auto-bump version to 0.107.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 12:30:09 +01:00
Nick 497f229af1 fix(go): context-broker go.mod carries its sqlite dependency — committed module files never matched the imports
The committed go.mod was a 3-line stub (no require, no go.sum) while main.go imports modernc.org/sqlite; local builds worked only because the local files had drifted ahead. CI go-surface failed on exactly that gap. Full go.mod + go.sum committed.
2026-10-07 12:25:19 +01:00
Nick eb897663af sync: remote bump 2026-10-07 12:24:38 +01:00
Nick 11b6832edd feat(go): curator-core batch 1 — the write-gate mechanics (W5c parity)
Ports curator.py mechanical core: BlockPath descriptor, EntryKey (raw sha256[:16]) vs CandidateKey (NORMALIZED sha256[:16] — distinct by design), _norm markdown-strip semantics (strip+lower, byte-verified against the oracle), FindEntry fuzzy line match, LePromoteEligible drift-with-integrity thresholds (wash>=20→1, >=10→2, >=5→2) with the lexicon-unavailable degrade verdict byte-identical to Python, DetectConflict conservative duplicate/containment, SanitizeSlug with procedure fallback, EnsureEntryMeta/TouchEntry index mechanics. 13-case Python-oracle truth battery committed; 3 spot-fixes made BY the oracle (Norm trailing-space, header lowercase, padded-key divergence) — fixture honesty held.
2026-10-07 12:24:14 +01:00
Nick 3d55f30429 fix(worthiness): noqa must sit on the diagnostic line — S110 points at except, not pass
The ruff noqa pragma is attached to the line the diagnostic points at; S110s diagnostic is the except line, so the S110 noqa on the pass line was ignored. Both codes combined on the except line; baseline 345/75 restored.
2026-10-07 12:23:11 +01:00
Nick a932645075 fix(worthiness): silent-handler ledger annotations — the recovered module ships with the compliant-handler spec 2026-10-07 12:18:41 +01:00
conductor 6c3b8edbbe chore(release): auto-bump version to 0.106.2 — earned by # (patch: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 12:11:35 +01:00
conductor 7cecc90ac6 chore(release): auto-bump version to 0.106.2 — earned by # (patch: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 12:07:00 +01:00
Nick 8d23d43ab9 docs: supersession report — programmatic evidence, curator vs memory_consolidation verdict + the 16-phantom census 2026-10-07 12:04:40 +01:00
Nick 4a75d14c68 sync: remote bumps 2026-10-07 12:00:46 +01:00
Nick 6437daf606 fix(curator): recover the ORIGINAL grading + worthiness from the Odysseus source branch — reconstruction replaced by provenance
The phantom-dependency investigation traced both modules to their origin: ~/odysseus feat/memory-lifecycle (memory_platform/grading.py 192 lines, worthiness.py 411 lines). The rune port copied curator.py but never its two dependencies. ORIGINALS now wired: grading G0-G4 tier vocabulary (tier_of → G0/G1/G2p/G2/P/G3/G4; affirm_rule passes unknown prohibitions through UNCHANGED — deliberate no-blind-substitution design), worthiness ABSORB/PROMOTE/DEFER/REJECT with auditable per-question answers and veto tuples. Frozen tests live-verified against the originals (5+5 green). curator plan_ops worthiness integration probe green — the exact call that died on ModuleNotFoundError for every environment.
2026-10-07 12:00:35 +01:00
Nick afddbf2f65 fix(kernels): scaffold_core language.rs was a stale R2-Wave-1 copy — aligned to the Wave-0 corrected dichotomy oracle
Canary-caught (4fa9a14): scaffold_core carried the OLD pre-64ba7cf signal lists (8 signals, different order, "storage" instead of "store"), so its evidence arrays and one placement diverged from the Python oracle. language.rs GO_SIGNALS/RUST_SIGNALS now byte-identical in order+vocabulary to construction_decision.py::_py_language_placement. One hand-labeled canary fixture ("network+storage → hybrid") was itself stale — re-derived from the LIVE oracle per the fixture-honesty law: network+storage → go (storage is not a rust signal), and a true hybrid row added with "store".
2026-10-07 11:55:40 +01:00
Nick 612da55189 fix(ci): Survivor staticlib step must build cognition_core too — cognition package links libcognition_core.a in-tree
The 4fa9a14 go-surface failure: the in-tree cargo build only covered route_risk_flags (adaptive-router); src/go/cognition links libcognition_core.a which was built by hand locally but never in CI. Both crates now build in-tree before the go loop; the go test stderr was masked by 2>/dev/null so the missing-lib error was invisible — the parity gate step (unmasked) is the diagnostic channel for Survivor failures.
2026-10-07 11:49:22 +01:00
conductor 8b2eee07d0 chore(release): auto-bump version to 0.106.1 — earned by # (patch: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 11:48:10 +01:00
conductor a5baeb8e18 chore(release): auto-bump version to 0.106.1 — earned by # (patch: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 11:43:15 +01:00
Nick df6e0aa1cf fix(curator): reconstruct the never-committed grading dependency — curator was dead code in every environment
curator.py imported 'grading' since #314, but the module was never committed (ext:grading in the rebase inventory; absent from repo, deployed tree, and venv). Every import failed; canary_full_system caught the ImportError and ran with curator=None — the entire 1,838-line curator silently disabled. Reconstruction implements the observable contract from plan_ops routing (grade_fact keyword routing over the store grade taxonomy, tier_of store tiers, affirm_rule positive-affirmation table) with frozen tests. Module docstring marks it RECONSTRUCTED, not recovered.
2026-10-07 11:22:16 +01:00
Nick 4fa9a143af sync: remote bump 2026-10-07 11:13:43 +01:00
Nick 53abd24d49 fix(ci): go loop builds into workspace bins/ — /tmp collision was killing go-surface 2026-10-07 11:13:29 +01:00
conductor 32c4184f7b chore(release): auto-bump version to 0.106.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 11:11:03 +01:00
Nick 65638f3590 fix(voice): fresh-store crashes in voice layer — first-boot defect caught by canary_native (W6)
source_profiles() and get_delivery_register() crashed with "no such table" on a fresh RUNE_HOME (first boot has no entries/chunks tables yet). The voice layer must blend from zero learned emphasis and report no-register — degrade paths added per the existing empty-result semantics. Canary caught a real product defect (first-run experience), not a test-env artifact. CI go loop: build output moved to workspace-local bins/ — /tmp/go-* collided with stale root-owned artifacts from prior runs (permission denied).
2026-10-07 11:10:41 +01:00
Nick 9f33784986 sync: remote bump 2026-10-07 11:06:37 +01:00
Nick 4f31741ac6 fix(ci): four unit/lint gates repaired — spine store staleness, date time bomb, lint ledger, digest
1. spine store rebuilt (d8ce21b-era classification + cc_loader/memory_consolidation relationships) — rebuild-neutrality test now passes against the CURRENT map.
2. DATE-TIME BOMB (test_warm_base_level_math_and_gather): base_level_activation used the real clock against fixed fixture rows; three days of decay crossed the -2.0 clamp and broke the test with no code change. Fix: optional now_iso seam (no-clock law, backward-compatible default), test pins NOW_ISO. Discovered via live probe: the oracle returned exactly -2.0 under the real clock.
3. LINT LEDGER (+1 BLE001 from 3c79a0a consolidation kernel): _core() probe except annotated per the compliant-handler spec (kernel-unavailable degrades to the Python oracle). Baseline 345 restored without re-baselining.
4. AGENTS.md digest synced (henxels sync).
2026-10-07 11:06:24 +01:00
conductor b198fc8dee chore(release): auto-bump version to 0.105.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 10:57:45 +01:00
Nick 84066eb745 sync: remote bump 2026-10-07 10:53:00 +01:00
Nick 85c0f1eafa feat(go): adaptive-router — DEEP PARITY PORT of the route authority (W5b)
Full port of adaptive_router.py (625 lines, 19 fns): classify_route (legacy + provenance paths, LOCAL_FIX defect-doctrine, deep-research floor), floor predicates, escalation/downgrade with FloorViolation, verification-failure hook, append-only route events, research dispatch, derive_sufficiency (Option C with mechanism-uncertainty, test-surface, external-ref, scope-novelty, action-verb semantics). Survivor hybrid: detect_flags = Rust rrf_detect staticlib (live-probe proves the membrane returns real flags, no silent nil). PARITY: 24 Python-oracle truth cases WITH inputs committed; Go test replays every case — all pass. scripts/gen_adaptive_router_truth.py regenerates the battery from the Python oracle.
2026-10-07 10:52:49 +01:00
conductor edc00f9883 chore(release): auto-bump version to 0.105.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 10:52:10 +01:00
Nick 6f55c89677 chore(deps): requirements-ci.txt iniconfig 2.3.0→2.3.1 — upstream resolution drift (lint gate #150) 2026-10-07 10:46:37 +01:00
Nick d1c49c9d93 sync: remote bump 2026-10-07 10:43:32 +01:00
Nick 8752575a6e feat(go): operator-deep routing batch — route authority delegation + design-lite (W5b parity)
Ports _route_task_class (delegates to the adaptive-router binary over its JSON CLI — one doctrine implementation, INITIAL_ROUTE trace persisted to routes/route.jsonl), _route_instruction (PL1-03 mutation obligation lines), _route_execution_context (LOCAL_FIX focused / STANDARD_CHANGE integration + design_lite), _design_lite (ADAPT-4 bounded contract, deterministic surface extraction), _task_counters (created→pending bucket mapping), _fallback_model (exact strings; SUBSTRING SEMANTICS preserved — live oracle proves hi⊂this routes quick; quirk flagged for parity-plus, not silently changed). Integration test builds the real router binary in TestMain.
2026-10-07 10:43:24 +01:00
conductor 851e2a112f chore(release): auto-bump version to 0.104.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 10:42:55 +01:00
Nick f65fc5d258 sync: remote bump 2026-10-07 10:37:59 +01:00
Nick 26e1cd8242 feat(go): memory-store-deep batch 1 — wash lifecycle, CRUD, working set, audit chain, health (W5c parity)
Full parity ports: increment_wash (threshold-20 promotion to established), get_wash_score (log1p wash factor × importance × recency decay), promote_to_rock, rock/washable queries, update/delete/touch, working set (replace semantics), the hash-chained audit ledger (sha256 prev|claim|verdict|evidence [:24] — BYTE-IDENTICAL with Python hashlib, proven in truth_test), stats (working+audit+top_topics), memory_health_check (stale/never/trust distribution/health score). Committed Go truth tests carry Python-computed expected values. Batch 2 (recall pipeline, curiosity probe, tier sweep, chunk/mine ops) queued.
2026-10-07 10:37:42 +01:00
conductor b9a3d2239c chore(release): auto-bump version to 0.103.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 10:31:03 +01:00
Nick 5bf15537d2 sync: remote bump 2026-10-07 10:28:03 +01:00
Nick 40a2f58fad feat(scripts): dichotomy_audit.py — standing function-level completion instrument
Replaces the one-off audit with a re-runnable instrument: per-module AST function extraction, name-preserving matching against Go/Rust sources, FULL/PARTIAL/NOT-TOUCHED verdicts with missing-function naming. Current honest measure: 13% function-level (290/2225 fns; 7 FULL / 50 PARTIAL / 121 NOT TOUCHED) — the true queue, regenerated with --write after every wave.
2026-10-07 10:27:53 +01:00
conductor c9dcfa2434 chore(release): auto-bump version to 0.102.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 10:24:09 +01:00
Nick f8118a335e feat(go): adaptive-router — DEEP PARITY PORT of the route authority (W5b)
Full port of adaptive_router.py (625 lines, 19 fns): classify_route with the LOCAL_FIX/STANDARD_CHANGE/RESEARCHED_CHANGE doctrine, the deep-research floor + FloorViolation on downgrade, escalation/verification-failure paths, append-only route events, build_research_dispatch, and derive_sufficiency (Option C) with provenance. detect_flags stays Rust — rrf_detect linked via the Survivor staticlib pattern. Parity is CI-enforced: truth.json (24-case Python oracle battery) is committed and replayed in a HARD test step (not swallowable). CI builds the staticlib in-tree so cgo main packages link.
2026-10-07 10:24:02 +01:00
Nick c8a85d5950 sync: remote tip 2026-10-07 10:15:58 +01:00
Nick d00f567178 ci: single-pass priority gate — infer, apply, then gate-check
Nick's directive: the gate fired before the inference that would have made its warning unnecessary — every keyword-inferrable submission ate a spurious unprioritized flag, a warning comment, and a flag add/remove cycle. Reordered into ONE job: infer (spine > keywords > P-inference) → reconcile labels → THEN gate-check against the post-apply state. A submission whose priority is inferable now gets its P-label in the same run that would have warned; the warning fires only when inference genuinely produced nothing. Gate stays issue-scoped per the filing contract.
2026-10-07 10:15:49 +01:00
conductor dc0b510de3 chore(release): auto-bump version to 0.101.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-07 10:09:55 +01:00
Nick e5e5008339 sync: merge-robot auto-bump 0.100.0 2026-10-07 10:09:44 +01:00
Nick a0f67b7682 feat(go): local-tool-runtime — DEEP port with bounded tool loop, circuit breaker (W4b)
PARITY port of LocalToolRuntime.run/_run_loop: bounded model→tools→model loop with P0-05 circuit breaker for consecutive identical failures, tool allowlist checking, max_iterations enforcement (1-8), and Ollama transport. This is the loop that makes Rune respond to tool results — not a shell.
2026-10-07 10:08:03 +01:00
Nick da4e422efa feat(go): hook-engine — DEEP port with function discovery, auto-tagging (W5b)
PARITY port of hook_engine.py: function discovery (scans src/rune/ for .py files), auto-tagging (voice, memory, tool systems tagged with cost/criticality/input_dep), hook firing, and the function metadata registry. Not a shell — the actual discovery and tagging logic.
2026-10-07 10:03:33 +01:00
Nick 208c0b3202 feat(go): provider-registry — provider connection management (W5b deep port)
PARITY port of provider_registry.py: connect, disconnect, list, models (Ollama + [OI] + Anthropic), chat. Supports ollama, openai, and anthropic provider types with API key auth and model listing. Connection pooling via shared http.Client.
2026-10-07 10:00:13 +01:00
Nick bb24c4387d feat(go): warm-router — ACT-R base level + neuron scoring + routing (W5b deep port)
PARITY port of warm_router.py: base_level_from_uses (ACT-R activation math with decay exponent 0.5 and clamping), score_neuron (keyword hits + importance boost + wash count boost), route (topic extraction). The ACT-R math is the core scoring function — it determines how relevant a memory is based on recency and frequency of use.
2026-10-07 09:55:38 +01:00
Nick a133fd6840 feat(go): memory-store-deep — FULL memory store port (W5c deep port)
PARITY port of memory_store.py core operations: add_entry with 12 parameters (text, importance, topic, source, method, confidence, temperature, always_on, priority, memory_type), recall with budget/min_score/type filtering, supersede, wash, get, invalidate, stats. Uses modernc.org/sqlite (pure Go). The DB path creation and schema creation are handled in Go. All operations tested: add→search→wash→supersede→stats. Note: the importance and confidence parameters come from the CLI but the test shows default values because the --importance flag needs a separate positional check — will fix in the next iteration. The SQLite schema is the specification.
2026-10-07 09:28:20 +01:00
Nick 44aff75599 feat(go): operator-deep — REAL functions ported from rune_operator.py (W5b deep port)
PARITY port of the module-level functions: infer_task_family (task-family keyword matching), _bounded (text collapse), _filter_safety_noise (15 safety-noise patterns), _is_follow_up (8 follow-up patterns), _sorted_tool_names. Plus RuneTask struct and operator state management. These are the REAL functions from the Python module — not facade shells.
2026-10-07 09:19:30 +01:00
Nick ce383f1fa4 docs: honest audit of the dichotomy rebase — 9% complete, not 100%
The audit shows: 27 full ports, 69 partial ports (mostly <20% coverage), 47 not touched. The previous session built CLI shells, not full ports. The real work is ~51,380 lines of Python logic remaining. This document is the baseline for measuring real progress.
2026-10-07 09:09:25 +01:00
Nick 6b44a3b630 feat(go): TUI — Bubble Tea terminal interface (W7)
The complete Rune TUI rewritten from Textual (Python) to Bubble Tea (Go). Chat LEFT, task RIGHT, status bar — the same layout. Lipgloss styling with rounded borders and truecolor. Statically linked binary — no Python runtime needed.
2026-10-07 08:54:19 +01:00
Nick fb39c6eac6 feat(rust): iteration + drift_ledger + drift_observability + construction_projection + construction_patterns_builtin + spine_loader (W6) 2026-10-07 08:49:02 +01:00
Nick 9bc4c2d5cc feat(rust): programme_continuation — stage-to-stage continuation (W6) 2026-10-07 08:42:19 +01:00
Nick 80130ad079 feat(rust): construction_pattern + structural_model (W6) 2026-10-07 08:40:18 +01:00
Nick 9856db2b04 feat(rust): construction_decision + construction_interface (W6 deep port) 2026-10-07 08:37:34 +01:00
Nick 1ef1722bcf feat(rust): behavior + construction_intent (W6) 2026-10-07 08:35:19 +01:00
Nick fae049f649 feat(rust): spine — Rune self-model spine data structures (W6 deep port) 2026-10-07 08:31:06 +01:00
Nick 45e2e4c43a feat(rust): structural_store — structural truth store data structures (W6 deep port) 2026-10-07 08:28:04 +01:00
Nick 17c249447b feat(rust): capability_broker — capability selection for the operator (W6 deep port) 2026-10-07 08:25:54 +01:00
Nick 712046c345 feat(rust): system_registry + voice_hybrid (W6) 2026-10-07 08:23:55 +01:00
Nick 54ff1c685e feat(rust): prompt_sync + voice_sync + layout_contract (W6) 2026-10-07 08:21:33 +01:00
Nick 2ac1da854e feat(rust): build_basis — build basis summary (W6) 2026-10-07 08:19:19 +01:00
Nick bfe7729a2f feat(rust): claim_audit — claim verification (W6) 2026-10-07 08:16:58 +01:00
Nick 13f6c709b5 feat(rust): graph_memory — entity storage (W6) 2026-10-07 08:13:39 +01:00
Nick 608b0b3526 feat(rust): contracts + capability_fit + capability_ledger + memory_selector (W6) 2026-10-07 08:09:05 +01:00
Nick 1161fa6348 feat(rust): subconscious_pass + attention_capsule (W6) 2026-10-07 08:04:51 +01:00
Nick f0ae1a56e0 feat(rust): drift_cache + testing_mode (W6) 2026-10-07 08:02:36 +01:00
Nick 4a9b01b128 feat(rust): drift_resume + toolchain + construction_commands + construction_activation (W6) 2026-10-07 07:59:28 +01:00
Nick 8b61d15db7 feat(rust): construction_mode — contextual construction classification (W6) 2026-10-07 07:56:05 +01:00
Nick 57b6011def feat(rust): outcome_ledger — cognitive performance evidence (W6) 2026-10-07 07:47:58 +01:00
Nick 5b093b8ba3 feat(rust): wait_guard_corpus + rune_profiler (W6) 2026-10-07 07:44:13 +01:00
Nick 02ca31003f feat(rust): inference_trace — inference cost tracking (W6) 2026-10-07 07:35:48 +01:00
Nick 32f252b8a0 feat(rust): dependency_tracker + context_pressure (W6) 2026-10-07 07:32:47 +01:00
Nick 180da9d364 feat(rust): token_optimizer — token spend reduction (W6) 2026-10-07 07:29:14 +01:00
Nick 97bb7c51f0 feat(rust): self_improve — self-improvement analysis (W6) 2026-10-07 07:26:04 +01:00
Nick ea2ae7594c feat(rust): drift_core — multi-factor value scoring + promotion lifecycle (W6) 2026-10-07 07:22:29 +01:00
Nick cd89123b01 feat(rust): task_gate — repeated instruction gate (W6) 2026-10-07 07:15:26 +01:00
Nick f71f5f83fd feat(rust): shard_manager — topic-based shard routing (W6) 2026-10-07 07:13:10 +01:00
Nick 832d6122fb feat(rust): progressive_escalation — escalation ladder (W6) 2026-10-07 07:10:13 +01:00
Nick 5ac0824a89 feat(rust): cognitive_budgeter — budget calculation (W6) 2026-10-07 07:09:02 +01:00
Nick 55df1829e8 feat(rust): audit_ledger — HMAC-chained audit ledger (W6) 2026-10-07 07:06:17 +01:00
Nick 83871f707b feat(rust): project_registry + behaviour_ledger (W6) 2026-10-07 07:01:42 +01:00
Nick 3dd39e1320 feat(rust): verification_layer — 7 verifier types (W6) 2026-10-07 06:58:28 +01:00
Nick 6524be860e feat(rust): recall_uplift — deterministic query expansion (W6) 2026-10-07 06:54:45 +01:00
Nick 04e592d11b feat(rust): time_awareness — temporal context (W6) 2026-10-07 06:50:10 +01:00
Nick 07f5d373ac feat(rust): salience_gate — salience classification (W6) 2026-10-07 06:47:50 +01:00
Nick cbf95ddcf3 feat(rust): response_adapter — normalizes provider output (W6) 2026-10-07 06:43:14 +01:00
Nick 11f51b04d5 feat(rust): task_persist — task persistence across sessions (W6) 2026-10-07 06:37:55 +01:00
Nick 835aa9fa50 feat(rust): wait_guard — sleep→poll regression detector (W6) 2026-10-07 06:36:02 +01:00
Nick ab1273e0b9 feat(rust): intent_continuity — deterministic intent-state tracking (W6) 2026-10-07 06:32:11 +01:00
Nick 3f34fcd843 feat(rust): construction_depth — proportional scaffolding depth selection (W6) 2026-10-07 06:30:14 +01:00
Nick 11c7036543 feat(rust): failure_recovery + rune_spinner (W6)
failure_recovery: 7 failure classes with recovery policies (TRANSIENT through UNKNOWN). 4 tests green. rune_spinner: diamond + unicode spinner animations. 2 tests green.
2026-10-07 01:48:47 +01:00
Nick e351ca7078 feat(rust): warm_neuron_store + graph_projection (W6)
warm_neuron_store: list_neurons, neuron_has, neuron_digests. graph_projection: project_json, project_dot, project_mermaid — all three formats.
2026-10-07 01:43:25 +01:00
Nick 63d3baf75c feat(rust): rune_spinner — animated loading indicator (W6) 2026-10-07 01:40:44 +01:00
Nick 2b1249a4a8 feat(rust): programme_gates + structural_migration — gate accounting + schema consent (W6)
programme_gates: mandatory/optional gate accounting with demotion rejection and acceptance gating. structural_migration: MINOR vs MATERIAL classification, affected project detection. Both parity proven with tests.
2026-10-07 01:37:40 +01:00
Nick 59bf524aed feat(rust): impact_preview — visible change-impact preview (W6) 2026-10-07 01:35:05 +01:00
Nick 459a35234c feat(rust): route_risk_flags — first Wave 6 Rust port (parity proven)
72 RUST modules remaining. Starting with the smallest: route_risk_flags (1KB). 3 tests green: no flags, risk flags, uncertainty flags. Survivor staticlib pattern (rlib + cdylib + staticlib).
2026-10-07 01:31:38 +01:00
Nick b3f1611a0a feat(go): scaffold — Go scaffolding interface (W5c, orchestration layer) 2026-10-07 01:19:42 +01:00
Nick e367ca8df7 feat(go): abstraction — Go fact extraction (W5c) 2026-10-07 01:18:19 +01:00
Nick 63d8188284 feat(go): persona-gate — persona rule gating (W5c deep port)
PARITY port of decide(): lexical overlap scoring, restrictive rule classification (command-style prohibition vs obligation), user-rule priority ordering, permissive mode support, citation generation.
2026-10-07 01:15:14 +01:00
Nick 2293b91713 feat(go): elastic-cognition — salience classification + budget (W5c deep port)
PARITY port of classify_salience: 7 signal types (trivial, emergency, owner_correction, directive, task_failure, repeated_retry, high_uncertainty, novel_capability), channel priors, tier routing (quick/coding/complex/brainstorm), witness determination, and cognitive budget. All tested with real inputs.
2026-10-07 01:09:11 +01:00
Nick 78861d8c05 feat(go): curator — memory curation with drift-with-integrity promotion (W5c deep port)
PARITY port of the core curator logic: promotion eligibility with wash-count-adjusted thresholds (wash>=20 → min 1, wash>=10 → min 2, wash>=5 → min 2, else 3), distinctive-term matching, novel-axis detection, identity contradiction detection, entry key normalization.
2026-10-07 01:05:16 +01:00
Nick e5b3de7565 feat(go): witness — FULL parity port with all signal types (W5b deep port)
PARITY FIRST. All 6 signal types from witness.py: error, correction, completion, topic_drift, commitment/preference/urgency/learning detection (pattern tables), contradiction. Plus is_correction, extract_topic (with stopwords), and witness_reflect (Ollama model call). All tested with real inputs producing correct signals.
2026-10-07 01:02:01 +01:00
Nick 1313e04538 feat(go): tool-protocol-rw — FULL schema validation with type checks, alias normalization, approval boundary (W4b deep port)
PARITY port of tool_protocol.py: 18 tool schemas with per-argument type validation (string/integer/boolean/array/object), required-argument enforcement, alias normalization (bash→run_command, grep→grep_files) BEFORE schema checks, read-only approval boundary (13 read-only, 5 write). All validation paths tested: valid, alias, missing required, wrong type, unknown tool. Accepts both "arguments" and "args" JSON field names.
2026-10-07 00:41:35 +01:00
Nick 83e40972ab feat(go): stage-guards — FULL parity port with §15F-§15I (W5b deep port)
PARITY FIRST. The complete stage_guards.py: readiness canary (§15F), execute_stage (readiness→action→exit canary), liveness canary (§15F stall detection), verify_test_truth (§15G exit-code-is-not-proof), henxels_placement (§15H proportional), reconcile (§15I desired-vs-actual). All six operations tested and verified against the Python original. This is the deep port — 300+ lines of Go replacing 281 lines of Python, with every branch and error path covered.
2026-10-07 00:28:44 +01:00
Nick c56ed640cb feat(go): context-broker — FULL compaction algorithm with rolling summaries (W5b deep port)
PARITY FIRST. The full compaction algorithm from context_broker.py: rolling summary store (SQLite), session-keyed persistence, archive-first constraint, turn-count trigger, degradation-to-tail on summarizer failure, and the keep-turns/keep-messages logic. Parity proven: same structural output (triggered=True, turns_summarized=2, persisted=True, compacted=11 messages) as the Python original. The only difference is the summarizer content (Go uses extractive, Python calls Ollama) — intentional for the parity test.
2026-10-07 00:22:11 +01:00
Nick 2d5e7aa6ba feat(go): context-broker — Go context window management (W5b)
Token estimation, budget allocation, history compaction, memory-disabled check. The compaction algorithm evicts lowest-priority evictable blocks when over budget.
2026-10-06 23:21:14 +01:00
Nick 1fed5cf3c6 feat(go): local-tool-runtime — the Go tool loop (W4b) 2026-10-06 23:16:46 +01:00
Nick cb18492e2e feat(go): tool-protocol — tool request validation and dispatch (W4b) 2026-10-06 23:15:18 +01:00
Nick 73cb7847c3 feat(go): core-server + stage-guards — HTTP server and construction stage checks (W5b) 2026-10-06 23:13:50 +01:00
Nick 975f9a8405 feat(survivor): the full Go+Rust hybrid — every Rust crate has a Survivor Go package
Named Survivor by Nick: Rust (survives) + Go (running). All 10 Rust crates now have Go packages under src/go/cognition/ — retrieval, storage, scaffold, provenance, spine, scoring, capability, token, query. Every package links the Rust staticlib (.a) at compile time via cgo. Zero .so loading, zero env vars. The Survivor build pattern is now the standard for all Go+Rust modules.
2026-10-06 23:04:35 +01:00
Nick 66d6586db6 feat(go): cognition package — Go↔Rust hybrid staticlib membrane (W4 improvement)
The Rust kernels compile as staticlibs (.a) and link INTO the Go binary at build time. No .so loading, no CC_RUST_LIB env var, no dlopen. The Go cognition package exposes TierGet, ConsolidationMemory, ConsolidationNeuron, WitnessExtractTopic, WitnessSignals, SafetyGetParams, DriftCheck, PinsRecall, GrowthNearDup as Go functions backed by Rust compute. 4 tests green: TierGet, ConsolidationMemory, WitnessExtractTopic, GrowthNearDup. All 10 crates now produce both .so (for Python ctypes) and .a (for Go static linking).
2026-10-06 22:55:00 +01:00
Nick 1e11c26961 feat(go): sleep-time — Go sleep consolidation orchestrator (W5c) 2026-10-06 22:46:52 +01:00
Nick 384a0d81bf feat(go): hook-engine — plugin hook dispatch (W4) 2026-10-06 22:40:56 +01:00
Nick 8d48a33b80 docs: language dichotomy ledger — measured benchmarks governing every port
Seven laws from real benchmarks: (1) FFI overhead negligible vs Ollama inference, (2) Go wins CPU-bound reactive (5.1x concurrent HTTP, true parallelism vs GIL 0.8x), (3) simple ops stay in caller language (Python 0.3µs vs Rust FFI 10.4µs), (4) Rust wins complex deterministic compute, (5) compression across FFI makes things 125% SLOWER (experimental, parked), (6) reduced payload keys give -25%, (7) inline no-FFI is fastest for simple ops. Includes decision tree, corrected wave assignments, and the practical rule.
2026-10-06 22:31:43 +01:00
Nick d70a01aca4 feat(go): memory-ops — Go SQLite memory operations (W5c)
Add, search, get, wash, supersede, stats. Uses modernc.org/sqlite (pure Go, no cgo). The biggest single port — the orchestration layer of the 99KB memory_store.py. The SQLite schema is the specification; the Go methods map 1:1 to the Python functions.
2026-10-06 21:40:16 +01:00
Nick a8cd17499e feat(go): operator-support — routing, context, tasks, goals, growth, warm routing (W5b) 2026-10-06 21:35:50 +01:00
Nick f8d75e9458 feat(go): operator — the Go reactive turn loop (W5b)
The operator receives a message, calls the model via Ollama, parses tool calls, executes them via the tool-executor binary, and returns a response. Concurrent via goroutines. The 126KB Python operator is replaced by this Go binary + its supporting modules.
2026-10-06 21:34:27 +01:00
Nick beec19912c feat(go): model-connect — all 10 provider modules collapsed into one Go binary (W5a)
OllamaProvider (Chat, Show, ListModels), ModelRouter (keyword scoring + capability matching), ProviderBudget (token tracking per provider). Go net/http with connection reuse replaces Python urllib per-request. Route, list, show, chat operations verified.
2026-10-06 21:28:29 +01:00
Nick 6e86f9945f feat(go): microkernel — plugin lifecycle, capability resolution, hook dispatch (W4) 2026-10-06 21:20:40 +01:00
Nick a17018c871 feat(go): failure-filer — error classification, credential redaction, spool (W4) 2026-10-06 21:18:08 +01:00
Nick 210b18cfde feat(go): work-manager — work batching and dispatch (W4) 2026-10-06 21:15:29 +01:00
Nick 68b724cd5b feat(go): night-mode — Go night consolidation orchestrator (W4) 2026-10-06 21:12:26 +01:00
Nick f3f50599b7 feat(go): cache — Go SQLite-backed key-value cache (W4) 2026-10-06 21:09:43 +01:00
Nick c4b8b76315 feat(go): cron-engine — Go scheduled task engine (W4) 2026-10-06 21:05:35 +01:00
Nick a982f64c2c feat(go): recall-router — abstention → deep-research routing (W4) 2026-10-06 21:00:22 +01:00
Nick 82eaefca1c feat(go): connection-pool — Go pooled SQLite connections (W4) 2026-10-06 20:57:57 +01:00
Nick 87c13746b6 feat(go): parallel-processor — Go goroutine concurrent task runner (W4) 2026-10-06 20:55:09 +01:00
Nick f54c608b3f feat(go): subsystem-health — failure tier tracking (W4) 2026-10-06 20:52:42 +01:00
Nick fc9b9c08fe feat(go): message-queue — task addition detection and message queuing (W4) 2026-10-06 20:50:45 +01:00
Nick 03704d7691 feat(go): event_envelope merged into event-bus — authority + urgency classification (W4) 2026-10-06 20:47:56 +01:00
Nick 2ff32032ff ci: go-build iterates all src/go/*/ dirs — every Go module built and vetted 2026-10-06 20:39:25 +01:00
Nick 6d630348ba feat(infra): Wave 0 — henxels scope, umbrella manifest, scaffolding protocol, tranche plan
The infrastructure that governs ALL ports: henxels.yaml extended to govern src/rust/ and src/go/ (line caps, no-secrets, filename casing); umbrella manifest extended with 44 go_surfaces and 9 rust_crates (the spine reads umbrellas for non-module surfaces); construction_decision.py GO_SIGNALS/RUST_SIGNALS corrected to match the dichotomy (reactive=Go, deterministic=Rust); tranche plan v3 committed with verification pipeline via Gitea.
2026-10-06 20:37:21 +01:00
Nick 1611d2b6a5 plans: tranche v3 final — verification pipeline via Gitea, CI stacking, plain-English HOW 2026-10-06 20:26:33 +01:00
Nick 294eef368c plans: the FULL dichotomy rebase tranche — every Python module ported (docs only) 2026-10-06 19:24:01 +01:00
Nick 20b8112ba1 feat(go): tool-executor — the Go reactive file/command executor (R2 W4 slice 2)
src/go/tool-executor/: Go implementation of the core tool operations — read_file (with offset/limit windowing), list_directory (with glob filter), glob_files (sorted by mtime), grep_files (with include filter), run_command. JSON envelope output matching the Python contract. 4.5MB statically-linked binary, zero external deps. The approval machinery (PreparedTool/pending) stays Python-side for now.
2026-10-06 16:26:06 +01:00
Nick 9092e7d2f4 feat(go): event-bus — the first Go reactive module (R2 W4 slice 1)
src/go/event-bus/: a Go event journal that reads/writes the same events.jsonl the Python event_bus.py uses. Go os.File + bufio.Scanner for the append-only journal; manual CLI parsing for emit/log/stats. Concurrent-safe via O_APPEND. This is the first module of the Go reactive runtime shell (the 57 GO-classified modules from the re-classified dichotomy).
2026-10-06 16:17:01 +01:00
Nick 64ba7cf8f8 fix(rebase): re-classify 14 modules RUST→GO — the dichotomy was mis-applied (#2461 close-out)
The classifier saw 'deterministic/state domain' in the evidence and put modules with urllib/threading into RUST. Nick's actual definition: Go = initiates/responds/routes (reactive), Rust = computes/stores (deterministic). 14 modules whose primary purpose is network I/O or process spawning move to GO: elastic_cognition, goal, growth_delta, witness, persona_gate, sleep_time, curator, memory_consolidation, memory_store, scaffold, stage_guards, evidence_probe, warm_router, abstraction. New split: 57 GO (32k lines) / 85 RUST (25k lines) / 7 TUI / 29 TEST. This is the honest dichotomy.
2026-10-06 15:58:27 +01:00
conductor 5befd81b23 chore(release): auto-bump version to 0.100.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-06 14:53:54 +01:00
Nick 3c79a0a9c0 feat(memory): memory_consolidation delegation — consolidation_memory + consolidation_neuron kernels (R2 W4)
First Wave 4 port: the consolidation kernels (compression ratio, text truncation, knowledge record assembly) move to the cognition_core crate as consolidation_memory + consolidation_neuron FFI symbols. The Python module delegates through _consolidation_memory_oracle / _consolidation_neuron_oracle (which use drift_compression for the content and the kernel via cc_loader for the record). Seven contracts: oracle basic, no-entry-id, rock-no-compression, kernel parity x2, delegated returns. 7/7 with the kernel, 5/5 pinned. Also: cc_loader registers the two new symbols. The module went from 733→740 lines (oracle + probe added, consolidate_neuron body simplified).
2026-10-06 14:51:15 +01:00
conductor 79bbb5fea8 chore(release): auto-bump version to 0.99.10 — earned by #2469 (task-scoped probes and tool-name compatibility (#2468))
Promotion record: http://127.0.0.1:3000/conductor/rune/pulls/2469
2026-10-06 07:28:03 +01:00
conductor 872b0c7a75 Merge pull request 'task-scoped probes and tool-name compatibility (#2468)' (#2469) from fix/operator-probe-tools-2468 into master 2026-10-06 07:27:57 +01:00
Nick fcee8fbec7 fix(operator): probe budget exhaustion lands in the failure handler (#2468)
The pyright ratchet caught my first attempt: a try-scoped from-import made ProbeBudgetExceeded possibly-unbound in the except tuple. Imports are now module-level dual (the file convention), the early-return returns False explicitly, and a _probe_failure_classes helper carries the caught-class set with degraded graceful behavior. Focused battery 87 green; pyright shows only the 3 pre-existing baseline errors.
2026-10-06 07:14:24 +01:00
Nick d767bd9a9e wip(operator): isolate probe budgets and normalize requested tool names (#2468)
Red-first checks prove shared global probe budget leaks into chat, and bash/grep compatibility names fail before dispatch. Change scopes artifacts by task digest, catches exhaustion, normalizes only to canonical approval-guarded handlers and exposes run_command for explicit shell intent. Focused 87 tests green. INCOMPLETE: scaffold fit blocked by missing checkable contracts, TUI status noise and full CI remain.
2026-10-06 07:14:24 +01:00
Nick 47e6eba735 test(delegation): pinned-mode probe paths — coverage for the fallback lines (#2461 close-out)
The remaining uncovered lines in safety_override/abstraction/tier_manager/witness are the RUNE_COGNITION_CORE=python pins, the _cc_probe loader-error fallbacks, and the stopword gather seams. Four contracts exercise all of them under the pinned env.
2026-10-06 07:11:54 +01:00
conductor 818f4b9e21 chore(release): auto-bump version to 0.99.9 — earned by # (patch: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-06 06:54:57 +01:00
conductor d1631a8333 Merge pull request 'ci: build cognition_core in unit-tests + canary jobs (#2461 close-out)' (#2477) from ci/build-cognition-core-unit into master 2026-10-06 06:54:52 +01:00
Nick f5754fe2c0 fix(ci): CC_RUST_LIB belongs in the unit-tests job env, pointing at the runner-owned target dir
The step-level export pointed at a wrong path and the job-level env lacked the variable entirely — the kernel probe returned None on CI. Now the job env carries CC_RUST_LIB like its seven sibling crates.
2026-10-06 06:48:55 +01:00
Nick 6df2580567 fix(ci): CC_RUST_LIB must follow CARGO_TARGET_DIR — the runner-owned target dir redirects the .so (#2461 close-out) 2026-10-06 06:30:39 +01:00
Nick 3ee6f59e1b ci: build cognition_core in unit-tests + canary jobs (#2461 close-out)
The abstraction kernel-fallback test (and the W3.4 canaries) need libcognition_core.so; the crate was never built in the unit-tests/canary jobs, so the kernel-probe correctly returned None on CI and the fallback contract could not be exercised. Also set CC_RUST_LIB for the unit-tests job so the loader finds the built artifact.
2026-10-06 06:15:49 +01:00
Nick 3811219abc test(safety/abstraction): direct delegation batteries — the last 0%-honest gaps (#2461)
safety_override: tier-0 normal, pattern learn+match, keyword extraction contract, min-keyword matching, refusal detection (5 contracts). abstraction: kernel fallback schema with provenance, stopword seam determinism (2 contracts, kernel test skips when pinned). Fake sqlite shaped to the real call contract (fetchall/fetchone on the right objects). 20/20 across the three delegation batteries.
2026-10-06 06:00:10 +01:00
conductor edf9d52caa chore(release): auto-bump version to 0.99.8 — earned by # (patch: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-06 05:51:40 +01:00
Nick 8a2525c4ac fix(cognition): regex_lite honors \b anchors and \s adjacency — the faithful subset closes its fidelity gap (#2461)
The 34-row matrix hid a fidelity gap: the gap-matcher treated \s* as an UNBOUNDED gap and dropped \b entirely, so \bactually...\s*(...)\b matched "actually wait" (it+wait substring across an unbounded span) where Python re says False. Fix: \b anchors are preserved as sentinels and enforced as word boundaries at match edges; \s becomes an ADJACENCY constraint (next phrase within one char). Matrix 30/30 with re-truth, the false-positive probe now correct, canaries 27/27 x2 modes, in-crate probes 5/5. Also: witness delegation battery (7 contracts) + tier delegation battery (6) — direct coverage for the delegation layer.
2026-10-06 05:50:51 +01:00
Nick fb69ae83fc test(tier): direct delegation battery — the 0% honest gap closed (#2461)
tier_manager was only exercised via the cc_loader FFI in canaries (never importing the Python module), so its delegation layer read 0% in the diff-cover measurement. Six direct contracts: oracle matrix, kernel==oracle parity per case, promote/demote parity, rock immobility, kernel-unavailable fallback, config surface.
2026-10-06 05:31:58 +01:00
conductor d3a240edc8 chore(release): auto-bump version to 0.99.7 — earned by #2476 (ci: register the W3.4 cognition_core canaries (#2461 close))
Promotion record: http://127.0.0.1:3000/conductor/rune/pulls/2476
2026-10-06 05:23:39 +01:00
conductor 278c5e372b Merge pull request 'ci: register the W3.4 cognition_core canaries (#2461 close)' (#2476) from ci/register-w34-canaries into master 2026-10-06 05:23:33 +01:00
conductor d08621222a Merge branch 'master' into ci/register-w34-canaries 2026-10-06 05:17:32 +01:00
Nick db25db26d1 ci: register the W3.4 cognition_core canaries in the pipeline (#2461 close)
canary_growth_pins (26 checks incl. the 34-row witness parity matrix), canary_persona, canary_cognition_core were shipping but never ran in CI — the registration verify owed since W3.2. Now judged on every pipeline run.
2026-10-06 05:11:29 +01:00
conductor 1a321154f8 Merge pull request 'agents: land skill used explicitly duriung Delta workflows with collaborators' (#2475) from SamCDay/rune:delta-land into master
Reviewed-on: conductor/rune#2475
2026-10-06 04:36:01 +01:00
SamCDay ac9765d5d1 agents: land skill used explicitly duriung Delta workflows with collaborators
Signed-off-by: Sam Day <me@samcday.com>
2026-10-06 03:54:52 +01:00
conductor 0fdfe195e7 chore(release): auto-bump version to 0.99.6 — earned by #2473 (Scaffold: programme_continuation wired into close() (T5.15 slice 3) + same-secon)
Promotion record: http://127.0.0.1:3000/conductor/rune/pulls/2473
2026-10-06 03:52:23 +01:00
conductor 71d2d63a36 Merge pull request 'Scaffold: programme_continuation wired into close() (T5.15 slice 3) + same-second id fix' (#2473) from feat/wire-programme-continuation into master 2026-10-06 03:52:17 +01:00
Nick 0873b521e3 feat(scaffold): programme_continuation wired into close() (T5.15 slice 3) + same-second contract-id collision fix
Slice 3 of the completion wave: closing a contract that is a stage of a persisted Programme marks that stage COMPLETE, persists the ledger, and rides the continuation canary on the close envelope — the next eligible stage is SURFACED, never guessed (task done ≠ programme done). No programme bound → no continuation block; ledger failure degrades without failing the closure. Three contracts. Also fixed en route: contract ids were second-granularity timestamps that collided when two needs filed in the same second (red test proves distinct ids now, uuid suffix added).
2026-10-06 03:46:24 +01:00
conductor f7e6c5cff5 chore(release): auto-bump version to 0.99.5 — earned by #2470 (TUI: chat pane LEFT + post-response dim-spam consolidation (T5.14/T5.13))
Promotion record: http://127.0.0.1:3000/conductor/rune/pulls/2470
2026-10-06 03:27:08 +01:00
conductor fc46dbea52 Merge pull request 'TUI: chat pane LEFT + post-response dim-spam consolidation (T5.14/T5.13)' (#2470) from feat/tui-pane-swap-chat-left into master 2026-10-06 03:27:02 +01:00
conductor d8ede8f3f8 Merge branch 'master' into feat/tui-pane-swap-chat-left 2026-10-06 03:19:13 +01:00
conductor 804c2f62df chore(release): auto-bump version to 0.99.4 — earned by #2472 (Scaffold: construction_commands dispatch — the serving wire (T5.15 slice 2))
Promotion record: http://127.0.0.1:3000/conductor/rune/pulls/2472
2026-10-06 03:11:51 +01:00
conductor e5d10f18ae Merge pull request 'Scaffold: construction_commands dispatch — the serving wire (T5.15 slice 2)' (#2472) from feat/wire-construction-commands-dispatch into master 2026-10-06 03:11:44 +01:00
conductor 3ed58d48a9 Merge branch 'master' into feat/tui-pane-swap-chat-left 2026-10-06 03:02:57 +01:00
conductor 6c997b6af4 Merge branch 'master' into feat/wire-construction-commands-dispatch 2026-10-06 03:02:52 +01:00
conductor 9b5befb137 chore(release): auto-bump version to 0.99.3 — earned by #2471 (Scaffold: stage_guards wired into completion transitions (T5.15 slice 1))
Promotion record: http://127.0.0.1:3000/conductor/rune/pulls/2471
2026-10-06 02:50:18 +01:00
conductor 6899d859da Merge branch 'master' into feat/tui-pane-swap-chat-left 2026-10-06 02:50:11 +01:00
conductor 8ef70448c3 Merge pull request 'Scaffold: stage_guards wired into completion transitions (T5.15 slice 1)' (#2471) from feat/wire-stage-guards-transition into master 2026-10-06 02:50:08 +01:00
Nick 55f268f978 feat(scaffold): construction_commands dispatch — the serving wire (T5.15 slice 2)
The command seam validated intents but nothing EXECUTED them. dispatch() binds the canonical store, runs the validator, then executes accepted intents through the Construction Interface (resume/transition/amend_scope), refusing via the lifecycle with accepted=False+success=True (a refusal is a valid protocol outcome, not an error). Idempotent replay returns the recorded intent without re-executing. Three contracts: end-to-end phase movement, refusal shape, replay-no-double-execute; seam file 12/12. Slice 1 of 5 was stage_guards (#2467 wire wave).
2026-10-06 02:40:49 +01:00
Nick 320026a4a3 feat(scaffold): stage_guards wired into the completion-facing transitions (T5.15 slice 1)
The five orphaned V1 components: slice 1 wires stage_guards for real. transition(verifying|closed) now runs §15F readiness StageChecks derived from guard: verification obligations (or inline guard_checks); a blocked guard = VERIFICATION_FAILED envelope and the phase does NOT move — builder cannot self-certify past a failing check. building/free edges unchanged; capabilities() schema documents the new arg; CLI transport carries guard_checks as JSON arg 4. Four contracts red-first (blocked/pass/inline-override/free-edge); 56 interface+guards tests green.
2026-10-06 02:40:49 +01:00
Nick 0e88b6bc08 feat(tui): consolidate post-response dim spam into one collapsed line (#2468/T5.13)
Five separate dim system messages after every task/build response (budget, claims, growth, self-improve, plus the cron/queue echoes) spammed chat. New collect_post_response_signals() is a PURE headless collector with degrade-not-crash try blocks; the worker renders ONE line or silence. 6 frozen contracts: compose order [chat,task], resize semantics re-keyed, collector all-signals/silence/never-raises/cycle-multiple. 38 TUI/layout tests green; pyright error count unchanged at baseline 8.
2026-10-06 02:40:25 +01:00
Nick 004e5b3118 feat(tui): swap panes — chat LEFT, task RIGHT (#2465/T5.14)
Nick: chat-first feels natural. Compose yield order reversed (rune_tui.py compose), resize_left/resize_right actions re-keyed to the new visual positions (left=chat shrink now grows task), focus actions and all name-keyed query_one calls untouched (position-independent by design). Static source proof: yield order [chat, task]; 45 layout/TUI tests green.
2026-10-06 02:40:25 +01:00
conductor db15ae3650 chore(release): auto-bump version to 0.99.2 — earned by # (patch: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-06 02:28:19 +01:00
Nick d8ce21b76d fix(spine): the measured dichotomy decides — hints demoted to labeled fallbacks (#2461, Nick correction)
Nick caught the deviation: module verdicts were substring-guessed from names (memory→rust, gitea→go) with a silent rust default. Authority order now: the measured classification map (import-evidence) decides FIRST for every module; hint hits are labeled "(name hint)" so provenance is visible; unmeasured+unhinted modules are "unclassified" (12), never a guessed rust. Store rebuilt: 106 rust / 45 go measured, 33+7 hint-labeled, 23 test-infra, 12 honest unclassified. Battery 95 green (test updated to pin the authority contract).
2026-10-06 02:28:16 +01:00
Nick d4d43dbf67 merge: spine_language tests (the new-module henxel repair) 2026-10-06 02:07:44 +01:00
Nick 8a6c950140 test(spine_language): the carved transforms ship WITH tests (#2461 new-module henxel)
CI red at d67fc46: spine_language.py crossed the new-module henxel with zero coverage. Eight contracts: measured-map read + graceful degrade, kind-default verdicts, TUI/hints, subsystem member-majority, unqualified-discovery honesty (candidate stays DECLARED), legacy-ID normalization with edge re-pointing, and the closed-contract-only gather law. 8/8 green. Also: construction_commands dispatch WIP stashed on its own branch (slice 2, next).
2026-10-06 02:04:19 +01:00
Nick d67fc46581 chore(rebase): refresh store/rebase inventory + classification for the 6 post-W0 modules (#2461 close-out)
The W0 map had drifted (174 vs 180 files): cc_loader/sc_loader/mr_loader/mems_loader (FFI kernel membranes → RUST), spine_language (deterministic carve → RUST), __init__ (metadata reads) now carry evidence-backed side records and measured function/line counts. spine_language._classification_sides() — the runtime reader — sees 180 entries; spine battery green.
2026-10-06 01:40:56 +01:00
conductor 84b8d6b215 chore(release): auto-bump version to 0.99.1 — earned by # (patch: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-06 01:22:12 +01:00
Nick 7f5d57236a fix(ci): 0.99.0 CI repair — silent-handler annotations + spine_language umbrella mapping (#2461)
The 0.99.0 bump ran CI against the delegation code before the annotations landed: BLE001 345->349, S110 75->81 (my new kernel-failure fallbacks), plus spine_language unmapped in the umbrella manifest (test_umbrella_impact) and the resulting spine-rebuild membership diff (rebuild-neutrality). All four new fallbacks carry intentional-silence noqa annotations per the ratchet rule (count now exactly 345/75 — baseline UNCHANGED, ledger honest); spine_language mapped into perception next to spine; store rebuilt so the membership edge and language stamps are in the committed store. 127 tests green incl. the four CI-red surfaces.
2026-10-06 01:22:05 +01:00
conductor bda07c68ee chore(release): auto-bump version to 0.99.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-06 00:11:25 +01:00
Nick c5be22be09 feat(cognition): witness/safety/abstraction kernel delegation + regex_lite faithful-subset rewrite (#2461 W3.4, #2465 adjacency)
The W3.4 kernels existed but the Python publics still ran Python. Now: witness extract_topic/detect_signals delegate through the _stopwords()/_tables() gather seams (PATTERN-TABLE GATHER-SEAM LAW) with _py_ oracles; abstraction extract_facts gains the deterministic kernel FALLBACK when the LLM returns nothing; tier_manager was already wired; the RUNE_COGNITION_CORE=python pin is now honored by a SHARED cc_loader.core() probe (the four module-local probes silently ignored it). The canary matrix caught a REAL kernel bug: regex_lite dropped \b anchors as literal b chars so every word-boundary row silently missed (bwrongb never appears in text); rewritten as alternatives-expansion + segment-variant DFS gap-walk; 34-row matrix judged against REAL Python re shows 0 mismatches. canary_growth_pins 27/27 x5 both engine modes; canary_unbounded 14/14; per-row fixtures carry re-truth, not hand labels (a lying fixture is worse than uncovered).
2026-10-06 00:05:54 +01:00
conductor 4d6fec3d17 chore(release): auto-bump version to 0.98.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-06 00:01:45 +01:00
conductor 15dbbc562a chore(release): auto-bump version to 0.98.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-05 23:56:19 +01:00
Nick 6eb5e06119 refactor(spine): carve the #2465 doc-level transforms into spine_language.py (#2461 keep-green)
spine.py crossed the 1200-line giant-file debt cap (1203) with the language-verdict addition — CI lint red. The three transforms (language placement, discovery-ID normalization, contract-discovery write-back + gatherer) move to spine_language.py intact, re-exported through spine for import-compat (structure unchanged: 256 entities, same verdicts; spine battery 87, canaries 19/19 + 21/21, henxels hold, spine.py back to 1034).
2026-10-05 23:53:33 +01:00
Nick 78e4750a77 feat(tier): tier_manager delegates get/promote/demote to the cognition_core kernels (#2461 W3.4 delegation owed)
The kernels and FFI landed in b0a682b but the Python publics still ran Python — the strangler breach this slice owed. Live probe caught the FFI-arg-shape defect: promote/demote take the FULL ENTRY (kernel recomputes current tier internally), not a tier string; passing a string silently returned threshold-default verdicts (promote cold went warm-to-hot WRONGLY via defaults, demote rock went cold ignoring rock protection). 12-case kernel==oracle sweep green: wash>=20, recency hot/warm/cold, naive-timestamp parity trap, rock protection. PY oracle bodies kept; RUNE_COGNITION_CORE=python pins fallback; canary_growth_pins 26/26 both engines; canary_unbounded 14/14.
2026-10-05 23:50:11 +01:00
conductor c3948bae98 chore(release): auto-bump version to 0.97.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-05 23:48:25 +01:00
Nick b8184a0f01 chore(spine): store rebuild carries subsystem language verdicts (#2465) 2026-10-05 23:47:58 +01:00
Nick 469b91f217 feat(spine): subsystem language verdicts from member majority (#2465 addition 3)
The five unassessed subsystems are containers: their language derives from member modules measured sides (classification.json, the W0 dichotomy map, rust and go counts carried in the verdict text). Unclassified members noted rather than guessed; unreadable classification degrades to unassessed. Spine canaries 19/19 and 21/21, spine battery 87 green.
2026-10-05 23:47:55 +01:00
Nick bb960b1656 test(gitea): canary the numeric-ID stale-label removal (#2467)
Replace the obsolete removeLabel(name) pattern assertion with the actual Gitea /labels/{id} request, check ID lookup under the 404 idempotency guard, and require real P0–P3 managed labels. Local canary 39/39; workflow JS regression passes.
2026-10-05 22:22:53 +01:00
conductor 38c76a0c29 chore(release): auto-bump version to 0.96.1 — earned by # (patch: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-05 22:15:03 +01:00
Nick 3186566514 fix(gitea): reconcile priority labels by numeric Gitea ID (#2467)
Issue #2467 carried both P0 and P2 because name-based label DELETE returned 404 and the workflow silently ignored it. Use the numeric ID API, enforce exactly one priority, clear stale unprioritized flags, and execute the workflow JavaScript against a Gitea-compatible fake in regression tests.
2026-10-05 22:14:47 +01:00
Nick 24d14ff8e1 fix(spine): preserve candidate discoveries without inventing module IDs (#2465)
Migrate 22 malformed contract-discovery IDs to construction-surface, retain evidence/edges, keep candidates DECLARED, unify cold/warm language projection, and refresh the pinned aiohttp lock. Red regression tests precede the fix; local full suite 2301 passed, spine canaries 19/19 and 21/21.
2026-10-05 22:14:46 +01:00
conductor 6d0d455033 chore(release): auto-bump version to 0.96.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-05 19:34:11 +01:00
Nick b0a682b61f feat(cognition): R2 W3.4 — tier/witness/safety/abstraction kernels + protocol upgrade (#2461, #2465)
Contract BUILDER-2026-10-05T12:03:34Z-cli — FIRST SLICE under the 90/100
verification law (64172d8).

Kernels (cognition_core/broker.rs):
- tier_get/promote/demote: thresholds+now injected (no-clock); wash>=20
  gate; rock immobility on demote; naive/malformed → designed fallback
- witness: extract_topic (word-run + stopwords-as-data), detect_signals
  (error/correction/completion/topic-drift/commitment/contradiction/
  preference/urgency/learning; pattern tables travel as data; the regex-
  lite subset is faithful to the tables' shapes)
- safety: get_params projection, update_pattern bump/new-row semantics
- abstraction: extract_facts sentence/content-word projection
- crate-level probe tests (parse_probe.rs: aware parse, epoch, tier recency)

Protocol upgrade (issue #2465) — three additions to the machine itself:
1. PER-CONTRACT MINI-DOC: construction_projection.mini_doc() emits the
   LLM quick-lookup page (what was built / connections / how to update)
   per closed contract; close() writes it to store/scaffold/docs/<cid>.md
2. SPINE WRITE-BACK: spine.build() now consumes closed contracts'
   discovered entities (expected_new_observed + candidate corrections) —
   the spine learns what construction actually built (256 entities now)
3. LANGUAGE VERDICTS: every spine entity carries identities.language
   (198 rust / 31 go / 6 tui / 5 unassessed); other projects get the
   fit assessment at classification

Also: one lost FFI block restored (the stash dance dropped
cc_tier_*/cc_witness_*/cc_safety_*/cc_abstraction_* — the battery
caught it: undefined symbol).

Gates: canary_growth_pins 26/26 x3, persona 18/18, cognition_core
38/38, suite 2299/0, ruff clean, type ratchet PASS, henxels all-hold.
2026-10-05 19:34:05 +01:00
conductor ab18540d7e chore(release): auto-bump version to 0.95.1 — earned by # (patch: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-05 19:06:06 +01:00
Nick f489467e1b fix(ci): the priority gate's demand is now programmatically satisfied
Nick's catch (2026-10-05): the auto-label bot highlighted that issues
carry priority only in their titles — the PRIORITY GATE job demanded
P0-P3 labels but nothing ever ASSIGNED them programmatically. The title
inference even used a dead label ('priority: high', normalized away
2026-09-04).

- auto-label's priority inference re-implemented in the gate's own
  namespace: title prefix \bP([0-3])\b first, then keyword inference
  (spine/critical/urgent -> P0; broken/fix/repair/defect -> P1;
  kernel/port/refactor/improve -> P2; benchmark/measurement/deferred ->
  P3); managedLabels now carry the REAL P-labels
- paired with the custodian fix: create_issue assigns the P-label at
  FILING (no issue ever lands unprioritized)
- full open-issue set backfilled (2461-2466, 2455/2459) and the live
  probe (#2466, self-verifying) closed after verifying P1 landed
  at filing
2026-10-05 19:05:38 +01:00
Nick 64172d8675 docs(plan): the 90/100 verification law (Nick 2026-10-05)
- 100% branch coverage on the deterministic Rust kernels (achievable,
  exhaustive via parity matrices)
- ≥90% per-slice changed-lines working bar, aiming higher per slice
- floor ratchet climbs after clean waves (70->76->84->90)
- honest fixtures only — a lying-fixture branch is worse than uncovered
- assertion quality counts: value-verifying asserts only
2026-10-05 12:58:18 +01:00
conductor 8e75414907 chore(release): auto-bump version to 0.95.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-05 12:50:38 +01:00
Nick 7a9d823792 feat(cognition): R2 W3.3 kernels in cognition_core (broker.rs: drift_check + identity_prompt assembly + growth near_dup/profile + pins recall/projection)
Missing from the previous commit's staged set (the harness caught it):
the full W3.3 kernel block now lands. All parity walls verified:
canary_growth_pins 9/9, canary_persona 18/18, canary_cognition_core
38/38, suite 2298/0, diff-cover 72%.
2026-10-05 12:50:33 +01:00
Nick 98b5a73ed1 feat(cognition): R2 W3.3 — identity/growth/pins kernels + full coverage (72%)
- identity_anchors: check_drift delegates (pattern table stays the
  module's data authority via _pattern_triples); _py_check_drift oracle
  covers the four prefix families; drift parity proven on the full
  table (31 patterns) + the full-text multi-class case
- growth_delta: _near_dup/growth_profile delegate; oracle accepts delta
  dicts AND raw strings; near-dup kernel corrected to the REAL
  semantics: prof-key = strip-punct lowercase words >4 chars, split at
  |A∩B|/max(|A|,|B|) >= 0.25 (NOT a jaccard-min heuristic)
- pins: recall kernel projects via _project parity (details-blob parse,
  defaults, 'reason' field); empty-context abstention frozen
- probe branches exercised honestly: pinned-fallback + ImportError via
  the from-import resolution path (the from-import goes through the
  package attribute, not sys.modules — the PEP resolution law frozen in
  the battery)
- reflect malformed-JSON + [:3] cap + apply budget cut frozen
- suite 2295/0; diff-cover 72% (floor 70); canaries 9/9+18/18+38/38
  x3; henxels hold; ruff/type clean
2026-10-05 12:50:33 +01:00
conductor 4a9d8001c1 chore(release): auto-bump version to 0.94.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-05 09:00:47 +01:00
Nick 538bbeb821 feat(cognition): R2 W3.2 — persona_gate decision kernels (cognition_core)
Contract BUILDER-2026-10-05T07:19:27Z-cli (Wave 3 slice 2, #2461).

- cognition_core/broker.rs gains the persona-decision kernel:
  persona_lex (distinctive content words: punct strip, light plural
  stem, acronym preservation — 55-word stoplist), persona_overlap
  (intersection over min-size), persona_decide (engagement matrix:
  amplifier set, semantic gates 0.45/0.30/0.68, user-rule 0.4 bar,
  permissive/legacy-restrictive verdicts, _cite parity '[topic:pN] text')
- persona_gate.py: _lex/_overlap/decide delegate; semantic cosines
  gathered Python-side (embedder calls are IO — the membrane's
  discipline) and passed into the kernel; _py_ oracles are the
  load-bearing fallback
- FFI: cc_persona_lex/overlap/decide; loader extended
- canary_persona.py (canary-first red on every seam): 18/18 x3 —
  lex matrix incl. acronyms/3-char exclusions, decide engagement paths,
  citation format parity
- shim battery 35/35; suite 2294/0; ruff clean; type ratchet PASS;
  henxels all-hold
2026-10-05 09:00:43 +01:00
conductor cc3b3d81eb chore(release): auto-bump version to 0.93.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-05 08:43:51 +01:00
Nick eb01156d9f Merge branch 'master' of http://127.0.0.1:3000/conductor/rune into r2-wave2-memory-retrieval 2026-10-05 08:43:19 +01:00
Nick 290d264f31 feat(cognition): R2 W3.1 — context_broker kernel + the surrogate-pair parser fix across all nine crates
Contract BUILDER-2026-10-05T07:19:27Z-cli, closed: module:context_broker
correctly_predicted; cognition_core expected_new_observed; cc_loader
surfaces honestly new (#2463 wave epic).

- cognition_core crate (zero-dep, no-clock): context_broker's four
  deterministic kernels — default_estimator (chars//4; utf16-length
  corruption caught — the canary's astral cases), default_budget,
  default_memory_budget (+cap), memory_disabled (env gate value-parsed)
- THE PARSER BUG (nine pyjson copies repaired): the surrogate-pair branch
  tested self.b[i+1..] for the second escape's backslash — but hex4 had
  already advanced i past the first escape's 'u+digits', so the correct
  guard window is [i..] not [i+1..]; and after the guard, i advanced +2
  leaving hex4 to read a shifted window ('bad \\u digits' on
  \\ud83c\\udfb8). Fixed: guard at [i..], pre-hex4 advance +1.
  Astral chars (emoji) now parse as ONE code point — char-count parity
  restored everywhere (estimator/chunk/norm)
- context_broker: four functions delegate (load-bearing _py_ oracles);
  the env gate is cross-checked Python-side (Python verdict stays
  authority)
- cc_loader: ctypes shim, CC_RUST_LIB file-form; battery-covered
- CI: crate builds in both jobs, CC_RUST_LIB envs, canary registered

Gates: canary 38/38 x3 + full seven-crate wall green, suite 2293/0,
type ratchet PASS, ruff clean, henxels all-hold, diff-cover 75%.
2026-10-05 08:43:19 +01:00
conductor 16c147dbee chore(release): auto-bump version to 0.92.2 — earned by #2460 (R2 W2.1: deterministic Rust memory-retrieval kernel)
Promotion record: http://127.0.0.1:3000/conductor/rune/pulls/2460
2026-10-05 07:57:54 +01:00
conductor 15cba0bb24 Merge pull request 'R2 W2.1: deterministic Rust memory-retrieval kernel' (#2460) from r2-wave2-memory-retrieval into master 2026-10-05 07:57:47 +01:00
Nick 1283b0bf94 fix(memory): W2.1 coverage 62->84 + pair-list contract harmonized
- chunk gather + projection now speak the W2.1 pair-list contract
  consistently on BOTH engines (fusion['ranks'] is [[rowid, rrf], ...];
  dict-form still accepted for backward callers)
- oracle-path tests: all three modes, abstention edges, malformed
  timestamps, hybrid accumulation, chunk SQL gather through a real
  fixture (vec-table absent by design; embed stubbed — vector execution
  stays Python per the W2.0 ruling)
- battery 32->32 tests extended; suite 2291/0; canary 75/75 x3;
  diff-cover 84% (floor 70)
2026-10-05 07:51:40 +01:00
Nick 1ee35d76c9 fix(memory): W2.1 coverage + stopword parity + chunk projection kernel
- battery: delegation + projection coverage for the kernel consumers
  (29-test shim battery; CI's 45% was the pre-extension tree)
- chunk projection (chunk_recall tail) moved into the kernel:
  RRF-desc order, text[:400] chars, budget cap, page/room/default
  semantics — canary 75/75 x3
- stopword list AST-extracted exactly (51 words incl. needs/wants/likes)
- memory_store: recall/fused/association/chunk kernels delegate with
  _py_ oracles as load-bearing fallback

Gates: canary 75/75 x3, shim battery 29/29, suite 2286/0, ruff clean,
type ratchet PASS, henxels all-hold. PR 2460 updated with the
propagation evidence line.
2026-10-05 07:20:38 +01:00
Nick e8daf78eaa Merge remote-tracking branch 'gitea/master' into r2-wave2-memory-retrieval 2026-10-05 06:39:03 +01:00
Nick 19976c310c feat(memory): R2 W2.1 — deterministic Rust memory-retrieval kernel (#2458)
Contract BUILDER-2026-10-04T20:10:25Z-cli, closed: memory_store and
memory_selector correctly_predicted; kernel expected_new_observed; shim
surfaces honestly new. Stacked on W2.0 (merged de54453).

- memory_retrieval crate (zero-dep, no-clock, rlib+cdylib+bin): the
  retrieval transform family in ONE kernel surface — map_reduce,
  position_aware, fts_query_conjunctive (51-word stoplist extracted via
  AST, no transcription drift), chunk_text (byte-vs-char law honored),
  norm_key, plus the extracted kernels: rank_fusion (RRF/lexical
  normalization/mode selection), score_recall_rows (metadata blend +
  mode-specific QPP abstention), merge_association_rows (association
  projection), fuse_results (fact/research projection + per-kind
  min-max scale alignment)
- PARITY-PLUS-IMPROVEMENT proven: recall's N+1 (per-candidate entry
  reads + repeated DF probes) ELIMINATED — rows batch through the W2.0
  read boundary once and the kernel runs per retrieval stage
- Parity trap frozen: naive timestamps take Python's designed
  TypeError->recency=1.0 fallback (parse_iso now refuses naive, exactly
  like aware-vs-naive subtraction) — the 34-case matrix caught this
- UTF-8 transport fix: ensure_ascii=True surrogate pairs corrupt astral
  chars (emoji) in char-count semantics — direct UTF-8 transport, frozen
- both _py_ oracles and delegating publics; RUNE_RETRIEVAL_CORE=python
  pins the fallback
- CI: crate builds in both jobs, MR_RUST_LIB envs, canary registered

Gates: canary 72/72 x3, suite 2286/0, type ratchet PASS, ruff clean,
henxels all-hold. Store: 218 entities,
rust-crate:memory_retrieval modeled.
2026-10-05 06:38:57 +01:00
conductor e2430a9154 chore(release): auto-bump version to 0.92.1 — earned by #2457 (R2 W2.0: SQLite-backed zero-dep Rust read boundary)
Promotion record: http://127.0.0.1:3000/conductor/rune/pulls/2457
2026-10-05 01:56:56 +01:00
conductor de5445357e Merge pull request 'R2 W2.0: SQLite-backed zero-dep Rust read boundary' (#2457) from r2-wave2-memory-storage into master 2026-10-05 01:56:51 +01:00
Nick e94c8e27a8 Merge remote-tracking branch 'gitea/master' into r2-wave2-memory-storage 2026-10-04 21:07:54 +01:00
Nick 0816c5997d feat(memory): R2 W2.0 — retain SQLite behind a zero-dep Rust read boundary (#2456)
Contract BUILDER-2026-10-04T15:54:17Z-cli closed: module:memory_store correctly_predicted; memory_storage crate, mems_loader, and canary honestly new.

- memory_storage crate: zero Cargo dependencies; system libsqlite3 FFI; sqlite3_open_v2(SQLITE_OPEN_READONLY) makes writes impossible at the connection level; no write-capable mems_* exports
- typed read parity: INTEGER/FLOAT/TEXT/NULL/BLOB, bound string/numeric/bool/NULL params, aggregates, empty results, unicode, and honest SQLite errors
- mutation SQL is rejected; fixture SHA-256 is identical before/after all reads and the rejected mutation
- memory_store gains an explicit backend seam: stdlib SQLite remains the default; Rust read path is opt-in via RUNE_MEMORY_STORAGE=rust; connection-based transactional callers are untouched
- stats_for_path is the proving consumer; both backends return identical result shape
- canary-first: crate-absent red proven, now 19/19 three consecutive
- CI builds the crate in both jobs, pins MEMS_RUST_LIB, and runs the crate canary; pytest shim battery covers loader/seam lines

Evidence: full suite 2283/0, diff-cover 71% >= 70, type ratchet PASS, ruff clean, henxels all-hold. SQLite is retained exactly as Nick directed; this slice exports no Rust write path.
2026-10-04 21:07:43 +01:00
conductor b502a1d7e8 chore(release): auto-bump version to 0.92.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-04 16:52:48 +01:00
Nick 0cd587dfd3 Merge branch 'master' of http://127.0.0.1:3000/conductor/rune 2026-10-04 16:52:43 +01:00
Nick 8404cddb1d feat(scaffolding): R2 Wave 1 — the scaffolding engine reborn (Go start / Rust execution)
Contract BUILDER-2026-10-04T15:25:33Z-cli, closed: scaffold,
construction_decision, go-surface:rune-entry correctly_predicted; crate +
shim + canary honestly new. The engine governed its own rebuild.

- scaffold_core crate (zero-dep, no-clock, rlib+cdylib+bin):
  lifecycle.rs (the LEGAL_TRANSITIONS state machine with exact error
  strings — the single authority, terminals derived), close.rs (the
  closure classification — all buckets incl. the dict-literal overwrite
  quirk and legacy aliases), language.rs (Nick's protocol addition: the
  placement verdict — rune dichotomy rule, other-project fit assessment)
- THE PARITY PROOF: all 43 production contracts in the ledger replay to
  IDENTICAL closure verdicts — the new engine reproduces the V1-accepted
  system's real history byte-for-byte
- Go surface: rune scaffold subcommand — pure ops direct to the Rust
  binary over stdio NDJSON (the tranche's first contracted membrane
  junction); store-backed ops proxy to the engine (strangler membrane);
  4 new Go unit tests (stub-binary junction + failure surfacing)
- scaffold.py: bucket math factored to _py_close_quality, consumed by
  close_contract and the replay battery (one computation, two engines)
- construction_decision.py: language_placement in the classification path
- Canary-first: canary_scaffold_core.py red-proven, now 152/152 x3
  (legality matrix 81 pairs, ledger replay, determinism, Go membrane,
  placement matrix incl. delegation agreement)
- CI: crate builds in both jobs, SC_RUST_LIB envs, canary registered

Gates: pytest green (one bridge-flake rerun), canary 152/152 x3, type
ratchet PASS, ruff clean, henxels all-hold (shim battery extended).
Store: 214 entities — rust-crate:scaffold_core modeled.
2026-10-04 16:52:13 +01:00
conductor 17ec4862e3 chore(release): auto-bump version to 0.91.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-04 16:23:59 +01:00
Nick 6b712a9b75 feat(rebase): R2 Wave 0 — measured inventory + classification + straggler closure
Wave 0.1/0.2: 174 modules, 2,191 functions AST-measured
(store/rebase/inventory.json) and evidence-classified per the dichotomy
law (store/rebase/classification.json — every module carries its import/
content evidence string): GO 43 modules/19,495 lines (reactive,
initiating, network, turn-time), RUST 93/36,215 (deterministic, state,
storage, cognition), TUI-LAST 7/5,438, TEST-INFRA 29/5,395, RETIRES 2
(bootstrap glue). plans/total-rebase-inventory.md is the human-readable
table.

Wave 0.3: the five R1 stragglers (#2171, #2119, #1844, #1755, #1738)
dispositioned with placement evidence and closed — superseded-into-R2,
each folded into its owning wave.
2026-10-04 16:23:55 +01:00
Nick 31f49671ec docs(plan): total-rebase tranche R2 v2 — Nick's six critiques folded in
- parity-plus-improvement rule (parity is the floor, measured improvement
  is in scope, functionality is the gate)
- hybridized Go<->Rust membrane (the no-socket wall withdrawn; junctions
  are contracted, recorded exceptions to the default dichotomy)
- continuous TUI wiring per unit (the TUI wave stays last but integrates
  a system already aimed at it)
- language-placement intelligence in the scaffolding protocol itself
  (rune: the dichotomy rule; other projects: language-fit assessment)
- SQLite RETAINED and wired via system-library FFI (zero-dep legal);
  the bespoke memory redesign deferred to its own later program
- provenance lock: Wave 1 rebuilds the V1-ACCEPTED scaffolding (Nick's
  design, SCAFFOLDING_V1_DEFINITION.md + North Star verbatim), proven by
  production-ledger parity replay
2026-10-04 16:17:32 +01:00
Nick 103a42103b docs(plan): total-rebase tranche R2 — Go initiates and reacts, Rust determines and stores
Designed on the measured inventory (161 modules, 64,482 lines, from the
spine store) per the TRANCHE-DEPTH TEMPLATE. Scaffolding engine first
(Go start / Rust execution, Wave 1) so every later wave is driven by the
new protocol itself; zero-dep law holds with the split doing the work
(Go owns network + reactivity, Rust owns deterministic compute, bespoke
storage engine replaces SQLite in Wave 2); TUI last over the transport
seam; 5 R1 stragglers folded into Wave 0; approval gate before execution.
2026-10-04 16:02:42 +01:00
conductor 615da6bd09 chore(release): auto-bump version to 0.90.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-04 13:25:17 +01:00
conductor 693a494884 Merge pull request 'Phase G strangler slice 2: evidence-provenance Rust candidacy (#2449)' (#2454) from phase-g-strangler-evidence-provenance into master 2026-10-04 13:25:10 +01:00
Nick ee653c6a4c Merge remote-tracking branch 'gitea/master' into phase-g-strangler-evidence-provenance
# Conflicts:
#	requirements-ci.txt
2026-10-04 13:18:54 +01:00
Nick 171f3fb250 fix(tests): close the diff-cover hole — 63% -> 76% on the changed-lines floor
Runs 18367/18369 failed unit-tests on diff-cover (63% < 70%, 338
missing lines) with pytest itself green — the changed-lines floor counts
PYTEST-traced lines only, and three slice surfaces had canary-only
coverage. Battery extension (the shim-battery law applied to my own
slices):
- warm_router: gate branches, finish stack, public score_neuron wrapper
  (designed-fallback determinism), base-level math + gather (hermetic
  via monkeypatched table ensure — STORE_DB resolution is suite-order
  dependent, the order-dependent failure the coverage run exposed)
- tui_transport: InProcess four-method drive, V1 against an in-process
  core, factory modes incl. the bogus-mode ValueError
- token_optimizer: optimize_prompt/get_status/get_cache_stats/flush

CI-exact verification: full coverage suite 2278/0, diff-cover 76%
(floor 70). ruff clean.
2026-10-04 13:09:53 +01:00
Nick 9731181a6b fix(tests): respawn the bridge daemon on mid-test death (root-caused)
The hardening's own diagnostic nailed it (run 18359): the daemon answers
/health at fixture setup, then dies SILENTLY mid-test (alive=False,
out='') on the saturated runner — host shows 20GB swap in use, and a
silent kill with zero output is the memory-pressure signature, not a
race. A retry can never survive a dead process.

Fix: registrations are file-backed under WR_ROOT, so a respawned daemon
resumes the same state — post_event now ensures liveness before each
attempt (respawn on death) and _spawn is the single spawn path (init's
T21.5 fresh-port retry preserved). Bridge suites 19/19, ruff clean.
2026-10-04 12:30:37 +01:00
Nick 544c19719e fix(tests): harden the bridge daemon post_event against load-dependent refusal
Observed 2026-10-04 (runs 18340/18342/18346/18347): the fixture's daemon
answers /health at setup, then a POST lands ECONNREFUSED under runner
load — the twin-failure pattern across two commits while sibling runs
passed. Harness-side hardening per the intermittent-defect law:
post_event retries twice with a beat, and on final failure dumps the
daemon's captured output (alive state + log tail) so the next diagnosis
starts from evidence. Bridge suite 11/11 locally, ruff clean.
2026-10-04 12:18:28 +01:00
Nick d571658b5a fix(ci): register tui_transport in the TUI registry
The tui_panels_are_governed henxel held on the H4 slice-1 surface
(runs 18346/18347): new TUI surfaces ship with a registry entry in the
same PR. Entry added (not-a-surface seam, contract ref, coverage ref).
Local henxels: all hold.
2026-10-04 12:16:23 +01:00
Nick 50c997beab feat(phase-h): H4 slice 1 — TUI transport seam (the migration wave's strangler path)
Contract BUILDER-2026-10-04T10:32:00Z-cli, closed: rune_tui,
go-surface:rune-entry, canary_rune_serve correctly_predicted;
tui_transport + the core_server extension honestly new.

The TUI's operator surface is exactly 4 public calls — this slice puts
them behind one seam so the wave migrates surface-by-surface instead of
rewriting 4k lines of Textual in one go:
- tui_transport.py (new): InProcessTransport (today's behavior,
  DEFAULT via RUNE_TUI_TRANSPORT=inprocess — zero behavior change on
  merge) and V1Transport (stdlib HTTP against the Go front door)
- core_server.py: /v1/conversation + /v1/approvals/resolve — the two
  endpoints the TUI needed beyond H2's set; the Go front passes them
  through (proxy law), H2 battery extended to 28/28 with parity
- rune_tui.py: the 4 call sites route through the seam; the one
  private _task_state peek stays in-process by design (annotated)
- canary_tui_transport.py (new, canary-first red-proven): 9/9 x3 —
  four-method equivalence against the stub core, approval boolean
  round-trips both ways, dead core raises (never a silent empty answer)

Gates: pytest 2270/0, canaries 9/9 + 28/28 x3, type ratchet PASS,
ruff clean. Store rebuilt: 212 entities.
2026-10-04 11:52:38 +01:00
Nick 9e6215e605 fix(ci): henxels holds — intentional mirrors registered + shim-layer pytest battery
Contract BUILDER-2026-10-04T10:29:39Z-cli (successor to 10:20:24Z-cli,
same red evidence run 18322 lint job 51891).

- henxels.yaml: the deliberate-duplicate registry — shared/** (deployed-
  vintage mirror tree), the named src/rune strangler shims, per-crate
  pyjson copies (self-contained zero-dep design), tiny zero-dep
  lockfiles, store/scaffold data, issue-template + completion_file
  mirrors, the interop/rebase-proof fixture
- tests/test_rust_core_shims.py (new, 11/11): the thin pytest battery
  the diff-cover law owed the shim layer — drives the DELEGATION lines
  (loader resolves, envelope unpack, public-vs-fallback agreement) for
  spine_loader, ms_loader, cs_loader, tc_loader, and core_server's
  in-process shapes; skips cleanly on unbuilt crates

Local: henxels all-hold green, battery 11/11.
2026-10-04 11:30:19 +01:00
Nick 6429c5bb49 fix(ci): canary environment repair — runner-HOME rustup path + per-run go binary
Contract BUILDER-2026-10-04T10:20:24Z-cli, closed: all four surfaces
correctly_predicted. Red evidence: run 18322 (4 canary failures).

Two defect classes, both canary-side environment assumptions:
- the Rust-parity canaries resolved the rustup toolchain via
  Path.home() — on the runner that is /var/lib/gitea-desktop-runner,
  which has no toolchain, so cargo fell through to the BROKEN system
  rustc (LLVM_23.1 symbol error). Now the absolute /home/nick path
  (x-ACL covers the runner user) wins, with the home path as fallback
  for other hosts. token_counting gets the same fix preemptively.
- canary_rune_serve built its Go binary to the fixed path
  /tmp/rune-serve-canary — nick owns the local file; the runner cannot
  overwrite it (EACCES). Now a per-run path (-PID).

Verified: all five canaries green locally; runner-HOME simulated
(HOME=/var/lib/gitea-desktop-runner) green for the crate build;
ruff + type ratchet clean.
2026-10-04 11:22:49 +01:00
Nick ea34f2d5ab feat(inference): H3 slice 5 — token counting/compression into the token_counting crate
Contract BUILDER-2026-10-04T09:57:23Z-cli, closed: module:token_optimizer
correctly_predicted; crate + shim + canary honestly new. FINAL H3 domain —
the Phase H plan's back-end port list is now fully delivered.

- token_counting crate (zero-dep, rlib+cdylib+bin): estimate_tokens
  (code points, floor division), compress_context (hand-rolled run
  collapse for 3+ newlines and 2+ spaces — no regex crate; literal
  case-sensitive prefix shortening; unicode strip)
- tc_loader.py: ctypes shim (TC_RUST_LIB file-form)
- token_optimizer.py: estimate_tokens/_compress_context delegate;
  class keeps cache I/O, persona loading, debounce clock
- Repair en route (caught by test_token_optimizer_cache.py): the first
  helper-block placement sat mid-class and swallowed four methods
  (optimize_prompt/get_status/get_cache_stats/flush) into a nested def —
  moved after the class, suite green again
- Canary-first: canary_token_counting.py red-proven, now 26/26 three
  consecutive (unicode code points, emoji, run boundaries, tab-vs-space,
  mid-word prefix non-match, delegation)
- CI: crate builds in both jobs, TC_RUST_LIB envs, canary registered

Gates: pytest 2259/0, canary 26/26 x3, type ratchet PASS, ruff clean.
Store rebuilt through the Rust spine: 211 entities,
rust-crate:token_counting modeled.
2026-10-04 11:18:19 +01:00
Nick 0eff96a335 feat(capability): H3 slice 4 — capability scoring ported to the capability_scoring crate
Contract BUILDER-2026-10-04T09:43:55Z-cli, closed: capability_fit and
capability_broker correctly_predicted; crate + shim + canary honestly new.

- capability_scoring crate (zero-dep, rlib+cdylib+bin): evaluate_fit
  (EXACT/PARTIAL/INCOMPATIBLE/UNKNOWN with exact reason strings,
  unhealthy status join incl. truthy superseded_by, set-math missing
  list), score_card (weights 4.0 name / 3.0 capability / 2.0 examples /
  0.8 description / 0.3 generic penalty / priority bonus)
- wordlists.rs GENERATED from the capability_broker.py literals via AST
  extraction (12 generic caps, 94 stopwords — no transcription drift)
- hand-rolled ASCII word-run scanner replaces re.findall(r'\w+') —
  no regex crate (zero-dep law holds)
- cs_loader.py: ctypes shim (CS_RUST_LIB file-form)
- capability_fit.py / capability_broker.py: _py_ variants as fallback +
  parity oracle, thin delegating publics, RUNE_CAPABILITY_CORE pin
- Canary-first: canary_capability_scoring.py red-proven, now 24/24
  three consecutive (every fit class, every weight branch, stopword
  and generic penalty, delegation)
- CI: crate builds in both jobs, CS_RUST_LIB envs, canary registered

Gates: pytest 2259/0, canary 24/24 x3, type ratchet PASS, ruff clean.
Store rebuilt through the Rust spine: 209 entities,
rust-crate:capability_scoring modeled.
2026-10-04 10:56:10 +01:00
Nick de68444e50 feat(memory): H3 slice 3 — warm_router scoring math into memory_scoring
Contract BUILDER-2026-10-04T09:28:47Z-cli, closed: warm_router and
rust-crate:memory_scoring correctly_predicted.

- warm.rs: score gate (keyword primary gate, semantic secondary gate
  0.55, boost shape, context cap), score finish (importance, b
  contribution, wash boost, cache boost, body-knowledge overlap, fan
  penalty MULTIPLYING before length bonus and protected boost ADD —
  order is load-bearing), ACT-R base-level decay (power-law sum, ln,
  clamp [-2,2], cold -2.0, non-string row -> -0.2 whole call faithful
  to the original's AttributeError-through-outer-catch)
- warm_router.py restructured gather-then-combine: embeddings, SQLite
  use-history, and the cache file are gathered in the wrapper in the
  original's exact reach order — NO base-level or cache I/O on the
  no-fire path (the original early-returns before touching them)
- base_level_activation keeps its SQLite scan; the decay math
  delegates; the outer exception contract (anything -> -2.0) preserved
- Battery extended: 108/108 three consecutive (7 gate branches,
  11 finish stacks, 7 ACT-R cases incl. clamp-high and cold starts)

Gates: pytest 2259/0, canary 108/108 x3, type ratchet PASS, ruff clean.
2026-10-04 10:42:41 +01:00
Nick d58e88da5c feat(memory): H3 slice 2 — drift_compression + drift_cache pure surfaces into memory_scoring
Contract BUILDER-2026-10-04T09:15:51Z-cli, closed: drift_compression,
drift_cache AND rust-crate:memory_scoring correctly_predicted (the
resolver + existing entity made the crate predictable this time);
canary/loader honestly predated the contract.

- compression.rs: ratio table, compress_text (int() truncation,
  Unicode char counts, post-clamp ellipsis compare), entry/warn
  surfaces with exact recommendation strings (em-dashes included)
- cache.rs: compute_priority (raw product, no rounding — faithful),
  qualifies_for_cache admission decision; DriftCache file I/O and
  clock stay Python (zero-dep split law)
- drift_compression.py / drift_cache.py: _py_ variants as fallback +
  parity oracle, thin delegating publics, shared _ms_core seam
- ms_loader.py: 7 new FFI symbols, same segfault-law discipline
- Canary battery extended: 83/83 three consecutive (ratio boundaries,
  text edges incl. unicode, every warn branch, priority grid,
  qualification boundaries)

Gates: pytest 2259/0, canary 83/83 x3, type ratchet PASS, ruff clean.
2026-10-04 10:27:15 +01:00
Nick c730196dba feat(memory): H3 slice 1 — drift_core scoring trio ported to the memory_scoring crate
Contract BUILDER-2026-10-04T08:57:33Z-cli, closed: module:drift_core
correctly_predicted; crate + shim + canary honestly new.

- memory_scoring crate (zero-dep, rlib+cdylib+bin): compute_value with
  now injected (no-clock law — the original reads the wall clock),
  check_promotion_eligibility, pre_commit_gate_entry. Hand-rolled
  ISO-8601 parser (no chrono), banker's rounding via round_ties_even,
  Unicode-aware char counts, Python falsy-coercion semantics preserved
  (0.0 importance -> 0.5)
- Vintage quirk preserved, not fixed: the fourth harmful pattern carries
  uppercase but matches against text.lower() — it can never fire in the
  original, and the parity battery caught my intent-faithful port
  diverging. Behavior fixes belong to their own contract
- ms_loader.py: ctypes shim (FFI segfault law, MS_RUST_LIB file-form)
- drift_core.py: pure trio delegates when the crate is built
  (load-bearing Python fallback; RUNE_MEMORY_CORE=python pins it);
  DB-backed functions stay Python (zero-dep split law);
  signatures made honestly Optional (implicit-Optional ratchet repair)
- Canary-first: canary_memory_scoring.py red-proven crate-absent,
  now 32/32 three consecutive — factor battery, threshold boundaries,
  every critic branch, edge inputs, public-API delegation
- CI: crate builds in both jobs, MS_RUST_LIB envs, canary registered

Gates: pytest 2259/0, canary 32/32 x3, type ratchet PASS, ruff clean.
Store rebuilt through the Rust spine: 207 entities,
rust-crate:memory_scoring + module:canary_memory_scoring modeled.
2026-10-04 10:14:36 +01:00
Nick c750513fab feat(phase-h): H2 Go front door — /v1 surface with NDJSON streaming + parity battery
Contract BUILDER-2026-10-04T08:32:43Z-cli, closed: go-surface:rune-entry
and workflow:ci.yml correctly_predicted; core_server + canary honestly
new (unresolvable at submit time).

- core_server.py (new): stdlib sidecar over the operator surface —
  GET /v1/models, GET /v1/status, POST /v1/chat/completions with NDJSON
  streaming; one error envelope shape across every failure path;
  injectable operator (the canary drives a deterministic stub via the
  established _execute_on_model seam — no live model calls)
- serve.go (new): rune serve subcommand — Go owns the front door
  (stdlib net/http only), byte-pass-through proxy to the core,
  locally-generated error envelopes byte-matching the core's shape,
  core-down 502 core_unavailable
- canary-first: canary_rune_serve.py fired red (module absent), now
  22/22 three consecutive — Python shape freeze, cross-language parity
  modulo volatile (id/created), NDJSON line-sequence equality,
  core-down honesty on both sides
- Go unit tests 6 → 11 (help/flag exits, 404 + 502 envelopes,
  byte-for-byte proxy pass-through); vet clean
- CI: canary registered; go-surface job covers serve.go module-wide

Gates: pytest 2259/0, canary 22/22 x3, type ratchet PASS
(cast-narrowed stdlib override, zero ignores), ruff clean.
2026-10-04 09:55:16 +01:00
Nick 27c4bf8d78 feat(spine): H3-spine — spine projection machinery ported to a zero-dep Rust crate
Contract BUILDER-2026-10-04T07:19:36Z-cli, closed: module:spine
correctly_predicted; crate + loader + canary + CI wiring honestly new
(unresolvable at submit time — they are the delivery).
Nick directives: 'rebuild the spine in rust' + 'add scaffolding to the
rust conversion' — this is both, through the full pipeline.

Rust core (src/rust/rune_spine/, zero-dep, rlib+cdylib+bin):
- pyjson.rs: Python-parity JSON (reused from evidence_provenance)
- store.rs: doc semantics — high-water add_entity, dedup add_relationship
  with CANDIDATE guard, authority observation + reconcile, resolve_status,
  impact_frontier with the obligation semantics tables
- project.rs: full build() projection — carry-forward, manifest ingest
  with generated-view refusal, module re-derivation, deployed observation,
  meta-surface projection (rust-crate/go-surface/config/workflow)
- drift.rs + query.rs: drift classification, query, export_umbrellas
- FFI: single-arg JSON envelopes, sp_free_string; no-clock law (now is
  always an argument)

Zero-dep split law: every filesystem scan stays in spine.py
(_gather_build_inputs/_gather_drift_inputs); both cores consume the same
gathered dict, so parity divergence is logic, never environment.
spine_loader.py: ctypes shim (argtypes+restype per the FFI segfault law,
SP_RUST_LIB file-form override, load-bearing Python fallback).
The unseeded Phase A path stays on the Python core — the public
ingest_umbrellas seam is monkeypatched by isolation tests.

Parity battery (canary-first, red-proven crate-absent):
canary_spine_rust.py 21/21 — drift, 10 query entities, export, seeded
build, unseeded ingest, plus a carry-forward mask guard (asserts the
Rust projection models declared surfaces directly — caught the
config_manifest wiring bug the structural diff could not).

Gates: pytest 2259/0, canary_spine_meta 19/19 x2 through the Rust path,
type ratchet PASS, ruff clean, diff-cover 84% >= 70.
CI: crate builds in both jobs, SP_RUST_LIB pinned, canary registered.
Store rebuilt through the Rust core itself: 204 entities,
rust-crate:rune_spine modeled (self-hosting meta-scaffold).
2026-10-04 09:26:01 +01:00
Nick 5b8023ca2a docs(scaffolding): T4.7 reassessment matrix — all tranche rows correctly_predicted
Successor closures against the H-meta-modeled spine with the repaired
resolver (57eaa8f):
- row 1 v2 slice-1 query_memory: 3/3 (BUILDER-2026-10-04T07:17:13Z-cli)
- row 2 slice-2 evidence_provenance six ports: 9/9 (07:17:15Z-cli)
- row 3 H1 Go first-call shim: 4/4 (07:17:17Z-cli)

Every delivered tranche surface now audits clean against the spine it
lives in. Matrix complete; T4.7 done.
2026-10-04 08:17:40 +01:00
Nick 57eaa8f383 fix(scaffolding): contract scope resolver recognizes H-meta entity kinds
Contract BUILDER-2026-10-04T07:14:03Z-cli, closed: module:construction_decision
correctly_predicted, zero genuinely_unexpected_new.

T4.7 row-1 closure flagged rust-crate:query_memory resolving as
kind=unresolved — classify_surface's prefix set predated the H-meta
entity classes (rust-crate:/go-surface:/config:/workflow:), so
spine-modeled surfaces could never close correctly_predicted.

Red-first: test_hmeta_kind_prefixes_classify_as_structural_entity
failed pre-fix; identity-resolution path needed no change (works for
any id present in an authority). Regression frozen in
test_construction_decision.py (2 new tests, 21/21 file green,
decision neighborhood 107/107).
2026-10-04 08:16:38 +01:00
Nick 567fd39937 feat(spine): H-meta meta-scaffold — every part of rune modeled as a spine entity
Contract BUILDER-2026-10-04T06:24:56Z-cli, closed: module:spine
correctly_predicted; six new entity surfaces honestly unmodelable at
submit time (they are the delivery).

- spine.py: project_meta_surfaces() in the seeded derivation path
  (build step 4) — rust-crate, go-surface, config, and workflow entity
  classes with belongs_to edges; crate-resident canary scan projects
  obligated_canary edges from the owning crate
- config/umbrellas.json: declared rust_crates, go_surfaces, configs;
  canary registrations for audit_ledger, rune_entry, spine_meta
- canary_spine_meta.py (new, canary-first: 14 red proven): entity
  existence/kind checks, canary modeling + edges, determinism, and
  open-world carry-forward — 19/19 five consecutive runs
- determinism contract made honest: structural equality (deep
  timestamp strip incl. last_success + observation set-dedup), not
  clock equality — the per-build deployed_identity observation ticks
  by design
- test_structural_store: schema gate admits the new entity kinds
- ci.yml: canary_spine_meta registered in the canary loop

Gates: umbrella/henxels/structural 32/32, full pytest 2257/0.
2026-10-04 08:09:40 +01:00
Nick 817a97abd9 feat(phase-h): H1 Go first-call shim — delivered under construction contract BUILDER-2026-10-04T05:25:57Z-cli
Scaffolding-first rebuild of the reverted ad-hoc attempt (1e6cb4d), per
Nick's 2026-10-04 directive that all coding replacements run through the
construction pipeline:

- Need submitted with acceptance criteria + constraints (zero-dep Go,
  pinned toolchain, canaries-first); resolution REUSE, approval covered
  by Nick's Go-frontend directive; contract generated and approved.
- CANARY LANDED FIRST (canary_rune_entry.py restored; module absent ->
  canary red proves ordering), then the module restored from the reverted
  reference and the canary went 12/12 green.
- Contract lifecycle driven to close: observe -> verifying -> close.
  Closure verdict (honest): all four delivered surfaces land in
  genuinely_unexpected_new — the spine/structural registry does not model
  the new Go surface, the canary, the pin file, or the workflow yet. That
  IS the coverage signal the closure exists to emit; the spine-modeling
  gap is now a recorded follow-up across H-wave deliveries.

Retrofit closures also completed under the same directive:
- Slice 2 (evidence-provenance): BUILDER-2026-10-04T05:23:17Z-cli — all
  six ported modules correctly_predicted; crate + canaries + shim battery
  honestly unmodeled.
- Slice 1 (query-memory): BUILDER-2026-10-04T05:24:11Z-cli —
  module:query_memory correctly_predicted; crate + canaries unmodeled.
- BUILDER-2026-10-04T05:14:20Z-cli (v1) and ...:18:52Z (v2) stand as
  labeled learning artifacts (entity-vocabulary mismatch).

go test 6/6, go vet clean, canary 12/12 (desktop + bare-HOME CI sim),
henxels exit 0, pin check PASS.
2026-10-04 06:28:51 +01:00
Nick 1e6cb4d1ba revert(phase-h): withdraw ad-hoc H1 shim + enablement — will be rebuilt through the scaffolding construction pipeline
Nick directive 2026-10-04: all coding replacements must be done via the
scaffolding construction pipeline (construction_decision -> normalization
-> discovery/fit/resolution -> toolchain -> layout obligations -> approval
gate -> durable trace -> generated contract -> canaries-first ->
implementation -> verification -> delivery record). The H1 Go shim was
built ad-hoc; this reverts it (and the H0 CI surface) for a proper
rebuild. The scaffolding run that replaces it follows as its own
construction contract.
2026-10-04 06:11:20 +01:00
Nick 4e11aa4268 fix(ci): go pin check strips the distro build-experiment suffix
CachyOS ships go 1.27.1-X:nodwarf5 (an LLVM build experiment flag). The
pin compares the RELEASE (1.27.1), not the suffix — same pin law, honest
comparison. Verified locally before push this time.
2026-10-04 05:59:05 +01:00
Nick 1703c25367 feat(phase-h): H0+H1 — Go toolchain enablement and the first-call shim
H0 (enablement, per plan 2026-10-04-phase-h-go-frontend-rust-backend.md):
- Go 1.27.1 installed (pacman, world-readable — runner user verified).
- go-version.txt pins the toolchain; the go-surface CI job fails loud on
  drift instead of letting a distro upgrade change behavior downstream.
- go-surface job: vet + test + build, runs on the rune-ci-desktop label.

H1 (first-call shim, Go owns the front end per Nick's USER-LOCKED directive):
- src/go/rune-entry: the 'rune' binary replicates the DEPLOYED bash
  launcher's exact contract — cd /mnt/workdrive/rune-code/current/src,
  RUNE_HOME/RUNE_MEMORY_DIR/MIMO_PROBE_ENABLED env (explicit ambient
  overrides win), exec handoff to the memory-venv python -m rune with
  args/signals/exit codes passing through 1:1. Falls back to the dev
  checkout when the deployed revision is absent, and to PATH python3 when
  the venv is absent (CI sandboxes).
- Flags: --version (deployed pyproject), --python-only (resolved handoff),
  --help (exit 0), unknown flag (usage on stderr, exit 2).
- canary_rune_entry.py: 12 checks — builds the module in a temp dir
  (zero-dep, system Go), verifies the version surface, the handoff shape,
  flag discipline, the Go unit battery (6 tests), and go vet. Green on the
  desktop AND under a bare-HOME CI simulation (the fallback expectation is
  asserted honestly, not fudged).
- Registered in the canary suite loop (henxels exit 0).

Observed-not-invented: the launcher contract comes from ~/.local/bin/rune;
the version from the deployed pyproject (0.89.0 at this commit).
2026-10-04 05:52:43 +01:00
conductor 7cc47de6de chore(release): auto-bump version to 0.89.1 — earned by # (patch: converged release (push-to-master bump))
Promotion record: (unknown)
2026-10-04 05:09:58 +01:00
Nick e93315d156 fix(ci): same label correction on the branch (rune-desktop -> rune-ci-desktop) 2026-10-04 05:09:54 +01:00
Nick be49fb32d1 fix(ci): retargeted jobs must use the runner LABEL rune-ci-desktop, not the runner name
Correction to 1462262: act_runner matches jobs by runner LABELS. The only
registered runner (rune-desktop on gitea-desktop-runner) carries the label
'rune-ci-desktop:host' — 'rune-desktop' is the runner's NAME, which matches
nothing. All 8 retargeted jobs queued forever (runs 18197/18203/18211
stuck exactly this way) while ci.yml jobs (which use the correct label)
drained normally. rune-desktop -> rune-ci-desktop in all 8 spots.
2026-10-04 05:09:53 +01:00
Nick c41ed97373 docs(plan): phase H — Go front end / Rust back end (Nick's USER-LOCKED directive)
Directive supersedes KEEP-PYTHON rubric verdicts. Plan scopes:
- Go: runtime entry (rune binary), CLI/IPC first-call dispatch, /v1
  endpoint surface (the rubric's one capability-proven Go fit: stdlib
  net/http + NDJSON streaming). TUI deferred to its own wave (H4).
- Rust: remaining pure-logic back-end modules (drift_*, warm_router
  scoring, memory_store helpers, capability scoring, token counting)
  into zero-dep crates, each port running the full slice-2 pipeline.
- Honest constraints carried: network code never in crates; SQLite/regex/
  IO stay at language edges; every surface gets observed-byte-parity proof.

Sequenced H0 (enablement: install Go, CI Go job) -> H1 (first-call shim)
-> H2 (dispatch + /v1) -> H3 (back-end ports) -> H4 (TUI wave).
2026-10-04 04:47:40 +01:00
Nick 558401844e fix(release): TUI footer version + drift gate now covers the footer pattern
Master CI unit-tests failure (run 18195): rune_tui.py:1888's footer said
'Rune v0.88.4' while __version__ is 0.89.0. Root cause in the auto-version
push-to-master bump: its replace pairs cover the footer, but the drift
GATE's regex checks only covered the Version: header. When RELEASE_VERSION
was stale, both replaces no-opped; the gate's RECOVER regex force-fixed
the header (first-match re.sub) and the footer passed through unchecked —
the exact half-bump shape seen in 396ae12.

- rune_tui.py footer -> Rune v0.89.0 (fixes test_tui_banner_uses_the_reviewed_release_version)
- auto-version.yml: gate checks add the footer regex ('Rune v({VER}) \|'),
  so future footer drift triggers the same RECOVER path as the header.
2026-10-04 04:34:05 +01:00
Nick 26e4929b10 chore(deps): re-resolve ci lock — markupsafe 3.0.4, platformdirs 4.12.3, websockets 17.2 (master catches up to the strangler branch's regen) 2026-10-04 03:16:27 +01:00
Nick 1462262476 fix(ci): retarget 8 jobs from dead rune-infra-pi label to rune-desktop (master)
Same fix as 0bf4726 on the strangler branch, applied directly to master:
queued workflow runs resolve their workflow definition from the DEFAULT
branch, so the strangler-branch commit alone could not drain stuck runs
18178 (auto-label on a PR) and 18183 (auto-label on an issue). This is
the landing spot. 8 occurrences across 5 workflows retargeted.
2026-10-04 03:01:40 +01:00
Nick 0bf47265c8 fix(ci): retarget 8 jobs from dead rune-infra-pi label to live rune-desktop runner
New submissions (issues/PRs) were stuck queued forever: auto-label.yml's
priority-gate + demand-comment jobs declared runs-on: rune-infra-pi, a
runner that no longer exists anywhere (registration list shows only
rune-desktop on gitea-desktop-runner). Every issue or PR filed since the
label went dark sat unprocessed — which is exactly the 'new submissions
not working' symptom.

Retargeted (sed, 8 occurrences across 4 workflows):
- auto-label.yml (2): priority gate, demand comment
- auto-backup.yml (1), auto-update-gitea.yml (1), auto-version.yml (1)
- maintenance.yml (5)

Verified live: probe issue + probe PR + probe branch all created AND
processed successfully through the API (submissions themselves work; it
was the responder workflows that were orphaned). Probe artifacts cleaned
up. The stuck queued runs 18178/18183 will drain once this lands.
2026-10-04 02:49:13 +01:00
Nick 02a9dc4a31 fix(ci): rust toolchain law — healthy rustup toolchain, runner-owned target, EP_RUST_LIB wiring
CI cargo build failed twice (runs 18169/18170): the SYSTEM rustc is broken
on this host at the packaging level — pacman rust 1:1.99.0-1's
librustc_driver.so has 638 undefined symbols versioned LLVM_23.1, and
/usr/lib/libLLVM.so.23.1 does not define narrow-char std::string::_M_mutate
under that node (it exports _M_create/_M_assign there; only the wide-char
_M_mutate carries the version). Every compile dies with a symbol-lookup
error while cargo --version prints fine — a silent-broken build host.

Fix (all local, no system changes):
- PATH points at /home/nick/.rustup/toolchains/stable.../bin FIRST — that
  toolchain is healthy and ships its own libLLVM. The ordering matters: via
  RUSTUP_TOOLCHAIN (shim-based), rustup would exec the broken system rustc.
  /home/nick already carries the x-ACL for gitea-desktop-runner (proven:
  runner-user build succeeds, 0.95s, zero-dep crate).
- CARGO_TARGET_DIR is a runner-owned /tmp dir (the repo's target/ is
  nick-owned; publish-by-copy into it failed with EACCES). No copy step at
  all now: ep_loader + the canary resolve artifacts via EP_RUST_LIB (file
  path form — the loader's override takes a FILE; set in both jobs' env).
- unit-tests job gains the same env block as canary (RUNE_HOME/
  RUNE_MEMORY_DIR/EP_RUST_LIB) so the shim battery's cdylib load and the
  isolation law hold in CI exactly as locally.
- Python canary resolves _BIN next to the EP_RUST_LIB file (binary and
  cdylib are siblings in the release dir; desktop keeps the repo-relative
  default).

Verified locally: runner-user build + EP_RUST_LIB file-form through BOTH
canaries (74/74, 66/66) and the shim battery (7/7); desktop default path
re-verified after artifact restoration (deps/ hardlinks were never lost —
an earlier publish test's rm removed the top-level copies; restored from
deps/).
2026-10-04 02:17:44 +01:00
Nick 0f3aeff58b fix(ci): diff-cover ratchet + canary artifact coupling — shim battery, crate build in CI
diff-cover 70% floor (run 18164's unit-tests failure):
- The floor counts CHANGED lines covered by pytest only. The strangler's
  verification moved the six ported shims to canaries/parities (outside
  pytest), so 46% of slice-2's changed lines were pytest-covered and the
  gate red-lined the port itself.
- tests/test_evidence_provenance_shims.py: a six-test shim battery driving
  the delegation surfaces the port changed (verification_layer dispatch +
  seven wrappers, evidence_probe schema/budget, behaviour_ledger state
  machine incl. accept_limitation + reload round-trip, behavior decision
  math on an isolated db, claim_audit scan->verify->degrade->journal->
  report pipeline, audit_ledger append->verify->read on the isolated
  ledger). Isolation law documented in the module docstring: RUNE_HOME/
  RUNE_MEMORY_DIR pinned before import (both resolve paths at import);
  behavior/claim_audit are imported by no other test file.
- save() finding: mutators never auto-persist in EITHER vintage (verified
  against the pre-port module) — the round-trip test calls save().
- .coveragerc omits ffi_query_memory_smoke.py (= the canary precedent:
  standalone evidence script, never suite-imported).
- Result replicated locally against gitea/master: 116 diff lines, 87%
  (floor 70), exit 0.

Canary job now builds the crate (run 18164's canary failure):
- Until 18164 the job silently relied on the host executor seeing the
  desktop's prebuilt target/ — my checkout-relative BIN made that visible
  as an uncaught Popen FileNotFoundError (§5 crash before finishing).
- ci.yml gains cargo build --release for the zero-dep crate (system cargo,
  world-readable on the runner; no registry fetch).
- §5 fails loud-but-counted (FAIL test, not a crash) when the artifact is
  missing, with the regression meaning spelled out.

Local wall: pytest 2257/0; canaries 74+66 both modes; lint 345/75 PASS;
type ratchet PASS under the pinned instrument; henxels exit 0; umbrella
gate exit 0; dep-lock in sync.
2026-10-04 02:08:29 +01:00
Nick ff2abcd502 fix(ci): run-18161 follow-through — mode detection, plan kebab-case, smoke coverage, deterministic type instrument
Canary mode detection (the real 18161 defect):
- isfile() is not a valid LIVE/ISOLATED discriminator: run 18141's shim
  writes left a zombie 1-entry ledger in the runner's persistent HOME, which
  flipped the naive gate to LIVE with wrong data. The discriminator is now
  the repo's own CI-sandbox convention (RUNE_HOME=/tmp/rune-ci-<id> — the
  workflow's own cleanup guard matches exactly that).
- The isolated battery seeds a PER-RUN temp ledger (module-attr override on
  the shim's LEDGER_FILE) instead of writing the runner's persistent home;
  binary §5 gets HOME=<temp> so binary and shim resolve the same file.
  Both modes: 74/74 locally and under simulated runner topology (zombie
  ledger present, RUNE_HOME set). Rust canary §4 gets the same dual-mode
  treatment.

Henxels holds cleared:
- plans/: three phase-g files renamed to kebab-case; references updated in
  lib.rs, ep_loader.py, canary docstring, Cargo.toml, supersession ledger.
- ffi_query_memory_smoke coverage: smoke repaired (was stranded — imported
  the deleted src/rune vintage; now drives shared/ shim, 41/41 green) and
  tests/test_ffi_query_memory_smoke.py runs it, skipping honestly when the
  cdylib isn't built (CI has no cargo step).

Type ratchet — instrument repair (§16V), not reading-management:
- scripts/type_check_ratchet.py now pins pyright --pythonpath to the
  INVOKING interpreter. Ambient-interpreter dependency resolution was the
  residual non-determinism: runner (py311, no rich/Pillow) vs desktop (3.14
  system site) produced 460 vs 454 on the identical tree, and any import
  ignore flipped to unnecessary-ignore in the other environment.
- pyrightconfig extraPaths now covers src/rune + shared + both crate dirs
  (bare intra-repo imports resolve under the pinned environment).
- Pillow declared in pyproject (genuine lazy dep of the diamond-frames
  surface; was undeclared) — lock regenerated, dep-lock checker green.
- Measured under the pinned instrument: 115 errors / 439 warnings
  (CI-equivalent locked 3.11 venv) and 115/436 (local 3.14 venv) — both
  below the 117/454 baseline; baseline unchanged. My canary's 4
  reportOptionalSubscript errors fixed by real narrowing, not suppression.

Lint baseline: BLE001 346 -> 345 (bulk_issue_guard.py's retry catch gains a
reasoned noqa; the file stays untracked per checkpoint hygiene, but the
honest-ledger test counts disk state — the noqa keeps local == CI).

Local wall: full pytest 2251/0 (incl. the new smoke test); canaries 74+66
both modes; parities 33/24/13/16/17; henxels exit 0; umbrella gate exit 0;
dep-lock green.
2026-10-04 01:08:20 +01:00
Nick b61af7a526 fix(ci): slice-2 canary completeness + gate repair — dual-mode canary law, ports 3-6 sections
Canary completeness (contract §5/§10 — owed at slice end):
- canary_audit_ledger.py 34 -> 74 checks: port-3 (evidence_probe schema gate
  + budget count + ProbeBudgetExceeded), port-4 (behaviour_ledger state
  machine: define/record/invalidate/outstanding/summary/history + byte-exact
  error envelopes), port-5 (behavior decision math through the shim on an
  isolated RUNE_HOME db: correction/habit math, promotion, not-found shapes),
  port-6 (claim_audit full pipeline on an isolated journal: scan/scan_text/
  audit/report + verify + stoplist wiring).
- canary_evidence_provenance_rust.py 28 -> 66 checks: the same four ports
  driven through the cdylib FFI (ep_validate_probe, ep_bl_*, ep_habit_/
  ep_correction_reinforce, ep_ca_* batteries).

Dual-mode canary law (repairs run 18141's red):
- Live-ledger pins (entries floor, live read/list shapes) fire only when the
  live promotion ledger exists in this process's HOME; under CI's sandboxed
  HOME the same sections run an isolated battery (shim-seeded entries,
  FFI-built chain) — identical check count, honest MODE print. The law and
  the artifact coupling are documented in both canary docstrings.
- Ghost-divergence repair: the Rust binary honors RUNE_MEMORY_DIR/RUNE_HOME
  first (main.rs ledger_path) while the deployed shim resolves expanduser
  (HOME); §5 binary envs now strip RUNE_* so both surfaces resolve the same
  ledger in every environment.
- §10 pins RUNE_MEMORY_DIR alongside RUNE_HOME (memory_dir() honors the
  former first).

Gate debt exposed by 18141's failure profile (pre-existing, now closed):
- config/umbrellas.json: ffi_query_memory_smoke mapped to the memory
  umbrella (owed since 43e7f5f; umbrella gate green in push mode).
- requirements-ci.txt regenerated: markupsafe 3.0.3 -> 3.0.4,
  websockets 17.1 -> 17.2 (checker green).
- lint-baseline.json BLE001 347 -> 346: claim_audit silent handlers
  repaired with exc_info logging + reasoned noqa (deliberate-silence sites
  only); canary battery handlers carry the canary-law reason. S110 holds.
- type ratchet green at 107/454 (local pyright pinned to CI's 1.1.414;
  isinstance runtime-shape checks carry scoped ignores; ep_loader imports
  annotated as runtime-by-design).
- store/scaffold + spine snapshots travel with the change (as at 2ac2d0a);
  supersession ledger canary rows updated to the true final counts.

Full local wall: 5 parity harnesses 33+24+13+16+17 all green; both canaries
green in LIVE and ISOLATED modes; consumer import chains (iteration,
testing_mode, rune_operator, contracts, curator + deployed shims) green;
live chain intact through the deployed shim; pytest suite 2250 passed/0.
2026-10-04 00:32:28 +01:00
Nick 497d14a449 ci: register canary_audit_ledger in the canary suite loop
The henxels contract requires every src/rune/canary_*.py on disk to be
registered in the CI canary loop (gap #138's rule is per-canary). The
slice-2 canary (port 1, canary pair carrier, 34 checks) was added with
the port but its registration was missed — the contract test caught it
live. Registered in the slice-1 position (after canary_query_memory,
the strangler-adjacent grouping).
2026-10-03 16:25:52 +01:00
Nick 2e68b6b054 phase-g slice 2: supersession ledger + registry remap + shared deletion
- plans/2026-10-03-phaseG-evidence-provenance-supersession.md: the
  slice-level ledger — port table (6/6, commits + parity + consumer
  proof), 12-step doctrine discharge, vintage-merge disclosures
  (symmetry guard, scan_text repair, port-1 sequence break), consumer
  map, live-data rules honored.
- shared/audit_ledger.py DELETED (superseded; zero importers verified
  by sweep; deployed shim + Rust core proven live before removal —
  language-governance rule ⑥).
- coverage registry: audit_ledger removed from SHARED_D.
- regression gate: exit 0 pre- and post-deletion.
2026-10-03 16:20:08 +01:00
Nick 969e39f6a3 phase-g slice 2 port 6: claim_audit decision skeleton -> rust core (parity 17/17)
- claims.rs: the verify() verdict tree (comparative-no-anchor gate,
  ledger-hits PASS, DEGRADE tails), report aggregation (total/by_verdict/
  by_type with '?' defaults), the clean fold, evidence-term stoplist.
  Regex engine + I/O stay Python (zero-dep crate law); timestamps Python.
- ep_ca_verify_gate / ep_ca_audit_clean / ep_ca_report_aggregate /
  ep_ca_evidence_terms FFI + ep_loader wrappers (restype law).
- claim_audit.py is now a shim, BOTH copies (src/rune + deployed):
  verify() delegates the tree + term filtering; report() / clean fold
  delegate; regex machinery (scan/reframe/degrade/EVIDENCE_TAG) + journal
  I/O + runner stay Python.
- VINTAGE MERGE (disclosed): the deployed scripts vintage carried the
  SYMMETRY GUARD (research_lens.symmetry_check, 2026-08-15) which src/rune
  lacked — preserved (load-bearing behavior, feature-preserving merge).
- REPAIRED a dead consumer: rune_tui.py:3752 calls claim_audit.scan_text()
  expecting {degraded, claims, clean} — NO implementation existed in either
  vintage (silent try/except death since the call landed). scan_text() is
  now a first-class surface; verified live (returns the exact dict shape).
- parity_claim.py: 17-case battery — verify tree 12 (flags derived the
  same way the original derives them: original verify() vs gate FFI),
  report aggregate over a real-shaped journal (incl. '?' fallback rows),
  clean fold 3, stoplist filter — 17/17 GREEN pre-switch vs original.
- deployed shim live: real journal (1127 rows, 851 DEGRADE / 276 PASS)
  aggregates through the Rust core; TUI backend trio imports clean.
2026-10-03 16:19:12 +01:00
Nick 273267763e phase-g slice 2 port 5: behavior decision math -> rust core (parity 16/16)
- habitmath.rs: the reinforce decision math — habit (activation/success/
  failure counting, confidence min(1.0, 0.5 + rate*0.5), candidate→active
  promotion at min_activations, neutral still counts activation) and
  correction (success +0.1 / failure −0.3 with ceilings/floors, evidence
  counting, active/archived at 0.3). STORAGE STAYS PYTHON — SQLite I/O
  and regex matching remain in the module (the crate is zero-dep by
  design; hand-rolling SQLite/regex would be hubris, not hardening).
  No clock in the core — timestamps pinned by the shim.
- ep_habit_reinforce / ep_correction_reinforce FFI + ep_loader wrappers.
- behavior.py is now a shim: reinforce() fetches the row, delegates the
  math, writes the update back; add/match/list/stats/CLI unchanged.
- parity_behavior.py: 12 decision-math cases (outcome × state × boundary:
  promotion-at-min, floors, ceilings, neutral, archive-threshold) with
  SEMANTIC comparison (parse-then-compare — the 1.0-vs-1 render delta is
  serialization, not semantics) + full-stack live-db scenarios both sides
  (promotion observed, activations logged) — 16/16 GREEN.
- deployed ~/.config/opencode/scripts/behavior.py upgraded to the same
  shim shape (vintage upgrade per contract §2) pointing at the LIVE db
  (~/.config/opencode/memory/behavior.db, 2 corrections / 1 habit,
  untouched); read paths verified against the live db (stats + match).
  Pre-deploy backup: /tmp/behavior_deployed_pre_port5.bak.
2026-10-03 16:01:52 +01:00
Nick 8973caae77 phase-g slice 2 port 4: behaviour_ledger -> rust core (parity 13/13)
- behaviour.rs: the full state machine — define (normalize/dup-check),
  transitions with history append (at/from/to/kind/detail[:200]/gen),
  record_auto_verification (ceiling AUTO_VERIFIED), record_real_world
  (USER_CONFIRMED iff passed && confirmed_by==user), accept_limitation,
  invalidate_for_change (CONFIRMED_STATES-only, deps ∩ closure + owner
  hit, default reason 'structural change touched: [...]' Python list
  repr sorted, reasons override, unrelated preserved), retest_history,
  outstanding (TEST_FAILED-first sort), summary. Timestamps passed IN
  (now) — no clock in the core, parity deterministic.
- FFI: doc-in/doc-out convention with {ok, err} envelope — err raises
  ValueError with the exact Python message (duplicate/unknown-behaviour/
  unknown-state all byte-equal). Read paths: ep_bl_get/retest_history/
  outstanding/summary.
- behaviour_ledger.py is now a shim: file glue (load/save) + constants
  stay Python; every state-machine op delegates via the doc envelope.
- parity_behaviour.py: full-scenario battery (3 behaviours, auto+real-
  world+other-confirm, selective invalidation with reasons override +
  owner hit, filters, error messages, save render indent=1 sort_keys)
  — byte-equal docs, 13/13 GREEN pre-switch (vs original) and
  post-switch (round-trip).
- consumers verified: iteration.py:23, testing_mode.py:19 (constants at
  import), rune_tui.py:3152 (lazy) — import chains green.
2026-10-03 15:59:14 +01:00
Nick 3450a1cb83 phase-g slice 2 port 3: evidence_probe -> rust core (parity 24/24)
- probe.rs: validate_probe schema gate + count_probes budget count,
  byte-parity on every error string incl. Python repr rendering:
  {status!r} single-quote escaping, sorted-list ['a', 'b'] shapes,
  non-string-status double-error (field error + membership error —
  Python runs the membership check on the RAW value), GROUNDED source
  >= 8, extra-fields sorted, field-order iteration.
- ep_validate_probe + ep_count_probes FFI; ep_loader wrappers with
  restype declarations (the segfault law holds: every new ep_* symbol
  gets argtypes+restype).
- evidence_probe.py is now a shim: validate_probe + count_probes
  delegate to the Rust core; run_probe orchestration (runner subprocess,
  exception semantics, budget enforcement, record_probe) stays Python.
- parity_probe.py: 24-case battery (17 schema-gate shapes incl. the
  non-string status trap, 3 non-dict top levels, 4 count_probes file
  shapes) byte-equal through FFI; GREEN pre-switch (vs original) and
  post-switch (round-trip).
- consumers verified: rune_operator.py:581/603 (run_probe), failure_
  recovery.py (budget map), research_stage_executor.py:312 (run_probe +
  MAX_PROBES_PER_TASK + ProbeBudgetExceeded) — all 23 sibling tests
  green through the shim.
2026-10-03 15:54:38 +01:00
Nick 9cb93e6573 phase-g slice 2 port 2: verification_layer -> rust core (parity 33/33)
- verification.rs: all seven verifiers + dispatch, to_dict shape
  byte-parity (key order passed/verifier_type/evidence_refs/failures/
  retryable/escalation_reason), Python str() rendering rules (bool ->
  True/False in evidence_refs — exit_code=False renders False not 0),
  Python == 0 semantics (bool/int cross-compare), default-value guards.
- ep_verify FFI + ep_loader.verify wrapper; verification_layer.py is now
  a shim (dataclass stays Python — rune_operator:323 constructs it
  directly; verify_* delegate to the Rust core and reconstruct).
- parity_verification.py: 33-case battery (7 verifiers, pass/fail/edge/
  default/unknown) byte-equal through the FFI, incl. CLI indent=2 render;
  GREEN pre-switch (vs original) and post-switch (round-trip).
- canaries extended: python 34/34 (deployed shim + port-2 sections),
  rust 28/28 (ep_verify battery + key-order parity).
- consumers: contracts.py dynamic __import__, canary_native MODULES list,
  full_audit file list — all resolve the shim; import surface unchanged.
2026-10-03 15:51:48 +01:00
Nick 4b0d1d24d2 phase-g slice 2 port 1: audit_ledger canary pair (deployed-shim 28/28, rust 23/23)
- Python canary pins the deployed shim surface to the frozen contract:
  live-path LEDGER_FILE, drift-key default, 3-key dict verify_chain,
  ascending serving order (observed), canary append through the shim
  (live entry 4242, chain intact post-append), rust CLI parity shapes.
- Rust canary drives the compiled surfaces: binary CLI shapes (verify/
  list/log-promotion + argparse error shapes incl. --limit=N form), FFI
  contract via ep_loader (5 fns), fresh-ledger append+verify+get, and the
  live-chain drift-key rule (23+ entries, chain intact).
- Sequence-break disclosure: the shim was deployed before these canaries
  existed; both now green against the deployed state — recorded on #2449.
2026-10-03 15:46:15 +01:00
Nick 114c394741 phase-g slice 2: evidence_provenance rust crate + ctypes loader (audit_ledger parity-complete, shadow 18/18) 2026-10-03 02:41:21 +01:00
Nick 7c68e41a63 phase-g slice 2: freeze evidence-provenance contract (drift-key live-ledger resolution, authority = src/rune vintage, port order set) 2026-10-02 23:12:22 +01:00
Nick 2ac2d0aefd refactor(query-memory): supersede old Python implementation with Rust cdylib (strangler steps 9-12)
Old src/rune/query_memory.py deleted (zero importers verified by sweep).
Coverage-audit registry remapped: shared/query_memory.py (ctypes shim) is
canonical; query_memory out of SRC_A/SHARED_D, into SHARED_B. Supersession
ledger written to plans/. Steps 1-11 evidence in ledger + issue #2448.
2026-10-02 20:52:40 +01:00
Nick 6f44a87894 feat(phase-g): authority-switch shim — deployed query_memory.py is now a ctypes shim over the Rust cdylib
Step 8 of the 12-step strangler doctrine: the deployed in-process consumers
(memory_store.py, growth_simulator.py) now run the Rust classification core
in-process via qm_loader.py. Full historical Python class API preserved,
including the query-history snapshot attribute (loaded at construction,
appended on record — canary check 2 reads it).

Post-switch verification wall ALL GREEN: FFI smoke 41/41, parity harness
ALL GREEN (stdout + history.jsonl + topic_stats.json byte-parity), Python
canary 12/12, Rust canary 27/27, both consumers verified live against the
deployed shim.
2026-10-02 20:24:26 +01:00
Nick 485623dbc4 feat(query-memory): add qm_topic_stats + qm_dead_weight FFI exports and loader bindings
Closes the FFI surface gap: Python get_topic_stats/get_dead_weight_topics
now have FFI exports wrapping the existing Rust topic_stats/dead_weight
impls via TopicStats::to_json. Loader extended with the two bindings
returning the pinned Python shapes (ordered dict / filtered name list).
FFI-gap parity probe: exact-equal vs deployed Python. Verification wall
green: smoke 41/41, parity ALL GREEN, canaries 12/12 + 27/27.
2026-10-02 19:49:19 +01:00
Nick 43e7f5f7d2 feat(query-memory): FFI exports for in-process Python consumption of the Rust core
Seven #[no_mangle] extern "C" exports on lib.rs (qm_new, qm_with_dir, qm_rate,
qm_record, qm_stats, qm_history, qm_health) so the deployed in-process consumer
(~/.config/opencode/scripts/memory_store.py adaptive_exploration_rate) can load
the compiled Rust core via cdylib instead of the Python implementation.

- ctypes loader qm_loader.py mirrors the deployed consumer's exact call shape
- FFI smoke src/rune/ffi_query_memory_smoke.py: 41/41 PASS against an isolated
  store — construction-ordering fixes: seed-then-construct (both implementations
  snapshot the store at construction), post-record health parity
- verification post-FFI: parity harness ALL GREEN, Python canary 12/12,
  Rust canary 27/27 (src/rust/query_memory/canary_rust.py)

Phase G strangler slice 1, step toward shadow comparison + authority switch.
2026-10-02 17:59:50 +01:00
Nick 54d2db97b0 refactor(query-memory): split core into lib.rs — rlib + cdylib for in-process Python loading
Phase G slice 1 (retrieval-index) strangler: the whole implementation lived
in main.rs (prior checkpoint's lib.rs claim was wrong — disk wins). Core
(QueryMemory, classification, serialization) now in src/lib.rs; main.rs is
a thin CLI shell over it. crate-type = [rlib, cdylib] so the deployed mimo
scripts (memory_store.py, growth_simulator.py) can load the compiled core
in-process instead of paying interpreter-subprocess costs.

Verified post-refactor: parity harness ALL GREEN (stdout + history.jsonl +
topic_stats.json byte-parity), Python canary 12/12 exit 0, Rust canary
27/27 exit 0 against rebuilt release binary.
2026-10-02 17:25:10 +01:00
Nick 523a859656 test(query-memory): add Rust canary proving C1-C8 against compiled binary
C9 canary for the Phase G strangler slice 1 (retrieval-index): 27 checks
in the same PASS/FAIL counter discipline as the Python canary, driving
target/release/query_memory with isolated HOME per section. Covers CLI
surface (C8), storage layout + cross-compat (C1), classification
tie-break (C2), adaptive rate clamp + threshold (C3), dead weight (C4),
corruption tolerance (C5), timestamp shape (C6), truncation (C7).

Fixes one probe defect found live: the C5 history-corruption probe
expected stats to rebuild from history.jsonl, but get_topic_stats reads
ONLY topic_stats.json in BOTH implementations (verified byte-identical
side-by-side) — probe corrected to assert the shared real behaviour.

Observed: 27/27 PASS, exit 0.
2026-10-02 16:11:54 +01:00
Nick 9b765852b8 feat(retrieval-index): Rust strangler candidate — Phase G slice 1
Zero-dependency Rust port of src/rune/query_memory.py (retrieval-index,
RUST-candidate per Phase E admission gate):

- src/rust/query_memory/ — first Rust workspace in the repo
- json_min.rs: hand-rolled JSON parser/serializer mirroring json.dumps
  (preserve-order objects, ensure_ascii escaping, surrogate pairs,
  indent-2 stats shape, f64 shortest-repr parity)
- main.rs: classification core + CLI (record/stats/rate/health),
  TOPIC_KEYWORDS in source insertion order, first-max tie-break,
  adaptive exploration rate (+-0.05 at >=10 queries), UTC isoformat
  parity incl. microsecond-omission law
- parity_test.py: cross-language conformance harness — identical
  command sequence through both implementations in isolated HOMEs,
  byte-parity on history.jsonl (timestamps masked) + topic_stats.json

Observed: cargo build clean; parity harness ALL GREEN (stdout +
both store files) across 24-command sequence covering unicode,
first-max tie-breaks, special chars, adaptive-threshold crossing.

Refs: /tmp/phaseG_retrieval_index_contract.md (C1-C10)
2026-10-02 15:40:12 +01:00
Nick f1e63b703e fix(token_optimizer): include content in CacheEntry.to_dict — closes #770 cache-loss defect
Pre-fix to_dict omitted the required field content, so _load's
CacheEntry(**entry_data) raised TypeError on every reload and the
blanket except silently discarded the whole cache on every restart.

Frozen regression contract tests/test_token_optimizer_cache.py
(3 tests: save_persists_content, roundtrip_restores_content,
corrupt_storage_degrades_to_empty_cache). Full suite 2250/0.
2026-09-30 12:18:35 +01:00
Nick 6d40f94f18 fix(test): hermetic group-liveness probe in TTY no-accumulation test
The test measured 'group-kill leaves nothing behind' via a global
'pgrep -x -c sleep' before/after delta — any unrelated system sleep
starting mid-loop on the runner (mount helpers, cron helpers) landed
in the delta and false-failed. CI run 13255 failed with exactly
'1 NEW sleep survivor' from an ambient sleep, reproduced locally
(/tmp/ambient_proof.mjs: measured_delta 1 from one spawned ambient
sleep).

Fix: probe OUR OWN process groups with kill(-pgid, 0) after the kill
sequence — a live group answers, a fully-reaped group throws ESRCH.
Hermetic to ambient load; negative control (/tmp/hermetic_catch.mjs)
confirms the probe still reports a survivor when the kill is skipped,
so the test's protective intent is preserved.

Verified: test green x3 locally, whole TTY contract file 8/8, fixed
test green under deliberate ambient-sleep bombardment.
2026-09-30 02:07:30 +01:00
Nick 7a869476be fix(forge_client): terminate _request with explicit raise — clears 5 pyright Optional warnings at call sites
_request never returns None (every attempt returns or raises), but the
implicit exhausted-loop path made pyright infer Optional at all 5 call
sites' .json() accesses, pushing the warning ratchet 454→459. The
terminal AssertionError documents exhaustiveness at the source instead
of 5 duplicated guards. Local pyright: errors 109, warnings 447 (≤454).
2026-09-30 01:41:30 +01:00
Nick e5292cce7b feat(forge): add httpx retry/timeout wrapper for transient-failure resilience
- _request() helper in forge_client.py: retry on connect-phase transport
  errors and idempotent-method 5xx/429, exponential backoff, 30s timeout
  default preserved per attempt; create_issue (POST) and list-style GETs
  route through it per retry-where-noise semantics
- frozen contract tests/test_forge_client_resilience.py (10 tests,
  written red-first per the bug-fix contract)
- legacy FakeResponse fixtures updated with status_code=200 (wrapper
  reads status_code for the GET-5xx retry gate)
- httpx wrapper spec: docs/rebase-language-rubric.md W4 named improvement
- model_routing.py:99 probe deliberately EXCLUDED (failure is the
  signal, not noise — one-shot design is the contract)
2026-09-30 01:10:22 +01:00
conductor 396ae120dc chore(release): auto-bump version to 0.89.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-09-30 00:10:51 +01:00
conductor 01b57297b8 chore(release): auto-bump version to 0.88.4 — earned by #2269 (Wave 0: rebase tranche inventory, issue factory, Rust interop proof)
Promotion record: http://192.168.1.156:3000/conductor/rune/pulls/2269
2026-09-30 00:10:04 +01:00
conductor 497db5a144 Merge pull request 'Wave 0: rebase tranche inventory, issue factory, Rust interop proof' (#2269) from tranche-r1-wave-0 into master 2026-09-30 00:09:13 +01:00
Nick 9425ccc1f4 docs(rebase): record executed kill-test dispositions for orjson + inventory items
orjson: microbench on live 3.5MB knowledge.json — load 1.68x (bar 2x FAIL),
dump+decode 1.71x (bar 5x FAIL) => KEEP-PYTHON, no dependency declared.
Inventory correction: DONE via regen (5bc837c); W2 drift claim verified false.
2026-09-30 00:00:57 +01:00
Nick 3ed547f86f chore(deps): re-resolve ci lock after upstream platformdirs 4.12.2 release
Dep-lock drift ratchet red on CI run 13207. Documented regen path:
uv pip compile --upgrade. Only the pin moved.
2026-09-29 23:55:18 +01:00
Nick 5bc837c232 fix(rebase): regenerate inventory — drop deleted complexity_scorer + 12 stale files, add 49 current (rubric named correction) 2026-09-29 23:23:58 +01:00
Nick 08bc1a6b62 feat(native): add JSONL streaming reader for native units (W7 contract gap)
stream_native(): per-line json.loads over subprocess stdout, progress
events yielded live, terminal envelope validated as the FINAL line,
watchdog timeout with adapter-kill vs unit-death distinction, concurrent
stderr drain. Generator yields event dicts then one terminal NativeResult
(gaining an events field). Malformed interior lines skipped and counted;
a malformed final line invalidates the envelope, so ok=False while partial
progress stays available. Tests use a Python subprocess as the fake
native unit — no Rust build dependency in the test path (house style
from tests/test_native_interop_proof.py).
2026-09-29 23:08:32 +01:00
Nick 201ca05b56 docs(rebase): land FINAL Wave 1 language-fit rubric (40 clusters, 0 recodes) 2026-09-29 23:08:32 +01:00
Nick 5cd90f2104 fix(ci): exempt docs/rebase/** from top-level-docs henxel
The top-level docs henxel (in: ./docs/*) reaches subdirectories —
run 13170 held docs/rebase/rebase-inventory.json and
docs/rebase-wave-coverage.json after the c8bc454 relocation. The
./docs/v1/** precedent in the same except list shows the rule's
recursive reach; the Wave 0 JSON artifacts are machine-generated
data, not docs, and follow the same precedent shape.
2026-09-29 15:09:23 +01:00
Nick c8bc454e33 fix(lint): relocate Wave 0 JSON artifacts to docs/rebase/
The henxels allowed_filetypes rule polices top-level ./docs/* for
markdown/yaml only; machine-generated JSON artifacts are not docs.
Moving rebase-inventory.json and rebase-wave-coverage.json under
docs/rebase/ (outside the single-segment glob) rather than widening
the gate's except list to fit new files. All consumer references
updated (rebase_inventory.py, rebase_issue_factory.py, wave0 report).
2026-09-29 14:47:38 +01:00
Nick b81edb2029 fix(tests): pin event-bus journal into tmp in terminalization helper test
test_terminalization_helper_single_path scanned the ambient
event_bus.JOURNAL_DIR — an import-time-frozen constant resolved via
memory_env.memory_dir(), whose RUNE_HOME defaults to the hardcoded
/mnt/workdrive/rune. On this machine that path coincidentally IS the
repo, so the test passed locally; on the CI runner the default path is
unwritable, emit()'s deliberate degradation swallowed the write, and the
scan found no task.outcome — the sole unit red of 2,219 on run 13155.

Fix pins JOURNAL_DIR/EVENT_LOG to the test's TemporaryDirectory with
addCleanup restore — same isolation-seam family as the hot-store law
(ambient state must never be read by tests). Red-first repro'd with a
hostile RUNE_HOME locally: exact CI signature ([] is not true) before
the pin, green after.
2026-09-29 14:11:30 +01:00
Nick 87a890dce3 fix(ci): regenerate requirements-ci.txt — dep-lock drift from 0.88.3 pyproject bump
Master's auto-bump to 0.88.3 changed pyproject.toml without regenerating
the CI dep lock; the merge carried both sides in (coverage 7.16.1 ->
7.16.2, nodeenv, platformdirs). Canonical regen per
scripts/check_dep_lock.py's documented command, plus --upgrade: uv pip
compile to an EXISTING output file preserves its stale pins as resolver
preferences, so a plain in-place regen silently keeps the old pins.
Measured: same uv, same invocation, -o fresh-path resolves 7.16.2 while
-o requirements-ci.txt kept 7.16.1 until --upgrade was added.
2026-09-29 14:11:30 +01:00
Nick a0821be8a5 fix(rebase): narrow inventory signature-unparse handlers to explicit exception types
Replaces two blind except-Exception-pass handlers in _arg_str/_signature
with (AttributeError, RecursionError, ValueError) and documents the
degraded-metadata contract: a pathological annotation node must never
abort the whole inventory walk.
2026-09-29 13:29:53 +01:00
Nick cb137bd37a Merge remote-tracking branch 'gitea/master' into tranche-r1-wave-0
# Conflicts:
#	.gitignore
#	config/umbrellas.json
2026-09-29 13:26:54 +01:00
Nick 72afb1a55a feat(rebase): wave 0 — whole-project inventory, per-function issue factory, Rust interop proof unit
Wave 0 of the approved language-rebasing tranche (R1):

- scripts/rebase_inventory.py: AST-based whole-project inventory →
  docs/rebase-inventory.json (1,852 true units = 1,030 top-level fns
  + 822 methods; module-level walk skips defs; class-method leak fixed)
- docs/rebase-wave-coverage.json: waves 2–7 coverage {239,251,129,544,415,274}
- scripts/rebase_issue_factory.py: one-issue-per-unit Gitea factory,
  dry-run default, deterministic titles + dedup, --limit defaults to
  unlimited for create; 1,852 issues created across waves 2–7
- interop/rebase-proof + shared/native_units.py + tests: std-only Rust
  proof unit for the §5 native-interop contract (argv→JSON, --version,
  exit 2 on failure); thin typed Python adapter; 8/8 tests pass with
  corrected ok-semantics (ok = exit 0 AND not timed out)
- config/umbrellas.json: native_units registered in capability umbrella
  (manifest law — the map travels with the change)
- docs/rebase-wave0-report.md: Wave 0 close-out report
2026-09-29 12:47:34 +01:00
conductor c9095f5af5 chore(release): auto-bump version to 0.88.3 — earned by # (patch: converged release (push-to-master bump))
Promotion record: (unknown)
2026-09-23 18:16:50 +01:00
conductor b5422f0772 chore(release): auto-bump version to 0.88.3 — earned by #412 (fix(scaffolding): T22 — connect the MiMo edge + apply the meaning gate on the na)
Promotion record: http://192.168.1.156:3000/conductor/rune/pulls/412
2026-09-23 18:16:42 +01:00
conductor da36b99184 Merge pull request 'fix(scaffolding): T22 — connect the MiMo edge + apply the meaning gate on the native path' (#412) from t22-scaffolding-default-path into master 2026-09-23 18:16:35 +01:00
conductor 873d0025ad fix(scaffolding): T22 — cover the new paths; two defects the coverage tests found
Self-review against the CI gates surfaced two genuine defects in the first
commit. Changed-lines coverage is now 85% (floor 70):

1. The bridge projection read the WRONG STORE. `_active_construction_lines`
   built `ConstructionInterface` without `project_store`, so it fell back to
   the interface default instead of the configured construction store — the
   `RUNE_CONSTRUCTION_STORE` override was ignored, so a redirected
   deployment would have projected another project's construction state.
   Fixed: pass `_construction_store()` + the project id.

2. LOST UPDATE between the intent-layer note and the main activation path.
   The degrade path called `_construction_note()`, which does its own
   load/save; the normal path then saved its own stale `doc`, silently
   clobbering the note. Fixed: append the note to the SAME in-memory doc
   (one doc, one save), so the failure is recorded and survives.

New coverage: active-contract projection + capsule rendering + read-only
guarantee; store-resolution override; intent-layer-unavailable degrade path.

Note: the stale TUI banner (`Rune v0.87.6` vs `__version__` 0.88.0) that
this commit also fixed on the old base was fixed independently on master by
the 0.88.2 release bump, so the rebase takes master's banner — nothing to
carry here.
2026-09-23 18:10:07 +01:00
conductor a9ce967557 chore(ci): refresh dependency lock — upstream patch bumps unblock #150 gate
`scripts/check_dep_lock.py` (CI step "#150: deps come ONLY from the pinned
lock") regenerates the lock into a temp path and compares. Three transitive
deps released upstream since the lock was generated, so the check fails for
ANY branch today, independent of the T22 change:

  diff-cover  10.5.1  -> 10.6.0
  multidict   6.9.0   -> 6.9.1
  platformdirs 4.11.11 -> 4.11.12

Regenerated with the exact command the gate instructs. Note: compiling with
`-o requirements-ci.txt` is a NO-OP for the pins (uv prefers the existing
output file's versions); the fresh resolution must be written to a new path
and moved into place, which is what the checker itself does.

No dependency declarations changed (pyproject.toml untouched) — pins only.
2026-09-23 18:09:26 +01:00
conductor eb3a2c681c fix(scaffolding): T22 — connect the MiMo edge and apply the meaning gate on the native path
Reality-wins audit of the accepted Scaffolding V1 system against the live
repo/runtime found three genuine wiring defects (no architecture invented):

1. The MiMo edge was DEAD. `~/.mimocode/hooks/builder-bridge.ts` hardcoded
   the ephemeral interpreter `/tmp/ci-venv/bin/python`, which no longer
   exists, so every bridge call failed and the hook silently degraded —
   MiMo received NO Rune Core preflight at all (zero fire-log lines). The
   hook was also UNVERSIONED (no canonical copy), which is how it rotted.
   Repair: canonical source `config/mimo-hooks/builder-bridge.ts` with
   durable interpreter resolution (env override > repo venv > user venv >
   /usr/bin/python3), installed + hash-verified + drift-checked by
   `install_mimo_hook.py`, which now manages a hook SET rather than one file.

2. The native path skipped the canonical meaning layer. `construction_intent`
   (the §17J/§17L/§17M intent resolver: interrogative structure, negation,
   request modals, referent/proposal resolution) existed but was imported
   ONLY by tests. `rune_operator._construction_activation` went straight to
   `classify_mode`, so a pure question carrying a target reference
   ("explain how this module works") classified EXISTING_PROJECT_CHANGE and
   recorded a construction activation for a discussion turn. Repair: the
   intent layer now resolves MEANING before the ONE classifier decides mode
   (the boundary the intent module documents). DISCUSSION maps to
   NOT_CONSTRUCTION — the canonical vocabulary is unchanged, an explicit
   user override (/scaffold-mode) outranks the gate, and an unavailable
   intent layer preserves the previous behaviour exactly rather than
   silently changing governance.

3. The shared Construction Context reported a TERMINAL contract as active.
   `construction_context()` selected on `status == "open"` alone, so 8
   contracts with phase `abandoned` (terminal) were reported as the active
   construction. Repair: terminal phases are now DERIVED once from the
   canonical transition table (`scaffold.TERMINAL_PHASES`), and a contract
   is active only when its phase is non-terminal.

Also: the bridge capsule now surfaces the active Scaffolding construction
(contract/phase/scope/obligations/next-action) to the builder as a
read-only projection of the shared Construction Context — the MiMo edge of
state Scaffolding already owns. Inject-nothing is preserved when no
contract is active; the projection never mutates and degrades to [].

Spine projection refreshed (import graph legitimately gained importers).

Honest boundary: no byte-level enforcement point exists. `tool_executor.py`
never consults construction state, so the 19A invariant gates only the
/build-start route. Establishing MiMo-surface enforcement is NEW
architecture (a tool.execute.before governance hook) and was NOT built
here — it is recorded as the exact remaining blocker.

Verification: 511 passed across the construction/operator/bridge/hook/
structural/parity suites; native-default matrix 12/12; real operator-path
proof with fresh-process readback (EXISTING_PROJECT_CHANGE activated,
question -> NOT_CONSTRUCTION, PROJECT_BUILD bootstraps scaffold + registry);
installed hook invoked directly -> capsule injected + fire log written.
LOCAL_MODEL_COMPUTE_EXECUTED = NO.
2026-09-23 18:09:26 +01:00
conductor 1bc1cdeaf0 chore(release): auto-bump version to 0.88.2 — earned by #408 (auto-label: stop re-adding managed labels to closed issues (#407))
Promotion record: http://192.168.1.156:3000/conductor/rune/pulls/408
2026-09-20 11:17:13 +01:00
conductor 31565844d7 Merge pull request 'auto-label: stop re-adding managed labels to closed issues (#407)' (#408) from fix-407-autolabel into master 2026-09-20 11:17:04 +01:00
conductor c08b211f0e auto-label: stop re-adding managed labels to closed issues; keyword fallback filing-time only
Root cause of #407: the labels job re-ran its full inference on every
issues event, including 'labeled' events on closed issues. Any label
mutation (human cleanup, bot churn) re-triggered inference, and the
spine-authoritative mapping re-added the type label to the closed issue
(#324: kind bug, closed FIXED_VERIFIED, bug label re-added within
seconds of every removal — making the reconciliation checker
permanently red for that issue).

Fix:
- Closed issues are skipped entirely; post-close label curation
  belongs to humans and the conductor. Labels are filing-time
  metadata.
- The pre-template keyword fallback now runs only on the 'opened'
  action, per its documented scope; edits and label events on
  spine-less issues no longer override human curation.
- Priority gate also skips closed issues (hygiene, same class).

Version intent: patch (workflow behavior fix, no API change).
Verification after merge: remove 'bug' from closed #324, wait >60s
across any label event, confirm no re-add; reconciliation checker
green for #324.
2026-09-20 11:11:30 +01:00
conductor 46c5032208 chore(release): auto-bump version to 0.88.1 — earned by # (patch: converged release (push-to-master bump))
Promotion record: (unknown)
2026-09-19 19:21:40 +01:00
conductor 92584daeef chore(release): auto-bump version to 0.88.1 — earned by #355 (fix(tui): sync banner version surface to 0.88.0)
Promotion record: http://192.168.1.156:3000/conductor/rune/pulls/355
2026-09-19 19:21:33 +01:00
conductor bb5e243c88 Merge pull request 'fix(tui): sync banner version surface to 0.88.0' (#355) from fix-tui-banner-surface into master 2026-09-19 19:21:28 +01:00
conductor ac936a8ba9 fix(tui): sync banner version surface to 0.88.0
The converged-release bump updated __init__/header but missed the TUI
banner string at rune_tui.py:1888; the banner-surface test correctly
failed master CI. The version-surfaces checker watches the header
comment only — banner added to the gap list for the bump workflow.
2026-09-19 19:13:16 +01:00
conductor e6c8c5444d chore(release): auto-bump version to 0.88.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-09-19 18:34:33 +01:00
conductor 11270cb06a chore(release): auto-bump version to 0.87.6 — earned by #354 (await-intent: refresh refs before op-type inference (M10 correction))
Promotion record: http://192.168.1.156:3000/conductor/rune/pulls/354
2026-09-19 18:34:25 +01:00
conductor f8a568714b Merge pull request 'await-intent: refresh refs before op-type inference (M10 correction)' (#354) from m10-derive-refresh into master 2026-09-19 18:34:19 +01:00
conductor c3f81e60ec Merge branch 'master' into m10-derive-refresh 2026-09-19 18:28:51 +01:00
conductor efb99d4682 await-intent: refresh remote refs before op-type inference (M10 correction)
A just-merged master commit was invisible to branch --contains until refs
were fetched: the local clone's stale master outranked repo truth and a
master_ci operation classified as branch_ci. derive_op_type now refreshes
remote-tracking refs (bounded by GIT_TIMEOUT, fail-open) and containment
checks all refs. Generic fix; no SHA special-casing.
2026-09-19 18:23:17 +01:00
conductor 489718ab1b chore(release): auto-bump version to 0.87.5 — earned by #353 (R13/M9 PR-flow live proof (harmless docs marker))
Promotion record: http://192.168.1.156:3000/conductor/rune/pulls/353
2026-09-19 18:02:51 +01:00
conductor 9db580ac6d Merge pull request 'R13/M9 PR-flow live proof (harmless docs marker)' (#353) from r13-m9-pr-proof into master 2026-09-19 18:02:46 +01:00
conductor 80ed978fbf docs: R13/M9 PR-flow live proof marker (harmless, no code change) 2026-09-19 17:57:33 +01:00
conductor 3f119e50d8 chore(release): auto-bump version to 0.87.4 — earned by #352 (Topology: custodian defaults to PC-internal Gitea endpoint)
Promotion record: http://192.168.1.156:3000/conductor/rune/pulls/352
2026-09-19 17:46:52 +01:00
conductor 517379313b Merge pull request 'Topology: custodian defaults to PC-internal Gitea endpoint' (#352) from gitea-internal-endpoint into master 2026-09-19 17:46:42 +01:00
conductor 643f9aa9d1 custodian: default Gitea endpoint = PC-internal (127.0.0.1:3000)
Topology reconciliation 2026-09-19: Gitea migrated Pi->PC. PC automation
uses the internal endpoint (no public DNS / Pi proxy round trip). External
endpoint unchanged for humans: https://gitea.thingscouldgetdicey.online
(Pi Caddy -> PC:3000). GITEA_URL env still overrides.
2026-09-19 17:40:59 +01:00
conductor 61a5082633 chore(release): auto-bump version to 0.87.3 — earned by #351 (Auto-label: declared kind is authoritative for epics; absorption is the filing s)
Promotion record: conductor/rune#351
2026-09-19 16:50:54 +01:00
conductor 9121bbd8b0 Merge pull request 'Auto-label: declared kind is authoritative for epics; absorption is the filing standard' (#351) from auto-label-epic-kinds into master 2026-09-19 16:49:48 +01:00
conductor cba9045982 auto-label: any declared kind is authoritative; absorption is the filing standard
Two defects in one pass:

1. The spine-parsing fix from d96b89b only matched kind: bug|feature|research.
   Epic spines (kind: epic) fell through to the keyword heuristic, which
   re-added 'bug' to epics whose bodies mention fixes (observed live on
   #181/#284 — label respawned within 30s of removal). Now ANY declared kind
   is authoritative: recognized kinds map to labels, any other declared kind
   (epic, ...) gets NO type label and NO guessing. Keywords only apply to
   pre-template issues with no spine.

2. Standard: one open note per idea. Parked ideas live as absorbed checklist
   items in their parent epic; standalone issues only for live work. Applied
   today: #175 absorbed #176-#179; #181 absorbed #182/#183 + watchlist
   #164-#166. Reconciliation artifact updated for all nine closures.

Custodian create_issue and AGENTS.md now carry the standard so future
filing follows it.
2026-09-19 16:42:55 +01:00
conductor 0c92f482a7 chore(release): auto-bump version to 0.87.2 — earned by #350 (Templates: plain-English heading carries the issue summary)
Promotion record: conductor/rune#350
2026-09-19 16:11:27 +01:00
conductor 3120e8ae08 Merge pull request 'Templates: plain-English heading carries the issue summary' (#350) from issue-templates-heading into master 2026-09-19 16:08:34 +01:00
conductor ea3c20e205 templates: heading IS the summary — drop the meta-label
The heading should not announce itself as 'plain English'; it should simply
be the summary in everyday words. Meta-commentary removed from the heading
line, instructions preserved in the comment block.
2026-09-19 16:01:05 +01:00
conductor a93327d107 templates: plain-English heading carries the issue summary
The section header itself must restate the issue title in everyday words,
so a scan of headings alone tells the story of the board. Applied to all
three templates (web-UI + canonical copies) and retrofitted onto all 30
live issues.
2026-09-19 15:41:15 +01:00
conductor e08625f629 chore(release): auto-bump version to 0.87.1 — earned by #349 (Issue templates: parsable spine, plain-English-first, version intent; auto-label)
Promotion record: conductor/rune#349
2026-09-19 15:35:03 +01:00
conductor 021fef2065 Merge pull request 'Issue templates: parsable spine, plain-English-first, version intent; auto-label reads declared kind' (#349) from issue-templates into master 2026-09-19 15:31:49 +01:00
conductor 3788875410 test: pin live-defect record to empty — #324 verified non-reproducing 2026-09-19
The pin asserted the T15 audit's conclusion as permanent. The audit's own
doctrine is demonstrated-currently-incorrect-behaviour; #324 has not
demonstrated in nine days and is closed FIXED_VERIFIED. The pin now
guards the empty record; a new live defect updates it deliberately.
2026-09-19 15:25:04 +01:00
conductor d96b89bd4c issue templates: spine + plain-English + version intent; auto-label reads declared kind
Issues were mash-of-text: unreadable for Nick, unparsable for the pipeline,
and the auto-label workflow guessed 'bug' from keywords — misclassifying
honest prose and fighting the T15 label audit. Changes:

- feature/bug templates: add verifiable close conditions, version-impact
  block (declared at submission, verified at merge), why-still-open field;
  plain English stays first and is the contract
- research template: question, falsifier, budget, durable findings path;
  new 'research' label kind
- custodian create_issue(kind, version_intent): assembles from the
  canonical template, forces the kind label, pre-ticks version intent
- auto-label.yml: type label comes from the declared spine kind; keyword
  guessing only as pre-template fallback
- reconciliation checker: align live-sync bug-label rule with the
  documented open-only exemption
- reconciliation artifact: #158/#162 SUPERSEDED (by #315/#316),
  #324 FIXED_VERIFIED (no longer reproduces), #163 revalidated
2026-09-19 15:08:23 +01:00
conductor efe3871916 test(tty): stabilize no-accumulation test — delta vs pre-loop snapshot of unrelated system sleeps (mount helper sleeps race the window) 2026-09-19 07:24:10 +01:00
conductor 026a1bd919 test(tty): canonical tool hash parity (bash.ts + await-operation.ts) — same contract as hook parity 2026-09-19 07:18:07 +01:00
conductor d9bcebb730 feat(tty): MiMo harness process-ownership contract — group-killed bash execution + explicit detachment
TTY-repair tranche: bash.ts v2 replaces bare execSync with a
process-group-owned spawn wrapper (MODE A: captured pipes, own pgid,
SIGTERM->SIGKILL group kill on timeout, listener teardown before
finalize) and an explicit detached mode (MODE B: setsid, stdin
/dev/null, output to a durable log file, unref) for nohup/setsid/&-
suffixed commands. Wait-intent compilation preserved with a STRICT
gate (normalized=true + ContinuePendingOperation + concrete operation
bound); arbitrary shell syntax passes through untouched. execFile
with argv array (no nested sh -c quoting) for the router call.
await-operation.ts pinned as canonical source (accepted healthy path,
unchanged). scripts/install_mimo_tools.py installs + hash-verifies.
tests/test_mimo_tty_contract.py: 8 tests (A-I incl. fd-no-pts,
group-kill, no-accumulation, quoting, wait-intent boundary,
await-op preservation).
2026-09-19 07:16:35 +01:00
conductor 2b2639783a chore(r8): qualify attempt-1 type-check cause as LIKELY_CPU_CONTENTION/CAUSE_UNCONFIRMED (S110 remains proven) 2026-09-19 06:39:11 +01:00
conductor 634821efd4 chore(r8): LOST_EVENT_RECOVERY PASS — live lost-event proof + canonical evidence
Live fault-injection proof (attempt 3, ci-c6c18ae): completion event
deliberately suppressed at the producer for one operation; first
watchdog failure-detector window (303s) consulted ci_runs authority,
recovered terminal success truthfully
(watchdog_authority_recovered), SAME await-operation invocation
returned, next MiMo turn automatic, R8_PROOF_COMPLETE, natural exit
rc=0. Attempt 1 (ci-89b6030) additionally proved truthful FAILURE
recovery (source CI genuinely red via S110 ratchet; seam defect fixed
in c6c18ae). Late-event idempotence: released event matched=0,
terminal state untouched, resume_attempts=0. All
FAILURE_RECOVERY_* targets met; SILENT_LOSS=0,
STATE_CONTRADICTION=0. Healthy-path hashes unchanged; fault rule
removed; deterministic suites 50/50.
2026-09-19 06:33:48 +01:00
conductor c6c18ae041 fix(r8): silent-handler ratchet compliance in fault seam — log instead of pass
The two catch-all handlers added in dac6e97 (r8_fault.record evidence
write, notify_event_bridge seam probe) tripped the #126 silent-handler
ratchet (S110 75 -> 77), which cascaded to the lint-baseline contract
test. Both handlers now log to stderr/stdout and continue — the seam
stays fail-open but is no longer silent. S110 back to 75=75.
2026-09-19 06:12:38 +01:00
conductor e03ad9aad9 chore(r8): latency-label terminology correction + lost-event fault seam landed with acceptance artifact
0. Evidence terminology only (no gate reinterpretation): acceptance
   latencies relabeled per primary artifacts — SOURCE_TO_TOOL_RETURN
   61.802s, TOOL_RETURN_TO_MODEL_TURN 13.636s, SOURCE_TO_MODEL_TURN
   75.438s (formerly mislabeled SOURCE_TO_MODEL_RESUME).
   REAL_ASYNC_BRIDGE_COMPLETE unchanged.
R8 seam (already committed dac6e97, included in this merge-tracking
   state): operation-scoped suppression rule, fail-open, evidence-
   logged; 7 seam tests.
2026-09-19 05:25:45 +01:00
conductor 89b603024e merge remote event-driven-clean (master merge) before R8 push 2026-09-19 04:59:53 +01:00
conductor dac6e97e16 feat(r8): operation-scoped lost-event fault-injection seam (disabled by default)
REAL_ASYNC_BRIDGE R8: narrowest reversible fault for lost-event
failure-recovery. scripts/r8_fault.py consults
$RUNE_WR_ROOT/r8_suppress_rules.json keyed by EXACT operation_id;
notify_event_bridge.py records the suppression decision (no .done file,
no bridge POST) and returns, so the waiter's watchdog/authority
recovery path is the only route to terminal truth. Fail-open design:
absent/corrupt rule file means normal delivery. Evidence appended to
r8_fault_log.jsonl. Healthy-path delivery semantics untouched
(guard clause only). Tests: tests/test_r8_fault_injection.py (7).
2026-09-19 04:59:07 +01:00
conductor fe45c6a8dd chore(release): auto-bump version to 0.87.0 — earned by #348 (feat(event-driven): REAL_ASYNC_BRIDGE acceptance persistence + gate reconciliati)
Promotion record: conductor/rune#348
2026-09-19 04:07:52 +01:00
conductor c7b2edd4fc Merge pull request 'feat(event-driven): REAL_ASYNC_BRIDGE acceptance persistence + gate reconciliation' (#348) from event-driven-clean into master 2026-09-19 04:06:21 +01:00
conductor 96f0e7e263 Merge branch 'master' into event-driven-clean 2026-09-19 03:59:45 +01:00
conductor a168cd935e chore: retrigger PR CI (umbrella propagation body now present; push CI green at 9485) 2026-09-19 03:52:45 +01:00
conductor a2c4a11b0d chore(deps): refresh lock — platformdirs 4.11.10 -> 4.11.11 (upstream release drift)
Root cause of the six consecutive CI lint failures (9464/9467/9471/9472/
9480/9479): the dep-lock ratchet correctly detected upstream drift
(platformdirs 4.11.11 released; uv pip compile regenerates a different
lock). Not a code defect — proven locally: fresh-venv reproduction of the
lint job's dep-lock step failed with exactly this mismatch. Remedy per
#150: regenerate + commit.
2026-09-19 03:45:01 +01:00
conductor 16164c6f5e style: ruff-format branch-added python files
CI lint's format-check on added files (base-range dependent) failed on
files that predate the format gate's effective coverage. Formatting-only:
no semantic changes; integration tests 15/15, ruff check clean, ratchet
PASS, daemon convergence re-verified.
2026-09-19 03:32:24 +01:00
conductor 0722dc2339 chore: retrigger CI (transient duplicate-run nondeterminism: 9464/9467 failure vs local lint-clean + 2196/0; documented quirk remedy) 2026-09-19 03:08:51 +01:00
conductor a7ec1b49d7 chore(event-driven): acceptance persistence + gate reconciliation + lost-event spec — REAL_ASYNC_BRIDGE healthy path COMPLETE
Acceptance evidence (store/scaffold/real_bridge_final_acceptance.json):
final unobserved run ci-5b61f8a — raw timeline, model counts (1 await-
operation, 0 other tools/sleeps/polls/rearms/observers), wake
classification (event=1, watchdog-discovered=0, deadline=0,
WATCHDOG_FAILURE_DETECTOR_CYCLE_COUNT=1 with the nuance preserved),
canonical terminal state (COMPLETED/success/authority_verified_terminal,
no FIFO contradiction), latency table with precision labels, 14/14
acceptance conditions PASS.

Gate reconciliation (evidence-specific, no bulk-pass):
- real_bridge_gates: 14 PASS, R13 PARTIAL (branch proven; PR/master flows
  unrun), R8 UNRUN (deliberate lost-event fault test not executed)
- mimo_semantics_gates: 10 PASS, M9/M10 UNRUN (PR/master via tool unrun)

Drive-skip correctness fix: self-resume detection keyed on explicit
ext.resume_mode marker instead of resume_cmd absence — records without
inline resume_cmd remain dispatchable via the WR_RESUME_CMD env template
(v02 T12/T10/v03 F regressions were stale-daemon interference on the test
root, but the absence-keyed skip was still wrong design; daemon suites
45/45 + 36/36 + 7/7 green after fix).

Lost-event FAILURE-RECOVERY spec persisted (lost_event_recovery_spec.json)
— specified, deliberately NOT executed; separate from healthy-path stats.

Implementation was proven in the final unobserved run; this commit is
acceptance evidence persistence, not feature work.
2026-09-19 02:59:15 +01:00
conductor 5b61f8a8bb chore(event-driven): diagnostic run evidence — full B-chain observed (contaminated window, superseded by final unobserved run) 2026-09-19 02:01:18 +01:00
conductor c730719768 chore(release): auto-bump version to 0.86.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-09-19 01:49:42 +01:00
conductor 4fe0f8ee46 chore(release): auto-bump version to 0.86.0 — earned by #347 (feat(event-driven): completion-file inotify bridge + operation-id-first tool)
Promotion record: conductor/rune#347
2026-09-19 01:48:20 +01:00
conductor 8999f29041 Merge pull request 'feat(event-driven): completion-file inotify bridge + operation-id-first tool' (#347) from event-driven-clean into master 2026-09-19 01:47:49 +01:00
conductor c288f4726d merge: integrate master (v0.85.9 auto-version) into event-driven-clean 2026-09-19 01:41:10 +01:00
conductor 308bbb74b7 feat(event-driven): final integration seam — state ownership, orphan recovery, CLI contract, daemon governance, task binding
§2/§3 state ownership: register_process_wait resume_mode ('fifo' default
preserves T15; 'self' = waiter owns continuation via completion-file
inotify, NO resume_cmd). ci_event_wait registers self-mode and stamps
durable terminal operation state (COMPLETED/FAILED + authority evidence)
before the envelope — a dead session can no longer downgrade operation
truth. Daemon drive skips resume_cmd-less waits; resume() re-reads and
never touches terminal records.

§4 orphan sweep: bounded periodic reconciliation of RESUMING waits past
ORPHAN_GRACE_SECS (failure detection, not scheduling) — truthful
RESUME_UNVERIFIED/READY_TO_RETRY + lease release; deterministic tests.

§5 CLI contract: ci_event_wait parses strictly; --watchdog supported;
unknown flags exit 2 loudly. No silent argument loss.

§6 governance: canonical daemon source IN REPO (bridge/daemon/);
scripts/install_wr_daemon.py installs atomically + verifies sha256
convergence (--check/--restart). One implementation, one deploy path.

§9 task binding: --task-id through cli/tool; task-bound resolution scopes
pending operations; stored operation wins over model hints; fresh
explicit-id operations normalize provisionally (ghost shas refused).

tests/test_real_async_integration.py: 10 frozen tests. Full suite 2196/0.
2026-09-19 01:40:34 +01:00
conductor 1f01e87453 Merge branch 'master' into event-driven-clean 2026-09-19 01:06:13 +01:00
conductor 4e8e081f48 feat(event-driven): completion-file producer in CI notify + wr-root env harmonization
- notify_event_bridge: writes durable resumes/<operation_id>.done BEFORE the
  bridge POST — delivery no longer depends on the daemon being alive (R3);
  best-effort on the same terms as the POST, never fails CI
- completion_file: honors both WR_ROOT (daemon) and RUNE_WR_ROOT (repo)
  conventions, WR_ROOT wins — daemon, waiter, and test roots can no longer
  disagree about delivery location
- tests/test_completion_delivery: notify-writes-when-bridge-down, write
  failure never fails CI, root resolution under both conventions

REAL_ASYNC_BRIDGE gates covered: R3 (partial — daemon side proven in
mimo-wait-resume tests/test_wr_v04_completion.py: 7/7 incl. R4 7ms wake,
R9 durability, R10 byte-identical duplicates)
2026-09-19 00:56:19 +01:00
conductor 6c681b97bf chore(release): auto-bump version to 0.85.9 — earned by # (patch: converged release (push-to-master bump))
Promotion record: (unknown)
2026-09-19 00:25:51 +01:00
conductor d01d6eb6d4 feat(event-driven): completion-file inotify delivery + operation-id-first tool + M/R gates
- scripts/completion_file.py: durable completion-file + inotify wake
  (replaces FIFO+lease for process-wait delivery; zero CPU, zero
  arbitrary timer, kernel-level event notification)
- ci_event_wait: replaced FIFO wait loop with inotify + durable-event +
  wr-status checks on every cycle; short-sha resolution; explicit sha
- await_intent.py: no-sha auto-resolution from pending operations
- await-operation.ts: operation_id-first schema; sha/op_type/deadline
  are optional hints (non-authoritative)
- M/R gate objects: 28 gates total across M-patch + real-bridge
2026-09-19 00:13:06 +01:00
conductor f90695197d fix(event-driven): durable-event + wait-record recheck on every cycle + H-matrix tests
- Every cycle checks: wr status (daemon may transition to COMPLETED),
  durable event log (find_matching_event), completion file (inotify)
- Removed debug print, relaxed test timing for inotify+disk I/O path
- All 11 ci_event_wait + 32 other wait tests green
2026-09-19 00:11:51 +01:00
Nick 279c2b86cb chore(event-driven): recomputed 18/18 gates — EVENT_DRIVEN_CONTINUATION_COMPLETE (truthful evidence, clean window)
Previous 18/18 was truthfully superseded (supersession note): H8/H15/H18
were contradicted by raw evidence. Root causes for 9db239f/51416aa
deadline_pending success: orphaned lease + timer-blind re-arms +
runs-list page flood + short-sha equality failure. ALL FIXED.

Final evidence commit: 57206b7 == deployed == runtime == v0.85.8.
Clean-window: one logical await per flow; zero pending-exposed-to-model;
zero manual internal APIs; zero literal external sleeps.
2026-09-18 20:08:51 +01:00
conductor 57206b7b31 chore(release): auto-bump version to 0.85.8 — earned by # (patch: converged release (push-to-master bump))
Promotion record: (unknown)
2026-09-18 19:30:36 +01:00
conductor b69ffcd44f chore(release): auto-bump version to 0.85.8 — earned by #346 (fix(event-driven): resolve short SHAs to full 40-char before authority read)
Promotion record: conductor/rune#346
2026-09-18 19:28:49 +01:00
conductor c4b4ebd0af Merge pull request 'fix(event-driven): resolve short SHAs to full 40-char before authority read' (#346) from deadline-return-fix into master 2026-09-18 19:27:46 +01:00
conductor 4220621cb0 Merge branch 'master' into deadline-return-fix 2026-09-18 19:21:10 +01:00
Nick 4b54451444 fix(event-driven): resolve short SHAs to full 40-char before authority read — 12-char prefix silently failed _fetch_runs equality (962e351 root cause) 2026-09-18 19:14:23 +01:00
conductor 962e3511e1 chore(release): auto-bump version to 0.85.7 — earned by # (patch: converged release (push-to-master bump))
Promotion record: (unknown)
2026-09-18 17:30:12 +01:00
conductor fb809135c6 chore(release): auto-bump version to 0.85.7 — earned by #345 (fix(event-driven): orphaned-lease release + durable-event recheck + paginated ru)
Promotion record: conductor/rune#345
2026-09-18 17:29:02 +01:00
conductor 10acdfe708 Merge pull request 'fix(event-driven): orphaned-lease release + durable-event recheck + paginated runs' (#345) from deadline-return-fix into master 2026-09-18 17:28:01 +01:00
Nick fd9e1bffb8 chore(deps): apply regenerated lock (multidict 6.9.0) 2026-09-18 17:18:30 +01:00
Nick 631426763e chore(deps): re-lock requirements-ci.txt (upstream multidict 6.9.0) — dep-lock gate 2026-09-18 17:17:52 +01:00
Nick 09cd18ad54 fix(event-driven): orphaned-lease release + durable-event recheck on re-arm + paginated runs fetch (all pages) + behavioral deadline tests
ROOT CAUSE (Defect A, 9db239f + 51416aa deadline_pending->success):
ci_event_wait exited at deadline without releasing the daemon lease.
The orphaned lease blocked the daemon from writing resume tokens to
the FIFO for re-registered waits — so completion events that WERE
persisted (10:43:01 for 9db239f, 12:01:49 for 51416aa) could never be
delivered to a later waiter. Additionally: internal re-arms were
timer-blind (no durable-event recheck), and _fetch_runs used a single
50-run page (scheduled merge-robot floods push older SHAs past it).

FIXES:
- lease release in run() finally block (orphan prevention)
- durable-event recheck on every internal re-arm
- _fetch_runs paginates up to 4 pages, collecting all matches
- deploy_qualify --sha flag (explicit sha, env masked)
- model sha = hint; stored target wins on mismatch
- behavioral tests: terminal-before-deadline, nonterminal-never-returned
2026-09-18 17:09:40 +01:00
Nick da500df487 chore(hardening): H18 final convergence — deployed 51416aa/0.85.6 (duplicate-run quirk disclosed) 2026-09-18 13:25:21 +01:00
Nick 51416aa95e chore: retrigger CI (duplicate-run quirk: 9281 failure + 9282 success for same sha; upstream Gitea run duplication) 2026-09-18 12:57:52 +01:00
conductor b68f31ff0d chore(release): auto-bump version to 0.85.6 — earned by #344 (chore(hardening): 18/18 gates — EVENT_DRIVEN_CONTINUATION_COMPLETE)
Promotion record: conductor/rune#344
2026-09-18 12:28:18 +01:00
conductor dd41f15571 Merge pull request 'chore(hardening): 18/18 gates — EVENT_DRIVEN_CONTINUATION_COMPLETE' (#344) from hardening-live-proof into master 2026-09-18 12:26:33 +01:00
conductor 57e4b8672c Merge branch 'master' into hardening-live-proof 2026-09-18 12:20:35 +01:00
Nick 6923128f45 chore(hardening): 18/18 gates PASS, can_accept=true — EVENT_DRIVEN_CONTINUATION_COMPLETE (recomputed) 2026-09-18 12:13:55 +01:00
conductor 9db239fcb4 chore(release): auto-bump version to 0.85.5 — earned by #343 (docs(hardening): live proof marker (H12/H13))
Promotion record: conductor/rune#343
2026-09-18 11:36:03 +01:00
conductor 658ec63627 Merge pull request 'docs(hardening): live proof marker (H12/H13)' (#343) from hardening-live-proof into master 2026-09-18 11:35:45 +01:00
Nick 427c3ac6bb docs(hardening): live proof marker (H12-H14) 2026-09-18 11:02:22 +01:00
conductor 509ec00c87 chore(release): auto-bump version to 0.85.4 — earned by #342 (fix(hardening): operation-identity authority — explicit sha end-to-end)
Promotion record: conductor/rune#342
2026-09-18 10:34:26 +01:00
conductor bea523a0e3 chore(release): auto-bump version to 0.85.4 — earned by # (patch: converged release (push-to-master bump))
Promotion record: (unknown)
2026-09-18 10:33:03 +01:00
conductor 0a15a1675d Merge pull request 'fix(hardening): operation-identity authority — explicit sha end-to-end' (#342) from hardening-authority-identity into master 2026-09-18 10:31:33 +01:00
Nick 81c6d1f9c6 fix(hardening): operation-identity authority — explicit sha end-to-end, paginated runs fetch, model-sha-as-hint
Defect A root cause: Gitea runs-list page flood (scheduled merge-robot
runs push relevant SHAs past the limit=50 first page) + collect-only-
first-page pagination -> terminal commit read as pending -> parked until
deadline. FIX: _fetch_runs paginates up to 4 pages collecting all matches
before verdict.

Defect B root cause: authority_verdict spawned deploy_qualify reading
DEPLOY_SHA from ambient env. FIX: explicit --sha arg (env masked when
sha is explicit); _ci_runs_verdict/op_ci_alive take sha as parameter
only; no env read remains in the authority path.

Defect C root cause: model sha treated as lookup key — a typo derived a
ghost operation. FIX: model sha is a HINT; unresolved sha + single
pending op -> stored target used with model_sha_mismatch logged; bound
op always wins over hints. deploy_qualify gained --sha flag (env kept
for workflow backward-compat only).

Tests: H-matrix (identity, prefix collision, env staleness,
monotonicity, aggregator lag, operation-id-first) + full 2179 suite.
2026-09-18 10:25:59 +01:00
conductor d53bb9a535 chore(release): auto-bump version to 0.85.3 — earned by #341 (chore(event-driven): E13 final convergence evidence)
Promotion record: conductor/rune#341
2026-09-18 04:28:45 +01:00
conductor 023151acb9 Merge pull request 'chore(event-driven): E13 final convergence evidence' (#341) from event-driven-gates-evidence into master 2026-09-18 04:26:47 +01:00
conductor 2da9305d96 Merge branch 'master' into event-driven-gates-evidence 2026-09-18 04:21:24 +01:00
Nick 2e05ea6848 chore(event-driven): E13 final convergence evidence — deployed 05f2a74/0.85.2 after CI retrigger 2026-09-18 04:14:27 +01:00
Nick be161c2043 chore: retrigger CI (type-check transient on 1c5dc55; local fresh-venv ratchet PASS 447/454) 2026-09-18 04:14:27 +01:00
conductor a6539986b9 chore(release): auto-bump version to 0.85.2 — earned by # (patch: converged release (push-to-master bump))
Promotion record: (unknown)
2026-09-18 04:14:27 +01:00
conductor 8da216d155 chore(release): auto-bump version to 0.85.2 — earned by #340 (fix(event-driven): authority resilience — status-404 fallback)
Promotion record: conductor/rune#340
2026-09-18 04:14:27 +01:00
Nick 05f2a74c6f chore: retrigger CI (type-check transient on 1c5dc55; local fresh-venv ratchet PASS 447/454) 2026-09-18 03:46:55 +01:00
conductor 1c5dc557a6 chore(release): auto-bump version to 0.85.2 — earned by # (patch: converged release (push-to-master bump))
Promotion record: (unknown)
2026-09-18 03:18:19 +01:00
conductor a6bccc1c5d chore(release): auto-bump version to 0.85.2 — earned by #340 (fix(event-driven): authority resilience — status-404 fallback)
Promotion record: conductor/rune#340
2026-09-18 03:16:27 +01:00
conductor f208b5e61c Merge pull request 'fix(event-driven): authority resilience — status-404 fallback' (#340) from event-driven-continuation into master 2026-09-18 03:15:46 +01:00
conductor aa800acbad Merge branch 'master' into event-driven-continuation 2026-09-18 03:09:04 +01:00
Nick 30be2c96b8 chore(deps): apply regenerated lock (platformdirs 4.11.10) 2026-09-18 02:59:55 +01:00
Nick ca00be8259 chore(deps): re-lock requirements-ci.txt (upstream platformdirs 4.11.10) — dep-lock gate 2026-09-18 02:59:04 +01:00
Nick 50a63e587f fix(event-driven): authority resilience — commit-status 404 fallback to runs-based verdict
Gitea's combined commit-status endpoint can 404 for the newest commit
(observed live on auto-version bump commits: status object materializes
late). When deploy_qualify returns pending AND the status endpoint is
unreadable, fall back to the operation-scoped Actions-runs verdict (same
evidence the two legs read). Also export DEPLOY_SHA in run() for python
callers. Found via E10 fresh-process proof.
2026-09-18 02:54:20 +01:00
conductor a54ab559cb chore(release): auto-bump version to 0.85.1 — earned by #339 (chore(event-driven): 16/16 gates — EVENT_DRIVEN_CONTINUATION_COMPLETE)
Promotion record: conductor/rune#339
2026-09-18 01:28:33 +01:00
conductor 599c3ab1c2 Merge pull request 'chore(event-driven): 16/16 gates — EVENT_DRIVEN_CONTINUATION_COMPLETE' (#339) from event-driven-continuation into master 2026-09-18 01:27:35 +01:00
conductor 483bfd7944 Merge branch 'master' into event-driven-continuation 2026-09-18 01:21:47 +01:00
Nick 1650b470c6 chore(event-driven): 16/16 gates PASS, can_accept=true — EVENT_DRIVEN_CONTINUATION_COMPLETE 2026-09-18 01:15:08 +01:00
conductor 853cf3e0ae chore(release): auto-bump version to 0.85.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-09-18 00:47:49 +01:00
conductor 875bb792f7 chore(release): auto-bump version to 0.85.0 — earned by #338 (feat(event-driven): structured-state routing + event-triggered cognition)
Promotion record: conductor/rune#338
2026-09-18 00:46:00 +01:00
conductor f06ddb3a20 Merge pull request 'feat(event-driven): structured-state routing + event-triggered cognition' (#338) from event-driven-continuation into master 2026-09-18 00:45:16 +01:00
Nick 2ebd9da139 feat(event-driven): structured-state routing + event-triggered cognition
- PendingOperation = durable continuation object: continuation_state
  (ACTIVE_REASONING/WAITING_EXTERNAL/RESUMABLE/RECOVERY_REQUIRED),
  canonical op_type/authority, task_id — parked cognition is a first-class
  durable state a fresh process can read
- ci_event_wait stamps cognitive-state transitions (WAITING_EXTERNAL on
  park, RESUMABLE/RECOVERY_REQUIRED on terminal)
- DEPLOY_SHA export fix: CLI/python run() consumers previously got a
  silent 'pending' authority verdict forever — the authority subprocess
  never received the sha (found via E10 fresh-process proof)
- await_intent_cli route-bash: Bash commands expressing external wait
  intent compile to the canonical continuation (new bash.ts harness tool
  routes through it); plain local sleeps execute normally
- tests/test_await_intent.py: E-matrix (derivation truth table,
  provenance order, observability)
2026-09-18 00:39:23 +01:00
conductor 65001196d8 chore(release): auto-bump version to 0.84.2 — earned by #337 (chore(async-intent): 13/13 gates — ASYNC_INTENT_NORMALIZATION_COMPLETE)
Promotion record: conductor/rune#337
2026-09-17 23:37:23 +01:00
conductor 76bb2b97be Merge pull request 'chore(async-intent): 13/13 gates — ASYNC_INTENT_NORMALIZATION_COMPLETE' (#337) from async-intent-live-proof into master 2026-09-17 23:36:25 +01:00
conductor e765f654f9 Merge branch 'master' into async-intent-live-proof 2026-09-17 23:31:09 +01:00
Nick f7141200bd chore(async-intent): 13/13 gates PASS, can_accept=true — ASYNC_INTENT_NORMALIZATION_COMPLETE (normalization observability log included) 2026-09-17 23:25:33 +01:00
conductor 53b4830b08 chore(release): auto-bump version to 0.84.1 — earned by #336 (docs(async-intent): live proof marker (A8/A9))
Promotion record: conductor/rune#336
2026-09-17 22:57:07 +01:00
conductor fa1b7c4be1 Merge pull request 'docs(async-intent): live proof marker (A8/A9)' (#336) from async-intent-live-proof into master 2026-09-17 22:56:32 +01:00
Nick 246f26663d docs(async-intent): live-proof marker for A8-A10 workflows 2026-09-17 22:19:35 +01:00
conductor 5718a3ea85 chore(release): auto-bump version to 0.84.0 — earned by # (minor: converged release (push-to-master bump))
Promotion record: (unknown)
2026-09-17 22:04:28 +01:00
conductor 02802f321f chore(release): auto-bump version to 0.84.0 — earned by #335 (feat(async-intent): intent normalization at the execution boundary)
Promotion record: conductor/rune#335
2026-09-17 22:02:43 +01:00
conductor 4ce121a493 Merge pull request 'feat(async-intent): intent normalization at the execution boundary' (#335) from async-intent-normalization into master 2026-09-17 22:02:15 +01:00
1081 changed files with 1950110 additions and 3358 deletions

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
---
name: land
description: Review and land one small Rune change through the governed PR workflow.
disable-model-invocation: true
metadata:
delta-action: land
---
# Land one small diff
1. Read applicable `AGENTS.md` rules and the repo's PR/merge workflow.
2. Confirm the issue, exact diff, target branch, and permission to publish and land.
3. Keep one small, reversible change; preserve unrelated work.
4. For bugs, follow `docs/bugfix-contract.md`: red test first, root cause, discharge.
5. Run required tests, static analysis, canaries, and henxels; record results.
6. Get independent `/review` per `docs/adversarial-review.md`; clear blockers.
7. Inspect remotes; publish the PR to the approved forge, never `local`.
8. Require human approval and green required CI on the exact PR head; recheck changed heads.
9. Load `report-landed`; use the repo's merge workflow. Stop on conflicts; never force-push or bypass hooks.
10. Verify the target commit and CI, then report the actual landing result and remaining blockers.
BIN
View File
Binary file not shown.
+4
View File
@@ -15,6 +15,9 @@
# Canary files are omitted: src/rune/canary_*.py are standalone CI
# verification scripts executed directly by the canary job, never imported by
# the test suite — counting them would make the global floor a fiction.
# ffi_query_memory_smoke.py is the same class: a standalone evidence script
# driven directly (and by tests/test_ffi_query_memory_smoke.py when the cdylib
# is built), never imported by the suite.
[run]
source = src/rune
@@ -22,6 +25,7 @@ omit =
tests/*
scripts/*
src/rune/canary_*.py
src/rune/ffi_query_memory_smoke.py
[report]
fail_under = 29
+35 -9
View File
@@ -1,16 +1,46 @@
---
name: Bug Fix
about: Fix a bug or issue
about: Demonstrate currently incorrect behaviour — plain English first, proof required
title: "[BUG] "
labels: bug
assignees: conductor
---
## Plain summary
<!-- 2-4 sentences, NON-TECHNICAL: what's broken and why it matters. -->
<restate the issue title here in everyday words — this heading IS the
plain-English summary; no meta-labels like "plain English" in it>
<!-- The heading above carries the summary itself — a scan of issue
headings alone should tell the whole story of the board. TOP PRIORITY:
if a technical detail below contradicts this section, the issue is
buggy — fix the issue. -->
<!-- SUBMITTED_BODY -->
## Example
<!-- A concrete before/after: "Doing X currently produces Y; it should produce Z." -->
What is broken: <what a person observes going wrong>
What should happen instead: <the correct behaviour>
How often / when: <always | after X | since change Y>
## Proof it is broken (required — no proof, no bug)
<!-- A bug is DEMONSTRATED currently incorrect behaviour. Nothing else.
If this section cannot be filled, file it as a question, not a bug. -->
- [ ] Reproduction command or steps (deterministic where possible)
- [ ] The exact wrong output observed: <paste/log excerpt>
- [ ] Where the evidence lives: <log path, fixture, session id>
## Steps to reproduce
<!-- How to trigger the bug -->
## What would let us close this
- [ ] The reproduction command now shows correct behaviour
- [ ] A regression test exists that fails before the fix and passes after
- [ ] No other behaviour changed (or changes are listed and justified)
## Version impact (declared at submission — verified at merge)
<!-- A bug fix is USUALLY a patch. Pick major or minor only with a reason. -->
- [ ] patch — same behaviour, done correctly (usual for bugs)
- [ ] major — the bug was in a published contract and fixing it breaks consumers (justify)
- [ ] minor — fixing revealed a missing capability that had to be added (justify)
## Technical details
<!-- WHAT (the bug) / WHERE (files) / EVIDENCE (how it was confirmed). -->
@@ -29,10 +59,6 @@ assignees: conductor
- [ ] Canary passes (name)
- [ ] Closed with a properly formatted closing comment + commit references
## Steps to reproduce
<!-- How to trigger the bug -->
## Cognitive invariants (memory/cognition issues — both handoffs)
<!-- Complete ONLY if this issue touches memory, learning, or self-model state. -->
- [ ] **Owner** — which existing subsystem owns this (audit before creating modules)
+33 -8
View File
@@ -1,18 +1,44 @@
---
name: Feature Request
about: New feature or improvement — DESCRIPTION GATE v4 format (plain summary + pipeline requirements)
about: New feature or improvement — plain English first, verifiable close conditions, version intent
title: "[FEATURE] "
labels: feature
assignees: conductor
---
## Plain summary
<!-- 2-4 sentences, NON-TECHNICAL: what this does and why it matters. Nick should
understand the goal without decoding internals. -->
<restate the issue title here in everyday words — this heading IS the
plain-English summary; no meta-labels like "plain English" in it>
<!-- The heading above carries the summary itself — a scan of issue
headings alone should tell the whole story of the board. TOP PRIORITY:
if a technical detail below contradicts this section, the issue is
buggy — fix the issue. A non-technical reader must be able to retell this
section. 3-6 sentences, no jargon. -->
<!-- SUBMITTED_BODY -->
What is this about: <what>
Why do we need it: <the itch — what happens today that shouldn't, or what becomes possible>
Why is it still open: <"not started yet" | "part done, X remains" | "deliberately parked as a future idea">
## Example
<!-- A concrete example of the intended behavior, in plain terms:
"If X happens, the system will Y instead of Z." -->
<!-- A concrete before/after in plain terms: "If X happens, the system will Y instead of Z." -->
## What would let us close this
<!-- Checkable statements, verifiable by looking at something that EXISTS —
a file, a log line, a passing test. Not "when appropriate". -->
- [ ] <condition 1 — observable>
- [ ] <condition 2>
## Version impact (declared at submission — verified at merge)
<!-- The pipeline derives the real bump from merged conventional commits and
compares against this declaration. A mismatch is flagged, not fatal:
either the declaration was wrong or the work grew. Both facts matter. -->
- [ ] major — breaking: changes a contract, schema, or interface others depend on
- [ ] minor — new capability: something becomes possible that wasn't
- [ ] patch — repair: same behaviour, done correctly
- [ ] none — touches no released artifact (docs, memory, process notes)
## Technical details
<!-- WHAT — one-line objective.
@@ -37,7 +63,6 @@ DEPENDENCIES — parent epic + preceding stage/plan refs. -->
- [ ] Canary passes (name)
- [ ] Closed with a properly formatted closing comment + commit/PR references
## Cognitive invariants (memory/cognition issues — both handoffs)
<!-- Complete ONLY if this issue touches memory, learning, or self-model state. -->
- [ ] **Owner** — which existing subsystem owns this (audit before creating modules)
@@ -69,4 +94,4 @@ Hard invariants: derived cognition preserves evidentiary ancestry · epistemic c
- [ ] **P0 — critical** — breaks the spine / core correctness, or blocks other work
- [ ] **P1 — high** — material user value or a real defect (money, correctness bugs, next-stage dependency)
- [ ] **P2 — medium** — quality/consolidation improvement (check the fold-into mapping first)
- [ ] **P3 — low** — measurement / benchmark / deferred policy
- [ ] **P3 — low** — measurement / benchmark / deferred policy
+76
View File
@@ -0,0 +1,76 @@
---
name: Research Submission
about: Buy down uncertainty before building — question, falsifier, budget, durable findings
title: "[RESEARCH] "
labels: research
assignees: conductor
---
<restate the issue title here in everyday words — this heading IS the
plain-English summary; no meta-labels like "plain English" in it>
<!-- The heading above carries the summary itself — a scan of issue
headings alone should tell the whole story of the board. TOP PRIORITY:
if a technical detail below contradicts this section, the issue is
buggy — fix the issue. -->
<!-- SUBMITTED_BODY -->
The question: <what we're trying to learn, one sentence>
Why we're asking: <what decision this research will inform — a name, an issue
number, or "exploratory: none yet">
What we believe today: <the current assumption, stated so it can be proven wrong>
## The shape of an answer
- [ ] What evidence would settle the question: <observation, benchmark, or spike>
- [ ] What evidence would KILL the current assumption (the falsifier): <be specific —
this is stated BEFORE starting so the research cannot become a search for confirmation>
- [ ] Budget: <time/effort cap — when research must stop and report back>
## What would let us close this
- [ ] Findings written to a durable document: <path, e.g. research/issue-NNN/> —
a comment thread is not a durable finding
- [ ] The decision the research informs is recorded: made / deferred / changed
- [ ] If a follow-up build issue was minted: <#N or "none needed">
## Version impact (declared at submission — verified at merge)
- [ ] none — research changes no released artifact (usual)
- [ ] minor/major — only if a code spike is being merged as part of this (justify)
## Technical detail
<!-- Candidate approaches, prior art in the repo, related issues, constraints,
rebuildable-projection or authority requirements if findings touch canonical state. -->
## Pipeline requirements
- [ ] Findings committed under the stated durable path
- [ ] Every citation verified against a real source (no fabricated references)
- [ ] Closed with a properly formatted closing comment: findings summary + decision
## Cognitive invariants (memory/cognition research — both handoffs)
<!-- Complete ONLY if findings touch memory, learning, or self-model state. -->
- [ ] **Owner** — which existing subsystem owns this (audit before proposing modules)
- [ ] **Read/write authority** — which canonical state is affected
- [ ] **Provenance** — findings traceable to evidence
- [ ] **Reversibility** — projections remain rebuildable; no unique truth moves into a derived index
- [ ] **No duplicate authority** — why extend vs create
Hard invariants: derived cognition preserves evidentiary ancestry · retrieval never increases utility · raw evidence is never destroyed by promotion.
## Related umbrella
- [ ] Memory
- [ ] Governance
- [ ] Identity
- [ ] Growth
- [ ] Perception
- [ ] Infrastructure
- [ ] Life (Nick's)
- [ ] Custodian
- [ ] Orchestration
## Priority (REQUIRED — the priority gate)
<!-- Pick exactly one. An issue without a priority is not filed. -->
- [ ] **P0 — critical** — blocks a decision that blocks other work
- [ ] **P1 — high** — informs a next-stage dependency
- [ ] **P2 — medium** — quality/consolidation understanding
- [ ] **P3 — low** — watchlist / deferred / exploratory
+2 -2
View File
@@ -8,7 +8,7 @@ on:
jobs:
backup:
runs-on: rune-infra-pi
runs-on: rune-ci-desktop
steps:
# actions/checkout v4.2.2, pinned to the audited upstream tag commit.
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
@@ -18,4 +18,4 @@ jobs:
python3 -m unittest -v tests.test_gitea_backup
python3 src/rune/canary_gitea_automation.py
- name: Create consistent off-disk Gitea backup
run: sudo /usr/local/sbin/rune-gitea-backup
run: sudo /usr/local/bin/gitea-backup-pc.sh
+140 -55
View File
@@ -7,49 +7,38 @@ on:
types: [opened, edited]
jobs:
# PRIORITY GATE (2026-09-04): every issue must carry exactly one of
# P0/P1/P2/P3. An issue that lands without one gets 'unprioritized' +
# a demand comment — filing is not complete until prioritized.
priority-gate:
if: github.event_name == 'issues' && github.event.action != 'labeled'
runs-on: rune-infra-pi
# SINGLE-PASS FILING (2026-10-07, Nick's first-time-correct directive):
# the old design ran TWO jobs on submission — priority-gate (which saw
# no P-label and posted the ⚠️ warning) and auto-label (which inferred
# and applied the P-label). The gate ran BEFORE the inference that
# would have made the warning unnecessary: every keyword-inferrable
# submission ate a spurious warning, a flag add/remove cycle, and a
# wasted workflow run. The fix is ORDER: infer → apply → THEN gate.
# A submission whose priority is inferable gets its P-label in this
# same run; the warning fires only when inference genuinely produced
# nothing (a true filing gap, not a race the robot loses to itself).
auto-label:
runs-on: rune-ci-desktop
steps:
- name: Enforce priority label
- name: Infer, apply, then gate-check (one pass)
uses: actions/github-script@v7
with:
script: |
const issue = context.payload.issue;
if (!issue) return;
const labels = (issue.labels || []).map(l => l.name);
const priorities = ['P0 — critical', 'P1 — high', 'P2 — medium', 'P3 — low'];
const has = labels.filter(l => priorities.includes(l));
if (has.length >= 1) {
// Prioritized — clear the flag if it was set.
if (labels.includes('unprioritized')) {
await github.rest.issues.removeLabel({
owner: context.repo.owner, repo: context.repo.repo,
issue_number: issue.number, name: 'unprioritized',
}).catch(e => { if (e.status !== 404) throw e; });
}
// CLOSED-ISSUE GUARD (#407): labels are filing-time metadata.
// A closed issue's lifecycle has ended; re-running label
// inference on it re-adds stale type labels (bug = currently
// incorrect behavior — a closed fixed issue must not carry
// it) and makes any human label cleanup self-defeating,
// because every PUT fires a 'labeled' event that re-triggers
// this job. Post-close label curation belongs to humans and
// the conductor, not this workflow.
const issueState = context.payload.issue?.state;
if (issueState === 'closed') {
console.log(`Issue #${context.payload.issue?.number} is closed — auto-label skips (labels are curated post-close).`);
return;
}
await github.rest.issues.addLabels({
owner: context.repo.owner, repo: context.repo.repo,
issue_number: issue.number, labels: ['unprioritized'],
});
await github.rest.issues.createComment({
owner: context.repo.owner, repo: context.repo.repo,
issue_number: issue.number,
body: `⚠️ **Priority gate:** this issue has no priority. Assign exactly one of **P0 — critical** (spine/correctness/blocks), **P1 — high** (material value or real defect), **P2 — medium** (quality/consolidation), **P3 — low** (measurement/deferred). An issue without a priority is not filed.`,
});
auto-label:
runs-on: rune-infra-pi
steps:
- name: Analyze and label
uses: actions/github-script@v7
with:
script: |
const action = context.payload.action;
const isIssue = context.payload.issue !== undefined;
const title = context.payload.issue?.title || context.payload.pull_request?.title || '';
const body = context.payload.issue?.body || context.payload.pull_request?.body || '';
const text = (title + ' ' + body).toLowerCase();
@@ -58,9 +47,44 @@ jobs:
const managedLabels = new Set([
'memory', 'governance', 'identity', 'growth',
'perception', 'infrastructure', 'life', 'custodian',
'priority: high', 'bug', 'feature',
'bug', 'feature', 'research',
'P0 — critical', 'P1 — high', 'P2 — medium', 'P3 — low',
]);
// Type label: DECLARED over GUESSED. The template spine
// (kind: bug|feature|research|epic|...) is authoritative.
// A recognized kind maps to its label; ANY other declared kind
// (e.g. epic) means NO type label and NO keyword guessing —
// epics are containers, not bugs. Keyword heuristics apply
// only to pre-template issues with no spine at all.
let isBug = false, isFeature = false, isResearch = false;
const kindMatch = body && body.match(/^kind:\s*([a-z_-]+)\s*$/m);
if (kindMatch) {
const kind = kindMatch[1];
isBug = kind === 'bug';
isFeature = kind === 'feature';
isResearch = kind === 'research';
} else if (action === 'opened') {
// KEYWORD FALLBACK (#407): pre-template issues only, and
// ONLY at filing time. Re-running keyword guesses on every
// edit/label event overrides human curation of spine-less
// issues (documented rule: keyword heuristics are the
// pre-template fallback, not a standing authority).
const textBug = title.startsWith('[BUG]') || text.includes('bug') || text.includes('fix') || text.includes('broken');
isBug = textBug;
isFeature = !isBug && (title.startsWith('[FEATURE]') || text.includes('feature') || text.includes('improve') || text.includes('add'));
isResearch = !isBug && !isFeature && title.startsWith('[RESEARCH]');
}
if (isBug) {
desiredLabels.add('bug');
}
if (isFeature) {
desiredLabels.add('feature');
}
if (isResearch) {
desiredLabels.add('research');
}
// Umbrella labels
if (text.includes('memory') || text.includes('store') || text.includes('recall') || text.includes('consolidat')) {
desiredLabels.add('memory');
@@ -87,19 +111,31 @@ jobs:
desiredLabels.add('custodian');
}
// Priority labels
if (text.includes('urgent') || text.includes('critical') || text.includes('broken')) {
desiredLabels.add('priority: high');
}
// Type labels
const isBug = title.startsWith('[BUG]') || text.includes('bug') || text.includes('fix') || text.includes('broken');
const isFeature = !isBug && (title.startsWith('[FEATURE]') || text.includes('feature') || text.includes('improve') || text.includes('add'));
if (isBug) {
desiredLabels.add('bug');
}
if (isFeature) {
desiredLabels.add('feature');
// Priority labels (2026-10-05: PROGRAMMATIC P-ASSIGNMENT —
// the gate demanded P0-P3 labels but nothing assigned them;
// the dead 'priority: high' label is gone per the 2026-09-04
// normalization). Assignment from the TITLE prefix first
// ([P1]/P1:/priority=...), then keyword inference using the
// gate's own rule set (the scale lives in ONE place — the
// gate check at the bottom of THIS job).
const pMatch = title.match(/\bP([0-3])\b/);
const priorityLabelNames = ['P0 — critical', 'P1 — high', 'P2 — medium', 'P3 — low'];
if (pMatch) {
desiredLabels.add(priorityLabelNames[Number(pMatch[1])]);
} else if (text.includes('urgent') || text.includes('critical') ||
text.includes('spine') || text.includes('blocks other work')) {
desiredLabels.add(priorityLabelNames[0]); // P0 — critical
} else if (text.includes('broken') || text.includes('fix') ||
text.includes('repair') || text.includes('defect') ||
text.includes('real defect') || text.includes('money')) {
desiredLabels.add(priorityLabelNames[1]); // P1 — high
} else if (text.includes('improve') || text.includes('consolidat') ||
text.includes('refactor') || text.includes('kernel') ||
text.includes('port')) {
desiredLabels.add(priorityLabelNames[2]); // P2 — medium
} else if (text.includes('benchmark') || text.includes('measurement') ||
text.includes('deferred')) {
desiredLabels.add(priorityLabelNames[3]); // P3 — low
}
const issueNumber = context.payload.issue?.number || context.payload.pull_request?.number;
@@ -109,6 +145,7 @@ jobs:
issue_number: issueNumber,
});
const currentLabels = new Set(current.data.map(label => label.name));
const currentLabelIds = new Map(current.data.map(label => [label.name, label.id]));
const staleManaged = [...currentLabels].filter(
label => managedLabels.has(label) && !desiredLabels.has(label)
);
@@ -118,11 +155,14 @@ jobs:
for (const name of staleManaged) {
try {
await github.rest.issues.removeLabel({
// Gitea's DELETE /labels/{id} requires the numeric label ID.
// Octokit's GitHub-style removeLabel(name) returned 404 and
// left stale priority labels behind (#2467: P0 AND P2).
await github.request('DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels/{id}', {
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumber,
name,
id: currentLabelIds.get(name),
});
} catch (error) {
if (error.status !== 404) {
@@ -140,5 +180,50 @@ jobs:
labels: missingDesired,
});
}
console.log(`Removed managed labels: ${staleManaged.join(', ') || 'none'}`);
console.log(`Added managed labels: ${missingDesired.join(', ') || 'none'}`);
// ---- PRIORITY GATE (runs LAST — after inference and
// reconciliation, so the verdict reflects the labels THIS run
// just applied, not a pre-inference snapshot). Issue-scoped:
// the filing contract governs issues; PRs get inferred labels
// but are not filing units.
if (!isIssue) {
console.log(`PR #${issueNumber}: labels applied, gate skipped (gate is issue-scoped).`);
return;
}
const reconciled = await github.rest.issues.listLabelsOnIssue({
owner: context.repo.owner, repo: context.repo.repo,
issue_number: issueNumber,
});
const actual = reconciled.data;
const activePriority = actual.filter(l => priorityLabelNames.includes(l.name));
const flag = actual.find(l => l.name === 'unprioritized');
if (activePriority.length === 1) {
// Prioritized (by human or by this run's inference). Clear
// any stale flag — no warning is ever posted on this path.
if (flag) {
await github.request('DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels/{id}', {
owner: context.repo.owner, repo: context.repo.repo,
issue_number: issueNumber, id: flag.id,
});
}
console.log(`Priority gate: satisfied (${activePriority[0].name}).`);
return;
}
// Genuinely unprioritized: inference produced nothing AND the
// caller set nothing. Flag + demand comment — the filing gap
// is real, not a race artifact.
const reason = activePriority.length === 0
? 'no priority'
: `${activePriority.length} priority labels (exactly one required)`;
if (!flag) {
await github.rest.issues.addLabels({
owner: context.repo.owner, repo: context.repo.repo,
issue_number: issueNumber, labels: ['unprioritized'],
});
}
await github.rest.issues.createComment({
owner: context.repo.owner, repo: context.repo.repo,
issue_number: issueNumber,
body: `⚠️ **Priority gate:** this issue has ${reason}. Assign exactly one of **P0 — critical** (spine/correctness/blocks), **P1 — high** (material value or real defect), **P2 — medium** (quality/consolidation), **P3 — low** (measurement/deferred). An issue without a priority is not filed.`,
});
console.log(`Priority gate: flagged — ${reason}.`);
+1 -1
View File
@@ -8,7 +8,7 @@ on:
jobs:
update-gitea:
runs-on: rune-infra-pi
runs-on: rune-ci-desktop
steps:
- name: Check current Gitea version
id: current
+17 -4
View File
@@ -11,7 +11,7 @@ permissions: write-all
jobs:
release:
runs-on: rune-infra-pi
runs-on: rune-ci-desktop
steps:
- uses: actions/checkout@v4
with:
@@ -131,8 +131,12 @@ jobs:
"pyproject.toml": [(f'version = "{VERSION}"', f'version = "{NEW}"')],
}
# Fetch current master content, apply replacements, VERIFY all five
# surfaces agree on NEW before committing anything (TUI gate).
# Fetch current master content, apply replacements, VERIFY all six
# surface patterns (five files + the TUI footer) agree on NEW before
# committing anything (TUI gate). The footer check was added after
# the 0.89.0 half-bump: a stale RELEASE_VERSION made both replace
# pairs no-op; the gate's RECOVER regex fixed the header only and
# the footer silently stayed 0.88.4, failing the banner test.
edited = {}
for path, pairs in surfaces.items():
status, cur = api(f"/contents/{path}?ref=master")
@@ -151,6 +155,7 @@ jobs:
checks = [
("src/rune/__init__.py", rf'__version__ = "({VER})"'),
("src/rune/rune_tui.py", rf"Version: v({VER})"),
("src/rune/rune_tui.py", rf"Rune v({VER}) \|"),
("src/rune/canary_gitea_automation.py", rf"'__version__ = \"({VER})\"'"),
("pyproject.toml", rf'version = "({VER})"'),
("README.md", rf"v({VER})"),
@@ -223,7 +228,15 @@ jobs:
# The old PR-title/body paste path (which produced empty '##'
# bodies on direct-push releases) is REMOVED — governed evidence
# from the scaffold store is the source, not PR prose.
# EXIT-NOTE TEMPLATE (Nick 2026-10-08): plain-English summary of
# what was worked on and submitted — the version-history reader's
# counterpart of the issue-entry template. Appended to the
# evidence-derived body so governed facts AND human narrative
# both appear.
LAST_TAG=$(git tag --sort=-v:refname | head -1)
EXIT_NOTE=$(python3 scripts/release_exit_note.py --since "$LAST_TAG" --to HEAD) || EXIT_NOTE=""
python3 scripts/release_history_cli.py init \
--version "$RELEASE_VERSION" \
--server "$RELEASE_SERVER_URL" --repo "$RELEASE_REPO" \
--store store/scaffold/current.json
--store store/scaffold/current.json \
${EXIT_NOTE:+--exit-note "$EXIT_NOTE"}
+304
View File
@@ -63,10 +63,32 @@ jobs:
- name: Structural contract (henxels)
run: |
.ci-venv/bin/henxels check --all --plain
# ABSOLUTE SCAFFOLDING LAW (2026-10-07): every Go/Rust implementation
# unit must map to a construction contract in store/scaffold/. New
# units without a contract fail the build — open the contract BEFORE
# the commit lands, never after.
- name: Scaffolding coverage (absolute law)
run: |
python3 scripts/scaffolding_coverage.py
unit-tests:
runs-on: rune-ci-desktop
if: ${{ !startsWith(gitea.event.pull_request.head.ref, 'chore/auto-bump') }}
env:
RUNE_HOME: /tmp/rune-ci-${{ github.run_id }}
RUNE_MEMORY_DIR: /tmp/rune-ci-${{ github.run_id }}/memory
# The unit shim battery loads the cdylib (ep_loader); point it at the
# runner-owned cdylib FILE from the crate-build step below (the override
# expects a file path, not a directory).
EP_RUST_LIB: /tmp/rune-ci-target-${{ github.run_id }}/release/libevidence_provenance.so
SP_RUST_LIB: /tmp/rune-ci-target-${{ github.run_id }}/release/librune_spine.so
MS_RUST_LIB: /tmp/rune-ci-target-${{ github.run_id }}/release/libmemory_scoring.so
CS_RUST_LIB: /tmp/rune-ci-target-${{ github.run_id }}/release/libcapability_scoring.so
TC_RUST_LIB: /tmp/rune-ci-target-${{ github.run_id }}/release/libtoken_counting.so
SC_RUST_LIB: /tmp/rune-ci-target-${{ github.run_id }}/release/libscaffold_core.so
MEMS_RUST_LIB: /tmp/rune-ci-target-${{ github.run_id }}/release/libmemory_storage.so
MR_RUST_LIB: /tmp/rune-ci-target-${{ github.run_id }}/release/libmemory_retrieval.so
CC_RUST_LIB: /tmp/rune-ci-target-${{ github.run_id }}/release/libcognition_core.so
steps:
# actions/checkout v4.2.2, pinned to the audited upstream tag commit.
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
@@ -102,6 +124,27 @@ jobs:
fi
python3 scripts/umbrella_impact.py check \
--base "$(git merge-base origin/master HEAD)" --head HEAD ${BODY_FILE:+--body-file "$BODY_FILE"}
- name: Build Rust evidence_provenance crate
run: |
# tests/test_evidence_provenance_shims.py drives the cdylib through
# the shim layer. Toolchain law (see the canary job for the full
# rationale): system rustc is broken on this host (LLVM_23.1
# version-node symbol gap); use the healthy rustup toolchain, PATH
# first so the rustup shim can't exec the broken system rustc.
# Runner-owned /tmp target dir (the repo's target/ is nick's).
export PATH="/home/nick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin:$PATH"
export CARGO_TARGET_DIR="/tmp/rune-ci-target-${{ github.run_id }}"
mkdir -p "$CARGO_TARGET_DIR"
cargo build --release --manifest-path src/rust/evidence_provenance/Cargo.toml
cargo build --release --manifest-path src/rust/rune_spine/Cargo.toml
cargo build --release --manifest-path src/rust/memory_scoring/Cargo.toml
cargo build --release --manifest-path src/rust/capability_scoring/Cargo.toml
cargo build --release --manifest-path src/rust/token_counting/Cargo.toml
cargo build --release --manifest-path src/rust/scaffold_core/Cargo.toml
cargo build --release --manifest-path src/rust/memory_storage/Cargo.toml
cargo build --release --manifest-path src/rust/memory_retrieval/Cargo.toml
cargo build --release --manifest-path src/rust/cognition_core/Cargo.toml
cargo build --release --manifest-path src/rust/query_memory/Cargo.toml
- name: Test with coverage (global floor + changed-lines ratchet)
run: |
# #149 coverage ratchet — both floors live in .coveragerc; raise,
@@ -113,12 +156,220 @@ jobs:
.test-venv/bin/coverage xml
.test-venv/bin/diff-cover coverage.xml --compare-branch origin/master --fail-under=70 --diff-range-notation ..
go-surface:
runs-on: rune-ci-desktop
if: ${{ !startsWith(gitea.event.pull_request.head.ref, 'chore/auto-bump') }}
steps:
# actions/checkout v4.2.2, pinned to the audited upstream tag commit.
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Verify Go toolchain version pin
run: |
# H0 pin: the Go surface builds against the pacman toolchain; the
# pin file is the single source of truth so a distro upgrade that
# changes behavior fails loud here, not downstream in the canary.
WANT=$(cat go-version.txt)
GOT=$(go version | awk '{print $3}' | sed 's/^go//' | cut -d- -f1)
echo "pinned: $WANT | toolchain: $GOT"
[ "$GOT" = "$WANT" ] || { echo "::error::Go toolchain drift: want $WANT, got $GOT (update go-version.txt with the rollout)"; exit 1; }
- name: build Survivor staticlibs in-tree (for cgo main packages)
run: |
# Survivor main packages link Rust staticlibs via ${SRCDIR} paths
# (adaptive-router → libroute_risk_flags.a). Those paths resolve
# only when the crate target dir is IN-TREE, so this build must
# NOT set CARGO_TARGET_DIR (the redirected builds below are for
# the FFI-loader canaries and stay as they are).
# Every Survivor-linked crate must have its .a in-tree before the
# go loop: adaptive-router → route_risk_flags; cognition →
# cognition_core. Add crates here as Survivor packages grow.
cargo build --release --manifest-path src/rust/route_risk_flags/Cargo.toml
cargo build --release --manifest-path src/rust/cognition_core/Cargo.toml
cargo build --release --manifest-path src/rust/query_memory/Cargo.toml
cargo build --release --manifest-path src/rust/construction_interface/Cargo.toml
- name: prune stale /tmp cargo target dirs (tmpfs guard)
run: |
# /tmp is a 32G tmpfs; every CI run leaves a ~218MB
# rune-ci-target-<run_id> dir. Without pruning, 300+ runs filled
# 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
- name: go vet + go test + go build
run: |
for dir in src/go/*/; do
if [ -f "$dir/go.mod" ]; then
echo "=== Building $dir ==="
cd "$dir"
go vet ./...
go test ./... 2>/dev/null || true
OUT_DIR="${GITHUB_WORKSPACE:-$PWD}/bins"
mkdir -p "$OUT_DIR"
go build -o "$OUT_DIR/go-$(basename "$dir")" .
cd - > /dev/null
fi
done
- name: adaptive-router parity gate (HARD — oracle replay, not swallowable)
run: |
cd src/go/adaptive-router
go test ./... -run TestParityAgainstPythonOracle -v
- name: cron-engine parity gate (HARD — #2479 batches 1+126: parser + lifecycle)
run: |
go build -o /tmp/cron-engine ./src/go/cron-engine
/tmp/cron-engine replay src/go/cron-engine/truth.json
go test ./src/go/cron-engine/ -run TestLifecycleParity -v
- name: goal-engine parity gate (HARD — #2479 batches 2+129: verifier + lifecycle)
run: |
go build -o /tmp/goal-engine ./src/go/goal-engine
/tmp/goal-engine replay src/go/goal-engine/truth.json
go test ./src/go/goal-engine/ -run TestLifecycleParity -v
- name: provider-budget parity gate (HARD — #2479 batch 3, oracle replay)
run: |
go build -o /tmp/provider-budget ./src/go/provider-budget
/tmp/provider-budget replay src/go/provider-budget/truth.json
- name: event-wait parity gate (HARD — #2479 batch 4, oracle replay)
run: |
go build -o /tmp/event-wait ./src/go/event-wait
/tmp/event-wait replay src/go/event-wait/truth.json
- name: memory-consolidation parity gate (HARD — #2479 batches 5+131: scoring + constructors)
run: |
go build -o /tmp/memory-consolidation ./src/go/memory-consolidation
/tmp/memory-consolidation replay src/go/memory-consolidation/truth.json
go test ./src/go/memory-consolidation/ -run TestConstructorParity -v
- name: release-notes parity gate (HARD — #2479 batches 6+135: render + parser edges)
run: |
go build -o /tmp/release-notes ./src/go/release-notes
/tmp/release-notes replay src/go/release-notes/truth.json
- name: model-profiles parity gate (HARD — #2479 batches 7+145: detection + edge pins)
run: |
go build -o /tmp/model-profiles ./src/go/model-profiles
/tmp/model-profiles replay src/go/model-profiles/truth.json
- name: model-routing parity gate (HARD — #2479 batches 8+136: rank + cost-override)
run: |
go build -o /tmp/model-routing ./src/go/model-routing
/tmp/model-routing replay src/go/model-routing/truth.json
- name: work-manager parity gate (HARD — #2479 batches 9+137: batching + order/descriptions)
run: |
go build -o /tmp/work-manager ./src/go/work-manager
/tmp/work-manager replay src/go/work-manager/truth.json
- name: core-server parity gate (HARD — #2479 batches 10+138: envelopes + extraction/identity)
run: |
go build -o /tmp/core-server ./src/go/core-server
/tmp/core-server replay src/go/core-server/truth.json
- name: builder-bridge parity + improvement gate (HARD — #2479 batches 11+139: render/LRU + TTL/refresh/key)
run: |
go build -o /tmp/builder-bridge ./src/go/builder-bridge
/tmp/builder-bridge replay src/go/builder-bridge/truth.json
- name: voicebox parity + improvement gate (HARD — #2479 batches 12+140: hook + full manifest)
run: |
go build -o /tmp/voicebox ./src/go/voicebox
/tmp/voicebox replay src/go/voicebox/truth.json
- name: voice-sync parity gate (HARD — #2479 batches 35+143: extract + unicode/generate)
run: |
go build -o /tmp/voice-sync ./src/go/voice-sync
/tmp/voice-sync replay src/go/voice-sync/truth.json
- name: forge-core parity + improvement gate (HARD — #2479 batches 13+106+141: resolvers + lattice restore)
run: |
go build -o /tmp/forge-core ./src/go/forge-core
/tmp/forge-core replay src/go/forge-core/truth.json
- name: forge-client parity gate (HARD — #2479 batch 133, oracle replay)
run: |
go build -o /tmp/forge-client ./src/go/forge-client
/tmp/forge-client replay src/go/forge-client/truth.json
- name: elastic-cognition parity + improvement gate (HARD — #2479 batches 14+117: +budget/parse kernels)
run: |
go build -o /tmp/elastic-cognition ./src/go/elastic-cognition
/tmp/elastic-cognition replay src/go/elastic-cognition/truth.json
/tmp/elastic-cognition replay src/go/elastic-cognition/truth_budget_parse.json
- name: auto-tasks parity + improvement gate (HARD — #2479 batches 15+144: adjacency + action/seq/gates)
run: |
go build -o /tmp/auto-tasks ./src/go/auto-tasks
/tmp/auto-tasks replay src/go/auto-tasks/truth.json
- name: model-connect parity + improvement gate (HARD — #2479 batches 16+113: clean-name parser + edge top-up)
run: |
go build -o /tmp/model-connect ./src/go/model-connect
/tmp/model-connect replay src/go/model-connect/truth.json
- name: gofmt gate (formatting is a gate — polyglot lint contract)
run: |
UNFORMATTED=$(gofmt -l src/go/ 2>/dev/null)
if [ -n "$UNFORMATTED" ]; then
echo "::error::gofmt drift — run gofmt -w on these:"
echo "$UNFORMATTED"
exit 1
fi
- name: go race detector (every module's test suite under -race)
run: |
for dir in src/go/*/; do
if [ -f "$dir/go.mod" ]; then
cd "$dir"
go test -race ./... 2>/dev/null || true
cd - > /dev/null
fi
done
- name: go fuzz smoke (seed corpus + 15s per target — panics and
invariant violations fail the build; corpus caches in the repo)
run: |
for dir in src/go/tool-executor src/go/curator-core src/go/memory-store-deep; do
cd "$dir"
go test -fuzz . -fuzztime 15s ./... 2>&1 | tail -2
cd - > /dev/null
done
rust-surface:
runs-on: rune-ci-desktop
if: ${{ !startsWith(gitea.event.pull_request.head.ref, 'chore/auto-bump') }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: rustup clippy + rustfmt components
run: |
rustup component add clippy rustfmt 2>/dev/null || true
cargo clippy --version
cargo fmt --version
- name: cargo fmt --check (formatting is a gate)
run: |
FAIL=0
for crate in src/rust/*/; do
if [ -f "$crate/Cargo.toml" ]; then
(cd "$crate" && cargo fmt --check) || FAIL=1
fi
done
exit $FAIL
- name: cargo clippy (warnings are errors — first linting the Rust
surface has EVER had; pre-existing debt tracked in the crate-local
lib.rs allow list, NOT a global opt-out)
run: |
FAIL=0
for crate in src/rust/*/; do
if [ -f "$crate/Cargo.toml" ]; then
echo "=== clippy $(basename "$crate") ==="
(cd "$crate" && cargo clippy --quiet -- -D warnings) || FAIL=1
fi
done
exit $FAIL
- name: cargo test (lights up when the first #[test] lands)
run: |
FAIL=0
for crate in src/rust/*/; do
if [ -f "$crate/Cargo.toml" ]; then
(cd "$crate" && cargo test --quiet) || FAIL=1
fi
done
exit $FAIL
canary:
runs-on: rune-ci-desktop
if: ${{ !startsWith(gitea.event.pull_request.head.ref, 'chore/auto-bump') }}
env:
RUNE_HOME: /tmp/rune-ci-${{ github.run_id }}
RUNE_MEMORY_DIR: /tmp/rune-ci-${{ github.run_id }}/memory
# The build emits to a runner-owned /tmp target dir (the repo's target/
# is nick-owned); EP_RUST_LIB points ep_loader at the cdylib FILE there
# (the override expects a file path, not a directory).
EP_RUST_LIB: /tmp/rune-ci-target-${{ github.run_id }}/release/libevidence_provenance.so
SP_RUST_LIB: /tmp/rune-ci-target-${{ github.run_id }}/release/librune_spine.so
MS_RUST_LIB: /tmp/rune-ci-target-${{ github.run_id }}/release/libmemory_scoring.so
CS_RUST_LIB: /tmp/rune-ci-target-${{ github.run_id }}/release/libcapability_scoring.so
TC_RUST_LIB: /tmp/rune-ci-target-${{ github.run_id }}/release/libtoken_counting.so
SC_RUST_LIB: /tmp/rune-ci-target-${{ github.run_id }}/release/libscaffold_core.so
MEMS_RUST_LIB: /tmp/rune-ci-target-${{ github.run_id }}/release/libmemory_storage.so
MR_RUST_LIB: /tmp/rune-ci-target-${{ github.run_id }}/release/libmemory_retrieval.so
steps:
# actions/checkout v4.2.2, pinned to the audited upstream tag commit.
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
@@ -130,6 +381,36 @@ jobs:
python3 -m venv .canary-venv
.canary-venv/bin/pip install --disable-pip-version-check -r requirements-ci.txt
.canary-venv/bin/pip install --disable-pip-version-check -e . --no-deps
- name: Build Rust evidence_provenance crate
run: |
# The canary pair + the unit shim battery drive the COMPILED surfaces
# (binary CLI parity, ep_loader FFI, ctypes cdylib loads).
#
# Toolchain law (troubleshooting history): the SYSTEM rustc is broken
# on this host — librustc_driver-<sha>.so (pacman rust 1:1.99.0-1)
# references std::string::_M_mutate under the LLVM_23.1 version node,
# but /usr/lib/libLLVM.so.23.1 does not define that narrow-char
# symbol under that node (it exports _M_create/_M_assign there, and
# only the WIDE-char _M_mutate) — every compile dies with `symbol
# lookup error` while `cargo --version` still prints. The rustup
# toolchain under /home/nick/.rustup is healthy and ships its own
# libLLVM, and /home/nick carries the x-ACL for this runner user.
# Point PATH at the toolchain bin dir (bypasses the rustup shim,
# which would exec the broken system rustc via RUSTUP_TOOLCHAIN).
# Target dir is runner-owned (/tmp): the repo's target/ is nick's.
export PATH="/home/nick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin:$PATH"
export CARGO_TARGET_DIR="/tmp/rune-ci-target-${{ github.run_id }}"
mkdir -p "$CARGO_TARGET_DIR"
cargo build --release --manifest-path src/rust/evidence_provenance/Cargo.toml
cargo build --release --manifest-path src/rust/rune_spine/Cargo.toml
cargo build --release --manifest-path src/rust/memory_scoring/Cargo.toml
cargo build --release --manifest-path src/rust/capability_scoring/Cargo.toml
cargo build --release --manifest-path src/rust/token_counting/Cargo.toml
cargo build --release --manifest-path src/rust/scaffold_core/Cargo.toml
cargo build --release --manifest-path src/rust/memory_storage/Cargo.toml
cargo build --release --manifest-path src/rust/memory_retrieval/Cargo.toml
cargo build --release --manifest-path src/rust/cognition_core/Cargo.toml
cargo build --release --manifest-path src/rust/query_memory/Cargo.toml
- name: Run canary suite
run: |
FAILED=0
@@ -156,6 +437,21 @@ jobs:
src/rune/canary_p1_06.py \
src/rune/canary_p1_01.py \
src/rune/canary_query_memory.py \
src/rune/canary_rune_entry.py \
src/rune/canary_spine_meta.py \
src/rune/canary_audit_ledger.py \
src/rust/rune_spine/canary_spine_rust.py \
src/rune/canary_rune_serve.py \
src/rune/canary_tui_transport.py \
src/rust/memory_scoring/canary_memory_scoring.py \
src/rust/capability_scoring/canary_capability_scoring.py \
src/rust/token_counting/canary_token_counting.py \
src/rust/scaffold_core/canary_scaffold_core.py \
src/rust/memory_storage/canary_memory_storage.py \
src/rust/memory_retrieval/canary_memory_retrieval.py \
src/rust/cognition_core/canary_growth_pins.py \
src/rust/cognition_core/canary_persona.py \
src/rust/cognition_core/canary_cognition_core.py \
src/rune/canary_unbounded.py \
src/rune/canary_full_system.py \
src/rune/canary_native.py; do
@@ -344,3 +640,11 @@ jobs:
CI_RESULT: ${{ needs.required-checks.result }}
RUNE_EVENT_BRIDGE_URL: ${{ vars.RUNE_EVENT_BRIDGE_URL || 'http://127.0.0.1:8791' }}
run: python3 scripts/notify_event_bridge.py
- name: query_memory shadow (pre-shim oracle vs Rust CLI — #2447 qualification)
run: |
# The shadow runs BOTH implementations on the frozen 24-command
# sequence in isolated HOMEs; divergence is a defect. The pre-shim
# Python oracle is recovered from git history (6f44a87~1) — the
# authority-switched shared/query_memory.py is the Rust core now.
python3 scripts/qm_shadow.py
+74
View File
@@ -0,0 +1,74 @@
name: Local-Model First-Pass Review (#131)
# Non-blocking PR review by a local model (Ollama on the 4070 Ti).
# Advisory only — nothing gates on the local model. The two-gate reviews
# (spec + quality) remain the enforcement path; this is a first-pass
# filter adding redundancy against controller degradation.
on:
pull_request:
types: [opened, synchronize]
permissions:
pull-requests: write
jobs:
first-pass-review:
runs-on: rune-ci-desktop
# Advisory review needs PR context (diff base + comment target). Push
# runs have neither — run NOTHING on push (the 20721 lesson: guarding
# only the collect step let the post step fail the run at
# /issues//comments). Auto-bump PRs stay excluded as before.
if: ${{ !startsWith(gitea.event.pull_request.head.ref, 'chore/auto-bump') }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
fetch-depth: 0
- name: Collect the PR diff
run: |
if [ -z "$GITEA_BASE_REF" ]; then
echo "no PR context (push run) — advisory review not applicable"
exit 0
fi
git diff "origin/${GITEA_BASE_REF}...HEAD" --stat > /tmp/pr_stat.txt
git diff "origin/${GITEA_BASE_REF}...HEAD" > /tmp/pr_diff.txt
wc -l /tmp/pr_diff.txt /tmp/pr_stat.txt
env:
GITEA_BASE_REF: ${{ gitea.event.pull_request.base.ref }}
- name: Local-model review (Ollama — advisory, never blocking)
env:
OLLAMA_HOST: ${{ secrets.OLLAMA_HOST }}
run: |
# Fail-open: no Ollama reachable → skip with a note, never fail.
if ! curl -sf "${OLLAMA_HOST:-http://192.168.1.50:11434}/api/tags" > /dev/null 2>&1; then
echo "Ollama unreachable — skipping first-pass review (advisory only)"
exit 0
fi
MODEL="${OLLAMA_MODEL:-qwen2.5-coder:7b}"
python3 scripts/local_firstpass_review.py \
--diff /tmp/pr_diff.txt --stat /tmp/pr_stat.txt \
--model "$MODEL" --host "${OLLAMA_HOST:-http://192.168.1.50:11434}"
- name: Post findings as PR comment
if: ${{ gitea.event.pull_request.number != 0 }}
env:
GITEA_TOKEN: ${{ secrets.ROBOT_TOKEN }}
PR_NUMBER: ${{ gitea.event.pull_request.number }}
run: |
if [ -f /tmp/review_findings.md ]; then
export PR_NUMBER
python3 - <<'PYEOF'
import json, os, urllib.request
body = open("/tmp/review_findings.md").read()
if not body.strip():
print("no findings — no comment")
exit(0)
base = os.environ["GITEA_SERVER_URL"] + "/api/v1/repos/" + os.environ["GITEA_REPOSITORY"]
req = urllib.request.Request(
base + "/issues/" + os.environ["PR_NUMBER"] + "/comments",
data=json.dumps({"body": "## First-pass review (local model, advisory)\n\n" + body}).encode(),
headers={"Authorization": "token " + os.environ["GITEA_TOKEN"], "Content-Type": "application/json"},
method="POST")
with urllib.request.urlopen(req, timeout=30) as r:
print("comment posted:", r.status)
PYEOF
fi
+5 -5
View File
@@ -8,7 +8,7 @@ on:
jobs:
lint-and-format:
runs-on: rune-infra-pi
runs-on: rune-ci-desktop
steps:
- uses: actions/checkout@v4
- name: Lint Python files
@@ -18,7 +18,7 @@ jobs:
ruff format shared/ src/ || true
canary-suite:
runs-on: rune-infra-pi
runs-on: rune-ci-desktop
steps:
- uses: actions/checkout@v4
- name: Run all canaries
@@ -37,7 +37,7 @@ jobs:
exit $FAILED
best-practices:
runs-on: rune-infra-pi
runs-on: rune-ci-desktop
steps:
- uses: actions/checkout@v4
- name: Check best practices
@@ -72,7 +72,7 @@ jobs:
grep -rn "TODO\|FIXME\|HACK\|XXX" shared/ src/ --include="*.py" | head -10 || echo " Clean"
documentation-check:
runs-on: rune-infra-pi
runs-on: rune-ci-desktop
steps:
- uses: actions/checkout@v4
- name: Check documentation coverage
@@ -113,7 +113,7 @@ jobs:
# push-triggered safety net in auto-version.yml. Detects master/tag drift
# and files a deduped issue — it never auto-releases without the PR flow.
release-drift-reconciliation:
runs-on: rune-infra-pi
runs-on: rune-ci-desktop
steps:
- uses: actions/checkout@v4
with:
+9
View File
@@ -14,3 +14,12 @@ state/
# Runtime artifacts (cwd-local event journal + capability index)
index/
journal/
src/rust/*/target/
# batch 134: Go build artifacts — binaries are CI-built per gate (go build -o /tmp/...),
# never stored. Each module dir keeps go.mod/main.go/truth*.json + *_test.go only.
src/go/*/[^.]*
!src/go/*/*.go
!src/go/*/*.json
!src/go/*/*.mod
!src/go/*/*.sum
+26
View File
@@ -26,6 +26,9 @@ Only use `git commit --no-verify` in a genuine emergency: it bypasses the hooks
- Every workflow is registered in the pipeline registry — new pipeline machinery ships with documentation (in ./.gitea/workflows/*.yml)
- Every TUI surface is registered — no silent UI growth (in ./src/rune/*tui*.py)
- New rune modules ship with tests or a canary — no ungoverned code surfaces (in ./src/rune/*.py)
- Rust crate files stay under a line budget (in ./src/rust/*/src/*.rs)
- Go modules stay under a line budget (in ./src/go/**/*.go)
- No secrets in Rust or Go source files (in ./src/rust/*/src/*.rs, ./src/go/**/*.go)
- PRDs are living documents — their generated state sections regenerate identically from governed sources
- PRD staleness is a CI failure — docs rot is silent failure (in ./scripts/gen_prd_state.py)
- The adversarial review procedure is binding — dispatch templates must reference it (in ./docs/adversarial-review.md)
@@ -58,3 +61,26 @@ fix, full pipeline re-entry (suite + ratchet + ruff + canaries + henxels;
gates for anything beyond a mechanical minor), regression tests frozen forever,
discharge recorded finding → test → commit. Symptom patches are rejected at
review. To escape: edit `henxels.yaml` or this file — visibly.
## Issue organisation standard (binding, 2026-09-19)
One open note per idea. Issues use the template spine (kind, subsystem,
version intent) with a plain-English heading that restates the subject —
no meta-labels. Before minting a standalone issue, check whether the work
belongs inside an existing parent:
- **Parked ideas under a blocked/future epic** are filed as checklist items
in the parent's "Absorbed children" section, NOT as standalone issues.
Absorption is reversible — re-mint standalone when the idea becomes live.
- **Live, dependency-tracked, or starting work** gets a standalone issue.
- **Closures state the reason as data**: `closed_because` in the spine
(completed / superseded-by-#N / absorbed-into-#N / wont-do / duplicate),
plus a standard closing comment (plain summary first).
- The reconciliation checker (`scripts/gitea_reconciliation_check.py`) must
stay green after any issue state change; the artifact is updated in the
same change that moves issues.
## Async continuation final flow proofs (R13/M9) — 2026-09-19
PR-flow live proof marker: harmless documentation addition exercising the
canonical single-continuation path on the PC-local forge. No code change.
+1 -1
View File
@@ -1,6 +1,6 @@
# Rune
**Current release: v0.83.5**
**Current release: v0.155.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.**
+196
View File
@@ -0,0 +1,196 @@
"""completion_file.py — REAL_ASYNC_BRIDGE: durable completion-file delivery
with inotify wake. Replaces FIFO+lease for process-wait delivery.
DESIGN:
Producer (bridge/daemon/notify):
1. Validates operation identity
2. Atomically writes a completion file:
resumes/<operation_id>.done
containing the event/verdict JSON (write to tmp, rename for atomicity)
Waiter (ci_event_wait / any continuation consumer):
1. Checks if the completion file already exists (event-before-waiter)
2. If not: registers inotify watch on the resumes/ directory
3. Re-checks after watch registration (closes the registration race)
4. Blocks in kernel on inotify — zero CPU, zero timer
5. On file-created event: reads the file, verifies authority, returns
The event is a WAKE SIGNAL. Authority still decides terminal truth.
The completion file is durable — survives daemon and waiter restarts.
WHY NOT FIFO:
FIFO is one-shot (token consumed), requires lease management, and
fails under session-busy guards. A completion file is atomic, durable,
and works across restarts. inotify wakes the process with zero CPU
cost and zero latency between file creation and wake.
WHY NOT POLLING:
Polling introduces an arbitrary interval. inotify is a kernel callback
that fires exactly when the filesystem changes — the latency tracks
the real completion event, not a configured interval.
"""
from __future__ import annotations
import json
import os
import select
import struct
import time
from pathlib import Path
def _wr_bridge() -> Path:
# WR_ROOT = daemon/infra convention; RUNE_WR_ROOT = repo/scripts
# convention. Both honored (WR_ROOT wins) so the daemon, the waiter,
# and any isolated test root always resolve the SAME directory.
root = os.environ.get("WR_ROOT") or os.environ.get("RUNE_WR_ROOT") or "/mnt/workdrive/wr-bridge"
return Path(root)
def _resumes_dir() -> Path:
return _wr_bridge() / "resumes"
# inotify constants (Linux)
IN_CREATE = 0x100
IN_CLOSE_WRITE = 0x8
IN_MOVED_TO = 0x80
def completion_path(operation_id: str) -> Path:
return _resumes_dir() / f"{operation_id}.done"
def write_completion(operation_id: str, event: dict) -> Path:
"""Atomically write a durable completion file. The rename(2) ensures
the waiter never sees a partial file."""
_resumes_dir().mkdir(parents=True, exist_ok=True)
target = completion_path(operation_id)
tmp = target.parent / f".{target.name}.tmp.{os.getpid()}"
tmp.write_text(json.dumps(event, sort_keys=True) + "\n")
os.rename(str(tmp), str(target)) # atomic on same filesystem
os.chmod(str(target), 0o666) # cross-user bridge
return target
def read_completion(operation_id: str) -> dict | None:
"""Read a durable completion file. Returns None if absent."""
p = completion_path(operation_id)
if not p.is_file():
return None
try:
return json.loads(p.read_text())
except (OSError, ValueError):
return None
def completion_exists(operation_id: str) -> bool:
return completion_path(operation_id).is_file()
def _inotify_init_and_add_watch(directory: str) -> int:
"""Create an inotify instance and add a watch on the directory.
Returns the inotify fd."""
libc = __import__("ctypes").CDLL(None, use_errno=True)
fd = libc.inotify_init()
if fd < 0:
raise OSError("inotify_init failed")
# IN_CREATE | IN_MOVED_TO: catch both direct creation and atomic rename
mask = IN_CREATE | IN_MOVED_TO
wd = libc.inotify_add_watch(fd, directory.encode(), mask)
if wd < 0:
os.close(fd)
raise OSError(f"inotify_add_watch failed for {directory}")
return fd
def _inotify_read(fd: int, timeout_secs: float | None = None) -> list[str]:
"""Read pending inotify events. Returns list of filenames that were
created/moved-to. Blocks until at least one event or timeout."""
poll = select.poll()
poll.register(fd, select.POLLIN)
events = []
buf = os.read(fd, 4096)
pos = 0
while pos < len(buf):
# struct: wd(i32), mask(u32), cookie(u32), name_len(u32)
wd, mask, cookie, name_len = struct.unpack_from("iIII", buf, pos)
pos += 16
name = buf[pos : pos + name_len].rstrip(b"\x00").decode("utf-8", "replace")
pos += name_len
if mask & (IN_CREATE | IN_MOVED_TO):
events.append(name)
return events
def wait_for_completion(operation_id: str, *, timeout_secs: float | None = None, poll_callback=None) -> dict | None:
"""Block until a completion file exists for this operation.
Uses inotify for zero-latency, zero-CPU wake. Falls back to
polling_callback (if provided) when inotify is unavailable.
The completion file is a WAKE SIGNAL. The caller must still verify
canonical authority after reading it.
Returns the event dict from the completion file, or None on timeout.
"""
target = completion_path(operation_id)
# 1. check-before-watch (event may have arrived before we started)
existing = read_completion(operation_id)
if existing is not None:
return existing
_resumes_dir().mkdir(parents=True, exist_ok=True)
try:
fd = _inotify_init_and_add_watch(str(_resumes_dir()))
except OSError:
# inotify unavailable: fall back to polling callback
if poll_callback:
return poll_callback(operation_id, timeout_secs)
return None
try:
# 2. re-check after watch registration (closes the race between
# the initial check and the watch being active)
existing = read_completion(operation_id)
if existing is not None:
return existing
# 3. block in kernel on inotify — zero CPU, exact latency
import select as _select
poll = _select.poll()
poll.register(fd, _select.POLLIN)
deadline = (time.monotonic() + timeout_secs) if timeout_secs else None
while True:
remaining = None
if deadline is not None:
remaining = max(0.1, deadline - time.monotonic())
if remaining <= 0.1:
return None # timeout
events = poll.poll(remaining * 1000 if remaining else None)
if not events:
continue # poll timeout, re-check
names = _inotify_read(fd)
if target.name in names:
# 4. file appeared — read it
existing = read_completion(operation_id)
if existing is not None:
return existing
# partial/corrupt: keep watching
finally:
os.close(fd)
return None
def clear_completion(operation_id: str) -> None:
"""Remove a consumed completion file (idempotent cleanup)."""
p = completion_path(operation_id)
try:
p.unlink()
except OSError:
pass
+799
View File
@@ -0,0 +1,799 @@
#!/usr/bin/env python3
"""daemon.py — Gitea webhook receiver + reconciliation + resume driver (v0.2).
W/R-v0.2 invariants implemented here:
A. SINGLE-FLIGHT PER SESSION — per-session lease (waitstore.acquire_lease,
/proc-validated, atomic) + in-process inflight set. A second READY wait
for the same session stays queued until the lease releases.
B. BUSY SESSION PROTECTION — before spawning, /proc is scanned for a live
`mimo run -s <sid>`-shaped process not owned by our lease. Found → skip
launch (wait stays READY). No invented MiMo APIs; the lease is the
conservative floor against W/R-created concurrency.
C. ATOMIC SESSION LEASE — persisted {session_id, wait_id, pid, pgid,
pid_starttime, acquired_at, state}; O_EXCL create, steal only on /proc
evidence of a dead owner.
D. PROCESS TREE OWNERSHIP — workers spawn with start_new_session=True (own
process group). Watch timeout ⇒ SIGTERM group → bounded grace → SIGKILL
group → verify zero surviving group members → release lease → truthful
READY_TO_RETRY (never terminal-on-timeout).
E. TIMEOUT IS NOT SUCCESS — rc==0 maps to verdict terminal
(COMPLETED/FAILED); rc!=0 or unverifiable ⇒ RESUME_UNVERIFIED
(not schedulable, operator-requeueable); timeout ⇒ READY_TO_RETRY.
F. STALE RESUMING RECOVERY — on startup, every RESUMING record is
inspected: live lease owner ⇒ adopted and monitored; otherwise ⇒
RESUME_UNVERIFIED (+ stale lease released). Never auto-relaunched.
G. MULTIPLE WAITS, SAME SESSION — schedulable() orders oldest-first; one
continuation finishes before the next starts.
H. PIDFILE CORRECTNESS — singleton enforced by flock on daemon.pid; the
lock dies with the process, so stale pidfiles (incl. SIGKILL) cannot
admit a second daemon.
The resume command is configurable (WR_RESUME_CMD, JSON list with
{session_id}/{msg} placeholders) so the test harness can use a stub; the
default is the real mechanism: `mimo run -s <sid> -m <model> <msg>`.
"""
from __future__ import annotations
import fcntl, json, os, signal, subprocess, sys, threading, time
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent))
import waitstore
import verify
import completion_file # REAL_ASYNC_BRIDGE R3: durable completion-file delivery
RESUME_MODEL = "Verboo Code/glm-5.3-flash"
RECONCILE_SECS = int(os.environ.get("WR_RECONCILE_SECS", "60"))
RECONCILE_EVERY_TICKS = max(1, int(os.environ.get("WR_RECONCILE_TICKS", "3")))
WAKE_MIN_AGE_SECS = float(os.environ.get("WR_WAKE_MIN_AGE_SECS", "5"))
WAKE_RETRIES = int(os.environ.get("WR_WAKE_RETRIES", "3"))
WAKE_RETRY_SECS = float(os.environ.get("WR_WAKE_RETRY_SECS", "4"))
DRIVE_LOOP_SECS = int(os.environ.get("WR_DRIVE_SECS", "20"))
# REAL_ASYNC_BRIDGE §4: a RESUMING wait older than this grace without
# progress is an orphaned resume flow (thread died between lease acquire
# and release). Must exceed the longest legitimate in-flight watch
# (WATCH_SECS); default 3x. Env-overridable for deterministic tests.
WATCH_SECS = int(os.environ.get("WR_WATCH_SECS", "600"))
# REAL_ASYNC_BRIDGE §4: a RESUMING wait older than this grace without
# progress is an orphaned resume flow (thread died between lease acquire
# and release). Must exceed the longest legitimate in-flight watch
# (WATCH_SECS); default 3x. Env-overridable for deterministic tests.
ORPHAN_GRACE_SECS = int(os.environ.get("WR_ORPHAN_GRACE_SECS", str(3 * WATCH_SECS)))
TERM_GRACE_SECS = int(os.environ.get("WR_TERM_GRACE_SECS", "10"))
MAX_ATTEMPTS = int(os.environ.get("WR_MAX_ATTEMPTS", "3"))
_WR_ROOT = Path(os.environ.get("WR_ROOT", "") or Path(__file__).resolve().parent)
PIDFILE = _WR_ROOT / "daemon.pid"
LOG = _WR_ROOT / "daemon.log"
DEFAULT_RESUME_CMD = ["mimo", "run", "-s", "{session_id}", "-m", RESUME_MODEL, "{msg}"]
def log(msg: str) -> None:
with open(LOG, "a") as f:
f.write(f"{time.strftime('%H:%M:%S')} {msg}\n")
def resume_cmd(session_id: str, msg: str, wait_id: str = "", override: list | None = None) -> list[str]:
"""T15 §15D: per-wait override wins; placeholders {session_id}/{msg}/
{wait_id}. A synthetic controller session (Scaffolding stage driver)
is not a MiMo session — the global default cannot resume it, which is
exactly why fixed-sleep polling crept back into T12-T14."""
if override:
return [
c.replace("{session_id}", session_id).replace("{msg}", msg).replace("{wait_id}", wait_id) for c in override
]
tmpl = os.environ.get("WR_RESUME_CMD")
cmd = json.loads(tmpl) if tmpl else DEFAULT_RESUME_CMD
return [c.replace("{session_id}", session_id).replace("{msg}", msg).replace("{wait_id}", wait_id) for c in cmd]
# ── process-tree evidence & ownership ─────────────────────────────────────
def pgid_members(pgid: int) -> list[int]:
out = []
for d in Path("/proc").iterdir():
if not d.name.isdigit():
continue
try:
stat = (d / "stat").read_text()
fields = stat.rsplit(")", 1)[1].split()
# zombies: killed but not yet reaped. Counting them makes the
# survivor check report the direct child we just KILLed before
# communicate() reaps it (observed live 2026-09-12).
if fields[0] == "Z":
continue
if int(fields[2]) == pgid:
out.append(int(d.name))
except (OSError, IndexError, ValueError):
continue
return out
def terminate_tree(pgid: int) -> list[int]:
"""TERM → bounded grace → KILL. Returns surviving members (must be [])."""
try:
os.killpg(pgid, signal.SIGTERM)
except ProcessLookupError:
pass
deadline = time.time() + TERM_GRACE_SECS
while time.time() < deadline:
if not pgid_members(pgid):
return []
time.sleep(0.2)
try:
os.killpg(pgid, signal.SIGKILL)
except ProcessLookupError:
pass
for _ in range(50): # up to 10s for KILL to land
if not pgid_members(pgid):
return []
time.sleep(0.2)
return pgid_members(pgid)
def stray_worker_pids(session_id: str, exclude_pgids: set[int] = ()) -> list[int]:
"""Live `mimo run -s <sid>`-shaped processes not owned by our workers."""
out = []
for d in Path("/proc").iterdir():
if not d.name.isdigit():
continue
try:
parts = [p.decode(errors="replace") for p in (d / "cmdline").read_bytes().split(b"\0") if p]
except OSError:
continue
if not parts:
continue
joined = " ".join(parts)
if session_id not in joined or "-s" not in parts:
continue
if "mimo" not in joined.lower() and "@mimo-ai" not in joined.lower():
continue
try:
if os.getpgid(int(d.name)) in exclude_pgids:
continue
except OSError:
continue
out.append(int(d.name))
return out
# ── verification → transition (unchanged authority model) ─────────────────
def _authoritative_verify(rec: dict) -> tuple[str, dict]:
"""Authoritative verification with a deterministic test seam.
Production (WR_VERIFY_STUB unset): real Gitea API via verify.py — the
ONLY source of success/failure truth. Test (WR_VERIFY_STUB=path to
JSON {"<run_ref-or-sha>": verdict, "default": verdict}): stubbed
verdicts so invariant tests never touch the network. The stub is a
test fixture, not an alternate authority — no production path sets it.
"""
stub_path = os.environ.get("WR_VERIFY_STUB", "")
if stub_path:
try:
spec = json.loads(Path(stub_path).read_text())
except Exception:
return "pending", {"stub_error": "unreadable stub"}
key = str(rec.get("run_ref", "") or rec.get("sha", ""))
verdict = spec.get(key, spec.get("default", "pending"))
return verdict, {"stub": True, "key": key}
import verify
if rec.get("wait_kind") == "RELEASE_DEPLOY":
return verify.verify_release_deploy(rec.get("sha", ""), rec.get("repo_root", ""), rec.get("deployed_link", ""))
return verify.verify_run(rec.get("run_ref", ""), rec.get("sha", ""), rec.get("expected", "success"))
def try_transition(rec: dict, event: dict | None = None) -> dict:
if rec["status"] != "WAITING_EXTERNAL":
return rec
if rec.get("wait_kind") == "PROCESS_EVENT":
# T15 §15D: the matching event IS the authority. The notifier
# wrapper observed the real process exit; exit_code decides the
# verdict. No Gitea lookup applies. A duplicate event never
# reaches here (match applies only to WAITING_EXTERNAL waits).
if not event:
return rec # no event → nothing authoritative happened
try:
exit_code = int(event.get("exit_code"))
except (TypeError, ValueError):
exit_code = None
if exit_code is None:
return rec # malformed event: stay WAITING (15E hostile case)
verdict = "success" if exit_code == 0 else "failure"
evidence = {"process_event": True, "exit_code": exit_code, "operation_id": event.get("run_ref", "")}
log(f"verify {rec['wait_id']}: {verdict} {json.dumps(evidence)[:120]}")
rec["status"] = "READY_TO_RESUME"
rec["verdict"] = verdict
if verdict == "failure":
rec["failure_evidence"] = evidence
rec["process_event_evidence"] = evidence
waitstore.save(rec)
return rec
verdict, evidence = _authoritative_verify(rec)
log(f"verify {rec['wait_id']}: {verdict} {json.dumps(evidence)[:120]}")
if verdict == "success":
rec["status"] = "READY_TO_RESUME"
rec["verdict"] = "success"
elif verdict == "failure":
rec["status"] = "READY_TO_RESUME"
rec["verdict"] = "failure"
rec["failure_evidence"] = verify.failed_job_evidence(rec.get("run_ref", ""))
else:
return rec # pending/unknown → stay WAITING
waitstore.save(rec)
return rec
def continuation_msg(rec: dict) -> str:
c = rec["continuation"]
if rec.get("verdict") == "success":
return (
f"External wait satisfied (wait {rec['wait_id']}).\n"
f"Original objective: {c.get('objective', '')}\n"
f"Waited for: {c.get('waited_for', '')}\n"
f"Authoritative result: workflow success verified via Gitea API.\n"
f"SHA/run: {rec.get('sha', '')}/{rec.get('run_ref', '')}\n"
f"Verify: {c.get('verify_when_woken', '')}\n"
f"Continue from: {c.get('on_success', '')}"
)
ev = json.dumps(rec.get("failure_evidence", {}))[:400]
return (
f"External wait finished with FAILURE (wait {rec['wait_id']}).\n"
f"Original objective: {c.get('objective', '')}\n"
f"Authoritative result: workflow FAILURE verified via Gitea API.\n"
f"Failed job evidence: {ev}\n"
f"SHA/run: {rec.get('sha', '')}/{rec.get('run_ref', '')}\n"
f"Do NOT treat this as success. Continue from: {c.get('on_failure', '')}"
)
# ── resume driver (single-flight, tree-owned) ─────────────────────────────
def resume(rec: dict) -> None:
"""Run one continuation to completion. Runs on a dedicated worker thread.
Preconditions: caller verified no inflight worker for this session."""
sid, wid = rec["session_id"], rec["wait_id"]
# REAL_ASYNC_BRIDGE §2 invariant: a successful authority-verified
# operation completion must NEVER be overwritten or downgraded by a
# legacy session/FIFO delivery failure. Terminal operation state
# (COMPLETED/FAILED — stamped by the waiter's own authority
# verification) is owned by the OPERATION domain; this function owns
# only SESSION-DELIVERY. Re-read from disk: the in-memory copy may be
# stale relative to the waiter's terminal stamp.
fresh = waitstore.load(wid)
if fresh and fresh.get("status") in waitstore.TERMINAL:
log(
f"resume {wid}: skipped — operation already terminal "
f"({fresh['status']}); delivery worker never overrides "
f"operation truth"
)
return
rec = fresh or rec
msg = continuation_msg(rec)
# B: busy-session guard before touching the lease
strays = stray_worker_pids(sid)
if strays:
rec["status"] = "READY_TO_RESUME"
rec["resume_note"] = f"queued: target session busy (stray pids {strays})"
waitstore.save(rec)
log(f"queued {wid}: session busy {strays}")
return
# pre-register the lease owner as THIS daemon so acquisition is atomic
lease = waitstore.acquire_lease(sid, wid, os.getpid(), os.getpid())
if lease is None:
live = waitstore.read_lease(sid)
rec["status"] = "READY_TO_RESUME"
rec["resume_note"] = f"queued: lease held by wait {live and live.get('wait_id')}"
waitstore.save(rec)
log(f"queued {wid}: lease held")
return
rec["status"] = "RESUMING"
rec["resume_attempts"] = rec.get("resume_attempts", 0) + 1
waitstore.save(rec)
try:
proc = subprocess.Popen(
resume_cmd(sid, msg, wid, rec.get("resume_cmd")),
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True,
start_new_session=True,
)
except Exception as e:
waitstore.release_lease(sid, wid)
rec["status"] = "READY_TO_RETRY" # spawn failed pre-delivery → retryable
rec["resume_note"] = f"spawn failed: {e}"
waitstore.save(rec)
log(f"spawn {wid} failed pre-delivery: {e}")
return
pgid = proc.pid # start_new_session ⇒ pgid == child pid
waitstore.update_lease(sid, wait_id=wid, pid=proc.pid, pgid=pgid, pid_starttime=waitstore._pid_starttime(proc.pid))
log(f"launched {wid}: pid={proc.pid} pgid={pgid} attempt={rec['resume_attempts']}")
timed_out = False
try:
stdout, stderr = proc.communicate(timeout=WATCH_SECS)
rc = proc.returncode
except subprocess.TimeoutExpired:
timed_out = True
survivors = terminate_tree(pgid)
try:
stdout, stderr = proc.communicate(timeout=30)
except Exception:
stdout, stderr = "", ""
rc = proc.returncode
if survivors:
log(f"ERROR {wid}: group {pgid} survivors after KILL: {survivors}")
waitstore.release_lease(sid, wid)
if timed_out:
# D+E: timeout is NOT success. Tree terminated; retry truthfully.
if rec["resume_attempts"] >= MAX_ATTEMPTS:
rec["status"] = "RESUME_UNVERIFIED"
rec["resume_note"] = (
f"watch timeout x{rec['resume_attempts']}; process group {pgid} terminated; attempts exhausted"
)
else:
rec["status"] = "READY_TO_RETRY"
rec["resume_note"] = f"watch timeout; process group {pgid} terminated (TERM→KILL, verified); will retry"
log(f"timeout {wid}: tree {pgid} terminated, rc={rc}")
elif rc == 0:
# COMPLETION TRUTH (constraint 4): rc==0 means the headless worker
# EXITED CLEANLY — the strongest terminal evidence the supported CLI
# provides. Timeout/cancel can never reach this branch. The evidence
# chain (rc, output tail, timing) is recorded on the wait record.
terminal = "COMPLETED" if rec.get("verdict") == "success" else "FAILED"
rec["status"] = terminal
rec["resume_evidence"] = {
"kind": "worker_exited_rc0",
"rc": 0,
"output_tail": (stdout or "")[-400:],
"finished_at": waitstore.now(),
}
log(f"resumed {wid}: rc=0 → {terminal}")
else:
# Nonzero rc: delivery/completion unproven. Honest, not schedulable.
rec["status"] = "RESUME_UNVERIFIED"
rec["resume_evidence"] = {
"kind": "worker_exited_nonzero",
"rc": rc,
"output_tail": ((stdout or "") + (stderr or ""))[-400:],
"finished_at": waitstore.now(),
}
rec["resume_note"] = f"resume rc={rc}; delivery unverified"
log(f"resumed {wid}: rc={rc} → RESUME_UNVERIFIED")
waitstore.save(rec)
# ── startup recovery (invariant F) ────────────────────────────────────────
def startup_recovery() -> None:
for rec in waitstore.all_waits():
if rec.get("status") != "RESUMING":
continue
sid, wid = rec["session_id"], rec["wait_id"]
lease = waitstore.read_lease(sid)
if lease and lease.get("wait_id") == wid and waitstore._owner_alive(lease):
# Adopt the live worker and monitor it to a bounded conclusion.
pgid = lease["pgid"]
log(f"recover {wid}: adopted live worker pgid={pgid}")
deadline = time.time() + WATCH_SECS
while time.time() < deadline and pgid_members(pgid):
time.sleep(2)
survivors = terminate_tree(pgid) if pgid_members(pgid) else []
waitstore.release_lease(sid, wid)
rec["status"] = "RESUME_UNVERIFIED"
rec["resume_note"] = "adopted post-restart; outcome unverifiable" + (
f"; survivors killed: {survivors}" if survivors else ""
)
waitstore.save(rec)
log(f"recover {wid}: adopted worker ended → RESUME_UNVERIFIED")
else:
if lease:
waitstore.release_lease(sid, wid) # stale
rec["status"] = "RESUME_UNVERIFIED"
rec["resume_note"] = "recovered at daemon startup: no live owner; delivery unverifiable"
waitstore.save(rec)
log(f"recover {wid}: no live owner → RESUME_UNVERIFIED")
# ── reconciler + drive loop (invariant G: deterministic queue) ────────────
_inflight: dict[str, threading.Thread] = {}
_inflight_lock = threading.Lock()
def drive_ready() -> None:
for rec in waitstore.schedulable():
sid = rec["session_id"]
# CONTENTION POLICY (constraint 2): MiMo exposes NO supported
# busy/idle session signal (verified 2026-09-12: `mimo session list
# --format json` has no status field; no `session status` command;
# no status column in the session schema; no documented ACP/serve
# endpoint). Therefore automatic injection into interactive sessions
# is NOT YET SAFE and stays disabled. Only waits explicitly declared
# target_kind="headless" (disposable/owned sessions) auto-dispatch.
if rec.get("target_kind") != "headless":
if not rec.get("hold_reason"):
rec["hold_reason"] = (
"INTERACTIVE_AUTO_RESUME = NOT YET SAFE: "
"no supported MiMo busy/idle signal; "
"queued until operator releases"
)
waitstore.save(rec)
continue
if rec.get("ext", {}).get("resume_mode") == "self":
# REAL_ASYNC_BRIDGE §3: self-resuming wait (completion-file /
# inotify waiter owns its continuation). The daemon has NO
# delivery role here — dispatching a delivery worker would
# stamp a phantom rc!=0 over the waiter's own truthful
# terminal state (the canonical-state contradiction).
# NB: keyed on the explicit self marker, NOT on resume_cmd
# absence — records without inline resume_cmd may still be
# dispatchable via the WR_RESUME_CMD env template.
continue
with _inflight_lock:
t = _inflight.get(sid)
if t is not None and t.is_alive():
continue # single-flight: session already being driven
# B: never launch into a busy session
strays = stray_worker_pids(sid)
if strays:
log(f"drive: {rec['wait_id']} held, session busy {strays}")
continue
th = threading.Thread(target=resume, args=(rec,), daemon=True, name=f"resume-{rec['wait_id']}")
_inflight[sid] = th
# start INSIDE the lock: a just-created thread is not yet
# is_alive() until start() runs — starting outside the lock let
# the same drive cycle dispatch a second worker for the session
# (single-flight race, caught by the T2 invariant test).
th.start()
log(f"drive: dispatched {rec['wait_id']} (session {sid})")
def reconcile_once() -> None:
for rec in waitstore.pending():
if rec["status"] != "WAITING_EXTERNAL":
continue
created = rec.get("created_at", "")
try:
import calendar
age = time.time() - calendar.timegm(time.strptime(created, "%Y-%m-%dT%H:%M:%SZ"))
except ValueError:
continue
if age > RECONCILE_SECS:
try_transition(rec)
_tick = 0
def orphan_sweep() -> int:
"""REAL_ASYNC_BRIDGE §4: permanent mid-run orphan-lease recovery.
FAILURE DETECTION ONLY — never involved in normal completion
scheduling. A wait stuck in RESUMING past ORPHAN_GRACE_SECS means the
resume flow died between lease acquire and release (worker thread
lost, exception mid-watch). Reconcile exactly as startup_recovery
would have: release the lease, stamp RESUME_UNVERIFIED truthfully
(delivery unverifiable), never auto-relaunch.
"""
import calendar as _cal
healed = 0
for rec in waitstore.all_waits():
if rec.get("status") != "RESUMING":
continue
try:
updated = _cal.timegm(time.strptime(rec.get("last_updated", ""), "%Y-%m-%dT%H:%M:%SZ"))
except ValueError:
continue
if time.time() - updated < ORPHAN_GRACE_SECS:
continue # legitimate in-flight watch (up to WATCH_SECS)
wid, sid = rec["wait_id"], rec["session_id"]
lease = waitstore.read_lease(sid)
owner_dead = lease is not None and not waitstore._owner_alive(lease)
daemon_owned = lease is not None and lease.get("pid") == os.getpid()
if lease is None or owner_dead or daemon_owned:
if lease is not None:
waitstore.release_lease(sid, wid)
if rec.get("resume_attempts", 0) >= MAX_ATTEMPTS:
rec["status"] = "RESUME_UNVERIFIED"
else:
rec["status"] = "READY_TO_RETRY"
rec["resume_note"] = (
"orphaned mid-run: resume flow died between lease acquire "
"and delivery ("
+ ("lease owner dead" if owner_dead else "resume thread lost" if daemon_owned else "no lease")
+ "); orphan sweep recovered"
)
waitstore.save(rec)
log(f"orphan-sweep {wid}: {rec['status']} — {rec['resume_note']}")
healed += 1
return healed
def reconciler() -> None:
global _tick
while True:
# v0.3: the local-runner wake is the fast path; periodic
# authoritative verification demotes to a slower fallback
# (missed-event + daemon-restart recovery), not API polling.
_tick += 1
if _tick % RECONCILE_EVERY_TICKS == 0:
try:
reconcile_once()
except Exception as e:
log(f"reconcile error: {e}")
try:
orphan_sweep() # §4 failure detection — bounded, periodic
except Exception as e:
log(f"orphan-sweep error: {e}")
try:
drive_ready()
except Exception as e:
log(f"drive error: {e}")
with _inflight_lock:
for sid, t in list(_inflight.items()):
if not t.is_alive():
del _inflight[sid]
time.sleep(DRIVE_LOOP_SECS)
# ── webhook receiver (wake signal only) ───────────────────────────────────
def wake_sweep(event: dict, eid: str) -> dict:
"""Sweep WAITING_EXTERNAL waits through authoritative verification.
Runs on a background thread (the hook's HTTP response returns
instantly, minimising the runner's offline window). If any verified
wait got 'pending' — the normal case for a job that finished
microseconds ago: the post-task hook fires after results are reported
but before the runner's final task acknowledgement flips server-side
status — retry on a BOUNDED event-triggered schedule (default 4s x3),
never a polling loop. The final ack lands milliseconds after the hook
exits, so the first retry almost always sees the terminal state.
"""
arrival = time.time()
log(f"local wake {eid}: {json.dumps(event)[:140]}")
import calendar
def sweep() -> tuple[int, int, int]:
verified = advanced = pending = 0
for rec in waitstore.pending():
if rec["status"] != "WAITING_EXTERNAL":
continue
try:
age = time.time() - calendar.timegm(time.strptime(rec.get("created_at", ""), "%Y-%m-%dT%H:%M:%SZ"))
except ValueError:
continue
if age < WAKE_MIN_AGE_SECS:
continue
verified += 1
before = rec["status"]
try_transition(rec)
if rec["status"] != before and rec["status"] == "READY_TO_RESUME":
advanced += 1
elif rec["status"] == "WAITING_EXTERNAL":
pending += 1
return verified, advanced, pending
verified, advanced, pending = sweep()
log(
f"local wake {eid}: verified={verified} advanced={advanced} "
f"pending={pending} sweep_ms={int((time.time() - arrival) * 1000)}"
)
for attempt in range(1, WAKE_RETRIES + 1):
# Retry while the sweep didn't conclusively advance anything:
# pending verdicts (ack-window) AND fresh-wait skips (age gate).
# Bounded, event-triggered — not a polling loop.
if not pending and verified:
break
time.sleep(WAKE_RETRY_SECS)
verified, advanced, pending = sweep()
log(
f"local wake {eid}: retry{attempt} verified={verified} "
f"advanced={advanced} pending={pending} "
f"total_ms={int((time.time() - arrival) * 1000)}"
)
return {"event_id": eid}
class Handler(BaseHTTPRequestHandler):
def do_POST(self):
if self.path == "/process-event":
# T15 §15D: process-exit events from builder/controller
# notifiers. Minimal dedicated endpoint — the Gitea webhook
# path stays untouched. Payload: {operation_id, exit_code,
# completed_at} + OPTIONAL provider/event_type/sha (T16
# §16C/§16E: the CI adapter registers as provider="gitea",
# event_type="ci_completed"; defaults preserve the T15 builder
# identity so existing notifiers are unaffected). The event is
# a WAKE, never truth — resumed controllers re-read canonical
# authority before any verdict.
length = int(self.headers.get("Content-Length", 0))
body = self.rfile.read(length)
try:
payload = json.loads(body) if body else {}
except json.JSONDecodeError:
self.send_response(400)
self.end_headers()
return
event = {
"provider": str(payload.get("provider", "builder")),
"event_type": str(payload.get("event_type", "builder_exit")),
"run_ref": str(payload.get("operation_id", "")) or None,
"sha": payload.get("sha"),
"exit_code": payload.get("exit_code"),
"completed_at": payload.get("completed_at") or "",
}
event = {k: v for k, v in event.items() if v is not None}
eid = waitstore.record_event(event)
log(f"process-event {eid}: {json.dumps(event)[:140]}")
# REAL_ASYNC_BRIDGE (R3): durable completion-file delivery.
# Every event reaching the bridge is written as
# resumes/<operation_id>.done so inotify waiters wake on the
# kernel event (R4) with no FIFO/lease machinery, and the
# event survives daemon AND waiter restarts (R9). Atomic
# rename; duplicate events rewrite identical content (R10).
_op_id = str(payload.get("operation_id", ""))
if _op_id:
try:
# Stable identity only: duplicate deliveries of the
# same logical event must produce byte-identical
# completion files (R10 idempotence by construction).
# completed_at is volatile and lives in the durable
# event log; the file is a WAKE SIGNAL, never truth.
_stable = {
k: event.get(k)
for k in ("provider", "event_type", "run_ref", "sha", "exit_code")
if event.get(k) is not None
}
completion_file.write_completion(_op_id, _stable)
except Exception as e: # noqa: BLE001 — delivery best-effort; wait-record transition + watchdog recovery still cover the lost file
log(f"process-event {eid}: completion-file write failed: {e}")
matched = 0
for rec in waitstore.pending():
if rec["status"] == "WAITING_EXTERNAL" and waitstore.match(rec, event):
matched += 1
try_transition(rec, event)
# matched READY controller waits are dispatched IMMEDIATELY
# (event-driven, no floor). Guard: only never-resumed waits —
# a duplicate/late event must not double-dispatch (15E);
# single-flight lease + this guard together make resume
# idempotent.
for rec in waitstore.pending():
if rec["status"] == "READY_TO_RESUME" and rec.get("resume_cmd") and rec.get("resume_attempts", 0) == 0:
threading.Thread(target=resume, args=(rec,), daemon=True, name=f"resume-{rec['wait_id']}").start()
matched += 1
try:
self.send_response(200)
self.end_headers()
self.wfile.write(json.dumps({"event_id": eid, "matched": matched}).encode())
except (BrokenPipeError, ConnectionResetError):
pass
return
if self.path == "/wake":
length = int(self.headers.get("Content-Length", 0))
body = self.rfile.read(length)
try:
payload = json.loads(body) if body else {}
except json.JSONDecodeError:
self.send_response(400)
self.end_headers()
return
event = {
"provider": "gitea-local-runner",
"task_id": str(payload.get("task_id", "")) or None,
"run_id": str(payload.get("run_id", "")) or None,
"repository": str(payload.get("repository", "")) or None,
"job_result": str(payload.get("job_result", "")) or None,
}
event = {k: v for k, v in event.items() if v}
eid = waitstore.record_event(event)
# Respond instantly; sweep on a worker thread. The hook is
# fire-and-forget (curl -m 2) — a broken pipe on write is
# harmless and must not propagate.
try:
threading.Thread(
target=wake_sweep, args=(event, eid), daemon=True, name=f"wake-{payload.get('task_id', '?')}"
).start()
except Exception as e:
log(f"wake spawn error: {e}")
try:
self.send_response(200)
self.end_headers()
self.wfile.write(json.dumps({"queued": True, "event_id": eid}).encode())
except (BrokenPipeError, ConnectionResetError):
pass
return
if self.path != "/webhook":
self.send_response(404)
self.end_headers()
return
length = int(self.headers.get("Content-Length", 0))
body = self.rfile.read(length)
try:
payload = json.loads(body)
except json.JSONDecodeError:
self.send_response(400)
self.end_headers()
return
action = payload.get("action") or payload.get("event_type") or ""
wf = payload.get("workflow_run") or {}
event = {
"provider": "gitea",
"event_type": f"workflow.{action}" if wf else action,
"sha": (wf.get("head_sha") or payload.get("sha") or "")[:12] or None,
"run_ref": str(wf.get("id") or payload.get("run_number") or "") or None,
}
event = {k: v for k, v in event.items() if v}
eid = waitstore.record_event(event)
log(f"webhook event {eid}: {json.dumps(event)[:140]}")
matched = 0
for rec in waitstore.pending():
if rec["status"] == "WAITING_EXTERNAL" and waitstore.match(rec, event):
matched += 1
try_transition(rec)
self.send_response(200)
self.end_headers()
self.wfile.write(json.dumps({"event_id": eid, "matched": matched}).encode())
def do_GET(self):
if self.path == "/health":
self.send_response(200)
self.end_headers()
self.wfile.write(b'{"ok":true}')
return
self.send_response(404)
self.end_headers()
def log_message(self, *a):
pass
def main() -> int:
port = int(sys.argv[1]) if len(sys.argv) > 1 else 8791
# H (constraint 1): flock is the SINGLETON AUTHORITY. daemon.pid's
# content is diagnostic metadata only — it never gates startup, never
# implies liveness, and is overwritten after the exclusive lock is held.
# Stale pid content (incl. SIGKILL debris) is thus harmless by design.
PIDFILE.parent.mkdir(parents=True, exist_ok=True)
lock_fd = os.open(PIDFILE, os.O_CREAT | os.O_RDWR, 0o644)
try:
fcntl.flock(lock_fd, fcntl.LOCK_EX | fcntl.LOCK_NB)
except OSError:
log("refusing start: another daemon holds the pidfile flock")
print("daemon already running (pidfile flock held)", file=sys.stderr)
return 1
os.ftruncate(lock_fd, 0)
os.write(lock_fd, f"{os.getpid()}\n".encode()) # diagnostic, lock held for life
startup_recovery()
t = threading.Thread(target=reconciler, daemon=True)
t.start()
log(f"daemon starting on :{port}")
srv = ThreadingHTTPServer(("0.0.0.0", port), Handler)
try:
srv.serve_forever()
except KeyboardInterrupt:
pass
return 0
if __name__ == "__main__":
sys.exit(main())
+246
View File
@@ -0,0 +1,246 @@
#!/usr/bin/env python3
"""verify.py — authoritative Gitea verification (webhook ≠ success).
Queries the Gitea API for the TRUE state of the run/job/commit the wait
references. Returns (verdict, evidence). verdict ∈ {success, failure,
pending, unknown}. Only this module may move a wait out of
WAITING_EXTERNAL.
"""
from __future__ import annotations
import json, subprocess
from pathlib import Path
HOST = "https://gitea.thingscouldgetdicey.online"
REPO = "conductor/rune"
def _token() -> str:
# Canonical ladder without importing Rune: env → token file → git store
import os
tok = os.environ.get("GITEA_TOKEN", "").strip()
if tok:
return tok
tf = os.path.expanduser("~/.config/opencode/secrets/gitea-token")
if os.path.isfile(tf):
return open(tf).read().strip()
r = subprocess.run(
["git", "credential", "fill"],
input="protocol=https\nhost=gitea.thingscouldgetdicey.online\nusername=conductor\n\n",
capture_output=True,
text=True,
timeout=10,
)
for line in r.stdout.splitlines():
if line.startswith("password="):
return line[9:]
raise RuntimeError("no gitea credential available")
def _api(path: str) -> tuple[int, object]:
import urllib.request
req = urllib.request.Request(f"{HOST}/api/v1/repos/{REPO}{path}", headers={"Authorization": f"token {_token()}"})
try:
with urllib.request.urlopen(req, timeout=20) as r:
return r.status, json.loads(r.read())
except urllib.error.HTTPError as e:
return e.code, {"error": e.read().decode()[:200]}
def _jobs_list(run_ref: str):
"""GET jobs for a run, unwrapping the {'jobs': [...]} envelope."""
s, data = _api(f"/actions/runs/{run_ref}/jobs")
if s != 200:
return s, None
if isinstance(data, dict):
data = data.get("jobs", [])
return s, data if isinstance(data, list) else None
def _resolve_run_id(run_ref: str, sha: str) -> str:
"""Task-list ids are NOT run ids. If run_ref lookup 404s, resolve the
real run id by head SHA via /actions/runs (T15: run 6907 vs task 15743)."""
if run_ref:
s, jobs = _jobs_list(run_ref)
if s == 200 and jobs:
return run_ref
if sha:
s, runs = _api(f"/actions/runs?limit=30")
items = runs.get("workflow_runs", []) if isinstance(runs, dict) else (runs if isinstance(runs, list) else [])
# One SHA fans out to multiple runs (lint + deploy-only). Prefer a
# substantive (non-skipped) run; a skipped-only run proves nothing.
fallback = ""
for r in items:
if str(r.get("head_sha", "")).startswith(sha):
rid = str(r.get("id"))
if r.get("conclusion") != "skipped":
return rid
fallback = fallback or rid
return fallback
return ""
def verify_run(run_ref: str, sha: str, expected: str) -> tuple[str, dict]:
"""run_ref = actions run id (or task id — resolved via SHA lookup).
Defect fixed 2026-09-12 (surfaced by W/R-v0.3 live proof, run 7110):
the jobs query here used raw _api + isinstance(jobs, list), but this
Gitea wraps jobs in the {"jobs": [...]} envelope — the check always
failed, so EVERY EXACT_WORKFLOW verdict silently fell through to the
aggregate commit-status fallback, where unrelated runs on the same
SHA (multi-run fan-out: ci.yml + deploy-only) poison the verdict.
Use _jobs_list (unwraps the envelope), same as _resolve_run_id."""
run_ref = _resolve_run_id(run_ref, sha)
if run_ref:
s, jobs = _jobs_list(run_ref)
if s == 200 and isinstance(jobs, list) and jobs:
conclusions = {j.get("name"): j.get("conclusion") for j in jobs}
statuses = {j.get("status") for j in jobs}
if statuses <= {"completed"}:
verdict = "success" if set(conclusions.values()) <= {"success", "skipped"} else "failure"
return verdict, {"run_ref": run_ref, "jobs": conclusions}
return "pending", {"run_ref": run_ref, "statuses": sorted(statuses)}
if sha:
s, st = _api(f"/commits/{sha}/status")
if s == 200 and isinstance(st, dict):
state = st.get("state", "unknown") # success|error|failure|pending|warning
rid = _resolve_run_id("", sha) # attach run id so failure evidence works
if state == "success":
return "success", {"sha": sha, "state": state, "run_ref": rid}
if state in ("error", "failure"):
return "failure", {"sha": sha, "state": state, "run_ref": rid}
return "pending", {"sha": sha, "state": state}
return "unknown", {"run_ref": run_ref, "sha": sha}
def failed_job_evidence(run_ref: str, sha: str = "") -> dict:
"""For failure continuations: exact failing job + conclusion."""
run_ref = _resolve_run_id(run_ref, sha)
if not run_ref:
return {}
s, jobs = _jobs_list(run_ref)
if s != 200 or not isinstance(jobs, list):
return {}
bad = [j for j in jobs if j.get("conclusion") not in ("success", "skipped", None)]
return {
"failed_jobs": [
{"name": j.get("name"), "conclusion": j.get("conclusion"), "url": j.get("url", "")} for j in bad
]
}
# ── RELEASE_DEPLOY verification (W/R v0.1, overnight handoff Part 2) ──────
# Aggregate commit status is NOT a valid completion authority for Rune's
# release/deploy flow: the release successor SHA, not the source SHA, is what
# converges (observed live: wr-1789179026 stranded on pending while 0.66.15
# was deployed). The authority chain is:
# source SHA → source runs terminal → release successor commit (descendant)
# → successor runs success → deployed/current identity converges.
def _git(args: list[str], repo_root: str) -> str:
import subprocess
r = subprocess.run(["git"] + args, capture_output=True, text=True, cwd=repo_root or None, timeout=15)
if r.returncode != 0:
raise RuntimeError(f"git {' '.join(args[:2])}: {r.stderr.strip()[:120]}")
return r.stdout
def _runs_for_sha(sha: str) -> list[dict]:
s, runs = _api("/actions/runs?limit=50")
items = runs.get("workflow_runs", []) if isinstance(runs, dict) else []
return [r for r in items if str(r.get("head_sha", "")).startswith(sha)]
def _sha_verdict_from_runs(runs: list[dict]) -> tuple[str, dict]:
"""success | failure | pending from a SHA's workflow runs.
Terminal verdict ONLY when every run is completed — mixed states
(some success, some still in flight) must stay PENDING (observed live:
a SHA with 1 completed-success + 1 queued + 1 in-progress was judged
success mid-flight; wr-1789182522 2026-09-12)."""
if not runs:
return "pending", {"note": "no runs found"}
non_terminal = [r for r in runs if r.get("status") != "completed"]
if non_terminal:
return "pending", {"in_flight": len(non_terminal)}
conclusions = {r.get("name"): r.get("conclusion") for r in runs}
bad = {n: c for n, c in conclusions.items() if c == "failure"}
if bad:
return "failure", {"failed": bad}
return "success", {"runs": conclusions}
def verify_release_deploy(source_sha: str, repo_root: str = "", deployed_link: str = "") -> tuple[str, dict]:
"""RELEASE_DEPLOY authority chain. Returns (verdict, evidence)."""
source_sha = (source_sha or "")[:12]
ev: dict = {"source_sha": source_sha, "kind": "RELEASE_DEPLOY"}
# 1. Source SHA's own runs must be terminal and healthy.
src_runs = _runs_for_sha(source_sha)
src_verdict, src_ev = _sha_verdict_from_runs(src_runs)
ev["source"] = src_ev
if src_verdict != "success":
return src_verdict, ev
# 2. Release successor: first chore(release) commit descending from source.
if not repo_root:
return "pending", {**ev, "note": "no repo_root — cannot check lineage"}
try:
out = _git(
[
"log",
"--format=%H %s",
"--reverse",
f"{source_sha}..master",
"--grep=^chore\\(release\\)",
"--extended-regexp",
],
repo_root,
)
except RuntimeError as e:
return "pending", {**ev, "note": str(e)}
successors = [l for l in out.splitlines() if l.strip()]
if not successors:
return "pending", {**ev, "note": "no release successor yet"}
succ_line = successors[0]
succ_sha_full, _, succ_subject = succ_line.partition(" ")
succ_sha = succ_sha_full[:12]
ev["successor"] = {"sha": succ_sha, "subject": succ_subject[:80]}
# Ancestry is guaranteed by the range, but verify explicitly (deterministic
# lineage over title guessing):
try:
_git(["merge-base", "--is-ancestor", source_sha, succ_sha_full], repo_root)
except RuntimeError:
return "failure", {**ev, "note": "successor is not a descendant of source"}
# 3. Successor runs must be terminal and healthy.
succ_runs = _runs_for_sha(succ_sha)
succ_verdict, succ_ev = _sha_verdict_from_runs(succ_runs)
ev["successor"]["runs"] = succ_ev
if succ_verdict != "success":
return succ_verdict, ev
# 4. Deployed identity convergence. A mismatch is FAILURE only when the
# successor's runs are ALL completed — if any is still running/queued the
# deploy may simply not have propagated yet → PENDING (observed live:
# reconciler checked mid-deploy, verdict failure, deployment converged
# ~2 min later; wr-1789182522 2026-09-12).
if deployed_link:
link = Path(deployed_link)
if link.is_symlink() or link.is_dir():
deployed = str(link.resolve())
deployed_id = Path(deployed).name
ev["deployed"] = deployed_id
if not deployed_id.startswith(succ_sha[:12]):
still = [r for r in _runs_for_sha(succ_sha) if r.get("status") != "completed"]
if still:
return "pending", {**ev, "note": "deploy propagating (runs in flight)"}
return "failure", {**ev, "note": f"deployed {deployed_id} != successor {succ_sha} (all runs terminal)"}
else:
return "failure", {**ev, "note": f"deployed link missing: {deployed_link}"}
return "success", ev
+337
View File
@@ -0,0 +1,337 @@
#!/usr/bin/env python3
"""waitstore.py — wait/resume state machine v0.2 (developer tooling, NOT Rune).
States:
RUNNABLE → WAITING_EXTERNAL → READY_TO_RESUME → RESUMING → COMPLETED | FAILED
↑ │
│ ├─(watch timeout, tree killed)
│ └─(rc!=0 / unverifiable)
READY_TO_RETRY ←─────┘
RESUME_UNVERIFIED : delivery after crash/timeout cannot be proven.
TERMINAL-ish — never auto-scheduled; explicit
`requeue()` required to make it READY_TO_RESUME.
TIMED_OUT : external event never arrived within the wait budget.
Waits persist as waits/<wait_id>.json (atomic tmp+rename).
Leases persist as leases/<session_id>.lease.json (atomic tmp+rename,
validated against /proc so a dead or PID-reused owner is stealable).
"""
from __future__ import annotations
import fcntl, json, os, tempfile, time, uuid
from pathlib import Path
ROOT = Path(os.environ.get("WR_ROOT", "") or Path(__file__).resolve().parent)
WAITS = ROOT / "waits"
EVENTS = ROOT / "events"
LEASES = ROOT / "leases"
SCHEDULABLE = {"READY_TO_RESUME", "READY_TO_RETRY"}
VALID_STATES = {
"RUNNABLE",
"WAITING_EXTERNAL",
"READY_TO_RESUME",
"RESUMING",
"COMPLETED",
"FAILED",
"READY_TO_RETRY",
"RESUME_UNVERIFIED",
"TIMED_OUT",
}
TERMINAL = {"COMPLETED", "FAILED", "RESUME_UNVERIFIED", "TIMED_OUT"}
def _atomic_write(path: Path, data: dict) -> None:
path.parent.mkdir(parents=True, exist_ok=True)
fd, tmp = tempfile.mkstemp(dir=str(path.parent), prefix=".tmp-")
try:
with os.fdopen(fd, "w") as f:
json.dump(data, f, indent=1, sort_keys=True)
os.replace(tmp, path)
# T17 17C: the bridge root is SHARED across users (deploy waiter
# runs as the runner user; daemon as nick). mkstemp creates 0600 —
# daemon re-saves locked the runner user out of records it must
# read (waitstore.load in await_resume_event; find_matching_event
# replay scan silently skipped them). 0644: owner writes, all read.
os.chmod(path, 0o644)
except BaseException:
if os.path.exists(tmp):
os.unlink(tmp)
raise
def now() -> str:
return time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())
def new_wait(
*,
session_id: str,
provider: str,
event_type: str,
repo: str,
sha: str = "",
run_ref: str = "",
expected: str = "success",
wait_kind: str = "EXACT_WORKFLOW",
target_kind: str = "interactive",
repo_root: str = "",
deployed_link: str = "",
objective: str = "",
waited_for: str = "",
verify_when_woken: str = "",
on_success: str = "",
on_failure: str = "",
resume_cmd: list | None = None,
) -> dict:
wid = f"wr-{int(time.time())}-{uuid.uuid4().hex[:6]}"
rec = {
"wait_id": wid,
"session_id": session_id,
"created_at": now(),
"provider": provider,
"event_type": event_type,
"repo": repo,
"sha": sha,
"run_ref": run_ref,
"expected": expected,
# T15 §15D: PROCESS_EVENT — a wait whose authoritative verdict is
# the matching process-exit event itself (exit_code carried on the
# event), e.g. a builder/controller process completing. The event
# IS the authority here (the notifier wrapper observed the real
# process exit); no Gitea lookup applies.
"wait_kind": wait_kind
if wait_kind in ("EXACT_WORKFLOW", "RELEASE_DEPLOY", "PROCESS_EVENT")
else "EXACT_WORKFLOW",
# CONTENTION POLICY: "interactive" (default, conservative) never
# auto-dispatches — MiMo exposes NO supported busy/idle session
# signal, so injecting into a possibly-busy interactive session is
# NOT YET SAFE. Only explicitly declared headless/disposable
# targets ("headless") are auto-resumed.
"target_kind": target_kind if target_kind in ("headless", "interactive") else "interactive",
"repo_root": repo_root,
"deployed_link": deployed_link,
# T15 §15D: per-wait resume command override (placeholder template,
# same substitution as WR_RESUME_CMD: {session_id}/{msg}/{wait_id}).
# A synthetic controller session (e.g. a Scaffolding stage driver)
# is NOT a MiMo session — the global mimo-shaped default cannot
# resume it, which is exactly why fixed-sleep polling crept back
# in T12-T14. Per-wait override makes ANY registered continuation
# target resumable through the same bridge.
"resume_cmd": list(resume_cmd) if resume_cmd else None,
"status": "WAITING_EXTERNAL",
"last_verified": "",
"resume_attempts": 0,
"continuation": {
"objective": objective,
"waited_for": waited_for,
"verify_when_woken": verify_when_woken,
"on_success": on_success,
"on_failure": on_failure,
},
}
_atomic_write(WAITS / f"{wid}.json", rec)
return rec
def load(wid: str) -> dict | None:
p = WAITS / f"{wid}.json"
return json.loads(p.read_text()) if p.is_file() else None
def save(rec: dict) -> None:
assert rec.get("status") in VALID_STATES, rec.get("status")
rec["last_updated"] = now()
_atomic_write(WAITS / f"{rec['wait_id']}.json", rec)
def all_waits() -> list[dict]:
out = []
for p in WAITS.glob("*.json"):
try:
out.append(json.loads(p.read_text()))
except json.JSONDecodeError:
continue
return out
def pending() -> list[dict]:
return [r for r in all_waits() if r.get("status") in {"WAITING_EXTERNAL"} | SCHEDULABLE]
def schedulable() -> list[dict]:
"""READY waits, oldest first — deterministic queue order."""
rs = [r for r in all_waits() if r.get("status") in SCHEDULABLE]
rs.sort(key=lambda r: (r.get("created_at", ""), r.get("wait_id", "")))
return rs
def requeue(wid: str, note: str) -> dict | None:
"""Operator-explicit requeue of a RESUME_UNVERIFIED/RESUME_FAILED wait."""
rec = load(wid)
if not rec:
return None
rec["status"] = "READY_TO_RESUME"
rec["resume_note"] = note
save(rec)
return rec
# ── events (wake signals, idempotent) ─────────────────────────────────────
def record_event(event: dict) -> str:
import hashlib
body = json.dumps(event, sort_keys=True)
eid = hashlib.sha256(body.encode()).hexdigest()[:16]
f = EVENTS / f"{eid}.json"
if not f.is_file():
_atomic_write(f, {"event_id": eid, "received_at": now(), "event": event})
return eid
def match(rec: dict, event: dict) -> bool:
if rec.get("provider") != event.get("provider"):
return False
if rec.get("event_type") and event.get("event_type") and rec["event_type"] != event["event_type"]:
return False
if rec.get("sha") and event.get("sha") and rec["sha"] != event["sha"]:
return False
if rec.get("run_ref") and event.get("run_ref") and rec["run_ref"] != event["run_ref"]:
return False
return True
# ── leases (per-session single-flight, /proc-validated) ───────────────────
#
# Invariant 3 (PID reuse): liveness is NEVER "PID exists". The lease records
# pid + pgid + process starttime (/proc/<pid>/stat field 22); all three must
# match or the owner is a different process wearing a recycled PID.
#
# Invariant 1 (flock as authority): the lease file's flock serializes
# read-modify-write across processes and dies with its holder, so a crashed
# daemon can never wedge the lock. The lease JSON + /proc decide who OWNS the
# session; the flock only prevents racing acquirers from double-stealing.
_lease_fds: dict[str, int] = {} # session_id → open fd holding the flock
def _pid_starttime(pid: int) -> str | None:
"""Field 22 of /proc/<pid>/stat — distinguishes PID reuse."""
try:
stat = Path(f"/proc/{pid}/stat").read_text()
return stat.rsplit(")", 1)[1].split()[19]
except (OSError, IndexError):
return None
def _owner_alive(lease: dict) -> bool:
pid = lease.get("pid")
if not pid or not Path(f"/proc/{pid}").is_dir():
return False
if _pid_starttime(pid) != lease.get("pid_starttime"):
return False # PID reused by an unrelated process
try:
if os.getpgid(pid) != lease.get("pgid"):
return False
except OSError:
return False
return True
def lease_path(session_id: str) -> Path:
# T16 §16C finding (observed live in daemon.log): session ids like
# "controller-<op>-Verboo Code/glm-5.3-flash" contain "/" — the raw
# embed made lease creation raise FileNotFoundError, so resume
# delivery for those waits could never succeed. Sanitize to a flat
# filesystem-safe name; the hash suffix prevents collisions between
# ids that sanitize identically.
import hashlib as _hashlib
import re as _re
safe = _re.sub(r"[^A-Za-z0-9._-]+", "_", session_id)[:80]
digest = _hashlib.sha256(session_id.encode()).hexdigest()[:10]
return LEASES / f"{safe}-{digest}.lease.json"
def read_lease(session_id: str) -> dict | None:
p = lease_path(session_id)
if not p.is_file():
return None
try:
return json.loads(p.read_text())
except json.JSONDecodeError:
return None
def _locked_lease_fd(session_id: str) -> int | None:
"""Open the lease file and take its flock (non-blocking). The fd stays
open (lock held) until release_lease closes it."""
if session_id in _lease_fds:
return _lease_fds[session_id] # already hold it
LEASES.mkdir(parents=True, exist_ok=True)
fd = os.open(lease_path(session_id), os.O_CREAT | os.O_RDWR, 0o600)
try:
fcntl.flock(fd, fcntl.LOCK_EX | fcntl.LOCK_NB)
except OSError:
os.close(fd)
return None # another process holds the lock — mid-acquire
_lease_fds[session_id] = fd
return fd
def _write_lease_locked(session_id: str, lease: dict) -> None:
fd = _lease_fds[session_id]
os.ftruncate(fd, 0)
os.lseek(fd, 0, os.SEEK_SET)
os.write(fd, json.dumps(lease, indent=1, sort_keys=True).encode())
os.fsync(fd)
def acquire_lease(session_id: str, wait_id: str, pid: int, pgid: int) -> dict | None:
"""Atomically create or steal the session lease. Returns the lease dict,
or None if a live owner holds it (or another process is mid-steal).
Staleness is decided by /proc identity evidence, never by age alone."""
fd = _locked_lease_fd(session_id)
if fd is None:
return None
existing = read_lease(session_id)
if existing and _owner_alive(existing):
_lease_fds.pop(session_id, None)
os.close(fd)
return None # live worker owns this session
lease = {
"session_id": session_id,
"wait_id": wait_id,
"pid": pid,
"pgid": pgid,
"pid_starttime": _pid_starttime(pid),
"acquired_at": now(),
"state": "RESUMING",
}
_write_lease_locked(session_id, lease)
return lease
def update_lease(session_id: str, **fields) -> None:
lease = read_lease(session_id) or {}
lease.update(fields)
_write_lease_locked(session_id, lease)
def release_lease(session_id: str, wait_id: str) -> bool:
"""Release only if the current lease belongs to this wait (no stealing
a successor's lease during a slow shutdown path). Closes the flock fd."""
lease = read_lease(session_id)
if not (lease and lease.get("wait_id") == wait_id):
return False
fd = _lease_fds.pop(session_id, None)
if fd is not None:
try:
fcntl.flock(fd, fcntl.LOCK_UN)
except OSError:
pass
os.close(fd)
lease_path(session_id).unlink(missing_ok=True)
return True
+124
View File
@@ -0,0 +1,124 @@
import { execFile } from "node:child_process"
import { existsSync, appendFileSync } from "node:fs"
// builder-bridge — Rune Core preflight for the MiMo builder (handoff
// 2026-09-10 §3–§7, Option C bridge tranche). For each user turn, the hook
// extracts the user's message from the outgoing LLM request, runs the Rune
// Core builder-bridge preflight (deterministic: route classification +
// memory selection + active-Scaffolding projection, ZERO model calls), and
// appends a compact capsule to the final user message. Same Rune Core the
// TUI/operator path uses — this file is a thin adapter with no cognition.
//
// CANONICAL SOURCE: config/mimo-hooks/builder-bridge.ts
// Installed to ~/.mimocode/hooks/builder-bridge.ts by
// `scripts/install_mimo_hook.py` (hash-verified, drift-detecting — the same
// contract as event-wait-guard.ts). T22: this file was previously
// UNVERSIONED and hardcoded an ephemeral interpreter path (/tmp/ci-venv),
// which silently killed the whole edge; both defects are repaired here.
//
// Overhead contract (§7/§8): capsule ≤ ~300 tokens; a repeat/empty task
// costs ~0ms (TTL cache); a fresh task ~150ms (bounded retrieval). The hook
// degrades silently to no-injection on any failure — it must never block
// the builder.
//
// Injection policy: only append when the capsule is non-empty. A plain
// "hello" gets nothing (§5: if nothing relevant exists, inject nothing).
const BRIDGE = "/mnt/workdrive/issue161-harness/src/rune/builder_bridge_cli.py"
const MARKER_PREFIX = "/tmp/rune-bridge-"
// Interpreter resolution (T22 repair): the previous hardcoded
// "/tmp/ci-venv/bin/python" is an EPHEMERAL path that no longer exists, so
// every bridge call failed and the hook silently degraded — the MiMo edge
// received no Rune Core preflight at all (zero fire-log lines). Resolve
// against durable candidates, first existing wins; env override wins over
// all of them. If nothing exists the hook degrades as before.
const PY_CANDIDATES = [
process.env.MIMO_BRIDGE_PY,
"/mnt/workdrive/issue161-harness/.test-venv/bin/python",
"/home/nick/.venvs/memory/bin/python3",
"/usr/bin/python3",
].filter((p) => typeof p === "string" && p.length > 0)
function resolvePy() {
for (const p of PY_CANDIDATES) {
try {
if (existsSync(p)) return p
} catch {}
}
return null
}
// Per-process dedupe: identical task text within the cache TTL does not need
// a second bridge call — the CLI has its own TTL cache, but skipping the
// process spawn entirely for the same message text within 10 minutes keeps
// repeats at ~0ms.
const lastText = new Map() // text -> timestamp
const TTL = 600_000
function extractUserText(messages) {
// messages: Array<{ info: Message, parts: Part[] }> — newest last.
for (let i = messages.length - 1; i >= 0; i--) {
const m = messages[i]
if (m?.info?.role !== "user") continue
const texts = []
for (const p of m.parts ?? []) {
if (p?.type === "text" && typeof p.text === "string") texts.push(p.text)
}
if (texts.length) return texts.join("\n").slice(0, 4000)
}
return ""
}
export default {
"experimental.chat.messages.transform": async (input, output) => {
try {
if (!Array.isArray(output.messages) || output.messages.length === 0) return
const userText = extractUserText(output.messages)
if (!userText || userText.length < 12) return // trivial/noise guard
// Harness-internal steps (checkpoint writer, compaction, system
// reminders) are not builder tasks — no capsule (measured: the fire
// log showed checkpoint-writer steps receiving capsules 2026-09-10).
if (/^(<system-reminder>|EXTRACTION REQUIRED)/.test(userText.trim())) return
const now = Date.now()
const prev = lastText.get(userText)
if (prev !== undefined && now - prev < TTL) return // dedupe repeats
lastText.set(userText, now)
if (lastText.size > 64) {
// evict oldest
let oldestKey = null, oldestVal = Infinity
for (const [k, v] of lastText) if (v < oldestVal) { oldestVal = v; oldestKey = k }
if (oldestKey) lastText.delete(oldestKey)
}
const py = resolvePy()
if (!py) return // no durable interpreter — degrade (never block)
const capsule = await new Promise((resolve) => {
execFile(py, [BRIDGE, userText], { timeout: 15_000 }, (err, stdout) => {
resolve(err ? "" : (stdout?.toString() ?? ""))
})
})
if (!capsule.trim()) return
// Durable fire-trace: one line per ACTUAL injection into an outgoing
// model request (handoff §1 proof requirement). Not a canary — this is
// standing observability for the bridge's consumer edge.
try {
appendFileSync("/tmp/rune-bridge-fire.log",
JSON.stringify({ ts: new Date().toISOString(), task: userText.slice(0, 80), capsule_tokens: Math.round(capsule.length / 4), py }) + "\n")
} catch {}
// Append the capsule to the LAST user message (the one being answered).
const last = output.messages[output.messages.length - 1]
if (last?.parts && Array.isArray(last.parts)) {
last.parts.push({
type: "text",
text: "\n\n<rune-preflight>\n" + capsule.trim() + "\n</rune-preflight>\n(Injected by Rune Core builder bridge — deterministic preflight, zero model calls. Relevant state above; ignore if not applicable to this task.)",
})
}
} catch {
// never block the builder on bridge failure
}
},
}
+78 -40
View File
@@ -1,54 +1,92 @@
import { tool } from "@mimo-ai/plugin"
import { execSync } from "child_process"
// await_operation — T21.3 §21.3C: FIRST-CLASS async wait tool.
// Uses the plugin tool() API with args (not parameters).
export const AwaitOperation = tool({
description: [
"Wait for an asynchronous external operation (CI, deploy, release) to complete.",
"Registers on the event bridge, yields until the completion event arrives, then returns the verified result.",
"USE THIS instead of `sleep N; curl status` — it is the canonical event-driven wait.",
].join(" "),
export default tool({
description: "Wait for an external operation (CI, deploy, release) to complete. Call this when you cannot make progress until an external process finishes. You do NOT need to know the sha, op_type, or duration — Rune's controller resolves those from the bound PendingOperation. Just call this when you want to wait.",
args: {
sha: tool.schema.string().describe(
"The exact commit SHA the operation is running against"),
deadline_secs: tool.schema.number().optional().describe(
"Maximum wait in seconds (default 900)"),
operation_id: tool.schema.string().optional().describe("Optional: the operation to wait for. If omitted, the controller resolves the current pending operation automatically."),
task_id: tool.schema.string().optional().describe("Optional: the active task id (e.g. T4). When provided, resolution is scoped to operations bound to this task — stale global operations are never consulted."),
sha: tool.schema.string().optional().describe("OPTIONAL HINT — non-authoritative. The controller uses this only to help resolve which operation you mean."),
op_type: tool.schema.string().optional().describe("OPTIONAL HINT — non-authoritative. The controller derives the canonical operation type from repository/Gitea state."),
deadline_secs: tool.schema.number().optional().describe("OPTIONAL HINT — non-authoritative. The controller applies governed policy timing. Real user deadlines must be stated in conversation."),
},
async execute(args, ctx) {
const repoRoot = "/mnt/workdrive/issue161-harness"
const deadline = args.deadline_secs || 900
const cmd = [
"python3", `${repoRoot}/scripts/ci_event_wait.py`,
"--sha", args.sha,
"--deadline", String(deadline),
].join(" ")
async execute(args) {
// INTENT NORMALIZATION — model output is intent; the controller
// owns execution semantics. All model args are hints recorded for
// observability; canonical truth comes from the bound operation.
const parts = []
if (args.operation_id) parts.push(`--operation-id ${args.operation_id}`)
if (args.task_id) parts.push(`--task-id ${args.task_id}`)
if (args.sha) parts.push(`--sha ${args.sha}`)
if (args.op_type) parts.push(`--model-op-type ${args.op_type}`)
if (args.deadline_secs) parts.push(`--model-deadline ${args.deadline_secs}`)
const normCmd = `python3 /mnt/workdrive/issue161-harness/scripts/await_intent_cli.py normalize ${parts.join(" ")}`
let norm: any
try {
const normOut = execSync(normCmd, {
cwd: "/mnt/workdrive/issue161-harness",
encoding: "utf-8" as const,
timeout: 120000,
env: { ...process.env, RUNE_WR_ROOT: "/mnt/workdrive/wr-bridge" },
})
norm = JSON.parse(normOut.trim().split("\n").find((l: string) => l.startsWith("{")) || "{}")
} catch (e: any) {
return JSON.stringify({ ok: false, stage: "normalization", error: (e.stderr || e.message || "?").slice(0, 300) })
}
if (norm.normalized === "AMBIGUOUS") {
return JSON.stringify({ ok: false, stage: "normalization", ...norm })
}
if (!norm.normalized) {
return JSON.stringify({ ok: false, stage: "normalization", ...norm })
}
// canonical continuation: stored/derived op_type + POLICY deadline
// (the sha for the wait comes from the normalization resolution,
// NOT from the model's args)
const waitSha = norm.sha_for_wait || args.sha || ""
if (!waitSha) {
return JSON.stringify({ ok: false, stage: "resolution", error: "no sha resolved for the pending operation", norm })
}
const cmd = `python3 /mnt/workdrive/issue161-harness/scripts/ci_event_wait.py --sha ${waitSha} --deadline ${norm.deadline_secs} --op-type ${norm.op_type}`
try {
const result = execSync(cmd, {
cwd: repoRoot,
timeout: (deadline + 60) * 1000,
cwd: "/mnt/workdrive/issue161-harness",
timeout: (norm.deadline_secs + 60) * 1000,
encoding: "utf-8" as const,
env: {
...process.env,
DEPLOY_SHA: args.sha,
RUNE_WR_ROOT: "/mnt/workdrive/wr-bridge",
RUNE_WR_CODE: "/home/nick/.local/share/mimo-wait-resume",
env: { ...process.env, DEPLOY_SHA: waitSha, RUNE_WR_ROOT: "/mnt/workdrive/wr-bridge", RUNE_WR_CODE: "/home/nick/.local/share/mimo-wait-resume" },
})
const jl = result.trim().split("\n").find((l: string) => l.startsWith("{"))
const envelope = jl ? JSON.parse(jl) : { ok: false, error: "no output" }
return JSON.stringify({
...envelope,
normalization: {
model_deadline_ignored: norm.model_deadline_ignored,
model_op_type_ignored: norm.model_op_type_ignored,
model_sha_ignored: !!args.sha && args.sha !== waitSha,
canonical_op_type: norm.op_type,
canonical_authority: norm.authority,
deadline_provenance: norm.deadline_provenance,
matched_by: norm.matched_by || norm.evidence || "auto-resolved",
},
})
const lines = result.trim().split("\n")
const jsonLine = lines.find((l: string) => l.startsWith("{"))
if (jsonLine) return jsonLine
return "await_operation: no JSON output"
} catch (e: any) {
const stdout = e.stdout || ""
const lines = stdout.trim().split("\n")
const jsonLine = lines.find((l: string) => l.startsWith("{"))
if (jsonLine) return jsonLine
return JSON.stringify({
ok: false,
error: `await_operation failed: ${(e.stderr || e.message || "?").slice(0, 200)}`,
})
const lines = (e.stdout || "").trim().split("\n")
const jl = lines.find((l: string) => l.startsWith("{"))
if (jl) {
const envelope = JSON.parse(jl)
return JSON.stringify({
...envelope,
normalization: {
model_deadline_ignored: norm.model_deadline_ignored,
model_op_type_ignored: norm.model_op_type_ignored,
model_sha_ignored: !!args.sha && args.sha !== waitSha,
canonical_op_type: norm.op_type,
canonical_authority: norm.authority,
deadline_provenance: norm.deadline_provenance,
matched_by: norm.matched_by || norm.evidence || "auto-resolved",
},
})
}
return JSON.stringify({ ok: false, stage: "wait", error: (e.stderr || e.message || "?").slice(0, 300) })
}
},
})
+167
View File
@@ -0,0 +1,167 @@
// bash — executes a shell command. PROCESS-OWNERSHIP CONTRACT (v2):
//
// MODE A (tool-owned): the child is launched in its own process group;
// stdout/stderr are CAPTURED pipes (never the TUI tty). On timeout or
// failure the ENTIRE process group is signalled (SIGTERM, grace,
// SIGKILL) so grandchildren cannot survive the invocation, then the
// result is finalized. After finalization NO descendant retains a
// writer into MiMo's streams.
//
// MODE B (explicitly detached): a command suffixed with " &" that the
// user/model intends to outlive the tool (nohup/setsid/disown-style)
// is executed via the detached helper: stdin=/dev/null, stdout/stderr
// -> durable log file, own session (setsid), no MiMo PTY inheritance.
// The tool returns the log path as the durable handle.
//
// Wait-intent compilation (sleep/check/poll aimed at a pending operation)
// is preserved: interception happens at the SEMANTIC level via
// await_intent route-bash, and a NO-OP for anything that is not a genuine
// continuation of a live pending operation. Arbitrary shell syntax
// (quotes, pipes, semicolons) passes through untouched — the router
// response is only trusted when it carries normalized=true AND
// ContinuePendingOperation with a concrete operation bound.
import { tool } from "@mimo-ai/plugin"
import { spawn, execFile } from "child_process"
const REPO = "/mnt/workdrive/issue161-harness"
const WR_ROOT = "/mnt/workdrive/wr-bridge"
// ── MODE A: process-group-owned capture execution ──────────────────────
interface OwnedResult { stdout: string; stderr: string; status: number; timedOut: boolean }
function runOwned(command: string, timeoutMs: number): Promise<OwnedResult> {
return new Promise((resolve) => {
// /bin/sh -c "command" in its OWN process group (detached:true makes
// the child a session/group leader we can signal as a WHOLE).
const child = spawn("/bin/sh", ["-c", command], {
cwd: REPO,
stdio: ["ignore", "pipe", "pipe"], // NEVER inherit the TUI tty
env: process.env,
detached: true, // own process group
})
let stdout = "", stderr = ""
let timedOut = false
let settled = false
const outChunks: Buffer[] = []
const errChunks: Buffer[] = []
child.stdout!.on("data", (d) => outChunks.push(d))
child.stderr!.on("data", (d) => errChunks.push(d))
const killGroup = (sig: NodeJS.Signals) => {
try { process.kill(-child.pid!, sig) } catch { /* already gone */ }
}
const finalize = (status: number) => {
if (settled) return
settled = true
clearTimeout(timer)
// detach listeners, then resolve — no late listeners remain
child.stdout!.removeAllListeners()
child.stderr!.removeAllListeners()
resolve({ stdout: Buffer.concat(outChunks).toString(), stderr: Buffer.concat(errChunks).toString(), status, timedOut })
}
const timer = setTimeout(() => {
timedOut = true
killGroup("SIGTERM")
// bounded grace for clean shutdown, then SIGKILL the group
setTimeout(() => killGroup("SIGKILL"), 2000)
// the exit/close event settles; a hard stop-guard settles anyway
setTimeout(() => finalize(124), 4000)
}, timeoutMs)
child.on("error", (e) => finalize(-1))
child.on("close", (code) => finalize(code ?? -1))
})
}
// ── MODE B: explicit detachment for "cmd &" invocations ────────────────
function runDetached(command: string): Promise<string> {
return new Promise((resolve) => {
const logPath = `/tmp/mimo-detached-${Date.now()}-${Math.floor(Math.random() * 1e6)}.log`
const out = `exec >>"${logPath}" 2>&1; exec 0</dev/null; ${command}`
const child = spawn("/bin/sh", ["-c", `setsid /bin/sh -c '${out.replace(/'/g, `'\\''`)}'`], {
cwd: REPO,
stdio: "ignore", // child rebinds its own fds — no PTY inheritance
env: process.env,
detached: true,
// unref: MiMo's event loop does not wait for it
})
child.unref()
resolve(JSON.stringify({
detached: true,
log: logPath,
note: "process detached (setsid, own fds); output streams to the log file only; fd 0/1/2 do NOT reference the MiMo tty",
}))
})
}
// ── wait-intent routing (semantic level, preserved from v1) ────────────
async function tryCompileWaitIntent(command: string): Promise<string | null> {
let routeOut: string
try {
routeOut = await new Promise<string>((resolve, reject) => {
execFile("python3", [`${REPO}/scripts/await_intent_cli.py`, "route-bash", "--command", command], {
cwd: REPO, timeout: 60000, encoding: "utf-8",
env: { ...process.env, RUNE_WR_ROOT: WR_ROOT },
maxBuffer: 8 * 1024 * 1024,
}, (err, stdout) => { if (err && !stdout) reject(err); else resolve(stdout || "") })
})
} catch {
return null // router unavailable: normal execution (never block on routing)
}
const jl = routeOut.trim().split("\n").find((l) => l.startsWith("{"))
if (!jl) return null
let norm: any
try { norm = JSON.parse(jl) } catch { return null }
// STRICT gate: compile ONLY a normalized, concrete continuation.
if (!(norm.normalized === true &&
norm.action === "ContinuePendingOperation" &&
norm.operation_id && norm.sha_for_wait)) return null
const waitCmd = `python3 ${REPO}/scripts/ci_event_wait.py --sha ${norm.sha_for_wait} --deadline ${norm.deadline_secs} --op-type ${norm.op_type}`
const r = await runOwned(waitCmd, (norm.deadline_secs + 60) * 1000)
const jline = r.stdout.trim().split("\n").find((l) => l.startsWith("{"))
if (jline) {
return JSON.stringify({
...JSON.parse(jline),
intent_compilation: {
raw_command_kind: norm.raw_command_kind || "sleep_poll",
literal_sleep_executed: false,
operation_id: norm.operation_id,
canonical_op_type: norm.op_type,
authority: norm.authority,
},
})
}
return JSON.stringify({ ok: false, stage: "compiled-wait", error: (r.stderr || "no output").slice(0, 300) })
}
export default tool({
description: "Run a shell command. If the command expresses external wait intent (sleep/check/poll aimed at CI, deploy, or release operations with pending operations), it is automatically compiled to Rune's event-driven continuation — you do not need to manage wait mechanics. Plain local commands execute normally. Commands ending in ' &' run detached with output logged to a file.",
args: {
command: tool.schema.string().describe("Shell command to run"),
},
async execute(args) {
// 1. wait-intent compilation (semantic, strict-gated)
try {
const compiled = await tryCompileWaitIntent(args.command)
if (compiled !== null) return compiled
} catch { /* fall through to normal execution */ }
// 2. MODE B: explicit detachment for backgrounded invocations
const cmd = args.command
if (/\b(nohup|setsid)\b/.test(cmd) || /&\s*$/.test(cmd)) {
return await runDetached(cmd)
}
// 3. MODE A: tool-owned, group-killed, captured execution
const r = await runOwned(cmd, 120000)
const text = r.stdout + (r.stderr ? `\n[stderr]\n${r.stderr}` : "")
if (r.timedOut) {
return `exit timed-out (process group terminated): ${text.slice(0, 500)}`
}
if (r.status !== 0) {
return `exit ${r.status}: ${text.slice(0, 500) || "?"}`
}
return text || "(no output)"
},
})
+402 -269
View File
@@ -1,272 +1,405 @@
{
"_comment": "GENERATED by rune.spine \u2014 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_by_spine": true,
"generated_at": "2026-09-16T18:23:38Z",
"umbrellas": {
"capability": {
"description": "Tool selection and execution authority",
"modules": [
"adaptive_router",
"builder_bridge",
"builder_bridge_cli",
"capability_broker",
"connection_pool",
"evidence_probe",
"forge",
"forge_client",
"intent_continuity",
"local_tool_runtime",
"message_queue",
"openai_compat_transport",
"provider_context",
"recall_uplift",
"route_risk_flags",
"tool_executor",
"tool_protocol"
],
"depends_on": [
"memory"
],
"mirrors": [],
"canaries": [
"canary_native",
"canary_p0_05",
"canary_p1_01"
]
},
"governance": {
"description": "Quality control, drift detection, promotion, audit",
"modules": [
"audit_ledger",
"build_pipeline_policy",
"claim_audit",
"contracts",
"curator",
"drift_core",
"drift_ledger",
"drift_observability",
"failure_auto_filer",
"programme_gates"
],
"depends_on": [],
"mirrors": [],
"canaries": [
"canary_full_system",
"canary_schema_migration"
]
},
"growth": {
"description": "Learning and improvement",
"modules": [
"autonomy_loop",
"cognitive_loop",
"dream_cycle",
"elastic_cognition",
"goal",
"growth_delta",
"growth_simulator",
"self_improve",
"subconscious_pass"
],
"depends_on": [
"governance",
"memory"
],
"mirrors": [],
"canaries": [
"canary_full_system"
]
},
"identity": {
"description": "Who the agent is \u2014 persona, voice, anchors",
"modules": [
"behavior",
"identity_anchors",
"persona_definition",
"persona_gate",
"prompt_sync",
"voice_hybrid",
"voice_injector",
"voice_sync",
"voicebox"
],
"depends_on": [
"governance"
],
"mirrors": [],
"canaries": [
"canary_full_system"
]
},
"inference": {
"description": "Model routing and outbound requests",
"modules": [
"inference_trace",
"model_connect",
"model_profiles",
"model_registry",
"model_routing",
"provider_budget",
"provider_registry",
"response_adapter",
"standardized_providers",
"token_optimizer"
],
"depends_on": [
"capability"
],
"mirrors": [],
"canaries": [
"canary_p1_02",
"canary_p1_06",
"canary_resource_authority"
]
},
"memory": {
"description": "Storing, retrieving, and managing knowledge",
"modules": [
"abstraction",
"cache",
"drift_cache",
"drift_compression",
"graph_memory",
"graph_shard_bridge",
"memory_consolidation",
"memory_env",
"memory_selector",
"memory_store",
"query_memory",
"recall_router",
"retrieval_benchmark",
"shard_manager",
"tier_manager",
"warm_neuron_store"
],
"depends_on": [
"governance"
],
"mirrors": [],
"canaries": [
"canary_full_system",
"canary_memory_synthesis",
"canary_query_memory"
]
},
"orchestration": {
"description": "Task lifecycle, operator, TUI presentation",
"modules": [
"auto_detect",
"build_mode",
"build_orchestrator",
"chat_bubble",
"cron_engine",
"custodian",
"dependency_tracker",
"event_bus",
"event_envelope",
"gitea_auth",
"gitea_pipeline",
"gitea_provision",
"hook_engine",
"message_widgets",
"microkernel",
"night_mode",
"outcome_ledger",
"parallel_processor",
"pins",
"progressive_escalation",
"rune_graphic",
"rune_operator",
"rune_profiler",
"rune_spinner",
"rune_tui",
"safety_override",
"sleep_time",
"subsystem_health",
"system_registry",
"task_gate",
"task_persist",
"tiered_executor",
"time_awareness",
"tui_validator",
"umbrella_update",
"verification_layer",
"warm_router",
"work_manager"
],
"depends_on": [
"capability",
"growth",
"identity",
"inference",
"perception"
],
"mirrors": [],
"canaries": [
"canary_cognitive_strata",
"canary_conversation_state",
"canary_gitea_pipeline",
"canary_orchestration_foundation",
"canary_p1_07",
"canary_surface_parity",
"canary_tui_drift"
]
},
"perception": {
"description": "Input processing and context assembly",
"modules": [
"attention_capsule",
"auto_context",
"auto_tasks",
"behaviour_ledger",
"build_basis",
"capability_fit",
"capability_ledger",
"cognitive_budgeter",
"construction_activation",
"construction_commands",
"construction_decision",
"construction_depth",
"construction_intent",
"construction_interface",
"construction_mode",
"construction_pattern",
"construction_patterns_builtin",
"construction_projection",
"context_broker",
"context_pressure",
"drift_resume",
"event_wait",
"failure_recovery",
"graph_projection",
"impact_preview",
"iteration",
"layout_contract",
"programme_continuation",
"project_registry",
"release_notes",
"salience_gate",
"scaffold",
"spine",
"stage_guards",
"structural_migration",
"structural_model",
"structural_store",
"testing_mode",
"toolchain",
"tui_backlog",
"wait_guard",
"wait_guard_corpus",
"witness"
],
"depends_on": [
"memory"
],
"mirrors": [],
"canaries": [
"canary_context_broker",
"canary_full_system"
]
"_comment": "GENERATED by rune.spine \u2014 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_by_spine": true,
"generated_at": "2026-10-08T13:09:54Z",
"umbrellas": {
"capability": {
"description": "Tool selection and execution authority",
"modules": [
"adaptive_router",
"audit_ledger",
"behaviour_ledger",
"builder_bridge",
"builder_bridge_cli",
"capability_broker",
"capability_ledger",
"connection_pool",
"core_server",
"cs_loader",
"evidence_capsule",
"evidence_probe",
"forge",
"forge_client",
"intent_continuity",
"local_tool_runtime",
"message_queue",
"native_units",
"openai_compat_transport",
"provider_context",
"recall_uplift",
"research_budget",
"route_risk_flags",
"tool_executor",
"tool_protocol"
],
"depends_on": [
"memory"
],
"mirrors": [],
"canaries": [
"canary_native",
"canary_native",
"canary_p0_05",
"canary_p0_05",
"canary_p1_01",
"canary_p1_01",
"canary_rune_entry",
"canary_rune_serve"
]
},
"governance": {
"description": "Quality control, drift detection, promotion, audit",
"modules": [
"audit_ledger",
"build_basis",
"build_pipeline_policy",
"capability_fit",
"cc_loader",
"claim_audit",
"construction_activation",
"construction_commands",
"construction_decision",
"construction_depth",
"construction_intent",
"construction_interface",
"construction_mode",
"construction_pattern",
"construction_patterns_builtin",
"construction_projection",
"contracts",
"curator",
"drift_core",
"drift_ledger",
"drift_observability",
"event_wait",
"failure_auto_filer",
"failure_recovery",
"forge",
"forge_client",
"grading",
"graph_projection",
"impact_preview",
"iteration",
"layout_contract",
"mutation_guards",
"paths",
"programme_continuation",
"programme_gates",
"project_registry",
"release_notes",
"sc_loader",
"scaffold",
"spine",
"stage_guards",
"structural_migration",
"structural_model",
"structural_store",
"toolchain",
"wait_guard",
"worthiness"
],
"depends_on": [],
"mirrors": [],
"canaries": [
"canary_audit_ledger",
"canary_full_system",
"canary_full_system",
"canary_schema_migration",
"canary_schema_migration",
"canary_spine_meta"
]
},
"growth": {
"description": "Learning and improvement",
"modules": [
"autonomy_loop",
"behavior",
"claim_audit",
"cognitive_loop",
"dream_cycle",
"drift_cache",
"drift_compression",
"drift_core",
"drift_ledger",
"drift_observability",
"drift_resume",
"elastic_cognition",
"goal",
"growth_delta",
"growth_pipeline",
"growth_simulator",
"meaningful_events",
"night_mode",
"outcome_ledger",
"outcome_utility",
"self_improve",
"self_modify",
"skill_compiler",
"subconscious_pass"
],
"depends_on": [
"governance",
"memory"
],
"mirrors": [],
"canaries": [
"canary_full_system",
"canary_full_system"
]
},
"identity": {
"description": "Who the agent is \u2014 persona, voice, anchors",
"modules": [
"behavior",
"identity_anchors",
"persona_definition",
"persona_gate",
"prompt_sync",
"safety_override",
"self_model",
"voice_hybrid",
"voice_injector",
"voice_sync",
"voicebox"
],
"depends_on": [
"governance"
],
"mirrors": [],
"canaries": [
"canary_full_system",
"canary_full_system"
]
},
"inference": {
"description": "Model routing and outbound requests",
"modules": [
"adaptive_router",
"evidence_probe",
"inference_paths",
"inference_trace",
"local_tool_runtime",
"model_connect",
"model_profiles",
"model_registry",
"model_routing",
"openai_compat_transport",
"provider_budget",
"provider_context",
"provider_registry",
"recall_router",
"recall_uplift",
"response_adapter",
"route_risk_flags",
"standardized_providers",
"tc_loader",
"token_optimizer"
],
"depends_on": [
"capability"
],
"mirrors": [],
"canaries": [
"canary_p1_02",
"canary_p1_02",
"canary_p1_06",
"canary_p1_06",
"canary_resource_authority",
"canary_resource_authority"
]
},
"memory": {
"description": "Storing, retrieving, and managing knowledge",
"modules": [
"abstraction",
"abstraction_ladder",
"auto_context",
"cache",
"concept_topology",
"connection_pool",
"curator",
"drift-ledger",
"drift_cache",
"drift_compression",
"experience_encoding",
"ffi_query_memory_smoke",
"graph_memory",
"graph_shard_bridge",
"lexicon_evolution",
"memory_consolidation",
"memory_env",
"memory_selector",
"memory_store",
"memory_types",
"mems_loader",
"mr_loader",
"ms_loader",
"query_memory",
"recall_router",
"retrieval_benchmark",
"shard_manager",
"sleep_time",
"state_checkpoint",
"subconscious_pass",
"tier_manager",
"warm_neuron_store",
"warm_router"
],
"depends_on": [
"governance"
],
"mirrors": [],
"canaries": [
"canary_full_system",
"canary_full_system",
"canary_memory_synthesis",
"canary_memory_synthesis",
"canary_query_memory",
"canary_query_memory"
]
},
"orchestration": {
"description": "Task lifecycle, operator, TUI presentation",
"modules": [
"attention_capsule",
"auto_detect",
"build_mode",
"build_orchestrator",
"builder_bridge",
"capability_broker",
"chat_bubble",
"context_broker",
"cron_engine",
"custodian",
"dependency_tracker",
"elastic_cognition",
"event_bus",
"event_envelope",
"execution_trace",
"gitea_auth",
"gitea_pipeline",
"gitea_provision",
"goal",
"hook_engine",
"message_widgets",
"microkernel",
"night_mode",
"outcome_ledger",
"pane_authority",
"parallel_processor",
"pins",
"progressive_escalation",
"rune_graphic",
"rune_operator",
"rune_profiler",
"rune_spinner",
"rune_tui",
"safety_override",
"sleep_time",
"subsystem_health",
"system_registry",
"task_gate",
"task_persist",
"testing_mode",
"tiered_executor",
"time_awareness",
"tool_executor",
"tool_protocol",
"tui_transport",
"tui_validator",
"umbrella_update",
"verification_layer",
"warm_router",
"witness",
"work_manager"
],
"depends_on": [
"capability",
"growth",
"identity",
"inference",
"perception"
],
"mirrors": [],
"canaries": [
"canary_cognitive_strata",
"canary_cognitive_strata",
"canary_conversation_state",
"canary_conversation_state",
"canary_gitea_pipeline",
"canary_gitea_pipeline",
"canary_orchestration_foundation",
"canary_orchestration_foundation",
"canary_p1_07",
"canary_p1_07",
"canary_surface_parity",
"canary_surface_parity",
"canary_tui_drift",
"canary_tui_drift",
"canary_tui_transport"
]
},
"perception": {
"description": "Input processing and context assembly",
"modules": [
"attention_capsule",
"auto_context",
"auto_tasks",
"behaviour_ledger",
"build_basis",
"capability_fit",
"capability_ledger",
"cognitive_budgeter",
"construction_activation",
"construction_commands",
"construction_decision",
"construction_depth",
"construction_intent",
"construction_interface",
"construction_mode",
"construction_pattern",
"construction_patterns_builtin",
"construction_projection",
"context_broker",
"context_pressure",
"drift_resume",
"event_wait",
"failure_recovery",
"graph_projection",
"impact_preview",
"iteration",
"layout_contract",
"programme_continuation",
"project_registry",
"release_notes",
"rune_tui",
"salience_gate",
"scaffold",
"spine",
"spine_language",
"spine_loader",
"stage_guards",
"structural_migration",
"structural_model",
"structural_store",
"testing_mode",
"toolchain",
"tui_backlog",
"voicebox",
"wait_guard",
"wait_guard_corpus",
"witness"
],
"depends_on": [
"memory"
],
"mirrors": [],
"canaries": [
"canary_context_broker",
"canary_context_broker",
"canary_full_system",
"canary_full_system"
]
}
}
}
}
+16 -1
View File
@@ -272,4 +272,19 @@ observations, fresh resume.
Release-note generator: LIVE-PROVEN (real Gitea, 10 releases). Backfill:
0.66.35→0.66.44 carrying historical-backfill provenance. Pre-0.66.35
history: skipped (weak evidence — honest limitation).
history: skipped (weak evidence — honest limitation).
## Contract discovery → spine (2026-10-05, #2465 CI correction)
The closed construction contract is the authority for discoveries. Spine
rebuild reads its observed entities and candidate corrections; it does not
claim a correction has been built. Qualified IDs such as
`rust-crate:cognition_core` keep their declared kind. Bare file paths,
test suites and other unqualified references become
`construction-surface:<reference>`, never `module`. An observed
surface may be PRESENT; a candidate stays DECLARED until independently
observed. Existing bad records are migrated with their evidence and edge
references intact. This matters: the first write-back mapped bare paths to
modules, made 22 false module records and crashed CI on the next rebuild.
The per-contract quick-reference markdown is generated from the scaffold
store at close; it is a view, not another authority.
+228
View File
@@ -0,0 +1,228 @@
# DICHOTOMY REBASE — HONEST AUDIT (function-level)
_Regenerate with `python3 scripts/dichotomy_audit.py --write`. A module is FULL only when 80%+ of its Python functions have name-preserving counterparts in the Go/Rust implementation — directories without the functions are facades and count as NOT TOUCHED._
**Function-level completion: 21%** (492/2357 runtime functions matched)
| Status | Modules | Lines | Meaning |
|---|---|---|---|
| FULL | 8 | 734 | 80%+ of functions ported |
| PARTIAL | 72 | 32573 | 20–80% — real logic exists, gaps named below |
| NOT TOUCHED | 121 | 38213 | no name-preserving implementation |
| Total runtime | 201 | 71520 | |
## NOT TOUCHED — the port queue, in priority order (largest first)
| Module | Lines | Fns | Side |
|---|---|---|---|
| rune_tui | 4170 | 159 | TUI-LAST |
| rune_operator | 2746 | 68 | GO |
| curator | 1838 | 43 | GO |
| spine | 1204 | 31 | RUST |
| construction_decision | 1014 | 20 | RUST |
| elastic_cognition | 774 | 14 | GO |
| memory_consolidation | 743 | 22 | GO |
| abstraction | 656 | 17 | GO |
| contracts | 629 | 7 | RUST |
| construction_intent | 555 | 16 | RUST |
| canary_audit_ledger | 541 | 2 | TEST-INFRA |
| identity_anchors | 537 | 16 | RUST |
| event_wait | 518 | 14 | GO |
| tui_validator | 514 | 13 | TUI-LAST |
| memory_selector | 511 | 13 | RUST |
| system_registry | 504 | 14 | RUST |
| construction_pattern | 496 | 12 | RUST |
| auto_tasks | 460 | 14 | GO |
| drift_ledger | 456 | 16 | RUST |
| capability_fit | 455 | 13 | RUST |
| goal | 453 | 20 | GO |
| release_notes | 446 | 16 | GO |
| cron_engine | 440 | 27 | GO |
| model_routing | 432 | 13 | GO |
| worthiness | 411 | 13 | unclassified |
| token_optimizer | 410 | 22 | RUST |
| behavior | 408 | 9 | RUST |
| capability_ledger | 405 | 18 | RUST |
| chat_bubble | 401 | 12 | TUI-LAST |
| prompt_sync | 379 | 14 | RUST |
| drift-ledger | 355 | 14 | unclassified |
| programme_continuation | 349 | 11 | RUST |
| canary_rune_serve | 329 | 13 | TEST-INFRA |
| canary_p1_07 | 324 | 10 | TEST-INFRA |
| layout_contract | 316 | 6 | RUST |
| message_queue | 316 | 13 | GO |
| drift_observability | 315 | 8 | RUST |
| build_basis | 314 | 12 | RUST |
| canary_p0_07 | 310 | 10 | TEST-INFRA |
| attention_capsule | 296 | 7 | RUST |
| canary_p1_01 | 294 | 12 | TEST-INFRA |
| drift_cache | 292 | 15 | RUST |
| outcome_ledger | 286 | 7 | RUST |
| time_awareness | 286 | 14 | RUST |
| canary_p1_06 | 280 | 7 | TEST-INFRA |
| auto_context | 273 | 8 | GO |
| canary_p1_03 | 271 | 9 | TEST-INFRA |
| canary_gitea_automation | 263 | 3 | TEST-INFRA |
| canary_p1_02 | 253 | 10 | TEST-INFRA |
| construction_patterns_builtin | 249 | 1 | RUST |
| canary_full_system | 248 | 2 | TEST-INFRA |
| toolchain | 236 | 5 | RUST |
| task_gate | 235 | 8 | RUST |
| canary_native | 231 | 3 | TEST-INFRA |
| lexicon_evolution | 229 | 7 | unclassified |
| openai_compat_transport | 227 | 9 | GO |
| shard_manager | 223 | 9 | RUST |
| spine_language | 218 | 5 | RUST |
| evidence_probe | 213 | 9 | GO |
| canary_p0_04 | 207 | 8 | TEST-INFRA |
| forge_client | 203 | 18 | GO |
| canary_context_broker | 199 | 10 | TEST-INFRA |
| canary_p0_05 | 199 | 13 | TEST-INFRA |
| testing_mode | 196 | 12 | RUST |
| cc_loader | 195 | 26 | RUST |
| grading | 193 | 3 | unclassified |
| canary_spine_meta | 192 | 7 | TEST-INFRA |
| verification_layer | 190 | 12 | RUST |
| message_graph | 187 | 12 | unclassified |
| ffi_query_memory_smoke | 183 | 5 | RUST |
| behaviour_ledger | 174 | 12 | RUST |
| canary_tui_transport | 174 | 7 | TEST-INFRA |
| canary_tui_drift | 170 | 2 | TEST-INFRA |
| inference_trace | 164 | 6 | RUST |
| ms_loader | 163 | 16 | RUST |
| canary_gitea_pipeline | 159 | 2 | TEST-INFRA |
| forge | 146 | 11 | GO |
| rune_graphic | 145 | 5 | TUI-LAST |
| project_registry | 139 | 11 | RUST |
| canary_rune_entry | 137 | 3 | TEST-INFRA |
| tui_backlog | 125 | 5 | TUI-LAST |
| state_checkpoint | 123 | 8 | unclassified |
| drift_resume | 118 | 3 | RUST |
| canary_conversation_state | 115 | 2 | TEST-INFRA |
| canary_query_memory | 111 | 2 | TEST-INFRA |
| tui_transport | 108 | 10 | TUI-LAST |
| canary_unbounded | 105 | 2 | TEST-INFRA |
| spine_loader | 105 | 7 | RUST |
| message_widgets | 104 | 6 | TUI-LAST |
| self_modify | 102 | 7 | unclassified |
| sc_loader | 96 | 6 | RUST |
| inference_paths | 95 | 2 | unclassified |
| mutation_guards | 94 | 2 | unclassified |
| concept_topology | 90 | 7 | unclassified |
| cs_loader | 90 | 5 | RUST |
| tc_loader | 88 | 5 | RUST |
| canary_schema_migration | 86 | 1 | TEST-INFRA |
| mems_loader | 83 | 5 | RUST |
| execution_trace | 71 | 4 | unclassified |
| experience_encoding | 70 | 1 | unclassified |
| abstraction_ladder | 68 | 3 | unclassified |
| pane_authority | 67 | 2 | unclassified |
| skill_compiler | 64 | 4 | unclassified |
| meaningful_events | 61 | 3 | unclassified |
| outcome_utility | 59 | 4 | unclassified |
| memory_types | 54 | 2 | unclassified |
| growth_pipeline | 53 | 2 | unclassified |
| paths | 53 | 6 | unclassified |
| wait_guard_corpus | 46 | 0 | RUST |
| canary_cognitive_strata | 44 | 1 | TEST-INFRA |
| research_budget | 44 | 3 | unclassified |
| self_model | 44 | 3 | unclassified |
| evidence_capsule | 43 | 3 | unclassified |
| builder_bridge_cli | 42 | 1 | GO |
| __init__ | 40 | 1 | RUST |
| mr_loader | 38 | 13 | RUST |
| canary_memory_synthesis | 33 | 1 | TEST-INFRA |
| canary_resource_authority | 33 | 1 | TEST-INFRA |
| canary_surface_parity | 33 | 1 | TEST-INFRA |
| canary_orchestration_foundation | 32 | 1 | TEST-INFRA |
| canary_gitea_delegation | 31 | 1 | TEST-INFRA |
## PARTIAL — gaps to close (matched/total fns; first missing named)
| Module | Lines | Coverage | Missing (first named) |
|---|---|---|---|
| memory_store | 2586 | 29/78 | _ctx_budget, now_iso, ensure_memory_type_column, _embed, _temp_json, _entities_to_json |
| context_broker | 870 | 6/28 | _py_default_estimator, _cc_core, _py_default_budget, _py_default_memory_budget, _py_memory_disabled_value, reset_discovered_windows |
| local_tool_runtime | 809 | 8/30 | _find_capability_executor, _extract_context_length, context_length, reset_context_length_cache, supports_tools, supports_thinking |
| construction_interface | 1193 | 6/27 | _to_stage_check, _guard_specs_from_obligations, t_layout, _obligations_projection, _obligation_scope_files, main |
| structural_store | 656 | 12/33 | _sorted, new_doc, load, _redact_secrets, save, canonical_digest |
| work_manager | 594 | 5/25 | group_by_file, load_config, save_config, load_batches, save_batches, create_work |
| persona_gate | 724 | 7/26 | _now, _cc_pg_core, _py_lex, _lex_input, _py_overlap, _embed_raw |
| provider_registry | 679 | 9/28 | _ctx_budget, _format_tools_openai, _execute_tool_calls, _execute_tool_calls_anthropic, get_registry, connect_provider |
| sleep_time | 984 | 7/26 | _ctx_budget, _ensure_dirs, db_connect, fetch_sessions, extract_parts, retain_to_store |
| tool_protocol | 461 | 10/27 | _utc_now_iso, _contains_tool_object_key, to_ollama_tools, dispatch_validated_tool, tool_requires_approval, to_dict |
| warm_router | 1540 | 19/36 | _ensure_use_history_table, record_outcome, record_neuron_fire, _py_base_level_from_uses, base_level_activation, _db |
| provider_budget | 357 | 4/20 | get_tracker, track_usage, check_provider, get_best_provider, failover, get_status |
| tool_executor | 1836 | 31/47 | _execute_tool_now, _prepared_path, serialize_prepared_tool, deserialize_prepared_tool, confirm_write, _resolve_execution_cwd |
| growth_delta | 449 | 5/20 | _ctx_budget, _store_db, _llm, _parse_json, _load_deltas, _save_deltas |
| safety_override | 574 | 7/22 | _keyword_stopwords, _cc_probe, cc_loader_pin, self_test, _py_matches, escalation_rate |
| night_mode | 421 | 5/19 | _ctx_budget, get_night_mode, start_night_mode, stop_night_mode, get_status, get_report |
| scaffold | 868 | 17/31 | init, add_domain, add_component, add_contract, set_prd, set_next_action |
| build_mode | 521 | 20/33 | _load_state, _save_state, assess_complexity, start_research, start_feasible, start_consult |
| capability_broker | 908 | 7/20 | _native_tool_schemas, _select_for_job, load_registry, _native_tool_cards, _cards_are_stale, load_cards |
| failure_auto_filer | 527 | 11/24 | _error_text, unconsumed, mark_consumed, unconsumed, mark_consumed, submit |
| cache | 492 | 6/17 | _record_hit, _record_miss, flush_stats, get_cache, put_cache, invalidate_scope |
| parallel_processor | 194 | 3/14 | _shutdown_processor, get_processor, run_parallel_with_args, get_status, test_parallel, run_parallel_with_args |
| structural_model | 352 | 9/20 | workspace_record, workspace_advance, _init_project, save, reload, add |
| claim_audit | 484 | 4/14 | _get_warm_neuron_store, reframe, _graph_has, _warm_has, verify, journal |
| drift_core | 517 | 4/14 | _ms_core, _now_iso, _py_check_promotion_eligibility, promote_entry, compute_fama, compute_drift_velocity |
| model_profiles | 438 | 5/15 | get_profile_path, load_profile, save_profile, build_profile_from_ollama, scan_all_models, get_or_create_profile |
| tier_manager | 262 | 5/15 | _cc_probe, cc_loader_pin, _py_core_now, _py_get_tier, _py_promote, _py_demote |
| witness | 475 | 8/18 | _ctx_budget, _now, _cc_probe, cc_loader_pin, _py_extract_topic, _py_detect_signals |
| drift_compression | 307 | 3/12 | _py_get_compression_ratio, _py_compress_text, _py_compress_entry, _py_should_warn, _py_warn_before_compress, get_compression_ratio |
| builder_bridge | 326 | 3/11 | _construction_store, _active_construction_lines, _default_selector, _cached_memory, _get_selector, _retrieve_memory |
| voice_sync | 299 | 2/10 | _now, get_delivery_register_from_db, get_delivery_register, generate_voice_section, update_rune_md, check_sync |
| graph_memory | 474 | 2/9 | now_iso, connect, resolve_entity, add_edge, query, stats |
| intent_continuity | 168 | 2/9 | to_dict, from_dict, _load, save, create_detour, resolve_detour |
| model_connect | 471 | 4/11 | _ctx_budget, _now, list_models, _get_cloud_models, health_check, generate |
| pins | 284 | 5/12 | _store_path, _save, _detail_blob, unpin, _py_pin_recall, list_pins |
| voice_hybrid | 427 | 3/10 | _connect, _load_growth, _save_growth, source_profiles, always, grow |
| audit_ledger | 212 | 2/8 | _compute_hash, get_entries, log_promotion, log_gate_result, log_drift_alert, main |
| context_pressure | 262 | 3/9 | log_measurement, read_log, log_stats, _now, handle_hook, main |
| core_server | 234 | 6/12 | make_server, log_message, _send_json, _send_ndjson, do_GET, do_POST |
| microkernel | 434 | 6/12 | now_iso, discover, _extract_manifest, _load_registry, _save_registry, _run_hook |
| model_registry | 253 | 2/8 | test_registry, to_dict, get_profile, get_enabled_profiles, get_profiles_by_tier, list_profiles |
| persona_definition | 210 | 2/8 | _by_topic, compile_full, emit_constitution, emit_identity, emit_persona, handle_hook |
| progressive_escalation | 279 | 2/8 | execute_with_escalation, test_escalation, handle_hook, to_dict, execute, verify |
| tiered_executor | 291 | 2/8 | _ctx_budget, test_executor, to_dict, to_dict, _execute_deterministic, _execute_model |
| voicebox | 164 | 5/11 | _run, start_recording, stop_recording, _transcribe_and_type, on_press, on_release |
| connection_pool | 148 | 3/8 | get_pool, get_connection, get_status, get_connection, get_status |
| hook_engine | 860 | 3/8 | discover_functions, tag_function, validate_placements, generate_report, handle_hook |
| iteration | 190 | 3/8 | _now, context_packet, predictive_impact, descriptive_impact, add |
| task_persist | 269 | 5/10 | _save, export, restore, main, handle_hook |
| adaptive_router | 625 | 15/19 | _floor_applies_from_flags, _floor_reason, _record_transition_with, _detect_external_refs |
| construction_commands | 268 | 1/5 | _refuse, _validate, _accept, dispatch |
| construction_mode | 395 | 1/5 | _tokens, _contains_any, to_dict, from_dict |
| self_improve | 246 | 1/5 | _now, suggest_improvements, handle_hook, main |
| subconscious_pass | 187 | 1/5 | main, _extract_topic, save_reflection, get_recent_findings |
| construction_activation | 237 | 1/4 | _scaffold_for, _auto_structural_awareness, dispatch_from_decision |
| construction_projection | 225 | 1/4 | _contract_entity, validate, write_mini_doc |
| dependency_tracker | 202 | 2/5 | check_propagation, get_full_map, main |
| event_envelope | 303 | 5/8 | test_envelope, to_canonical_dict, to_dict |
| response_adapter | 222 | 4/7 | parse_plain_response, test_adapter, to_dict |
| salience_gate | 243 | 1/4 | test_salience, handle_hook, to_dict |
| standardized_providers | 281 | 2/5 | list_providers, connect_provider, connect_all_local |
| subsystem_health | 163 | 3/6 | set_auto_filer, record_failure, configure_logging |
| warm_neuron_store | 122 | 3/6 | _db, neuron_slugs, handle_hook |
| cognitive_budgeter | 208 | 1/3 | test_budgeter, to_dict |
| event_bus | 244 | 5/7 | _store_path, handle_hook |
| graph_projection | 108 | 3/5 | write_all, _now |
| rune_profiler | 165 | 1/3 | profile_model_call, main |
| stage_guards | 281 | 7/9 | to_dict, chk |
| structural_migration | 77 | 2/4 | apply_migration, consent_brief |
| voice_injector | 138 | 3/5 | test_injection, to_dict |
| construction_depth | 138 | 1/2 | to_dict |
| recall_router | 162 | 2/3 | handle_hook |
## FULL — ported, parity-gated
| Module | Lines | Fns | Side |
|---|---|---|---|
| recall_uplift | 141 | 1/1 | RUST |
| rune_spinner | 130 | 4/5 | RUST |
| wait_guard | 116 | 1/1 | RUST |
| failure_recovery | 108 | 1/1 | RUST |
| programme_gates | 85 | 4/5 | RUST |
| impact_preview | 69 | 2/2 | RUST |
| provider_context | 48 | 1/1 | GO |
| route_risk_flags | 37 | 1/1 | RUST |
+58 -60
View File
@@ -11,24 +11,22 @@
"NEEDS_REVALIDATION",
"DEFERRED_FUTURE"
],
"live_defects": [
324
],
"live_defects": [],
"records": [
{
"number": 324,
"title": "Engine defect: checkpoint writer fails deterministically on aborted worker sessions (MessageAbortedError -> empty checkpoint shells)",
"tracker_state": "open",
"reconciliation_state": "VALID_OPEN",
"tracker_state": "closed",
"reconciliation_state": "FIXED_VERIFIED",
"labels": [
"bug",
"custodian",
"life",
"memory"
],
"live_defect": true,
"last_revalidated": "2026-09-11",
"next_action": ""
"live_defect": false,
"last_revalidated": "2026-09-19",
"next_action": "none \u2014 defect no longer reproduces: zero MessageAbortedError in current logs (incl. active worker), six most recent session checkpoints full documents (111-396 lines); verified by present-absence 2026-09-19"
},
{
"number": 316,
@@ -237,8 +235,8 @@
{
"number": 183,
"title": "Future: typed temporal semantics for facts, relationships, beliefs, and preferences",
"tracker_state": "open",
"reconciliation_state": "DEFERRED_FUTURE",
"tracker_state": "closed",
"reconciliation_state": "HISTORICAL_EVIDENCE",
"labels": [
"P3 \u2014 low",
"governance",
@@ -250,14 +248,14 @@
"ready"
],
"live_defect": false,
"last_revalidated": "2026-09-11",
"next_action": ""
"last_revalidated": "2026-09-19",
"next_action": "none \u2014 idea absorbed into parent epic #181 as tracked checklist item; full detail preserved in this closed issue; re-mint when live"
},
{
"number": 182,
"title": "Future: GitHub code-search prior-art audit for graph and vector memory",
"tracker_state": "open",
"reconciliation_state": "DEFERRED_FUTURE",
"tracker_state": "closed",
"reconciliation_state": "HISTORICAL_EVIDENCE",
"labels": [
"P3 \u2014 low",
"governance",
@@ -266,8 +264,8 @@
"ready"
],
"live_defect": false,
"last_revalidated": "2026-09-11",
"next_action": ""
"last_revalidated": "2026-09-19",
"next_action": "none \u2014 idea absorbed into parent epic #181 as tracked checklist item; full detail preserved in this closed issue; re-mint when live"
},
{
"number": 181,
@@ -287,13 +285,13 @@
],
"live_defect": false,
"last_revalidated": "2026-09-11",
"next_action": ""
"next_action": "epic holds absorbed children #182 #183 + research watchlist #164 #165 #166; closes when prerequisites land or ideas dropped"
},
{
"number": 179,
"title": "Future: succession/privacy semantics and lineage evaluation",
"tracker_state": "open",
"reconciliation_state": "DEFERRED_FUTURE",
"tracker_state": "closed",
"reconciliation_state": "HISTORICAL_EVIDENCE",
"labels": [
"P3 \u2014 low",
"governance",
@@ -305,14 +303,14 @@
"ready"
],
"live_defect": false,
"last_revalidated": "2026-09-11",
"next_action": ""
"last_revalidated": "2026-09-19",
"next_action": "none \u2014 idea absorbed into parent epic #175 as tracked checklist item; full detail preserved in this closed issue; re-mint when live"
},
{
"number": 178,
"title": "Future: evidence-grounded ancestral perspective with explicit uncertainty",
"tracker_state": "open",
"reconciliation_state": "DEFERRED_FUTURE",
"tracker_state": "closed",
"reconciliation_state": "HISTORICAL_EVIDENCE",
"labels": [
"P3 \u2014 low",
"governance",
@@ -322,14 +320,14 @@
"perception"
],
"live_defect": false,
"last_revalidated": "2026-09-11",
"next_action": ""
"last_revalidated": "2026-09-19",
"next_action": "none \u2014 idea absorbed into parent epic #175 as tracked checklist item; full detail preserved in this closed issue; re-mint when live"
},
{
"number": 177,
"title": "Future: temporal autobiographical model with provenance and reinterpretation lineage",
"tracker_state": "open",
"reconciliation_state": "DEFERRED_FUTURE",
"tracker_state": "closed",
"reconciliation_state": "HISTORICAL_EVIDENCE",
"labels": [
"P3 \u2014 low",
"governance",
@@ -340,14 +338,14 @@
"ready"
],
"live_defect": false,
"last_revalidated": "2026-09-11",
"next_action": ""
"last_revalidated": "2026-09-19",
"next_action": "none \u2014 idea absorbed into parent epic #175 as tracked checklist item; full detail preserved in this closed issue; re-mint when live"
},
{
"number": 176,
"title": "Future: lineage-aware situated curiosity for meaningful autobiographical gaps",
"tracker_state": "open",
"reconciliation_state": "DEFERRED_FUTURE",
"tracker_state": "closed",
"reconciliation_state": "HISTORICAL_EVIDENCE",
"labels": [
"P3 \u2014 low",
"feature",
@@ -358,8 +356,8 @@
"ready"
],
"live_defect": false,
"last_revalidated": "2026-09-11",
"next_action": ""
"last_revalidated": "2026-09-19",
"next_action": "none \u2014 idea absorbed into parent epic #175 as tracked checklist item; full detail preserved in this closed issue; re-mint when live"
},
{
"number": 175,
@@ -379,13 +377,13 @@
],
"live_defect": false,
"last_revalidated": "2026-09-11",
"next_action": ""
"next_action": "epic holds absorbed children #176-#179 as checklist items; closes when prerequisites land or ideas dropped"
},
{
"number": 166,
"title": "RESEARCH WATCHLIST: Memory-R1 (RL memory ops), Titans (test-time memory), Vespa/Weaviate/Milvus (retrieval competitors)",
"tracker_state": "open",
"reconciliation_state": "DEFERRED_FUTURE",
"tracker_state": "closed",
"reconciliation_state": "HISTORICAL_EVIDENCE",
"labels": [
"P3 \u2014 low",
"growth",
@@ -394,14 +392,14 @@
"ready"
],
"live_defect": false,
"last_revalidated": "2026-09-11",
"next_action": ""
"last_revalidated": "2026-09-19",
"next_action": "none \u2014 idea absorbed into parent epic #181 as tracked checklist item; full detail preserved in this closed issue; re-mint when live"
},
{
"number": 165,
"title": "RESEARCH: SimpleMem semantic compression + A-MEM dynamic linking + Letta sleep-time compute",
"tracker_state": "open",
"reconciliation_state": "DEFERRED_FUTURE",
"tracker_state": "closed",
"reconciliation_state": "HISTORICAL_EVIDENCE",
"labels": [
"P3 \u2014 low",
"infrastructure",
@@ -410,14 +408,14 @@
"ready"
],
"live_defect": false,
"last_revalidated": "2026-09-11",
"next_action": ""
"last_revalidated": "2026-09-19",
"next_action": "none \u2014 idea absorbed into parent epic #181 as tracked checklist item; full detail preserved in this closed issue; re-mint when live"
},
{
"number": 164,
"title": "RESEARCH: HippoRAG 2 \u2014 PPR-style associative propagation as warm-neuron activation candidate",
"tracker_state": "open",
"reconciliation_state": "DEFERRED_FUTURE",
"tracker_state": "closed",
"reconciliation_state": "HISTORICAL_EVIDENCE",
"labels": [
"P3 \u2014 low",
"growth",
@@ -426,27 +424,27 @@
"ready"
],
"live_defect": false,
"last_revalidated": "2026-09-11",
"next_action": ""
"last_revalidated": "2026-09-19",
"next_action": "none \u2014 idea absorbed into parent epic #181 as tracked checklist item; full detail preserved in this closed issue; re-mint when live"
},
{
"number": 163,
"title": "Temporal graph backend spike: Neo4j vs FalkorDB (LadybugDB experimental; Graphiti as reference)",
"tracker_state": "open",
"reconciliation_state": "NEEDS_REVALIDATION",
"reconciliation_state": "VALID_OPEN",
"labels": [
"P1 \u2014 high",
"ready"
],
"live_defect": false,
"last_revalidated": "2026-09-11",
"next_action": ""
"last_revalidated": "2026-09-19",
"next_action": "run the backend spike; compare on same corpus/query set; record evidence-backed recommendation"
},
{
"number": 162,
"title": "Qdrant associative-memory projection spike (dense/sparse/multivector + ColBERT late-interaction reranking)",
"tracker_state": "open",
"reconciliation_state": "NEEDS_REVALIDATION",
"tracker_state": "closed",
"reconciliation_state": "SUPERSEDED",
"labels": [
"P1 \u2014 high",
"custodian",
@@ -454,8 +452,8 @@
"ready"
],
"live_defect": false,
"last_revalidated": "2026-09-11",
"next_action": ""
"last_revalidated": "2026-09-19",
"next_action": "none \u2014 scope carried verbatim by #316 (ADAPT-1 B3-v2); single-tracker rule"
},
{
"number": 159,
@@ -478,8 +476,8 @@
{
"number": 158,
"title": "Generated wiring-status / architecture-truth report",
"tracker_state": "open",
"reconciliation_state": "VALID_OPEN",
"tracker_state": "closed",
"reconciliation_state": "SUPERSEDED",
"labels": [
"P2 \u2014 medium",
"growth",
@@ -489,8 +487,8 @@
"ready"
],
"live_defect": false,
"last_revalidated": "2026-09-11",
"next_action": ""
"last_revalidated": "2026-09-19",
"next_action": "none \u2014 scope carried verbatim by #315 (ADAPT-1 B2-v2); single-tracker rule"
},
{
"number": 156,
@@ -1151,6 +1149,6 @@
"next_action": ""
}
],
"last_reconciled": "2026-09-12",
"reconciled_by": "PL1 held-out era reconciliation (fresh session 2026-09-12)"
}
"last_reconciled": "2026-09-19",
"reconciled_by": "fresh-session tranche 2026-09-19: template retrofit (spine+plain-English on all open issues), closures #158/#162 (SUPERSEDED) and #324 (FIXED_VERIFIED), research labels applied to #163/#164/#165/#166/#182/#316, stale bug labels removed from #163-#166; 2026-09-19 absorption pass: parked children absorbed into parents (#175<-#176..#179; #181<-#182,#183,#164..#166) per one-open-note-per-idea standard"
}
+134
View File
@@ -0,0 +1,134 @@
# THE LANGUAGE DICHOTOMY LEDGER — measured, not assumed
_Created 2026-10-06 from real benchmarks. This is the governing standard for every port in the full dichotomy rebase. Every port must pass the "which language is better for THIS operation?" test before being assigned._
---
## The Measured Benchmarks
| Operation | Python | Python ctypes → Rust | Go cgo → Rust | Pure Go inline |
|---|---|---|---|---|
| Simple tier check | 0.05 µs | 1.4 µs | 1.4 µs | — |
| Consolidation (669B payload) | 0.2 µs | 2.9 µs | 3.4 µs | 0.3 µs |
| Concurrent HTTP (10 requests) | 10.8ms (4.0x) | — | 8.4ms (5.1x) | — |
| CPU-bound pattern matching (1000 msgs) | 9.6ms (0.8x — GIL) | — | ~2.5ms (est. 3.5-4x) | — |
| Compression + zlib wrapper | 0.2 µs | 13.7 µs (worse!) | — | — |
## The Laws
### Law 1: FFI overhead is negligible for the real workload
The cgo/ctypes boundary costs 1.4-3.4 µs per call. Ollama inference costs 200-5000 ms. FFI overhead is 0.0003-0.0017% of total request time. The language of the caller doesn't matter for the boundary.
### Law 2: Go wins for CPU-bound reactive work
Goroutines deliver true parallelism (5.1x concurrent HTTP, ~3.5-4x CPU-bound). Python's GIL serialises CPU-bound work (0.8x speedup with 4 threads). Go wins for: operator, witness, event bus, work manager, tool executor.
### Law 3: Simple operations stay in the caller's language
Pure Python compression: 0.3 µs. Same op via Rust FFI: 10.4 µs. The FFI overhead exceeds the compute benefit for simple operations. If a Go module needs a string truncation, do it IN GO.
### Law 4: Rust wins for complex deterministic operations
Compile-time type safety, zero-cost abstractions, memory safety, near-native speed for complex compute. Rust wins for: scoring, dedup, pattern matching across many signals, record assembly with many fields, structural store operations.
### Law 5: Compression across the FFI boundary makes things SLOWER
Measured: uncompressed FFI call = 6.1 µs. With zlib wrapper = 13.7 µs (+125%). The cgo transition overhead (~1-2µs) dominates; payload size doesn't matter for local calls under 10KB. Compression helps only for network transfers (>100KB payloads).
### Law 6: Reduced payload (shorter keys) gives a marginal improvement
Measured: 6.1 → 4.6 µs (-25%) by shortening JSON keys from "wash_count" to "w". This is a valid optimisation for hot-path FFI calls but not worth the complexity for most operations.
### Law 7: Pure inline (no FFI) is fastest when the operation is simple
Measured: pure Go inline = 0.3 µs vs 6.1 µs via FFI. If the operation is simple enough to implement in the caller's language, do it inline. Only cross the FFI boundary for operations complex enough to justify it.
---
## The Practical Decision Tree
```
Is the operation I/O-bound (HTTP, subprocess, file I/O)?
→ YES → GO (goroutines, net/http, os/exec)
→ NO ↓
Is the operation CPU-bound and in the request path (responding to user)?
→ YES → GO (goroutines give true parallelism where the GIL fails)
→ NO ↓
Is the operation complex deterministic compute (multiple functions, thresholds, scoring)?
→ YES → RUST (type safety, zero-cost abstractions, memory safety)
BUT measure: does the compute exceed the FFI overhead?
→ NO ↓
Is the operation simple (string truncation, basic comparison, simple lookup)?
→ YES → Do it INLINE in the caller's language (no FFI)
```
---
## The Wave Assignment (corrected)
| Wave | Language | Why |
|---|---|---|
| W4: event-bus, hook-engine, message-queue, microkernel, subsystem-health, parallel-processor, work-manager, failure-filer, cron-engine, night-mode, cache, connection-pool, recall-router | **Go** | I/O-bound, CPU-bound reactive, event-driven |
| W4b: tool-executor, tool-protocol, local-tool-runtime | **Go** | I/O-bound, request-path |
| W5a: model-connect (all 10 provider modules) | **Go** | I/O-bound (HTTP), connection pooling |
| W5b: operator, adaptive_router, build_mode, warm_router, etc. | **Go** | CPU-bound reactive (routing, dispatch) + I/O-bound |
| W5c: memory_store, curator, sleep_time | **Go** | I/O-bound (SQLite + subprocess) |
| W6: spine, construction_*, contracts, capability_*, drift_*, graph_memory, memory_selector, identity_anchors, pins, salience_gate, self_improve, token_optimizer | **Rust** | Complex deterministic compute (scoring, dedup, classification, structural operations) |
| W6 simple modules: response_adapter, route_risk_flags, rune_profiler, rune_spinner, wait_guard, task_persist, time_awareness | **Stay in caller's language** | Simple operations where FFI overhead > compute benefit |
| W7: TUI | **Go (Bubble Tea)** | The reactive front end that interfaces with the user |
---
## The Compression Idea (EXPERIMENTAL — NOT WORTH IT)
**Measured result: compression across the FFI boundary makes things 125% SLOWER.**
The cgo transition overhead (~1-2µs) is the dominant cost, not the payload size. Compressing the payload adds CPU work (compress + decompress) that exceeds the benefit of a smaller payload crossing the boundary. The compressed payload is 20% of the original size, but the total time doubles.
Compression WOULD help only if:
- The payload were >100KB (network transfer between machines)
- The boundary were a network connection, not a local function call
**Mark as experimental and park. Do not implement.**
---
## The Hybrid Language Idea (FUTURE — NOT NOW)
A hybrid language combining Go's concurrency with Rust's type safety and memory safety would eliminate the FFI boundary entirely. This would be the ideal language for the entire runtime.
But this is a much larger project — effectively designing and implementing a new programming language. It should be explored after the rebase is complete and the system is stable in Go+Rust. The cgo boundary works today with negligible overhead.
---
## Provenance
- Benchmarks run 2026-10-06 on nick-desktop (CachyOS, 4 cores, cgo 1.21, modernc.org/sqlite)
- Rust kernel: libcognition_core.so from cognition_core crate
- Go binaries: statically linked, go 1.21
- Python: /home/nick/.venvs/memory/bin/python3
- These measurements are for THIS hardware and THIS codebase. Re-measure if the hardware changes.
---
## The Hybrid Language: SURVIVOR
Named by Nick (2026-10-06): Rust (survives, memory-safe, deterministic) + Go (running, reactive, concurrent) = **Survivor** — the hybrid language pattern where Go reactive code links Rust deterministic compute as a static library at compile time.
### The Survivor Build Pattern
- Rust crates compile as staticlib (.a) + cdylib (.so)
- Go binaries link the .a files at compile time via cgo LDFLAGS
- The caller sees ONE binary with ONE function call — no FFI boundary from the outside
- No CC_RUST_LIB / SC_RUST_LIB env vars needed
- Measured: 0.6µs/call vs 1.4-3.4µs for the .so approach
### Survivor Go Packages
All under src/go/cognition/:
- cognition (root): tier, consolidation, witness, safety, drift, pins, growth
- retrieval: memory_retrieval kernel (mr_call)
- storage: memory_storage kernel (mems_read_query)
- scaffold: scaffold_core kernel (sc_check_transition, sc_close_quality, sc_language_placement)
- provenance: evidence_provenance kernel (ep_* functions)
- spine: rune_spine kernel (sp_drift, sp_export, sp_project, sp_query)
- scoring: memory_scoring kernel (ms_* functions)
- capability: capability_scoring kernel (cs_evaluate_fit, cs_score_card)
- token: token_counting kernel (tc_compress_context, tc_estimate_tokens)
- query: query_memory kernel (qm_* functions)
+52
View File
@@ -0,0 +1,52 @@
# Phase G Slice 2 (T7.3) — Evidence-Provenance Surface Census (#2449)
Generated 2026-10-08 (contract BUILDER-2026-10-08T14:02:24Z-588ca6). The
six-module surface, its Rust candidate, and the per-module switch state —
measured, not asserted. This is the frozen-contract input.
## The Rust candidate
`src/rust/evidence_provenance/` — 24 `pub extern` symbols, CI-built on all
three rust steps (evidence_provenance/Cargo.toml in every list). The
cdylib carries the ep_* core (compute_hash, append_entry, verify_chain)
plus the per-module helper seams (ca_*, and the loader families).
## Per-module switch state
| module | loader integration | parity evidence | state |
|---|---|---|---|
| claim_audit.py | ep_loader (ca_evidence_terms, ca_verify_gate, ca_report_aggregate) — 17/17 proven vs this module's Python vintage (docstring) | ep parity 17/17 | SWITCHED |
| behavior.py | 4 loader/ctypes refs | ep_loader import + parity battery | SWITCHED |
| behaviour_ledger.py | 11 loader/ctypes refs | dual-import (validation ledger) | SWITCHED |
| evidence_probe.py | 4 loader/ctypes refs | ep_loader delegation | SWITCHED |
| verification_layer.py | 3 loader/ctypes refs | ep_loader delegation | SWITCHED |
| audit_ledger.py | 0 — NO loader integration | drift-key vintage split (see below) | REMAINING GAP |
Test batteries observed green this session: claim_audit/audit_ledger/
behavior/evidence_probe/verification_layer families 14/14;
test_evidence_provenance_shims.py 6/6.
## The remaining work (batches after this census)
1. **audit_ledger switch** — the only module with zero loader integration.
Pin the DRIFT KEY FIRST: the live promotion_ledger.jsonl (21 entries)
verifies valid under the DEPLOYED vintage key `rune-drift-integrity-2024`;
the src/rune default (`rune-governed-adaptation-2024`) fails it. The
Rust seam must carry the deployed-vintage key as the verification key
for existing entries (the frozen contract pins this).
2. **Vintage reconciliation** — src/rune/ is the hardened NEWER vintage
(memory_env-pathed DB, defensive code); deployed + shared/ audit_ledger
are OLDER. The switch must reconcile, not clobber (RECONCILE-DON'T-CLOBBER).
3. **Supersession ledger** — per-module close records after shadow evidence.
4. **Shadow** — run the ep parity battery + per-module canaries as the
shadow evidence per the slice-1 pattern (see scripts/qm_shadow.py for
the shape).
## Grounding findings carried from the issue (verified this session)
- Only 3 of 6 modules are deployed (~/.config/opencode/scripts/):
audit_ledger, behavior, claim_audit. Consumers confirmed: rune_tui.py
(claim_audit, behavior), curator.py + canaries (audit_ledger),
rune_operator.py:581 (evidence_probe).
- The divergent-vintage finding and the live-ledger drift-key finding are
banked above and pin the contract.
+382
View File
@@ -0,0 +1,382 @@
# Language-Fit Rubric — Wave 1 (Language-Rebasing Tranche R1)
> STATUS: FINAL — self-verified 2026-09-29 per tranche §12 (all 6 rounds completed,
> evidence-sufficiency statements recorded, kill tests frozen; execution proceeds on the
> evidence, every RECODE still passes its benchmark gate — no win, no recode).
> Per-subsystem sections filled from live research rounds (≥2 live-verified external sources per claim,
> per-source lessons, evidence→decision mapping, kill test per candidate). No code changes in Wave 1.
> Governing law from §11: **KEEP-PYTHON honesty determines how much of the rebase volume is real.**
> Toolchain baseline: Rust 1.98.1 + GCC 16.2.1 present; Go NOT installed — Go earns installation only
> through rubric evidence here.
## Verdict (all rounds, one paragraph)
**KEEP-PYTHON across the board: 40 clusters scored, 0 recode units awarded.** Six research
rounds (W2 leaf utilities, W3 memory, W4 provider-layer, W5 orchestration, W6 runtime-core,
W7 TUI) each characterized their subsystem's actual workload inward (file:line-anchored) and
tested Python/Rust/Go/C against it with live-verified sources and frozen kill tests. The
pattern is consistent: the compute-shaped work already executes in C (hashlib, sqlite3/FTS5/vec0,
json, regex), the dominant latency is network or LLM-bound, and no cluster contains a hot loop
that pays for a process-boundary recode through the 658 µs–0.63 ms interop crossing. **Go:
REJECTED — does not earn installation this tranche** (D5=0 everywhere; nothing measured or
fetch-confirmed earns it; orchestration additionally rejects its design fit; K-GO kill tests
frozen per round should the case be revived). **Rust: toolchain-ready, justified nowhere this
tranche** — keep as the standing option behind the CI-proven std-only adapter for any future
measured hot loop. **C: rejected everywhere scored** (duplicates C already inside SQLite/hashlib;
adds an unsafe-memory surface). The rebase volume the tranche hypothesized is real only as a
small set of named improvements — see "Wave-plan consequence" below.
## Rubric dimensions (applied to every candidate language per subsystem)
| Dimension | Question | Evidence required |
|---|---|---|
| D1 Workload fit | Does the subsystem's dominant workload (I/O-bound, CPU-bound, FFI, protocol, UI) actually favour this language? | Benchmarks or authoritative docs, live-verified |
| D2 Measured gain | What wins, concretely — latency, memory, startup, binary distribution? | Named hot paths from the Wave 0 inventory + numbers |
| D3 Interop cost | What does the interop contract (§5) cost to carry for this boundary? | Adapter surface size, ABI/build complexity |
| D4 Ecosystem | Do the needed libraries exist and are they maintained? | Live-verified crate/package/module listings |
| D5 Toolchain reality | Is the toolchain present (or installable and justified) on this machine and the CI runner? | Runner + local `--version` evidence |
| D6 Maintenance continuity | Can the Rune ecosystem's single-maintainer loop sustain code in this language here? | Honest judgement, stated plainly |
| D7 Kill test | What is the CHEAPEST disproof of this candidate? | One falsifiable early test, frozen before any recode |
Scoring: each candidate gets D1–D6 scored 0–2 with one-line evidence each, D7 written regardless.
Decision per subsystem: **KEEP-PYTHON** / **RECODE→<language>** — KEEP-PYTHON is the expected default;
a RECODE that cannot pass its own kill test reverts to KEEP-PYTHON before implementation.
---
## W3 — Memory & persistence (units: memory_store 56 fns, curator 43, warm_router 32, memory_consolidation 20, sleep_time 25, + graph_memory, night_mode, identity_anchors)
- **Research round actor:** general-2 (COMPLETED 2026-09-29 — artifacts at
`research/wave1/memory/`: inward.md, outward/ ×6, outward-sources.md, synthesis.md)
- **Intention profile:** JSONL-heavy appends, BM25/FTS ranking, consolidation passes, long-running
scheduled jobs, file-backed state.
- **Decision:** **KEEP-PYTHON (all 7 clusters, zero RECODE).** Cluster verdicts:
(1) hot-store JSON persistence — KEEP with upgrade path: orjson in-process wheel
(~10× dumps / 2× loads); a bespoke Rust CLI unit is dead on spawn cost (the
`shared/native_units.py` crossing ~1–5 ms ≈ orjson's entire 3.4 MB `knowledge.json` decode);
(2) SQLite store + FTS5/vec0 recall — KEEP, the compute is already C inside SQLite
(`memory_store.py:646` vec0 MATCH, `:693` bm25); (3) neuron scoring/routing — KEEP,
network-bound `_embed` (Ollama subprocess curl) dominates; (4) graph BFS — KEEP,
hops=1 default, per-node SQL, tiny N; the future fix is a SQL CTE, not a language;
(5) batch consolidation/curator — KEEP, LLM/I-O-bound and latency-insensitive,
asyncio sweet spot; (6) orchestration/glue — KEEP, pure glue pinned by the Python-TUI
interop contract; (7) embedding transport — KEEP, network-bound.
- **Candidate matrix summary:** Python 7/7 · Go 0/7 (not installed, nothing measured or
fetch-confirmed earns installation; Go's JSON stack mid-rewrite upstream) · hand-written C
0/7 (C already battle-tested inside SQLite — hand-writing would duplicate it) · Rust 0/7
as CLI units (spawn cost kills the one credible vector; in-process wheels excluded by
Wave 0 policy).
- **Kill tests (frozen in synthesis.md):** Rust-JSON — orjson microbench on live 3.4 MB
`knowledge.json` (if drop-in and ≥2× load / ≥5× dump, the CLI unit is disproven on spawn
cost); Rust-general — kill unless a profile shows ≥50% wall time in pure Python compute
(none exists; reopen only on materially changed workload); Go — instrument one
`consolidate_all` run, kill if Python-compute share <50% (it will be — LLM/I-O bound);
C — kill unless a hot kernel absent from the SQLite extension ecosystem is identified
(none).
- **Sources + lessons:** 6 live-fetched 2026-09-29 (orjson, sled, sqlite-vec, SQLite FTS5
docs, Go json/v2 rewrite issue, pydantic-core) — full annotations in
`research/wave1/memory/outward-sources.md`.
- **Evidence sufficiency (honest):** static analysis only, no runtime profiling;
memory.store SQLite DB not materialized locally — kill tests specify *measured*
thresholds rather than assertions. Verdicts rest on "Python is glue around C/network,"
which profiling would only strengthen.
## W4 — Provider/model layer (units: provider_registry 28, model_connect 10, model_routing 15, model_profiles 15, provider_budget 21, + standardized_providers, model_registry, connection_pool)
- **Research round actor:** general-5 (COMPLETED 2026-09-29 — artifacts at
`research/wave1/provider-layer/`: inward.md, outward-sources.md, outward/ (8 evidence
JSONs), synthesis.md)
- **Intention profile:** HTTP/SSE streaming, connection pooling, retries/backoff, protocol parsing,
tool-call reliability.
- **Intention profile correction (inward-verified):** the layer has **NO retry/backoff and NO
SSE stub at all** (grep-verified) — `stream: False` everywhere, ~900 lines, remote-LLM-latency-
bound. Rewrite pitches are therefore feature-adds, not ports.
- **Candidate matrix:** 5 clusters, all KEEP-PYTHON. Scores (1–5 = fit for the cluster's actual
workload): (C1) HTTP wire + transport (provider_registry, openai_compat_transport, model_connect
discovery) Python 5 / Go 2 / Rust 1; (C2) connection pool (connection_pool.py, 144 lines —
in-process object guards under threading.Lock, NOT a TCP pool) Python 5 / Go 2 / Rust 2;
(C3) routing decisions (model_routing.py, 432 lines, pure decision logic, one httpx call)
Python 5 / Go 1 / Rust 1; (C4) budget accounting (provider_budget.py, 354 lines, pure
arithmetic + lock, no I/O) Python 5 / Go 1 / Rust 1; (C5) config/registry/normalization
(model_profiles, model_registry, standardized_providers, model_connect tables — dataclasses +
JSON, editable by non-systems programmers) Python 5 / Go 1 / Rust 1.
- **Decision:** **KEEP-PYTHON (all 5 clusters).**
- **Kill tests:** C1 Go — KILLED: toolchain absent (`which go` → not found); 28 call-site
behaviors incl. the tool-call envelope contract (openai_compat_transport.py:67-107, 160-207)
would be re-implemented with zero incumbent test port and NO performance signal (remote-LLM-
latency-bound, kilobyte payloads). Re-earn path if Go is ever installed: std-only proof via
`interop/rebase-proof/` + a benchmark harness on C1 only. C1 Rust — KILLED BY CONSTRUCTION:
SSE parsing requires reqwest+tokio+eventsource-stream+nom (outward O3/O4/O5 — even mistral.rs
takes the tokio stack), violating the std-only interop contract. C2–C5 Go/Rust — KILLED:
burden of proof sits on the rewrite candidates; kill tests need contention/throughput/
counter-evidence that does not exist; routing runs once per request at millisecond scale
against multi-second LLM calls (5 orders of magnitude below any measurable threshold).
- **Sources + lessons:** 8 live-fetched (O1–O8), ≥2 per major claim, coverage map in
`outward-sources.md`. Lessons: (1) stdlib-only Rust has no realistic precedent for HTTP/SSE
workloads — the interop contract's zero-crate standard effectively decides Rust out of all
network-wire clusters; (2) Go's stdlib HTTP+NDJSON streaming is capability-proven
(pkg.go.dev/net/http, ollama api/client.go, ollama's Go API server) — Go's losses here are
evidence-absence, not capability-absence; (3) the honest reliability upgrade for this layer
is a small Python-level httpx retry/timeout wrapper — a feature-add, not a language change.
## W5 — Orchestration, authority, plugins, skills (units: orchestration/ 44 files 244 fns, contracts, build_mode 34, construction_authority*, verification_construction, spine, + governance surfaces: drift_*, persona_gate, safety_override, witness, behavior, growth_delta, claim_audit)
- **Research round actor:** general-1 (COMPLETED 2026-09-29 — artifacts at
`research/wave1/orchestration/`: inward.md, outward-sources.md, outward/ (4 search
JSONs), synthesis.md)
- **Intention profile:** contract/lifecycle state machines, authority gating, fail-closed validation,
HMAC-chained ledgers, policy dispatch.
- **Intention profile correction (inward-verified):** the subsystem is durable-ledger I/O,
authority wiring, deterministic policy gates, and TUI-facing coordination — NOT hot loops
(2 RLocks, 0 sockets, 0 thread pools across 43 files). **Scope gap: `construction_authority.py`
and `verification_construction.py` do not exist in the tree** — the construction cluster is
covered by build_mode.py; no evidence invented for the missing files.
- **Candidate matrix:** 6 clusters, all KEEP-PYTHON. Scores (1–5 = fit for the cluster's actual
workload): (C1) durable state & ledger stores (event_store.py:56-101, atomic.py, evidence_store.py
— fsync-bound; hashing already C via hashlib) Python 5; (C2) composition roots & authority wiring
(composition.py, authority.py, cognitive.py — pure glue, runtime cost ≈ 0) Python 5; (C3)
policy/state machines/gates (lifecycle.py, scheduler.py, broker.py, no_change.py, reflex.py —
deterministic dict/enum decisions, sub-ms; testability is the requirement) Python 5; (C4)
structural self-model & schema tooling (spine.py:24-25, microkernel.py, contracts.py, records.py
— introspection + canonical JSON; only candidate for a future Rust spine-diff if snapshots grow
1000×) Python 4; (C5) TUI-facing orchestration & build pipeline (build_mode.py 11-stage pipeline,
gateway.py, transport.py — the consumer IS the Python TUI; latency dominated by LLM/subprocess
waits) Python 5; (C6) benchmark/migration harnesses (retrieval_benchmark.py, migrate.py,
benchmark.py — offline tooling, recode buys nothing, loses iteration speed) Python 4.
- **Decision:** **KEEP-PYTHON (all 6 clusters). This subsystem contributes 0 recode units to
the wave plan.** Go: REJECTED, do not install — differentiator (goroutine-dense servers)
targets a workload absent here; cost is exception→error-value rewrite of ~260 functions.
Rust: FEASIBLE (toolchain proven) but UNJUSTIFIED anywhere — no cluster has the hot loop
that pays for a process-boundary recode; keep as toolchain-ready for other subsystems.
C: REJECTED — the only compute-shaped work (sha256) already executes C via stdlib hashlib.
- **Kill tests:** K1 (frozen, ALREADY RUN): 100 round-trips through the rebase-proof adapter —
mean 0.63ms, p95 0.74ms, cold 0.87ms, 100% exit-0 + ok:true → adapter overhead does NOT block
recodes on cost; recodes die on value grounds. Re-open any cluster if profiling shows a
function consuming >10% of a real interactive session. K-GO (frozen, ~30 min): Go prototype
of event_store.py's batched append+fsync vs Python at 1000 events; if Python's p95 is within
2× of Go's, Go is dead here permanently. K-RUST (frozen, ~20 min): measure spine diff on a
10k-entity snapshot; <50ms kills any Rust spine recode by absence of pain.
- **Sources + lessons:** 4 live-fetched web sources (pydantic-core, ruff blog, go.dev FAQ,
Python 3.14 hashlib docs) + 1 LOCAL EXPERIMENT (n=100 adapter benchmark). Lessons: (1) the
rebase-proof adapter round-trips at 0.63ms/op — subprocess-per-op is viable for coarse ops,
never per-event; (2) Python's "slowness" argument dissolves where the actual compute already
runs in C via stdlib (hashlib, sqlite) — the language question is really "where is the hot
loop", and here the answer is nowhere; (3) assumed limits flagged honestly: human-scale event
cadence (batch_size=8) and Linux spawn cost — both would need revisit at 10⁴+ events/sec or
cross-platform targets.
## W6 — Runtime core & tooling (units: tool_executor 46, tool_protocol 27, local_tool_runtime 32, capability_broker 19, context_broker 21, work_manager 25, cron_engine 28, + failure_auto_filer 28, hook_engine, elastic_cognition, auto_tasks, goal)
- **Research round actor:** general-4 (COMPLETED 2026-09-29 on disk despite cancellation
notification — artifacts at `research/wave1/runtime-core/`: inward.md, outward/,
outward-sources.md, synthesis.md)
- **Intention profile:** subprocess/process supervision, native execution boundary (native_units
adapter already exists), event loops, cron scheduling, hook dispatch.
- **Decision:** **STAY-PYTHON (all 6 clusters).** Round scores (1–5 = fit for the cluster's
actual inward-characterized workload): (A) subprocess lifecycle (tool_executor, cron_engine,
auto_tasks) 4.7 — `subprocess.run(timeout=, capture_output=)` is a one-call expression of the
pattern; Rust std::process has NO built-in child timeout (outward-verified), strictly more
code under zero-crate; (B) protocol/JSON parsing (tool_protocol, brokers) 4.5 — inputs are
KB-scale model fragments; Python json/regex is already C-backed, so a rewrite swaps C for
compiled code at the same asymptotic cost; serde's typed-struct model actively mismatches
fence-wrapped schema-flexible output; (C) model→tool control loop + HTTP
(local_tool_runtime, elastic_cognition, goal) 4.8 — wall time is LLM HTTP latency in seconds;
Python overhead is µs–ms noise; the loop's content is policy (circuit breaker, escalation
ladders, routing tables); (D) context assembly (context_broker) 4.7 — correctness lives in
admission policy and degrade-not-crash semantics, not speed; compaction is itself an LLM call;
(E) reliability/queueing (failure_auto_filer) 4.2 — honest lowest: on paper the best Rust
candidate (queue + worker + crash-safe JSONL spool), but perf requirement ≈ nil and the
correctness burden is threading semantics a rewrite would re-risk for no win ("nothing
breaks today"); (F) declarative config/brokers (work_manager, hook_engine, capability_broker)
4.9 — literal data, no-op runtime, portable to anything valuable in nothing.
- **Candidate matrix summary:** Python 6/6 · Go 0/6 (paper verdicts only — evidence-starved,
not installed, kill tests unrunnable locally) · Rust 0/6 (kill tests runnable via the
existing std-only interop harness) · C unscored (no FFI-adjacent cluster surfaced).
Best-language moment found anywhere: robfig/cron replacing ~37 hand-rolled cron-parsing
lines (cron_engine.py:199-236) — ergonomics nicety, not a fit verdict.
- **Kill tests (frozen in synthesis.md):** Rust-A — re-express `_run_command`
(tool_executor.py:1064) with std::process + manual timeout; kill if >2× the ~40-line
Python wrapper (Q4 predicts it is); Go-A — port `cron_engine._run_loop` with os/exec,
measure task-fire latency delta (prediction: zero — 60 s sleep and child runtime dominate);
B — parse the largest observed tool-protocol stream 1000× in Python; kill if total <1 s
(no rewrite yields an observable win); C — instrument `_run_loop`
(local_tool_runtime.py:417), log non-HTTP CPU per iteration (prediction <1% of wall);
D — time `assemble`+`_admit` on the largest stored context, kill if <10 ms; E — fault-inject
kill -9 during spool append; if recovery semantics already hold, the rewrite has no
correctness win to buy; F — none needed: absence of any win condition IS the disproof.
- **Sources + lessons:** live-fetched 2026-09-29 — annotations in
`research/wave1/runtime-core/outward-sources.md`; headline lessons: Rust std::process lacks
child timeout (Q4); Go os/exec reaches parity but changes only syntax (Q1); Python
json/regex C-backed (Q5b); serde typed structs mismatch dynamic model output (Q5a);
concurrency features irrelevant at ≤2 threads (Q6).
- **Evidence sufficiency:** Python verdicts fully evidenced inward+outward; Go execution-side
evidence honestly starved (paper kill tests carried forward); E's JSONL-spool crash-safety
claim rests on inward semantics only — flagged in synthesis.md.
## W7 — Operator + TUI (units: rune_operator 61 fns, rune_tui 161 fns — largest module, tui_validator)
- **Research round actor:** general-3 (COMPLETED 2026-09-29 — artifacts at
`research/wave1/tui/`: inward.md, outward/ ×8, outward-sources.md, synthesis.md)
- **Intention profile:** terminal rendering, input handling, rich layout, hot store state, supervisory
command surface. Design decision 4 holds: TUI consumes the interop contract, never rewritten first.
- **Decision:** **KEEP-PYTHON (TUI shell; all 4 clusters, zero RECODE, no carve-out found).**
Cluster scores (1 = recode, 5 = keep): (A) rendering/widgets 4 — no hot loop exists; render is
plain Rich `Text` concatenation (rune_tui.py:1331, chat_bubble.py:157), only animation a 0.12 s
spinner (:263), no markdown/Syntax parsing anywhere in src/rune; (B) event glue (~50 `_cmd_*`
handlers, reactives, tool-widget maps) 5 — this is Textual's core competency (workers,
`exclusive=True`, `call_from_thread`); vendor docs (ratatui) admit "little to no help in organizing
large applications"; (C) model send path + envelope 5 — synchronous `send_task` in async worker;
the envelope shape (`success/response/thinking/tool_events/degraded`, rune_tui.py:3624ff) is
ALREADY the de-facto interop contract; (D) subprocess/streaming 5 — JSONL streaming precedent
already in-tree (`_cmd_pull` :3443-3517): the pattern for consuming recoded units, not a recode
target. Whole-TUI native recode 1/5 REJECTED — 80+ first-party module coupling, framework-provided
concurrency re-implemented by hand; Go additionally toolchain-blocked. Countervailing evidence
(Bubble Tea/tview/Codex TUI maturity) recorded honestly in outward-sources.md — it does not
outweigh the coupling.
- **⚠ CONTRACT GAP FLAGGED (binds Waves 2–7):** `shared/native_units.py` parses only the LAST
stdout line — it must gain a JSONL streaming reader (per-line `json.loads` + terminal-envelope
validation) before any recoded long-running unit can stream progress to the TUI. Small, testable,
non-breaking; candidate for the first Wave 2 implementation issue.
- **Adapter surface (TUI as consumer — adopted as the rubric's interop-contract restatement):**
(1) single-invocation stateless CLI (`native_unit <op> [args]`, no daemon); (2) success = final
stdout line `{"ok":true, …}` generalizing the model-send envelope — recoded units emitting
`response`/`tool_events`/`degraded` plug in with zero TUI changes; (3) failure = `ok:false` +
nonzero exit, stderr human-only, success = exit 0 AND not timed out; (4) mandatory `--version`
on every unit (status bar + `canary_tui_drift.py` detect live units vs Python fallback);
(5) JSONL streaming mode for long ops with terminal sentinel envelope; (6) per-call timeout
budget, `timed_out` surfaced in `NativeResult` for graceful degradation; (7) streamed events
referencing UI objects carry the TUI's stable keys — `(channel, call_id)` for tool widgets
(:3676), WorkPane `_entries` object ids (:1239) — preserved verbatim; (8) std-only for
proof-phase units.
- **Candidate matrix summary:** Python 4/4 clusters · Rust/Go whole-TUI 1/5 rejected · carve-out
candidates: none found (future markdown parsing would carve as a Rust native unit behind the
adapter, not now).
- **Kill tests (frozen in synthesis.md):** stay-Python — killed if >16 ms UI-thread stalls under
heavy event bursts OR IPC latency dominates message round-trip (Textual pilot measurement);
Rust recode — killed if the adapter must expose >~15 first-party modules (count today ≈80:
killed NOW); Go recode — additionally killed by toolchain absence (`command -v go` empty).
- **Sources + lessons:** 8 live-fetched 2026-09-29 (Textual workers guide, ratatui vendor docs,
Bubble Tea/tview/Codex countervailing evidence, JSON Lines spec, push-granular-work guidance) —
annotations in `research/wave1/tui/outward-sources.md`.
- **Evidence sufficiency (honest):** full inward read of all 5 TUI files with line refs; ≥2 sources
per major claim; gap = no runtime profiling (stall kill test unmeasured — but no mechanism exists
for the stall to occur; the 120 ms 21-step pipeline was already removed, `_run_warm_router`
:3575 is a no-op).
## W2 — Leaf utilities & canaries (~40 modules, low coupling: pins, time_awareness, message_queue, event_envelope, attention_capsule, complexity_scorer, token_optimizer, cache 501/17, prompt_sync, chat_bubble, ~15 canary_* modules)
- **Research round actor:** general-6 (COMPLETED 2026-09-29 — full report in actor notification)
- **Intention profile:** small pure helpers, envelopes, scoring, cache; smallest blast radius; the
factory + interop proving ground at real scale.
- **Ground-truth measurements (local, this session):** Python fn call ~46 ns (100k timed
iterations in-process) · native CLI roundtrip ~658 µs (subprocess to
`interop/rebase-proof/target/release/rebase-proof --version`) · Python startup floor ~18 ms ·
overhead ratio ≈ **14,000×**. The only CI-proven interop contract is the subprocess CLI boundary
(`shared/native_units.py`: argv in → JSON stdout, `--version`, timeout, typed `NativeResult`).
PyO3/in-process bindings excluded by Wave 0 policy. Therefore every per-call crossing costs
≥658 µs — a per-turn helper would need to run >14,000× faster in Rust to break even.
- **Candidate matrix (representative — full per-cluster 0–2 scoring in round report):**
Python 12/12 in every cluster · Rust 5–6/12 · Go 1–3/12 (D5=0, not installed) · C 1–2/12.
No module contains a hot loop (heaviest: 2 `re.sub` per turn in token_optimizer).
- **Decision:** **KEEP-PYTHON (all ~40, zero RECODE).** Cluster verdicts: (a) pure CRUD helpers
pins/time_awareness/token_optimizer — KEEP, CPython 3.11+ already 10–60% faster on this shape
(PEP 659); (b) message/envelope/capsule structures — KEEP, recode would insert a boundary
between the chattiest neighbors; (c) cache.py (501 L, largest in wave) — KEEP, the fast part is
already C (sqlite3 DB-API 2.0 over SQLite's C library), Python is thin orchestration, batching
(threshold 50 / 30 s) already amortizes writes; (d) chat_bubble.py — KEEP, **hard-pinned** to
Python by the Textual framework (recode = full framework abandonment, bottleneck is human
typing speed); (e) prompt_sync.py glue — KEEP, glue into Python siblings (memory_env,
voice_sync, build_pipeline_policy); (f) ~19 canary_* — KEEP **categorically**, a canary that
verifies Python importability cannot exist in another language.
- **Kill tests (reopening criteria, all fail today on first cheap measurement):** Rust — microbench
one per-turn helper behind the native_units CLI, must beat the Python in-process call >10×
end-to-end including the 658 µs crossing (whole call <~46 µs; a trivial `--version` already
costs 658 µs); Go — identical benchmark post-install, uninstall if roundtrip >100 µs with no
named hot path; C — identical benchmark + required fuzz-clean JSON roundtrip, plus a
demonstrated GC-free allocation-hot loop first; cache.py — recode only if Python-side
orchestration (excl. sqlite3 waits) exceeds 5% of end-to-end latency; capsule/envelope/queue —
recode only if one turn's Python total exceeds ~5 ms AND a candidate's CLI path is >10× cheaper.
- **Sources + lessons:** (1) https://docs.python.org/3/whatsnew/3.11.html — 10–60% faster,
PEP 659 specializing interpreter: CPython already optimized for helper-shaped code, the D2
baseline is a moving improving target; (2) https://docs.python.org/3/whatsnew/3.13.html —
free-threading/JIT experimental, KEEP-PYTHON ≠ frozen but no bets on experimental paths;
(3) https://www.maturin.rs/ — in-process Rust↔Python needs a whole binding/packaging toolchain
atop the CLI boundary, D3 worse than measured 658 µs (Wave 0 policy excludes it anyway);
(4) https://go.dev/doc/install — Go is a pre-install prerequisite, D5=0 everywhere, never earned
installation; (5) https://textual.textualize.io/ — Textual is a Python TUI framework,
chat_bubble.py framework-pinned; (6) https://docs.python.org/3/library/sqlite3.html — sqlite3 is
DB-API 2.0 over C, cache.py's perf layer already native. All fetched live 2026-09-29.
- **⚠ Inventory drift (VERIFIED 2026-09-29):** complexity_scorer.py listed in
rebase-inventory.json (2 mentions) but absent on disk — deleted in commit 867321e
("governed retirement — complexity_scorer deleted (602 lines)"). Wave 0 inventory needs a
correction pass; the module was scored nowhere (no source to characterize).
---
## Wave-plan consequence (T5 scope, from the verdict above)
With **0 recode units awarded**, the tranche's hypothesized rebase volume is real only as the
work below. Waves 2–9 are **disposition + named improvements, NOT mass recoding**:
**Waves 2–7 — per-issue disposition (the 1,852 `[rebase w{wave}]` issues):**
Each issue receives its tranche §7 disposition — improve / fix / missing-connectors answered
with evidence — plus a language verdict of **KEEP-PYTHON with its rubric evidence line**
(the round section for that subsystem names the claim). Disposition runs leaf-first
(Wave 2 → 7), the canonical suite stays green throughout, and no issue closes without its
evidence line. A recode is off the table unless a frozen kill test is reopened — and then
tranche §6 still governs: **no benchmark win, no recode.** Go is not installed and earned no
installation; Rust stays toolchain-ready but unjustified (standing option behind the
CI-proven adapter).
**Named improvements — the actual rebase volume (ship alongside disposition):**
1. **JSONL streaming reader for `shared/native_units.py`** (W7 contract gap): the adapter
parses only the LAST stdout line; it must gain per-line `json.loads` + terminal-envelope
validation before any recoded long-running unit could stream progress. Small, testable,
non-breaking — first implementation issue of Wave 2.
2. **httpx retry/timeout wrapper for the provider layer** (W4): the honest reliability
upgrade is a feature-add, not a language change.
3. **orjson upgrade path** (W3 cluster 1): the only credible Python-side JSON win —
in-process, no boundary crossing. **DISPOSITION (2026-09-29, kill test EXECUTED and
FAILED — KEEP-PYTHON stands, no dependency declared):** microbench on the live
`~/.rune/consolidation/knowledge.json` (3,540,959 bytes, n=30 best-of): load 13.15 ms
std vs 7.85 ms orjson = **1.68× (bar ≥2×: FAIL)**; dump 9.58 ms std vs 5.61 ms
orjson-with-decode = **1.71× (bar ≥5×: FAIL)**; raw-bytes dump 1.39 ms = 6.91× but is
not drop-in (every `write_text`/`json.dump`-to-file site would need a bytes→str or
binary-write conversion). Roundtrip equality verified. Bench: `/tmp/orjson_bench.py`
shape (uvx --with orjson). The bytes trap measured real: decode() eats ~60% of the
dump win.
4. **complexity_scorer.py inventory correction**: listed in `rebase-inventory.json` but
deleted on disk (commit `867321e`, 602 lines) — Wave 0 inventory needs the correction
pass. **DISPOSITION (2026-09-29, DONE):** inventory regenerated per the script's own
header (never hand-edit) — 177→213 files, 1,852→2,314 functions, 13 dead files
dropped; committed + pushed `5bc837c`. The W2 round's "2 mentions" drift claim
verified FALSE against the live inventory (zero hits).
5. **robfig/cron** (W6): recorded as a best-language footnote only; no action.
**Wave 8 — TUI integration proof:** demonstrate the TUI reading/utilising the mixed-language
surfaces that exist (the `interop/rebase-proof` unit through the upgraded adapter), per the
8-point adapter surface adopted above.
**Wave 9 — close-out audit:** 100% of the 1,852 issues dispositioned, debt-table revision,
version bump.
## Cross-cutting candidates (evaluated once, referenced by every subsystem)
- **Rust (present, 1.98.1):** interop proof unit already CI-proven (std-only, zero crates, `interop/rebase-proof/`, adapter in `shared/native_units.py`, ok = exit 0 AND not timed out).
- **Go (absent):** must earn installation through D1–D5 evidence here before any recode targets it.
- **C (present, GCC 16.2.1):** expected to lose D6 in most subsystems; scored where FFI-adjacent work exists.
- **Python (KEEP baseline):** the default. Every subsystem begins here; evidence must move it.
## Evidence ledger (per-source lessons, all rounds)
Index of per-source evidence. Full annotations live in each round's
`research/wave1/<subsystem>/outward-sources.md`; this ledger records the headline lesson
each source contributed and the rubric claims it supports.
| Round | Sources (live-fetched 2026-09-29) | Headline lessons | Supports |
|---|---|---|---|
| W2 leaf utilities | 6: python.org 3.11 + 3.13 whatsnew, maturin.rs, go.dev/doc/install, textual.textualize.io, docs.python.org sqlite3 | CPython 3.11+ already 10–60% faster on helper-shaped code (PEP 659) — D2 baseline is a moving target; free-threading/JIT experimental, no bets; in-process bindings need a whole toolchain atop the CLI boundary (excluded by Wave 0 policy anyway); Go is pre-install prerequisite, D5=0; Textual framework-pins chat_bubble.py; sqlite3 perf layer already C | W2 KEEP-PYTHON ×~40; the 14,000× crossing-overhead law |
| W3 memory | 6: orjson, sled, sqlite-vec, SQLite FTS5 docs, Go json/v2 rewrite issue, pydantic-core | orjson is the only credible Python-side JSON win (in-process, no boundary); SQLite FTS5/vec0 compute is already C; Go's JSON stack mid-rewrite upstream (versioning risk); pydantic-core shows the Rust-as-wheel pattern, excluded by policy | W3 KEEP-PYTHON 7/7; orjson upgrade path on cluster 1 |
| W4 provider-layer | 8: live-fetched O1–O8 (HTTP/SSE ecosystem, tokio-stack precedents incl. mistral.rs, pkg.go.dev/net/http, ollama Go client/server) | stdlib-only Rust has no realistic HTTP/SSE precedent — the zero-crate contract decides Rust out of all network-wire clusters by construction; Go's stdlib HTTP+NDJSON streaming is capability-proven (its losses here are evidence-absence, not capability-absence); the honest reliability upgrade is a Python httpx retry/timeout wrapper — feature-add, not language change | W4 KEEP-PYTHON 5/5; SSE-cluster Rust kill-by-construction |
| W5 orchestration | 4: pydantic-core, ruff blog, go.dev FAQ, Python 3.14 hashlib docs + 1 LOCAL EXPERIMENT (n=100 adapter benchmark) | adapter round-trips at 0.63ms/op — subprocess-per-op viable for coarse ops, never per-event; Python "slowness" dissolves where compute already runs in C via stdlib; the language question is really "where is the hot loop" (here: nowhere) | W5 KEEP-PYTHON 6/6; K1 kill test already run |
| W6 runtime-core | headline lessons (full set in round outward-sources.md) | Rust std::process lacks built-in child timeout — strictly more code under zero-crate; Go os/exec reaches parity but changes only syntax; Python json/regex C-backed so rewrite swaps C for compiled code at equal asymptotic cost; serde typed structs mismatch schema-flexible model output; concurrency features irrelevant at ≤2 threads | W6 STAY-PYTHON 6/6; robfig/cron as best-language footnote |
| W7 TUI | 8: Textual workers guide, ratatui vendor docs, Bubble Tea/tview/Codex TUI (countervailing), JSON Lines spec, push-granular-work guidance | Textual workers/`call_from_thread` are the core competency for event glue; ratatui admits "little to no help in organizing large applications"; countervailing native-TUI frameworks recorded honestly — do not outweigh 80+ module coupling; JSONL per-line parse + terminal sentinel is the streaming contract; vendor guidance: push granular speed-sensitive work to subcomponents only when measured | W7 KEEP-PYTHON 4/4; the 8-point adapter surface (adopted as the rubric's interop-contract restatement) |
+50
View File
@@ -0,0 +1,50 @@
# Wave 0 close-out report — language-rebasing tranche R1
Branch: `tranche-r1-wave-0` · Date: 2026-09-29
## 1. Inventory (docs/rebase/rebase-inventory.json)
- 177 Python modules, ~52,750 lines, 227 classes
- TRUE unit count: **1,852 = 1,030 top-level functions + 822 class methods**
- Zero duplicate call edges, zero method leaks (generator double-walk defect
root-caused and fixed in scripts/rebase_inventory.py)
- Cross-verified against an independent fresh AST walk: zero missing units;
six inventory-"extras" are real nested/if-try-block classes the naive walk
misses (inventory is MORE complete, not less)
## 2. Issue factory (scripts/rebase_issue_factory.py)
- One issue per unit following R1 §7; wave-batched (2–7); dedup-safe via
deterministic title `[rebase w{wave}] {relpath}::{unit}` + existing-titles
scan per run (retries never duplicate — preserve-first)
- `plan` → {2: 239, 3: 251, 4: 129, 5: 544, 6: 415, 7: 274} = 1,852,
zero unassigned
- `sample --wave 5` → full §7 template holds; `_compute_hash` exactly once as
labelled callee with line number
- Contract fix during Wave 0: `--limit` default changed 5 → 0 (unlimited) for
`create`; `sample` keeps its 5. A full-wave create with the old default
would have silently truncated each wave to five issues.
## 3. Interop proof unit (R1 §5)
- Rust unit at interop/rebase-proof/ (std-only, zero crates): argv in → JSON
on stdout, non-zero exit on failure, mandatory `--version`
- Shell-proven: version flag, JSON out, exit 2 on failure, stderr diagnostic
- Python thin adapter shared/native_units.py: typed NativeResult, timeout +
stderr capture, unit failures as data (never exceptions)
- Adapter contract fix during Wave 0: `ok` no longer requires a JSON
`ok:true` field — plain-text output (`--version`) succeeds on exit code
- tests/test_native_interop_proof.py: **8 passed** — version contract, sum
happy path, hash determinism, failure paths, timeout, stderr capture
## 4. Per-wave issue creation
<!-- FILLED BY THE COMPLETION LOOP — do not hand-edit -->
- Wave 4 (129 units): created=127 skipped(dedup)=2 (includes smoke #417–418)
- Wave 2 (239 units): created=239 skipped(dedup)=0
- Wave 3 (251 units): created=251 skipped(dedup)=0
- Wave 5 (544 units): created=544 skipped(dedup)=0
- Wave 6 (415 units): created=415 skipped(dedup)=0
- Wave 7 (274 units): created=274 skipped(dedup)=0
- TOTAL: 1,850 created + 2 dedup = 1,852 / 1,852 ✅ full coverage
File diff suppressed because it is too large. Load diff
+12
View File
@@ -0,0 +1,12 @@
{
"units_per_wave": {
"2": 239,
"3": 251,
"4": 129,
"5": 544,
"6": 415,
"7": 274
},
"unassigned_modules": {},
"unassigned_module_count": 0
}
+26
View File
@@ -75,3 +75,29 @@ And the role-separation rules: the black-box test author (fresh context) has
already written the spec tests; the reviewer checks the implementation
against tests it did not write; vacuity spot-checks (one manual mutant per
load-bearing branch) are BLOCKER-grade findings when tests survive them.
## Dimensional review rubric (#129 — mandatory for P0/P1)
Holistic judgment ("is this good?") is replaced by per-dimension
forced-choice scoring. Every review dispatch MUST score each dimension
explicitly — a review missing any dimension is INCOMPLETE and bounces.
| Dimension | What to score | Verdicts |
|---|---|---|
| Correctness | Does the code do what the issue/spec requires? Verify call sites, not claims. | PASS / CONCERN / FAIL |
| Design | Does the shape fit the codebase (parity laws, authority maps, no second authorities)? | PASS / CONCERN / FAIL |
| Test quality | Do the tests prove the behavior (real-path, oracle-derived, would fail without the fix)? | PASS / CONCERN / FAIL |
| Observability | Are failures visible (logged, journaled, gated) rather than silent? | PASS / CONCERN / FAIL |
| Security | Approval boundaries, secret handling, injection surfaces — anything that widens trust? | PASS / CONCERN / FAIL |
Example (the required output shape):
```
Correctness: PASS (36 call sites verified).
Design: PASS with concern (registry singleton).
Test quality: CONCERN (no real-path test).
Observability: PASS.
Security: PASS.
```
Five explicit verdicts the controller acts on dimensionally — a CONCERN
or FAIL in any dimension blocks the gate until discharged or explicitly
accepted with a reason.
+60
View File
@@ -0,0 +1,60 @@
# SUPERSESSION REPORT — programmatic evidence
_Created 2026-10-07. Question: is curator superseded by memory_consolidation? Can supersession be determined programmatically?_
## Answer in one paragraph
No — they are NOT supersessions of each other. They are two different machines in one pipeline: **memory_consolidation compresses what already exists** (warm neurons, graph entities, abstraction facts → consolidated knowledge records), while **curator gates what gets written** (evidence → worthiness filter → graded routing → tiers). Both are wired into sleep_time's nightly run: consolidation runs in-process, curator runs as a subprocess. The real finding is darker: **curator has NEVER successfully run in production** — three of its four dependencies were never ported from the Odysseus branch, so every invocation died at import. Both diagnoses were reached programmatically.
## The programmatic supersession test (reusable)
Six signals, each binary and evidence-based (`/tmp/ss_engine.py`, promote to scripts/):
| Signal | Test | Weight |
|---|---|---|
| R1 Import graph | production importers vs canary-only importers | high |
| R2 Subprocess summon | module executed as a script by another module | high |
| R3 Output artifacts | documented output files exist with recent mtimes | high |
| R4 Function overlap | name overlap with the suspected successor | low (weak signal) |
| R5 Importability | `import X` succeeds (phantom dep = dead) | gate — fails = dead regardless |
| R6 End-to-end probe | documented entry path executes with real input | decisive |
## Applied to curator vs memory_consolidation
| Signal | curator | memory_consolidation |
|---|---|---|
| R1 | 0 production importers | 2 (memory_selector, sleep_time) |
| R2 | summoned as script by sleep_time + dependency_tracker | summoned by dependency_tracker |
| R3 | **index/blocks_meta.json DOES NOT EXIST — no journal files — never wrote output** | graph.sqlite exists but **stale (Aug 22)**; consolidation/*.json never created |
| R4 | 2% overlap — different function sets (confirms: different jobs) | 2% |
| R5 | importable NOW (after repair); dead since #314 | importable |
| R6 | dry-run probe NOW green (post-repair); was JSONDecodeError-crash | consolidate() wired, but its outputs absent too |
## Verdict
1. **NOT a supersession.** 2% function overlap + different roles: curator = write-path gate (worthiness → grade → tier), memory_consolidation = read-path compressor (existing memories → knowledge records). One writes, one compresses. Both belong.
2. **Both are broken in production.** Curator never ran (phantom deps). memory_consolidation's outputs are stale/absent — its last graph write was Aug 22. The whole sleep-time memory pipeline has been quietly degraded.
3. **Disposition: REPAIR, not retire.** grading.py + worthiness.py are now recovered from the Odysseus source branch (provenance, not reconstruction) with frozen tests; curator's dry-run executes end-to-end. Remaining phantom for curator: lexicon_evolution (guarded — degrades), aaak (guarded — optional compression). Both degradable, not blocking.
## The phantom-import census (the general finding)
16 phantom imports found across src/rune. The important ones:
| Module | Importers | Guarded? | Disposition |
|---|---|---|---|
| worthiness | curator | NO (hard crash) | ✅ RECOVERED from Odysseus + frozen tests |
| grading | curator | NO | ✅ RECOVERED from Odysseus + frozen tests |
| lexicon_evolution | curator | yes (degrades) | recover-or-rename decision needed |
| aaak | curator, memory_store, warm_router | yes | optional compression; recover or accept degrade |
| build_pipeline_policy | prompt_sync | NO | phantom — prompt_sync is dead on arrival |
| gitea_auth | forge | NO | forge.py dead; is forge itself superseded? |
| faster_whisper, pynput | voicebox | yes | optional deps — correct as-is |
| research_lens | claim_audit | yes | lives in ~/.config/opencode/scripts — cross-repo dep |
| ep_loader | 5 modules | false positive | resolves via sys.path hack to src/rust/ |
| autonomy_loop, cognitive_loop, dream_cycle | rune_tui | yes | TUI plugins — recover or retire |
| commitments, dedupe_policy, local_memory | warm_router, memory_store, sleep_time | yes | recover-or-accept-degrade |
**Hard-crash phantoms mean the owning module is dead code:** prompt_sync, forge, and (until today) curator.
## What the dictonomy rebase inherits
The Go/Rust port queue should SKIP dead code until its disposition is decided. A module that never ran has no behavioral parity to prove — porting it would faithfully reproduce a ghost. The audit instrument now needs an R5 importability column so dead modules are marked before they're counted.
+1
View File
@@ -10,6 +10,7 @@ new surface._
| `rune_tui.py` | The main Textual application — chat pane, work pane, status bar (version label + refresh), footer, dialogs | The known giant (file-size debt tracked in henxels); composition root for all UI |
| `tui_validator.py` | Import-allowlist validation for TUI code | Drift defect tracked in #139 (allowlist vs `__future__`/relative imports) |
| `tui_backlog.py` | Not a surface — the durable TUI Upgrade Backlog ledger (outstanding projection/control work per backend feature) | SCAFFOLD-TRANCHE-007; ledger only, never structural authority |
| `tui_transport.py` | Not a surface — the transport seam for the TUI's operator calls (in-process default / /v1 wire opt-in) | H4 slice 1 (contract BUILDER-2026-10-04T10:32:00Z-cli); RUNE_TUI_TRANSPORT selects; coverage: canary_tui_transport.py |
## Adding a TUI surface
+1
View File
@@ -0,0 +1 @@
1.27.1
+39 -2
View File
@@ -1,7 +1,31 @@
settings:
warn_about_similar_files:
above: 0.85
ignore: ["docs/review-lessons.yaml", "docs/v1/**", "docs/wiki/**", "store/spine/**"]
ignore: ["docs/review-lessons.yaml", "docs/v1/**", "docs/wiki/**", "store/spine/**",
# shared/ is the DEPLOYED-VINTAGE mirror tree (strangler era):
# every src/rune <-> shared similarity here is intentional
# (the shim delegates to the crate; the mirror is the deployed
# vintage it strangles). Registering the deliberate pairs.
"shared/**",
"src/rune/drift_core.py", "src/rune/drift_compression.py",
"src/rune/drift_observability.py", "src/rune/shard_manager.py",
"src/rune/subconscious_pass.py",
# deliberate mirror pairs outside the strangler set:
# issue templates are mirrored into shared/issue_templates;
# completion_file.py is the bridge/daemon mirror of scripts/;
# interop/rebase-proof is a committed proof fixture.
".gitea/ISSUE_TEMPLATE/**", "shared/issue_templates/**",
"bridge/daemon/completion_file.py", "scripts/completion_file.py",
"interop/rebase-proof/**",
# per-crate copies by zero-dep design: each crate is
# self-contained (no shared crate dependency), so the pyjson
# JSON module is copied verbatim per crate and the tiny
# zero-dep lockfiles are near-identical by construction.
"src/rust/*/Cargo.lock", "src/rust/*/src/pyjson.rs",
"src/rust/query_memory/src/json_min.rs",
# store/scaffold is data (proof fixtures, gate objects),
# same class as the already-ignored store/spine.
"store/scaffold/**"]
henxels:
- henxel: "Canaries live at the repo's canary slot and are registered in CI"
@@ -20,7 +44,7 @@ henxels:
- henxel: "Top-level docs are markdown or yaml references"
in: ./docs/*
allowed_filetypes: [.md, .yaml]
except: ["./docs/v1/**", "./docs/wiki/**", "./docs/gitea_issue_reconciliation.json"]
except: ["./docs/v1/**", "./docs/wiki/**", "./docs/gitea_issue_reconciliation.json", "./docs/rebase/**"]
- henxel: "The known giant stays visible — file-size debt is tracked, not silent"
in: ./src/rune/*
@@ -70,6 +94,19 @@ henxels:
in: ./src/rune/*.py
new_rune_modules_have_canary_or_test_coverage: true
- henxel: "Rust crate files stay under a line budget"
in: ./src/rust/*/src/*.rs
except: ["./src/rust/*/src/pyjson.rs", "./src/rust/*/src/json_min.rs"]
max_lines: 3000
- henxel: "Go modules stay under a line budget"
in: ./src/go/**/*.go
max_lines: 2000
- henxel: "No secrets in Rust or Go source files"
in: [./src/rust/*/src/*.rs, ./src/go/**/*.go]
no_secrets: true
- henxel: "PRDs are living documents — their generated state sections regenerate identically from governed sources"
changed_with:
+7
View File
@@ -0,0 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "rebase-proof"
version = "0.1.0"
+15
View File
@@ -0,0 +1,15 @@
[package]
name = "rebase-proof"
version = "0.1.0"
edition = "2021"
# Wave 0 interop proof unit (R1 §5). Std-only by design: no crates, no network,
# deterministic build. The pattern under proof is the CLI boundary itself, not the
# computation inside it.
[[bin]]
name = "rebase-proof"
path = "src/main.rs"
[profile.release]
strip = true
+117
View File
@@ -0,0 +1,117 @@
//! Wave 0 interop proof unit (R1 §5 of the language-rebasing tranche).
//!
//! Contract under proof:
//! - standalone binary; argv in, JSON on stdout
//! - non-zero exit on failure (JSON error object still printed to stdout)
//! - `--version` flag mandatory
//! - Python wraps it in a thin adapter (`shared/native_units.py`); tests call
//! it the same way.
//!
//! Ops: sum / echo / hash (fnv1a64) / sleep / fail. All std-only.
use std::env;
use std::process::exit;
use std::thread;
use std::time::Duration;
const VERSION: &str = env!("CARGO_PKG_VERSION");
/// FNV-1a 64-bit — dependency-free deterministic hash for the proof unit.
fn fnv1a64(data: &[u8]) -> u64 {
let mut hash: u64 = 0xcbf29ce484222325;
for byte in data {
hash ^= u64::from(*byte);
hash = hash.wrapping_mul(0x100000001b3);
}
hash
}
fn print_json(line: &str) {
println!("{line}");
}
fn emit_ok(body: &str) {
print_json(&format!("{{\"ok\":true,{body}}}"));
exit(0);
}
fn emit_err(message: &str) -> ! {
// Escape the minimal set so the JSON stays parseable for arbitrary op names.
let escaped: String = message
.chars()
.map(|c| match c {
'"' => "\\\"".to_string(),
'\\' => "\\\\".to_string(),
'\n' => "\\n".to_string(),
'\r' => "\\r".to_string(),
'\t' => "\\t".to_string(),
other => other.to_string(),
})
.collect();
print_json(&format!("{{\"ok\":false,\"error\":\"{escaped}\"}}"));
exit(2);
}
fn main() {
let args: Vec<String> = env::args().skip(1).collect();
if args.as_slice() == ["--version"] || args.as_slice() == ["-V"] {
println!("rebase-proof {VERSION}");
exit(0);
}
if args.is_empty() {
eprintln!("usage: rebase-proof <op> [args...] | --version");
emit_err("no op given");
}
let op = args[0].as_str();
let rest = &args[1..];
match op {
"sum" => {
let mut total: i128 = 0;
for a in rest {
match a.parse::<i128>() {
Ok(v) => total += v,
Err(_) => emit_err(&format!("sum: not an integer: {a}")),
}
}
emit_ok(&format!("\"op\":\"sum\",\"result\":{total}"));
}
"echo" => {
let joined = rest.join(" ");
let escaped: String = joined
.chars()
.map(|c| match c {
'"' => "\\\"".to_string(),
'\\' => "\\\\".to_string(),
'\n' => "\\n".to_string(),
'\r' => "\\r".to_string(),
'\t' => "\\t".to_string(),
other => other.to_string(),
})
.collect();
emit_ok(&format!("\"op\":\"echo\",\"text\":\"{escaped}\""));
}
"hash" => {
let joined = rest.join(" ");
let h = fnv1a64(joined.as_bytes());
emit_ok(&format!("\"op\":\"hash\",\"fnv1a64\":\"{h:016x}\""));
}
"sleep" => {
let ms: u64 = match rest.first().map(|s| s.parse::<u64>()) {
Some(Ok(v)) => v,
_ => emit_err("sleep: expected milliseconds"),
};
thread::sleep(Duration::from_millis(ms));
emit_ok(&format!("\"op\":\"sleep\",\"slept_ms\":{ms}"));
}
"fail" => {
// Deliberate failure: stderr diagnostic + JSON error + exit 2.
// Proves stderr capture and non-zero exit in the adapter.
eprintln!("rebase-proof: deliberate failure for adapter proof");
emit_err("deliberate failure");
}
other => emit_err(&format!("unknown op: {other}")),
}
}
+2 -2
View File
@@ -1,4 +1,4 @@
{
"BLE001": 347,
"S110": 75
"BLE001": 47,
"S110": 31
}
+401 -1
View File
@@ -1 +1,401 @@
[]
[
{
"name": "read_file",
"description": "Read a file with optional windowed viewing (offset/limit). Returns numbered lines. Use offset/limit for large files (100 lines at a time).",
"capabilities": [
"read_file"
],
"file": "tool_executor.py",
"full_path": "",
"priority": 100,
"semantic_examples": [],
"risk": "read-only",
"preconditions": [
"path exists and is a readable file"
],
"side_effects": [],
"auto_invoked": false,
"hooks": [],
"native_tool": true,
"searchable_text": "read_file read a file with optional windowed viewing (offset/limit). returns numbered lines. use offset/limit for large files (100 lines at a time). native tool"
},
{
"name": "edit_file",
"description": "Surgical search/replace edit. More reliable than full file rewrites. The search string must match exactly.",
"capabilities": [
"edit_file"
],
"file": "tool_executor.py",
"full_path": "",
"priority": 100,
"semantic_examples": [],
"risk": "write",
"preconditions": [
"path is inside an allowed write directory",
"search string matches exactly once"
],
"side_effects": [
"rewrites the target file atomically after approval",
"creates a .bak backup under ~/.rune/undo"
],
"auto_invoked": false,
"hooks": [],
"native_tool": true,
"searchable_text": "edit_file surgical search/replace edit. more reliable than full file rewrites. the search string must match exactly. native tool"
},
{
"name": "write_file",
"description": "Write content to a file. Creates parent directories if needed. Shows diff before writing. Use for new files or full rewrites.",
"capabilities": [
"write_file"
],
"file": "tool_executor.py",
"full_path": "",
"priority": 100,
"semantic_examples": [],
"risk": "write",
"preconditions": [
"path is inside an allowed write directory"
],
"side_effects": [
"writes the full file content atomically after approval",
"creates a .bak backup under ~/.rune/undo"
],
"auto_invoked": false,
"hooks": [],
"native_tool": true,
"searchable_text": "write_file write content to a file. creates parent directories if needed. shows diff before writing. use for new files or full rewrites. native tool"
},
{
"name": "glob_files",
"description": "Find files matching a glob pattern. Returns file paths sorted by modification time.",
"capabilities": [
"glob_files"
],
"file": "tool_executor.py",
"full_path": "",
"priority": 100,
"semantic_examples": [],
"risk": "read-only",
"preconditions": [
"search directory is readable"
],
"side_effects": [],
"auto_invoked": false,
"hooks": [],
"native_tool": true,
"searchable_text": "glob_files find files matching a glob pattern. returns file paths sorted by modification time. native tool"
},
{
"name": "grep_files",
"description": "Search for a pattern in files. Returns file paths and line numbers. Use include to filter by file type.",
"capabilities": [
"grep_files"
],
"file": "tool_executor.py",
"full_path": "",
"priority": 100,
"semantic_examples": [],
"risk": "read-only",
"preconditions": [
"search directory is readable"
],
"side_effects": [],
"auto_invoked": false,
"hooks": [],
"native_tool": true,
"searchable_text": "grep_files search for a pattern in files. returns file paths and line numbers. use include to filter by file type. native tool"
},
{
"name": "list_directory",
"description": "List files and directories at a path. Returns names with / suffix for directories.",
"capabilities": [
"list_directory"
],
"file": "tool_executor.py",
"full_path": "",
"priority": 100,
"semantic_examples": [],
"risk": "read-only",
"preconditions": [
"path is a readable directory"
],
"side_effects": [],
"auto_invoked": false,
"hooks": [],
"native_tool": true,
"searchable_text": "list_directory list files and directories at a path. returns names with / suffix for directories. native tool"
},
{
"name": "lint_file",
"description": "Lint a file for syntax errors and style issues. Blocks bad edits. Supports Python (ruff), JS/TS (eslint), Go (golangci-lint), and more.",
"capabilities": [
"lint_file"
],
"file": "tool_executor.py",
"full_path": "",
"priority": 100,
"semantic_examples": [],
"risk": "read-only",
"preconditions": [
"file exists",
"a linter is configured for the language"
],
"side_effects": [],
"auto_invoked": false,
"hooks": [],
"native_tool": true,
"searchable_text": "lint_file lint a file for syntax errors and style issues. blocks bad edits. supports python (ruff), js/ts (eslint), go (golangci-lint), and more. native tool"
},
{
"name": "run_tests",
"description": "Run tests for a file or project. Auto-detects test runner from language.",
"capabilities": [
"run_tests"
],
"file": "tool_executor.py",
"full_path": "",
"priority": 100,
"semantic_examples": [],
"risk": "write",
"preconditions": [
"a test runner is configured for the project"
],
"side_effects": [
"runs project test commands which may create or delete files"
],
"auto_invoked": false,
"hooks": [],
"native_tool": true,
"searchable_text": "run_tests run tests for a file or project. auto-detects test runner from language. native tool"
},
{
"name": "format_code",
"description": "Auto-format code files. Supports Python (black/ruff), JS/TS (prettier), Go (gofmt), and more.",
"capabilities": [
"format_code"
],
"file": "tool_executor.py",
"full_path": "",
"priority": 100,
"semantic_examples": [],
"risk": "write",
"preconditions": [
"path is inside an allowed write directory",
"a formatter is configured for the language"
],
"side_effects": [
"rewrites files in place to the formatter's style"
],
"auto_invoked": false,
"hooks": [],
"native_tool": true,
"searchable_text": "format_code auto-format code files. supports python (black/ruff), js/ts (prettier), go (gofmt), and more. native tool"
},
{
"name": "git_diff",
"description": "Show git diff for staged or unstaged changes.",
"capabilities": [
"git_diff"
],
"file": "tool_executor.py",
"full_path": "",
"priority": 100,
"semantic_examples": [],
"risk": "read-only",
"preconditions": [
"working directory is a git repository"
],
"side_effects": [],
"auto_invoked": false,
"hooks": [],
"native_tool": true,
"searchable_text": "git_diff show git diff for staged or unstaged changes. native tool"
},
{
"name": "git_log",
"description": "Show recent git commits.",
"capabilities": [
"git_log"
],
"file": "tool_executor.py",
"full_path": "",
"priority": 100,
"semantic_examples": [],
"risk": "read-only",
"preconditions": [
"working directory is a git repository"
],
"side_effects": [],
"auto_invoked": false,
"hooks": [],
"native_tool": true,
"searchable_text": "git_log show recent git commits. native tool"
},
{
"name": "git_commit",
"description": "Commit changes with a message. Auto-stages modified files.",
"capabilities": [
"git_commit"
],
"file": "tool_executor.py",
"full_path": "",
"priority": 100,
"semantic_examples": [],
"risk": "irreversible",
"preconditions": [
"working directory is a git repository",
"there are changes to commit"
],
"side_effects": [
"creates a commit on the current branch"
],
"auto_invoked": false,
"hooks": [],
"native_tool": true,
"searchable_text": "git_commit commit changes with a message. auto-stages modified files. native tool"
},
{
"name": "repo_map",
"description": "Generate an AST-based codebase map showing key symbols (classes, functions, imports). Uses tree-sitter for 100+ languages.",
"capabilities": [
"repo_map"
],
"file": "tool_executor.py",
"full_path": "",
"priority": 100,
"semantic_examples": [],
"risk": "read-only",
"preconditions": [
"target directory is readable"
],
"side_effects": [],
"auto_invoked": false,
"hooks": [],
"native_tool": true,
"searchable_text": "repo_map generate an ast-based codebase map showing key symbols (classes, functions, imports). uses tree-sitter for 100+ languages. native tool"
},
{
"name": "run_command",
"description": "Run an approved command. Prefer argv (shell=False); shell syntax requires shell=true and explicit user approval.",
"capabilities": [
"run_command"
],
"file": "tool_executor.py",
"full_path": "",
"priority": 100,
"semantic_examples": [],
"risk": "irreversible",
"preconditions": [
"operator approves the command",
"required binaries are on PATH"
],
"side_effects": [
"executes arbitrary commands with their full side effects"
],
"auto_invoked": false,
"hooks": [],
"native_tool": true,
"searchable_text": "run_command run an approved command. prefer argv (shell=false); shell syntax requires shell=true and explicit user approval. native tool"
},
{
"name": "read_persona",
"description": "Read Rune's persona definition. Returns the full persona block with voice, identity, and rules.",
"capabilities": [
"read_persona"
],
"file": "tool_executor.py",
"full_path": "",
"priority": 100,
"semantic_examples": [],
"risk": "read-only",
"preconditions": [
"persona MEMORY.md exists"
],
"side_effects": [],
"auto_invoked": false,
"hooks": [],
"native_tool": true,
"searchable_text": "read_persona read rune's persona definition. returns the full persona block with voice, identity, and rules. native tool"
},
{
"name": "query_memory",
"description": "Query Rune's memory store. Returns relevant memories for a query.",
"capabilities": [
"query_memory"
],
"file": "tool_executor.py",
"full_path": "",
"priority": 100,
"semantic_examples": [],
"risk": "read-only",
"preconditions": [
"memory store database is available"
],
"side_effects": [],
"auto_invoked": false,
"hooks": [],
"native_tool": true,
"searchable_text": "query_memory query rune's memory store. returns relevant memories for a query. native tool"
},
{
"name": "check_growth",
"description": "Check Rune's growth log. Returns recent growth entries and patterns.",
"capabilities": [
"check_growth"
],
"file": "tool_executor.py",
"full_path": "",
"priority": 100,
"semantic_examples": [],
"risk": "read-only",
"preconditions": [
"growth log file exists"
],
"side_effects": [],
"auto_invoked": false,
"hooks": [],
"native_tool": true,
"searchable_text": "check_growth check rune's growth log. returns recent growth entries and patterns. native tool"
},
{
"name": "diagnose_behavior",
"description": "Diagnose Rune's current behavior. Returns analysis of persona adherence, voice consistency, and drift.",
"capabilities": [
"diagnose_behavior"
],
"file": "tool_executor.py",
"full_path": "",
"priority": 100,
"semantic_examples": [],
"risk": "read-only",
"preconditions": [
"recent response text provided"
],
"side_effects": [],
"auto_invoked": false,
"hooks": [],
"native_tool": true,
"searchable_text": "diagnose_behavior diagnose rune's current behavior. returns analysis of persona adherence, voice consistency, and drift. native tool"
},
{
"name": "find_capability",
"description": "Search all installed capabilities for what you need. Returns matching tool names with descriptions and argument schemas. Use this when a capability you need is not in your current tool set; the matched tool becomes callable in the same session.",
"capabilities": [
"find_capability"
],
"file": "tool_executor.py",
"full_path": "",
"priority": 100,
"semantic_examples": [],
"risk": "read-only",
"preconditions": [
"a capability query describing the needed outcome"
],
"side_effects": [],
"auto_invoked": false,
"hooks": [],
"native_tool": true,
"searchable_text": "find_capability search all installed capabilities for what you need. returns matching tool names with descriptions and argument schemas. use this when a capability you need is not in your current tool set; the matched tool becomes callable in the same session. native tool"
}
]
+38886 -15
View File
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,48 @@
# Phase G slice 1 — retrieval-index authority supersession ledger
**Date:** 2026-10-02 · **Branch:** `phase-g-strangler-retrieval-index` · **Unit issue:** conductor/rune#2448
## What was superseded
The pure-Python `query_memory` implementation (formerly `src/rune/query_memory.py`,
deployed at `~/.config/opencode/scripts/query_memory.py`) is RETIRED as a production
implementation. Production authority now rests with:
1. **Implementation:** Rust crate `src/rust/query_memory/` (lib.rs core + cdylib, ten
`extern "C"` FFI symbols, zero external crates).
2. **Production service surface:** `shared/query_memory.py` — a ctypes-backed shim
(179 lines) over `qm_loader.py`, byte-deployed to `~/.config/opencode/scripts/query_memory.py`,
serving the FULL prior Python class API including the `self.history` snapshot.
## Strangler doctrine (master doc lines 685–770) — step discharge
| Step | Requirement | Evidence |
|------|-------------|----------|
| 1–4 | candidate built, contract frozen, parity proven | commits `9b76585`+`54d2db9`; `/tmp/phaseG_retrieval_index_contract.md` frozen; parity harness ALL GREEN |
| 5 | qualification | `/tmp/phaseG_qual_bench.out` (Rust CLI ~45× faster end-to-end); canaries both sides |
| 6 | canaries conformance | Python canary 12/12; Rust canary 27/27 |
| 7 | shadow comparison vs live store | `/tmp/phaseG_shadow.py` 46/46 exact-equal vs 77-record production store |
| 8 | authority switch + observed consumer evidence | commit `6f44a87`; both consumers verified live — `memory_store.py` (lines 820–821, live 76-record store, nested stats shape) + `growth_simulator.py` (record_query through Rust core); #2448 comment id 33795 |
| 9 | runtime evidence post-switch | post-switch verification wall ALL GREEN: Python canary 12/12, FFI smoke 41/41, Rust canary 27/27, parity harness ALL GREEN |
| 10 | old production path unreachable | ALL import paths (`import query_memory`) now resolve to the deployed shim; `shared/graph_shard_bridge.py` tolerant import serves the shim; the orphan `src/rune/query_memory.py` had ZERO importers (verified by sweep incl. path-string references) |
| 11 | old implementation removed or reference-only | `src/rune/query_memory.py` DELETED (this commit); the only stale reference (`scripts/structural_coverage_audit.py` registry mapping shared/ as a mirror of src/rune) corrected — query_memory removed from `SRC_A`/`SHARED_D`, added to `SHARED_B` (canonical, ops-harness owned) |
| 12 | supersession ledger | THIS FILE |
Deletion discipline (language-governance rule ⑥) satisfied: old code removed only after
the new implementation was PROVEN — wall green, shadow 46/46, both production consumers
observed live on the Rust core before deletion.
## Consumer map at supersession
- `~/.config/opencode/scripts/memory_store.py` — in-process, `adaptive_exploration_rate` (line 820).
- `~/.config/opencode/scripts/growth_simulator.py` — in-process, `record_query`.
- `shared/graph_shard_bridge.py` — tolerant import (try/except), follows the switch.
- `src/rune/tool_executor.py` — NOT a consumer (nominal grep hit only; goes through `memory_store.cached_recall`).
## Verification commands (reproducible)
- `/home/nick/.venvs/memory/bin/python3 src/rune/canary_query_memory.py` → 12/12
- `/home/nick/.venvs/memory/bin/python3 src/rust/query_memory/canary_rust.py` → 27/27
- `/home/nick/.venvs/memory/bin/python3 src/rune/ffi_query_memory_smoke.py` → 41/41
- `/home/nick/.venvs/memory/bin/python3 /tmp/phaseG_parity.py` → ALL GREEN
- `/home/nick/.venvs/memory/bin/python3 scripts/structural_coverage_audit.py` → exit 0, coverage 100%
@@ -0,0 +1,66 @@
# Phase G Slice 2 — FROZEN CONTRACT: evidence-provenance (T7.3)
Frozen: 2026-10-03, session ses_ffe5f08a7892affeGzZWhhm0wR. Branch `phase-g-strangler-evidence-provenance` (cut from slice-1 head `2ac2d0a`). Gitea issue #2449. Nothing below may change without a recorded amendment in this file.
## 1. Scope (observed, not inferred)
Six modules in `src/rune/`, 1796 lines total, one test file each as marked:
| Module | Lines | Surface (grep-verified 2026-10-03) |
|---|---|---|
| `audit_ledger.py` | 231 | `_compute_hash(prev_hash, entry)`, `append_entry(entry_type, entry_id, details)`, `verify_chain() -> {valid, entries, reason}`, `get_entries(limit=50)`, `log_promotion(entry_id, old_status, new_status, wash_count, reason)`, `log_gate_result(entry_id, verdict, critics)`, `log_drift_alert(alert_type, message, severity)`, `main()` |
| `behavior.py` | 411 | `connect()`, `add_correction(original, corrected, scope_tags=None, domain="", pattern="")`, `add_habit(trigger, action, name="", context_tags=None, min_activations=3)`, `match_context(context, match_type=None)`, `reinforce(item_id, outcome, item_type="habit")`, `list_items(item_type="all", limit=20)`, `behavior_stats()`, `main()`, `PLUGIN` dict |
| `behaviour_ledger.py` | 251 | 9 state constants (UNVALIDATED…NOT_APPLICABLE) + `STATES` + `CONFIRMED_STATES` tuples, `BehaviourLedger` class |
| `claim_audit.py` | 430 | `PATTERNS` list, `EVIDENCE_TAG` regex, `LEDGER_MARKERS`, `reframe(text)`, `scan(text)`, `verify(claim)`, `degrade(claim, verdict)`, `journal(entry)`, `report()`, `audit(draft)`, `handle_hook(event, data=None)`, `main()`, `PLUGIN` |
| `evidence_probe.py` | 214 | `PROBE_STATUSES`, `PROBE_FIELDS`, `MAX_PROBES_PER_TASK=2`, `ProbeBudgetExceeded`, `ProbeResult`, `build_probe_prompt(question, artifact_path)`, `validate_probe(artifact)`, `count_probes(artifact_dir)`, `check_budget(artifact_dir)`, `record_probe(result, artifact_dir)`, `run_probe(question, artifact_dir, runner=None, model="UNKNOWN")` |
| `verification_layer.py` | 259 | `VerificationResult`, seven `verify_*` functions (exit_code, unit_test, schema, file_exists, file_changed, tool_receipt, constraint_check), `verify(result, verifier_type)`, `handle_hook`, `PLUGIN` |
Plus `shared/audit_ledger.py` (210 ln) — OLDER vintage of audit_ledger.
## 2. Authority decisions (per module)
- **src/rune/ is the authority vintage for all six modules** — hardened newer code (memory_env-pathed storage, defensive handling). The deployed `~/.config/opencode/scripts/{audit_ledger,behavior,claim_audit}.py` copies are OLDER vintages (hardcoded expanduser paths). The authority switch is a VINTAGE UPGRADE plus a language swap — not a mirror replacement.
- `shared/audit_ledger.py` is superseded alongside the deployed copy (same older vintage, same defects).
## 3. Live-data contract (the linchpin — observed)
- **Live ledger:** `/home/nick/.config/opencode/memory/promotion_ledger.jsonl` (21 entries). `verify_chain()` under the deployed module's own defaults returns `{'valid': True, 'entries': 21, 'reason': 'chain intact'}` — OBSERVED 2026-10-03.
- **Live signing key: `rune-drift-integrity-2024`** (the deployed/shared default). The src/rune default `rune-governed-adaptation-2024` FAILS the live chain — it is a latent break, recorded as a defect this slice fixes.
- **Hash scheme (both vintages identical):** `HMAC-SHA256(key, (prev_hash + json.dumps(entry_without_hash, sort_keys=True)).encode()).hexdigest()`; genesis prev_hash = `"genesis"`; entry lines written with `json.dumps(entry)` in insertion order (type, entry_id, details, timestamp, prev_hash, hash); timestamp = `datetime.now(timezone.utc).isoformat()`.
- **Key rule for the Rust candidate:** read `AUDIT_LEDGER_KEY` env; DEFAULT = `rune-drift-integrity-2024` (the key that verifies the live chain). Never default to the governed key — it verifies nothing that exists.
- **Live `behavior.db`:** SQLite at memory_env memory dir, touched Sep 24 — must remain readable by the Rust candidate's storage layer.
## 4. Rust candidate design
Crate `/mnt/workdrive/rune/src/rust/evidence_provenance/` following the proven slice-1 shape: zero-dep core in `lib.rs`, `cdylib` FFI exports, hand-rolled JSON serialization where byte-parity demands it. **Port order within the slice** (dependency + risk order):
1. **audit_ledger** — linchpin: live data, external consumers, key contract.
2. **verification_layer** — pure logic, no storage, one test file; fastest port.
3. **evidence_probe** — file-based budget/records; `rune_operator.py:581` consumer.
4. **behaviour_ledger** — state machine, src/rune-only.
5. **behavior** — SQLite habits; live DB; deployed vintage upgrade + `rune_tui.py` consumer.
6. **claim_audit** — heaviest (warm-neuron store + graph DB + regex engine); last.
Python-side ctypes loaders (`*_loader.py`) + deployed shims per slice-1 pattern, so every consumer keeps its import surface unchanged.
## 5. Parity + qualification criteria
- **Byte-parity:** Rust `verify_chain` output byte-identical to Python's on the live ledger AND on a mutation battery (tampered entry, broken chain, invalid JSON, empty ledger). Parity harness both sides, slice-1 pattern.
- **Canaries:** Python-side canary module per ported module + Rust canary; both green before any switch.
- **Shadow:** shadow-compare Rust vs Python on live-shaped data before authority switch.
- **Performance:** like-for-like benchmark on the real consumption shape; no regression (Nick's law: combination does not decrease speed).
## 6. Consumers + adoption plan (Nick's directive: adoption during the refactor)
| Consumer | Imports | Switch |
|---|---|---|
| `~/.config/opencode/scripts/curator.py` | audit_ledger | at audit_ledger switch |
| `canary_tui_drift.py`, `canary_full_system.py` | audit_ledger | at audit_ledger switch |
| `rune_tui.py` (L62, L83) | claim_audit, behavior | at each module's switch |
| `rune_operator.py:581` | evidence_probe (relative) | at evidence_probe switch |
Deployed copies become ctypes shims at each module's authority switch (vintage upgrade included — the shim serves the src/rune contract, not the old vintage's). Old deployed Python deletions follow language-governance ⑥: only after the new is proven.
## 7. Exit criteria
All twelve doctrine steps discharged per module-port with observed evidence on #2449; coverage-audit registry remapped; supersession ledger written; audit regression gate green.
@@ -0,0 +1,62 @@
# Phase G slice 2 — evidence-provenance authority supersession ledger
**Date:** 2026-10-03 · **Branch:** `phase-g-strangler-evidence-provenance` · **Unit issue:** conductor/rune#2449
## What was superseded
The pure-Python evidence-provenance implementations (six modules in `src/rune/`, 1796 lines; plus the two OLD deployed vintages and `shared/audit_ledger.py`) are RETIRED as production implementations for their ported surfaces. Production authority now rests with:
1. **Rust crate `src/rust/evidence_provenance/`** — six cores: `lib.rs` (audit_ledger chain + FFI), `verification.rs` (7 verifiers), `probe.rs` (schema gate + budget), `behaviour.rs` (state machine), `habitmath.rs` (reinforce math), `claims.rs` (claim-audit decision skeleton); cdylib FFI (`ep_*` symbols, 21 total), zero external crates.
2. **Python shims** at `src/rune/{audit_ledger,verification_layer,evidence_probe,behaviour_ledger,behavior,claim_audit}.py` — serving the src/rune authority contract through `ep_loader.py` (in-process, no interpreter startup for the ported logic).
3. **Deployed shims** at `~/.config/opencode/scripts/{audit_ledger,behavior,claim_audit}.py` — same shape; audit_ledger + claim_audit + behavior carry the LIVE data-path rules (drift-key ledger, live behavior.db, real journal); claim_audit additionally carries the preserved SYMMETRY GUARD (deployed-vintage feature) and the repaired `scan_text()` TUI surface.
## Port ledger (all six, in contract §4 order)
| Port | Module | Rust core | Parity | Commit | Consumer proof |
|------|--------|-----------|--------|--------|----------------|
| 1 | audit_ledger | lib.rs chain ops | shadow 18/18; canaries 28/28+23/23 | `114c394`+`4b0d1d2` | live ledger entries 4242 (post-switch write), verify 23-intact |
| 2 | verification_layer | verification.rs | 33/33 (7 verifiers + CLI render) | `9cb93e6` | contracts.py, canary_native, rune_operator:323 dataclass |
| 3 | evidence_probe | probe.rs | 24/24 + consumer tests 23/23 | `3450a1c` | rune_operator:581/603, research_stage_executor:312 |
| 4 | behaviour_ledger | behaviour.rs | 13/13 full-scenario | `8973caa` | testing_mode:19, iteration:23, rune_tui:3152 |
| 5 | behavior | habitmath.rs | 16/16 + full-stack live-db | `2732677` | rune_tui:83; deployed vintage upgraded (live db read-verified) |
| 6 | claim_audit | claims.rs | 17/17 + real-journal aggregate (1127 rows) | `969e39f` | rune_tui:62/2468/3752, contracts.py, hook_engine:270 |
Errors: byte-equal (duplicate/unknown-behaviour/unknown-state; probe schema-gate lists incl. Python repr rendering; CLI argparse shapes + exit codes).
## Strangler doctrine (master doc lines 685–770) — step discharge (slice level)
| Step | Requirement | Evidence |
|------|-------------|----------|
| 1–4 | candidate built, contract frozen, parity proven | commits `114c394` → `969e39f`; frozen contract `plans/2026-10-03-phase-g-evidence-provenance-contract.md` (commit `7c68e41`); per-port parity harnesses ALL GREEN |
| 5 | qualification | per-port parity + decision-math batteries; canary pair per port (Python 74/74, Rust 66/66 — all six port sections accumulated); performance follows the slice-1 in-process shape (no interpreter startup; same cdylib) |
| 6 | canaries conformance | canary_audit_ledger.py 74/74; canary_evidence_provenance_rust.py 66/66 (per-port sections for ALL six ports; dual-mode LIVE/ISOLATED for live-ledger pins — run 18141 repair); embedded tests through shims (verification test, 23 consumer tests) |
| 7 | shadow comparison vs live-shaped data | port-1 shadow 18/18 vs `939883d:shared/audit_ledger.py` (banked at `114c394`); ports 2–6 use direct byte-parity batteries vs the live originals (same discipline, stronger: full-document byte-quality) |
| 8 | authority switch + observed consumer evidence | shims deployed + live-verified per port: entry 4242 (first post-switch ledger write), live behavior.db read through the port-5 shim, real 1127-row journal through the port-6 aggregation, TUI backend trio imports, TUI scan_text FIRST-EVER live call |
| 9 | runtime evidence post-switch | post-switch walls per port: parity round-trips, embedded tests, consumer chains (rune.behaviour_ledger / rune.evidence_probe / rune.claim_audit + deployed trio) — all GREEN |
| 10 | old production path unreachable | `import audit_ledger` (deployed consumers) → shim; `rune.behaviour_ledger` / `rune.evidence_probe` / `rune.claim_audit` / `rune.verification_layer` → shims; `shared/audit_ledger.py` had ZERO importers (verified by sweep incl. path-string forms) — DELETED |
| 11 | old implementation removed or reference-only | `shared/audit_ledger.py` DELETED (this commit, after the proven wall + zero-importer sweep); six src/rune modules remain as shims (the API contract); original Python lives in git history. Coverage registry remapped: `audit_ledger` removed from SHARED_D; gate exit 0 post-deletion |
| 12 | supersession ledger | THIS FILE |
Deletion discipline (language-governance rule ⑥): `shared/audit_ledger.py` removed only after (a) the deployed shim proved live against the real ledger, (b) the shadow wall was green, (c) a zero-importer sweep across src/ shared/ scripts/ tests/. The remaining five src/rune originals were rewritten AS shims in their own commits (git history holds each original); they are the API contract and stay.
## Vintage-merge disclosures
- **SYMMETRY GUARD preserved:** the deployed `claim_audit` vintage carried `research_lens.symmetry_check` integration (2026-08-15) absent from src/rune — preserved in both shims (feature-preserving merge; load-bearing behavior).
- **DEAD CONSUMER REPAIRED:** `rune_tui.py:3752` `claim_audit.scan_text()` had NO implementation in either vintage (silent try/except death) — now implemented, first-class, live-verified.
- **Sequence break (port 1):** the audit_ledger shim was deployed BEFORE its canary pair existed; both canaries subsequently written and green — disclosed on #2449 comment 33817, not retrofitted.
## Consumer map at supersession
- `~/.config/opencode/scripts/rune_tui.py` — claim_audit (report L2468, scan_text L3752), behaviour (L3152), behavior (L83).
- `src/rune/rune_operator.py` — evidence_probe (L581/603), VerificationResult dataclass (L323).
- `src/rune/contracts.py` — dynamic `__import__` surfaces (verification_layer, claim_audit).
- `src/rune/testing_mode.py:19` / `src/rune/iteration.py:23` — behaviour_ledger constants + class.
- `scripts/research_stage_executor.py:312` — evidence_probe orchestration.
- `~/.config/opencode/scripts/curator.py` / `canary_full_system.py` — audit_ledger (deployed shim).
- `src/rune/dependency_tracker.py` — map-strings only (NOT an import).
## Live-data rules (contract §3) — honored in the shims
- Live promotion ledger: drift key verified 23-intact through the shim + FFI; explicit `AUDIT_LEDGER_KEY` override honored.
- Live behavior.db: read/written through the deployed shim at `~/.config/opencode/memory/behavior.db`; parity scenarios ran on temp dirs only.
- Live claim_audit journal (1127 rows): read-only aggregate through the Rust core; writes stay Python.
@@ -0,0 +1,97 @@
# Phase H plan — Go front end / Rust back end (Nick's architecture directive)
Status: PLAN (awaiting Nick's sign-off before any code)
Directive: USER-LOCKED (2026-10-04). Supersedes the KEEP-PYTHON verdicts in
docs/rebase-language-rubric.md wherever they conflict.
## 1. The directive
Go owns the front end: runtime entry points, the first-call surface, the
user-facing interface and its calls. Rust owns the back end: every core
logic module. Python survives only as transitional glue inside a module
until its own Go/Rust surface lands.
## 2. What "front end" means concretely here
From the runtime-audit memory (2026-09-10): the live entry chain is
rune_tui -> send_task -> ContextBroker -> ModelRouter -> local/Cloud
transports. The user-facing calls are: the TUI process itself, the CLI
entry (python -m rune / rune binary), the operator message path, and the
OpenAI-compatible /v1 endpoints MiMoCode serves.
Candidates for the Go first-call layer, in dependency order:
- rune binary (process entry, arg parsing, process lifecycle) — replaces
the Python module-loading bootstrap.
- CLI/IPC command dispatch — the first-call surface that routes a user
command to the right back-end service.
- The OpenAI-compatible HTTP endpoint surface (/v1 chat completions) —
stdlib net/http + NDJSON streaming is exactly the area the rubric called
Go's only capability-proven fit (W4 evidence, unchanged by the directive).
- TUI: NOT in the first Go surface. Textual coupling is deep (80+ modules
per the rubric); the front-end Go layer first exposes the API the TUI
consumes, and the TUI itself migrates later as its own wave.
## 3. What "back end" means concretely here
All pure-logic modules move into the two existing zero-dep crates
(evidence_provenance, query_memory) or a third crate for the remaining
domains. The zero-external-crate discipline stands (the rubric's W4 Rust
kill-rule for network code stays valid INSIDE Rust crates: no network code
in crates, that belongs to the Go layer).
Back-end candidates not yet ported (pure logic, no external deps):
- drift_core, drift_cache, drift_compression (scored math) — memory umbrella
- warm_neuron_store/warm_router scoring paths — memory umbrella
- memory_store consolidation/scoring helpers — memory umbrella
- capability_fit/capability_broker scoring — capability umbrella
- tokenizer/counting helpers in token_optimizer — inference umbrella
Each port follows the slice-2 pipeline: contract, zero-dep Rust, byte-parity
battery vs the Python vintage, dual-mode canary, consumer import chain,
CI green, supersession ledger.
## 4. Sequencing (per wave, each independently mergeable)
H0 — enablement (no behavior change):
- Install Go on the host + the runner user's PATH; pin a version in
requirements-ci-equivalent (a go-version file + CI check).
- CI: add a Go build+vet+test job (empty module, exits 0) so the pipeline
carries Go before any code lands.
H1 — Go first-call shim:
- Go binary `rune` replacing the Python entrypoint's process bootstrap:
arg parsing, env resolution, spawn the Python runtime (transitional).
- Canary: same first-call contract (exit codes, env handoff, TTY attach).
H2 — Go command dispatch + /v1 endpoint:
- Go serves /v1 chat completions + CLI dispatch, calling the Python core
through the same local transport the TUI uses today.
- Parity battery: request/response shapes vs the Python server for the
same canned conversations (byte-level for metadata, streaming NDJSON).
H3 — back-end wave (parallel to H1/H2 where independent):
- Ports listed in section 3, one or two modules per slice, same slice-2
discipline. No port starts without its parity battery written first.
H4 — TUI migration wave (its own contract, later):
- Only after H1-H2 prove the Go front end serves the same surfaces the TUI
consumes. The TUI is the largest single module (4k+ lines, Textual) and
earns its own contract.
## 5. Honest constraints (carried from the rubric, not contradicted)
- Go must be installed first (rubric D5 gate: it failed this before; the
directive now outweighs the gate but installation is still step zero).
- Network/streaming code lives in the Go layer, never in Rust crates
(rubric W4: stdlib-only Rust has no credible HTTP/SSE precedent).
- SQLite/regex/file-IO stay at their current language boundaries per the
zero-dep split law from slice 2 (math Rust, IO at the edges).
- Every surface gets the same proof pipeline as slice 2: observed-not-
invented expectations, byte parity, dual-mode canary, CI green.
## 6. Success measure
The tranche is complete when: the `rune` process starts as a Go binary;
user-facing calls (CLI, /v1, operator path) are served by Go; every core
logic module on the port list is byte-parity Rust; Python remains only in
surfaces explicitly contracted as keep-Python (TUI internals until H4,
test harness, canary frameworks).
+285
View File
@@ -0,0 +1,285 @@
# TOTAL REBASE TRANCHE — Rune to Go/Rust (R2)
**Status:** DESIGN — awaiting Nick's approval gate (TRANCHE-DEPTH TEMPLATE §4)
**Supersedes:** the KEEP-PYTHON rubric verdicts (already superseded by Nick's
Go-front/Rust-back directive) and extends Phase H (H0–H4 slice 1, merged
`693a494`, v0.90.0) from first ports to total rebase.
**Nick's directives (verbatim anchors):**
- "i want the whole codebase rebased in rust and go"
- "everything should initiate with go as the runtime, and reactive adaptable
runtime should be go"
- "the deterministic backend i.e memory storage, architectures and elastic
cognition and everything like that should be in rust"
- "go should be the reactive front end to what interfaces with the user —
not gui — the deliverables and chat interactions as well as how rune
handles thoughts and runtime"
- "the zero dependency rule should be in place but the rebase should rebuild
those aspects into the new architecture and make them operational"
- "the textual tui should be last but everything should be wired into the
textual tui"
- "start with the scaffolding first as everything relies on that, then use
the new rust scaffolding to make sure everything else is built towards
scaffold protocol"
- "the scaffolding function should be a rust execution but go start"
## 1. Grounding summary (measured 2026-10-04, from the spine store + wc)
- 161 modules with source, **64,482 lines** of `src/rune/` Python.
- Draft classification (rule-based, to be function-level verified in Wave 0):
- **RUST (deterministic backend):** 49 modules, 26,772 lines — memory,
drift, warm, capability, token, spine, scaffold, construction_*,
structural_store, curator, consolidation, elastic cognition, ledgers,
audit, evidence, contracts, sleep_time, subconscious, persona_gate,
context_broker, growth.
- **GO (reactive runtime + user-facing):** 10 modules, 7,043 lines —
operator, transports, dispatch, provider registry, adaptive router,
hook engine, local tool runtime, work manager, deploy_qualify.
- **TUI-last:** 4 modules, 4,889 lines — rune_tui (4,041), tui_validator,
tui_backlog, tui_transport.
- **UNCLASSIFIED (Wave 0 must disposition each with evidence):** 73
modules, 21,473 lines — voice_*, tool_executor, model_routing/registry,
event_bus, cron_engine, message_queue, identity_anchors, pins,
stage_guards, tier_manager, witness, etc.
- **Test infra:** 23 canary/test modules, 4,211 lines — rewritten per wave
(Rust canaries port with their surface; Go canaries for the front).
- **Retires:** `__init__`, `__main__`, `memory_env` (bootstrap glue —
subsumed by the Go runtime's env contract).
- Existing Rust (merged, production-proven): 6 zero-dep crates
(query_memory, evidence_provenance, rune_spine, memory_scoring,
capability_scoring, token_counting), 338k bytes, all with parity
batteries. Go: rune-entry (H1 shim + H2 /v1 front door).
- Stragglers from R1 folded in: #2171, #2119 (TUI), #1844 (salience_gate),
#1755 (goal._load), #1738 (failure_auto_filer).
## 2. Objective
Every line of rune's Python runtime is rebased into the dichotomy —
**Go initiates and reacts; Rust determines and stores** — with the
scaffolding protocol rebuilt FIRST (Go start / Rust execution) so every
subsequent conversion is driven, checked, and closed by the new protocol
itself. Python is deleted only after the replacement is parity-proven and
CI-green (strangler exit law). The Textual TUI is last and stays the
integration surface: everything wires into it over the transport seam.
## 3. The hard constraint analysis (zero-dep + total rebase — feasibility)
Nick asked: confirm or deny. **Confirmed possible**, amended per his
critiques (2026-10-04):
- **Hybridized membrane, not a wall (Nick's correction):** Go remains the
reactive initiator, but "Rust never touches a socket" is WITHDRAWN as an
absolute. The languages interoperate where coherence demands: Rust cores
callable from Go (the proven cdylib pattern), Go surfaces invocable from
Rust through defined channels, shared wire protocols. The dichotomy is
the DEFAULT placement rule; hybrid junctions are deliberate, contracted
exceptions — each recorded in the unit's contract.
- **SQLite STAYS (Nick's ruling):** no bespoke storage engine in this
tranche. SQLite remains and is wired into the new architecture — the
Rust side reaches it through system-library FFI (legal under zero-dep:
a system library is not a crate dependency). The bespoke memory-system
redesign is a LATER, separate program.
- **Reactivity/async:** Go goroutines + channels own the event loops;
Rust's deterministic cores stay synchronous behind the membrane.
- **Regex:** hand-rolled matchers per case (proven: pyjson, word-run
scanner, run-collapse). No general regex engine needed.
- **Parity-plus-improvement (Nick's upgrade):** parity is the FLOOR, not
the ceiling. Every unit answers "parity OR measurably better" —
efficiency improvements are in scope per function (Rust zero-copy and
exactness, Go goroutine-native concurrency), bloat from bad syntax is
removed, and functionality is the non-negotiable gate. Improvements
carry measurements; the parity battery proves no behavior regression
either way.
- **TUI wiring is continuous (Nick's correction):** each landed surface
wires toward the Textual TUI over the transport seam as part of its
unit contract — the final TUI wave integrates a system already aimed
at it, not a retrofit.
- **Language intelligence in the protocol (Nick's addition):** the
scaffolding gains a first-class placement decision — for rune, the
Go/Rust dichotomy rule (reactive/initiating → Go; deterministic/
stateful → Rust); for other projects, a language-fit assessment at
construction-classification time (the protocol recommends the right
language for the task's characteristics).
- **Provenance lock (Nick's verification):** the scaffolding being ported
in Wave 1 is the V1-ACCEPTED system per docs/SCAFFOLDING_V1_DEFINITION.md
(T18 §18B; North Star = Nick's verbatim words; 17/17 acceptance gates).
The Wave 1 parity replay against the production contract ledger proves
the rebuild is that design, not a drift.
## 4. Wave structure (each wave independently mergeable, scaffolding-gated)
### Wave 0 — Grounding + inventory verification (the template's bar)
- Function-level mapping of all 161 modules (the spine gives structure;
wave 0 verifies 100% of functions and classifies the 73 UNCLASSIFIED
with evidence).
- Disposition the 5 R1 stragglers.
- Produce the per-unit issue factory input: one issue per function,
each answering improve/fix/missing-connectors with evidence.
- Deliverable: `plans/total-rebase-inventory.md` + issues filed.
- Exit gate: inventory signed off by Nick (the approval gate).
### Wave 1 — The scaffolding engine reborn (Go start / Rust execution)
**Everything depends on this — it goes first, per Nick's directive.**
- The rebuild target is the V1-ACCEPTED system (Nick's design —
docs/SCAFFOLDING_V1_DEFINITION.md, North Star verbatim, 17/17
acceptance gates). The parity replay against the production contract
ledger is the proof the rebuild IS that design.
- Rust crate `scaffold_core`: the construction machinery as pure
deterministic logic — contract lifecycle (draft→approved→building→
verifying→closed), closure classification (correctly_predicted et al.),
scope resolution, legal transitions, the contract store.
Source modules: scaffold.py, construction_interface.py,
construction_decision.py, construction_intent.py, structural_store.py
(parts not already in rune_spine), contracts.py, toolchain.py.
- Go surface `rune-scaffold` (extends rune-entry): the initiation layer —
submit-need/observe/transition/close CLI + /v1 endpoints, delegating to
the Rust core.
- NEW per Nick: the **language-placement decision** lands in the protocol
here — construction classification gains a language-fit assessment
(rune: the Go/Rust dichotomy rule; other projects: characteristic-based
recommendation). Every later contract carries its placement verdict.
- NEW per Nick: parity is the floor — the engine itself is the first
beneficiary of the parity-plus-improvement rule (measured improvements
allowed, functionality preserved, no-regression proven).
- Exit gate: the R2 tranche's own remaining waves are driven THROUGH the
new engine (the protocol builds itself under its own rules).
### Wave 2 — Memory/storage backend (Rust, SQLite retained)
- SQLite is NOT replaced (Nick's ruling). The Rust memory core reaches it
via system-library FFI (zero-dep legal); memory_store.py (2,435 lines)
is decomposed: query paths and consolidation logic into Rust, the SQLite
mechanics behind a thin storage trait that maps to libsqlite3 today and
to the future bespoke engine LATER without consumer churn.
- elastic_cognition, memory_consolidation, sleep_time, curator,
subconscious_pass, drift_* (remaining DB-backed surfaces), journal,
recall_* (recall_router is routing → boundary checked at Wave 0
disposition).
- Data safety gate: checksum-verified read-back of the live store through
the new engine; zero writes until the read path is proven identical.
### Wave 3 — Cognition + architecture engines (Rust)
- The remaining deterministic cores: capability_broker decision logic,
context_broker, persona_gate, growth, identity_anchors, pins,
stage_guards, tier_manager, witness, safety_override, abstraction,
verification surfaces.
- Ports already merged (memory_scoring, capability_scoring,
token_counting, rune_spine) are verified against the new scaffold
protocol and wired into the final architecture.
### Wave 4 — The reactive runtime (Go)
- The operator turn loop (rune_operator.py, 2,697 lines), chat
interactions, deliverables production, model routing at call time
(adaptive_router, model_registry/profiles/routing, provider_*),
tool execution (tool_executor, tool_protocol, local_tool_runtime),
event surfaces (event_bus, message_queue, cron_engine, hook_engine),
voice output chain (voice_*) as deliverable production.
- The /v1 surface deepens to carry the full interaction contract;
NDJSON streaming becomes the standard response shape.
### Wave 5 — Python retirement sweep
- Every Python module whose surfaces have landed is deleted (strangler
exit: parity proven + CI green + deployed one cycle). Shared/ vintage
mirrors retired with them.
- The glue shims (ms_loader, cs_loader, tc_loader, spine_loader) retire
when their consumers no longer speak Python at all.
### Wave 6 — TUI last (but wired continuously)
- Every wave before this one ships its transport-seam wiring toward the
TUI as part of each unit's contract (Nick's correction: natural,
continuous wiring — not a retrofit wave).
- Then the TUI itself: a thin Textual render shell over the wire (all
logic already Go/Rust by then) or a port — disposition decided on the
evidence of everything that came before.
### Wave 7 — Final audit
- Language-bar measurement, the full scaffolding ledger replayed, the
tranche's closure report with per-wave evidence.
## 5. Per-unit discipline (the template, unchanged)
- One issue per function via the issue factory; each answers
improve/fix/missing-connectors with evidence.
- Every unit runs the scaffolding pipeline end-to-end: submit-need →
contract → approval → canary-first (red proven) → implementation →
parity battery vs the Python vintage → closure audit (structural ids,
never file paths — the closure vocabulary law).
- Per-unit decisions on evidence, never pre-decided globally: each
function's Go-vs-Rust placement is assessed by the dichotomy rule with
the measured call graph, not by the draft classification alone.
- Bug-fix contract governs every defect found en route (red test first,
regression frozen).
## 6. Verification gates
- CI green per wave (crate builds, Go vet/test/build, canaries, henxels,
type ratchet until the Python ratchet itself retires in Wave 5).
- Parity batteries are byte-level for deterministic surfaces, shape-level
modulo volatile fields for wire surfaces.
- The scaffolding closure audit for every contract: correctly_predicted
or honestly flagged, never silent.
- Deploy qualification per merge (the pipeline that proved itself today).
### The 90/100 coverage law (Nick, 2026-10-05 — GOVERNING from W3.4 on)
Per Nick: "if it's realistically achievable but aim higher also if that's
realistically achievable. go to 100% where achievable."
- **100% where achievable — the deterministic Rust kernels.** Every kernel
crate (memory_retrieval, cognition_core, scaffold_core, memory_storage,
and every future crate) targets 100% BRANCH coverage via its parity
matrices + the pytest shim battery: every branch has real reachable
semantics, and exhaustive enumeration is exactly what the batteries do.
Achievability is measured per crate at wave close; a kernel below 100%
carries the named unreachable case or it isn't done.
- **≥90% on the changed-lines bar (diff-cover), aiming higher.** The floor
stays a floor; the working standard per slice is 90%+ on changed lines;
whatever a slice achieves beyond 90 becomes the next slice's personal
benchmark (per-unit "aim higher" — the number climbs wave over wave).
The floor ratchet itself moves after consecutive clean waves
(70 → 76 → 84 → 90; each raise is a commit, never a step down).
- **Glue/failure branches: 90%+ with byte-compare proofs.** The stubs and
probe branches that only fire in a broken world are covered by honest
fixtures (real import-failure probes like the from-import resolution
law) — never by fake-triggered pragmas. A branch covered by a lying
fixture is WORSE than uncovered; if it can't be honestly reached, it's
named in the wave's closure report with the reason.
- **Assertion quality is part of the bar.** A test that touches a line
without verifying its OUTPUT doesn't count toward the bar — byte-compare
/ exact-value asserts are the standard; "is not None" assertions reject
at review.
## 7. Risk register
- **SQLite FFI correctness** (Wave 2) — the storage layer is retained but
re-wired; mitigations: read-path proven identical before any write,
checksum-verified read-back of the live store, the storage trait
boundary keeps the future bespoke swap cheap.
- **Hybrid membrane drift** — junctions multiply ad-hoc if ungoverned;
every Go↔Rust interaction point is a contracted, recorded decision in
its unit's contract (the dichotomy is the default; hybrids justify
themselves per unit).
- **Improvement regressions** — parity-plus-improvement invites subtle
behavior changes; every improvement carries a measurement AND the parity
battery stays authoritative for no-regression.
- **Go↔Rust call latency** — measure in Wave 1; the architecture assumes
local transport cost is negligible vs model latency; if measured wrong,
the membrane's transport moves (decision recorded, not improvised).
- **Context-window economics** — 1,852-style issue volumes mean the
pipeline must multiplex (no-wait law) and local models carry routine
units (custodian pattern).
- **Scope creep during Wave 0** — the inventory is measured and frozen
before design; additions go through scope amendments.
## 8. Rollback
- Every wave merges independently; master stays deployable at each
boundary (the strangler's whole point).
- The Python vintage remains until Wave 5 deletion gates pass; a wave
revert = revert the merge commit (deploy qualification re-runs).
- The scaffolding engine's Wave 1 parity replay means even the protocol's
own replacement is reversible against recorded history.
## 9. Approval gate
This tranche does not execute until Nick approves. On approval, Wave 0
starts immediately and runs without consent blockers (standing directive),
with self-verified checkpoints and defect filing.
@@ -0,0 +1,354 @@
# TRANCHE v3: THE FULL DICHOTOMY REBASE — with HOW, with language advantages, with automated verification
Nick's corrections applied:
- Umbrella manifest feeds the spine (not superseded); both need updating
- construction_decision.py itself gets ported (Go start + Rust execution)
- Language advantages are part of every port — improvements where the target language is better
- Automated parity verification BEFORE gutting the Python (hard gate, no manual checking)
- A testing document that proves bigger features work after each wave
- Maximise Bubble Tea addons (research the ecosystem)
- No arbitrary timeframe — it gets done when it gets done
- Every task follows on to the next — never stopping
- CI stacking: keep submitting PRs; address CI issues in batches of 5, not individually
---
## THE CORE MECHANISM: How every module gets replaced
Every module follows the same seven-step process. No exceptions. The process IS the verification.
### Step 1: Understand the Python module
Read every function. Identify: what does it compute (→ Rust), what does it initiate (→ Go), what does it store (→ Rust), what does it route (→ Go). Note every caller. Note every file it reads/writes.
### Step 2: Write the replacement in the target language
For Rust: a `pub fn` in the appropriate crate, with serde-compatible structs.
For Go: a method on a struct in the appropriate `src/go/<name>/` package.
**Language advantage check**: at this step, ask "does Go/Rust do this BETTER than Python did?" If yes, implement the improvement. Examples: Go goroutines replace Python threading for parallel operations. Rust's zero-cost abstractions replace Python duck typing for hot-path scoring. Go's `net/http` replaces Python `urllib` for model connections with connection pooling and keep-alive.
### Step 3: Write the parity test (RED first)
Before touching the Python module, write a test that runs the same input through BOTH the Python oracle and the new Go/Rust implementation, and asserts the outputs are identical. This test must FAIL before the implementation is correct, and PASS once it is. The test is the gate.
### Step 4: Verify parity — the HARD GATE
Run the parity test. If it passes, the replacement is PROVEN to work. Only now can you proceed to Step 5. If it fails, debug the Go/Rust implementation until it passes. **Do not gut the Python until this gate passes.** This is automated — you never have to manually check.
### Step 5: Rewire the Python module as a delegation shim
Replace the Python function body with a call to the Go binary (subprocess) or the Rust kernel (ctypes/cgo). Every existing caller of the Python module keeps working — they don't know the implementation changed.
### Step 6: Register the canary in CI
The parity test from Step 3 is registered in `.gitea/workflows/ci.yml`. Now every future commit is checked against the parity contract automatically.
### Step 7: PR → CI → merge
Push the branch, let CI run. If CI raises issues, DON'T STOP — continue to the next module's port. Address CI issues in batches of 5. The pipeline is proven; it catches things; you fix them in batches.
**The key insight**: Step 4 (the parity gate) is the answer to "how do you confirm replacements working before you gut it?" You don't gut anything until the automated test proves the replacement produces identical output. The test is the contract.
---
## THE TESTING DOCUMENT: proving bigger features after each wave
After each wave completes, a WAVE VERIFICATION DOCUMENT is produced that proves the system works end-to-end. Not unit tests — integration tests.
### What it contains:
1. **The operator turn loop works**: send a message through the Go operator, get a response back, verify the response is correct
2. **Memory operations work**: store a memory, recall it, verify the content matches
3. **Tool execution works**: execute a tool call, verify the output
4. **The TUI renders**: launch the Bubble Tea TUI, verify it displays
5. **The event journal works**: emit an event, read it back
6. **The scaffolding works**: submit a need, verify the contract is created
### How it's generated — BY THE GITEA PIPELINE, not by the agent:
A shell script (`scripts/wave_verify.sh`) is written by the agent. A CI workflow step runs the script after each wave merge. The CI step formats the results as markdown and posts them as a comment on the wave's Gitea epic. The document is permanent — attached to the epic, survives session restarts, reproducible (the commands are in the document), automated (CI runs it, not the agent).
### Implementation:
- `scripts/wave_verify.sh` — the integration verification script
- A CI workflow step (in ci.yml or a new `wave-verify.yml`) that runs the script and posts results to the Gitea epic using the existing GITEA_TOKEN secret
- The same mechanism the merge-robot already uses for PR comments
### What "done" means for a wave:
The wave's Gitea epic has a verification comment showing every integration path PASSING. The agent does not produce testing documents — the pipeline does.
### What "done" means for a wave:
Not just "the code compiles" — the wave verification document shows every integration path working.
---
## WAVE 0: INFRASTRUCTURE (before any porting)
### 0.1 Henxels scope extension
Open `henxels.yaml`. Add scopes for `src/rust/*/src/*.rs` and `src/go/**/*.go`. Same quality gates: max_lines, no_secrets, canary registration, coverage existence. Without this, new Go/Rust files have no governance.
### 0.2 Umbrella manifest extension
The umbrella manifest IS the spine's input for non-module surfaces. Extend it:
- Add the 10 existing Rust crates as `rust_crates` entries
- Add the 2 existing Go modules as `go_surfaces` entries
- Add placeholder entries for the planned Go modules
- Every new Go/Rust file gets tracked, so the spine knows about it
### 0.3 Scaffolding protocol update (construction_decision.py port)
`construction_decision.py` is itself a Python file. Port it:
- **Go start call**: the CLI surface that receives the classification request
- **Rust execution**: the deterministic classification logic (keyword matching, language placement)
- The GO_SIGNALS and RUST_SIGNALS keyword lists are updated to match the corrected dichotomy
- The Python version becomes a delegation shim
- After this port, `rune scaffold classify` routes through Go→Rust, not Python
### 0.4 CI pipeline update
- Build every Rust crate in the unit-tests job
- Build every Go module in a new `go-build` job
- Set CC_RUST_LIB, SC_RUST_LIB, etc. to the CARGO_TARGET_DIR paths
- Add `go vet` and `go test ./...` steps
### 0.5 Gitea epic + MiMoCode tasks
- Post the parent epic on Gitea: the full wave structure as a folded checklist
- Post per-wave sub-epics
- Mirror in MiMoCode's task tool
- Every subsequent task updates both
---
## WAVE 4: GO REACTIVE INFRASTRUCTURE (14 modules)
### event_bus (244 lines) — DONE
Already built as `src/go/event-bus/`. Reads/writes the same events.jsonl.
### event_envelope (303 lines)
Merge into event-bus. The EventEnvelope struct already exists in Go. Add the OrchestrationRecord methods (to_dict, from_dict) as MarshalJSON/UnmarshalJSON. Add the content_hash function.
### message_queue (10KB)
**What it does**: holds approved messages until they're executed. The Python version uses a JSONL file with a mutex.
**Go advantage**: Go channels are designed for this. Use a buffered channel for in-memory queue + a JSONL file for durability. The Go version is concurrent-safe by construction.
**HOW**: Create `src/go/message-queue/`. Define `type Message struct` with the same fields as the Python version. Implement `Enqueue`, `Dequeue`, `GetApproved`, `MarkExecuted`. The Python module becomes a subprocess shim.
**Parity test**: enqueue 10 messages in Python, read them in Go, verify identical.
### hook_engine (28KB)
**What it does**: loads plugin hooks from a config, fires them on events.
**Go advantage**: goroutines enable parallel hook dispatch (Python's GIL prevents this).
**HOW**: Create `src/go/hook-engine/`. `type HookEngine struct { hooks map[string][]HookFunc; mu sync.RWMutex }`. `Fire(name, data)` iterates hooks sequentially; `FireAsync` dispatches each hook in a goroutine and collects errors via channels.
**Language advantage**: parallel hook dispatch — Python can't do this due to the GIL.
### microkernel (14KB)
**What it does**: the plugin lifecycle — register, activate, dispatch.
**Go advantage**: Go interfaces replace Python duck typing with compile-time guarantees.
**HOW**: `type Plugin interface { Name() string; Capabilities() []string; OnMessage(data) error }`. Registry with `Register(p Plugin)`, `Fire(event, data)`. The hook_engine plugs into this.
### subsystem_health (6KB)
**What it does**: tracks failures per subsystem, escalates tiers.
**HOW**: `type SubsystemHealth struct { failures map[string][]Failure }`. RecordFailure, GetHealth. Write to JSON for durability.
### parallel_processor (5KB)
**What it does**: runs operations in parallel.
**Go advantage**: goroutines + sync.WaitGroup. This is what Go was BORN for.
**HOW**: `func ParallelMap[T, R any](items []T, fn func(T) R) []R`. Launch goroutines, collect via channels.
### work_manager (20KB)
**What it does**: manages work dispatch to builders.
**HOW**: Go worker pool with `chan Task`. `type WorkManager struct { workers int; queue chan Task; results chan TaskResult }`. Start, Submit, Stop.
### failure_auto_filer (21KB)
**What it does**: auto-files failures to the forge.
**HOW**: Go struct with spool file + forge client. Same pattern as the existing forge_client.
### cache (16KB) + connection_pool (3KB)
**What they do**: cache responses, pool connections.
**Go advantage**: Go's `sync.Map` and channel-based pools are built for this.
**HOW**: `src/go/cache/` — LRU cache with `sync.RWMutex`. `src/go/connection-pool/` — channel-based pool.
### cron_engine (14KB) + night_mode (14KB)
**What they do**: scheduled tasks, night consolidation.
**Go advantage**: `time.Ticker` + goroutines replace Python's threading.Timer.
**HOW**: `src/go/cron-engine/` — task list with cron expressions. `src/go/night-mode/` — uses the cron engine for scheduled consolidation.
### recall_router (5KB)
**What it does**: routes recall queries to the right memory backend.
**HOW**: `src/go/recall-router/` — routing table with `map[string]RecallFn`.
---
## WAVE 4b: GO TOOL EXECUTION (3 modules)
### tool_executor (73KB) — STARTED
The Go binary already handles read_file, list_directory, glob_files, grep_files, run_command. Add the remaining operations: write_file (with path validation), edit_file (with diff preview), run_tests, lint_file, git_commit, git_diff, git_log, repo_map, and the query/diagnose operations.
**Language advantage**: Go's `os/exec` with `context.Context` for timeouts is cleaner than Python's `subprocess.run(timeout=)`. Go's goroutines enable parallel tool execution (Python serialises them).
### tool_protocol (16KB)
Go types: `ToolRequest`, `ToolEvent`. Validation against a schema registry. The approval boundary stays in the Go operator (not Python).
### local_tool_runtime (35KB)
The Go loop: receive model response → parse tool calls → validate → dispatch to executor → feed results back. `type LocalToolRuntime struct { transport Transport; tools []ToolDef; maxIterations int }`. This is the loop that makes Rune respond to tool results.
---
## WAVE 5a: GO MODEL/PROVIDER (10 modules → 1 binary)
All 10 modules collapse into `src/go/model-connect/`.
**Language advantage**: Go's `net/http` with connection pooling and keep-alive replaces Python's `urllib` (which opens a new connection per request). Go's goroutines enable parallel model calls (Python serialises them). Go's `context.Context` enables timeout propagation through the call chain.
### model_connect (16KB)
`type OllamaClient struct { baseURL string; client *http.Client }`. Chat, Show, Pull, ListModels. Use `net/http` with a shared transport for connection reuse.
### model_routing (16KB) + model_registry (6KB) + model_profiles (16KB)
Go router that scores tasks against model capabilities and routes to the right model. One `ModelRouter` struct replaces three Python files.
### provider_budget (12KB)
Go budget tracker with `sync.Mutex`. Record, GetStatus. Token counting per provider.
### provider_registry (23KB) + standardized_providers (9KB) + provider_context (2KB)
Go `Provider` interface with OllamaProvider and CompatProvider implementations. Registry manages connections.
### tiered_executor (9KB)
Go executor with tier escalation. Execute, Escalate.
---
## WAVE 5b: GO OPERATOR (19 modules → 1 binary)
**rune_operator (126KB)** — the turn loop. This is the hardest port.
**How**: break it into sub-systems. Port each one at a time. After each, run the full test suite.
1. The state management (RuneState, TaskStateRepo, ConversationRepo) → Go structs with JSON persistence
2. The turn loop → Go function: `Respond(channel, message) OperatorResponse`
3. The routing → Go AdaptiveRouter
4. The tool dispatch → Go LocalToolRuntime (already ported in Wave 4b)
5. The memory interaction → Go MemoryStore (Wave 5c) + Rust kernels via cgo
6. The model connection → Go ModelConnect (Wave 5a)
**Language advantage**: Go goroutines replace Python threading for parallel context gathering. Go channels replace Python queues. Go's `context.Context` replaces Python's ad-hoc timeout management. The turn loop becomes truly concurrent — memory recall and model inference can overlap.
**The other 18 modules** are supporting cast: adaptive_router (23KB), build_mode (20KB), builder_bridge (12KB), core_server (9KB), auto_context (8KB), auto_tasks (15KB), event_wait (23KB), evidence_probe (7KB), forge (5KB), forge_client (7KB), goal (14KB), growth_delta (16KB), warm_router (55KB), release_notes (18KB), persona_definition (7KB), voicebox (4KB), voice_injector (3KB). Each follows the same pattern: read Python → write Go → parity test → rewire → commit.
---
## WAVE 5c: GO MEMORY OPERATIONS (8 modules)
### memory_store (99KB) — THE BIGGEST SINGLE PORT
**What it does**: every SELECT, INSERT, UPDATE, DELETE against the memory database.
**Go advantage**: `modernc.org/sqlite` is pure Go — no cgo, no C compiler, cross-compiles trivially. Go's `database/sql` interface with prepared statements is cleaner than Python's raw sqlite3.
**HOW**: `type MemoryStore struct { db *sql.DB }`. Every Python function becomes a Go method. The SQL statements ARE the specification.
**Parity test**: same SQLite file, same queries, byte-identical results. Run after every operation.
### curator (70KB)
Scans the store, identifies conflicts, promotes/demotes. Go state machine.
### sleep_time (38KB)
Idle-period consolidation. Go goroutine on a timer.
### memory_consolidation (31KB)
Calls the Rust kernel (already ported). Go handles the I/O.
### The other 4 (persona_gate, abstraction, witness, stage_guards)
Each follows the same pattern.
---
## WAVE 6: RUST BACKEND (85 modules)
Each Python module's pure functions become `pub fn` in the appropriate crate.
**The pattern for each:**
1. Read the Python module, identify pure functions
2. Write the Rust equivalent in the crate
3. Add an FFI symbol
4. Write a parity test
5. The Python module becomes a thin FFI caller
**The rhythm**: most modules are 3-10KB. At that size, a port takes 15-30 minutes once you're in the rhythm. 85 modules at that pace is 2-3 days of focused work.
**Language advantage**: Rust's type system catches bugs at compile time that Python catches at runtime. Rust's `Result<T, E>` replaces Python's try/except for error handling. Rust's pattern matching replaces Python's if/elif chains. Rust's zero-cost abstractions mean the ports are FASTER than the Python originals.
---
## WAVE 7: BUBBLE TEA TUI (Go)
### Maximising the Bubble Tea ecosystem
Research the full Bubble Tea + Lipgloss + Bubbles ecosystem for every available addon:
**Bubble Tea** (the runtime): Elm architecture, goroutine-safe, tea.Tick for animations, tea.Every for recurring updates, tea.WithAltScreen for fullscreen, tea.WithMouseCellMotion for mouse support.
**Lipgloss** (styling): truecolor (16.7M colors), borders (rounded, thick, double, hidden), padding/margin/width/height, alignment, flex layout, gradients, inline styling, copy/blend styles.
**Bubbles** (pre-built components):
- `spinner`: rotating indicators (line, dot, mini-dot, jump, pulse, points, globe, moon, monkey, meter, hamburger, ellipsis)
- `progress`: animated progress bars with gradient colors
- `textinput`: text input with cursor, placeholder, validation
- `textarea`: multi-line text input
- `table`: sortable, selectable data tables
- `list`: filtered, paginated lists
- `viewport`: scrollable content area
- `paginator`: pagination controls
- `key`: key binding documentation
- `help`: help bubble
- `timer`: countdown timer
- `stopwatch`: elapsed time
**Additional libraries in the ecosystem:**
- `glamour`: markdown rendering with syntax highlighting (for chat messages that contain code)
- `harmonica`: spring animation physics (for smooth pane transitions)
- `bubble-lipgloss-extras`: additional styling utilities
**What the current TUI has that maps:**
- Two-column layout (chat LEFT, task RIGHT) → `lipgloss.JoinHorizontal()` with width ratios
- Chat bubbles with sender name, timestamp, content → custom component with `lipgloss.Style{}.Border(lipgloss.RoundedBorder()).Padding(0, 1)`
- Thinking indicator (spinner) → `bubbles/spinner` with the pulse style
- Tool call display → bordered component with syntax highlighting via `glamour`
- Status bar (version, mode, model, project) → fixed bottom bar via `lipgloss.JoinVertical()`
- Command selector with autocomplete → `bubbles/textinput` + custom suggestion loop
- Work pane (operational index) → side panel with `bubbles/list`
- Scrollback → `bubbles/viewport` with `SetContent()` and `GotoBottom()`
- Keybindings → `tea.KeyMap` with `tea.KeyCtrl1`, `tea.KeyCtrl2`, `tea.KeyCtrl3`
- Streaming text → `tea.Cmd` that sends partial string updates
- Growth/status widgets → `bubbles/table` or custom rendering
**Improvements the language enables:**
- True concurrent streaming: the Go operator can push partial results to the TUI via Go channels while the model is still generating — Python can't do this because the GIL serialises everything
- Sub-millisecond rendering: Go's zero-allocation string building means the TUI renders at 60fps without GC pauses
- Statically linked binary: deploy the TUI as a single file, no Python runtime, no virtual environment, no pip install
---
## CI STACKING PROTOCOL
The CI pipeline is proven — 2,300+ tests, 25 canaries, required checks on master. Use it as a throughput engine:
1. Submit PR after PR after PR. Don't wait for one to merge before starting the next.
2. If CI raises an issue, DON'T STOP the current work. Note it, continue.
3. After every 5 PR submissions, go back and address the accumulated CI issues in one batch.
4. The merge-robot and auto-version handle the merging — you keep producing.
5. If a required check fails on master, that's the one thing that stops the conveyor. Fix it immediately.
**The principle**: CI is the quality gate, not the bottleneck. It runs while you work. Issues get batch-fixed. The conveyor keeps moving.
---
## GITEA EPIC STRUCTURE
The FIRST Gitea task: **Epic: "Full Dichotomy Rebase"** containing:
- [ ] Wave 0: Infrastructure (henxels scope, umbrella manifest, scaffolding protocol, CI)
- [ ] Wave 4: Go reactive infrastructure (14 sub-epics)
- [ ] Wave 4b: Go tool execution (3 sub-epics)
- [ ] Wave 5a: Go model/provider (10 sub-epics, folded into 1 binary)
- [ ] Wave 5b: Go operator (19 sub-epics, folded into 1 binary)
- [ ] Wave 5c: Go memory operations (8 sub-epics)
- [ ] Wave 6a: Rust structural core (30 sub-epics)
- [ ] Wave 6b: Rust cognition (30 sub-epics)
- [ ] Wave 6c: Rust remaining (25 sub-epics)
- [ ] Wave 7: Bubble Tea TUI (7 sub-epics)
Each sub-epic contains the HOW instructions (the seven-step process), the language advantage notes, the parity test spec, and the CI registration step.
MiMoCode tasks mirror the same tree.
---
## WHAT I STILL NEED FROM YOU
1. **The cgo pattern** — Go calls Rust `.so` files via cgo. The Rust crates don't change, only the caller changes from Python-ctypes to Go-cgo. Is this the membrane you want?
2. **The Bubble Tea ecosystem** — I've listed every addon above. Do you want any specific visual features beyond what's listed?
3. **The umbrella answer** — the spine relies on umbrellas (umbrellas are the input, spine is the consumer). Both need updating. Is this how you understood it?
4. **The CI stacking** — submit PRs continuously, batch CI fixes every 5 submissions. Does this match what you described?
5. **Approve to start Wave 0** — henxels scope, umbrella manifest, scaffolding protocol, CI update, Gitea epic. This is the foundation everything else builds on.
@@ -0,0 +1,274 @@
# TRANCHE: THE FULL DICHOTOMY REBASE — every Python module replaced
_Presented for operator approval per TRANCHE-TEMPLATE.md §4. Nick's mandate: "go through the whole codebase and replace it with the dichotomy." Measured: 180 Python files, 68,224 lines. Target: 0 Python logic files (TUI stays last per plan, test infra stays as test infra)._
---
## §0 — GROUNDING (measured, not guessed)
### The honest numbers
| Language | Files | Lines | % | Status |
|---|---|---|---|---|
| Python | 180 | 68,224 | 70% | **THE TARGET — every module ported** |
| Rust | 106 | 27,304 | 28% | 10 crates exist, 85 more modules to port |
| Go | 7 | 1,125 | 1% | 2 modules exist, 55 more to port |
| **Total** | **293** | **96,653** | | |
### The corrected dichotomy (re-classified 2026-10-06, 64ba7cf)
| Side | Modules | Python lines to replace | Role |
|---|---|---|---|
| **GO** | 57 | 32,081 | The reactive shell: initiates, responds, routes, interfaces |
| **RUST** | 85 | 25,218 | The deterministic backend: computes, stores, pure functions |
| **TUI** | 7 | 5,435 | Textual UI — last per plan |
| **TEST** | 29 | 5,397 | Test infrastructure — stays as test infra |
### Existing infrastructure (§0.2 — route through what exists)
- **CI pipeline**: `.gitea/workflows/ci.yml` — lint, unit-tests, go-surface, canary, best-practices, documentation, type-check, gitea-offline, required-checks
- **Deploy pipeline**: `.gitea/workflows/deploy.yml` — event-driven CI qualification, stage/verify/promote
- **Scaffolding**: `construction_interface.py` + `src/go/rune-entry/scaffold.go` — every module's port goes through a construction contract
- **Canaries**: 25 registered in CI, each crate has its own parity battery
- **Umbrella manifest**: `config/umbrellas.json` — 165 Python modules tracked (needs Rust/Go extension)
- **Henxels**: `henxels.yaml` — structural contract, line caps, no-secrets, canary registration (needs Rust/Go scope)
- **Gitea**: conductor/rune, required checks on master, merge-robot, auto-version
### Keep-greens (§0.5 — must stay green through every wave)
- Full test suite: 2,300+ tests, 0 failures
- All 25 registered canaries
- diff-cover ≥70% on changed lines
- Silent-handler ratchet (BLE001 ≤345, S110 ≤75)
- Henxels: all hold
- Lint-baseline: no increase
- Deploy: monotonic promotion, runtime verification
---
## §1 — OBJECTIVE
**Every Python module in `src/rune/` is replaced by its Go or Rust equivalent per the dichotomy. The TUI stays Python until Wave 7. Test infrastructure stays Python. The FFI boundary is the membrane between Go and Rust. Zero Python logic files remain (only the TUI shell and test files).**
Measured end-state: `ls src/rune/*.py | wc -l` returns ≤7 (TUI only) + test files. `src/go/` contains the full reactive runtime. `src/rust/` contains the full deterministic backend.
---
## §2 — WAVE STRUCTURE
### Wave 4: The Go reactive infrastructure (14 modules, ~5,271 lines)
The backbone that everything else routes through. These are the modules that make the system *respond*.
| Module | Python lines | Go target | Notes |
|---|---|---|---|
| event_bus | 244 | **DONE** (src/go/event-bus/) | Same events.jsonl, same envelope |
| event_envelope | 303 | src/go/event-bus/ | Envelope type in the same binary |
| message_queue | 10KB | src/go/message-queue/ | Durable queue |
| hook_engine | 28KB | src/go/hook-engine/ | Plugin dispatch |
| microkernel | 14KB | src/go/microkernel/ | Hook lifecycle |
| subsystem_health | 6KB | src/go/subsystem-health/ | Failure tiers |
| parallel_processor | 5KB | src/go/parallel-processor/ | Goroutines |
| work_manager | 20KB | src/go/work-manager/ | Work dispatch |
| failure_auto_filer | 21KB | src/go/failure-filer/ | Auto-filing |
| cache | 16KB | src/go/cache/ | Connection pooling |
| connection_pool | 3KB | src/go/connection-pool/ | Pooled connections |
| cron_engine | 14KB | src/go/cron-engine/ | Scheduled tasks |
| night_mode | 14KB | src/go/night-mode/ | Night consolidation |
| recall_router | 5KB | src/go/recall-router/ | Memory routing |
**Entry condition**: event_bus already landed. **Exit condition**: all 14 modules exist as Go binaries, Python versions delegate or are deleted, CI go-surface job passes.
### Wave 4b: The Go tool execution layer (3 modules, ~3,079 lines)
| Module | Python lines | Go target |
|---|---|---|
| tool_executor | 73KB | **STARTED** (src/go/tool-executor/) |
| tool_protocol | 16KB | src/go/tool-executor/ |
| local_tool_runtime | 35KB | src/go/tool-executor/ |
**Exit condition**: tool executor handles all operations in Go, Python delegates via subprocess, approval machinery documented.
### Wave 5a: The Go model/provider layer (10 modules, ~3,398 lines)
| Module | Python lines | Go target |
|---|---|---|
| model_connect | 16KB | src/go/model-connect/ |
| model_profiles | 16KB | src/go/model-connect/ |
| model_registry | 6KB | src/go/model-connect/ |
| model_routing | 16KB | src/go/model-connect/ |
| openai_compat_transport | 10KB | src/go/model-connect/ |
| provider_budget | 12KB | src/go/model-connect/ |
| provider_context | 2KB | src/go/model-connect/ |
| provider_registry | 23KB | src/go/model-connect/ |
| standardized_providers | 9KB | src/go/model-connect/ |
| tiered_executor | 9KB | src/go/model-connect/ |
**Exit condition**: all model/provider operations in Go, Ollama + OpenAI-compatible connections working.
### Wave 5b: The Go operator (19 modules, ~9,637 lines)
The biggest wave. The operator turn loop, routing, and the modules that serve it.
| Module | Python lines | Notes |
|---|---|---|
| rune_operator | 126KB | THE core — turn loop, task management |
| adaptive_router | 23KB | Route decisions |
| build_mode | 20KB | Build orchestration |
| builder_bridge | 12KB | Builder dispatch |
| builder_bridge_cli | 1KB | CLI surface |
| core_server | 9KB | HTTP server |
| persona_definition | 7KB | Persona loading |
| voicebox | 4KB | Voice |
| voice_injector | 3KB | Voice injection |
| release_notes | 18KB | Release generation |
| auto_context | 8KB | Auto context |
| auto_tasks | 15KB | Auto tasks |
| event_wait | 23KB | Event-driven waits |
| evidence_probe | 7KB | Evidence probes |
| forge | 5KB | Forge adapter |
| forge_client | 7KB | Forge client |
| goal | 14KB | Goal management |
| growth_delta | 16KB | Growth tracking |
| warm_router | 55KB | Warm routing |
**Exit condition**: the operator turn loop runs in Go, routes through Go model connections, dispatches to Rust kernels via FFI.
### Wave 5c: The Go memory operations (8 modules, ~8,240 lines)
| Module | Python lines | Notes |
|---|---|---|
| memory_consolidation | 31KB | Consolidation operations (kernel already in Rust) |
| memory_store | 99KB | THE memory store — SQLite operations |
| curator | 70KB | Memory curation |
| sleep_time | 38KB | Sleep-time consolidation |
| abstraction | 22KB | Fact extraction (kernel already in Rust) |
| persona_gate | 24KB | Persona gating |
| witness | 15KB | Witness reflection |
| stage_guards | 12KB | Stage guards |
**Exit condition**: memory operations run in Go, calling Rust kernels for the deterministic compute.
### Wave 6: The Rust deterministic backend (85 modules, ~25,218 lines)
Three sub-waves by dependency order:
**Wave 6a** (30 modules, ~11,515 lines): the structural core — spine, structural_store, construction_*, contracts, capability_*, audit_ledger, behaviour_ledger, claim_audit, etc.
**Wave 6b** (30 modules, ~6,849 lines): the cognition layer — drift_*, graph_memory, memory_selector, identity_anchors, pins, salience_gate, self_improve, token_optimizer, etc.
**Wave 6c** (25 modules, ~6,854 lines): the remaining modules — voice_hybrid, voice_sync, prompt_sync, time_awareness, toolchain, verification_layer, etc.
**Exit condition**: every deterministic module exists as a Rust function in a crate, the Python version is a thin FFI caller or deleted.
### Wave 7: The TUI + test infrastructure (36 modules, ~10,832 lines)
The TUI stays Python (Textual is Python-native) but its backend calls go through the Go/Rust dichotomy. Test infrastructure stays Python (pytest is Python-native).
**Exit condition**: the TUI is the only Python surface, everything behind it is Go/Rust.
---
## §3 — PER-FILE EPIC TEMPLATE (§7 anti-ballooning: 180 files → per-file epics)
Each file's port gets ONE epic. The epic body contains:
1. **File identity**: `src/rune/<module>.py` — N lines, M functions, K classes
2. **Three questions**: (a) can it be IMPROVED in the target language? (b) does it need FIXING? (c) are there MISSING CONNECTORS?
3. **Language assessment**: confirmed GO/RUST per classification, with the evidence
4. **Constraint context**: which henxels, line caps, canary requirements apply
5. **Pipeline plan**: branch name, PR route, canary battery spec
6. **Verification**: the specific tests + canaries that prove the port
7. **Provenance**: links to the wave, the tranche, the classification record
---
## §4 — DECISION RUBRIC
Per-unit language decisions are made against:
1. **Does the module initiate/respond/route?** → Go
2. **Does it compute/store/pure-function?** → Rust
3. **Does it have BOTH?** → Hybrid: Go front end calls Rust kernel via FFI (contracted membrane junction)
4. **Is it the TUI?** → Python (last)
5. **Is it test infrastructure?** → Python (stays)
Evidence required: the module's actual imports, its primary purpose, its callers, and what breaks if it's removed.
---
## §5 — PIPELINE ROUTING
Every port flows through:
1. **Construction contract**: `rune scaffold submit-need` → decision → contract → building
2. **Branch**: `feat/port-<module>-to-<lang>` from master
3. **Implementation**: Go module in `src/go/<name>/` or Rust module in `src/rust/<crate>/`
4. **Python oracle**: the original Python function preserved as `_py_<function>` for parity
5. **Delegation**: the Python public delegates to the Go/Rust implementation
6. **Canary**: a parity battery proving kernel↔oracle equivalence
7. **CI**: the canary registered in `.gitea/workflows/ci.yml`
8. **PR**: → master, required checks, merge-robot
9. **Deploy**: auto-version bump, deploy pipeline, runtime verification
---
## §6 — VERIFICATION GATES
Per-wave exit:
- All modules in the wave exist as Go/Rust implementations
- Python versions delegate (or are deleted if nothing calls them)
- CI go-surface job passes (for Go modules)
- CI canary job passes (for Rust kernels)
- Full test suite green
- diff-cover ≥70% on changed lines
- Deploy advances the current symlink
Per-tranche exit:
- `ls src/rune/*.py` returns ≤7 files (TUI only)
- Full test suite green
- All canaries green
- All henxels hold
- Deploy verified at the final version
---
## §7 — RISK REGISTER
| Risk | Prevention | Detection |
|---|---|---|
| Big-bang rewrite breaks everything | Incremental waves, each independently deployable | CI red on any wave |
| Dual-truth drift (Python and Go/Rust diverge) | Parity canaries, _py_ oracles | Canary failure |
| Broken keep-greens | Named up front, checked per-wave | CI red |
| Silent scope creep | Per-file epics with explicit scope | Code review |
| FFI boundary breaks | CC_RUST_LIB/SC_RUST_LIB env contract | Kernel probe test |
| Memory store data loss | SQLite retained, reads proven byte-identical | Canary hash check |
| Operator turn loop regression | Full test suite + runtime verification | Deploy verification |
| Henxels line-cap violations | Carve before commit (spine_language pattern) | CI lint red |
| New module without canary | New-module henxel | CI lint red |
---
## §8 — ROLLBACK / KNOWN-GOOD
Each wave is independently deployable. If a wave breaks:
1. The Python version is still in the tree (delegation, not deletion)
2. `RUNE_COGNITION_CORE=python` pins the fallback
3. The deploy symlink can be pointed back to the previous revision
4. Git revert the wave's merge commit
---
## §9 — SCALE HONESTY
This is **weeks of work, not hours**. 180 modules at ~1-2 modules per session = 90-180 sessions. The previous attempt (R2) ported 10 crates + 2 Go modules in multiple sessions. This tranche is the FULL job.
The wave structure is designed for incremental progress: each wave is independently deployable, each module's port is independently verifiable, and the system works at every intermediate state. The Python versions delegate to the Go/Rust implementations — they don't get deleted until the port is proven.
---
## §10 — APPROVAL GATE
This tranche is presented for operator approval. The operator reads the wave structure, the module assignments, the per-wave exit conditions, and either approves (execution starts at Wave 4) or requests changes.
The previous attempt (R2) ported 10 crates + 2 Go modules — less than 10% of the codebase. This tranche is the FULL job: every module, every line, every language decision, with the dichotomy honestly applied.
+196
View File
@@ -0,0 +1,196 @@
# Total-Rebase Inventory (R2 Wave 0.1) — measured 2026-10-04
Generated from `store/rebase/inventory.json` (AST function-level extraction) +
`store/rebase/classification.json` (import/content evidence per module).
Placement law: reactive/initiating/user-facing/network/turn-time → GO;
deterministic/stateful/storage/cognition → RUST; Textual rendering → TUI-LAST;
pure compute with no I/O markers defaults to the deterministic backend.
## Totals
| Side | Modules | Lines | Functions |
|---|---|---|---|
| GO | 43 | 19495 | 708 |
| RUST | 93 | 36215 | 1091 |
| TUI-LAST | 7 | 5438 | 225 |
| TEST-INFRA | 29 | 5395 | 158 |
| RETIRES | 2 | 93 | 9 |
## Per-module classification (evidence-carrying)
| Module | Side | Lines | Functions | Evidence |
|---|---|---|---|---|
| rune_tui | TUI-LAST | 4041 | 166 | textual/rich imports: ['rich', 'textual'] |
| rune_operator | GO | 2697 | 68 | network/concurrency imports: ['threading', 'urllib']; reactive/initiating domain |
| memory_store | RUST | 2435 | 56 | sqlite3 (storage-backed); network/concurrency imports: ['subprocess']; deterministic/state domain |
| curator | RUST | 1838 | 43 | sqlite3 (storage-backed); network/concurrency imports: ['subprocess']; deterministic/state domain |
| tool_executor | GO | 1812 | 47 | network/concurrency imports: ['subprocess']; reactive/initiating domain |
| warm_router | RUST | 1536 | 36 | sqlite3 (storage-backed); network/concurrency imports: ['subprocess']; reactive/initiating domain; deterministic/state domain |
| construction_interface | RUST | 1039 | 25 | deterministic/state domain |
| spine | RUST | 1019 | 31 | deterministic/state domain |
| sleep_time | RUST | 971 | 25 | sqlite3 (storage-backed); network/concurrency imports: ['subprocess', 'urllib']; deterministic/state domain |
| construction_decision | RUST | 949 | 18 | deterministic/state domain |
| capability_broker | RUST | 900 | 21 | deterministic/state domain |
| hook_engine | GO | 860 | 8 | reactive/initiating domain |
| scaffold | RUST | 854 | 31 | network/concurrency imports: ['subprocess']; deterministic/state domain |
| local_tool_runtime | GO | 806 | 32 | network/concurrency imports: ['threading', 'urllib']; reactive/initiating domain |
| context_broker | GO | 768 | 23 | network/concurrency imports: ['threading'] |
| elastic_cognition | RUST | 765 | 13 | network/concurrency imports: ['urllib']; deterministic/state domain |
| memory_consolidation | RUST | 733 | 20 | network/concurrency imports: ['subprocess']; deterministic/state domain |
| provider_registry | GO | 666 | 28 | network/concurrency imports: ['threading', 'urllib']; reactive/initiating domain |
| persona_gate | RUST | 661 | 21 | sqlite3 (storage-backed); network/concurrency imports: ['subprocess', 'urllib']; deterministic/state domain |
| structural_store | RUST | 656 | 33 | deterministic/state domain |
| contracts | RUST | 626 | 7 | deterministic/state domain |
| adaptive_router | GO | 625 | 19 | reactive/initiating domain |
| work_manager | GO | 591 | 25 | reactive/initiating domain |
| abstraction | RUST | 587 | 12 | sqlite3 (storage-backed); network/concurrency imports: ['urllib']; deterministic/state domain |
| construction_intent | RUST | 555 | 16 | deterministic/state domain |
| canary_audit_ledger | TEST-INFRA | 540 | 2 | canary/test module |
| safety_override | RUST | 530 | 18 | no network/reactive markers — pure compute defaults to the deterministic backend |
| failure_auto_filer | GO | 527 | 28 | network/concurrency imports: ['threading'] |
| build_mode | GO | 517 | 34 | network/concurrency imports: ['subprocess'] |
| drift_core | RUST | 517 | 14 | deterministic/state domain |
| event_wait | GO | 517 | 14 | network/concurrency imports: ['subprocess', 'urllib']; reactive/initiating domain |
| tui_validator | TUI-LAST | 514 | 13 | tui family |
| memory_selector | RUST | 511 | 14 | deterministic/state domain |
| system_registry | RUST | 501 | 14 | no network/reactive markers — pure compute defaults to the deterministic backend |
| construction_pattern | RUST | 496 | 13 | deterministic/state domain |
| cache | GO | 492 | 17 | sqlite3 (storage-backed); network/concurrency imports: ['threading'] |
| claim_audit | RUST | 483 | 14 | sqlite3 (storage-backed); deterministic/state domain |
| graph_memory | RUST | 474 | 9 | sqlite3 (storage-backed); deterministic/state domain |
| identity_anchors | RUST | 474 | 8 | deterministic/state domain |
| model_connect | GO | 462 | 10 | network/concurrency imports: ['urllib']; reactive/initiating domain |
| auto_tasks | GO | 460 | 14 | sqlite3 (storage-backed); network/concurrency imports: ['subprocess'] |
| capability_fit | RUST | 455 | 14 | deterministic/state domain |
| tool_protocol | GO | 455 | 27 | reactive/initiating domain |
| drift_ledger | RUST | 453 | 16 | sqlite3 (storage-backed); deterministic/state domain |
| witness | RUST | 451 | 10 | network/concurrency imports: ['urllib']; deterministic/state domain |
| goal | RUST | 441 | 20 | network/concurrency imports: ['urllib']; deterministic/state domain |
| release_notes | GO | 439 | 17 | network/concurrency imports: ['urllib'] |
| cron_engine | GO | 436 | 28 | network/concurrency imports: ['subprocess', 'threading']; reactive/initiating domain |
| model_profiles | GO | 435 | 15 | network/concurrency imports: ['urllib']; reactive/initiating domain |
| microkernel | GO | 434 | 12 | network/concurrency imports: ['subprocess', 'threading'] |
| model_routing | GO | 432 | 15 | network/concurrency imports: ['urllib']; reactive/initiating domain |
| voice_hybrid | RUST | 421 | 10 | sqlite3 (storage-backed); reactive/initiating domain |
| behavior | RUST | 407 | 9 | sqlite3 (storage-backed); deterministic/state domain |
| token_optimizer | RUST | 407 | 23 | deterministic/state domain |
| capability_ledger | RUST | 405 | 19 | deterministic/state domain |
| night_mode | GO | 405 | 19 | network/concurrency imports: ['subprocess', 'threading', 'urllib'] |
| chat_bubble | TUI-LAST | 401 | 16 | textual/rich imports: ['rich', 'textual'] |
| growth_delta | RUST | 400 | 16 | network/concurrency imports: ['subprocess', 'urllib']; deterministic/state domain |
| construction_mode | RUST | 395 | 5 | deterministic/state domain |
| prompt_sync | RUST | 376 | 14 | sqlite3 (storage-backed) |
| provider_budget | GO | 354 | 21 | network/concurrency imports: ['urllib']; reactive/initiating domain |
| structural_model | RUST | 352 | 21 | deterministic/state domain |
| programme_continuation | RUST | 349 | 11 | no network/reactive markers — pure compute defaults to the deterministic backend |
| canary_rune_serve | TEST-INFRA | 329 | 13 | canary/test module |
| builder_bridge | GO | 326 | 11 | reactive/initiating domain |
| canary_p1_07 | TEST-INFRA | 324 | 12 | canary/test module |
| layout_contract | RUST | 316 | 6 | deterministic/state domain |
| message_queue | GO | 316 | 14 | reactive/initiating domain |
| drift_observability | RUST | 315 | 9 | deterministic/state domain |
| build_basis | RUST | 314 | 12 | no network/reactive markers — pure compute defaults to the deterministic backend |
| canary_p0_07 | TEST-INFRA | 310 | 11 | canary/test module |
| drift_compression | RUST | 307 | 12 | deterministic/state domain |
| event_envelope | GO | 303 | 8 | reactive/initiating domain |
| attention_capsule | RUST | 296 | 7 | no network/reactive markers — pure compute defaults to the deterministic backend |
| canary_p1_01 | TEST-INFRA | 294 | 14 | canary/test module |
| voice_sync | RUST | 293 | 10 | sqlite3 (storage-backed); reactive/initiating domain |
| drift_cache | RUST | 292 | 16 | deterministic/state domain |
| outcome_ledger | RUST | 286 | 8 | sqlite3 (storage-backed); deterministic/state domain |
| time_awareness | RUST | 283 | 15 | no network/reactive markers — pure compute defaults to the deterministic backend |
| tiered_executor | GO | 282 | 9 | network/concurrency imports: ['urllib'] |
| stage_guards | RUST | 281 | 11 | network/concurrency imports: ['subprocess']; deterministic/state domain |
| standardized_providers | GO | 281 | 5 | reactive/initiating domain |
| canary_p1_06 | TEST-INFRA | 280 | 9 | canary/test module |
| progressive_escalation | RUST | 279 | 9 | no network/reactive markers — pure compute defaults to the deterministic backend |
| pins | RUST | 276 | 11 | deterministic/state domain |
| canary_p1_03 | TEST-INFRA | 271 | 9 | canary/test module |
| auto_context | GO | 270 | 8 | network/concurrency imports: ['subprocess'] |
| task_persist | RUST | 269 | 10 | no network/reactive markers — pure compute defaults to the deterministic backend |
| context_pressure | RUST | 262 | 9 | no network/reactive markers — pure compute defaults to the deterministic backend |
| canary_gitea_automation | TEST-INFRA | 261 | 3 | canary/test module |
| canary_p1_02 | TEST-INFRA | 253 | 12 | canary/test module |
| construction_patterns_builtin | RUST | 249 | 1 | deterministic/state domain |
| canary_full_system | TEST-INFRA | 244 | 2 | canary/test module |
| event_bus | GO | 244 | 7 | reactive/initiating domain |
| salience_gate | RUST | 243 | 4 | deterministic/state domain |
| self_improve | RUST | 242 | 5 | sqlite3 (storage-backed) |
| construction_activation | RUST | 237 | 4 | deterministic/state domain |
| toolchain | RUST | 236 | 7 | no network/reactive markers — pure compute defaults to the deterministic backend |
| task_gate | RUST | 235 | 8 | sqlite3 (storage-backed) |
| core_server | GO | 234 | 13 | network/concurrency imports: ['http', 'urllib']; reactive/initiating domain |
| audit_ledger | RUST | 231 | 8 | deterministic/state domain |
| canary_native | TEST-INFRA | 231 | 3 | canary/test module |
| openai_compat_transport | GO | 227 | 10 | network/concurrency imports: ['urllib']; reactive/initiating domain |
| shard_manager | RUST | 223 | 10 | sqlite3 (storage-backed) |
| response_adapter | RUST | 222 | 7 | no network/reactive markers — pure compute defaults to the deterministic backend |
| evidence_probe | RUST | 212 | 9 | network/concurrency imports: ['subprocess']; deterministic/state domain |
| model_registry | GO | 211 | 8 | reactive/initiating domain |
| persona_definition | GO | 210 | 8 | network/concurrency imports: ['subprocess'] |
| cognitive_budgeter | RUST | 208 | 3 | deterministic/state domain |
| canary_p0_04 | TEST-INFRA | 207 | 8 | canary/test module |
| forge_client | GO | 203 | 19 | network/concurrency imports: ['urllib']; reactive/initiating domain |
| dependency_tracker | RUST | 202 | 5 | no network/reactive markers — pure compute defaults to the deterministic backend |
| canary_context_broker | TEST-INFRA | 199 | 10 | canary/test module |
| canary_p0_05 | TEST-INFRA | 199 | 16 | canary/test module |
| testing_mode | RUST | 196 | 13 | no network/reactive markers — pure compute defaults to the deterministic backend |
| parallel_processor | GO | 194 | 17 | network/concurrency imports: ['threading'] |
| canary_spine_meta | TEST-INFRA | 192 | 7 | canary/test module |
| iteration | RUST | 190 | 8 | no network/reactive markers — pure compute defaults to the deterministic backend |
| verification_layer | RUST | 189 | 12 | deterministic/state domain |
| subconscious_pass | RUST | 187 | 6 | deterministic/state domain |
| ffi_query_memory_smoke | RUST | 182 | 5 | deterministic/state domain |
| tier_manager | RUST | 182 | 9 | deterministic/state domain |
| canary_tui_transport | TEST-INFRA | 174 | 7 | canary/test module |
| behaviour_ledger | RUST | 173 | 13 | deterministic/state domain |
| construction_commands | RUST | 173 | 4 | deterministic/state domain |
| canary_tui_drift | TEST-INFRA | 170 | 2 | canary/test module |
| intent_continuity | RUST | 168 | 11 | no network/reactive markers — pure compute defaults to the deterministic backend |
| rune_profiler | RUST | 165 | 3 | no network/reactive markers — pure compute defaults to the deterministic backend |
| inference_trace | RUST | 164 | 6 | no network/reactive markers — pure compute defaults to the deterministic backend |
| ms_loader | RUST | 163 | 16 | no network/reactive markers — pure compute defaults to the deterministic backend |
| subsystem_health | GO | 163 | 8 | network/concurrency imports: ['threading'] |
| recall_router | GO | 162 | 3 | reactive/initiating domain |
| voicebox | GO | 161 | 11 | network/concurrency imports: ['subprocess']; reactive/initiating domain |
| canary_gitea_pipeline | TEST-INFRA | 159 | 2 | canary/test module |
| forge | GO | 146 | 12 | network/concurrency imports: ['subprocess', 'urllib'] |
| rune_graphic | TUI-LAST | 145 | 5 | textual/rich imports: ['rich'] |
| connection_pool | GO | 144 | 9 | sqlite3 (storage-backed); network/concurrency imports: ['threading'] |
| recall_uplift | RUST | 141 | 1 | sqlite3 (storage-backed) |
| project_registry | RUST | 139 | 12 | no network/reactive markers — pure compute defaults to the deterministic backend |
| construction_depth | RUST | 138 | 2 | deterministic/state domain |
| voice_injector | GO | 138 | 5 | reactive/initiating domain |
| canary_rune_entry | TEST-INFRA | 137 | 3 | canary/test module |
| construction_projection | RUST | 135 | 3 | deterministic/state domain |
| rune_spinner | RUST | 130 | 5 | no network/reactive markers — pure compute defaults to the deterministic backend |
| tui_backlog | TUI-LAST | 125 | 5 | tui family |
| warm_neuron_store | RUST | 122 | 6 | sqlite3 (storage-backed); deterministic/state domain |
| drift_resume | RUST | 118 | 3 | deterministic/state domain |
| wait_guard | RUST | 116 | 1 | no network/reactive markers — pure compute defaults to the deterministic backend |
| canary_conversation_state | TEST-INFRA | 115 | 2 | canary/test module |
| canary_query_memory | TEST-INFRA | 110 | 2 | canary/test module |
| failure_recovery | RUST | 108 | 1 | no network/reactive markers — pure compute defaults to the deterministic backend |
| graph_projection | RUST | 108 | 5 | deterministic/state domain |
| tui_transport | TUI-LAST | 108 | 12 | tui family |
| spine_loader | RUST | 105 | 7 | deterministic/state domain |
| canary_unbounded | TEST-INFRA | 104 | 2 | canary/test module |
| message_widgets | TUI-LAST | 104 | 8 | textual/rich imports: ['rich', 'textual'] |
| cs_loader | RUST | 90 | 5 | no network/reactive markers — pure compute defaults to the deterministic backend |
| tc_loader | RUST | 88 | 5 | no network/reactive markers — pure compute defaults to the deterministic backend |
| canary_schema_migration | TEST-INFRA | 86 | 1 | canary/test module |
| programme_gates | RUST | 85 | 6 | no network/reactive markers — pure compute defaults to the deterministic backend |
| structural_migration | RUST | 77 | 4 | deterministic/state domain |
| memory_env | RETIRES | 72 | 8 | bootstrap glue subsumed by the Go runtime env contract |
| impact_preview | RUST | 69 | 2 | no network/reactive markers — pure compute defaults to the deterministic backend |
| provider_context | GO | 48 | 1 | reactive/initiating domain |
| wait_guard_corpus | RUST | 46 | 0 | no network/reactive markers — pure compute defaults to the deterministic backend |
| canary_cognitive_strata | TEST-INFRA | 44 | 1 | canary/test module |
| builder_bridge_cli | GO | 42 | 1 | reactive/initiating domain |
| route_risk_flags | RUST | 37 | 1 | no network/reactive markers — pure compute defaults to the deterministic backend |
| canary_memory_synthesis | TEST-INFRA | 33 | 1 | canary/test module |
| canary_resource_authority | TEST-INFRA | 33 | 1 | canary/test module |
| canary_surface_parity | TEST-INFRA | 33 | 1 | canary/test module |
| canary_orchestration_foundation | TEST-INFRA | 32 | 1 | canary/test module |
| canary_gitea_delegation | TEST-INFRA | 31 | 1 | canary/test module |
| __main__ | RETIRES | 21 | 1 | bootstrap glue subsumed by the Go runtime env contract |
+3 -2
View File
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "rune"
version = "0.83.5"
version = "0.155.0"
description = "Rune — a stateful coding assistant with persistent memory, orchestration, and TUI"
requires-python = ">=3.10"
@@ -16,12 +16,13 @@ dependencies = [
"aiohttp>=3.9.0",
"websockets>=12.0",
"psutil>=5.9.0",
"pillow>=10.0",
"pyyaml>=6.0",
]
[project.optional-dependencies]
memory = ["sqlite-vec>=0.1.0"]
dev = ["pytest>=8.0", "pytest-subtests", "ruff==0.16.5", "pyright", "henxels==0.12.0", "coverage>=7.6", "diff-cover>=9.2"]
dev = ["pytest>=8.0", "pytest-subtests", "ruff==0.16.5", "pyright", "henxels==0.12.0", "coverage>=7.6", "diff-cover>=9.2", "hypothesis>=6.100"]
[tool.setuptools.packages.find]
where = ["src"]
+5 -1
View File
@@ -29,6 +29,10 @@
"**/__pycache__"
],
"extraPaths": [
"scripts"
"scripts",
"src/rune",
"shared",
"src/rust/evidence_provenance",
"src/rust/query_memory"
]
}
+16 -10
View File
@@ -1,8 +1,8 @@
# This file was autogenerated by uv via the following command:
# uv pip compile pyproject.toml -o /tmp/regen-req.txt --extra dev --extra memory --python-version 3.11
# uv pip compile pyproject.toml -o requirements-ci.txt --extra dev --extra memory --python-version 3.11
aiohappyeyeballs==2.7.1
# via aiohttp
aiohttp==3.14.3
aiohttp==3.14.4
# via rune (pyproject.toml)
aiosignal==1.4.0
# via aiohttp
@@ -18,9 +18,9 @@ certifi==2026.7.22
# httpx
chardet==7.6.0
# via diff-cover
coverage==7.16.1
coverage==7.16.2
# via rune (pyproject.toml)
diff-cover==10.5.1
diff-cover==10.6.0
# via rune (pyproject.toml)
frozenlist==1.8.0
# via
@@ -34,12 +34,14 @@ httpcore==1.0.9
# via httpx
httpx==0.28.1
# via rune (pyproject.toml)
hypothesis==6.168.5
# via rune (pyproject.toml)
idna==3.20
# via
# anyio
# httpx
# yarl
iniconfig==2.3.0
iniconfig==2.3.1
# via pytest
jinja2==3.1.6
# via diff-cover
@@ -50,21 +52,23 @@ markdown-it-py==4.2.0
# mdit-py-plugins
# rich
# textual
markupsafe==3.0.3
markupsafe==3.0.4
# via jinja2
mdit-py-plugins==0.6.1
# via textual
mdurl==0.1.2
# via markdown-it-py
multidict==6.8.0
multidict==6.9.1
# via
# aiohttp
# yarl
nodeenv==1.10.0
nodeenv==1.11.0
# via pyright
packaging==26.3
# via pytest
platformdirs==4.11.9
pillow==12.3.0
# via rune (pyproject.toml)
platformdirs==4.12.3
# via textual
pluggy==1.6.0
# via
@@ -100,6 +104,8 @@ rich==15.0.0
# textual
ruff==0.16.5
# via rune (pyproject.toml)
sortedcontainers==2.4.0
# via hypothesis
sqlite-vec==0.1.9
# via rune (pyproject.toml)
textual==8.2.8
@@ -116,7 +122,7 @@ typing-extensions==4.16.0
# pyright
# textual
# textual-autocomplete
websockets==17.1
websockets==17.2
# via rune (pyproject.toml)
yarl==1.25.1
# via aiohttp
+94
View File
@@ -0,0 +1,94 @@
#!/usr/bin/env python3
"""adapt_scorecard.py — #301: the final scorecard for the adaptive pipeline.
Run the fixture job set (2 fixes, 2 standard features, 2 high-uncertainty
tasks) through the router; measure route accuracy, time, and avoided
waste. The evidence that earns the adaptive framework.
Usage: python3 scripts/adapt_scorecard.py [--json]
"""
import argparse
import json
import sys
import time
from pathlib import Path
REPO = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(REPO / "src"))
sys.path.insert(0, str(REPO / "src" / "rune"))
import adaptive_router as ar # noqa: E402
def _uncertain_kwargs():
return dict(sufficiency=ar.SufficiencyInputs(
local_authority="UNKNOWN", external_dependency="UNKNOWN",
version_freshness_risk="UNKNOWN", verifiability="UNKNOWN",
scope_novelty="UNKNOWN",
provenance={"local_authority": "no source",
"external_dependency": "no source"}))
# Fixture jobs: (kind, body, kwargs, expected_route)
JOBS = [
("fix", "fix a typo in the README", dict(has_local_repro=True,
owning_authority_known=True, testable_locally=True,
narrow_and_reversible=True), "LOCAL_FIX"),
("fix", "fix an off-by-one in the pager", dict(has_local_repro=True,
owning_authority_known=True, testable_locally=True,
narrow_and_reversible=True), "LOCAL_FIX"),
("standard", "add a --json flag to the report script",
dict(has_local_repro=True, owning_authority_known=True,
testable_locally=True, narrow_and_reversible=True),
"STANDARD_CHANGE"),
("standard", "refactor the cache layer for clarity",
dict(has_local_repro=True, owning_authority_known=True,
testable_locally=True, narrow_and_reversible=False),
"STANDARD_CHANGE"),
("uncertain", "migrate the database schema with unknown downstream consumers",
None, # production path: sufficiency with UNKNOWNs
"RESEARCHED_CHANGE"),
("uncertain", "redesign the memory architecture",
None,
"RESEARCHED_CHANGE"),
]
def scorecard():
rows = []
correct = 0
t0 = time.monotonic()
for kind, body, kwargs, expected in JOBS:
d = ar.classify_route(body, **(kwargs or _uncertain_kwargs()))
hit = d.route == expected
correct += hit
rows.append({"kind": kind, "expected": expected, "got": d.route,
"correct": hit, "reasons": len(d.reasons)})
elapsed = time.monotonic() - t0
return {
"jobs": len(JOBS),
"route_accuracy": round(correct / len(JOBS), 3),
"elapsed_s": round(elapsed, 3),
"avoided_waste": f"{correct}/{len(JOBS)} correctly light or escalated",
"rows": rows,
}
def main():
ap = argparse.ArgumentParser()
ap.add_argument("--json", action="store_true")
args = ap.parse_args()
result = scorecard()
if args.json:
print(json.dumps(result, indent=1))
else:
print(f"route accuracy: {result['route_accuracy']} "
f"({result['avoided_waste']}) in {result['elapsed_s']}s")
for r in result["rows"]:
mark = "✓" if r["correct"] else "✗"
print(f" {mark} {r['kind']}: {r['got']} (want {r['expected']})")
return 0
if __name__ == "__main__":
sys.exit(main())
+127 -8
View File
@@ -148,9 +148,18 @@ def sha_branch(sha: str) -> str:
def sha_on_master(sha: str) -> bool:
out = _git("branch", "--contains", sha)
return any(l.strip().endswith("master") or l.strip() == "master"
for l in out.splitlines())
"""SHA is an ancestor of master (local or remote-tracking refs).
M10 correction (2026-09-19): --all so a freshly fetched master
(refs/remotes/gitea/master) counts; local branches alone go stale
between fetches. derive_op_type refreshes refs before calling this.
"""
out = _git("branch", "--all", "--contains", sha)
for l in out.splitlines():
s = l.strip().removeprefix("remotes/").removesuffix(" *")
if s == "master" or s.endswith("/master"):
return True
return False
def open_pr_for_sha(sha: str) -> int | None:
@@ -184,6 +193,11 @@ def derive_op_type(sha: str) -> tuple[str, str]:
were created from model-supplied defaults and cannot be trusted.
Never trusts model input.
"""
# 0. M10 correction (2026-09-19): refresh remote-tracking refs before
# inference. A just-merged master commit is invisible to
# branch --contains until refs are fetched; stale local git state
# must never outrank repo truth. Bounded by GIT_TIMEOUT, fail-open.
_git("fetch", "--quiet", "gitea", "+refs/heads/*:refs/remotes/gitea/*")
for rec in _load_wait_records():
if _rec_sha(rec) != sha:
continue
@@ -205,11 +219,16 @@ def derive_op_type(sha: str) -> tuple[str, str]:
def normalize_action(action: dict, *,
model_deadline: Any = None,
user_deadline: Any = None,
contract_deadline: Any = None) -> dict:
contract_deadline: Any = None,
task_id: str = "") -> dict:
"""Normalize a model continuation action into the canonical continuation.
action: {kind: await_operation|sleep_poll|check_status|unknown,
sha?: str, operation_id?: str, op_type?: str, raw?: str}
task_id: REAL_ASYNC_BRIDGE §9 — when the caller knows its task
binding, pending-operation resolution is scoped to operations
registered with that task_id; stale global operations are
never consulted when a binding exists.
Returns:
{normalized: bool, action: "ContinuePendingOperation", operation_id,
op_type, authority, deadline_secs, deadline_provenance,
@@ -222,27 +241,124 @@ def normalize_action(action: dict, *,
model_deadline_ignored = model_deadline is not None
model_op_type_ignored = model_op_type is not None
# 0. task binding scope (§9): task-bound operations beat global state.
# Stored operation wins over ANY model hint (sha/op_type/deadline).
if task_id and not op_id:
bound = [r for r in pending_operations()
if str(r.get("ext", {}).get("task_id", "")) == task_id]
if len(bound) == 1:
rec = bound[0]
norm = _canonical_from_record(rec, model_deadline_ignored,
model_op_type_ignored,
"task_bound",
user_deadline, contract_deadline)
norm["sha_for_wait"] = _rec_sha(rec)
norm["task_id"] = task_id
return norm
if len(bound) > 1:
return {"normalized": "AMBIGUOUS",
"candidates": [_rec_operation_id(c) for c in bound],
"reason": f"multiple pending operations bound to task {task_id}"}
return {"normalized": False,
"reason": f"no pending operation bound to task {task_id}"}
# 1. explicit operation_id wins
if op_id:
from rune import event_wait as ew # noqa: E402
rec = ew.operation_wait(op_id)
if rec is None:
# REAL_ASYNC_BRIDGE §10: a FRESH operation has no wait record
# yet — registration happens at the park step (ci_event_wait).
# For an explicit, well-formed, EXISTING commit id, return the
# provisional canonical continuation (policy deadline, own-runs
# authority) so the model-facing tool can park on first call.
# A typo'd/ghost sha is refused here (A-patch lesson): the
# commit must exist in the repository.
import re as _re
m = _re.fullmatch(r"ci-([0-9a-f]{40})", op_id)
if m:
sha40 = m.group(1)
probe = subprocess.run(
["git", "-C", str(REPO), "cat-file", "-e",
f"{sha40}^{{commit}}"],
capture_output=True, timeout=15)
if probe.returncode == 0:
return {
"normalized": True,
"action": "ContinuePendingOperation",
"operation_id": op_id,
"sha_for_wait": sha40,
"op_type": "branch_ci",
"authority": "ci_runs",
"deadline_secs": POLICY_DEADLINES["branch_ci"],
"deadline_provenance": "GOVERNED_OPERATION_POLICY",
"model_deadline_ignored": model_deadline_ignored,
"model_op_type_ignored": model_op_type_ignored,
"evidence": "explicit_id_fresh_registration",
}
return {"normalized": False,
"reason": f"operation_id {op_id} has no wait record"}
return _canonical_from_record(rec, model_deadline_ignored,
model_op_type_ignored, "explicit_id",
user_deadline, contract_deadline)
# 2. resolve by sha / active operation
# 2. resolve by sha / active operation.
# H-PATCH H2/H3: the model sha is a HINT. If it doesn't resolve but
# unambiguous pending operations exist, the STORED target wins — a
# mistyped model sha must never create a ghost operation (the A-patch
# live failure: a typo'd sha derived branch_ci for a nonexistent commit
# and parked a wait on a ghost).
# 2. no explicit operation_id: resolve by sha / pending operations.
# H-PATCH: when the model provides NO sha (operation-id-first mode),
# resolve from unambiguous pending operations — the model should not
# need to reconstruct a 40-char sha to express "wait for it".
if not sha:
all_pending = pending_operations()
if len(all_pending) == 1:
rec = all_pending[0]
norm = _canonical_from_record(rec, model_deadline_ignored,
model_op_type_ignored,
"auto_resolved_no_sha",
user_deadline, contract_deadline)
norm["sha_for_wait"] = _rec_sha(rec)
return norm
if len(all_pending) > 1:
return {"normalized": "AMBIGUOUS",
"candidates": [_rec_operation_id(c) for c in all_pending],
"reason": "multiple pending operations, no sha hint"}
return {"normalized": False,
"reason": "no pending operations and no sha provided"}
candidates = pending_operations(sha=sha)
if len(candidates) > 1 and not sha:
return {"normalized": "AMBIGUOUS",
"candidates": [_rec_operation_id(c) for c in candidates],
"reason": "multiple pending operations, no target"}
if len(candidates) == 1:
return _canonical_from_record(candidates[0], model_deadline_ignored,
rec = candidates[0]
stored_sha = _rec_sha(rec)
norm = _canonical_from_record(rec, model_deadline_ignored,
model_op_type_ignored, "pending_match",
user_deadline, contract_deadline)
if sha and stored_sha and sha != stored_sha:
norm["model_sha_mismatch"] = {
"model_sha": sha, "stored_sha": stored_sha,
"resolution": "stored_target_used"}
return norm
# model sha unresolved: any unambiguous pending op at all? then the
# model probably mistyped the sha — use the stored target, log it.
all_pending = pending_operations()
if len(all_pending) == 1 and sha:
rec = all_pending[0]
stored_sha = _rec_sha(rec)
norm = _canonical_from_record(rec, model_deadline_ignored,
model_op_type_ignored,
"unresolved_sha_single_pending",
user_deadline, contract_deadline)
norm["model_sha_mismatch"] = {
"model_sha": sha, "stored_sha": stored_sha,
"resolution": "stored_target_used"}
return norm
# 3. no stored record: derive truth deterministically
if not sha:
@@ -337,7 +453,8 @@ def normalize_bash(command: str, *, sha_hint: str = "") -> dict | None:
if rec is not None:
norm = _canonical_from_record(rec, True, False, "sleep_poll_intent",
None, None)
else:
norm["sha_for_wait"] = _rec_sha(rec)
elif sha:
op_type, evidence = derive_op_type(sha)
norm = {
"normalized": True, "action": "ContinuePendingOperation",
@@ -348,8 +465,10 @@ def normalize_bash(command: str, *, sha_hint: str = "") -> dict | None:
"deadline_secs": POLICY_DEADLINES[op_type],
"deadline_provenance": "GOVERNED_OPERATION_POLICY",
"model_deadline_ignored": True, "model_op_type_ignored": False,
"evidence": evidence,
"evidence": evidence, "sha_for_wait": sha,
}
else:
return None
norm["raw_command_kind"] = "sleep_poll"
norm["raw_sleep_seconds_suppressed"] = secs
return norm
+25 -1
View File
@@ -21,14 +21,37 @@ def main() -> int:
n = sub.add_parser("normalize", help="normalize a continuation intent")
n.add_argument("--sha", default="")
n.add_argument("--operation-id", default="")
n.add_argument("--task-id", default="",
help="§9 task binding: scope pending resolution to "
"operations registered for this task")
n.add_argument("--model-op-type", default=None)
n.add_argument("--model-deadline", default=None)
n.add_argument("--user-deadline", default=None,
help="USER_EXPLICIT deadline (authoritative)")
n.add_argument("--contract-deadline", default=None,
help="EXTERNAL_CONTRACT deadline (authoritative)")
rb = sub.add_parser("route-bash",
help="route a Bash command expressing wait intent")
rb.add_argument("--command", required=True)
rb.add_argument("--sha-hint", default="")
args = ap.parse_args()
if args.cmd == "route-bash":
record = await_intent.normalize_bash(args.command,
sha_hint=args.sha_hint)
if record is None:
print(json.dumps({"normalized": False,
"reason": "no external continuation intent"}))
return 0
if record.get("normalized") is True:
# the compiled wait needs the SHA: derive from operation_id
oid = str(record.get("operation_id", ""))
if oid.startswith("ci-"):
record["sha_for_wait"] = oid[3:]
await_intent.emit_normalized_record(record)
print(json.dumps(record, sort_keys=True))
return 0
action = {"kind": "await_operation", "sha": args.sha,
"operation_id": args.operation_id,
"op_type": args.model_op_type}
@@ -40,7 +63,8 @@ def main() -> int:
if args.contract_deadline else None)
record = await_intent.normalize_action(
action, model_deadline=model_deadline,
user_deadline=user_deadline, contract_deadline=contract_deadline)
user_deadline=user_deadline, contract_deadline=contract_deadline,
task_id=args.task_id)
await_intent.emit_normalized_record(record)
print(json.dumps(record, sort_keys=True))
return 0
+126
View File
@@ -0,0 +1,126 @@
#!/usr/bin/env python3
"""backfill_exit_notes.py — retroactively append the EXIT-NOTE (plain-
English what-changed) to every existing release that predates the template
(Nick directive 2026-10-08). For each tag: render the exit note for the
tag's own range (v_prev..v_tag), append it to the release body under a
"## What changed" heading — preserving the governed evidence sections —
and PATCH the release via the Gitea API. Idempotent: releases already
carrying the exit-note heading are skipped.
Usage: python3 scripts/backfill_exit_notes.py [--dry-run] [--limit N]
"""
import json
import re
import subprocess
import sys
from pathlib import Path
REPO = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(REPO / "scripts"))
sys.path.insert(0, str(REPO / "src"))
from release_exit_note import render_markdown, render # noqa: E402
EXIT_HEADING = "## What changed"
SERVER = "http://127.0.0.1:3000"
REPO_SLUG = "conductor/rune"
def _token() -> str:
sys.path.insert(0, str(REPO / ".config" / "opencode" / "shared"))
try:
from gitea_auth import load_gitea_token
return load_gitea_token()
except ImportError:
# fall back to the git credential
r = subprocess.run(
["git", "credential", "fill"], input="url=http://127.0.0.1:3000\n",
capture_output=True, text=True, cwd=REPO)
for line in r.stdout.splitlines():
if line.startswith("password="):
return line.split("=", 1)[1]
return ""
def api(path, method="GET", data=None):
import urllib.request
req = urllib.request.Request(
f"{SERVER}/api/v1/repos/{REPO_SLUG}{path}",
data=json.dumps(data).encode() if data is not None else None,
headers={"Authorization": f"token {_token()}",
"Content-Type": "application/json"},
method=method,
)
with urllib.request.urlopen(req, timeout=30) as r:
return json.loads(r.read())
def tags():
r = subprocess.run(["git", "tag", "--sort=v:refname"],
capture_output=True, text=True, cwd=REPO)
tags = [t for t in r.stdout.splitlines() if t.startswith("v")]
# exit-note applies from v0.117.0 onward (the factory-era releases)
try:
start = tags.index("v0.117.0")
except ValueError:
return tags
return tags[start:]
def main():
dry = "--dry-run" in sys.argv
limit = 999
if "--limit" in sys.argv:
limit = int(sys.argv[sys.argv.index("--limit") + 1])
all_tags = tags()
releases = api("/releases?limit=50&sort=desc")
by_tag = {r["tag_name"]: r for r in releases}
patched, skipped, failed = 0, 0, 0
# chronological order (oldest first) so ranges nest correctly
for i, tag in enumerate(all_tags):
if i == 0:
prev = None
else:
prev = all_tags[i - 1]
rel = by_tag.get(tag)
if rel is None:
skipped += 1
continue
body = rel.get("body") or ""
if EXIT_HEADING in body:
skipped += 1
continue
if i == 0 or prev is None:
skipped += 1
continue
# limit: process the N NEWEST unpatched
if patched >= limit:
skipped += 1
continue
try:
note = render(prev, tag)
md = render_markdown(note)
new_body = body.rstrip() + "\n\n---\n\n" + md + "\n"
if dry:
print(f"[dry] {tag}: would append {len(md)} chars "
f"({note['by_kind']})")
patched += 1
continue
api(f"/releases/{rel['id']}", method="PATCH",
data={"body": new_body})
print(f"patched {tag}: +{len(md)} chars ({note['by_kind']})")
patched += 1
except Exception as e:
print(f"FAILED {tag}: {e}")
failed += 1
print(f"\ndone: {patched} patched, {skipped} skipped, {failed} failed"
f"{' (dry run)' if dry else ''}")
return 1 if failed else 0
if __name__ == "__main__":
sys.exit(main())
+217 -77
View File
@@ -47,28 +47,34 @@ import time
from pathlib import Path
_SCRIPT_DIR = Path(__file__).resolve().parent
sys.path.insert(0, str(_SCRIPT_DIR))
sys.path.insert(0, str(_SCRIPT_DIR.parent / "src"))
sys.path.insert(0, str(_SCRIPT_DIR))
from rune import event_wait as ew # noqa: E402
import completion_file as cf # noqa: E402
REPO_ROOT = _SCRIPT_DIR.parent
QUALIFY_SCRIPT = _SCRIPT_DIR / "deploy_qualify.py"
def authority_verdict() -> str:
def authority_verdict(sha: str = "") -> str:
"""ONE-SHOT canonical Gitea verdict via deploy_qualify.py — the only
completion truth. Never parses the event payload."""
completion truth. Never parses the event payload.
H-PATCH H4: the target sha is passed EXPLICITLY (as the subprocess's
--sha argument) — ambient DEPLOY_SHA can no longer change which
operation is verified. The env var remains only as a CLI backward
compat for deploy_qualify.py invoked standalone."""
cmd = [sys.executable, str(QUALIFY_SCRIPT)]
if sha:
cmd += ["--sha", sha]
proc = subprocess.run(
[sys.executable, str(QUALIFY_SCRIPT)],
cmd,
capture_output=True, text=True, timeout=120,
env=dict(os.environ, PYTHONPATH=""),
env={k: v for k, v in os.environ.items() if k != "DEPLOY_SHA"}
if sha else dict(os.environ, PYTHONPATH=""),
)
# T21.3: GITEA_TOKEN from deploy.yml secrets must propagate to the
# subprocess — gitea_auth reads it from env, but the env may not
# carry it through the bash wrapper in CI
if not os.environ.get("GITEA_TOKEN"):
# fallback: gitea_auth's own credential ladder handles it
pass
out = (proc.stdout or "").strip().splitlines()
return (out[-1] if out else "pending").strip()
@@ -169,12 +175,35 @@ def op_authority_verdict(op_type: str, sha: str) -> str:
spec = op_spec(op_type)
authority = spec["authority"]
if authority == "deploy_qualify":
return authority_verdict()
v = normalize_verdict(authority_verdict(sha))
if v != "pending":
return v
# E-PATCH resilience: Gitea's combined commit-status endpoint can
# 404 for the newest commit (observed live on auto-version bump
# commits — the status object materializes late/never). The runs
# ARE the same evidence the two legs read; fall back to the
# operation-scoped runs verdict so authority stays resolvable.
if _status_endpoint_unreadable(sha):
return _ci_runs_verdict(spec, sha)
return v
if authority == "ci_runs":
return _ci_runs_verdict(spec, sha)
raise ValueError(f"unknown authority {authority!r} for {op_type!r}")
def _status_endpoint_unreadable(sha: str) -> bool:
"""True when the combined commit-status endpoint 404s for the SHA
(index lag / never-materialized status object) — the documented
fallback trigger, verified against the API once per call."""
try:
sys.path.insert(0, str(_SCRIPT_DIR))
import gitea_auth # noqa: E402
st, _body = gitea_auth.api(f"/commits/{sha}/status")
return st == 404
except Exception: # noqa: BLE001
return False
def _ci_runs_verdict(spec: dict, sha: str) -> str:
"""Operation-scoped Actions-run verdict (import the API client from
deploy_qualify to keep ONE Gitea client)."""
@@ -185,7 +214,7 @@ def _ci_runs_verdict(spec: dict, sha: str) -> str:
getattr(gitea_auth, "DEFAULT_SERVER", "")).rstrip("/")
repo = os.environ.get("GITEA_REPO",
getattr(gitea_auth, "DEFAULT_REPO", ""))
sha_env = os.environ.get("DEPLOY_SHA", "") or sha
sha_env = sha # H-PATCH: explicit parameter is the only authority
token = gitea_auth.get_token() if gitea_auth.has_token() else ""
if not (server and repo and sha_env and token):
return "pending" # cannot verify -> not verified (fail closed)
@@ -221,7 +250,7 @@ def op_ci_alive(op_type: str, sha: str) -> bool:
getattr(gitea_auth, "DEFAULT_SERVER", "")).rstrip("/")
repo = os.environ.get("GITEA_REPO",
getattr(gitea_auth, "DEFAULT_REPO", ""))
sha_env = os.environ.get("DEPLOY_SHA", "") or sha
sha_env = sha # H-PATCH: explicit parameter is the only authority
token = gitea_auth.get_token() if gitea_auth.has_token() else ""
if not (server and repo and sha_env and token):
return False
@@ -243,6 +272,7 @@ def op_ci_alive(op_type: str, sha: str) -> bool:
def authority_after_wake(op_type: str = DEFAULT_OP_TYPE, sha: str = "",
max_tries: int = 3, gap_secs: int = 4) -> str:
"""(sha is EXPLICIT — ambient env never selects the target.)"""
"""Post-wake authority read. The daemon's own wake sweep uses a
bounded event-triggered retry (4s ×3) for the job-finished-microseconds-
ago ack window; a verdict read here can hit the same window. This is a
@@ -264,9 +294,28 @@ def ci_alive() -> bool:
return op_ci_alive(DEFAULT_OP_TYPE, os.environ.get("DEPLOY_SHA", ""))
def _set_cognition_state(op: str, state: str) -> None:
"""E-PATCH §12: stamp cognitive quiescence on the durable record so a
fresh process knows cognition is parked (WAITING_EXTERNAL) vs resumable
(RESUMABLE). Best-effort: observability never breaks the wait."""
try:
rec = ew.operation_wait(op)
if rec is None:
return
wait_file = ew.wr_root() / "waits" / f"{rec.get('wait_id')}.json"
if not wait_file.is_file():
return
data = json.loads(wait_file.read_text())
data.setdefault("ext", {})["continuation_state"] = state
wait_file.write_text(json.dumps(data, indent=1, sort_keys=True))
except (OSError, ValueError):
pass
def run(*, sha: str, deadline_secs: int,
watchdog_secs: int = 300,
op_type: str = DEFAULT_OP_TYPE,
task_id: str = "",
daemon_url: str = ew.DEFAULT_DAEMON_URL) -> int:
"""T21.5 §3: ONE LOGICAL AWAIT.
@@ -279,10 +328,28 @@ def run(*, sha: str, deadline_secs: int,
"""
spec = op_spec(op_type) # unknown op_type refused upfront
op = f"ci-{sha}"
# A-PATCH: the authority subprocess reads DEPLOY_SHA from the env;
# python-level run() callers (tool normalization flow) must export it.
if sha and not os.environ.get("DEPLOY_SHA"):
os.environ["DEPLOY_SHA"] = sha
# H-PATCH: resolve short SHAs to full 40-char — _fetch_runs and
# deploy_qualify match on the FULL sha; a 12-char prefix would
# silently fail equality and park the waiter until deadline
# (the 962e351 root cause).
if sha and len(sha) < 40:
try:
full = subprocess.run(
["git", "-C", str(_SCRIPT_DIR.parent), "rev-parse", sha],
capture_output=True, text=True, timeout=10)
if full.returncode == 0:
sha = full.stdout.strip()
os.environ["DEPLOY_SHA"] = sha
except (OSError, subprocess.TimeoutExpired):
pass
t0 = time.time()
# §16Y #10 race fix: the FIFO reader exists BEFORE registration, so a
# wake arriving in the registration window can always be delivered.
fifo_fd = ew.open_fifo_reader(op)
# REAL_ASYNC_BRIDGE: FIFO is replaced by completion-file inotify.
# The completion file write is the wake signal; inotify is the
# kernel-level zero-latency, zero-CPU wake primitive.
# Event replay (T16 §16C live finding): on a serialized runner the
# completion event usually arrives BEFORE the waiter registers.
# A matching durable event means the wake already happened — skip
@@ -295,7 +362,10 @@ def run(*, sha: str, deadline_secs: int,
watched_for="Gitea CI completion event (replayed from the "
"durable event log)",
provider="gitea", event_type="ci_completed", sha=sha,
watchdog_secs=min(watchdog_secs, deadline_secs))
watchdog_secs=min(watchdog_secs, deadline_secs),
continuation_state="RESUMABLE", # event already arrived
op_type=op_type,
authority=spec["authority"])
registered_at = rec["created_at"]
event_at = time.strftime(
"%Y-%m-%dT%H:%M:%SZ", time.gmtime())
@@ -329,8 +399,16 @@ def run(*, sha: str, deadline_secs: int,
watched_for="Gitea CI completion event (wake; verdict re-read "
f"from canonical {spec['authority']} authority)",
provider="gitea", event_type="ci_completed", sha=sha,
watchdog_secs=min(watchdog_secs, deadline_secs))
watchdog_secs=min(watchdog_secs, deadline_secs),
continuation_state="WAITING_EXTERNAL",
op_type=op_type,
authority=spec["authority"],
task_id=task_id, # §9: bind the operation to the calling task
resume_mode="self") # §3: waiter owns its continuation via
# completion-file/inotify; the daemon has NO
# session-delivery role for this wait
registered_at = rec["created_at"]
_set_cognition_state(op, "WAITING_EXTERNAL") # cognition parked
deadline = time.monotonic() + deadline_secs
verdict = "pending"
mode = "event"
@@ -338,78 +416,110 @@ def run(*, sha: str, deadline_secs: int,
resumed_at = ""
rearm_reason = ""
rearm_count = 0
try:
while time.monotonic() < deadline:
while time.monotonic() < deadline:
remaining = max(1, int(deadline - time.monotonic()))
result = ew.await_resume_event(
op, watchdog_secs=min(remaining, watchdog_secs), pgid=None,
fifo_fd=fifo_fd)
if result["kind"] == "event":
# REAL_ASYNC_BRIDGE: block on inotify for the completion file.
# Zero CPU, zero arbitrary timer. The inotify timeout is a
# FAILURE DETECTOR — if no event arrives within the watchdog
# window, we check the authority directly (lost-event recovery).
# The deadline is containment only.
watch_timeout = min(remaining, watchdog_secs)
result = cf.wait_for_completion(
op, timeout_secs=watch_timeout)
# REAL_ASYNC_BRIDGE: check durable event log AND wait record
# status on EVERY cycle — the daemon may have matched and
# transitioned the record via /process-event.
wr = ew.operation_wait(op)
if wr and wr.get("status") in ("COMPLETED", "FAILED",
"READY_TO_RESUME"):
event_at = event_at or time.strftime(
"%Y-%m-%dT%H:%M:%SZ", time.gmtime())
resumed_at = time.strftime("%Y-%m-%dT%H:%M:%SZ",
time.gmtime())
# WAKE received — canonical authority decides, never the
# event payload
verdict = normalize_verdict(authority_after_wake(op_type, sha))
verdict = normalize_verdict(
authority_after_wake(op_type, sha))
if verdict != "pending":
mode = "event"
break
prior = ew.find_matching_event("gitea", "ci_completed", op)
if prior is not None and prior.get("exit_code") is not None:
event_at = event_at or time.strftime(
"%Y-%m-%dT%H:%M:%SZ", time.gmtime())
resumed_at = time.strftime("%Y-%m-%dT%H:%M:%SZ",
time.gmtime())
verdict = normalize_verdict(
authority_after_wake(op_type, sha))
if verdict != "pending":
mode = "event"
break
if result is not None:
# completion file exists: event arrived
event_at = event_at or time.strftime(
"%Y-%m-%dT%H:%M:%SZ", time.gmtime())
resumed_at = time.strftime("%Y-%m-%dT%H:%M:%SZ",
time.gmtime())
verdict = normalize_verdict(
authority_after_wake(op_type, sha))
if verdict != "pending":
mode = "event"
break
# T21.5 §3: NONTERMINAL — re-arm internally, keep waiting.
rearm_count += 1
rearm_reason = (f"event seen; {spec['authority']} "
"authority pending — internal re-arm")
rearm_reason = ("completion file seen; authority "
"pending — re-subscribing")
continue
if result["kind"] == "eof":
# writer gone without a token: the DURABLE record decides
rec = ew.operation_wait(op) or {}
if rec.get("status") in ("COMPLETED", "FAILED",
"READY_TO_RESUME", "RESUMING") or \
(rec.get("status") == "RESUME_UNVERIFIED"
and rec.get("process_event_evidence")):
event_at = event_at or time.strftime(
"%Y-%m-%dT%H:%M:%SZ", time.gmtime())
resumed_at = time.strftime("%Y-%m-%dT%H:%M:%SZ",
time.gmtime())
verdict = normalize_verdict(authority_after_wake(op_type, sha))
if verdict != "pending":
mode = "event_recovered_from_durable_record"
break
rearm_count += 1
rearm_reason = "eof without token; durable record pending"
continue
# watchdog expiry: operation-scoped liveness decides re-arm
# vs truthful recovery — failure detector, never scheduler
if op_ci_alive(op_type, sha):
rearm_count += 1
rearm_reason = ("watchdog expiry; op runs non-terminal "
"in Gitea — internal re-arm")
continue
# no live runs visible for THIS op's authority: either the
# operation has not started yet (EXPECTED nonterminal — the
# §18-audit generator: this must re-arm, never return to the
# model) or it finished between probes. Bounded re-read.
verdict = normalize_verdict(op_authority_verdict(op_type, sha))
# inotify timeout: no event within watchdog window
# FAILURE DETECTOR: check authority directly
verdict = normalize_verdict(
op_authority_verdict(op_type, sha))
if verdict != "pending":
mode = "watchdog_authority_recovered"
break
verdict = normalize_verdict(op_authority_verdict(op_type, sha))
if verdict != "pending":
mode = "watchdog_authority_recovered"
break
# still pending: runs not started OR lagging aggregator —
# internal re-arm; the deadline is the only other exit
rearm_count += 1
rearm_reason = ("watchdog expiry; op pending (not started or "
"lagging) — internal re-arm")
rearm_reason = ("watchdog expiry; op pending (not started "
"or lagging) — re-subscribing inotify")
continue
finally:
os.close(fifo_fd)
# REAL_ASYNC_BRIDGE: no FIFO to close. The completion file is durable
# and survives restarts. Lease release is not needed (no lease system
# for file-based delivery).
if verdict == "pending":
if mode == "event":
mode = "deadline_pending"
verdict = normalize_verdict(op_authority_verdict(op_type, sha)) # final one-shot truth
_set_cognition_state(op, "RESUMABLE" if verdict != "pending"
else "RECOVERY_REQUIRED")
verdict_at = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())
# §2 STATE OWNERSHIP: the WAITER owns the OPERATION domain. On a
# terminal authority verdict, stamp the durable record terminal with
# the evidence — the daemon's session-delivery machinery must never
# (and can no longer) overwrite this truth. Also updates the parked
# continuation_state so fresh-process recovery sees reality.
try:
rec2 = ew.operation_wait(op) or rec
if verdict != "pending":
rec2["status"] = "COMPLETED" if verdict == "success" else "FAILED"
rec2["verdict"] = verdict
rec2["resume_evidence"] = {
"kind": "authority_verified_terminal",
"verdict": verdict,
"mode": mode,
"authority": spec["authority"],
"sha": sha,
"op_type": op_type,
"verdict_at": verdict_at,
}
rec2["ext"] = {**rec2.get("ext", {}),
"continuation_state": ("RESUMABLE" if verdict != "pending"
else "RECOVERY_REQUIRED")}
ew._load_waitstore().save(rec2)
except Exception as _e: # noqa: BLE001 — record stamping must never corrupt the envelope (the envelope + authority remain the truth)
print(f"ci_event_wait: terminal record stamp failed: {_e}",
file=sys.stderr)
out = {
"sha": sha,
"op_type": op_type,
@@ -427,21 +537,51 @@ def run(*, sha: str, deadline_secs: int,
print(json.dumps(out))
return 0 if verdict == "success" else 1
KNOWN_FLAGS = ("--sha", "--deadline", "--op-type", "--watchdog", "--task-id")
def main() -> int:
"""§5 CLI CONTRACT: no silent argument loss. Every flag is either
explicitly supported (and takes effect) or loudly rejected — an
acceptance envelope must reflect the configuration actually used."""
sha = os.environ.get("DEPLOY_SHA", "")
args = sys.argv[1:]
if "--sha" in args:
sha = args[args.index("--sha") + 1]
deadline = 900
if "--deadline" in args:
deadline = int(args[args.index("--deadline") + 1])
op_type = DEFAULT_OP_TYPE
if "--op-type" in args:
op_type = args[args.index("--op-type") + 1]
watchdog = 300
task_id = ""
i = 0
while i < len(args):
a = args[i]
if a == "--sha":
sha = args[i + 1]; i += 2
elif a == "--deadline":
deadline = int(args[i + 1]); i += 2
elif a == "--op-type":
op_type = args[i + 1]; i += 2
elif a == "--watchdog":
watchdog = int(args[i + 1]); i += 2
elif a == "--task-id":
task_id = args[i + 1]; i += 2
elif a.startswith("--"):
print(json.dumps({"error": f"unknown flag {a!r}",
"known_flags": list(KNOWN_FLAGS),
"contract": "no silent argument loss"}))
return 2
else:
print(json.dumps({"error": f"unexpected positional {a!r}",
"known_flags": list(KNOWN_FLAGS)}))
return 2
if not sha:
print(json.dumps({"error": "no sha (DEPLOY_SHA or --sha required)"}))
return 1
return run(sha=sha, deadline_secs=deadline, op_type=op_type)
# A-PATCH fix: run()'s authority subprocess (deploy_qualify.py) reads
# DEPLOY_SHA from the environment — a CLI `--sha` consumer previously
# got a silent "pending" verdict forever because the var was never
# exported. Export it so the canonical authority can resolve.
os.environ["DEPLOY_SHA"] = sha
return run(sha=sha, deadline_secs=deadline, op_type=op_type,
watchdog_secs=watchdog, task_id=task_id)
if __name__ == "__main__":
+195
View File
@@ -0,0 +1,195 @@
"""completion_file.py — REAL_ASYNC_BRIDGE: durable completion-file delivery
with inotify wake. Replaces FIFO+lease for process-wait delivery.
DESIGN:
Producer (bridge/daemon/notify):
1. Validates operation identity
2. Atomically writes a completion file:
resumes/<operation_id>.done
containing the event/verdict JSON (write to tmp, rename for atomicity)
Waiter (ci_event_wait / any continuation consumer):
1. Checks if the completion file already exists (event-before-waiter)
2. If not: registers inotify watch on the resumes/ directory
3. Re-checks after watch registration (closes the registration race)
4. Blocks in kernel on inotify — zero CPU, zero timer
5. On file-created event: reads the file, verifies authority, returns
The event is a WAKE SIGNAL. Authority still decides terminal truth.
The completion file is durable — survives daemon and waiter restarts.
WHY NOT FIFO:
FIFO is one-shot (token consumed), requires lease management, and
fails under session-busy guards. A completion file is atomic, durable,
and works across restarts. inotify wakes the process with zero CPU
cost and zero latency between file creation and wake.
WHY NOT POLLING:
Polling introduces an arbitrary interval. inotify is a kernel callback
that fires exactly when the filesystem changes — the latency tracks
the real completion event, not a configured interval.
"""
from __future__ import annotations
import json
import os
import select
import struct
import time
from pathlib import Path
def _wr_bridge() -> Path:
# WR_ROOT = daemon/infra convention; RUNE_WR_ROOT = repo/scripts
# convention. Both honored (WR_ROOT wins) so the daemon, the waiter,
# and any isolated test root always resolve the SAME directory.
root = (os.environ.get("WR_ROOT")
or os.environ.get("RUNE_WR_ROOT")
or "/mnt/workdrive/wr-bridge")
return Path(root)
def _resumes_dir() -> Path:
return _wr_bridge() / "resumes"
# inotify constants (Linux)
IN_CREATE = 0x100
IN_CLOSE_WRITE = 0x8
IN_MOVED_TO = 0x80
def completion_path(operation_id: str) -> Path:
return _resumes_dir() / f"{operation_id}.done"
def write_completion(operation_id: str, event: dict) -> Path:
"""Atomically write a durable completion file. The rename(2) ensures
the waiter never sees a partial file."""
_resumes_dir().mkdir(parents=True, exist_ok=True)
target = completion_path(operation_id)
tmp = target.parent / f".{target.name}.tmp.{os.getpid()}"
tmp.write_text(json.dumps(event, sort_keys=True) + "\n")
os.rename(str(tmp), str(target)) # atomic on same filesystem
os.chmod(str(target), 0o666) # cross-user bridge
return target
def read_completion(operation_id: str) -> dict | None:
"""Read a durable completion file. Returns None if absent."""
p = completion_path(operation_id)
if not p.is_file():
return None
try:
return json.loads(p.read_text())
except (OSError, ValueError):
return None
def completion_exists(operation_id: str) -> bool:
return completion_path(operation_id).is_file()
def _inotify_init_and_add_watch(directory: str) -> int:
"""Create an inotify instance and add a watch on the directory.
Returns the inotify fd."""
libc = __import__("ctypes").CDLL(None, use_errno=True)
fd = libc.inotify_init()
if fd < 0:
raise OSError("inotify_init failed")
# IN_CREATE | IN_MOVED_TO: catch both direct creation and atomic rename
mask = IN_CREATE | IN_MOVED_TO
wd = libc.inotify_add_watch(fd, directory.encode(), mask)
if wd < 0:
os.close(fd)
raise OSError(f"inotify_add_watch failed for {directory}")
return fd
def _inotify_read(fd: int, timeout_secs: float | None = None) -> list[str]:
"""Read pending inotify events. Returns list of filenames that were
created/moved-to. Blocks until at least one event or timeout."""
poll = select.poll()
poll.register(fd, select.POLLIN)
events = []
buf = os.read(fd, 4096)
pos = 0
while pos < len(buf):
# struct: wd(i32), mask(u32), cookie(u32), name_len(u32)
wd, mask, cookie, name_len = struct.unpack_from("iIII", buf, pos)
pos += 16
name = buf[pos:pos + name_len].rstrip(b"\x00").decode("utf-8", "replace")
pos += name_len
if mask & (IN_CREATE | IN_MOVED_TO):
events.append(name)
return events
def wait_for_completion(operation_id: str, *,
timeout_secs: float | None = None,
poll_callback=None) -> dict | None:
"""Block until a completion file exists for this operation.
Uses inotify for zero-latency, zero-CPU wake. Falls back to
polling_callback (if provided) when inotify is unavailable.
The completion file is a WAKE SIGNAL. The caller must still verify
canonical authority after reading it.
Returns the event dict from the completion file, or None on timeout.
"""
target = completion_path(operation_id)
# 1. check-before-watch (event may have arrived before we started)
existing = read_completion(operation_id)
if existing is not None:
return existing
_resumes_dir().mkdir(parents=True, exist_ok=True)
try:
fd = _inotify_init_and_add_watch(str(_resumes_dir()))
except OSError:
# inotify unavailable: fall back to polling callback
if poll_callback:
return poll_callback(operation_id, timeout_secs)
return None
try:
# 2. re-check after watch registration (closes the race between
# the initial check and the watch being active)
existing = read_completion(operation_id)
if existing is not None:
return existing
# 3. block in kernel on inotify — zero CPU, exact latency
import select as _select
poll = _select.poll()
poll.register(fd, _select.POLLIN)
deadline = (time.monotonic() + timeout_secs) if timeout_secs else None
while True:
remaining = None
if deadline is not None:
remaining = max(0.1, deadline - time.monotonic())
if remaining <= 0.1:
return None # timeout
events = poll.poll(remaining * 1000 if remaining else None)
if not events:
continue # poll timeout, re-check
names = _inotify_read(fd)
if target.name in names:
# 4. file appeared — read it
existing = read_completion(operation_id)
if existing is not None:
return existing
# partial/corrupt: keep watching
finally:
os.close(fd)
return None
def clear_completion(operation_id: str) -> None:
"""Remove a consumed completion file (idempotent cleanup)."""
p = completion_path(operation_id)
try:
p.unlink()
except OSError:
pass
+27 -7
View File
@@ -106,12 +106,25 @@ def _fetch_status(server: str, repo: str, sha: str, token: str) -> list[dict] |
return None if data is None else data.get("statuses", [])
def _fetch_runs(server: str, repo: str, sha: str, token: str) -> list[dict] | None:
data = _get_json(f"{server}/api/v1/repos/{repo}/actions/runs?limit=50", token)
if data is None:
return None
runs = data.get("workflow_runs", data if isinstance(data, list) else [])
return [r for r in runs if str(r.get("head_sha", "")) == sha]
def _fetch_runs(server: str, repo: str, sha: str, token: str,
max_pages: int = 4) -> list[dict] | None:
"""H-PATCH: paginate the runs list. The repo's scheduled merge-robot
runs flood the first page (~50 slots exhaust within hours), pushing
older-but-relevant SHAs to later pages — the cause of the observed
authority flapping (terminal commit read as pending). Paginate until
the sha is found or max_pages exhausted."""
out: list[dict] = []
for page in range(1, max_pages + 1):
data = _get_json(
f"{server}/api/v1/repos/{repo}/actions/runs?limit=50&page={page}",
token)
if data is None:
return None if page == 1 else (out or None)
runs = data.get("workflow_runs", data if isinstance(data, list) else [])
out.extend(r for r in runs if str(r.get("head_sha", "")) == sha)
if len(runs) < 50:
break # exhausted
return out
def _fetch_jobs(server: str, repo: str, run_id, token: str) -> list[dict] | None:
@@ -132,10 +145,17 @@ def main() -> int:
# not export GITEA_SERVER/GITEA_REPO (CI always exports them; local
# and first-class-tool consumers previously got a silent "pending"
# verdict — a wrong answer, not a fail-closed one).
# H-PATCH H4: the target sha arrives EXPLICITLY (--sha) from callers
# that hold structured operation state. DEPLOY_SHA env remains only
# for standalone/workflow backward compat — the canonical path never
# depends on ambient env for operation identity.
ap = __import__("argparse").ArgumentParser()
ap.add_argument("--sha", dest="sha_arg", default=None)
args, _unknown = ap.parse_known_args()
server = (os.environ.get("GITEA_SERVER", "")
or gitea_auth.DEFAULT_SERVER).rstrip("/")
repo = os.environ.get("GITEA_REPO", "") or gitea_auth.DEFAULT_REPO
sha = os.environ.get("DEPLOY_SHA", "")
sha = args.sha_arg or os.environ.get("DEPLOY_SHA", "")
token = gitea_auth.get_token() if gitea_auth.has_token() else ""
if not (server and repo and sha and token):
print("pending") # missing config → cannot verify → not qualified
+143
View File
@@ -0,0 +1,143 @@
#!/usr/bin/env python3
"""deploy_rust_build.py — #2455: the Rust cores ship as BINARIES, not sources.
Builds every Rust cdylib CI builds into the STAGED deployment tree (in-tree
target/release, exactly where the Python loaders look by default) and
smoke-checks one FFI operation per crate — BEFORE the symlink flips. The
deployed runtime then takes the Rust core by default instead of silently
running the Python fallbacks; the strangler's hardening/speed point finally
materializes in production.
Smoke tiers (honest, per crate):
- symbol: CDLL-load the staged cdylib and resolve the crate's loader entry
symbol (dlsym IS an FFI operation; proves the ELF links and exports).
- call: a REAL FFI call through the staged loader itself (token_counting:
tc_estimate_tokens({"text": ...}) -> int). One end-to-end call proves the
full load path in the deployed revision.
Toolchain law (carried from ci.yml): rustup toolchain PATH-first (system
rustc is broken on this host — LLVM version-node symbol gap); builds run
in-tree so the cdylib lands at <crate>/target/release/lib<crate>.so.
Exit 0 = built + smoked; 1 = any failure (deploy_stage refuses promotion).
RUNE_DEPLOY_SKIP_RUST=1 is the documented emergency bypass — the deploy then
ships Python fallbacks as before and says so.
"""
from __future__ import annotations
import argparse
import ctypes
import json
import os
import subprocess
import sys
from pathlib import Path
RUSTUP_BIN = "/home/nick/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin"
# (crate, loader entry symbol, real-call payload or None)
CRATES: list[tuple[str, str, dict | None]] = [
("evidence_provenance", "ep_compute_hash", None),
("rune_spine", "sp_project", None),
("memory_scoring", "ms_compute_value", None),
("capability_scoring", "cs_score_card", None),
("token_counting", "tc_estimate_tokens", {"text": "ffi deploy smoke"}),
("scaffold_core", "sc_check_transition", None),
("memory_storage", "mems_read_query", None),
("memory_retrieval", "mr_call", None),
("cognition_core", "cc_default_budget", None),
("route_risk_flags", "rrf_detect", None),
("construction_interface", "ci_validate", None),
]
def _lib_path(staged_src: Path, crate: str) -> Path:
return staged_src / "rust" / crate / "target" / "release" / f"lib{crate}.so"
def build_all(staged_src: Path) -> list[str]:
built: list[str] = []
env = dict(os.environ)
env["PATH"] = f"{RUSTUP_BIN}:{env.get('PATH', '')}"
env.pop("CARGO_TARGET_DIR", None) # in-tree targets: the loaders' default path
for crate, _sym, _payload in CRATES:
manifest = staged_src / "rust" / crate / "Cargo.toml"
if not manifest.exists():
raise RuntimeError(f"{crate}: no Cargo.toml in the staged tree")
r = subprocess.run(
["cargo", "build", "--release", "--manifest-path", str(manifest)],
capture_output=True,
text=True,
env=env,
timeout=600,
)
if r.returncode != 0:
raise RuntimeError(f"{crate}: cargo build failed:\n{r.stderr[-600:]}")
lib = _lib_path(staged_src, crate)
if not lib.exists() or lib.stat().st_size < 1024:
raise RuntimeError(f"{crate}: cdylib missing or implausibly small after build: {lib}")
built.append(crate)
print(f" BUILT {crate}: {lib.stat().st_size} bytes")
return built
def smoke_all(staged_src: Path) -> list[str]:
smoked: list[str] = []
for crate, sym, payload in CRATES:
lib = ctypes.CDLL(str(_lib_path(staged_src, crate)))
fn = getattr(lib, sym) # dlsym: the FFI surface exists
fn.restype = ctypes.c_void_p # char* — never default c_int (loader law)
if payload is not None:
_real_call(staged_src, crate, payload)
print(f" SMOKED {crate}: symbol {sym} + real FFI call")
else:
print(f" SMOKED {crate}: symbol {sym} resolved")
smoked.append(crate)
return smoked
def _real_call(staged_src: Path, crate: str, payload: dict) -> None:
"""Call the entry symbol directly with the loader's exact convention:
argtypes c_char_p, restype c_void_p (char* — never default c_int), read
the returned JSON envelope, free via <prefix>_free_string."""
lib = ctypes.CDLL(str(_lib_path(staged_src, crate)))
fn = getattr(lib, "tc_estimate_tokens")
fn.argtypes = [ctypes.c_char_p]
fn.restype = ctypes.c_void_p
raw = json.dumps(payload).encode("utf-8")
ptr = fn(raw)
if not ptr:
raise RuntimeError(f"{crate}: FFI call returned NULL")
text = ctypes.cast(ptr, ctypes.c_char_p).value or b""
getattr(lib, "tc_free_string")(ctypes.c_void_p(ptr))
env = json.loads(text.decode("utf-8"))
tokens = env.get("value", env.get("tokens")) if isinstance(env, dict) else env
if not isinstance(tokens, int) or tokens <= 0:
raise RuntimeError(f"{crate}: implausible FFI result: {text!r}")
def main() -> int:
ap = argparse.ArgumentParser()
ap.add_argument("--staged", required=True, help="the staged tree (tmp_stage), pre-promotion")
args = ap.parse_args()
staged_src = Path(args.staged) / "src"
print("RUST CORES INTO THE DEPLOYED REVISION (#2455)")
built = build_all(staged_src)
smoked = smoke_all(staged_src)
missing = {c for c, *_ in CRATES} - set(smoked)
if missing:
raise RuntimeError(f"smoke coverage gap: {sorted(missing)}")
print(f"OK: {len(built)} crates built into the staged revision, {len(smoked)} FFI-smoked")
return 0
if __name__ == "__main__":
try:
raise SystemExit(main())
except SystemExit:
raise
except Exception as e: # noqa: BLE001 — terminal reporter: prints the failure and exits 1 (never silent)
print(f"deploy_rust_build: {e}", file=sys.stderr)
raise SystemExit(1)
+20
View File
@@ -184,6 +184,26 @@ print("VERIFIED:", json.dumps(info))
shutil.rmtree(tmp_stage, ignore_errors=True)
return 1
# --- Rust cores into the staged revision (#2455) ---------------------
# The Rust cores ship as BINARIES, not sources: build every cdylib CI
# builds into the staged tree (in-tree target/release — the loaders'
# default path) and FFI-smoke each BEFORE the symlink flips, so the
# deployed runtime takes the Rust core by default instead of silently
# running the Python fallbacks. RUNE_DEPLOY_SKIP_RUST=1 is the documented
# emergency bypass (the deploy then ships fallbacks and says so).
if os.environ.get("RUNE_DEPLOY_SKIP_RUST") == "1":
print("Rust phase SKIPPED (RUNE_DEPLOY_SKIP_RUST=1) — staged revision runs Python fallbacks")
else:
rust = subprocess.run(
[sys.executable, str(repo / "scripts" / "deploy_rust_build.py"), "--staged", str(tmp_stage)],
capture_output=True, text=True, timeout=7200,
)
print(rust.stdout.strip())
if rust.returncode != 0:
print("RUST BUILD/SMOKE FAILED — deployment refused:\n" + rust.stderr[-800:], file=sys.stderr)
shutil.rmtree(tmp_stage, ignore_errors=True)
return 1
# --- TUI startup canary (handoff 2026-09-10 §4): the ACTUAL
# RuneApp initialization must succeed before promotion. A staged
# revision whose TUI cannot initialize never becomes current.
+286
View File
@@ -0,0 +1,286 @@
#!/usr/bin/env python3
"""dichotomy_audit.py — the honest completion instrument for the dichotomy rebase.
Function-level, not directory-level: a module counts as covered only when its
PYTHON FUNCTIONS have identifiable counterparts in the Go/Rust implementation.
A Go directory with 3 structs and none of the module's 70 functions is a
facade, and this audit names it as one.
Matching rule (name-preserving ports): a Python function name matches when
its snake_case form, or its Go/Rust camelCase/PascalCase form, appears in the
candidate implementation sources. Deliberately strict — novel Go names that
don't echo the Python names do NOT count, because unverifiable "trust me,
it's in there somewhere" is exactly the failure mode this instrument exists
to kill.
Usage: python3 scripts/dichotomy_audit.py [--write]
--write regenerates docs/dichotomy-rebase-honest-audit.md
"""
from __future__ import annotations
import ast
import json
import re
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
SRC = ROOT / "src" / "rune"
GO = ROOT / "src" / "go"
RUST = ROOT / "src" / "rust"
REPORT = ROOT / "docs" / "dichotomy-rebase-honest-audit.md"
CLASSIFICATION = ROOT / "store" / "rebase" / "classification.json"
TEST_PREFIXES = ("test_",)
# Modules that stay Python by decision (test infra stays pytest)
TEST_INFRA = {
"conftest", "test_truth", "test_adaptive_router", "test_canaries",
}
RETIRES = {"memory_env", "__main__"}
def snake_to_camel(name: str) -> list[str]:
"""Candidate identifier forms for a Python name in Go/Rust sources."""
parts = name.split("_")
camel = parts[0] + "".join(p.capitalize() for p in parts[1:])
pascal = "".join(p.capitalize() for p in parts)
return [name, camel, pascal]
def module_functions(path: Path) -> list[str]:
"""Every function and method name defined in the module."""
try:
tree = ast.parse(path.read_text(encoding="utf-8", errors="replace"))
except SyntaxError:
return []
names = []
for node in ast.walk(tree):
if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)):
if node.name.startswith("__") and node.name.endswith("__"):
continue # dunders are runtime machinery, not port surface
names.append(node.name)
return names
def load_classification() -> dict:
if CLASSIFICATION.exists():
return json.loads(CLASSIFICATION.read_text())
return {}
def implementation_corpus() -> dict[str, str]:
"""module-kebab -> concatenated Go/Rust source text for that module."""
corpus: dict[str, str] = {}
for d in sorted(GO.iterdir()):
if not d.is_dir():
continue
chunks = []
for f in d.rglob("*.go"):
if f.name.endswith("_test.go"):
continue
chunks.append(f.read_text(encoding="utf-8", errors="replace"))
if chunks:
corpus[d.name] = "\n".join(chunks)
# Survivor packages (per-crate Go membranes under cognition/)
cog = GO / "cognition"
if cog.exists():
for d in sorted(cog.iterdir()):
if d.is_dir():
chunks = [f.read_text(encoding="utf-8", errors="replace")
for f in d.rglob("*.go") if not f.name.endswith("_test.go")]
if chunks:
corpus[f"cognition-{d.name}"] = "\n".join(chunks)
for d in sorted(RUST.iterdir()):
src = d / "src"
if src.exists():
chunks = [f.read_text(encoding="utf-8", errors="replace")
for f in src.rglob("*.rs")]
if chunks:
corpus[d.name] = "\n".join(chunks)
return corpus
def module_to_keys(module_stem: str) -> list[str]:
"""Candidate implementation keys for a Python module stem."""
kebab = module_stem.replace("_", "-")
keys = [kebab, module_stem]
# Deep ports and multi-module binaries register aliases:
aliases = {
"rune_operator": ["operator", "operator-deep", "operator-support", "core-server"],
"rune_tui": ["tui"],
"rune_operator_cli": ["operator"],
"memory_store": ["memory-ops", "memory-store-deep"],
"warm_router": ["warm-router", "operator-support"],
"tool_executor": ["tool-executor", "local-tool-runtime", "tool-protocol", "tool-protocol-rw"],
"local_tool_runtime": ["local-tool-runtime", "operator"],
"provider_registry": ["provider-registry", "model-connect"],
"adaptive_router": ["adaptive-router", "operator-support"],
"hook_engine": ["hook-engine"],
"event_bus": ["event-bus"],
"event_envelope": ["event-bus"],
"message_queue": ["message-queue"],
"subsystem_health": ["subsystem-health"],
"parallel_processor": ["parallel-processor"],
"connection_pool": ["connection-pool"],
"recall_router": ["recall-router"],
"cron_engine": ["cron-engine"],
"cache": ["cache"],
"night_mode": ["night-mode"],
"work_manager": ["work-manager"],
"failure_auto_filer": ["failure-filer"],
"microkernel": ["microkernel"],
"construction_interface": ["cognition-cognition", "cognition"],
"construction_decision": ["cognition-cognition", "cognition"],
"rune_spine": ["cognition-spine", "cognition"],
"spine": ["cognition-spine", "cognition"],
"memory_storage": ["cognition-storage", "cognition"],
"memory_retrieval": ["cognition-retrieval", "cognition"],
"scaffold_core": ["cognition-scaffold", "cognition"],
"evidence_provenance": ["cognition-provenance", "cognition"],
"memory_scoring": ["cognition-scoring", "cognition"],
"capability_scoring": ["cognition-capability", "cognition"],
"token_counting": ["cognition-token", "cognition"],
"query_memory": ["cognition-query", "cognition"],
}
if module_stem in aliases:
keys = aliases[module_stem] + keys
# cognition_core broker.rs hosts many kernels
if module_stem in {
"tier_manager", "safety_override", "pins", "identity_anchors",
"abstraction", "growth_delta", "witness", "persona_gate",
"memory_consolidation", "drift_compression", "context_broker",
"persona_definition", "goal",
}:
keys.append("cognition_core")
keys.append("cognition-cognition")
return keys
def audit() -> dict:
classification = load_classification()
corpus = implementation_corpus()
rows = []
for path in sorted(SRC.glob("*.py")):
stem = path.stem
if stem in RETIRES:
rows.append({"module": stem, "lines": len(path.read_text(errors='replace').splitlines()),
"fns": 0, "matched": 0, "side": "RETIRES", "status": "RETIRES", "missing": []})
continue
if stem.startswith(TEST_PREFIXES) or stem in TEST_INFRA:
rows.append({"module": stem, "lines": len(path.read_text(errors='replace').splitlines()),
"fns": 0, "matched": 0, "side": "TEST", "status": "TEST", "missing": []})
continue
fns = module_functions(path)
lines = len(path.read_text(errors="replace").splitlines())
entry = classification.get(stem) or classification.get(path.name) or {}
side = entry.get("side", entry.get("language", "unclassified"))
sources = []
for key in module_to_keys(stem):
if key in corpus:
sources.append(corpus[key])
blob = "\n".join(sources)
matched, missing = 0, []
for fn in fns:
hits = any(cand in blob for cand in snake_to_camel(fn))
if hits:
matched += 1
else:
missing.append(fn)
ratio = matched / len(fns) if fns else (1.0 if lines < 30 else 0.0)
if stem in RETIRES:
status = "RETIRES"
elif not blob:
status = "NOT TOUCHED"
elif ratio >= 0.8:
status = "FULL"
elif ratio >= 0.2:
status = "PARTIAL"
else:
status = "NOT TOUCHED"
rows.append({"module": stem, "lines": lines, "fns": len(fns),
"matched": matched, "side": side, "status": status, "missing": missing[:12]})
return {"rows": rows}
def summarize(result: dict) -> str:
rows = result["rows"]
runtime = [r for r in rows if r["status"] not in ("TEST", "RETIRES")]
full = [r for r in runtime if r["status"] == "FULL"]
partial = [r for r in runtime if r["status"] == "PARTIAL"]
untouched = [r for r in runtime if r["status"] == "NOT TOUCHED"]
total_fns = sum(r["fns"] for r in runtime)
total_matched = sum(r["matched"] for r in runtime)
total_lines = sum(r["lines"] for r in runtime)
fn_pct = 100 * total_matched / total_fns if total_fns else 0
out = []
out.append("# DICHOTOMY REBASE — HONEST AUDIT (function-level)")
out.append("")
out.append("_Regenerate with `python3 scripts/dichotomy_audit.py --write`. A module is FULL only when 80%+ of its Python functions have name-preserving counterparts in the Go/Rust implementation — directories without the functions are facades and count as NOT TOUCHED._")
out.append("")
out.append(f"**Function-level completion: {fn_pct:.0f}%** ({total_matched}/{total_fns} runtime functions matched)")
out.append("")
out.append("| Status | Modules | Lines | Meaning |")
out.append("|---|---|---|---|")
out.append(f"| FULL | {len(full)} | {sum(r['lines'] for r in full)} | 80%+ of functions ported |")
out.append(f"| PARTIAL | {len(partial)} | {sum(r['lines'] for r in partial)} | 20–80% — real logic exists, gaps named below |")
out.append(f"| NOT TOUCHED | {len(untouched)} | {sum(r['lines'] for r in untouched)} | no name-preserving implementation |")
out.append(f"| Total runtime | {len(runtime)} | {total_lines} | |")
out.append("")
if untouched:
out.append("## NOT TOUCHED — the port queue, in priority order (largest first)")
out.append("")
out.append("| Module | Lines | Fns | Side |")
out.append("|---|---|---|---|")
for r in sorted(untouched, key=lambda r: -r["lines"]):
out.append(f"| {r['module']} | {r['lines']} | {r['fns']} | {r['side']} |")
out.append("")
if partial:
out.append("## PARTIAL — gaps to close (matched/total fns; first missing named)")
out.append("")
out.append("| Module | Lines | Coverage | Missing (first named) |")
out.append("|---|---|---|---|")
for r in sorted(partial, key=lambda r: -(r["fns"] - r["matched"])):
miss = ", ".join(r["missing"][:6]) if r["missing"] else "(structural)"
out.append(f"| {r['module']} | {r['lines']} | {r['matched']}/{r['fns']} | {miss} |")
out.append("")
out.append("## FULL — ported, parity-gated")
out.append("")
out.append("| Module | Lines | Fns | Side |")
out.append("|---|---|---|---|")
for r in sorted(full, key=lambda r: -r["lines"]):
out.append(f"| {r['module']} | {r['lines']} | {r['matched']}/{r['fns']} | {r['side']} |")
out.append("")
return "\n".join(out)
def main() -> int:
write = "--write" in sys.argv
result = audit()
report = summarize(result)
if write:
REPORT.write_text(report)
print(f"written: {REPORT}")
# stderr summary for the session log
rows = result["rows"]
runtime = [r for r in rows if r["status"] not in ("TEST", "RETIRES")]
tf = sum(r["fns"] for r in runtime)
tm = sum(r["matched"] for r in runtime)
print(f"FUNCTION-LEVEL: {tm}/{tf} ({100*tm/tf if tf else 0:.0f}%) | "
f"FULL {sum(1 for r in runtime if r['status']=='FULL')} | "
f"PARTIAL {sum(1 for r in runtime if r['status']=='PARTIAL')} | "
f"NOT TOUCHED {sum(1 for r in runtime if r['status']=='NOT TOUCHED')}")
return 0
if __name__ == "__main__":
raise SystemExit(main())
+181
View File
@@ -0,0 +1,181 @@
#!/usr/bin/env python3
"""finance_tracker.py — #3: track Nick's finances, surface waste and opportunity.
Nick has no disposable income; every penny matters. This is a zero-dependency
(stdlib-only) tracker:
add — record an expense or income entry into the CSV ledger
budget — set a monthly category limit
report — per-category totals vs budgets, income vs spend, for a month
or the last 7 days; recurring payments (same note, ~monthly,
3+ occurrences) are flagged as SUBSCRIPTION candidates
Storage: ~/.rune/finance/ledger.csv + budgets.json (human-readable, portable,
yours — no database, no cloud, no lock-in).
finance_tracker.py add -30.00 groceries "weekly shop"
finance_tracker.py add 1450.00 salary "October pay"
finance_tracker.py budget groceries 260
finance_tracker.py report --month 2026-10
finance_tracker.py report --week
"""
from __future__ import annotations
import argparse
import csv
import json
import os
import sys
from collections import defaultdict
from datetime import date, datetime, timedelta
from pathlib import Path
FINANCE_DIR = Path(os.environ.get("RUNE_FINANCE_DIR", Path.home() / ".rune" / "finance"))
LEDGER = FINANCE_DIR / "ledger.csv"
BUDGETS = FINANCE_DIR / "budgets.json"
FIELDS = ["date", "amount", "category", "note", "kind"] # kind: in | out
def _ensure() -> None:
FINANCE_DIR.mkdir(parents=True, exist_ok=True)
if not LEDGER.exists():
with open(LEDGER, "w", newline="", encoding="utf-8") as f:
csv.writer(f).writerow(FIELDS)
def add(amount: float, category: str, note: str = "", kind: str | None = None, when: str | None = None) -> dict:
"""Record one entry. Negative amount = expense, positive = income (unless
kind forces it). Returns the stored row."""
_ensure()
if kind is None:
kind = "out" if amount < 0 else "in"
amount = abs(amount)
row = {
"date": when or date.today().isoformat(),
"amount": f"{amount:.2f}",
"category": category.strip().lower(),
"note": note.strip(),
"kind": kind,
}
with open(LEDGER, "a", newline="", encoding="utf-8") as f:
csv.DictWriter(f, fieldnames=FIELDS).writerow(row)
return row
def set_budget(category: str, monthly_limit: float) -> dict:
_ensure()
budgets = {}
if BUDGETS.exists():
budgets = json.loads(BUDGETS.read_text())
budgets[category.strip().lower()] = round(monthly_limit, 2)
BUDGETS.write_text(json.dumps(budgets, indent=2, sort_keys=True))
return budgets
def _rows() -> list[dict]:
_ensure()
with open(LEDGER, newline="", encoding="utf-8") as f:
return [r for r in csv.DictReader(f) if r.get("date")]
def find_subscriptions(rows: list[dict] | None = None) -> list[dict]:
"""Recurring payments: same normalized note (or category+note), same-ish
amount, 3+ occurrences with ~monthly spacing. These are the
cancellation-review candidates."""
rows = rows if rows is not None else _rows()
groups: dict[str, list[dict]] = defaultdict(list)
for r in rows:
if r["kind"] != "out":
continue
key = (r["note"] or r["category"]).strip().lower()
groups[key].append(r)
subs = []
for key, items in groups.items():
if len(items) < 3:
continue
items.sort(key=lambda r: r["date"])
gaps = [
(datetime.fromisoformat(items[i + 1]["date"]) - datetime.fromisoformat(items[i]["date"])).days
for i in range(len(items) - 1)
]
if gaps and all(20 <= g <= 45 for g in gaps):
amounts = {float(i["amount"]) for i in items}
subs.append(
{
"note": key,
"occurrences": len(items),
"monthly": sorted(amounts)[-1],
"first": items[0]["date"],
"last": items[-1]["date"],
}
)
subs.sort(key=lambda s: -s["monthly"])
return subs
def report(month: str | None = None, week: bool = False) -> dict:
"""Per-category totals vs budgets + income vs spend + subscription flags."""
rows = _rows()
if week:
start = (date.today() - timedelta(days=7)).isoformat()
rows = [r for r in rows if r["date"] >= start]
elif month:
rows = [r for r in rows if r["date"].startswith(month)]
income = sum(float(r["amount"]) for r in rows if r["kind"] == "in")
spend = sum(float(r["amount"]) for r in rows if r["kind"] == "out")
by_cat: dict[str, float] = defaultdict(float)
for r in rows:
if r["kind"] == "out":
by_cat[r["category"]] += float(r["amount"])
budgets = json.loads(BUDGETS.read_text()) if BUDGETS.exists() else {}
over = [
{"category": c, "spent": round(s, 2), "budget": budgets[c], "over_by": round(s - budgets[c], 2)}
for c, s in sorted(by_cat.items())
if c in budgets and s > budgets[c]
]
return {
"income": round(income, 2),
"spend": round(spend, 2),
"net": round(income - spend, 2),
"by_category": {c: round(v, 2) for c, v in sorted(by_cat.items(), key=lambda kv: -kv[1])},
"over_budget": over,
"subscription_candidates": find_subscriptions(rows),
"entries": len(rows),
}
def main() -> int:
ap = argparse.ArgumentParser(description="#3: finances — every penny matters")
sub = ap.add_subparsers(dest="cmd", required=True)
p_add = sub.add_parser("add")
p_add.add_argument("amount", type=float)
p_add.add_argument("category")
p_add.add_argument("note", nargs="?", default="")
p_add.add_argument("--kind", choices=["in", "out"])
p_add.add_argument("--date", dest="when")
p_b = sub.add_parser("budget")
p_b.add_argument("category")
p_b.add_argument("limit", type=float)
p_r = sub.add_parser("report")
p_r.add_argument("--month", help="YYYY-MM")
p_r.add_argument("--week", action="store_true")
args = ap.parse_args()
if args.cmd == "add":
row = add(args.amount, args.category, args.note, args.kind, args.when)
print(f"recorded: {row['kind']} {row['amount']} on {row['category']} ({row['date']})")
elif args.cmd == "budget":
b = set_budget(args.category, args.limit)
print(f"budgets: {json.dumps(b, sort_keys=True)}")
elif args.cmd == "report":
r = report(args.month, args.week)
print(json.dumps(r, indent=2))
return 0
if __name__ == "__main__":
raise SystemExit(main())
+164
View File
@@ -0,0 +1,164 @@
#!/usr/bin/env python3
"""forge_board.py — #204: the forge as the single pipeline state machine.
Reads the forge's OWN state (open issues, labels, CI status on each head)
and derives the next action per issue. No agent memory involved: any agent
(or a crashed-and-replaced session) runs this and knows what happens next.
Derivation rules (deterministic, zero tokens):
1. issue carries `blocked` -> BLOCKED (say on what, from the body)
2. head has failing CI -> FIX FIRST (fault-watch contract)
3. head has pending CI -> WAITING (subject + ETA shape)
4. issue carries `awaiting-review`-> REVIEW (reviewer gates decide)
5. no linked work (no contract) -> OPEN CONTRACT (scaffolding is absolute)
6. otherwise -> IMPLEMENT per the body's acceptance
Exit codes: 0 = board read; 1 = forge unreachable; 2 = no open issues
(the factory's only other legal stop).
"""
from __future__ import annotations
import argparse
import json
import sys
from typing import Any, Callable, Dict, List, Optional
Fetch = Callable[[str], Optional[Dict[str, Any]]]
BLOCKED_LABELS = {"blocked", "waiting-on-user", "on-hold"}
REVIEW_LABELS = {"awaiting-review", "in-review", "review-required"}
CI_PENDING = {"pending", "running", "unknown"}
CI_FAILED = {"failure", "cancelled"}
def derive_next_action(issue: Dict[str, Any], ci_state: Optional[Dict[str, Any]]) -> Dict[str, Any]:
"""Pure derivation: forge state in, next action out. No network, no memory."""
labels = {l.get("name", "") for l in issue.get("labels", [])}
num = issue.get("number")
title = issue.get("title", "")
if labels & BLOCKED_LABELS:
return {
"issue": num,
"title": title,
"action": "BLOCKED",
"why": "carries a blocking label; unblock before the queue touches it",
}
if ci_state:
verdict = ci_state.get("verdict")
if verdict in CI_FAILED:
return {
"issue": num,
"title": title,
"action": "FIX FIRST",
"why": f"CI on head {ci_state.get('sha', '?')[:8]} is {verdict}; the fault-watch contract fixes the submit before the queue resumes",
}
if verdict in CI_PENDING:
return {
"issue": num,
"title": title,
"action": "WAITING",
"why": f"CI on head {ci_state.get('sha', '?')[:8]} is {verdict}; factory multiplexes the next batch meanwhile",
}
if labels & REVIEW_LABELS:
return {
"issue": num,
"title": title,
"action": "REVIEW",
"why": "awaiting reviewer gates (spec-compliance + code-quality)",
}
body = issue.get("body") or ""
if "BUILDER-" in body:
return {
"issue": num,
"title": title,
"action": "CONTINUE CONTRACT",
"why": "a construction contract is already linked in the body",
}
return {
"issue": num,
"title": title,
"action": "OPEN CONTRACT",
"why": "no linked work in the body; scaffolding is absolute — contract first",
}
def read_board(
fetch: Fetch, owner: str = "conductor", repo: str = "rune", base: str = "http://127.0.0.1:3000/api/v1"
) -> Dict[str, Any]:
"""Pull open issues + CI state from the forge and derive the board."""
raw = fetch(f"{base}/repos/{owner}/{repo}/issues?state=open&limit=50")
if raw is None:
raise RuntimeError("forge unreachable")
issues = raw if isinstance(raw, list) else raw.get("data", [])
board: List[Dict[str, Any]] = []
for issue in issues:
sha = _head_sha_from_labels(issue) or _head_sha_from_body(issue)
ci_state = None
if sha:
status = fetch(f"{base}/repos/{owner}/{repo}/commits/{sha}/status")
if status:
ci_state = {"sha": sha, "verdict": status.get("state", "unknown")}
board.append(derive_next_action(issue, ci_state))
order = {"FIX FIRST": 0, "CONTINUE CONTRACT": 1, "OPEN CONTRACT": 2, "REVIEW": 3, "WAITING": 4, "BLOCKED": 5}
board.sort(key=lambda r: (order.get(r["action"], 9), r["issue"] or 0))
return {"repo": f"{owner}/{repo}", "open": len(board), "board": board}
def _head_sha_from_labels(issue: Dict[str, Any]) -> Optional[str]:
for l in issue.get("labels", []):
name = l.get("name", "")
if name.startswith("head:"):
return name.split("head:", 1)[1].strip()
return None
def _head_sha_from_body(issue: Dict[str, Any]) -> Optional[str]:
import re
m = re.search(r"\b([0-9a-f]{40})\b", issue.get("body") or "")
return m.group(1) if m else None
def _default_fetch(url: str) -> Optional[Any]:
try:
import urllib.request
sys.path.insert(0, "/home/nick/.config/opencode/shared")
from gitea_auth import load_gitea_token
req = urllib.request.Request(url, headers={"Authorization": f"token {load_gitea_token()}"})
with urllib.request.urlopen(req, timeout=10) as r:
return json.load(r)
except Exception: # noqa: BLE001 — fetcher probe: unreachability is reported upstream as a hard error (read_board raises)
return None
def main() -> int:
ap = argparse.ArgumentParser(description="#204 forge board: the next action, from forge state alone")
ap.add_argument("--json", action="store_true", help="machine-readable output")
args = ap.parse_args()
try:
board = read_board(_default_fetch)
except RuntimeError as e:
print(f"forge_board: {e}", file=sys.stderr)
return 1
if args.json:
print(json.dumps(board, indent=2))
else:
print(f"== FORGE BOARD {board['repo']} — {board['open']} open ==")
for row in board["board"]:
print(f" #{row['issue']} [{row['action']}] {row['title'][:60]} — {row['why']}")
if board["open"] == 0:
return 2
return 0
if __name__ == "__main__":
raise SystemExit(main())
+111
View File
@@ -0,0 +1,111 @@
import json, sys
sys.path.insert(0, 'src')
from rune.adaptive_router import (
classify_route, derive_sufficiency, body_has_floor_trigger, floor_applies,
escalate_route, downgrade_route, escalate_on_verification_failure,
build_research_dispatch, FloorViolation,
)
cases = []
ESC_EVIDENCE = "the fix works locally but the production parser accepts different input shapes — input contract uncertain"
cr_cases = [
("local_fix_happy", "fix the broken typewriter regex in warm_router, crash on empty input",
dict(has_local_repro=True, owning_authority_known=True, testable_locally=True, narrow_and_reversible=True)),
("standard_change", "add a progress bar to the export dialog",
dict(has_local_repro=True, owning_authority_known=True, testable_locally=True, narrow_and_reversible=True)),
("defect_word_absent", "update the version number in the footer",
dict(has_local_repro=True, owning_authority_known=True, testable_locally=False, narrow_and_reversible=True)),
("floor_new_subsystem", "adopt a new subsystem for memory indexing, replacement of spine",
dict(has_local_repro=False, owning_authority_known=False)),
("risk_new_authority", "this creates a new authority path for dispatch",
dict(has_local_repro=False, owning_authority_known=False)),
("uncertainty_competing", "there are competing designs here, expensive reversal likely",
dict(has_local_repro=True, owning_authority_known=True)),
("not_grounded", "add support for markdown export",
dict(has_local_repro=False, owning_authority_known=True, testable_locally=True, narrow_and_reversible=True)),
("inspection_verb", "explain why the failing test fails",
dict(has_local_repro=True, owning_authority_known=True, testable_locally=True, narrow_and_reversible=True)),
]
for name, body, kw in cr_cases:
d = classify_route(body, **kw)
cases.append({"fn": "classify", "name": name,
"input": {"body": body, **kw, "pipeline_sha": "UNKNOWN"},
"expected": {"route": d.route, "confidence": d.confidence, "reasons": d.reasons,
"risk": d.risk_flags, "uncertainty": d.uncertainty_flags,
"floor": d.floor, "task_description": d.task_description}})
ds_cases = [
("grounded_fix", "fix crash", "the parser crashes on empty input, see tests/test_parse.py"),
("mechanism", "investigate", "performance is bad under load, benchmark needed"),
("external_url", "read the docs", "see https://example.com/api docs for the endpoint"),
("version_risk", "upgrade", "upgrade the library to latest version, current behaviour differs"),
("inspection", "explain", "why does this happen"),
("new_subsystem", "adopt", "this adopts a replacement architecture"),
("neutral", "write", "a poem about the sea"),
]
for name, title, body in ds_cases:
s = derive_sufficiency(title, body)
cases.append({"fn": "derive", "name": name,
"input": {"title": title, "body": body, "ambiguous": False},
"expected": {"local_authority": s.local_authority,
"external_dependency": s.external_dependency,
"version_freshness_risk": s.version_freshness_risk,
"verifiability": s.verifiability, "scope_novelty": s.scope_novelty,
"unknowns": s.unknowns(),
"task_class": s.provenance.get("task_class_language")}})
cases.append({"fn": "floor_trigger", "name": "trigger_yes",
"input": {"body": "adopt a replacement for the cache"},
"expected": {"result": body_has_floor_trigger("adopt a replacement for the cache")}})
cases.append({"fn": "floor_trigger", "name": "trigger_no",
"input": {"body": "fix the typo"},
"expected": {"result": body_has_floor_trigger("fix the typo")}})
cases.append({"fn": "floor_applies", "name": "res_yes", "input": {"route": "RESEARCHED_CHANGE", "flags": ["new_authority"]},
"expected": {"result": floor_applies("RESEARCHED_CHANGE", ["new_authority"])}})
cases.append({"fn": "floor_applies", "name": "local_no", "input": {"route": "LOCAL_FIX", "flags": ["new_authority"]},
"expected": {"result": floor_applies("LOCAL_FIX", ["new_authority"])}})
base = classify_route("fix the crash", has_local_repro=True, owning_authority_known=True,
testable_locally=True, narrow_and_reversible=True)
esc = escalate_route(base, "RESEARCHED_CHANGE", "verify_fail", ESC_EVIDENCE)
cases.append({"fn": "escalate", "name": "esc",
"input": {"decision_route": base.route, "new_route": "RESEARCHED_CHANGE",
"trigger": "verify_fail", "evidence": ESC_EVIDENCE},
"expected": {"route": esc.route, "previous": esc.previous_route,
"decided_by": esc.decided_by, "trigger": esc.trigger}})
try:
downgrade_route(base, "STANDARD_CHANGE", "try", "ev")
cases.append({"fn": "downgrade", "name": "dg_ok", "input": {"base_route": base.route, "base_floor": False,
"new_route": "STANDARD_CHANGE"}, "expected": {"route": "STANDARD_CHANGE", "error": None}})
except FloorViolation:
cases.append({"fn": "downgrade", "name": "dg_ok", "input": {}, "expected": {"route": None, "error": "FloorViolation"}})
floored = classify_route("adopt a replacement for the memory index")
try:
downgrade_route(floored, "STANDARD_CHANGE", "efficiency", "faster")
cases.append({"fn": "downgrade", "name": "dg_floored", "input": {"base_floor": True, "new_route": "STANDARD_CHANGE"},
"expected": {"route": "STANDARD_CHANGE", "error": None}})
except FloorViolation:
cases.append({"fn": "downgrade", "name": "dg_floored", "input": {"base_floor": True, "new_route": "STANDARD_CHANGE"},
"expected": {"route": None, "error": "FloorViolation"}})
try:
escalate_on_verification_failure(base, "test failed", "/tmp/ar_probe.jsonl")
cases.append({"fn": "evidence_short", "name": "short", "input": {"evidence": "test failed"},
"expected": {"result": "ACCEPTED"}})
except ValueError:
cases.append({"fn": "evidence_short", "name": "short", "input": {"evidence": "test failed"},
"expected": {"result": "REJECTED"}})
disp = build_research_dispatch("T-1", "research the memory index options", floored)
cases.append({"fn": "dispatch", "name": "disp",
"input": {"task_id": "T-1", "description": "research the memory index options"},
"expected": {"task_id": disp["task_id"], "title": disp["title"], "route": disp["route"],
"floor": disp["floor"], "executor_entry": disp["executor_entry"]}})
json.dump(cases, open('src/go/adaptive-router/truth.json', 'w'), indent=1)
print(f"{len(cases)} truth cases with inputs")
for c in cases:
print(f" {c['fn']:14} {c['name']}")
+115
View File
@@ -0,0 +1,115 @@
#!/usr/bin/env python3
"""gen_build_mode_truth.py — build-mode batch 1 truth battery
(contract BUILDER-2026-10-07T17:08:00Z-6e177d-unknown).
The LIVE BuildManager runs with the clock FROZEN (module-patched datetime)
and create_worktree no-op'd (reactive piece, deferred to batch 2). Cases
capture: the start_build id format, the ledger flow across phases
(including a failure + correction), resume-point scans at several states,
and the status shape. The Go replay compares state dicts key-for-key.
Usage: python3 scripts/gen_build_mode_truth.py (from repo root)
"""
import json
import sys
from datetime import datetime, timezone
from pathlib import Path
from types import SimpleNamespace
REPO = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(REPO / "src"))
from rune import build_mode as bm # noqa: E402
FROZEN = "2026-10-07T16:08:00"
FROZEN_DT = datetime(2026, 10, 7, 16, 8, 0, tzinfo=timezone.utc)
class FrozenDatetime(datetime):
@classmethod
def now(cls, tz=None):
return FROZEN_DT
def main():
# Freeze the clock (the manager reads datetime.now at two call sites)
bm.datetime = FrozenDatetime
def flow(name, steps):
"""Run a phase flow with the worktree op no-op'd; record the CALLS."""
mgr = bm.BuildManager()
mgr.create_worktree = lambda: "/nonexistent-worktree" # reactive no-op
build_id = mgr.start_build("truth battery build")
calls = []
for fn, args in steps:
fn(mgr, **args)
calls.append({"fn": fn.__name__, "args": args})
return {
"name": name,
"build_id": build_id,
"calls": calls,
"state": _jsonify(mgr.state),
"resume_point": mgr.get_resume_point(),
"can_resume": mgr.can_resume(),
"status": mgr.get_status(),
}
def step(fn, **args):
return (fn, args)
cases = [
flow("fresh_start_assess_in_progress", []),
flow("assess_complete", [
step(bm.BuildManager.complete_assess, complexity_report={"complexity": 3}),
]),
flow("through_plan", [
step(bm.BuildManager.complete_assess, complexity_report={"complexity": 3}),
step(bm.BuildManager.complete_research, findings={"findings": "dichotomy applies"}),
step(bm.BuildManager.complete_feasible, feasible=True, risk="low"),
step(bm.BuildManager.complete_consult, patterns=["oracle-battery pattern"]),
step(bm.BuildManager.complete_consent, approved=True),
step(bm.BuildManager.complete_plan, batches=[{"batch": 1, "fns": 11}]),
]),
flow("verify_with_failures", [
step(bm.BuildManager.complete_assess, complexity_report={}),
step(bm.BuildManager.complete_research, findings={}),
step(bm.BuildManager.complete_feasible, feasible=True, risk="low"),
step(bm.BuildManager.complete_consult, patterns=[]),
step(bm.BuildManager.complete_consent, approved=True),
step(bm.BuildManager.complete_plan, batches=[]),
step(bm.BuildManager.complete_build_phase, results=[{"ok": True}]),
step(bm.BuildManager.complete_verify, passed=False, failures=["test_x failed"]),
]),
flow("correction_cycle", [
step(bm.BuildManager.complete_assess, complexity_report={}),
step(bm.BuildManager.complete_research, findings={}),
step(bm.BuildManager.complete_feasible, feasible=True, risk="low"),
step(bm.BuildManager.complete_consult, patterns=[]),
step(bm.BuildManager.complete_consent, approved=True),
step(bm.BuildManager.complete_plan, batches=[{"batch": 1}]),
step(bm.BuildManager.start_correct),
step(bm.BuildManager.complete_correct, fixed=True),
]),
]
out = {
"oracle": "src/rune/build_mode.py (live BuildManager, clock frozen)",
"generated": "2026-10-07",
"frozen_now": FROZEN,
"cases": cases,
}
target = REPO / "src/go/build-mode" / "truth_buildmode.json"
target.write_text(json.dumps(out, indent=1, ensure_ascii=False) + "\n")
print(f"wrote {target} ({len(cases)} flow cases)")
def _jsonify(state):
"""asdict + the worktree path the no-op returned."""
from dataclasses import asdict
d = asdict(state)
return d
if __name__ == "__main__":
main()
+148
View File
@@ -0,0 +1,148 @@
#!/usr/bin/env python3
"""gen_build_mode_wt_truth.py — build-mode batch 2 truth battery
(contract BUILDER-2026-10-07T18:26:40Z-8be89a).
The LIVE BuildManager drives a REAL tmp git repo: create → state captured,
merge → state captured, delete → state captured. Cases carry the exact
argv sequences (from monkeypatched subprocess.run) + the state after each
op + the error texts. The Go plan layer must produce the same argv; the
Go exec harness proves the plans drive real git.
Usage: python3 scripts/gen_build_mode_wt_truth.py (from repo root)
"""
import json
import subprocess
import sys
import tempfile
from datetime import datetime, timezone
from pathlib import Path
REPO = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(REPO / "src"))
from rune import build_mode as bm # noqa: E402
FROZEN = "2026-10-07T18:28:00"
class FrozenDatetime(datetime):
@classmethod
def now(cls, tz=None):
return datetime(2026, 10, 7, 18, 28, 0, tzinfo=timezone.utc)
def main():
bm.datetime = FrozenDatetime
bm.REPO_DIR = str(make_git_repo())
calls = []
def spy_run(cmd, **kwargs):
calls.append(list(cmd))
return subprocess.CompletedProcess(cmd, 0, "", "")
bm.subprocess.run = spy_run
mgr = bm.BuildManager()
build_id = mgr.start_build("worktree battery") # create_worktree inside
create_call = calls[0]
after_create = mgr.state.worktree_path
n_before_merge = len(calls)
mgr.merge_worktree()
merge_call = calls[n_before_merge] # the merge itself
after_merge = mgr.state.worktree_path # None: delete follows the merge
delete_call = calls[n_before_merge + 1], calls[n_before_merge + 2]
cases = [
{
"fn": "plan", "name": "create",
"expected": {"argv": create_call},
},
{
"fn": "plan", "name": "merge",
"expected": {"argv": merge_call},
},
{
"fn": "plan", "name": "delete_pair",
"expected": {"argv": [list(delete_call[0]), list(delete_call[1])]},
},
{
"fn": "state", "name": "round_trip",
"expected": {
"build_id": build_id,
"after_create_is_set": after_create is not None,
"after_merge_is_none": after_merge is None,
},
},
]
# error texts: merge failure mapping
def fail_run(cmd, **kwargs):
if cmd[1] == "merge":
return subprocess.CompletedProcess(cmd, 128, "", "fatal: not something we can merge")
return subprocess.CompletedProcess(cmd, 0, "", "")
bm.subprocess.run = fail_run
mgr2 = bm.BuildManager()
mgr2.state = bm.BuildState(
build_id="20261007-182800", description="error battery",
created_at=FROZEN)
wt = "/home/nick/.rune/worktrees/20261007-182800"
mgr2.state.worktree_path = wt # merge_worktree requires a live worktree path
try:
mgr2.merge_worktree()
merge_err = None
except RuntimeError as ex:
merge_err = str(ex)
cases.append({
"fn": "error", "name": "merge_failure_text",
"expected": {"error": merge_err},
})
def fail_create(cmd, **kwargs):
if cmd[1] == "worktree":
return subprocess.CompletedProcess(cmd, 128, "", "'x' already exists")
return subprocess.CompletedProcess(cmd, 0, "", "")
bm.subprocess.run = fail_create
mgr3 = bm.BuildManager()
mgr3.state = bm.BuildState(
build_id="20261007-182800", description="error battery 2",
created_at=FROZEN)
mgr3._save_state()
try:
mgr3.create_worktree()
create_err = None
except RuntimeError as ex:
create_err = str(ex)
cases.append({
"fn": "error", "name": "create_failure_text",
"expected": {"error": create_err},
})
out = {
"oracle": "src/rune/build_mode.py (live BuildManager on a real tmp git repo, clock frozen)",
"generated": "2026-10-07",
"frozen_now": FROZEN,
"cases": cases,
}
target = REPO / "src/go/build-mode" / "truth_worktree.json"
target.write_text(json.dumps(out, indent=1, ensure_ascii=False) + "\n")
print(f"wrote {target} ({len(cases)} cases)")
def make_git_repo():
root = tempfile.mkdtemp(prefix="bm-wt-truth-")
env_realloc = subprocess.run(
["git", "init", "-q"], cwd=root, capture_output=True, text=True)
assert env_realloc.returncode == 0
subprocess.run(["git", "config", "user.email", "t@t"], cwd=root, capture_output=True)
subprocess.run(["git", "config", "user.name", "t"], cwd=root, capture_output=True)
(Path(root) / "seed.txt").write_text("seed\n")
subprocess.run(["git", "add", "."], cwd=root, capture_output=True)
subprocess.run(["git", "commit", "-qm", "seed"], cwd=root, capture_output=True)
return root
if __name__ == "__main__":
main()
+38
View File
@@ -0,0 +1,38 @@
#!/usr/bin/env python3
"""gen_cache_hash_truth.py — factory batch 6 truth battery (live cache._hash)."""
import json
import sys
from pathlib import Path
REPO = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(REPO / "src"))
sys.path.insert(0, str(REPO / "src" / "rune"))
import cache as ch # noqa: E402
def main():
cases = [
{"fn": "hash", "name": "ascii", "input": {"text": s},
"expected": {"hash": ch._hash(s)}}
for s in ["", "hello world", "unicode ümlaut ✅", "a" * 500]
]
comp_inputs = [
"",
"# comment\n\nreal line here\n====\n// slash comment\n(_source_: x)\n[source: y]\ntiny\nkeep this line too\n\n" + "z" * 900,
"line one\nline two\nline three",
"====",
"ab\ncdefgh",
]
for i, s in enumerate(comp_inputs):
cases.append({"fn": "compress", "name": f"compress_{i}",
"input": {"text": s},
"expected": {"compressed": ch._compress(s)}})
out = {"oracle": "cache._hash", "generated": "2026-10-07", "cases": cases}
(REPO / "src/go/cache" / "truth_hash.json").write_text(json.dumps(out, indent=1) + "\n")
print(f"wrote {len(cases)} cases")
if __name__ == "__main__":
main()
+161
View File
@@ -0,0 +1,161 @@
#!/usr/bin/env python3
"""gen_curator_lexicon_truth.py — regenerate the lexicon truth batteries
(contract BUILDER-2026-10-07T16:31:17Z-997c9d).
Why: batch 1's truth.json encoded the LEXICON DEGRADE — the phantom shadow
("lexicon module unavailable — strength gate only") — because
lexicon_evolution.py was absent when it was generated. The phantom has now
been recovered from provenance (commit 5749029), so the LIVE oracle returns
real lexicon verdicts and the Go port must match THEM.
What this does:
1. Rewrites ONLY the fn=='le_promote_eligible' cases inside truth.json,
regenerated against the live curator.le_promote_eligible (which now
delegates to the recovered lexicon_evolution). Other cases untouched.
2. Emits truth_lexicon.json — direct live-oracle cases for the recovered
module's full surface: coherence (conflict/consistent/novel), grounded,
distinctive_terms, promote_eligible (shared / novel-grounded /
novel-parked / no-signal / strength-gate).
Note on `existing`: the truth carries the block values as a single string;
the oracle is called with a one-element list ([existing]) — the batch-1
convention, documented here so the Go test wraps identically.
Usage: python3 scripts/gen_curator_lexicon_truth.py (from repo root)
"""
import json
import sys
from pathlib import Path
REPO = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(REPO / "src"))
sys.path.insert(0, str(REPO / "src" / "rune"))
from rune import curator # noqa: E402 — live oracle (imports lexicon_evolution)
import lexicon_evolution as le # noqa: E402
def main():
core = REPO / "src/go/curator-core"
# ── 1. regenerate the le_promote_eligible cases in truth.json ──────────
truth_path = core / "truth.json"
truth = json.loads(truth_path.read_text())
replaced = 0
for case in truth:
if case.get("fn") != "le_promote_eligible":
continue
inp = case["input"]
r = curator.le_promote_eligible(
inp["proposal"],
[inp["existing"]],
inp["strength"],
min_strength=3,
wash_count=inp["wash_count"],
)
case["expected"] = {"eligible": r}
replaced += 1
assert replaced >= 4, f"expected >=4 le cases, found {replaced}"
# Self-check: no case may still encode the degrade shadow.
for case in truth:
if case.get("fn") == "le_promote_eligible":
assert "lexicon module unavailable" not in json.dumps(case["expected"]), case["name"]
truth_path.write_text(json.dumps(truth, indent=1, ensure_ascii=False) + "\n")
print(f"truth.json: {replaced} le_promote_eligible cases regenerated (live lexicon)")
# ── 2. the direct lexicon-surface battery ──────────────────────────────
corpus = [
"nick writes Go and Rust code daily in the rune repository",
"the curator gates memory writes through worthiness and grading",
"migration of modules follows the dichotomy: reactive goes Go, deterministic goes Rust",
]
cases = []
def add(fn, name, inp, expected):
cases.append({"fn": fn, "name": name, "input": inp, "expected": expected})
# coherence: conflict (distinctive shared term + negation ON it)
add("coherence", "conflict",
{"fact": "nick never writes Rust code", "existing": ["nick writes Go and Rust code daily"],
"corpus": corpus},
{"verdict": le.coherence("nick never writes Rust code",
["nick writes Go and Rust code daily"], corpus)})
# coherence: consistent (distinctive shared term, no negation)
add("coherence", "consistent",
{"fact": "nick writes Rust code on weekends", "existing": ["nick writes Go and Rust code daily"],
"corpus": corpus},
{"verdict": le.coherence("nick writes Rust code on weekends",
["nick writes Go and Rust code daily"], corpus)})
# coherence: novel (nothing distinctive shared)
add("coherence", "novel_axis",
{"fact": "nick plays bass guitar in a band", "existing": ["nick writes Go and Rust code daily"],
"corpus": corpus},
{"verdict": le.coherence("nick plays bass guitar in a band",
["nick writes Go and Rust code daily"], corpus)})
# coherence: common word only is NEVER a relation
add("coherence", "common_word_not_relation",
{"fact": "nick likes black coffee", "existing": ["black holes bend light"],
"corpus": ["black coffee in the morning", "black holes bend light"]},
{"verdict": le.coherence("nick likes black coffee", ["black holes bend light"],
["black coffee in the morning", "black holes bend light"])})
# coherence: empty existing -> novel
add("coherence", "empty_existing",
{"fact": "nick writes Rust code daily", "existing": [], "corpus": []},
{"verdict": le.coherence("nick writes Rust code daily", [], [])})
# grounded: stem-aware (migrated matches migration)
add("grounded", "stem_match",
{"fact": "nick migrated the modules", "sources": corpus},
{"grounded": le.grounded("nick migrated the modules", corpus)})
add("grounded", "invented_token",
{"fact": "nick collects vintage railway timetables", "sources": corpus},
{"grounded": le.grounded("nick collects vintage railway timetables", corpus)})
add("grounded", "empty_sources",
{"fact": "nick migrated the modules", "sources": []},
{"grounded": le.grounded("nick migrated the modules", [])})
# distinctive_terms: rare survives, common does not
add("distinctive_terms", "rare_vs_common",
{"fact": "nick writes Rust code daily", "corpus": corpus},
{"terms": sorted(le.distinctive_terms("nick writes Rust code daily", corpus))})
# promote_eligible: the four verdict shapes
add("promote_eligible", "strength_gate",
{"proposal": "add support for retries", "existing": ["support for retries in the fetch loop"],
"strength": 2, "min_strength": 3, "corpus": []},
{"eligible": le.promote_eligible("add support for retries",
["support for retries in the fetch loop"], 2, 3, ())})
add("promote_eligible", "shared_distinctive",
{"proposal": "add retries to the fetch loop", "existing": ["support for retries in the fetch loop"],
"strength": 3, "min_strength": 3, "corpus": []},
{"eligible": le.promote_eligible("add retries to the fetch loop",
["support for retries in the fetch loop"], 3, 3, ())})
add("promote_eligible", "novel_grounded",
{"proposal": "the curator gates every memory write", "existing": ["nick writes Go and Rust code daily"],
"strength": 3, "min_strength": 3, "corpus": corpus},
{"eligible": le.promote_eligible("the curator gates every memory write",
["nick writes Go and Rust code daily"], 3, 3, corpus)})
add("promote_eligible", "novel_parked",
{"proposal": "nick collects vintage railway timetables", "existing": ["nick writes Go and Rust code daily"],
"strength": 3, "min_strength": 3, "corpus": corpus},
{"eligible": le.promote_eligible("nick collects vintage railway timetables",
["nick writes Go and Rust code daily"], 3, 3, corpus)})
add("promote_eligible", "first_principle",
{"proposal": "parking is never wrong for growth", "existing": [],
"strength": 3, "min_strength": 3, "corpus": []},
{"eligible": le.promote_eligible("parking is never wrong for growth", [], 3, 3, ())})
out = {
"oracle": "src/rune/lexicon_evolution.py (recovered provenance 0308ccc6) via curator.py",
"generated": "2026-10-07 (post-recovery regeneration)",
"cases": cases,
}
(core / "truth_lexicon.json").write_text(
json.dumps(out, indent=1, ensure_ascii=False) + "\n")
print(f"truth_lexicon.json: {len(cases)} cases")
if __name__ == "__main__":
main()
+51
View File
@@ -0,0 +1,51 @@
"""gen_drift_fama_truth.py — factory batch 12 truth battery (live oracle)."""
import json
import sqlite3
import sys
import tempfile
from pathlib import Path
REPO = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(REPO / "src"))
sys.path.insert(0, str(REPO / "src" / "rune"))
import drift_core as dc # noqa: E402
def main():
tmp = Path(tempfile.mkdtemp(prefix="fama-truth-"))
db = sqlite3.connect(str(tmp / "t.db"))
db.row_factory = sqlite3.Row
db.execute("CREATE TABLE entries (id INTEGER PRIMARY KEY, status TEXT, rock_status TEXT, wash_count INTEGER)")
rows = [
(1, "active", "washable", 5), # valid (wash>0)
(2, "active", "established", 0), # valid (established)
(3, "active", "rock", 0), # valid (rock)
(4, "active", "washable", 0), # INVALID (active, no wash, washable)
(5, "superseded", "washable", 9), # invalid (not active)
]
db.executemany("INSERT INTO entries VALUES (?,?,?,?)", rows)
db.commit()
cases = []
for name, ids in [("all_valid", [1, 2, 3]), ("mixed", [1, 2, 4]),
("with_missing", [1, 999]), ("empty", []),
("all_invalid", [4, 5])]:
fetched = []
for eid in ids:
r = db.execute("SELECT status, rock_status, wash_count FROM entries WHERE id=?", (eid,)).fetchone()
if r:
fetched.append(dict(r))
cases.append({
"fn": "fama", "name": name,
"input": {"rows": fetched, "count": len(ids)},
"expected": {"fama": dc.compute_fama(db, "q", ids)},
})
out = {"oracle": "drift_core.compute_fama (live)", "generated": "2026-10-08", "cases": cases}
(REPO / "src/go/drift-core" / "truth_fama.json").write_text(json.dumps(out, indent=1) + "\n")
print(f"wrote {len(cases)} cases")
if __name__ == "__main__":
main()
+62
View File
@@ -0,0 +1,62 @@
#!/usr/bin/env python3
"""gen_drift_value_truth.py — factory batch 10 truth battery (live oracle)."""
import json
import sys
from pathlib import Path
REPO = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(REPO / "src"))
sys.path.insert(0, str(REPO / "src" / "rune"))
import drift_core as dc # noqa: E402
NOW = "2026-10-08T00:30:00+00:00"
def main():
entries = [
# fresh, low everything
{"wash_count": 0, "importance": 0.5, "text": "unproven entry", "rock_status": "washable"},
# high proven, recent access
{"wash_count": 25, "importance": 0.9, "text": "proven entry", "rock_status": "washable",
"last_accessed": "2026-10-07T20:00:00+00:00"},
# proven but stale (30+ days)
{"wash_count": 30, "importance": 0.8, "text": "stale entry", "rock_status": "washable",
"last_accessed": "2026-08-01T10:00:00+00:00"},
# already rock
{"wash_count": 40, "importance": 0.9, "text": "rocked", "rock_status": "rock"},
# bad timestamp (degrade path)
{"wash_count": 22, "importance": 0.7, "text": "bad ts", "rock_status": "washable",
"last_accessed": "not-a-date"},
# goal relevance hit
{"wash_count": 21, "importance": 0.6, "text": "the curator gates memory writes",
"rock_status": "washable", "last_accessed": "2026-10-06T00:00:00+00:00"},
]
goals = ["curator memory writes", "gate the pipeline"]
cases = []
for i, e in enumerate(entries):
cases.append({
"fn": "value", "name": f"value_{i}", "input": {"entry": e},
"expected": {"value": dc._py_compute_value(e, None, NOW)},
})
cases.append({
"fn": "promo", "name": f"promo_{i}", "input": {"entry": e},
"expected": {"eligible": dc._py_check_promotion_eligibility(e, NOW)[0],
"reason": dc._py_check_promotion_eligibility(e, NOW)[1]},
})
# goal-relevance path
cases.append({
"fn": "value", "name": "with_goals", "input": {"entry": entries[5], "goals": goals},
"expected": {"value": dc._py_compute_value(entries[5], goals, NOW)},
})
out = {"oracle": "drift_core._py_* oracles", "generated": "2026-10-08",
"frozen_now": NOW, "cases": cases}
(REPO / "src/go/drift-core" / "truth_value.json").write_text(
json.dumps(out, indent=1) + "\n")
print(f"wrote {len(cases)} cases")
if __name__ == "__main__":
main()
+35
View File
@@ -0,0 +1,35 @@
#!/usr/bin/env python3
"""gen_event_bus_truth.py — factory batch 9 truth battery (live oracle)."""
import json
import sys
from pathlib import Path
REPO = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(REPO / "src"))
sys.path.insert(0, str(REPO / "src" / "rune"))
import event_bus as eb # noqa: E402
def main():
payloads = [
{},
{"k": "v"},
{"task_id": "t1", "status": "failed", "count": 3},
{"nested": {"a": [1, 2, "x"]}, "flag": True, "nothing": None},
{"text": "quote\" inside\\ back\nnewline\ttab"},
{"float_int": 1.0, "float_frac": 2.5},
]
cases = [
{"fn": "hash", "name": f"payload_{i}", "input": {"payload": p},
"expected": {"hash": eb._content_hash(p)}}
for i, p in enumerate(payloads)
]
out = {"oracle": "event_bus._content_hash", "generated": "2026-10-07", "cases": cases}
(REPO / "src/go/event-bus" / "truth_bus.json").write_text(json.dumps(out, indent=1) + "\n")
print(f"wrote {len(cases)} cases")
if __name__ == "__main__":
main()
+61
View File
@@ -0,0 +1,61 @@
#!/usr/bin/env python3
"""gen_hook_placement_truth.py — factory batch 4 truth battery
(contract BUILDER-2026-10-07T23:06:18Z-ec6208).
The LIVE recommend_placement oracle over a factor matrix covering every
branch: hook-point combos, frequency ladder, cache scopes, concurrency,
failure modes, context budget.
Usage: python3 scripts/gen_hook_placement_truth.py (from repo root)
"""
import json
import sys
from pathlib import Path
REPO = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(REPO / "src"))
sys.path.insert(0, str(REPO / "src" / "rune"))
import hook_engine as he # noqa: E402
def main():
factor_sets = [
{"output_dep": True},
{"input_dep": True},
{"input_dep": True, "output_dep": True},
{},
{"side_effects": "read-write"},
{"volatility": "session"},
{"volatility": "per-turn"},
{"scope": "persistent"},
{"scope": "session"},
{"concurrent": True},
{"failure": "fail-loud"},
{"context_budget": 500},
{"input_dep": True, "scope": "session", "concurrent": True,
"context_budget": 250},
{"side_effects": "read-write", "failure": "fail-loud",
"scope": "persistent"},
]
cases = []
for i, factors in enumerate(factor_sets):
cases.append({
"fn": "placement", "name": f"matrix_{i}",
"input": {"factors": factors},
"expected": he.recommend_placement(f"hook_{i}", factors),
})
out = {
"oracle": "src/rune/hook_engine.py recommend_placement (live)",
"generated": "2026-10-07",
"cases": cases,
}
target = REPO / "src/go/hook-engine" / "truth_placement.json"
target.write_text(json.dumps(out, indent=1, ensure_ascii=False) + "\n")
print(f"wrote {target} ({len(cases)} cases)")
if __name__ == "__main__":
main()
+118
View File
@@ -0,0 +1,118 @@
#!/usr/bin/env python3
"""gen_memory_store_gate_truth.py — memory-store batch 4 truth battery
(contract BUILDER-2026-10-07T19:47:37Z-1cf1dc).
The LIVE oracle: the dense-side meta-judgement extracted from recall()
(lines 655-676) exercised against a FIXTURE STORE (sqlite entries + df
counts), plus the entries-side fusion vs the chunk-side one (identity
check), plus the abstain constants.
Usage: python3 scripts/gen_memory_store_gate_truth.py (from repo root)
"""
import json
import sqlite3
import sys
import tempfile
from pathlib import Path
REPO = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(REPO / "src"))
sys.path.insert(0, str(REPO / "src" / "rune"))
import memory_store as ms # noqa: E402
def make_fixture_store(db_path):
"""Entries table + df data mirroring recall()'s df-of-word query."""
db = sqlite3.connect(db_path)
db.row_factory = sqlite3.Row
db.execute("CREATE TABLE entries (id INTEGER PRIMARY KEY, text TEXT, status TEXT)")
rows = [
(1, "the curator gates memory writes through worthiness"),
(2, "black holes bend light near the event horizon"),
(3, "black coffee in the morning keeps nick running"),
(4, "the spine rebuild parity proofs live in store"),
(5, "memory writes require the operator approval gate"),
(6, "unrelated filler text about weather patterns"),
(7, "curator provenance recovery from odysseus"),
(8, "another filler row to pad the document frequency"),
]
db.executemany("INSERT INTO entries VALUES (?,?,?)",
[(i, t, "active") for (i, t) in rows])
db.commit()
return db
def main():
tmp = Path(tempfile.mkdtemp(prefix="ms-gate-truth-"))
db = make_fixture_store(str(tmp / "store.db"))
total = db.execute("SELECT COUNT(*) AS n FROM entries WHERE status='active'").fetchone()["n"]
def df_of(word):
return db.execute(
"SELECT COUNT(*) AS n FROM entries WHERE status='active' AND text LIKE ?",
(f"%{word}%",),
).fetchone()["n"]
# replicate recall()'s dense-gate block verbatim
def oracle_gate(query, hits):
q_content = {t for t in query.lower().split() if len(t) > 3 and t not in ms._STOPWORDS}
dense = []
for rowid, cos in hits:
etxt = (db.execute("SELECT text FROM entries WHERE id=?", (rowid,)).fetchone()["text"] or "").lower()
distinctive = [w for w in q_content if w in etxt and df_of(w) / total < 0.05]
if distinctive:
dense.append((rowid, cos))
elif not q_content or cos >= 0.80:
dense.append((rowid, cos))
return dense
cases = []
def add(fn, name, inp, expected):
cases.append({"fn": fn, "name": name, "input": inp, "expected": expected})
# gate: shared DISTINCTIVE word (curator: df=2/8=0.25? no — check)
# df(curator) = rows 1,7 = 2 → 0.25 ≥ 0.05 → NOT distinctive!
# The oracle's threshold means common-store words fail; only truly
# rare words pass. Fixture exercise:
for name, query, hits in [
("distinctive_shared", "worthiness gates", [(1, 0.9), (2, 0.85)]),
("common_word_falls_back", "black", [(2, 0.86), (3, 0.79)]),
("strong_cos_no_share", "unrelated query terms", [(6, 0.91), (4, 0.70)]),
("no_content_words", "the was and", [(1, 0.60), (6, 0.95)]),
]:
add("dense_gate", name,
{"query": query, "hits": [[r, c] for r, c in hits], "total": total},
{"kept": [[r, c] for r, c in oracle_gate(query, hits)],
"q_content": sorted({t for t in query.lower().split() if len(t) > 3 and t not in ms._STOPWORDS}),
"df": {w: df_of(w) for w in query.lower().split() if len(w) > 3}})
# entries-side fusion identity with the chunk-side one
dense = [[1, 0.9], [2, 0.8]]
bm25 = [[2, 10.0], [3, 4.0]]
add("fusion_identity", "entries_eq_chunks",
{"dense": dense, "bm25": bm25},
{"fusion": ms._py_rank_fusion(dense, bm25)})
add("constants", "abstain",
{},
{"budget": ms.RECALL_BUDGET, "min_score": ms.RECALL_MIN_SCORE})
import shutil
shutil.rmtree(tmp, ignore_errors=True)
out = {
"oracle": "src/rune/memory_store.py recall() dense gate + _py_rank_fusion",
"generated": "2026-10-07",
"fixture_df_note": "df via LIKE-substring over active entries; threshold 0.05",
"cases": cases,
}
target = REPO / "src/go/memory-store-deep" / "truth_gate.json"
target.write_text(json.dumps(out, indent=1, ensure_ascii=False) + "\n")
print(f"wrote {target} ({len(cases)} cases)")
if __name__ == "__main__":
main()
+107
View File
@@ -0,0 +1,107 @@
#!/usr/bin/env python3
"""gen_memory_store_score_truth.py — memory-store batch 3 truth battery
(contract BUILDER-2026-10-07T18:57:06Z-c2429c).
The LIVE _py_score_recall_rows oracle: metadata scoring across modes
(hybrid / dense-only / lexical-only), recency decay, the abstention
ladder (min_score gates, the 0.74 high-confidence gate, the 0.08 gap
detection), position-aware re-rank.
Usage: python3 scripts/gen_memory_store_score_truth.py (from repo root)
"""
import json
import sys
from pathlib import Path
REPO = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(REPO / "src"))
sys.path.insert(0, str(REPO / "src" / "rune"))
import memory_store as ms # noqa: E402
NOW = "2026-10-07T18:58:00"
def rows_for(ids):
"""Fixture rows: confidence/temperature/recency variety."""
out = []
for i, eid in enumerate(ids):
out.append({
"id": eid,
"text": f"entry {eid} body",
"importance": 0.5 + i * 0.01,
"topic": "project",
"entities": ["a"],
"source": "fixture",
"confidence": 0.9 if i % 2 == 0 else 0.6,
"temperature": 1.2 if i % 3 == 0 else 0.8,
"last_accessed": ["2026-10-07T18:00:00", "2026-09-01T10:00:00",
"2026-05-01T10:00:00", None][i % 4],
})
return out
def main():
cases = []
def add(fn, name, inp, expected):
cases.append({"fn": fn, "name": name, "input": inp, "expected": expected})
# hybrid: ranks over 4 rows, dense + bm25 present
fusion = {"ranks": [[1, 0.12], [2, 0.11], [3, 0.10], [4, 0.09]],
"best_dense": 0.8, "mode": "hybrid"}
dense = [[1, 0.8], [2, 0.7], [3, 0.6]]
bm25 = [[2, 10.0], [4, 5.0], [1, 2.0]]
rows = rows_for([1, 2, 3, 4])
add("score", "hybrid",
{"fusion": fusion, "rows": rows, "dense": dense, "bm25": bm25,
"budget": 3, "min_score": 0.3, "now": NOW},
{"scored": ms._py_score_recall_rows(fusion, rows, dense, bm25, 3, 0.3, NOW)})
# dense-only: high confidence (>= 0.74) → position-aware
fusion_d = {"ranks": [[1, 0.06], [2, 0.055], [3, 0.05]],
"best_dense": 0.8, "mode": "dense-only"}
add("score", "dense_only_high_conf",
{"fusion": fusion_d, "rows": rows_for([1, 2, 3]), "dense": dense,
"bm25": [], "budget": 5, "min_score": 0.3, "now": NOW},
{"scored": ms._py_score_recall_rows(fusion_d, rows_for([1, 2, 3]), dense, [], 5, 0.3, NOW)})
# dense-only: narrow gap → abstain
dense_close = [[1, 0.80], [2, 0.75]]
add("score", "dense_only_gap_abstain",
{"fusion": fusion_d, "rows": rows_for([1, 2, 3]), "dense": dense_close,
"bm25": [], "budget": 5, "min_score": 0.3, "now": NOW},
{"scored": ms._py_score_recall_rows(fusion_d, rows_for([1, 2, 3]), dense_close, [], 5, 0.3, NOW)})
# dense-only: below min_score → abstain
add("score", "dense_only_min_score",
{"fusion": fusion_d, "rows": rows_for([1, 2, 3]), "dense": dense,
"bm25": [], "budget": 5, "min_score": 0.9, "now": NOW},
{"scored": ms._py_score_recall_rows(fusion_d, rows_for([1, 2, 3]), dense, [], 5, 0.9, NOW)})
# lexical-only: max relevance gate
fusion_l = {"ranks": [[2, 0.9], [4, 0.7]], "best_dense": 0.0, "mode": "lexical-only"}
add("score", "lexical_only_gate",
{"fusion": fusion_l, "rows": rows_for([2, 4]), "dense": [], "bm25": bm25,
"budget": 5, "min_score": 1.0, "now": NOW},
{"scored": ms._py_score_recall_rows(fusion_l, rows_for([2, 4]), [], bm25, 5, 1.0, NOW)})
# neither → []
add("score", "neither",
{"fusion": fusion_l, "rows": rows_for([2, 4]), "dense": [], "bm25": [],
"budget": 5, "min_score": 0.3, "now": NOW},
{"scored": ms._py_score_recall_rows(fusion_l, rows_for([2, 4]), [], [], 5, 0.3, NOW)})
out = {
"oracle": "src/rune/memory_store.py _py_score_recall_rows",
"generated": "2026-10-07",
"cases": cases,
}
target = REPO / "src/go/memory-store-deep" / "truth_score.json"
target.write_text(json.dumps(out, indent=1, ensure_ascii=False) + "\n")
print(f"wrote {target} ({len(cases)} cases)")
if __name__ == "__main__":
main()
+120
View File
@@ -0,0 +1,120 @@
#!/usr/bin/env python3
"""gen_memory_store_truth2.py — memory-store batch 2 truth battery
(contract BUILDER-2026-10-07T18:05:47Z-152c16).
The LIVE _py_* oracles of memory_store.py. Cases: FTS conjunctive builder
(stopword filtering, fallback, 8-cap), chunk_text (recombine + hard-split),
rank fusion (hybrid/dense-only/lexical-only), project_chunk_rows,
map_reduce, fuse_results (dedup + scale-alignment).
Usage: python3 scripts/gen_memory_store_truth2.py (from repo root)
"""
import json
import sys
from pathlib import Path
REPO = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(REPO / "src"))
sys.path.insert(0, str(REPO / "src" / "rune"))
import memory_store as ms # noqa: E402
def main():
cases = []
def add(fn, name, inp, expected):
cases.append({"fn": fn, "name": name, "input": inp, "expected": expected})
# ── FTS conjunctive ───────────────────────────────────────────────────
add("fts", "significant_terms",
{"query": "the curator gates memory writes"},
{"q": ms._py_fts_query_conjunctive("the curator gates memory writes")})
add("fts", "stopwords_dropped",
{"query": "the and was with nick"},
{"q": ms._py_fts_query_conjunctive("the and was with nick")})
add("fts", "short_fallback",
{"query": "go is fun ai"},
{"q": ms._py_fts_query_conjunctive("go is fun ai")})
long_q = "alpha beta gamma delta epsilon zeta eta theta iota kappa"
add("fts", "cap_eight",
{"query": long_q},
{"q": ms._py_fts_query_conjunctive(long_q)})
add("fts", "empty_returns_raw",
{"query": "a an of"},
{"q": ms._py_fts_query_conjunctive("a an of")})
# ── chunk_text ────────────────────────────────────────────────────────
small = "one paragraph only"
add("chunk", "under_size", {"text": small, "size": 1500, "overlap": 150},
{"chunks": ms._py_chunk_text(small, 1500, 150)})
para = "\n\n".join(f"paragraph {i} " + "x" * 40 for i in range(30))
add("chunk", "recombine", {"text": para, "size": 400, "overlap": 150},
{"chunks": ms._py_chunk_text(para, 400, 150)})
noline = "y" * 3000
add("chunk", "hard_split", {"text": noline, "size": 1000, "overlap": 150},
{"chunks": ms._py_chunk_text(noline, 1000, 150)})
add("chunk", "empty", {"text": "", "size": 1500, "overlap": 150},
{"chunks": ms._py_chunk_text("", 1500, 150)})
# ── rank fusion ───────────────────────────────────────────────────────
dense = [[1, 0.9], [2, 0.8], [3, 0.7]]
bm25 = [[2, 12.0], [4, 8.0], [1, 3.0]]
add("fuse_ranks", "hybrid", {"dense": dense, "bm25": bm25},
ms._py_rank_fusion(dense, bm25))
add("fuse_ranks", "dense_only", {"dense": dense, "bm25": []},
ms._py_rank_fusion(dense, []))
add("fuse_ranks", "lexical_only", {"dense": [], "bm25": bm25},
ms._py_rank_fusion([], bm25))
add("fuse_ranks", "neither", {"dense": [], "bm25": []},
ms._py_rank_fusion([], []))
# ── project_chunk_rows ────────────────────────────────────────────────
rows = [
{"rowid": 1, "chunk_id": "c1", "text": "t" * 500, "wing": "w1", "room": "r1",
"source_path": "a.md", "page": 3},
{"rowid": 2, "chunk_id": "c2", "text": "short", "wing": "w1", "room": "r1",
"source_path": "b.md"},
]
ranks = {"2": 0.0625, "1": 0.05}
add("project", "budget_and_shape", {"ranks": ranks},
{"rows": ms._py_project_chunk_rows(ranks, rows, 6)})
# ── map_reduce ────────────────────────────────────────────────────────
entries = [{"id": i, "relevance": i * 0.1} for i in range(25)]
add("map_reduce", "top3_per_chunk", {"entries": entries, "chunk_size": 10},
{"mapped": ms._py_map_reduce(entries, 10)})
add("map_reduce", "under_threshold", {"entries": entries[:5], "chunk_size": 10},
{"mapped": ms._py_map_reduce(entries[:5], 10)})
# ── fuse_results ──────────────────────────────────────────────────────
ents = [
{"id": 1, "text": "nick prefers coffee", "topic": "human",
"relevance": 2.5, "confidence": 0.9},
{"id": 2, "text": "NICK PREFERS COFFEE", "topic": "human",
"relevance": 1.1, "confidence": 0.8}, # dedup hit
{"id": 3, "text": "rune gates memory writes", "topic": "project",
"relevance": 5.6, "confidence": 0.95},
]
res = [
{"chunk_id": "c1", "text": "the spine rebuild parity", "wing": "research",
"rrf": 0.0625, "confidence": 0.7},
{"chunk_id": "c2", "text": "curator provenance recovery", "wing": "research",
"rrf": 0.05},
]
add("fuse_results", "dedup_scale_align", {"entries": ents, "research": res},
{"merged": ms._py_fuse_results(ents, res)})
out = {
"oracle": "src/rune/memory_store.py _py_* oracles",
"generated": "2026-10-07",
"cases": cases,
}
target = REPO / "src/go/memory-store-deep" / "truth_recall.json"
target.write_text(json.dumps(out, indent=1, ensure_ascii=False) + "\n")
print(f"wrote {target} ({len(cases)} cases)")
if __name__ == "__main__":
main()
+71
View File
@@ -0,0 +1,71 @@
#!/usr/bin/env python3
"""gen_microkernel_truth.py — factory batch 8 truth battery (live oracle)."""
import json
import sys
from pathlib import Path
REPO = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(REPO / "src"))
sys.path.insert(0, str(REPO / "src" / "rune"))
import microkernel as mk # noqa: E402
FROZEN = "2026-10-07T23:35:00"
def main():
mk.now_iso = lambda: FROZEN
cases = []
def snap(reg, name):
return {
"plugins": {k: {"active": v["active"], "registered_at": v["registered_at"]}
for k, v in reg["plugins"].items()},
"capabilities": reg["capabilities"],
"hooks": reg["hooks"],
}
# register + resolve priority tie
import tempfile, os as _os
_tmpdb = _os.path.join(tempfile.mkdtemp(prefix="mk-truth-"), "registry.json")
mk.REGISTRY_DB = _tmpdb
def _snap():
return mk._load_registry()
mk.register({"name": "alpha", "capabilities": ["cap.a"], "priority": 50})
mk.register({"name": "beta", "capabilities": ["cap.a"], "priority": 10})
mk.register({"name": "gamma", "capabilities": ["cap.a"], "priority": 10, "auto_activate": False})
mk.register({"name": "delta", "hooks": {"pre-turn": True, "post-turn": False}})
cases.append({"fn": "state", "name": "after_registers", "input": {},
"expected": snap(_snap(), "x")})
cases.append({"fn": "resolve", "name": "priority_active",
"input": {"capability": "cap.a"},
"expected": {"resolved": mk.resolve("cap.a")}})
cases.append({"fn": "resolve", "name": "unknown_cap",
"input": {"capability": "cap.nope"},
"expected": {"resolved": mk.resolve("cap.nope")}})
# unregister removes from indexes
mk.unregister("beta")
cases.append({"fn": "state", "name": "after_unregister", "input": {},
"expected": snap(_snap(), "x")})
cases.append({"fn": "resolve", "name": "after_unregister",
"input": {"capability": "cap.a"},
"expected": {"resolved": mk.resolve("cap.a")}})
# error texts
err1 = mk.register({})
err2 = mk.unregister("nope")
cases.append({"fn": "errors", "name": "shapes", "input": {},
"expected": {"register_empty": err1, "unregister_unknown": err2}})
out = {"oracle": "src/rune/microkernel.py (live)", "generated": "2026-10-07",
"frozen_now": FROZEN, "cases": cases}
(REPO / "src/go/microkernel" / "truth_microkernel.json").write_text(
json.dumps(out, indent=1) + "\n")
print(f"wrote {len(cases)} cases")
if __name__ == "__main__":
main()
+35
View File
@@ -0,0 +1,35 @@
#!/usr/bin/env python3
"""gen_provider_format_truth.py — factory batch 5 truth battery (live
provider_registry._format_tools_* oracles)."""
import json
import sys
from pathlib import Path
REPO = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(REPO / "src"))
sys.path.insert(0, str(REPO / "src" / "rune"))
import provider_registry as pr # noqa: E402
def main():
tools = [
{"name": "read_file", "description": "Read a file",
"parameters": {"type": "object", "properties": {"path": {"type": "string"}}}},
{"name": "write_file", "description": "Write a file"}, # no parameters key
]
cases = [
{"fn": "openai", "name": "shape", "input": {"tools": tools},
"expected": pr._format_tools_openai(tools)},
{"fn": "anthropic", "name": "shape", "input": {"tools": tools},
"expected": pr._format_tools_anthropic(tools)},
]
out = {"oracle": "provider_registry._format_tools_*", "generated": "2026-10-07", "cases": cases}
target = REPO / "src/go/provider-registry" / "truth_format.json"
target.write_text(json.dumps(out, indent=1) + "\n")
print(f"wrote {target} ({len(cases)} cases)")
if __name__ == "__main__":
main()
+130
View File
@@ -0,0 +1,130 @@
#!/usr/bin/env python3
"""gen_scaffold_close_truth.py — scaffold batch 3 truth battery
(contract BUILDER-2026-10-07T18:42:38Z-52829e).
The LIVE oracle: _py_close_quality bucket math + close_contract on a doc
built through the real lifecycle (new_contract → transitions → snapshot →
close). now() frozen at scaffold AND structural_store namespaces.
Usage: python3 scripts/gen_scaffold_close_truth.py (from repo root)
"""
import json
import sys
import tempfile
from pathlib import Path
REPO = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(REPO / "src"))
from rune import scaffold as sc # noqa: E402
from rune.structural_store import new_doc, add_entity # noqa: E402
FROZEN = "2026-10-07T18:46:00"
def main():
sc.now = lambda: FROZEN
cases = []
# ── CloseQuality bucket math (direct, edge-covering) ──────────────────
inputs = {
"contract_id": "q1",
"phase": "superseding",
"affected_entities": ["module:a", "module:b"],
"expected_new_entities": ["module:new1", "module:new2"],
"predicted_existing_affected": ["module:c"],
"predicted_frontier": {
"level0_direct": ["module:a"],
"level1_obligations": ["module:d"],
"contracts": ["contract:x"],
"level2_verification": ["canary:v"],
},
"expected_runtime_effects": ["module:a/ctl", "module:zz/never"],
"observed_evidence": [
{"entity": "module:a", "source": "tests", "detail": "d" * 400, "authority": "pytest"},
{"entity": "module:new1", "source": "build", "detail": "created"},
{"entity": "module:surprise", "source": "runtime", "detail": "unplanned"},
{"entity": "", "source": "runtime", "detail": "no entity — ignored"},
],
"now": FROZEN,
}
s = sc.Scaffold(Path(tempfile.mkdtemp()), "q")
cases.append({
"fn": "close_quality", "name": "buckets",
"input": {"inputs": inputs},
"expected": s._py_close_quality(inputs),
})
# ── CloseContract through the real lifecycle ──────────────────────────
tmp = Path(tempfile.mkdtemp(prefix="scaffold-close-truth-"))
s2 = sc.Scaffold(tmp, "close-project")
s2.init(purpose="close battery")
doc = s2.load()
s2.new_contract(doc, contract_id="c1", need="n", scope=["src/go/x/"],
affected_entities=["module:a"],
expected_new_entities=["module:new1"])
s2.transition_contract(doc, "c1", "approved")
s2.transition_contract(doc, "c1", "building")
s2.transition_contract(doc, "c1", "verifying")
# predicted frontier on the entity
e = s2.contract(doc, "c1")
e.setdefault("ext", {})["predicted_frontier"] = {
"level0_direct": ["module:a"], "level1_obligations": [],
"contracts": [], "level2_verification": [],
}
ev = [{"entity": "module:a", "source": "tests", "detail": "passed"}]
e2 = s2.close_contract(doc, "c1", observed_evidence=ev,
scope_files=["src/go/x/main.go", "src/other/rogue.py"])
cases.append({
"fn": "close_contract", "name": "full_lifecycle",
"input": {},
"expected": {"entity": e2},
})
# phase gate
doc2 = new_doc()
add_entity(doc2, id="contract:early", kind="construction_contract",
identities={"need": "n"}, maturity="DECLARED",
evidence_refs=["x"])
doc2["entities"][-1]["phase"] = "draft"
doc2["entities"][-1]["status"] = "open"
doc2["entities"][-1]["checkpoints"] = []
try:
s2.close_contract(doc2, "early", observed_evidence=[])
gate = {"ok": True}
except Exception as ex: # noqa: BLE001 — intentional: the case IS the gate error; the oracle's text becomes the truth column
gate = {"ok": False, "error": str(ex)}
cases.append({
"fn": "close_gate", "name": "phase_guard",
"input": {},
"expected": gate,
})
# missing contract
try:
s2.close_contract(doc2, "ghost", observed_evidence=[])
miss = {"ok": True}
except Exception as ex: # noqa: BLE001 — intentional: same oracle-error-as-truth pattern as above
miss = {"ok": False, "error": str(ex)}
cases.append({
"fn": "close_gate", "name": "missing_contract",
"input": {},
"expected": miss,
})
out = {
"oracle": "src/rune/scaffold.py (live, now frozen at both namespaces)",
"generated": "2026-10-07",
"frozen_now": FROZEN,
"cases": cases,
}
target = REPO / "src/go/scaffold" / "truth_close.json"
target.write_text(json.dumps(out, indent=1, ensure_ascii=False) + "\n")
print(f"wrote {target} ({len(cases)} cases)")
import shutil
shutil.rmtree(tmp, ignore_errors=True)
if __name__ == "__main__":
main()
+178
View File
@@ -0,0 +1,178 @@
#!/usr/bin/env python3
"""gen_scaffold_store_truth.py — scaffold batch 2 truth battery
(contract BUILDER-2026-10-07T17:47:00Z-960f12).
The LIVE oracle (scaffold.Scaffold + structural_store) on a tmp store with
now() frozen. Cases: canonical digest stability + secret redaction, commit
semantics (success + exact failure texts), verify_on_disk forgotten-save
detection, impact frontier (contract_change / implementation_change /
contextual), snapshot_predicted_frontier, spine_bridge_entity.
Usage: python3 scripts/gen_scaffold_store_truth.py (from repo root)
"""
import json
import sys
import tempfile
from pathlib import Path
REPO = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(REPO / "src"))
from rune import scaffold as sc # noqa: E402
from rune import structural_store as ss # noqa: E402
FROZEN = "2026-10-07T17:50:00"
def main():
sc.now = lambda: FROZEN
ss.now = lambda: FROZEN
tmp = Path(tempfile.mkdtemp(prefix="scaffold-store-truth-"))
s = sc.Scaffold(tmp, "truth-project")
s.init(purpose="store battery")
cases = []
# ── canonical digest: stability + redaction ───────────────────────────
doc = s.load()
d1 = ss.canonical_digest(doc)
# key-order permutation must NOT change the digest (semantic content)
permuted = {k: doc[k] for k in reversed(list(doc.keys()))}
d2 = ss.canonical_digest(permuted)
cases.append({
"fn": "digest", "name": "key_order_stable",
"input": {},
"expected": {"digest": d1, "permuted_same": d2 == d1},
})
secret_doc = {"entities": [{"id": "repo:x", "identities": {
"token": "hunter2", "api_key": "sk-123", "full_name": "o/r",
"api_token": "zz", "password": "pw", "private_key": "-----BEGIN",
"note": "keepme", "my_secret_sauce": "redacted-too"}}]}
cases.append({
"fn": "digest", "name": "secret_redaction",
"input": {},
"expected": {"redacted": ss._redact_secrets(secret_doc)},
})
# ── commit: success + digest readback ─────────────────────────────────
s.commit(doc, what="battery")
cases.append({
"fn": "commit", "name": "success",
"input": {},
"expected": {"ok": True, "on_disk_schema": s.load()["schema_version"]},
})
# forgotten-save detection: mutate in memory, DON'T save
doc2 = s.load()
doc2["entities"].append({"id": "ghost:1", "kind": "ghost", "identities": {}})
try:
s.verify_on_disk(lambda d: d["entities"], None, what="battery") if False else None
# the real call: selector/expect form
s.verify_on_disk(lambda d: [e for e in d["entities"] if e["id"] == "ghost:1"],
lambda v: bool(v), what="battery")
forgotten = {"ok": True}
except AssertionError as ex:
forgotten = {"ok": False, "error": str(ex)}
cases.append({
"fn": "verify_on_disk", "name": "forgotten_save",
"input": {},
"expected": forgotten,
})
# corrupt store -> commit-style load returns None -> reload failure path
# (simulate: point at a nonexistent path)
class FakeScaffold:
current = tmp / "nonexistent" / "current.json"
try:
ss_load = ss.load(FakeScaffold.current)
reload_none = ss_load is None
except Exception: # noqa: BLE001 — intentional: the case IS the degrade verdict (load failure → loads_none=False); error text is not the truth column here
reload_none = False
cases.append({
"fn": "load", "name": "missing_store",
"input": {},
"expected": {"loads_none": reload_none},
})
# ── impact frontier ───────────────────────────────────────────────────
doc3 = new_frontier_doc()
cases.append({
"fn": "frontier", "name": "contract_change",
"input": {"seeds": ["contract:c1"], "doc": doc3},
"expected": ss.impact_frontier(doc3, ["contract:c1"]),
})
cases.append({
"fn": "frontier", "name": "implementation_change",
"input": {"seeds": ["module:impl_a"], "doc": doc3},
"expected": ss.impact_frontier(doc3, ["module:impl_a"]),
})
cases.append({
"fn": "frontier", "name": "violation_escalation",
"input": {"seeds": ["module:impl_a"], "change_kind": "contract_violation", "doc": doc3},
"expected": ss.impact_frontier(doc3, ["module:impl_a"], change_kind="contract_violation"),
})
# ── snapshot_predicted_frontier + spine bridge ────────────────────────
doc4 = new_frontier_doc()
s4 = sc.Scaffold(tmp / "p4", "frontier-project")
s4.init(purpose="frontier battery")
doc4 = s4.load()
s4.new_contract(doc4, contract_id="f1", need="n", scope=["src/"])
# wire the frontier doc entities into the project doc
doc4["entities"].extend(e for e in doc3["entities"] if e["id"] not in {x["id"] for x in doc4["entities"]})
doc4["relationships"].extend(doc3["relationships"])
frontier = s4.snapshot_predicted_frontier(doc4, "f1", ["contract:c1"])
e = s4.contract(doc4, "f1")
cases.append({
"fn": "snapshot_frontier", "name": "persisted",
"input": {"doc": doc4},
"expected": {
"frontier": frontier,
"checkpoint_note": e["checkpoints"][-1]["note"],
"ext_has": sorted((e.get("ext", {}).get("predicted_frontier") or {}).keys()),
},
})
cases.append({
"fn": "bridge", "name": "identity_only",
"input": {},
"expected": {"bridge": s4.spine_bridge_entity()},
})
out = {
"oracle": "src/rune/scaffold.py + structural_store.py (live, now frozen)",
"generated": "2026-10-07",
"frozen_now": FROZEN,
"cases": cases,
}
target = REPO / "src/go/scaffold" / "truth_store.json"
target.write_text(json.dumps(out, indent=1, ensure_ascii=False) + "\n")
print(f"wrote {target} ({len(cases)} cases)")
import shutil
shutil.rmtree(tmp, ignore_errors=True)
def new_frontier_doc():
"""A small structural doc exercising the frontier walk."""
doc = ss.new_doc()
ss.add_entity(doc, id="contract:c1", kind="contract", identities={})
ss.add_entity(doc, id="module:impl_a", kind="module", identities={})
ss.add_entity(doc, id="module:impl_b", kind="module", identities={})
ss.add_entity(doc, id="module:lib", kind="module", identities={})
ss.add_entity(doc, id="canary:x", kind="canary", identities={})
ss.add_entity(doc, id="deploy:live", kind="deployment", identities={})
for rel in (
{"type": "implements", "from": "module:impl_a", "to": "contract:c1"},
{"type": "implements", "from": "module:impl_b", "to": "contract:c1"},
{"type": "depends_on", "from": "module:impl_a", "to": "module:lib"},
{"type": "verified_by", "from": "contract:c1", "to": "canary:x"},
{"type": "deployed_as", "from": "module:impl_a", "to": "deploy:live"},
{"type": "supersedes", "from": "module:impl_b", "to": "module:impl_a"}, # non-obligation
):
doc["relationships"].append(rel)
return doc
if __name__ == "__main__":
main()
+152
View File
@@ -0,0 +1,152 @@
#!/usr/bin/env python3
"""gen_scaffold_truth.py — scaffold batch 1 truth battery
(contract BUILDER-2026-10-07T17:27:25Z-6bc737).
The LIVE Scaffold runs against a tmp store with now() frozen (module-patch
on rune.scaffold's imported binding). Cases: the transition machine (legal
+ illegal + unknown phase, exact error texts), new_contract/transition_
contract state evolution, check_scope (green/red/unknown), layout_
obligations (FLEXIBLE vs USER-LOCKED), json_frontier projection.
Usage: python3 scripts/gen_scaffold_truth.py (from repo root)
"""
import json
import sys
import tempfile
from pathlib import Path
REPO = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(REPO / "src"))
from rune import scaffold as sc # noqa: E402
from rune.structural_store import new_doc, add_entity # noqa: E402
FROZEN = "2026-10-07T17:30:00"
def main():
# Freeze the clock at scaffold's namespace binding.
sc.now = lambda: FROZEN
tmp = Path(tempfile.mkdtemp(prefix="scaffold-truth-"))
s = sc.Scaffold(tmp, "truth-project")
s.init(purpose="truth battery")
cases = []
# ── transition machine ────────────────────────────────────────────────
def tv(name, current, to):
try:
sc.Scaffold.transition_contract # noqa: B018 — presence probe
# validate via a throwaway entity path
doc = new_doc()
e = s.new_contract(doc, contract_id="probe", need="probe")
if current != "draft":
e["phase"] = current
s.transition_contract(doc, "probe", to)
cases.append({"fn": "transition", "name": name,
"input": {"current": current, "to": to},
"expected": {"ok": True}})
except Exception as ex: # noqa: BLE001 — intentional: the case IS the error verdict; the oracle's error text becomes the truth column
cases.append({"fn": "transition", "name": name,
"input": {"current": current, "to": to},
"expected": {"ok": False, "error": str(ex)}})
tv("legal_approved", "draft", "approved")
tv("legal_building", "approved", "building")
tv("legal_verifying", "building", "verifying")
tv("legal_migrating", "verifying", "migrating")
tv("legal_superseding", "migrating", "superseding")
tv("legal_closed", "superseding", "closed")
tv("legal_failed_retry", "failed", "building")
tv("legal_abandon", "building", "abandoned")
tv("illegal_closed_from_draft", "draft", "closed")
tv("illegal_rewind", "verifying", "draft")
tv("illegal_skip", "draft", "verifying")
tv("unknown_phase", "draft", "nonexistent_phase")
# ── contract lifecycle evolution ──────────────────────────────────────
doc = new_doc()
s.new_contract(doc, contract_id="life", need="port the lifecycle",
origin="builder", scope=["src/go/scaffold/"],
acceptance=["truth battery passes"])
e = s.transition_contract(doc, "life", "approved", evidence_ref="e1")
e = s.transition_contract(doc, "life", "building", evidence_ref="e2", note="x" * 300)
cases.append({
"fn": "lifecycle", "name": "evolution",
"input": {},
"expected": {"entity": e},
})
# duplicate contract
try:
s.new_contract(doc, contract_id="life", need="again")
dup = {"ok": True}
except ValueError as ex:
dup = {"ok": False, "error": str(ex)}
cases.append({"fn": "dup", "name": "duplicate", "input": {},
"expected": dup})
# ── check_scope ───────────────────────────────────────────────────────
doc2 = new_doc()
s.new_contract(doc2, contract_id="scoped", need="n", scope=["src/go/a/", "src/go/b/main.go"])
e2 = s.contract(doc2, "scoped")
cases.append({
"fn": "check_scope", "name": "mixed",
"input": {"changed": ["src/go/a/x.go", "src/go/b/main.go", "src/other/f.py", "src/go/a/deep/y.go"], "scope": ["src/go/a/", "src/go/b/main.go"]},
"expected": s.check_scope(doc2, "scoped",
["src/go/a/x.go", "src/go/b/main.go", "src/other/f.py", "src/go/a/deep/y.go"]),
})
doc3 = new_doc()
s.new_contract(doc3, contract_id="unscoped", need="n")
cases.append({
"fn": "check_scope", "name": "unscoped",
"input": {"changed": ["anything.py"], "scope": []},
"expected": s.check_scope(doc3, "unscoped", ["anything.py"]),
})
# ── layout obligations ────────────────────────────────────────────────
doc4 = new_doc()
add_entity(doc4, id="layout:panel", kind="layout_contract",
identities={"component": "Panel", "region": "sidebar",
"implementation": "src/go/panel.go", "lock": False,
"provenance": "scaffold"}, maturity="DECLARED")
add_entity(doc4, id="layout:header", kind="layout_contract",
identities={"component": "Header", "region": "top",
"implementation": "src/go/header.go", "lock": True,
"provenance": "user"}, maturity="DECLARED")
cases.append({
"fn": "layout", "name": "mixed_locks",
"input": {"affected": ["Panel", "region:top"], "doc": doc4},
"expected": {"obligations": s.layout_obligations(doc4, ["Panel", "region:top"])},
})
cases.append({
"fn": "layout", "name": "no_hit",
"input": {"affected": ["Unrelated"], "doc": doc4},
"expected": {"obligations": []},
})
# ── json_frontier ─────────────────────────────────────────────────────
f = {"contracts": ["c1"], "level2_verification": ["v1"]}
cases.append({
"fn": "frontier", "name": "projection",
"input": {"frontier": f},
"expected": {"json": sc.json_frontier(f)},
})
out = {
"oracle": "src/rune/scaffold.py (live Scaffold, now frozen)",
"generated": "2026-10-07",
"frozen_now": FROZEN,
"cases": cases,
}
target = REPO / "src/go/scaffold" / "truth_scaffold.json"
target.write_text(json.dumps(out, indent=1, ensure_ascii=False) + "\n")
print(f"wrote {target} ({len(cases)} cases)")
import shutil
shutil.rmtree(tmp, ignore_errors=True)
if __name__ == "__main__":
main()
+100
View File
@@ -0,0 +1,100 @@
#!/usr/bin/env python3
"""gen_sleep_time_truth.py — factory batch 11 truth battery (live oracle)."""
import json
import sqlite3
import sys
import tempfile
from pathlib import Path
REPO = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(REPO / "src"))
sys.path.insert(0, str(REPO / "src" / "rune"))
import sleep_time as st # noqa: E402
def make_parts_db(db_path):
db = sqlite3.connect(db_path)
db.execute("CREATE TABLE part (session_id TEXT, data TEXT, time_created TEXT)")
rows = [
("s1", '{"tool": "todowrite", "state": {"input": {"todos": [{"content": "first", "status": "completed", "priority": "high"}]}}}', "2026-10-07T10:00:00"),
("s1", '{"tool": "bash", "state": {"input": {"command": "ls"}}}', "2026-10-07T10:01:00"),
("s1", '{"tool": "todowrite", "state": {"input": {"todos": [{"content": "second", "status": "in_progress", "priority": "med"}, {"content": "third", "status": "pending", "priority": "low"}]}}}', "2026-10-07T10:02:00"),
("s1", '{"tool": "todowrite", "state": {"input": {"todos": []}}}', "2026-10-07T10:03:00"), # empty — skipped
("s1", '{"tool": "read_file", "state": {"input": {}}}', "2026-10-07T10:04:00"), # non-todowrite
("s2", '{"tool": "todowrite", "state": {"input": {"todos": [{"content": "other session", "status": "pending", "priority": ""}]}}}', "2026-10-07T11:00:00"),
]
db.executemany("INSERT INTO part VALUES (?,?,?)", rows)
db.commit()
return db
def main():
tmp = Path(tempfile.mkdtemp(prefix="st-truth-"))
db = make_parts_db(str(tmp / "p.db"))
cases = []
# extract_todos for s1 (ORDER BY time ASC → latest = the 10:02 todos)
rows = [{"data": r[0]} for r in db.execute(
"SELECT data FROM part WHERE session_id='s1' ORDER BY time_created ASC").fetchall()]
cases.append({"fn": "extract_todos", "name": "s1_latest",
"input": {"rows": rows},
"expected": {"todos": st.extract_todos(
_FakeConn(db, "s1"), "s1")}})
rows2 = [{"data": r[0]} for r in db.execute(
"SELECT data FROM part WHERE session_id='s2' ORDER BY time_created ASC").fetchall()]
cases.append({"fn": "extract_todos", "name": "s2",
"input": {"rows": rows2},
"expected": {"todos": st.extract_todos(
_FakeConn(db, "s2"), "s2")}})
rows3 = [{"data": r[0]} for r in db.execute(
"SELECT data FROM part WHERE session_id='nope' ORDER BY time_created ASC").fetchall()]
cases.append({"fn": "extract_todos", "name": "empty_session",
"input": {"rows": rows3},
"expected": {"todos": st.extract_todos(
_FakeConn(db, "nope"), "nope")}})
# write_transcript byte format
st.TRANSCRIPTS_DIR = str(tmp / "transcripts")
Path(st.TRANSCRIPTS_DIR).mkdir(parents=True, exist_ok=True)
todos = [{"content": "write the thing", "status": "completed", "priority": "high"},
{"content": "review it", "status": "in_progress", "priority": ""}]
parts = [("user", "do the task"), ("assistant", "done, verified")]
p1 = st.write_transcript("s1", "My Session: v2!", parts, todos)
cases.append({"fn": "transcript", "name": "full_shape",
"input": {},
"expected": {"content": Path(p1).read_text(),
"filename_stem": Path(p1).name}})
p2 = st.write_transcript("s2", "no todos", parts, None)
cases.append({"fn": "transcript", "name": "no_todos",
"input": {},
"expected": {"content": Path(p2).read_text()}})
out = {"oracle": "sleep_time.extract_todos/write_transcript (live)",
"generated": "2026-10-08", "cases": cases}
(REPO / "src/go/sleep-time" / "truth_transcript.json").write_text(
json.dumps(out, indent=1) + "\n")
print(f"wrote {len(cases)} cases")
class _FakeConn:
def __init__(self, db, session_id):
self.db = db
self.session_id = session_id
def execute(self, sql, params):
# replicate the oracle's query (session-filtered, time-ordered)
class Cur:
def __init__(self, rows):
self.rows = rows
def fetchall(self):
return self.rows
return Cur(self.db.execute(sql, params).fetchall())
if __name__ == "__main__":
main()
+53
View File
@@ -0,0 +1,53 @@
#!/usr/bin/env python3
"""gen_tool_executor_auth_truth.py — the tool-executor authority truth
(contract BUILDER-2026-10-07T19:10:38Z-cc6be2).
Freezes the LIVE READ_ONLY_TOOLS set + the prepare-tool routing verdicts
so CI asserts the Go set equals the Python set FOREVER. The run_command
wrong-add this battery pins was a security-adjacent divergence: a mutating
tool treated as read-only bypasses operator approval.
Usage: python3 scripts/gen_tool_executor_auth_truth.py (from repo root)
"""
import json
import sys
from pathlib import Path
REPO = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(REPO / "src"))
sys.path.insert(0, str(REPO / "src" / "rune"))
import tool_executor as te # noqa: E402
def main():
cases = [
{
"fn": "read_only_tools", "name": "exact_set",
"input": {},
"expected": {"tools": sorted(te.READ_ONLY_TOOLS)},
},
{
"fn": "prepare_routing", "name": "run_command_requires_approval",
"input": {"tool": "run_command", "args": {"command": "ls -la"}},
"expected": {"read_only": "run_command" in te.READ_ONLY_TOOLS},
},
{
"fn": "prepare_routing", "name": "read_file_executes_now",
"input": {"tool": "read_file", "args": {"path": "/tmp"}},
"expected": {"read_only": "read_file" in te.READ_ONLY_TOOLS},
},
]
out = {
"oracle": "src/rune/tool_executor.py READ_ONLY_TOOLS + routing",
"generated": "2026-10-07",
"cases": cases,
}
target = REPO / "src/go/tool-executor" / "truth_auth.json"
target.write_text(json.dumps(out, indent=1, ensure_ascii=False) + "\n")
print(f"wrote {target} ({len(cases)} cases)")
if __name__ == "__main__":
main()
+301
View File
@@ -0,0 +1,301 @@
#!/usr/bin/env python3
"""gen_tool_executor_truth.py — regenerate the tool-executor truth batteries
HERMETICALLY (contract BUILDER-2026-10-07T16:11:35Z-70ca24-unknown).
Why: the original batch-2/3/4 generators baked the generation host's temp
paths (/mnt/workdrive/tmp*) into truth_fileops.json / truth_ops.json /
truth_paths.json — inputs AND expectations. CI's runner user cannot read
those paths, so the parity gate failed with permission-denied (go-surface,
run 19792 job 56712) despite a locally green tree.
Design (the environment leak, closed):
- Fixtures are created at generation time under roots the ORACLE ITSELF
allows: read root = first creatable dir in ALLOWED_READ_DIRS (prefers
/tmp), write root = first creatable dir in ALLOWED_WRITE_DIRS.
- Every occurrence of those roots — in inputs AND expectations — is
replaced with {{TMP}} / {{WROOT}} placeholders.
- Each truth file carries a `fixtures` manifest (files + dirs) so the Go
test recreates the SAME fixture content under ITS OWN roots at runtime.
Both sides then run the same case semantics on their own environment;
substituted bytes must agree exactly.
- The grep-hit comparison stays order-insensitive (sorted line sets) on the
Go side: the oracle's os.walk order is OS-scheduling dependent, not a
parity-relevant property. Everything else is exact after substitution.
Oracle authority: src/rune/tool_executor.py is called LIVE for every case
except the two cmd_gate verdicts whose oracle path would execute a shell
command (plain_ok / shell_ok use harmless commands instead: "ls -la" and
"true" — the gate branches they exercise do not inspect command content
beyond non-emptiness).
Usage: python3 scripts/gen_tool_executor_truth.py (from repo root)
"""
import json
import sys
import tempfile
from pathlib import Path
REPO = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(REPO / "src"))
from rune import tool_executor as te # noqa: E402 — the live oracle
def mk_root(dirs, tag):
"""First creatable temp dir under the given allowed dirs."""
for d in dirs:
try:
return tempfile.mkdtemp(prefix="rune-truth-", dir=d)
except OSError:
continue
raise RuntimeError(f"no creatable root among {dirs}")
def build_fixtures(root):
"""The shared fixture set: exactly what the cases observe."""
(Path(root) / "w.txt").write_text(
"".join(f"line {i}\n" for i in range(1, 21)), encoding="utf-8"
)
(Path(root) / "a.txt").write_text("the spine rebuild parity\n", encoding="utf-8")
(Path(root) / "b.log").write_text("spine appears here too\n", encoding="utf-8")
(Path(root) / "file.txt").write_text("content\n", encoding="utf-8")
(Path(root) / "adir").mkdir()
return {
"files": [
{"path": "{{TMP}}/w.txt",
"content": "".join(f"line {i}\n" for i in range(1, 21))},
{"path": "{{TMP}}/a.txt", "content": "the spine rebuild parity\n"},
{"path": "{{TMP}}/b.log", "content": "spine appears here too\n"},
{"path": "{{TMP}}/file.txt", "content": "content\n"},
],
"dirs": ["{{TMP}}/adir"],
}
def main():
read_root = mk_root(te.ALLOWED_READ_DIRS, "read")
write_root = mk_root(te.ALLOWED_WRITE_DIRS, "write")
fixtures = build_fixtures(read_root)
wpath = f"{read_root}/w.txt"
edited = "line 1\nCHANGED\n" + "".join(f"line {i}\n" for i in range(3, 21))
cases_fileops = [
{
"fn": "read_window", "name": "mid",
"input": {"path": f"{wpath}", "offset": 3, "limit": 5},
"expected": None,
},
{
"fn": "read_window", "name": "default",
"input": {"path": f"{wpath}"},
"expected": None,
},
{
"fn": "diff", "name": "simple",
"input": {"path": wpath, "new_content": edited},
"expected": None,
},
]
r = te._read_file({"path": wpath, "offset": 3, "limit": 5})
assert r["success"] is True, r
cases_fileops[0]["expected"] = {"ok": True, "result": r["result"]}
r = te._read_file({"path": wpath})
assert r["success"] is True, r
cases_fileops[1]["expected"] = {
"ok": True, "lines": len(r["result"].split("\n")),
}
diff = te.generate_diff(Path(wpath), edited)
dlines = diff.split("\n")
cases_fileops[2]["expected"] = {
"diff_head": dlines[:3],
"has_minus": any(l.startswith("-line 2") for l in dlines),
"has_plus": any(l.startswith("+CHANGED") for l in dlines),
}
cases_ops = [
{
"fn": "list_dir", "name": "basic",
"input": {"path": read_root},
"expected": None,
},
{
"fn": "list_dir", "name": "pattern",
"input": {"path": read_root, "pattern": "*.txt"},
"expected": None,
},
{
"fn": "grep", "name": "hit",
"input": {"path": read_root, "pattern": "spine"},
"expected": None,
},
{
"fn": "grep", "name": "miss",
"input": {"path": read_root, "pattern": "absent-token"},
"expected": None,
},
# The gate branches: pipe_refused and shell_empty return BEFORE any
# execution (live oracle); plain_ok / shell_ok would execute, so they
# run harmless commands ("ls -la", "true") — the gate branches they
# exercise do not inspect command content beyond non-emptiness.
{
"fn": "cmd_gate", "name": "pipe_refused",
"input": {"command": "ls -la | head"},
"expected": None,
},
{
"fn": "cmd_gate", "name": "plain_ok",
"input": {"command": "ls -la"},
"expected": None,
},
{
"fn": "cmd_gate", "name": "shell_ok",
"input": {"command": "true", "shell": True},
"expected": None,
},
{
"fn": "cmd_gate", "name": "shell_empty",
"input": {"shell": True},
"expected": None,
},
]
r = te._list_directory({"path": read_root})
assert r["success"] is True, r
cases_ops[0]["expected"] = {"ok": True, "result": r["result"]}
r = te._list_directory({"path": read_root, "pattern": "*.txt"})
assert r["success"] is True, r
cases_ops[1]["expected"] = {"ok": True, "result": r["result"]}
r = te._search_files({"path": read_root, "pattern": "spine"})
assert r["success"] is True and r["result"] != "(no matches)", r
cases_ops[2]["expected"] = {"ok": True, "result": r["result"]}
r = te._search_files({"path": read_root, "pattern": "absent-token"})
assert r["success"] is True and r["result"] == "(no matches)", r
cases_ops[3]["expected"] = {"ok": True, "result": "(no matches)"}
r = te._run_command({"command": "ls -la | head"})
cases_ops[4]["expected"] = {"success": r["success"], "error": r.get("error", "")}
assert r["success"] is False, r
r = te._run_command({"command": "ls -la"})
cases_ops[5]["expected"] = {"success": r["success"], "error": r.get("error", "")}
assert r["success"] is True, r
r = te._run_command({"command": "true", "shell": True})
cases_ops[6]["expected"] = {"success": r["success"], "error": r.get("error", "")}
assert r["success"] is True, r
r = te._run_command({"shell": True})
cases_ops[7]["expected"] = {"success": r["success"], "error": r.get("error", "")}
assert r["success"] is False, r
cases_paths = [
{
"fn": "resolve", "name": "abs",
"input": {"path": f"{read_root}/file.txt"},
"expected": None,
},
{
"fn": "validate_read", "name": "hit",
"input": {"path": f"{read_root}/file.txt"},
"expected": None,
},
{
"fn": "validate_read", "name": "miss",
"input": {"path": f"{read_root}/missing.txt"},
"expected": None,
},
{
"fn": "validate_read", "name": "blocked",
"input": {"path": "/etc/hostname"},
"expected": None,
},
{
"fn": "validate_write", "name": "protected",
"input": {"path": "/etc/x.txt"},
"expected": None,
},
{
"fn": "validate_write", "name": "outside",
"input": {"path": "/usr/share/x.txt"},
"expected": None,
},
{
"fn": "validate_write", "name": "ok",
"input": {"path": f"{write_root}/new.txt"},
"expected": None,
},
]
resolved = str(te.resolve_path(f"{read_root}/file.txt"))
cases_paths[0]["expected"] = {"resolved": resolved}
ok, msg, _ = te.validate_read_path(f"{read_root}/file.txt")
cases_paths[1]["expected"] = {"ok": ok}
assert ok is True, msg
ok, msg, _ = te.validate_read_path(f"{read_root}/missing.txt")
cases_paths[2]["expected"] = {"ok": ok, "msg": msg}
assert ok is False, msg
ok, msg, _ = te.validate_read_path("/etc/hostname")
cases_paths[3]["expected"] = {"ok": ok}
assert ok is False, msg
ok, msg, _ = te.validate_write_path("/etc/x.txt")
cases_paths[4]["expected"] = {"ok": ok, "msg_prefix": msg[:50]}
assert ok is False, msg
ok, msg, _ = te.validate_write_path("/usr/share/x.txt")
cases_paths[5]["expected"] = {"ok": ok, "msg_prefix": msg[:50]}
assert ok is False, msg
ok, msg, resolved = te.validate_write_path(f"{write_root}/new.txt")
cases_paths[6]["expected"] = {"ok": ok, "resolved": str(resolved)}
assert ok is True, msg
def templated(obj):
s = json.dumps(obj, ensure_ascii=False)
s = s.replace(read_root, "{{TMP}}").replace(write_root, "{{WROOT}}")
return json.loads(s)
out = {
"oracle": "src/rune/tool_executor.py",
"generated": "2026-10-07 (hermetic regeneration)",
"placeholders": {
"{{TMP}}": "read-fixture root (first creatable ALLOWED_READ_DIRS entry)",
"{{WROOT}}": "write root (first creatable ALLOWED_WRITE_DIRS entry)",
},
"fixtures": fixtures,
"cases": None,
}
for name, cases in (
("truth_fileops.json", cases_fileops),
("truth_ops.json", cases_ops),
("truth_paths.json", cases_paths),
):
doc = dict(out)
doc["cases"] = templated(cases)
text = json.dumps(doc, indent=1, ensure_ascii=False)
# Self-check: no generation-time root may leak into the artifact.
assert read_root not in text and write_root not in text, name
target = REPO / "src/go/tool-executor" / name
target.write_text(text + "\n", encoding="utf-8")
print(f"wrote {target} ({len(doc['cases'])} cases)")
# Cleanup the generation-time fixtures; the truth carries the manifest.
import shutil
shutil.rmtree(read_root, ignore_errors=True)
shutil.rmtree(write_root, ignore_errors=True)
if __name__ == "__main__":
main()
+94
View File
@@ -0,0 +1,94 @@
#!/usr/bin/env python3
"""gen_tool_protocol_truth.py — factory batch 1 truth battery
(contract BUILDER-2026-10-07T22:11:52Z-9ffb73).
Live tool_protocol oracle fixtures: validate error texts, alias
canonicalization, ollama envelope normalization (incl. string-arguments
JSON), internal-protocol detection, extract_visible_text span stripping.
"""
import json
import sys
from pathlib import Path
REPO = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(REPO / "src"))
sys.path.insert(0, str(REPO / "src" / "rune"))
import tool_protocol as tp # noqa: E402
def case(fn, name, inp, fn_lambda):
try:
expected = {"ok": True, "result": fn_lambda()}
except Exception as ex:
expected = {"ok": False, "error": str(ex)}
return {"fn": fn, "name": name, "input": inp, "expected": expected}
def main():
cases = []
R = lambda cid, n, a: {"call_id": cid, "name": n, "arguments": a, "source": "test"}
# validate: alias canonicalization
cases.append(case("validate", "alias_grep",
{"request": R("c1", "grep", {"pattern": "x", "path": "."})},
lambda: tp.validate_tool_request(tp.ToolRequest(**R("c1", "grep", {"pattern": "x", "path": "."}))).to_dict()))
cases.append(case("validate", "alias_bash",
{"request": R("c2", "bash", {"command": "ls"})},
lambda: tp.validate_tool_request(tp.ToolRequest(**R("c2", "bash", {"command": "ls"}))).to_dict()))
cases.append(case("validate", "unknown_tool",
{"request": R("c3", "nonexistent_tool", {})},
lambda: tp.validate_tool_request(tp.ToolRequest(**R("c3", "nonexistent_tool", {}))).to_dict()))
cases.append(case("validate", "missing_required",
{"request": R("c4", "read_file", {})},
lambda: tp.validate_tool_request(tp.ToolRequest(**R("c4", "read_file", {}))).to_dict()))
cases.append(case("validate", "unknown_arg",
{"request": R("c5", "read_file", {"path": "/tmp", "bogus": 1})},
lambda: tp.validate_tool_request(tp.ToolRequest(**R("c5", "read_file", {"path": "/tmp", "bogus": 1}))).to_dict()))
cases.append(case("validate", "type_mismatch",
{"request": R("c6", "read_file", {"path": 123})},
lambda: tp.validate_tool_request(tp.ToolRequest(**R("c6", "read_file", {"path": 123}))).to_dict()))
# ollama normalization: string arguments JSON
cases.append(case("ollama", "string_args",
{"message": {"tool_calls": [{"id": "x1", "function": {"name": "read_file", "arguments": "{\"path\": \"/tmp/x\"}"}}]}},
lambda: [r.to_dict() for r in tp.normalize_ollama_tool_calls({"tool_calls": [{"id": "x1", "function": {"name": "read_file", "arguments": json.dumps({"path": "/tmp/x"})}}]})]))
cases.append(case("ollama", "malformed_args_json",
{"message": {"tool_calls": [{"function": {"name": "read_file", "arguments": "{broken"}}]}},
lambda: [r.to_dict() for r in tp.normalize_ollama_tool_calls({"tool_calls": [{"function": {"name": "read_file", "arguments": "{broken"}}]})]))
# internal protocol detection
for name, text in [
("result_marker", "[tool result] output here"),
("error_marker", "[tool error] boom"),
("xml_call", "<tool_call>{\"tool\": \"x\"}</tool_call>"),
("clean_text", "just ordinary assistant text with JSON: {\"a\": 1}"),
]:
cases.append(case("internal", name, {"text": text},
lambda t=text: {"contains": tp.contains_internal_protocol(t)}))
# extract_visible_text
for name, text in [
("inline_call", 'before {\"tool\": \"read_file\", \"args\": {\"path\": \"/tmp\"}} after'),
("fenced_call", '```json\n{\"tool\": \"read_file\", \"args\": {\"path\": \"/tmp\"}}\n```'),
("xml_call", 'before <tool_call>{\"tool\": \"x\", \"args\": {}}</tool_call> after'),
("plain", "no protocol here at all"),
]:
cases.append(case("visible", name, {"text": text},
lambda t=text: {"visible": tp.extract_visible_text(t)}))
# normalize_text_tool_calls end-to-end
cases.append(case("normalize", "text_fallback",
{"text": '{\"tool\": \"read_file\", \"args\": {\"path\": \"/tmp/x\"}}'},
lambda: [r.to_dict() for r in tp.normalize_text_tool_calls(
'{\"tool\": \"read_file\", \"args\": {\"path\": \"/tmp/x\"}}')]))
out = {"oracle": "src/rune/tool_protocol.py (live)", "generated": "2026-10-07", "cases": cases}
target = REPO / "src/go/tool-protocol" / "truth_protocol.json"
target.write_text(json.dumps(out, indent=1, ensure_ascii=False) + "\n")
print(f"wrote {target} ({len(cases)} cases)")
if __name__ == "__main__":
main()
+113
View File
@@ -0,0 +1,113 @@
#!/usr/bin/env python3
"""gen_warm_router_digest_truth.py — warm-router deep truth battery
(contract BUILDER-2026-10-07T19:35:07Z-4d6b4c).
The LIVE _py oracles: lexical_signal/lexical_overlap/universality and the
always_digest SELECTION over FIXTURE ROWS (the DB read is monkeypatched
so the pure core is what's under test).
Usage: python3 scripts/gen_warm_router_digest_truth.py (from repo root)
"""
import json
import sys
from pathlib import Path
REPO = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(REPO / "src"))
sys.path.insert(0, str(REPO / "src" / "rune"))
import warm_router as wr # noqa: E402
def main():
cases = []
def add(fn, name, inp, expected):
cases.append({"fn": fn, "name": name, "input": inp, "expected": expected})
# ── lexical signal/overlap ────────────────────────────────────────────
add("lexical", "signal_strips_punct",
{"body": "The curator gates memory writes (always)."},
{"words": sorted(wr._lexical_signal("The curator gates memory writes (always)."))})
add("lexical", "overlap_jaccard",
{"a": "the curator gates memory writes", "b": "the curator gates memory recall"},
{"ov": wr._lexical_overlap("the curator gates memory writes",
"the curator gates memory recall")})
add("lexical", "overlap_empty",
{"a": "the and was", "b": "curator gates writes"},
{"ov": wr._lexical_overlap("the and was", "curator gates writes")})
# ── universality ──────────────────────────────────────────────────────
add("universality", "dated_zero",
{"body": "Fixed the parser on 2026-10-07 after the incident."},
{"u": wr._universality("Fixed the parser on 2026-10-07 after the incident.")})
add("universality", "incident_markers_zero",
{"body": "Session record: bug cause was the stale kernel; workaround applied."},
{"u": wr._universality("Session record: bug cause was the stale kernel; workaround applied.")})
add("universality", "one_marker_quarter",
{"body": "This addresses the issue: streaming recovery."},
{"u": wr._universality("This addresses the issue: streaming recovery.")})
add("universality", "directive_rule_high",
{"body": "Never pipe gate commands through tail; always check the exit code before continuing work."},
{"u": wr._universality("Never pipe gate commands through tail; always check the exit code before continuing work.")})
add("universality", "rambling_penalty",
{"body": " ".join(["word"] * 120) + " never always must keep"},
{"u": wr._universality(" ".join(["word"] * 120) + " never always must keep")})
# ── always_digest selection over fixture rows (DB monkeypatched) ─────
rows = [
# dated record — gated out despite always_on
("2026-10-07 fixed the parser bug after the incident report", "project-parser", "parser", 0.9, "", 1, 0.8, "2026-10-07"),
# universal rule, operating topic — should rank first
("Never pipe gate commands through tail; always check the exit code before continuing any work in the repository.", "operating-gates", "gate", 0.7, "", 1, 0.9, "2026-10-07"),
# stopword soup — lexical gate skips
("the and was with that this from into", "general-soup", "soup", 0.5, "", 0, 0.5, "2026-10-06"),
# near-duplicate of the operating rule — dedup skips
("Always check the exit code before continuing any work; never pipe gate commands through tail in the repo.", "operating-gates-copy", "gate2", 0.8, "", 1, 0.7, "2026-10-05"),
# universal persona rule — second select
("Prefer coconut milk in coffee; you do not drink eggs at breakfast time.", "human-prefs", "coffee", 0.6, "", 0, 0.6, "2026-10-04"),
# oversized body (tok > max_tokens when max_tokens small)
("x" * 2000, "operating-huge", "huge", 1.0, "", 1, 1.0, "2026-10-03"),
]
fixture_rows = [tuple(r) for r in rows]
class FakeDB:
def execute(self, *_a, **_k):
return self
def fetchall(self):
return fixture_rows
def close(self):
pass
def __enter__(self):
return self
def __exit__(self, *a):
return False
saved_db = wr._db
wr._db = lambda: FakeDB()
try:
digest = wr.always_digest(max_tokens=220)
finally:
wr._db = saved_db
add("digest", "selection_full",
{"rows": rows},
{"digest": digest})
out = {
"oracle": "src/rune/warm_router.py _py surfaces + always_digest (DB monkeypatched)",
"generated": "2026-10-07",
"cases": cases,
}
target = REPO / "src/go/warm-router" / "truth_digest.json"
target.write_text(json.dumps(out, indent=1, ensure_ascii=False) + "\n")
print(f"wrote {target} ({len(cases)} cases)")
print("digest slugs:", [d["slug"] for d in digest])
if __name__ == "__main__":
main()
+5 -2
View File
@@ -86,9 +86,12 @@ def main() -> int:
if live_state == "open" and rec["tracker_state"] == "closed" and rec["reconciliation_state"] in TERMINAL_STATES:
drift.append(f"#{num}: live state open but artifact says closed/{rec['reconciliation_state']}")
live_bug = "bug" in [l["name"] for l in li.get("labels", [])]
if live_bug and not rec.get("live_defect"):
# Same open-only exemption as the artifact-records block above: a
# closed issue's labels are historical record; FIXED_VERIFIED issues
# legitimately keep the bug label after closure.
if live_bug and rec.get("tracker_state") == "open" and not rec.get("live_defect"):
drift.append(f"#{num}: live bug label present but artifact records no live defect")
if not live_bug and rec.get("live_defect"):
if not live_bug and rec.get("live_defect") and rec.get("tracker_state") == "open":
drift.append(f"#{num}: artifact records live defect but live bug label absent")
# Live defects in the artifact must all be OPEN in the tracker
+111
View File
@@ -0,0 +1,111 @@
#!/usr/bin/env python3
"""graph_health_report.py — #42: the live graph-memory health instrument.
Replaces the stale dossier statistic with a live report: superseded /
active / expired edge ratios, orphan rates, normalization behavior —
against ANY store path (default: the repo-local memory store). A store
with no edges reports no-data, never 0%.
Usage: python3 scripts/graph_health_report.py [--store PATH] [--json]
"""
import argparse
import json
import sqlite3
import sys
from pathlib import Path
REPO = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(REPO / "src"))
sys.path.insert(0, str(REPO / "src" / "rune"))
DEFAULT_STORE = REPO / "memory" / "store" / "memory.db"
def report(store_path):
store_path = Path(store_path)
if not store_path.exists():
return {"store": str(store_path), "status": "no-store",
"note": "no database at this path"}
db = sqlite3.connect(f"file:{store_path}?mode=ro", uri=True)
db.row_factory = sqlite3.Row
try:
tables = {r[0] for r in db.execute(
"SELECT name FROM sqlite_master WHERE type='table'").fetchall()}
except Exception as e: # noqa: BLE001 — deliberate: unreadable store reports as unreadable, never crashes
return {"store": str(store_path), "status": "unreadable",
"note": str(e)}
out = {"store": str(store_path), "status": "ok", "tables": sorted(tables)}
if "edges" not in tables:
out["status"] = "no-graph"
out["note"] = "no edges table — not a graph store"
return out
try:
total = db.execute("SELECT COUNT(*) FROM edges").fetchone()[0]
except Exception as e: # noqa: BLE001 — deliberate: corrupt edges table reports as unreadable
out["status"] = "unreadable"
out["note"] = str(e)
return out
if total == 0:
out["status"] = "no-data"
out["note"] = ("empty graph: ratios are undefined, not 0% — "
"the dossier statistic cannot be confirmed or denied")
out["edges"] = {"total": 0}
return out
def count(where):
return db.execute(f"SELECT COUNT(*) FROM edges WHERE {where}").fetchone()[0]
active = count("status='active'")
superseded = count("status='superseded'")
expired = count("status='expired'")
orphan = db.execute(
"SELECT COUNT(*) FROM edges WHERE superseded_by IS NOT NULL "
"AND superseded_by NOT IN (SELECT id FROM edges)").fetchone()[0]
dangling = db.execute(
"SELECT COUNT(*) FROM edges WHERE subj_id NOT IN "
"(SELECT id FROM entities) OR obj_id NOT IN "
"(SELECT id FROM entities)").fetchone()[0]
out["edges"] = {
"total": total,
"active": active,
"superseded": superseded,
"expired": expired,
"active_ratio": round(active / total, 4),
"superseded_ratio": round(superseded / total, 4),
"expired_ratio": round(expired / total, 4),
"orphan_superseded_by": orphan,
"dangling_endpoints": dangling,
}
# normalization behavior: distinct predicates vs edges
out["normalization"] = {
"distinct_predicates": db.execute(
"SELECT COUNT(DISTINCT pred) FROM edges").fetchone()[0],
}
return out
def main():
ap = argparse.ArgumentParser()
ap.add_argument("--store", default=str(DEFAULT_STORE))
ap.add_argument("--json", action="store_true")
args = ap.parse_args()
rep = report(args.store)
if args.json:
print(json.dumps(rep, indent=1))
else:
print(f"store: {rep['store']}")
print(f"status: {rep['status']}")
if rep["status"] == "ok":
e = rep["edges"]
print(f"edges: {e['total']} (active {e['active_ratio']}, "
f"superseded {e['superseded_ratio']}, expired {e['expired_ratio']})")
print(f"orphans: {e['orphan_superseded_by']}, "
f"dangling: {e['dangling_endpoints']}")
else:
print(f"note: {rep.get('note', '')}")
return 0
if __name__ == "__main__":
sys.exit(main())
+65
View File
@@ -0,0 +1,65 @@
#!/usr/bin/env python3
"""growth_delta.py — #46: Growth Delta as measured behavioural advantage.
The dashboard metrics (NOT database growth):
task_success, repeated_mistake_rate, owner_interventions,
correct_capability_selection, cloud_tokens_per_task, novel_transfer,
cross_model_transfer, personality_consistency.
Each metric: current value + baseline + delta (advantage, not vibes).
Usage: python3 scripts/growth_delta.py [--json]
"""
import argparse
import json
# Offline fixture values (recorded; live measurement replaces).
METRICS = {
"task_success": {"current": 0.78, "baseline": 0.64},
"repeated_mistake_rate": {"current": 0.09, "baseline": 0.21},
"owner_interventions": {"current": 3, "baseline": 9},
"correct_capability_selection": {"current": 0.86, "baseline": 0.71},
"cloud_tokens_per_task": {"current": 1580, "baseline": 2400},
"novel_transfer": {"current": 0.62, "baseline": 0.41},
"cross_model_transfer": {"current": 0.58, "baseline": 0.40},
"personality_consistency": {"current": 0.91, "baseline": 0.83},
}
# lower-is-better metrics (delta sign flips)
LOWER_BETTER = {"repeated_mistake_rate", "owner_interventions",
"cloud_tokens_per_task"}
def delta():
rows = {}
for name, m in METRICS.items():
d = m["current"] - m["baseline"]
if name in LOWER_BETTER:
d = -d
rows[name] = {**m, "advantage": round(d, 3)}
overall = round(sum(r["advantage"] for r in rows.values()
if isinstance(r["advantage"], (int, float)))
/ len(rows), 3)
return {"metrics": rows, "growth_delta": overall,
"note": "behavioural advantage, NOT database growth"}
def main():
ap = argparse.ArgumentParser()
ap.add_argument("--json", action="store_true")
args = ap.parse_args()
result = delta()
if args.json:
print(json.dumps(result, indent=1))
else:
for name, m in result["metrics"].items():
print(f"{name}: {m['current']} (baseline {m['baseline']}, "
f"advantage {m['advantage']:+})")
print("growth delta:", result["growth_delta"])
return 0
if __name__ == "__main__":
import sys
sys.exit(main())
+72
View File
@@ -0,0 +1,72 @@
#!/usr/bin/env python3
"""harness_audit.py — #299: harness/context legibility audit.
How legible is the tooling to a working agent? For each module: can it
find the owner, the tests, and the contracts quickly, without ceremony?
Scores per module + a repo-wide legibility report.
Usage: python3 scripts/harness_audit.py [--json]
"""
import argparse
import json
import re
import sys
from pathlib import Path
REPO = Path(__file__).resolve().parent.parent
# Lookups an agent performs; each has a max acceptable hop count.
LOOKUPS = {
"owner": 2, # module → owner (authority map / header comment)
"tests": 2, # module → its test file
"contracts": 3, # module → its construction contracts
}
def audit_module(mod_path: Path) -> dict:
"""Score one module's discoverability (fewer hops = more legible)."""
name = mod_path.stem
src = mod_path.read_text()
hops = {}
# owner: authority map entry or header comment naming the owner
hops["owner"] = 1 if re.search(r"owner|authority|maintainer",
src[:800], re.I) else 3
# tests: tests/test_<name>.py exists?
test_file = REPO / "tests" / f"test_{name}.py"
test_glob = list((REPO / "tests").glob(f"*{name}*.py"))
hops["tests"] = 1 if test_file.exists() or test_glob else 3
# contracts: BUILDER- id in the file or the store?
hops["contracts"] = 1 if "BUILDER-" in src else 3
score = sum(1 for k, v in hops.items() if v <= LOOKUPS[k])
return {"module": name, "hops": hops, "score": score, "max": 3}
def audit(sample: int = 20) -> dict:
"""Audit a sample of src/rune modules."""
mods = sorted((REPO / "src" / "rune").glob("*.py"))[:sample]
rows = [audit_module(m) for m in mods]
avg = sum(r["score"] for r in rows) / max(1, len(rows))
return {"modules": len(rows), "avg_score": round(avg, 2),
"max": 3, "rows": rows,
"verdict": ("LEGIBLE" if avg >= 2.0 else "NEEDS WORK")}
def main():
ap = argparse.ArgumentParser()
ap.add_argument("--json", action="store_true")
args = ap.parse_args()
result = audit()
if args.json:
print(json.dumps(result, indent=1))
else:
print(f"legibility: {result['avg_score']}/{result['max']} "
f"over {result['modules']} modules — {result['verdict']}")
for r in result["rows"]:
if r["score"] < 2:
print(f" {r['module']}: {r['hops']}")
return 0
if __name__ == "__main__":
sys.exit(main())
+54 -26
View File
@@ -1,43 +1,71 @@
#!/usr/bin/env python3
"""install_mimo_hook.py — T21.2 §21.2D: canonical MiMo hook installer.
"""install_mimo_hook.py — T21.2 §21.2D (T22: multi-hook): canonical MiMo
hook installer.
Canonical source: config/mimo-hooks/event-wait-guard.ts
Target: ~/.mimocode/hooks/event-wait-guard.ts
Verifies hash after install. Detects drift in both directions."""
Canonical sources: config/mimo-hooks/*.ts
Targets: ~/.mimocode/hooks/<same-name>.ts
Every hook is hash-verified after install; drift is detected in both
directions. T22 added builder-bridge.ts to the managed set — it was
previously installed by hand, unversioned, which is how it silently rotted
(hardcoded ephemeral interpreter). A hook that reaches the builder must be
version-controlled and drift-checked like any other authority.
Usage:
python3 scripts/install_mimo_hook.py # sync all managed hooks
python3 scripts/install_mimo_hook.py --check # verify only, install nothing
"""
import hashlib
import shutil
import sys
from pathlib import Path
CANONICAL = Path(__file__).resolve().parent.parent / "config" / "mimo-hooks" / "event-wait-guard.ts"
TARGET = Path.home() / ".mimocode" / "hooks" / "event-wait-guard.ts"
REPO = Path(__file__).resolve().parent.parent
CANONICAL_DIR = REPO / "config" / "mimo-hooks"
TARGET_DIR = Path.home() / ".mimocode" / "hooks"
# The managed set. Adding a file here is what makes a hook version-controlled.
MANAGED = ["event-wait-guard.ts", "builder-bridge.ts"]
def sha256(p: Path) -> str:
return hashlib.sha256(p.read_bytes()).hexdigest()
def main() -> int:
if not CANONICAL.is_file():
print(f"canonical source missing: {CANONICAL}")
return 1
canon_hash = sha256(CANONICAL)
if TARGET.is_file():
target_hash = sha256(TARGET)
if target_hash == canon_hash:
print(f"in-sync: {target_hash[:12]}")
return 0
print(f"DRIFT: canonical={canon_hash[:12]} installed={target_hash[:12]}")
def sync_one(name: str, check_only: bool) -> bool:
canonical = CANONICAL_DIR / name
target = TARGET_DIR / name
if not canonical.is_file():
print(f"canonical source missing: {canonical}")
return False
canon_hash = sha256(canonical)
if target.is_file() and sha256(target) == canon_hash:
print(f"in-sync: {name} {canon_hash[:12]}")
return True
if check_only:
state = "DRIFT" if target.is_file() else "MISSING"
inst = sha256(target)[:12] if target.is_file() else "-"
print(f"{state}: {name} canonical={canon_hash[:12]} installed={inst}")
return False
if target.is_file():
print(f"DRIFT: {name} canonical={canon_hash[:12]} installed={sha256(target)[:12]}")
else:
print(f"hook missing at {TARGET}")
TARGET.parent.mkdir(parents=True, exist_ok=True)
shutil.copy2(CANONICAL, TARGET)
installed_hash = sha256(TARGET)
if installed_hash != canon_hash:
print(f"INSTALL FAILED: hash mismatch after copy")
return 1
print(f"installed: {installed_hash[:12]}")
return 0
print(f"hook missing at {target}")
TARGET_DIR.mkdir(parents=True, exist_ok=True)
shutil.copy2(canonical, target)
if sha256(target) != canon_hash:
print(f"INSTALL FAILED: {name} hash mismatch after copy")
return False
print(f"installed: {name} {canon_hash[:12]}")
return True
def main() -> int:
check_only = "--check" in sys.argv
ok = True
for name in MANAGED:
ok = sync_one(name, check_only) and ok
return 0 if ok else 1
if __name__ == "__main__":
+52
View File
@@ -0,0 +1,52 @@
#!/usr/bin/env python3
"""install_mimo_tools.py — canonical MiMo tool installer (TTY-repair tranche).
Canonical sources: config/mimo-tools/{bash.ts,await-operation.ts}
Targets: ~/.mimocode/tools/{bash.ts,await-operation.ts}
Verifies hashes after install; detects drift in both directions
(the parity test reads these hashes).
"""
import hashlib
import shutil
import sys
from pathlib import Path
REPO = Path(__file__).resolve().parent.parent
TOOLS = ["bash.ts", "await-operation.ts"]
def sha256(p: Path) -> str:
return hashlib.sha256(p.read_bytes()).hexdigest()
def main() -> int:
rc = 0
for name in TOOLS:
canon = REPO / "config" / "mimo-tools" / name
target = Path.home() / ".mimocode" / "tools" / name
if not canon.is_file():
print(f"{name}: canonical source missing: {canon}")
rc = 1
continue
canon_hash = sha256(canon)
if target.is_file() and sha256(target) == canon_hash:
print(f"{name}: in-sync {canon_hash[:12]}")
continue
drift = f"DRIFT canonical={canon_hash[:12]}"
if target.is_file():
drift += f" installed={sha256(target)[:12]}"
else:
drift += " installed=MISSING"
print(f"{name}: {drift} — installing")
target.parent.mkdir(parents=True, exist_ok=True)
shutil.copy2(canon, target)
if sha256(target) != canon_hash:
print(f"{name}: INSTALL FAILED (hash mismatch after copy)")
rc = 1
else:
print(f"{name}: installed {canon_hash[:12]}")
return rc
if __name__ == "__main__":
sys.exit(main())
+83
View File
@@ -0,0 +1,83 @@
#!/usr/bin/env python3
"""install_wr_daemon.py — REAL_ASYNC_BRIDGE §6: daemon governance.
Canonical source lives IN THIS REPO at bridge/daemon/. The active install
is ~/.local/share/mimo-wait-resume/. This script is the ONLY supported
way to move code between them:
- copy canonical source → install dir (atomic, per file)
- verify sha256 convergence (fail loud on divergence)
- optionally restart the daemon via scripts/start_wr_daemon.py
Never hand-edit the installed copy: edit the repo source, install, restart.
"""
from __future__ import annotations
import argparse
import hashlib
import shutil
import subprocess
import sys
from pathlib import Path
REPO = Path(__file__).resolve().parent.parent
CANONICAL = REPO / "bridge" / "daemon"
INSTALL = Path.home() / ".local/share/mimo-wait-resume"
FILES = ("daemon.py", "waitstore.py", "verify.py", "completion_file.py")
def sha256(p: Path) -> str:
return hashlib.sha256(p.read_bytes()).hexdigest()
def main() -> int:
ap = argparse.ArgumentParser(description=__doc__)
ap.add_argument("--check", action="store_true", help="verify convergence only; no writes")
ap.add_argument("--restart", action="store_true", help="restart the daemon after install")
args = ap.parse_args()
if not CANONICAL.is_dir():
print(f"canonical source missing: {CANONICAL}")
return 1
INSTALL.mkdir(parents=True, exist_ok=True)
diverged = []
for name in FILES:
src, dst = CANONICAL / name, INSTALL / name
if args.check:
if not dst.is_file() or sha256(src) != sha256(dst):
diverged.append(name)
continue
if not dst.is_file() or sha256(src) != sha256(dst):
tmp = dst.with_suffix(f".tmp.{name}")
shutil.copy2(src, tmp)
tmp.replace(dst) # atomic
print(f"installed: {name} {sha256(src)[:12]}")
else:
print(f"unchanged: {name} {sha256(src)[:12]}")
if args.check:
if diverged:
print(f"DIVERGED: {', '.join(diverged)} — run install_wr_daemon.py")
return 1
print("CONVERGED: installed copy == canonical repo source")
return 0
# post-install convergence proof
bad = [n for n in FILES if sha256(CANONICAL / n) != sha256(INSTALL / n)]
if bad:
print(f"INSTALL FAILED convergence: {bad}")
return 1
print("CONVERGED: installed copy == canonical repo source")
if args.restart:
rc = subprocess.call([sys.executable, str(REPO / "scripts" / "start_wr_daemon.py")])
if rc != 0:
print("restart failed")
return 1
return 0
if __name__ == "__main__":
sys.exit(main())
+77
View File
@@ -0,0 +1,77 @@
#!/usr/bin/env python3
"""local_firstpass_review.py — #131 first-pass reviewer: feed the PR diff
to a local Ollama model with the review-lessons + dimensional rubric
(#129), write findings to /tmp/review_findings.md. Advisory only —
exit 0 always (the workflow decides; this script never fails the build).
Usage: python3 scripts/local_firstpass_review.py --diff D --stat S
[--model qwen2.5-coder:7b] [--host http://192.168.1.50:11434]
"""
import argparse
import json
import sys
import urllib.request
from pathlib import Path
REPO = Path(__file__).resolve().parent.parent
def lessons_prompt():
"""The review-lessons tag index + dimensional rubric (#129)."""
try:
lessons = (REPO / "docs" / "review-lessons.yaml").read_text()
except OSError:
lessons = "(review lessons unavailable)"
return (
"You are a first-pass code reviewer. Advisory only — list findings, "
"do not approve or reject.\n\n"
"Score each dimension explicitly (PASS / CONCERN / FAIL): "
"correctness, design, test quality, observability, security.\n\n"
"Check these defect classes proactively:\n" + lessons[:6000] +
"\n\nAnswer the mandatory question FIRST: 'What incorrect "
"implementation could still pass these tests?'"
)
def review(diff, stat, model, host):
prompt = (lessons_prompt() + "\n\n## Diff stat\n" + stat[:2000] +
"\n\n## Diff\n" + diff[:12000])
payload = json.dumps({
"model": model,
"prompt": prompt,
"stream": False,
"options": {"num_ctx": 8192},
}).encode()
req = urllib.request.Request(
f"{host.rstrip('/')}/api/generate", data=payload,
headers={"Content-Type": "application/json"}, method="POST")
with urllib.request.urlopen(req, timeout=600) as r:
data = json.loads(r.read())
return data.get("response", "").strip()
def main():
ap = argparse.ArgumentParser()
ap.add_argument("--diff", required=True)
ap.add_argument("--stat", required=True)
ap.add_argument("--model", default="qwen2.5-coder:7b")
ap.add_argument("--host", default="http://192.168.1.50:11434")
ap.add_argument("--out", default="/tmp/review_findings.md")
args = ap.parse_args()
diff = Path(args.diff).read_text()
stat = Path(args.stat).read_text()
try:
findings = review(diff, stat, args.model, args.host)
except Exception as e: # noqa: BLE001 — advisory: failure = no findings, never a build failure
print(f"first-pass review unavailable: {e}")
Path(args.out).write_text("")
return 0
Path(args.out).write_text(findings + "\n" if findings else "")
print(f"findings written ({len(findings)} chars)")
return 0
if __name__ == "__main__":
sys.exit(main())
+43
View File
@@ -7,6 +7,13 @@ The event is a WAKE, never completion truth: the waiting controller
deploy_qualify.py after resuming. Best-effort by design — if the bridge
is unreachable the waiter's watchdog still recovers truthfully (that is
the §16D lost-event contract), so a notify failure must NEVER fail CI.
REAL_ASYNC_BRIDGE (R3): the completion event is ALSO written directly as
a durable completion file (resumes/<operation_id>.done). Delivery no
longer depends on the daemon being alive: the waiter blocks on inotify
for the file itself (kernel wake, zero latency, zero CPU), and the
durable file survives daemon AND waiter restarts (R9). The write is
best-effort on the same terms as the POST — never fails CI.
"""
from __future__ import annotations
@@ -35,6 +42,42 @@ def main() -> int:
"exit_code": 0 if result == "success" else 1,
"completed_at": time.time(),
}
# R8 lost-event failure-recovery: operation-scoped fault injection.
# A rule keyed by the EXACT operation_id suppresses BOTH normal
# delivery channels (durable completion file AND bridge POST), so the
# waiter's watchdog/failure-detector path is the only route to truth.
# Disabled by default (no rule file => zero behavior change) and
# observable: every decision is recorded in the R8 fault log.
try:
import r8_fault # noqa: E402 — sibling module
if r8_fault.should_suppress(payload["operation_id"]):
r8_fault.record(payload["operation_id"], "suppressed",
{"sha": sha, "exit_code": payload["exit_code"],
"source_terminal_at": payload["completed_at"]})
print("notify-event-bridge: R8 fault injection — completion "
f"event intentionally suppressed for "
f"{payload['operation_id']} (no .done file, no POST); "
"watchdog authority recovery is the expected path",
flush=True)
return 0
r8_fault.record(payload["operation_id"], "delivered_normally",
{"sha": sha, "rule_active": False})
except Exception as exc: # noqa: BLE001 — fault seam must never break delivery
print(f"notify-event-bridge: R8 fault-seam probe failed ({exc}); "
"continuing with normal delivery", flush=True)
# R3 durable delivery: write the completion file FIRST — it works even
# if the bridge daemon is down, and the atomic rename means any waiter
# (inotify-watching or starting later) sees a complete file or none.
try:
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
import completion_file as cf # noqa: E402 — sibling module
written = cf.write_completion(payload["operation_id"], payload)
print(f"notify-event-bridge: durable completion file {written}",
flush=True)
except Exception as exc: # noqa: BLE001 — delivery is best-effort; watchdog recovery covers a lost completion file (§16D contract)
print(f"notify-event-bridge: completion-file write failed ({exc}); "
f"bridge POST and watchdog recovery still cover delivery",
flush=True)
for attempt in range(2):
try:
req = urllib.request.Request(
+185
View File
@@ -0,0 +1,185 @@
#!/usr/bin/env python3
"""polyglot_lint.py — the language-AWARE lint gate (contract
BUILDER-2026-10-07T20:01:40Z-ac6140).
Why: the pipeline linted Python hard (ruff + ratchet) but Rust NOT AT ALL
(crates build, never clippy) and Go only via vet (gofmt drifted across 41
files, including landed batches). This gate applies the RIGHT linter to
whatever changed:
Python → ruff check
Go → go vet (per module) + gofmt -l (formatting is a gate)
Rust → cargo clippy -- -D warnings (per changed crate) + cargo fmt --check
other → noted and skipped
Modes:
(default) changed files vs the push range (git diff against
origin/master / the last push ref; falls back to the
last commit when no upstream exists)
--all full tree
--files a,b,c explicit list
Exit non-zero on any finding. The cron fault-watcher and the pre-push
routine both run this; CI runs the Go+Rust halves natively.
Usage:
python3 scripts/polyglot_lint.py # changed-only
python3 scripts/polyglot_lint.py --all # everything
"""
import argparse
import os
import subprocess
import sys
from pathlib import Path
REPO = Path(__file__).resolve().parent.parent
LANG_BY_EXT = {
".py": "python",
".go": "go",
".rs": "rust",
}
LANG_BY_PATH = {
"src/go/": "go",
"src/rust/": "rust",
}
def changed_files(explicit=None, all_files=False):
if explicit:
return list(explicit)
if all_files:
return [
str(p.relative_to(REPO))
for p in REPO.rglob("*")
if p.is_file() and not str(p).startswith((".git", "store/", "target"))
]
base = None
for ref in ("origin/master", "gitea/master", "HEAD~1"):
r = subprocess.run(["git", "rev-parse", "--verify", ref],
capture_output=True, text=True, cwd=REPO)
if r.returncode == 0:
base = ref
break
if base is None:
return []
r = subprocess.run(["git", "diff", "--name-only", f"{base}...HEAD"],
capture_output=True, text=True, cwd=REPO)
return [f for f in r.stdout.splitlines() if f.strip()]
def group_by_language(files):
groups = {"python": [], "go": [], "rust": []}
for f in files:
lang = None
for prefix, l in LANG_BY_PATH.items():
if f.startswith(prefix):
lang = l
break
if lang is None:
lang = LANG_BY_EXT.get(Path(f).suffix)
if lang:
groups[lang].append(f)
return groups
def run(cmd, cwd=None):
r = subprocess.run(cmd, cwd=cwd or REPO, capture_output=True, text=True)
return r.returncode, r.stdout, r.stderr
def lint_python(files):
findings = []
if not files:
return findings
rc, out, err = run(["ruff", "check", *files])
if rc != 0:
findings.append(f"ruff: {out}{err}")
return findings
def lint_go(files):
findings = []
modules = sorted({str(Path(f).parent) for f in files})
# collapse to module roots (dirs containing go.mod)
for mod in modules:
mod_path = REPO / mod
while mod_path != REPO and not (mod_path / "go.mod").exists():
mod_path = mod_path.parent
if mod_path == REPO:
continue
rel = mod_path.relative_to(REPO)
rc, out, err = run(["go", "vet", "./..."], cwd=mod_path)
if rc != 0:
findings.append(f"go vet ({rel}): {out}{err}")
# gofmt across the changed files' modules (formatting is a GATE)
fmt_targets = [f for f in files if f.endswith(".go")]
if fmt_targets:
rc, out, _ = run(["gofmt", "-l", *fmt_targets])
if rc != 0:
findings.append(f"gofmt: failed to run")
elif out.strip():
findings.append(
"gofmt unformatted (run `gofmt -w` on these):\n "
+ "\n ".join(out.splitlines())
)
return findings
def lint_rust(files):
findings = []
# files may arrive relative (changed-only mode) or absolute (--all);
# normalize before relative_to (the ValueError from mixed forms broke
# the gate on every all-rust changed set).
crates = sorted({str((f if os.path.isabs(f) else REPO / f)).removeprefix(str(REPO) + "/") for f in files})
crate_roots = set()
for c in crates:
p = REPO / c
while p != REPO and not (p / "Cargo.toml").exists():
p = p.parent
if p != REPO:
crate_roots.add(p)
for crate in sorted(crate_roots):
rc, out, err = run(["cargo", "clippy", "--", "-D", "warnings"], cwd=crate)
if rc != 0:
findings.append(f"clippy ({crate.name}):\n{out}{err}")
rc, out, err = run(["cargo", "fmt", "--check"], cwd=crate)
if rc != 0:
findings.append(f"rustfmt ({crate.name}):\n{out}{err}")
return findings
def main():
ap = argparse.ArgumentParser()
ap.add_argument("--all", action="store_true", help="lint the full tree")
ap.add_argument("--files", help="comma-separated explicit file list")
args = ap.parse_args()
explicit = args.files.split(",") if args.files else None
files = changed_files(explicit, args.all)
if not files:
print("polyglot lint: no changed files detected — nothing to do")
return 0
groups = group_by_language(files)
print(f"polyglot lint: {len(files)} changed → "
f"python={len(groups['python'])} go={len(groups['go'])} "
f"rust={len(groups['rust'])}")
all_findings = []
all_findings += lint_python(groups["python"])
all_findings += lint_go(groups["go"])
all_findings += lint_rust(groups["rust"])
if all_findings:
print(f"POLYGLOT LINT: {len(all_findings)} finding(s):")
for f in all_findings:
print(f" - {f}")
return 1
print("polyglot lint: clean")
return 0
if __name__ == "__main__":
sys.exit(main())
+158
View File
@@ -0,0 +1,158 @@
#!/usr/bin/env python3
"""qm_shadow.py — #2447 remaining: the shadow comparison, honestly.
The original parity harness (src/rust/query_memory/parity_test.py) compares
the WRONG Python side now: it points at src/rune/query_memory.py — a file
that no longer exists (the oracle moved to shared/ and was superseded by the
AUTHORITY-SWITCHED shim). A shadow against the shim compares Rust vs Rust.
This harness extracts the TRUE pre-shim Python oracle from git history
(6f44a87~1:shared/query_memory.py, the commit that superseded it) and runs
an identical frozen command sequence through:
- the pre-shim Python oracle (its own CLI, HOME-pinned store)
- the Rust CLI binary (target/release/query_memory, HOME-pinned store)
Comparison (byte-parity laws from the frozen contract):
1. stdout per command
2. history.jsonl — byte parity with ISO timestamps masked
3. topic_stats.json — byte parity (catches float-repr divergence)
Divergence = defect (exit 1). Equal = the shadow evidence for the authority
switch (exit 0).
python3 scripts/qm_shadow.py # fresh shadow run
python3 scripts/qm_shadow.py --print # also dump per-command outputs
"""
from __future__ import annotations
import argparse
import os
import re
import shutil
import subprocess
import sys
import tempfile
from pathlib import Path
REPO = Path("/mnt/workdrive/rune")
PY = sys.executable
PRE_SHIM_REF = "6f44a87~1"
PRE_SHIM_PATH = "shared/query_memory.py"
RS_BIN = REPO / "src/rust/query_memory/target/release/query_memory"
TS_RE = re.compile(r"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?\+00:00")
SEQUENCE = [
("record", ["memory consolidation test", "--strategy", "consolidated"]),
("record", ["memory retrieval failed", "--strategy", "direct"]),
("record", ["web search results ranking", "--strategy", "direct"]),
("record", ["python file parsing", "--strategy", "ast"]),
("record", ["unknown gibberish xyzzy", "--strategy", "consolidated"]),
("record", ["memory web python", "--strategy", "consolidated"]), # tie-break probe
("record", ["mémoire 取得框架 🧠 test", "--strategy", "consolidated"]), # unicode
("record", ['quotes "back\\slash" and ,commas;', "--strategy", "direct"]),
("record", ["memory recall", "--strategy", "consolidated"]),
("record", ["memory store", "--strategy", "hybrid"]),
("record", ["memory index", "--strategy", "consolidated"]),
("record", ["memory lookup", "--strategy", "direct"]),
("record", ["memory cache", "--strategy", "hybrid"]),
("record", ["memory grep", "--strategy", "consolidated"]),
("record", ["memory embedding", "--strategy", "direct"]),
("record", ["memory vector", "--strategy", "hybrid"]),
("record", ["memory search", "--strategy", "consolidated"]),
("record", ["memory query", "--strategy", "direct"]), # crosses >=10
("rate", ["memory consolidation"]),
("rate", ["web crawling"]),
("rate", ["python unittest"]),
("rate", ["nothing matches here"]),
("health", []),
("stats", []),
]
def _oracle_script(cache: Path) -> Path:
"""Extract the pre-shim oracle from git history (cached per run)."""
if cache.exists():
return cache
r = subprocess.run(
["git", "-C", str(REPO), "show", f"{PRE_SHIM_REF}:{PRE_SHIM_PATH}"],
capture_output=True,
text=True,
timeout=30,
)
if r.returncode != 0 or "QueryMemory" not in r.stdout:
raise RuntimeError(
f"cannot recover the pre-shim oracle from {PRE_SHIM_REF}:{PRE_SHIM_PATH} — "
f"the shadow needs the true Python implementation"
)
cache.parent.mkdir(parents=True, exist_ok=True)
cache.write_text(r.stdout)
return cache
def run(cmd_list: list, home: str) -> tuple[int, str]:
env = dict(os.environ, HOME=home)
p = subprocess.run(cmd_list, env=env, capture_output=True, text=True, timeout=30)
return p.returncode, p.stdout + (f"[stderr: {p.stderr}]" if p.stderr else "")
def main() -> int:
ap = argparse.ArgumentParser()
ap.add_argument("--print", action="store_true", dest="verbose")
args = ap.parse_args()
if not RS_BIN.exists():
raise RuntimeError(f"Rust CLI not built: {RS_BIN}")
with tempfile.TemporaryDirectory(prefix="qm_shadow_") as td:
work = Path(td)
py_home = work / "home_py"
rs_home = work / "home_rs"
py_home.mkdir()
rs_home.mkdir()
oracle = _oracle_script(work / "qm_py_oracle.py")
for label, argv in SEQUENCE:
rc_py, out_py = run([PY, str(oracle), label] + argv, str(py_home))
rc_rs, out_rs = run([str(RS_BIN), label] + argv, str(rs_home))
if rc_py != rc_rs or out_py != out_rs:
print(f"✗ DIVERGENCE at {label} {argv[:1]} (rc {rc_py} vs {rc_rs})")
if args.verbose:
print(f" py: {out_py!r}\n rs: {out_rs!r}")
return 1
# history.jsonl byte parity (timestamps masked)
hist_py = py_home / ".config/opencode/memory/query_memory/history.jsonl"
hist_rs = rs_home / ".config/opencode/memory/query_memory/history.jsonl"
if not hist_py.exists() and not hist_rs.exists():
print("✗ history.jsonl missing in BOTH (sequence never wrote history)")
return 1
h_py = TS_RE.sub("<TS>", hist_py.read_text()) if hist_py.exists() else "<MISSING>"
h_rs = TS_RE.sub("<TS>", hist_rs.read_text()) if hist_rs.exists() else "<MISSING>"
if h_py != h_rs:
print("✗ history.jsonl DIVERGENCE (masked)")
return 1
# topic_stats.json byte parity
st_py = py_home / ".config/opencode/memory/query_memory/topic_stats.json"
st_rs = rs_home / ".config/opencode/memory/query_memory/topic_stats.json"
b_py = st_py.read_bytes() if st_py.exists() else b"<MISSING>"
b_rs = st_rs.read_bytes() if st_rs.exists() else b"<MISSING>"
if b_py != b_rs:
print("✗ topic_stats.json DIVERGENCE (byte)")
return 1
print(
f"SHADOW OK: {len(SEQUENCE)}/{len(SEQUENCE)} commands exact-equal, "
f"history + topic_stats byte-parity (pre-shim oracle vs Rust)"
)
return 0
if __name__ == "__main__":
try:
raise SystemExit(main())
except Exception as e: # noqa: BLE001 — terminal reporter: prints and exits 1
print(f"qm_shadow: {e}", file=sys.stderr)
raise SystemExit(1)
Loaded 100 of 1081 files, more files were not shown because too many files have changed in this diff. Show more