feat: export and import mutation genomes with redacted evidence and origin attestations#44
Merged
Conversation
…rigin attestations Add a file-based, offline team genome (genome/0.1): one developer exports a verified mutation as a self-contained, redaction-gated bundle and another imports it as a fresh review-only candidate carrying the origin's verification reports as display-only attestations. Trust is never transplanted — lifecycle state does not travel, and the receiver must re-verify locally. - New autophagy-genome crate: bundle build/parse, content-id integrity, and attestation hashing (depends only on events, mutations, redaction). - Redaction: public PrivacyPolicy::scrub_value / scrub_string over arbitrary JSON, reusing the built-in secret rules. - Store: migration 0004 mutation_attestations (STRICT, display-only), plus registration/retrieval and the attestations field on MutationDetails. - CLI: genome export/import (with --dry-run and --force), a mutations show attestations section, and a mutations list imported marker. - Spec docs/specs/genome/0.1 (schema + valid/invalid fixtures) and ADR 0016. 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
A verified mutation can now travel between machines.
autophagy genome exportwrites a self-contained, redaction-gated
genome/0.1bundle;autophagy genome importingests it as a fresh review-only candidate. Trust is nevertransplanted: lifecycle state does not travel, the origin's replay/shadow
reports arrive as display-only attestations, and the receiver must re-run
challenge → replay → shadow against its own evidence to advance the candidate.
Local-first and offline — export writes a file, import reads one, no network I/O.
What's here
autophagy-genomecrate — the bundle format only (build, parse,content-id integrity check, attestation hashing). Depends solely on
events,mutations, andredaction; does no storage or network I/O. New crate as agenuine vertical slice.
PrivacyPolicy::scrub_value/scrub_stringoverarbitrary JSON, reusing the built-in secret rules (documented, unit-tested).
0004_mutation_attestations(STRICT, display-only, nolifecycle read path consults it),
register_attestation+ retrieval, and anadditive
attestationsfield onMutationDetails.genome export <id> --out PATH [--force],genome import PATH [--dry-run], amutations showattestations section, and amutations list(imported)marker. Wording is blunt: attestations are origin-claimed, notlocally verified.
docs/specs/genome/0.1(schema + valid/invalid fixtures,exercised by tests) and ADR 0016.
Why the bundle carries events
Two store facts force it:
register_mutationfails unless every citedevent_idalready exists locally (the evidence FK wall), and replay/shadowreports are content-hash-locked on their exact
source_event_ids. So the bundlecarries the original events, redacted — rewriting ids would break the hashes.
How the redaction gate works
PrivacyPolicy(built-in secret rulesimport.exclude_paths). A path-excluded event aborts theexport naming the event — silently dropping it would break the reports that
cite it. The mutation's reviewable text is scrubbed with the same rules.
storing it (never trusting the sender), and a path-excluded event aborts.
content_hash;import recomputes it and records
hash_verified— a transit-integrity check,never a re-verification.
Evidence
Round-trip integration test (
genome_export_import_round_trip_...): drives amutation to
shadow_passed, exports it, imports into a fresh DB — the candidatelands as
candidatewith both attestations stored (hash_verified, butlifecycle unchanged),
--dry-runwrites nothing, and re-import is idempotent.Plus genome-crate unit tests (schema conformance, tamper detection via
genome_idand attestation hash, path-excluded abort, package-text scrubbing)and a store test (attestations are display-only and idempotent).
Real-data check — exported a real
repeated_command_failurecandidate from acopy of the development database (schema v2, upgraded in place to v4 on open)
under an isolated
AUTOPHAGY_CONFIG_DIR; the user's real DB and config werenever touched. The bundle carried 28 redacted evidence events; a secret-pattern
scan (
sk-,ghp_,AKIA,Bearer …,api_key=…) found no matches, andno residual
[REDACTED]markers (the source was already clean). A sample event:{ "event_id": "evt_pi_01bcfb9a…", "source": "pi", "type": "tool.completed", "project": "/Users/karn/code/zuzoto/zuzoto", "tool": { "name": "bash", "input": { "command": "cd /Users/karn/code/zuzoto/zuzoto && go build ./... 2>&1" }, "exit_code": 0 } }Importing into a fresh empty DB:
The candidate lands as
candidate— verification did not travel.mise run checkis fully green (ci + docs + fmt + lint + test).Privacy implications
A genome contains redacted event content — the exact AEP events the mutation
cites, run through the redaction policy at export and again at import.
Exporting is an explicit user act that writes a local file the user then
chooses whether and how to share; Autophagy performs no network I/O at any
point. Attestation reports are deterministic, model-free evaluation summaries
(event ids, normalized selectors, integer counts, outcome enums) with no raw
payloads. Path-excluded evidence aborts rather than leaks, at both ends. Absolute
project paths travel unless
import.exclude_pathsremoves them — they aregoverned by the same policy that gates ingestion, and a
[genome]policyoverride is noted as future work in ADR 0016.
🤖 Generated with Claude Code