Skip to content

v0.5.0-kaizen — Hephaestus Kaizen Engine

Latest

Choose a tag to compare

@ddawnlll ddawnlll released this 11 Jul 15:18

v0.5.0-kaizen — Hephaestus Kaizen Engine

Explore freely. Prove ruthlessly. The loop now improves itself.

This is the largest release since the project rebrand. The Kaizen Engine turns
Hephaestus from a hypothesis-driven improvement loop into a self-improving system
by adding a third face (Reflector), a belief workspace (Global Workspace analog),
containment for new deadlock modes, four idea channels that supply diversity at
volume, and crash-safe runtime infrastructure.

All 21 v0.5 issues (#52#72) closed via PR #73.
191 tests pass. Praxis evidence bundle: .praxis/runs/v05-full-evidence.jsonl.

Highlights

  • Belief workspace (beliefs.yaml) — narrow, capacity-limited, single-writer
    (Reflector). Hard cap 12 active beliefs. Every belief carries a kill_criterion
    (falsifiability contract). Capacity competition for entry.
  • Reflector agent — the third face. Shared-assumption extraction, relaxation
    probe, perspective tour. Decorrelated model family from orchestrator. Runs
    offline (idle / plateau), like human sleep consolidation. Writes only
    beliefs.yaml and narrative.md — never code, never hypotheses.
  • relies_on field + blame propagation — the load-bearing change. When a
    hypothesis FAILs, blame propagates upward to every belief it relied on. Three
    failures on B-X → B-X becomes a suspect. Schema-breaking: required on all
    new hypotheses from this release forward.
  • Containment engine — authority matrix (28 role pairs, terminal referee
    for every pair), suspect TTL (no permanent lockout), curiosity exemption
    (Red Team blocks MERGE, never RUN), belief min-residency + eviction evidence,
    frame-shift cooldown + ratchet hysteresis.
  • Four idea channels — analogy (cross-project lessons + casting), random-leap
    (bisociation replay + dream mode + external entropy), affect (Brier calibration
    • mood modulation + boredom rotation), context (whisper inbox + morning
      briefing + regime detector). All independently feature-flagged, default
      disabled, separate daily budgets. Disabled = zero spend, zero artifacts.
  • Provenance tagging — every hypothesis + merge carries a provenance tag.
    Per-channel hit-rate reports. A merge without provenance fails schema validation.
  • Tick transaction journal — durable, atomic write-and-rename, phase tracking,
    operation-key idempotency, stale-lock recovery. Proves idempotent across
    worker dispatch, blame propagation, merges, lessons, provenance, spend
    accounting, channel output, and reflector consolidation.
  • Canary suite — 11 end-to-end scenarios: belief capacity 12/13, TTL expiry,
    direct blame, authority coverage failure, ratchet restart, prompt-injection
    isolation, disabled-channel zero side effects, deadlock recovery, eviction,
    reflector shadow isolation, duplicate-tick idempotency, crash recovery.

Phase 0 — debt cleared (#52, #53, #54, #55)

  • T2 Challenger / T3 Arbiter personastemplates/SOUL.challenger.md (read-only,
    blind, decorrelated, one rebuttal round) and templates/SOUL.arbiter.md (raw-evidence-
    only, binding merge/reject, falsifiability). Bootstrap wiring.
  • Self-grade diff gatetemplates/scripts/self-grade-diff.py. Orchestrator
    verdict cannot be more optimistic than mechanical evidence verdict. Wired into tick.
  • Pre-registration locktemplates/scripts/prereg-lock.py. Locks metric,
    threshold, direction, relies_on at dispatch. SHA-256 tamper detection.
  • Repo hygieneschema/tests_tmp/ removed; tests promoted to schema/tests/;
    .gitignore tripwires for Windows path artifacts.

Phase 1 — Belief workspace + Reflector (#56#60)

  • schema/beliefs.schema.json — capacity cap 12, kill_criterion, blamed_by,
    historical_beliefs[].
  • relies_on on hypotheses → blame propagation → suspect detection.
  • narrative.md — one-page project story, rewritten each consolidation.
  • SOUL.reflector.md + reflector-dispatch.sh — three questions per run.
  • Stagnation / momentum signals in state.json; suspect-belief hard rule in
    orchestrator SOUL and prompts/tick.md.

Phase 2 — Containment (#61#64)

  • Authority matrix — 28 role pairs, every blocking state has a terminal referee
    with timeout + safe-default HOLD.
  • Suspect TTL (default 5 ticks) — no permanent frame lockout.
  • Curiosity exemption — belief-test hypotheses run from protected budget.
  • Belief min-residency (M=3) + eviction audit log.
  • Frame-shift cooldown (K=8) + ratchet hysteresis (one notch per R-window,
    direction reversal requires full window of evidence).

Phase 3 — Idea channels (#65#68)

  • Analogy~/.hermes/lessons.jsonl cross-project corpus with dual writing
    (concrete + denominalized abstract) + casting sessions.
  • Random-leap — bisociation replay (mid-distance ledger pairs), dream mode
    (seeded entropy, generation/filtering separated), external entropy (arXiv/HN).
  • Affect — Brier calibration (confidently-wrong is costly, agreement NOT
    rewarded), mood as parameter modulation, boredom → family rotation.
  • Contextwhispers/ inbox (30s, weakest evidence), morning briefing,
    regime detector. Security: external streams earn workspace entry through
    capacity + competition, never write to beliefs.yaml directly.

Phase 4 — Provenance + measurement (#69)

  • provenance field on hypothesis + merge records (elimination | analogy | replay | whisper | external | relaxation).
  • Per-channel section in reports/<date>-tick.md template.
  • Rolling hit-rate aggregator script.
  • A merge without provenance fails schema validation.

Phase 5 — Runtime reliability (#70, #71, #72)

  • feature-flags.py — gradual rollout with safe defaults (shadow mode). Active
    blocked until readiness-check.py passes.
  • tick-journal.py — durable transaction journal. Atomic write-and-rename,
    phase tracking, operation-key idempotency, stale-lock recovery.
  • channel-budget.py — atomic daily idempotent accounting with file locking,
    stable operation keys, UTC reset.
  • tick-runtime.py deterministic wrapper with journal phase transitions;
    tick-gate.sh calls tick-runtime.py init as mandatory pre-tick hook.
  • channel-dispatch.py — deterministic channel dispatcher.
  • .github/workflows/v05-ci.yml — full test matrix on every PR.
  • Canary suite — 11 scenarios, 19 assertions.

Bootstrap integration

  • bootstrap.shDF_REFLECTOR_* defaults, adapter extraction, template vars,
    reflector profile install, v0.5 script copy, extra ledger dirs, registry update.
  • bootstrap.tsAdapterConfig.reflector_model/chain, decorrelation check
    against orchestrator, profile install, v0.5 script copy, registry update.
  • adapters/v7-alphaforge/project.yamlreflector_model/reflector_chain
    fields (deepseek ≠ claude orchestrator, satisfies decorrelation invariant).
  • templates/prompts/tick.md — Phase 4 channel dispatch + reflector dispatch.

Invariants (enforced by tests)

  • 191 tests pass across schema/tests/ (41 correction + 19 canary + 131 legacy).
  • A merge without provenance fails schema validation.
  • bootstrap.sh bash syntax verified (bash -n clean).
  • Disabled channel = 0 USD spend, 0 artifacts, 0 proposals.
  • Reflector writes only beliefs.yaml and narrative.md.
  • Authority matrix covers all role pairs; new profiles fail bootstrap without entry.
  • Provider-chain decorrelation: orchestrator ≠ worker ≠ challenger ≠ arbiter ≠
    reflector (bootstrap validateChainDecorrelation() fail-closed).

Migration from v0.4

bash migrate-ledger.sh .alphaforge/orchestrator/state.json --backup

migrate-ledger.sh converts v1 hypothesis files (empty relies_on) into v0.5
schema. The relies_on field is required (may be empty []) on all new
hypotheses from this release forward.

Install / upgrade

# Fresh install
curl -fsSL https://raw.githubusercontent.com/ddawnlll/hephaestus/main/install.sh | bash

# Upgrade existing
cd ~/.hephaestus && git pull && bash bootstrap.sh /path/to/project --adapter v7-alphaforge

What's next

  • v0.6: channel dispatch hardening (deterministic pre-commit + cron-side enforcement).
  • v0.6: reflector active-mode rollout (default shadow until readiness passes for
    30 consecutive ticks across all deployed projects).
  • v0.6: cross-project lessons.jsonl consolidation endpoint.

Known limitations

  • Reflector active mode requires readiness check + containment verified; default
    is shadow mode (reflector_proposals.yaml, never touches beliefs.yaml).
  • Channel dispatch is wired in the tick prompt; deterministic channel-dispatch
    scripting (pre-commit hooks, cron-side enforcement) is a hardening opportunity.
  • bootstrap.sh registry update uses a Python heredoc — bash bash -n passes,
    but prefer bootstrap.ts (Bun) for new adapter work.

Full Changelog: https://github.com/ddawnlll/hephaestus/blob/v0.5.0-kaizen/CHANGELOG.md
PR: #73
Praxis Evidence: .praxis/runs/v05-full-evidence.jsonl