feat(laws): v4.2.0 — laws layer de-dup, tier legibility, post-promotion audit#84
Merged
Conversation
…on audit
Follow-up to "are laws the right mechanism or noise?" — investigated with measured
data + a 3-agent adversarial pass that refuted the invasive ideas (shrink, demote,
stop auto-promotion) and confirmed the surgical ones. Rationale: docs/DESIGN-laws-v4.2.md.
Fixed:
- Double injection (measured): read-instructions (41x) + pref-fix (17x) existed as
law AND active instinct. injector-engine.js now skips candidates with a laws/{id}.txt
twin; manual_swap_promote archives the source instinct like auto_promote already did.
- advisor-escalation trimmed 1505->717 chars (was 26% of the law budget).
- bash-cat-use-read v4.1.0 regression: the noise-reduction lookahead also excluded
legit targets (cat file.py | head); reverted to satisfy test_reflex_matchers contract.
Added:
- Law presentation split by tier (session-start.py + core/laws-meta.default.json):
[principios] vs [herramienta] blocks so principles aren't diluted. Backward compatible.
- law_audit() + law-audit CLI (distill_engine.py) for periodic legibility.
Rejected as misdiagnoses (adversarial): domain-scoping (payoff negligible), demoting
gotchas (trigger-miss risk), hand-curating to 5-7 (no evidence content is bad).
Full suite green (39/39). Deployed v4.1.0 -> v4.2.0 and verified end-to-end.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Origen
Pregunta de Fer: "¿son las laws la mejor forma de hacer esto, o son ruido?" Investigado con datos medidos + contra-análisis adversarial de 3 agentes que refutó las ideas invasivas (encoger a 5-7, demotar gotchas, parar auto-promoción) y confirmó las quirúrgicas. Rationale completa en
docs/DESIGN-laws-v4.2.md.Fixed
read-instructions(41 inyecciones PreToolUse redundantes) +pref-fix(17) existían como ley Y como instinct activo.injector-engine.jsahora salta candidatos con ley gemelalaws/{id}.txt;manual_swap_promotearchiva el instinct fuente como ya hacíaauto_promote_to_law(fix de raíz).advisor-escalationadelgazada 1505→717 chars (era el 26% del presupuesto de leyes).bash-cat-use-readde v4.1.0: el negative-lookahead de reducción de ruido excluía también targets legítimos (cat file.py | head,tail file.json | grep) donde Read/Grep ES mejor, rompiendo el contrato detest_reflex_matchers. Revertido en seed + live.Added
session-start.py+core/laws-meta.default.json): las leyes se renderizan en dos bloques[principios]vs[herramienta]para que los principios no se diluyan con gotchas mecánicos. Retrocompatible (sin meta → un bloque).law_audit()+ CLIlaw-audit(distill_engine.py): por ley{id, tier, age_days, dup_active_instinct, backing_instinct_noise}→.law-audit.json. Legibilidad periódica para podar leyes con datos (medir "ley seguida" es irresoluble sin trigger, confirmado por el adversarial).Rechazado como falso positivo (adversarial)
Verificación
test_reflex_matchers(28/0 tras el fix).install.sh(con seed de laws-meta en install.sh/ps1) y verificado end-to-end: dos bloques, law-audit CLI, guard del injector.🤖 Generated with Claude Code