Skip to content

fix(laws): v4.3.1 — retired laws cascade to instincts instead of archive-only death#88

Merged
fermonterom merged 1 commit into
mainfrom
fix/v4.3.1-law-cascade
Jul 5, 2026
Merged

fix(laws): v4.3.1 — retired laws cascade to instincts instead of archive-only death#88
fermonterom merged 1 commit into
mainfrom
fix/v4.3.1-law-cascade

Conversation

@fermonterom

Copy link
Copy Markdown
Owner

Qué arregla

Feedback del operador sobre v4.3.0: al jubilar una law, el conocimiento desaparecía de las dos capas a la vez — la promoción ya había archivado el instinct fuente (anti doble-inyección v4.2.0) y la jubilación archivaba la law. Resultado: conocimiento probado muerto en laws/archive/.

Cascada en vez de muerte

  • _restore_backing_instinct() (compartido por la jubilación del auto-swap y demote_law_to_domain): el YAML de respaldo de la víctima vuelve a instincts/global/ con law_eligible: false — sigue inyectando por trigger en PreToolUse y, si de verdad dejó de importar, cae sola por el decay normal de instincts. El flag bloquea el ping-pong de re-promoción (auto_promote_to_law lo salta).
  • Bug preexistente arreglado de paso: el lookup de demote_law_to_domain buscaba instincts/archive/<id>.yaml, pero toda promoción v4 archiva como instincts/global/archive/<id>.promoted-to-law-<fecha>.yaml (nombre Y directorio distintos) — ninguna law promovida desde v4.0 podía degradarse. _find_backing_instinct_yaml() cubre las tres rutas (viva, archivo de promoción con newest-wins, legacy).
  • Laws sin respaldo (sembradas a mano, sin trigger): archive-only como hasta ahora — nunca se inventa un trigger (un instinct sin trigger válido jamás inyectaría: muerte silenciosa). Log retired-archive-only.

Caso real: loop-reorient (jubilada hoy por el primer auto-swap) no tiene YAML de respaldo → se queda en archive, recuperable a mano.

Tests

  • test_distill_v4 10→12: cascada con respaldo (YAML restaurado, law_eligible: false, trigger intacto, archivo de promoción consumido) y víctima sin respaldo (swap OK, nada inventado)
  • Verde también: law_tier 14 (demote existente intacto), runner 10, distill_engine 46, integrity 14, security 9, dream 40

🤖 Generated with Claude Code

…ive-only death

Operator feedback on v4.3.0: retiring a law removed the knowledge from
BOTH layers at once (promotion had archived the source instinct to
prevent double injection; retirement archived the law).

- _restore_backing_instinct(): shared by the auto-swap retirement and
  demote_law_to_domain. Victim's backing YAML returns to
  instincts/global/ with law_eligible:false (no re-promotion ping-pong),
  so the knowledge keeps injecting via PreToolUse and ages out through
  normal instinct decay if it truly stopped mattering.
- _find_backing_instinct_yaml(): also fixes demote_law_to_domain's
  lookup, which searched instincts/archive/<id>.yaml while every v4
  promotion archives as instincts/global/archive/<id>.promoted-to-law-
  <date>.yaml — different name AND directory; v4-promoted laws could
  never be demoted back.
- No-backing laws (manually seeded, no trigger) stay archive-only:
  a trigger is never invented. Logged as retired-archive-only.

test_distill_v4 10->12; law_tier/runner/integrity/security/dream green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@fermonterom
fermonterom merged commit 61ba994 into main Jul 5, 2026
11 checks passed
@fermonterom
fermonterom deleted the fix/v4.3.1-law-cascade branch July 5, 2026 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant