feat(redirect): arc→rule promotion pipeline — failures graduate into deny-mode redirect gates - #107
Merged
Merged
Conversation
Mines the transcript distiller's failure->fix arcs (failure_arc table) for purely mechanical, token-level shell-command fixes -- flag-drop, token-replace, prefix-insert -- and turns eligible ones into candidate redirect rules for human review, never auto-applied. - redirect/arc_promotion.py: deterministic, LLM-free classifier + evidence/ contradiction aggregation + `simba rule scan-arcs` DB orchestration. - redirect/candidates.py: rule_candidate sidecar table (pending/approved/ rejected), idempotent upsert-by-signature. - redirect/store.py: additive pattern/rewrite/mode columns on redirect_rules (migrated for pre-existing DBs), add_pattern(), mode-aware add(). - __main__.py: `simba rule scan-arcs`, `simba rule promote [<id> [--reject]] [--json]`, `simba rule redirect add --mode`; distill CLI triggers a fail-soft scan after arc upserts. - hooks/session_start.py: pending-rule-candidate inbox line (local-only, survives daemon being down). - Approval always writes DENY mode; no bulk-approve path.
Conflict: the projection lint's line-number allowlist — both sides had shifted the same __main__.py entry. Resolved empirically: the merged tree's call site is at 4069 (#105's +17 on top of this branch's own insertions); verified by running the lint.
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.
Completes the loop designed with the user 2026-07-20: the distiller's failure→fix arcs (#104) graduate into redirect rules through a deterministic, LLM-free promotion pipeline with a human approval valve.
redirect/arc_promotion.py): flag-drop (incl. combined-short-flag subsequence,-rn→-n), token-replace (--summarize→-summary), prefix-insert (python3 …→uv run python …). Rejects operand changes, multi-token diffs, shlex failures, contradicted signatures (two different fixes for one failure = context-dependent).hooks.arc_promotion_min_evidence(default 3) summed repeat_count OR ≥2 distinct sessions per signature.rule_candidatepeewee sidecar): idempotent rescans, rejected-stays-rejected.simba rule promotereview CLI: diff-style before→after, evidence (×7 across 3 sessions), derived rule + scope; approve writes a deny-mode rule to the redirect DB store and prints the graduation command;--reject;--json.simba rule scan-arcs+ fail-soft auto-scan aftersimba transcript distill. SessionStart inbox line when candidates are pending.mode="deny"wins over any global rewrite mode — auto-created rules structurally cannot silently rewrite. Never touches.simba/redirects.toml(human-owned).pattern/rewrite/modecolumns (guarded migration) +simba rule redirect add --mode.TDD red-first: 51 new tests (29 classifier/pipeline, 17 CLI, 3 inbox, 2 distill-integration). Full suite green on the branch merged with current main (#105-#106), ruff + format clean. Merge commit resolves the projection-lint allowlist conflict empirically (site at 4069 in the combined tree; verified by running the lint).