feat: track post-install mutation efficacy with deterministic recurrence windows#43
Merged
Conversation
…nce windows Add an observational, model-free measurement of whether the failure signature an installed mutation addresses recurs less after installation. Compares two equal-length windows anchored on installed_at, deterministic given (database-state, installed_at, evaluated_at), with no causal claim and no lifecycle coupling. - docs/decisions/0015: observational stance, window rule, verdict thresholds, matching rule, no lifecycle coupling, privacy. - docs/specs/efficacy/0.1: result.schema.json + valid/invalid fixtures. - migration 0003 (schema v3): STRICT mutation_efficacy + _evidence tables with a cascade trigger that drops only the report (never the candidate). - new crate autophagy-efficacy: pure deterministic evaluation, unit-tested. - store: register_efficacy / list_efficacy / efficacy_occurrences / efficacy_status_summary; content-hash immutable, no state transition. - cli: `autophagy mutations efficacy <id>`, `mutations show` latest-efficacy line, `status` installed-mutations summary; humanized text, full JSON. Co-Authored-By: Claude Fable 5 <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.
Claim
Once a mutation is installed, the only honest question left is empirical: does the failure signature it addresses recur less after
installed_at? This adds a deterministic, model-free, observational answer — a versionedefficacy/0.1report comparing two equal-length windows anchored on the install timestamp. No causal claim, no model call, and no lifecycle coupling (efficacy never advances or retires a mutation). It is the sibling of the shadow crate in shape and spirit, closing the loop from "installed" to "did it help".What's here
docs/specs/efficacy/0.1—result.schema.json+valid/+invalid/fixtures, exercised by round-trip tests.mutation_efficacy+mutation_efficacy_evidence, mirroring the shadow tables. History is intentional (many reports per mutation over time). The evidence-removal trigger deletes only the report when a cited event is removed — never the candidate — precisely because efficacy gates no lifecycle state.autophagy-efficacy— pure, deterministic evaluation (model.rs/evaluate.rs/validate.rs), unit-tested. The store gathers occurrences + coverage; the CLI wires them — that wiring is the crate's executable vertical slice.register_efficacy(content-hash immutable likeregister_shadow, but no state transition),list_efficacy,efficacy_occurrences,efficacy_status_summary.autophagy mutations efficacy <id>(evaluate + register + print, with--nowfor a reproducible/backdated clock);mutations showgains a latest-efficacy line;statusgains a one-line installed-mutation efficacy summary (only when installations exist). Humanized text (percent, relative time, per-week rates); full report under--output json.Selector-form gotcha (resolved empirically)
Against a throwaway copy of the real DB (69,400 events; 34,911 indexed signatures): both registered candidates carry
failure/v1|…|exit:1selectors, whileevent_signaturesholdsoperation/v1|…rows exclusively. The failure grammar never appears in the index, so a failure selector cannot be matched against it directly.The matching rule (
failure_signature_recurrence) therefore decomposes the selector into its operation signatureoperation/<v>|<tool>|<command>plus an exit code, and counts events that are indexed under that operation signature and aretool.failedand carry the matching exit code. (Command text can contain|, so the failure form is parsed by trimming the trailing|exit:<code>.) For thego buildcandidate the operation signature resolves to 56 indexed rows — 28tool.called, 25tool.completed(exit 0), and exactly 3tool.failed(exit 1), the three the finding cites.Coverage diagnostics (GOTCHA 2)
The index is partial by construction, so the report always states
total_failuresvsclassifiable_failuresand never silently undercounts: coverage below 50% forcesinsufficient_data(partial_index_coverage).Real-data evidence
Drove one candidate on the DB copy through challenge → replay (12 scenarios, passed) → shadow (12 observations, 100% precision, passed) → install into a scratch git repo, producing a real
installed_at = 2026-07-18T20:54:57Z.Evaluated at the real install instant, the post-window is 0 days → honest
insufficient_data. Evaluated at a later clock (same realinstalled_at,--now 2026-11-10), the three historical failures land in the pre-window and none recur:mutations show(audit tail):status:The report cites the exact three
go buildfailureevent_ids, and the 80.4% coverage figure (304 of 425 in-spantool.failedindexed) shows the partial-index diagnostic surfacing rather than hiding.Test coverage
autophagy-efficacy: 9 tests — each verdict, threshold edges, coverage, content-id determinism, backwards-clock rejection, and schema/fixture round-trip.autophagy-store: 6 tests — matching rule + coverage, span bounding + unparsed selectors, append-only/immutable/lifecycle-free registration, inconsistent-registration rejection, evidence-removal cascade (report dropped, candidate kept), latest-verdict status summary.autophagy-cli: full lifecycle test extended throughmutations efficacy(valid report,model_used=false, registered, no state change) and refusal once retired.Privacy
Strictly subtractive on derived data. The report cites exact
event_ids and integer counts only — never command text or event content. Occurrences are matched through the same redaction-approved signature index that already gates search, so efficacy can only see what redaction already approved. No new source text is persisted; nothing leaves the machine.Quality gate
mise run checkis fully green (ci + docs + fmt + lint + test).🤖 Generated with Claude Code