Guard repo close Mind adoption proof

This commit is contained in:
Meta Vens 2026-06-20 21:16:39 +01:00
commit 88c52eace9
6 changed files with 726 additions and 16 deletions

View file

@ -0,0 +1,489 @@
use anyhow::Context;
use anyhow::Result;
use anyhow::anyhow;
use chrono::Utc;
use serde_json::Value;
use serde_json::json;
use std::env;
use std::fs;
use std::path::Path;
use std::path::PathBuf;
use std::process::Command;
fn main() -> Result<()> {
let args = Args::parse()?;
let result = run_smoke(args)?;
println!("{}", serde_json::to_string_pretty(&result)?);
Ok(())
}
#[derive(Clone, Debug)]
struct Args {
root: PathBuf,
smoke_root: PathBuf,
}
impl Args {
fn parse() -> Result<Self> {
let mut root = env::current_dir().context("failed to resolve current directory")?;
let mut smoke_root = root.join(".epiphany-smoke");
let mut args = env::args().skip(1).peekable();
while let Some(arg) = args.next() {
match arg.as_str() {
"--root" => root = take_path(&mut args, "--root")?,
"--smoke-root" => smoke_root = take_path(&mut args, "--smoke-root")?,
other => return Err(anyhow!("unexpected argument {other:?}")),
}
}
Ok(Self { root, smoke_root })
}
}
fn run_smoke(args: Args) -> Result<Value> {
let root = args
.root
.canonicalize()
.with_context(|| format!("failed to resolve {}", args.root.display()))?;
let manifest = root.join("epiphany-core").join("Cargo.toml");
if !manifest.exists() {
return Err(anyhow!(
"could not find epiphany-core manifest at {}",
manifest.display()
));
}
fs::create_dir_all(&args.smoke_root)
.with_context(|| format!("failed to create {}", args.smoke_root.display()))?;
let stamp = Utc::now().format("%Y%m%d-%H%M%S").to_string();
let smoke_dir = args
.smoke_root
.join(format!("repo-close-mind-adoption-guard-{stamp}"));
if smoke_dir.exists() {
fs::remove_dir_all(&smoke_dir)
.with_context(|| format!("failed to clear {}", smoke_dir.display()))?;
}
fs::create_dir_all(&smoke_dir)
.with_context(|| format!("failed to create {}", smoke_dir.display()))?;
let repo = smoke_dir.join("repo-body");
fs::create_dir_all(&repo).with_context(|| format!("failed to create {}", repo.display()))?;
git(["init"], &repo)?;
git(
["config", "user.email", "epiphany-smoke@example.invalid"],
&repo,
)?;
git(["config", "user.name", "Epiphany Smoke"], &repo)?;
fs::write(
repo.join("README.md"),
"# Repo Close Mind Adoption Guard Smoke\n\nThis repository proves Soul refuses closure when the Mind adoption proof is tampered.\n",
)
.with_context(|| format!("failed to seed {}", repo.join("README.md").display()))?;
git(["add", "README.md"], &repo)?;
git(
[
"commit",
"-m",
"Seed repo close mind adoption guard smoke body",
],
&repo,
)?;
git(
["switch", "-c", "epiphany/repo-close-mind-adoption-guard"],
&repo,
)?;
let item = "repo-close-mind-adoption-guard";
let target_path = "notes/epiphany-work/repo-close-mind-adoption-guard.md";
let local_verse = repo.join(".epiphany").join("local-verse.ccmp");
cargo_json(
&manifest,
"epiphany-repo",
&[
"init",
"--workspace",
path_str(&repo)?,
"--epiphany-root",
path_str(&root)?,
"--swarm-id",
"repo-close-mind-adoption-guard-smoke",
"--topic",
"repo-close-mind-adoption-guard",
],
&root,
)?;
cargo_json(
&manifest,
"epiphany-swarm",
&[
"online",
"--workspace",
path_str(&repo)?,
"--epiphany-root",
path_str(&root)?,
"--runtime-id",
"repo-close-mind-adoption-guard-smoke",
"--local-verse-store",
path_str(&local_verse)?,
],
&root,
)?;
cargo_json(
&manifest,
"epiphany-work",
&[
"accept",
"--workspace",
path_str(&repo)?,
"--from",
"persona",
"--item",
item,
"--summary",
"Ask Soul to reject counterfeit Mind adoption proof before closure.",
"--candidate-action-ref",
"candidate-action://repo-close-mind-adoption-guard/tampered-adoption",
"--public-discussion-ref",
"epiphany-global/persona-collaboration/repo-close-mind-adoption-guard",
],
&root,
)?;
let plan = cargo_json(
&manifest,
"epiphany-work",
&[
"derive-plan",
"--workspace",
path_str(&repo)?,
"--item",
item,
"--action-family",
"planning-note",
"--model-ref",
"repo-close-mind-adoption-guard-smoke-imagination-v1",
"--model-authored",
],
&root,
)?;
let run = cargo_json(
&manifest,
"epiphany-work",
&[
"run",
"--workspace",
path_str(&repo)?,
"--epiphany-root",
path_str(&root)?,
"--item",
item,
"--path",
target_path,
],
&root,
)?;
let plan_path = value_at_path(&plan, &["receiptPath"])
.and_then(Value::as_str)
.ok_or_else(|| anyhow!("plan output had no receiptPath"))?;
let run_path = value_at_path(&run, &["receiptPath"])
.and_then(Value::as_str)
.ok_or_else(|| anyhow!("run output had no receiptPath"))?;
let adopt = cargo_json(
&manifest,
"epiphany-work",
&[
"adopt",
"--workspace",
path_str(&repo)?,
"--epiphany-root",
path_str(&root)?,
"--item",
item,
"--run-receipt",
run_path,
"--from-plan",
plan_path,
],
&root,
)?;
let adopt_path = value_at_path(&adopt, &["receiptPath"])
.and_then(Value::as_str)
.ok_or_else(|| anyhow!("adopt output had no receiptPath"))?;
let execute = cargo_json(
&manifest,
"epiphany-work",
&[
"execute",
"--workspace",
path_str(&repo)?,
"--epiphany-root",
path_str(&root)?,
"--item",
item,
"--adopt-receipt",
adopt_path,
"--from-plan",
plan_path,
],
&root,
)?;
let execute_path = value_at_path(&execute, &["receiptPath"])
.and_then(Value::as_str)
.ok_or_else(|| anyhow!("execute output had no receiptPath"))?;
let mut tampered_adopt = read_json(Path::new(adopt_path))?;
tampered_adopt["mindAdoptionDecision"]["status"] = json!("tampered-after-adoption");
tampered_adopt["mindAdoptionDecision"]["interpretation"]["classification"]["actionItemAccepted"] =
json!(false);
let tampered_adopt_path = smoke_dir.join("tampered-adopt.json");
write_json(&tampered_adopt_path, &tampered_adopt)?;
let mut tampered_execute = read_json(Path::new(execute_path))?;
tampered_execute["adoptReceiptPath"] = json!(path_str(&tampered_adopt_path)?);
let tampered_execute_path = smoke_dir.join("tampered-execute.json");
write_json(&tampered_execute_path, &tampered_execute)?;
let tampered_close = cargo_json(
&manifest,
"epiphany-work",
&[
"close",
"--workspace",
path_str(&repo)?,
"--item",
item,
"--execute-receipt",
path_str(&tampered_execute_path)?,
"--verification-command",
"git status --short",
],
&root,
)?;
require_eq(&tampered_close, &["status"], "verification-failed")?;
require_eq(&tampered_close, &["soul", "verdict"], "failed")?;
require_eq(
&tampered_close,
&["closureReview", "mindAdoptionReview", "status"],
"failed",
)?;
require_bool(
&tampered_close,
&["closureReview", "sourceGrounding", "mindAdoptionPassed"],
false,
)?;
require_bool(
&tampered_close,
&["closureReview", "mindAdoptionReview", "privateStateExposed"],
false,
)?;
require_assertion(
&tampered_close,
&["closureReview", "mindAdoptionReview", "assertions"],
"decision-status-adopted",
false,
)?;
require_assertion(
&tampered_close,
&["closureReview", "mindAdoptionReview", "assertions"],
"action-item-accepted",
false,
)?;
let close = cargo_json(
&manifest,
"epiphany-work",
&[
"close",
"--workspace",
path_str(&repo)?,
"--item",
item,
"--execute-receipt",
execute_path,
"--verification-command",
"git status --short",
],
&root,
)?;
require_eq(&close, &["status"], "closed")?;
require_eq(&close, &["soul", "verdict"], "passed")?;
require_eq(
&close,
&["closureReview", "mindAdoptionReview", "status"],
"passed",
)?;
require_bool(
&close,
&["closureReview", "sourceGrounding", "mindAdoptionPassed"],
true,
)?;
require_bool(&close, &["privateStateExposed"], false)?;
let summary = json!({
"schemaVersion": "epiphany.repo_close_mind_adoption_guard_smoke.v0",
"status": "ok",
"smokeDir": smoke_dir,
"repo": repo,
"branch": git_output(["branch", "--show-current"], &repo)?,
"item": item,
"targetPath": target_path,
"tamperedCloseStatus": tampered_close["status"],
"tamperedSoulVerdict": tampered_close["soul"]["verdict"],
"tamperedMindAdoptionReviewStatus": tampered_close["closureReview"]["mindAdoptionReview"]["status"],
"closeStatus": close["status"],
"soulVerdict": close["soul"]["verdict"],
"mindAdoptionReviewStatus": close["closureReview"]["mindAdoptionReview"]["status"],
"publicationAuthorized": false,
"privateStateExposed": false
});
write_json(&smoke_dir.join("summary.json"), &summary)?;
Ok(summary)
}
fn cargo_json(manifest: &Path, bin: &str, args: &[&str], cwd: &Path) -> Result<Value> {
let output = Command::new("cargo")
.arg("run")
.arg("--quiet")
.arg("--manifest-path")
.arg(manifest)
.arg("--bin")
.arg(bin)
.arg("--")
.args(args)
.current_dir(cwd)
.output()
.with_context(|| format!("failed to run cargo bin {bin}"))?;
if !output.status.success() {
return Err(anyhow!(
"{bin} failed with status {:?}\nstdout:\n{}\nstderr:\n{}",
output.status.code(),
String::from_utf8_lossy(&output.stdout),
String::from_utf8_lossy(&output.stderr)
));
}
serde_json::from_slice(&output.stdout).with_context(|| {
format!(
"{bin} did not emit JSON on stdout:\n{}",
String::from_utf8_lossy(&output.stdout)
)
})
}
fn git<const N: usize>(args: [&str; N], cwd: &Path) -> Result<()> {
let output = Command::new("git")
.args(args)
.current_dir(cwd)
.output()
.with_context(|| format!("failed to run git in {}", cwd.display()))?;
if output.status.success() {
Ok(())
} else {
Err(anyhow!(
"git failed in {} with status {:?}\nstdout:\n{}\nstderr:\n{}",
cwd.display(),
output.status.code(),
String::from_utf8_lossy(&output.stdout),
String::from_utf8_lossy(&output.stderr)
))
}
}
fn git_output<const N: usize>(args: [&str; N], cwd: &Path) -> Result<String> {
let output = Command::new("git")
.args(args)
.current_dir(cwd)
.output()
.with_context(|| format!("failed to run git in {}", cwd.display()))?;
if !output.status.success() {
return Err(anyhow!(
"git failed in {} with status {:?}\nstdout:\n{}\nstderr:\n{}",
cwd.display(),
output.status.code(),
String::from_utf8_lossy(&output.stdout),
String::from_utf8_lossy(&output.stderr)
));
}
Ok(String::from_utf8_lossy(&output.stdout).trim().to_string())
}
fn read_json(path: &Path) -> Result<Value> {
let raw =
fs::read_to_string(path).with_context(|| format!("failed to read {}", path.display()))?;
serde_json::from_str(&raw).with_context(|| format!("failed to decode {}", path.display()))
}
fn write_json(path: &Path, value: &Value) -> Result<()> {
if let Some(parent) = path.parent() {
fs::create_dir_all(parent)
.with_context(|| format!("failed to create {}", parent.display()))?;
}
fs::write(path, serde_json::to_vec_pretty(value)?)
.with_context(|| format!("failed to write {}", path.display()))
}
fn require_eq(value: &Value, path: &[&str], expected: &str) -> Result<()> {
let actual = value_at_path(value, path)
.and_then(Value::as_str)
.ok_or_else(|| anyhow!("missing string at {}", path.join(".")))?;
if actual == expected {
Ok(())
} else {
Err(anyhow!(
"expected {} to be {:?}, got {:?}",
path.join("."),
expected,
actual
))
}
}
fn require_bool(value: &Value, path: &[&str], expected: bool) -> Result<()> {
let actual = value_at_path(value, path)
.and_then(Value::as_bool)
.ok_or_else(|| anyhow!("missing bool at {}", path.join(".")))?;
if actual == expected {
Ok(())
} else {
Err(anyhow!(
"expected {} to be {}, got {}",
path.join("."),
expected,
actual
))
}
}
fn require_assertion(
value: &Value,
assertions_path: &[&str],
assertion_id: &str,
expected: bool,
) -> Result<()> {
let assertions = value_at_path(value, assertions_path)
.and_then(Value::as_array)
.ok_or_else(|| anyhow!("missing assertions at {}", assertions_path.join(".")))?;
let assertion = assertions
.iter()
.find(|entry| entry.get("assertionId").and_then(Value::as_str) == Some(assertion_id))
.ok_or_else(|| anyhow!("missing assertion {assertion_id}"))?;
require_bool(assertion, &["passed"], expected)
}
fn value_at_path<'a>(value: &'a Value, path: &[&str]) -> Option<&'a Value> {
let mut cursor = value;
for segment in path {
cursor = cursor.get(*segment)?;
}
Some(cursor)
}
fn take_path<I>(args: &mut std::iter::Peekable<I>, name: &str) -> Result<PathBuf>
where
I: Iterator<Item = String>,
{
args.next()
.map(PathBuf::from)
.ok_or_else(|| anyhow!("missing value for {name}"))
}
fn path_str(path: &Path) -> Result<&str> {
path.to_str()
.ok_or_else(|| anyhow!("path is not valid UTF-8: {}", path.display()))
}

View file

@ -7383,6 +7383,187 @@ fn push_assertion(assertions: &mut Vec<Value>, id: &str, passed: bool, summary:
}));
}
fn closure_mind_adoption_review(execute_receipt: &Value) -> Result<(Value, bool)> {
let Some(adopt_receipt_path) = path_from_json(execute_receipt, &["adoptReceiptPath"]) else {
return Ok((
json!({
"schemaVersion": "epiphany.repo_work_mind_adoption_closure_review.v0",
"status": "failed",
"reason": "execute receipt has no adoptReceiptPath",
"assertions": []
}),
false,
));
};
let adopt_receipt = read_json_if_exists(&adopt_receipt_path)?.unwrap_or(Value::Null);
if adopt_receipt.is_null() {
return Ok((
json!({
"schemaVersion": "epiphany.repo_work_mind_adoption_closure_review.v0",
"status": "failed",
"reason": "adopt receipt path is missing",
"adoptReceiptPath": adopt_receipt_path,
"assertions": []
}),
false,
));
}
let Some(mind_decision) = adopt_receipt.get("mindAdoptionDecision") else {
return Ok((
json!({
"schemaVersion": "epiphany.repo_work_mind_adoption_closure_review.v0",
"status": "failed",
"reason": "adopt receipt has no mindAdoptionDecision",
"adoptReceiptPath": adopt_receipt_path,
"assertions": []
}),
false,
));
};
let plan_derived = execute_receipt.get("planReceiptPath").is_some();
let mut assertions = Vec::new();
push_assertion(
&mut assertions,
"decision-schema",
string_from_json(mind_decision, &["schemaVersion"]).as_deref()
== Some("epiphany.repo_work_mind_adoption_decision.v0"),
"Mind adoption decision carries the expected schema.".to_string(),
);
push_assertion(
&mut assertions,
"decision-status-adopted",
string_from_json(mind_decision, &["status"]).as_deref()
== Some("adopted-for-branch-local-hands"),
"Mind adoption decision accepted branch-local Hands authority.".to_string(),
);
push_assertion(
&mut assertions,
"decision-owner-mind",
string_from_json(mind_decision, &["owner"]).as_deref() == Some("Mind"),
"Mind is the recorded adoption decision owner.".to_string(),
);
push_assertion(
&mut assertions,
"decision-interpreter-mind",
string_from_json(mind_decision, &["interpreter"]).as_deref() == Some("Mind"),
"Mind is the recorded adoption interpreter.".to_string(),
);
push_assertion(
&mut assertions,
"action-item-accepted",
bool_from_json(
mind_decision,
&["interpretation", "classification", "actionItemAccepted"],
) == Some(true),
"Mind classified the plan cargo as an accepted action item.".to_string(),
);
push_assertion(
&mut assertions,
"safe-family-recognized",
bool_from_json(
mind_decision,
&["interpretation", "classification", "safeFamilyRecognized"],
) == Some(true)
&& bool_from_json(mind_decision, &["gates", "safeFamilyRequired"]) == Some(true),
"Mind recognized the safe family and recorded the safe-family gate.".to_string(),
);
push_assertion(
&mut assertions,
"requested-paths-match-plan",
!plan_derived
|| (bool_from_json(
mind_decision,
&[
"interpretation",
"classification",
"requestedPathsMatchPlan",
],
) == Some(true)
&& bool_from_json(mind_decision, &["gates", "branchLocalOnly"]) == Some(true)),
"Mind confirmed requested paths match the plan before branch-local Hands authority."
.to_string(),
);
push_assertion(
&mut assertions,
"private-state-sealed",
bool_from_json(mind_decision, &["privateStateExposed"]) == Some(false),
"Mind adoption decision preserves the private-state seal.".to_string(),
);
let mind_decision_path = path_from_json(mind_decision, &["receiptPath"]);
let standalone_review = if let Some(path) = mind_decision_path.as_ref() {
match read_json_if_exists(path)? {
Some(standalone) => {
let matching_decision_id = string_from_json(&standalone, &["decisionId"])
== string_from_json(mind_decision, &["decisionId"]);
let matching_status = string_from_json(&standalone, &["status"])
== string_from_json(mind_decision, &["status"]);
let matching_schema = string_from_json(&standalone, &["schemaVersion"])
== string_from_json(mind_decision, &["schemaVersion"]);
let matching_private_seal = bool_from_json(&standalone, &["privateStateExposed"])
== bool_from_json(mind_decision, &["privateStateExposed"]);
push_assertion(
&mut assertions,
"standalone-decision-matches-snapshot",
matching_decision_id
&& matching_status
&& matching_schema
&& matching_private_seal,
"Standalone Mind decision matches the adopt receipt snapshot.".to_string(),
);
json!({
"status": "present",
"receiptPath": path,
"decisionIdMatched": matching_decision_id,
"statusMatched": matching_status,
"schemaMatched": matching_schema,
"privateStateSealMatched": matching_private_seal
})
}
None => {
push_assertion(
&mut assertions,
"standalone-decision-present",
false,
"Standalone Mind decision path exists in snapshot but the file is missing."
.to_string(),
);
json!({
"status": "missing",
"receiptPath": path
})
}
}
} else {
push_assertion(
&mut assertions,
"standalone-decision-path-present",
false,
"Adopt receipt snapshot names the standalone Mind decision receipt path.".to_string(),
);
json!({
"status": "missing-path"
})
};
let passed = assertions
.iter()
.all(|assertion| assertion.get("passed").and_then(Value::as_bool) == Some(true));
Ok((
json!({
"schemaVersion": "epiphany.repo_work_mind_adoption_closure_review.v0",
"status": if passed { "passed" } else { "failed" },
"adoptReceiptPath": adopt_receipt_path,
"mindDecisionPath": mind_decision_path,
"planDerived": plan_derived,
"assertions": assertions,
"standaloneDecisionReview": standalone_review,
"privateStateExposed": false
}),
passed,
))
}
fn closure_model_review(
model_authored: bool,
model_ref: Option<&str>,
@ -8520,6 +8701,8 @@ fn run_close(args: CloseArgs) -> Result<Value> {
let commit_stat = git_output(&workspace, &["show", "--stat", "--oneline", &commit_sha])?;
let (family_assertions, family_assertions_passed) =
closure_family_assertions(&workspace, &commit_sha, &execute_receipt, &item)?;
let (mind_adoption_review, mind_adoption_passed) =
closure_mind_adoption_review(&execute_receipt)?;
let closure_model_authored = args.model_authored || args.closure_model_ref.is_some();
let (model_closure_review, model_closure_passed) = closure_model_review(
closure_model_authored,
@ -8559,9 +8742,11 @@ fn run_close(args: CloseArgs) -> Result<Value> {
"pathScopeMatched": path_scope_matched,
"commitStat": compact_multiline(&commit_stat),
"commitReceiptMatchedExecuteReceipt": true,
"mindAdoptionPassed": mind_adoption_passed,
"familyAssertionsPassed": family_assertions_passed,
"modelClosurePassed": model_closure_passed
},
"mindAdoptionReview": mind_adoption_review,
"familyAssertions": family_assertions,
"modelingReview": {
"modelAuthored": closure_model_authored,
@ -8580,11 +8765,12 @@ fn run_close(args: CloseArgs) -> Result<Value> {
"privateStateExposed": false
},
"privateStateExposed": false,
"nextSafeMove": "Soul may pass closure only when verification succeeds, actual git changed paths match the Hands-declared path scope, safe-family assertions pass for known Imagination families, and any supplied or required model-authored closure verdict passes."
"nextSafeMove": "Soul may pass closure only when verification succeeds, actual git changed paths match the Hands-declared path scope, the accepted Mind adoption proof is present, safe-family assertions pass for known Imagination families, and any supplied or required model-authored closure verdict passes."
});
write_json(&closure_review_path, &closure_review)?;
let verification_passed = verification.status.success()
&& path_scope_matched
&& mind_adoption_passed
&& family_assertions_passed
&& model_closure_passed;
let soul_verdict_id = format!("repo-work-close-{item_slug}-soul-verdict");
@ -8595,6 +8781,10 @@ fn run_close(args: CloseArgs) -> Result<Value> {
format!(
"Soul verification failed for branch-local commit {commit_sha}: actual changed paths did not match declared Hands path scope."
)
} else if !mind_adoption_passed {
format!(
"Soul verification failed for branch-local commit {commit_sha}: Mind adoption proof did not pass."
)
} else if !family_assertions_passed {
format!(
"Soul verification failed for branch-local commit {commit_sha}: safe-family assertions did not pass."
@ -8635,6 +8825,11 @@ fn run_close(args: CloseArgs) -> Result<Value> {
"Closure refused because actual git changed paths differ from Hands-declared scope."
.to_string(),
]
} else if !mind_adoption_passed {
vec![
"Closure refused because the Mind adoption decision was missing, tampered, or non-affirmative."
.to_string(),
]
} else if !family_assertions_passed {
vec![
"Closure refused because the committed content did not satisfy known safe-family assertions."
@ -11375,6 +11570,14 @@ fn string_from_json(value: &Value, path: &[&str]) -> Option<String> {
cursor.as_str().map(ToString::to_string)
}
fn bool_from_json(value: &Value, path: &[&str]) -> Option<bool> {
let mut cursor = value;
for segment in path {
cursor = cursor.get(*segment)?;
}
cursor.as_bool()
}
fn string_array_from_json(value: &Value, path: &[&str]) -> Vec<String> {
let mut cursor = value;
for segment in path {

View file

@ -1063,11 +1063,14 @@ sealed under `.epiphany/work/`. Closure also writes a structured
command/exit code, declared Hands paths, actual git commit paths, commit stat,
optional model-review provenance from `--closure-model-ref` / `--model-authored`,
optional hard model closure verdicts from `--closure-model-verdict`, safe-family
assertions for known Imagination families, and authority seals. Soul passes only
assertions for known Imagination families, the cited
`epiphany.repo_work_mind_adoption_decision.v0` snapshot plus standalone receipt
match, and authority seals. Soul passes only
when the verification command succeeds, actual git changed paths match the
Hands-declared path scope, the committed target content satisfies the
deterministic safe-family assertions when the plan family is known, and any
supplied or required model-authored closure verdict passes.
Hands-declared path scope, the accepted Mind adoption proof is present and
affirmative, the committed target content satisfies the deterministic
safe-family assertions when the plan family is known, and any supplied or
required model-authored closure verdict passes.
`--require-closure-model-verdict` turns missing model verdicts into a closure
refusal; without that flag, older provenance-only model refs remain
compatibility evidence instead of a hard gate. Soul
@ -1133,6 +1136,17 @@ one with `--closure-model-verdict needs-work`. The pass item returned
`familyAssertions.status=passed` and `pathScopeMatched=true`; private state
remained sealed.
A Mind-adoption closure guard smoke proved Soul now verifies that the Hands
commit being closed still descends from an accepted Mind adoption decision:
`.epiphany-smoke\repo-close-mind-adoption-guard-20260620-201153` ran a
disposable repo through plan -> run -> adopt -> execute, then pointed a copied
execute receipt at a counterfeit adopt receipt whose embedded
`mindAdoptionDecision.status` and `actionItemAccepted` were tampered. The
tampered close returned `verification-failed`, Soul `failed`,
`mindAdoptionReview.status=failed`, and `mindAdoptionPassed=false`; the original
execute/adopt chain then closed with Soul `passed`,
`mindAdoptionReview.status=passed`, and `privateStateExposed=false`.
`epiphany-work overview` is the first compact repo work sight/proof surface:
```powershell
@ -1481,7 +1495,7 @@ temptation wearing clean robes.
| Imagination planning | `derive-plan` now writes a typed `epiphany.repo_work_imagination_action_items_receipt.v0` before the executable plan receipt. The action-item receipt can carry model provenance, allowed safe family, requested paths, verification asks, stop conditions, escalation reasons, planning facets (assumptions, constraints, non-goals, open questions, decision points, and evidence needs), and private-state seals; command text remains deterministic safe-family lowering for `append-worklog`, `planning-note`, `checklist-note`, `section-note` / `repo.markdown_managed_section`, `repo-status-section` / `repo.status_section`, `task-card` / `repo.task_card`, `repo-manifest` / `repo.body_manifest`, `repo-tool-capabilities` / `repo.tool_capabilities`, `repo-tool-request` / `repo.tool_request`, `repo-eve-surface` / `repo.eve_surface`, `repo-collaboration-policy` / `repo.collaboration_policy`, `repo-collaboration-topic` / `repo.collaboration_topic`, `repo-consensus-brief` / `repo.consensus_brief`, `repo-objective-draft` / `repo.objective_draft`, `repo-adoption-request` / `repo.adoption_request`, `repo-scheduling-request` / `repo.scheduling_request`, `repo-work-order` / `repo.work_order`, `repo-verification-request` / `repo.verification_request`, `repo-publication-request` / `repo.publication_request`, `repo-sync-request` / `repo.sync_request`, `repo-maintainer-review-request` / `repo.maintainer_review_request`, `repo-pr-request` / `repo.pr_request`, `repo-credit-request` / `repo.credit_request`, `repo-artifact-acceptance-request` / `repo.artifact_acceptance_request`, `repo-metrics-request` / `repo.metrics_request`, `repo-doctrine-update-request` / `repo.doctrine_update_request`, `repo-secret-policy-request` / `repo.secret_policy_request`, and `repo-deployment-request` / `repo.deployment_request`. `adopt` now writes `epiphany.repo_work_mind_adoption_decision.v0` before the main adoption receipt cites the decision and grants branch-local Hands authority. `plan` remains manual quarantine scaffolding. | Deepen further interpreter behavior and useful repo-owned configuration/action classes without turning model text into arbitrary shell authority. |
| Self scheduling | `tick` and `serve` prove one-step branch-local advancement, brake refusal, active-turn refusal, cooldown, and stale-turn recovery; `tick` now routes executed branch-local work through the existing Soul/Modeling/Mind `close` gate; `queue-run` selects tick-actionable rows from the typed repo-work queue and delegates to `tick`; `epiphany-swarm run` is the bounded operator mouth over that queue/tick physiology; `repo-work-service-plan` and `repo-work-service-runbook` write Idunn lifecycle receipts/artifacts for the same queue-run command without launching it. | Keep any future queue-run service launch/install behind Idunn and explicit operator authority. |
| Branch-local Hands work | `adopt` and `execute` create approved Hands gates, run planned commands, stage declared paths, commit on `epiphany/*`, and write receipts. | Keep mutation branch-contained and receipt-backed; broaden only through typed plan families, not ad hoc shell freedom. |
| Soul/Modeling/Mind closure | `close` verifies the Hands commit, writes `epiphany.repo_work_closure_review.v0`, refuses path-scope mismatches, and writes Soul, Modeling, and Mind receipts. | Deepen model-authored closure review beyond the first structured closure-review packet while preserving deterministic local closure for simple mechanical work. |
| Soul/Modeling/Mind closure | `close` verifies the Hands commit, writes `epiphany.repo_work_closure_review.v0`, refuses path-scope mismatches, refuses missing/tampered/non-affirmative Mind adoption proof, runs known safe-family content assertions, optionally gates on model-authored closure verdicts, and writes Soul, Modeling, and Mind receipts. | Keep extending closure toward source-grounded semantic review and durable map admission, while preserving deterministic local closure for simple mechanical work. |
| Repo work sight | `overview` emits compact proof rows and mirrors typed `epiphany.cultmesh.repo_work_overview.v0` event documents plus a latest key; Gjallar enumerates the history as queue rows and non-mutating action rows; Persona's Eve surface and Eve connection readbacks expose peer-readable gate/blocker/next-action rows; `queue-run` consumes the same queue for branch-local scheduler pulses. | Deepen the Persona-to-plan loop without moving action authority out of Hands/Self/Bifrost. |
| Publication | `publish` routes Bifrost/GitHub receipts from closure or explicit Soul/Mind refs. | Keep publication Bifrost-owned; do not let scheduler publish. |
| Upstream main sync | `sync` proves the published commit is contained by upstream main after explicit merge/sync authority. | Treat upstream-main sync as a required final proof for published work. |
@ -1936,11 +1950,13 @@ Required organs before MVP:
model-review provenance when supplied, refuses actual-vs-declared path-scope
mismatch before Soul passes, runs committed-content assertions for known safe
families, refuses assertion failures even when the path scope matches, can
require a model-authored closure verdict before Soul passes, and exposes the
closure-review artifact through overview/export proof rows. The verdict packet
require a model-authored closure verdict before Soul passes, and now verifies
the accepted Mind adoption proof by checking the embedded decision snapshot
plus standalone decision receipt before closure passes. The verdict packet
records reviewed inputs, finding text, enforced/skipped gate state, and
private-state seals; focused smoke proves a model `needs-work` verdict blocks
closure even when path scope and safe-family assertions pass.
private-state seals; focused smokes prove a model `needs-work` verdict blocks
closure even when path scope and safe-family assertions pass, and a tampered
Mind adoption decision blocks closure before publication gates can proceed.
- Repo work projection/run surface: local `epiphany-work overview` proof bundles, typed
`epiphany.cultmesh.repo_work_overview.v0` event history plus latest-key
projection, and Gjallar multi-item `repo-work-overview` action/readback rows
@ -1978,10 +1994,11 @@ Required organs before MVP:
redacted proof row through
`gamecult.bifrost.public_proof_publication_receipt.v0` with public Verse
target, public room, ledger, review, credit, proof ref, and SHA-256 readback.
Remaining work is richer closure depth, not basic safe-family planning cargo,
local public-proof export, local CultMesh readback, Bifrost/GitHub/sync row
visibility, public-proof publication closure, or the standard wrapper mouth
for that closure.
Remaining work is deeper semantic review and durable repo-map admission, not
basic safe-family planning cargo, local public-proof export, local CultMesh
readback, Bifrost/GitHub/sync row visibility, public-proof publication
closure, Mind-adoption closure proof, or the standard wrapper mouth for those
closures.
Scheduler authority is intentionally narrow. It may advance
`accept -> plan -> run -> adopt -> execute` only when each upstream receipt

File diff suppressed because one or more lines are too long

Binary file not shown.

View file

@ -634,5 +634,5 @@ current_status:
- `tools/epiphany_local_run.ps1 -Mode swarm-online-runbook` now emits an explicit Idunn preflight summary before the operator elevation boundary. Its JSON and one-line summary report `preflightStatus`, child artifact present/hash-verified/mismatch/missing counts, aggregate service execution failed/missing check counts, child preflight rows with expected/actual SHA-256s, and private-state exposure. Live proof `local-20260619-025627-410-9724e2f6` generated the non-mutating parent artifact with `preflightStatus=ready-for-elevated-operator`, two child runbooks present, two hashes verified, zero mismatches, zero missing artifacts, eleven failed sealed service checks, zero missing checks, explicit aftercare audits, and `privateStateExposed=false`. The remaining scar is still explicit elevated operator execution followed by complete Idunn audits, not missing parent/child artifact readiness.
- Service lifecycle receipt history is now event-only: `load_epiphany_cultmesh_daemon_service_lifecycle_receipts` filters out the `epiphany-local/daemon-service-lifecycle-receipt/latest` mirror, while `load_latest_epiphany_cultmesh_daemon_service_lifecycle_receipt` remains the latest-state reader. Focused unit test `service_lifecycle_receipt_history_excludes_latest_mirror` proves two per-receipt writes return exactly two history records and latest points at the second. Fresh smoke `verse-query-lifecycle-history-filter-smoke` and live overview/triage `local-20260618-145632-497-efac6f0d` / `local-20260618-145632-321-867947af` prove compact swarm sights still expose service lifecycle attention plus the present elevated runbook artifact without daemon pokes or service mutation. Do not use a broad unscoped cargo test filter for this check on Windows; it fans out across bin harnesses and hit a broken pipe during this pass.
- `epiphany-verse-query seed-compact` is the compact seed receipt for wrappers and read-only rites. The older `seed` command still prints the full local Verse context for explicit debugging, but compact wrapper modes now avoid full `seed`/final `query` readback after the combined overview proof exposed Windows debug stack overflow from full-context serialization pressure.
last_completed_repo_swarm_cut: `repo-deployment-request` now writes branch-local Idunn-facing deployment request cargo for reviewed git-push-observed-by-Idunn deployment without granting deploy, SSH, git-push, service lifecycle, Hands, publication, merge, cross-body, or private-state authority; proof `.epiphany-smoke\repo-deployment-request-family-20260620-195605` closed through Soul with family assertions/path scope passed, Idunn review pending, deployment script/host/secret/rollback/aftercare requirements present, and private-state seal intact.
next_action: Continue repo-swarm MVP work from the documented Epiphany Online cut order in `notes/epiphany-repo-swarm-mvp-contract.md`. Typed Gjallar repo-work history/queue sight, peer-readable Persona Eve lowering, Self-owned `epiphany-work queue-run`, bounded `epiphany-swarm run`, execute-to-close scheduler handoff through `close-from-execute`, deterministic `derive-plan` families `append-worklog`, `planning-note`, `checklist-note`, `section-note` / `repo.markdown_managed_section`, `task-card` / `repo.task_card`, `repo-status-section` / `repo.status_section`, `repo-manifest` / `repo.body_manifest`, `repo-tool-capabilities` / `repo.tool_capabilities`, `repo-tool-request` / `repo.tool_request`, `repo-eve-surface` / `repo.eve_surface`, `repo-collaboration-policy` / `repo.collaboration_policy`, `repo-collaboration-topic` / `repo.collaboration_topic`, `repo-consensus-brief` / `repo.consensus_brief`, `repo-objective-draft` / `repo.objective_draft`, `repo-adoption-request` / `repo.adoption_request`, `repo-scheduling-request` / `repo.scheduling_request`, `repo-work-order` / `repo.work_order`, `repo-verification-request` / `repo.verification_request`, `repo-publication-request` / `repo.publication_request`, `repo-sync-request` / `repo.sync_request`, `repo-maintainer-review-request` / `repo.maintainer_review_request`, `repo-pr-request` / `repo.pr_request`, `repo-credit-request` / `repo.credit_request`, `repo-artifact-acceptance-request` / `repo.artifact_acceptance_request`, `repo-metrics-request` / `repo.metrics_request`, `repo-doctrine-update-request` / `repo.doctrine_update_request`, `repo-secret-policy-request` / `repo.secret_policy_request`, and `repo-deployment-request` / `repo.deployment_request`, typed Imagination action-item receipts over allowlisted safe families, `epiphany.repo_work_mind_interpretation.v0` plus `epiphany.repo_work_mind_adoption_decision.v0` Mind interpreter receipts, explicit safe-family allowlist refusal, and explicit requested-path/plan-changed-path mismatch refusal before branch-local Hands authority, hash-backed local proof bundles with Bifrost/GitHub/credit/PR/upstream-main publication rows, redacted `epiphany-work export-proof` public bundles plus local Verse `epiphany.cultmesh.repo_work_public_proof.v0` Gjallar readback, Bifrost-owned `gamecult.bifrost.public_proof_publication_receipt.v0` closure plus wrapper `bifrost-public-proof` for redacted public proofs, Idunn-hosted non-mutating queue-run lifecycle plan/runbook receipts including native proof `.epiphany-smoke\repo-work-service-lifecycle-20260620-185853`, and the speech-audited `epiphany-work persona-intake` mouth plus wrapper `repo-persona-intake` are live with `privateStateExposed=false`; proofs `.epiphany-smoke\fresh-repo-mvp-20260620-180024`, `.epiphany-smoke\swarm-stop-classification-20260620-184717`, `.epiphany-smoke\repo-mind-safe-family-guard-20260620-194425`, `.epiphany-smoke\repo-mind-path-guard-20260620-194239`, `.epiphany-smoke\repo-doctrine-update-request-family-20260620-192140`, `.epiphany-smoke\repo-secret-policy-request-family-20260620-193046`, and `.epiphany-smoke\repo-deployment-request-family-20260620-195605` show fresh-repo iteration-limit stop classification, empty-queue Gjallar classification, dry-run planning-preview Self classification, Bifrost publication-gate classification, Bifrost/GitHub upstream-sync gate classification, Mind refusal for unsupported safe-family cargo and mismatched requested paths, reviewed doctrine/security/deployment request cargo, closure, publication receipts, upstream-main sync, public-proof export, and private-state sealing. The contract note now explicitly answers that Epiphany is headed toward a functional repo swarm but is not fully online until the typed artery runs as a living repo organism. The next cut is deeper interpreter semantics beyond adoption refusal, more useful reviewed repo-owned config/action request families, explicit Idunn deployment execution/audit under operator authority, or richer closure depth. Preserve Idunn service lifecycle ownership and existing CultMesh/Odin/Eve tool directories; service install/start/deployment execution still requires explicit elevated operator authority.
last_completed_repo_swarm_cut: Soul closure now verifies accepted Mind adoption proof before closing branch-local repo work. `epiphany-work close` embeds `epiphany.repo_work_mind_adoption_closure_review.v0`, checks the cited adoption receipt's embedded `epiphany.repo_work_mind_adoption_decision.v0` snapshot plus standalone decision receipt, and refuses missing/tampered/non-affirmative Mind decisions even when verification, path scope, and safe-family assertions pass. Proof `.epiphany-smoke\repo-close-mind-adoption-guard-20260620-201153` showed counterfeit adoption produced `verification-failed` / Soul `failed` / `mindAdoptionReview.status=failed`, while the original chain closed with Soul `passed`, `mindAdoptionReview.status=passed`, and `privateStateExposed=false`.
next_action: Continue repo-swarm MVP work from the documented Epiphany Online cut order in `notes/epiphany-repo-swarm-mvp-contract.md`. Typed Gjallar repo-work history/queue sight, peer-readable Persona Eve lowering, Self-owned `epiphany-work queue-run`, bounded `epiphany-swarm run`, execute-to-close scheduler handoff through `close-from-execute`, deterministic `derive-plan` families `append-worklog`, `planning-note`, `checklist-note`, `section-note` / `repo.markdown_managed_section`, `task-card` / `repo.task_card`, `repo-status-section` / `repo.status_section`, `repo-manifest` / `repo.body_manifest`, `repo-tool-capabilities` / `repo.tool_capabilities`, `repo-tool-request` / `repo.tool_request`, `repo-eve-surface` / `repo.eve_surface`, `repo-collaboration-policy` / `repo.collaboration_policy`, `repo-collaboration-topic` / `repo.collaboration_topic`, `repo-consensus-brief` / `repo.consensus_brief`, `repo-objective-draft` / `repo.objective_draft`, `repo-adoption-request` / `repo.adoption_request`, `repo-scheduling-request` / `repo.scheduling_request`, `repo-work-order` / `repo.work_order`, `repo-verification-request` / `repo.verification_request`, `repo-publication-request` / `repo.publication_request`, `repo-sync-request` / `repo.sync_request`, `repo-maintainer-review-request` / `repo.maintainer_review_request`, `repo-pr-request` / `repo.pr_request`, `repo-credit-request` / `repo.credit_request`, `repo-artifact-acceptance-request` / `repo.artifact_acceptance_request`, `repo-metrics-request` / `repo.metrics_request`, `repo-doctrine-update-request` / `repo.doctrine_update_request`, `repo-secret-policy-request` / `repo.secret_policy_request`, and `repo-deployment-request` / `repo.deployment_request`, typed Imagination action-item receipts over allowlisted safe families, `epiphany.repo_work_mind_interpretation.v0` plus `epiphany.repo_work_mind_adoption_decision.v0` Mind interpreter receipts, explicit safe-family allowlist refusal, explicit requested-path/plan-changed-path mismatch refusal, and Soul closure's Mind-adoption proof guard before branch-local Hands consequences reach publication gates, hash-backed local proof bundles with Bifrost/GitHub/credit/PR/upstream-main publication rows, redacted `epiphany-work export-proof` public bundles plus local Verse `epiphany.cultmesh.repo_work_public_proof.v0` Gjallar readback, Bifrost-owned `gamecult.bifrost.public_proof_publication_receipt.v0` closure plus wrapper `bifrost-public-proof` for redacted public proofs, Idunn-hosted non-mutating queue-run lifecycle plan/runbook receipts including native proof `.epiphany-smoke\repo-work-service-lifecycle-20260620-185853`, and the speech-audited `epiphany-work persona-intake` mouth plus wrapper `repo-persona-intake` are live with `privateStateExposed=false`; proofs `.epiphany-smoke\fresh-repo-mvp-20260620-180024`, `.epiphany-smoke\swarm-stop-classification-20260620-184717`, `.epiphany-smoke\repo-mind-safe-family-guard-20260620-194425`, `.epiphany-smoke\repo-mind-path-guard-20260620-194239`, `.epiphany-smoke\repo-doctrine-update-request-family-20260620-192140`, `.epiphany-smoke\repo-secret-policy-request-family-20260620-193046`, `.epiphany-smoke\repo-deployment-request-family-20260620-195605`, and `.epiphany-smoke\repo-close-mind-adoption-guard-20260620-201153` show fresh-repo iteration-limit stop classification, empty-queue Gjallar classification, dry-run planning-preview Self classification, Bifrost publication-gate classification, Bifrost/GitHub upstream-sync gate classification, Mind refusal for unsupported safe-family cargo and mismatched requested paths, reviewed doctrine/security/deployment request cargo, closure refusal for counterfeit Mind adoption, closure, publication receipts, upstream-main sync, public-proof export, and private-state sealing. The contract note now explicitly answers that Epiphany is headed toward a functional repo swarm but is not fully online until the typed artery runs as a living repo organism. The next cut is deeper semantic review and durable repo-map admission, further useful repo-owned config/action request families, or explicit Idunn deployment execution/audit under operator authority. Preserve Idunn service lifecycle ownership and existing CultMesh/Odin/Eve tool directories; service install/start/deployment execution still requires explicit elevated operator authority.