Wire startup birth specialist runner
This commit is contained in:
parent
0cba9bffa5
commit
f51a77e7d9
6 changed files with 515 additions and 9 deletions
421
epiphany-core/src/bin/epiphany-repo-birth-runner.rs
Normal file
421
epiphany-core/src/bin/epiphany-repo-birth-runner.rs
Normal file
|
|
@ -0,0 +1,421 @@
|
|||
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::io::Write;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::Command;
|
||||
use std::process::Stdio;
|
||||
use std::thread;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
const DEFAULT_CODEX_BIN: &str = "codex";
|
||||
const DEFAULT_TIMEOUT_SECONDS: u64 = 900;
|
||||
|
||||
fn main() -> Result<()> {
|
||||
let args = Args::parse()?;
|
||||
let summary = run(args)?;
|
||||
println!("{}", serde_json::to_string_pretty(&summary)?);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
struct Args {
|
||||
repo: PathBuf,
|
||||
baseline: PathBuf,
|
||||
artifact_dir: PathBuf,
|
||||
init_store: PathBuf,
|
||||
agent_store: PathBuf,
|
||||
heartbeat_store: PathBuf,
|
||||
codex_bin: String,
|
||||
mode: String,
|
||||
model: Option<String>,
|
||||
timeout_seconds: u64,
|
||||
auto_accept: bool,
|
||||
}
|
||||
|
||||
impl Args {
|
||||
fn parse() -> Result<Self> {
|
||||
let root = env::current_dir().context("failed to resolve current dir")?;
|
||||
let mut args = env::args().skip(1);
|
||||
let mut parsed = Args {
|
||||
repo: root.clone(),
|
||||
baseline: root
|
||||
.join(".epiphany-imports")
|
||||
.join("repo-personality-terrain")
|
||||
.join("baseline.msgpack"),
|
||||
artifact_dir: root.join(".epiphany-birth-runner"),
|
||||
init_store: root.join("state").join("repo-initialization.msgpack"),
|
||||
agent_store: root.join("state").join("agents.msgpack"),
|
||||
heartbeat_store: root.join("state").join("agent-heartbeats.msgpack"),
|
||||
codex_bin: DEFAULT_CODEX_BIN.to_string(),
|
||||
mode: "plan".to_string(),
|
||||
model: None,
|
||||
timeout_seconds: DEFAULT_TIMEOUT_SECONDS,
|
||||
auto_accept: false,
|
||||
};
|
||||
while let Some(arg) = args.next() {
|
||||
match arg.as_str() {
|
||||
"--repo" => parsed.repo = take_path(&mut args, "--repo")?,
|
||||
"--baseline" => parsed.baseline = take_path(&mut args, "--baseline")?,
|
||||
"--artifact-dir" => parsed.artifact_dir = take_path(&mut args, "--artifact-dir")?,
|
||||
"--init-store" => parsed.init_store = take_path(&mut args, "--init-store")?,
|
||||
"--agent-store" => parsed.agent_store = take_path(&mut args, "--agent-store")?,
|
||||
"--heartbeat-store" => {
|
||||
parsed.heartbeat_store = take_path(&mut args, "--heartbeat-store")?;
|
||||
}
|
||||
"--codex-bin" => parsed.codex_bin = take_string(&mut args, "--codex-bin")?,
|
||||
"--mode" => parsed.mode = take_string(&mut args, "--mode")?,
|
||||
"--model" => parsed.model = Some(take_string(&mut args, "--model")?),
|
||||
"--timeout-seconds" => {
|
||||
parsed.timeout_seconds =
|
||||
take_string(&mut args, "--timeout-seconds")?.parse()?;
|
||||
}
|
||||
"--auto-accept" => parsed.auto_accept = true,
|
||||
other => return Err(anyhow!("unknown argument {other:?}")),
|
||||
}
|
||||
}
|
||||
if !matches!(parsed.mode.as_str(), "plan" | "run") {
|
||||
return Err(anyhow!("--mode must be plan or run"));
|
||||
}
|
||||
Ok(parsed)
|
||||
}
|
||||
}
|
||||
|
||||
fn run(args: Args) -> Result<Value> {
|
||||
fs::create_dir_all(&args.artifact_dir)
|
||||
.with_context(|| format!("failed to create {}", args.artifact_dir.display()))?;
|
||||
let startup_dir = args.artifact_dir.join("startup");
|
||||
fs::create_dir_all(&startup_dir)?;
|
||||
let startup = run_repo_personality_json(&[
|
||||
"startup".to_string(),
|
||||
"--repo".to_string(),
|
||||
args.repo.display().to_string(),
|
||||
"--baseline".to_string(),
|
||||
args.baseline.display().to_string(),
|
||||
"--artifact-dir".to_string(),
|
||||
startup_dir.display().to_string(),
|
||||
"--init-store".to_string(),
|
||||
args.init_store.display().to_string(),
|
||||
])?;
|
||||
let packets = startup["generatedPackets"]
|
||||
.as_array()
|
||||
.cloned()
|
||||
.unwrap_or_default();
|
||||
let mut executions = Vec::new();
|
||||
for packet in packets {
|
||||
let kind = packet["kind"].as_str().unwrap_or("unknown");
|
||||
let packet_path = path_from_value(&packet["packetPath"])?;
|
||||
let execution_dir = args.artifact_dir.join(sanitize(kind));
|
||||
fs::create_dir_all(&execution_dir)?;
|
||||
let packet_value = read_json(&packet_path)?;
|
||||
let prompt_path = execution_dir.join("prompt.md");
|
||||
let schema_path = execution_dir.join("output-schema.json");
|
||||
let result_path = execution_dir.join("result.json");
|
||||
let stdout_path = execution_dir.join("codex.stdout.log");
|
||||
let stderr_path = execution_dir.join("codex.stderr.log");
|
||||
let prompt = render_specialist_prompt(kind, &packet_value)?;
|
||||
let schema = output_schema_for_kind(kind, &packet_value)?;
|
||||
write_text(&prompt_path, &prompt)?;
|
||||
write_json(&schema_path, &schema)?;
|
||||
let mut execution = json!({
|
||||
"kind": kind,
|
||||
"birthOnly": true,
|
||||
"executionOwner": "repo-initialization-startup-runner",
|
||||
"heartbeatParticipant": Value::Null,
|
||||
"packetPath": packet_path,
|
||||
"promptPath": prompt_path,
|
||||
"schemaPath": schema_path,
|
||||
"resultPath": result_path,
|
||||
"stdoutPath": stdout_path,
|
||||
"stderrPath": stderr_path,
|
||||
"status": "planned",
|
||||
"acceptCommand": accept_command(kind, &args, &packet_path, &result_path),
|
||||
});
|
||||
if args.mode == "run" {
|
||||
let run_result = run_codex_specialist(
|
||||
&args,
|
||||
&prompt,
|
||||
&schema_path,
|
||||
&result_path,
|
||||
&stdout_path,
|
||||
&stderr_path,
|
||||
)?;
|
||||
execution["status"] = run_result["status"].clone();
|
||||
execution["exitCode"] = run_result["exitCode"].clone();
|
||||
execution["timedOut"] = run_result["timedOut"].clone();
|
||||
if result_path.exists() {
|
||||
execution["result"] = read_json(&result_path).unwrap_or_else(|err| {
|
||||
json!({
|
||||
"status": "invalid-json",
|
||||
"error": err.to_string(),
|
||||
})
|
||||
});
|
||||
}
|
||||
if args.auto_accept && execution["status"] == "completed" {
|
||||
execution["acceptance"] = run_repo_personality_json(&accept_args(
|
||||
kind,
|
||||
&args,
|
||||
&packet_path,
|
||||
&result_path,
|
||||
))?;
|
||||
}
|
||||
}
|
||||
executions.push(execution);
|
||||
}
|
||||
let summary = json!({
|
||||
"schemaVersion": "epiphany.repo_birth_runner.v0",
|
||||
"createdAt": Utc::now().to_rfc3339_opts(chrono::SecondsFormat::Secs, true),
|
||||
"mode": args.mode,
|
||||
"repo": args.repo,
|
||||
"baseline": args.baseline,
|
||||
"artifactDir": args.artifact_dir,
|
||||
"initStore": args.init_store,
|
||||
"agentStore": args.agent_store,
|
||||
"heartbeatStore": args.heartbeat_store,
|
||||
"startup": startup,
|
||||
"executions": executions,
|
||||
"requiresReview": !args.auto_accept,
|
||||
"nextSafeMove": if executions.is_empty() {
|
||||
"Birth initialization records are present; continue startup."
|
||||
} else if args.mode == "plan" {
|
||||
"Review planned startup-only birth executions, then rerun with --mode run."
|
||||
} else if args.auto_accept {
|
||||
"Review auto-accepted smoke output and continue startup."
|
||||
} else {
|
||||
"Review result.json for each birth specialist, then run the shown accept-init command."
|
||||
}
|
||||
});
|
||||
write_json(
|
||||
&args.artifact_dir.join("birth-runner-summary.json"),
|
||||
&summary,
|
||||
)?;
|
||||
Ok(summary)
|
||||
}
|
||||
|
||||
fn run_codex_specialist(
|
||||
args: &Args,
|
||||
prompt: &str,
|
||||
schema_path: &Path,
|
||||
result_path: &Path,
|
||||
stdout_path: &Path,
|
||||
stderr_path: &Path,
|
||||
) -> Result<Value> {
|
||||
let mut command = Command::new(&args.codex_bin);
|
||||
command
|
||||
.arg("exec")
|
||||
.arg("--cd")
|
||||
.arg(&args.repo)
|
||||
.arg("--sandbox")
|
||||
.arg("read-only")
|
||||
.arg("--skip-git-repo-check")
|
||||
.arg("--output-schema")
|
||||
.arg(schema_path)
|
||||
.arg("--output-last-message")
|
||||
.arg(result_path);
|
||||
if let Some(model) = &args.model {
|
||||
command.arg("--model").arg(model);
|
||||
}
|
||||
command.arg("-");
|
||||
command
|
||||
.stdin(Stdio::piped())
|
||||
.stdout(Stdio::piped())
|
||||
.stderr(Stdio::piped());
|
||||
let mut child = command.spawn().context("failed to spawn codex exec")?;
|
||||
child
|
||||
.stdin
|
||||
.as_mut()
|
||||
.ok_or_else(|| anyhow!("failed to open codex stdin"))?
|
||||
.write_all(prompt.as_bytes())?;
|
||||
let deadline = Instant::now() + Duration::from_secs(args.timeout_seconds);
|
||||
loop {
|
||||
if let Some(status) = child.try_wait()? {
|
||||
let output = child.wait_with_output()?;
|
||||
write_bytes(stdout_path, &output.stdout)?;
|
||||
write_bytes(stderr_path, &output.stderr)?;
|
||||
return Ok(json!({
|
||||
"status": if status.success() { "completed" } else { "failed" },
|
||||
"exitCode": status.code(),
|
||||
"timedOut": false,
|
||||
}));
|
||||
}
|
||||
if Instant::now() >= deadline {
|
||||
let _ = child.kill();
|
||||
let output = child.wait_with_output()?;
|
||||
write_bytes(stdout_path, &output.stdout)?;
|
||||
write_bytes(stderr_path, &output.stderr)?;
|
||||
return Ok(json!({
|
||||
"status": "timeout",
|
||||
"exitCode": Value::Null,
|
||||
"timedOut": true,
|
||||
}));
|
||||
}
|
||||
thread::sleep(Duration::from_millis(250));
|
||||
}
|
||||
}
|
||||
|
||||
fn render_specialist_prompt(kind: &str, packet: &Value) -> Result<String> {
|
||||
Ok(format!(
|
||||
"{}\n\n# Startup-Only Birth Packet\n\nYou are executing exactly one repo initialization birth specialist packet. Do not edit files. Do not mutate state. Return only JSON that matches the provided schema. The coordinator/Self will review and decide whether to accept the result.\n\n```json\n{}\n```\n",
|
||||
packet["prompt"].as_str().unwrap_or(match kind {
|
||||
"repo-personality" => "Act as the Epiphany Repo Personality Distiller.",
|
||||
"repo-memory" => "Act as the Epiphany Repo Memory Distiller.",
|
||||
_ => "Act as a startup-only Epiphany birth specialist.",
|
||||
}),
|
||||
serde_json::to_string_pretty(packet)?
|
||||
))
|
||||
}
|
||||
|
||||
fn output_schema_for_kind(kind: &str, packet: &Value) -> Result<Value> {
|
||||
let expected = packet.get("expectedOutput").cloned().unwrap_or(Value::Null);
|
||||
let schema = match kind {
|
||||
"repo-personality" => json!({
|
||||
"type": "object",
|
||||
"required": ["verdict", "summary", "confidence", "roleQuirks", "selfPatchCandidates", "initializationRecord", "doNotMutate", "nextSafeMove"],
|
||||
"properties": {
|
||||
"verdict": {"type": "string", "enum": ["ready-for-review", "needs-more-terrain", "reject"]},
|
||||
"summary": {"type": "string"},
|
||||
"confidence": {"type": "number"},
|
||||
"roleQuirks": {"type": "array", "items": {"type": "object"}},
|
||||
"selfPatchCandidates": {"type": "array", "items": {"type": "object"}},
|
||||
"initializationRecord": {"type": "object"},
|
||||
"doNotMutate": {"type": "array", "items": {"type": "string"}},
|
||||
"nextSafeMove": {"type": "string"}
|
||||
},
|
||||
"additionalProperties": true,
|
||||
"xEpiphanyExpectedOutput": expected,
|
||||
}),
|
||||
"repo-memory" => json!({
|
||||
"type": "object",
|
||||
"required": ["verdict", "summary", "confidence", "roleMemoryPatches", "initializationRecord", "doNotMutate", "nextSafeMove"],
|
||||
"properties": {
|
||||
"verdict": {"type": "string", "enum": ["ready-for-review", "needs-more-terrain", "reject"]},
|
||||
"summary": {"type": "string"},
|
||||
"confidence": {"type": "number"},
|
||||
"roleMemoryPatches": {"type": "array", "items": {"type": "object"}},
|
||||
"globalMemoryCandidates": {"type": "array", "items": {"type": "object"}},
|
||||
"initializationRecord": {"type": "object"},
|
||||
"doNotMutate": {"type": "array", "items": {"type": "string"}},
|
||||
"nextSafeMove": {"type": "string"}
|
||||
},
|
||||
"additionalProperties": true,
|
||||
"xEpiphanyExpectedOutput": expected,
|
||||
}),
|
||||
other => return Err(anyhow!("unsupported birth specialist kind {other:?}")),
|
||||
};
|
||||
Ok(schema)
|
||||
}
|
||||
|
||||
fn accept_command(kind: &str, args: &Args, packet_path: &Path, result_path: &Path) -> Vec<String> {
|
||||
accept_args(kind, args, packet_path, result_path)
|
||||
}
|
||||
|
||||
fn accept_args(kind: &str, args: &Args, packet_path: &Path, result_path: &Path) -> Vec<String> {
|
||||
let mut out = vec![
|
||||
"accept-init".to_string(),
|
||||
"--init-store".to_string(),
|
||||
args.init_store.display().to_string(),
|
||||
"--packet".to_string(),
|
||||
packet_path.display().to_string(),
|
||||
"--kind".to_string(),
|
||||
kind.to_string(),
|
||||
"--accepted-by".to_string(),
|
||||
"Self".to_string(),
|
||||
"--summary".to_string(),
|
||||
format!("Accepted {kind} birth specialist result after review."),
|
||||
"--result".to_string(),
|
||||
result_path.display().to_string(),
|
||||
"--agent-store".to_string(),
|
||||
args.agent_store.display().to_string(),
|
||||
"--apply-self-patches".to_string(),
|
||||
"true".to_string(),
|
||||
];
|
||||
if kind == "repo-personality" {
|
||||
out.extend([
|
||||
"--heartbeat-store".to_string(),
|
||||
args.heartbeat_store.display().to_string(),
|
||||
"--apply-heartbeat-seeds".to_string(),
|
||||
"true".to_string(),
|
||||
]);
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
fn run_repo_personality_json(args: &[String]) -> Result<Value> {
|
||||
let exe = native_exe("epiphany-repo-personality");
|
||||
let output = Command::new(&exe)
|
||||
.args(args)
|
||||
.output()
|
||||
.with_context(|| format!("failed to run {}", exe.display()))?;
|
||||
if !output.status.success() {
|
||||
return Err(anyhow!(
|
||||
"epiphany-repo-personality failed: {}",
|
||||
String::from_utf8_lossy(&output.stderr)
|
||||
));
|
||||
}
|
||||
serde_json::from_slice(&output.stdout)
|
||||
.with_context(|| format!("epiphany-repo-personality returned invalid JSON"))
|
||||
}
|
||||
|
||||
fn native_exe(name: &str) -> PathBuf {
|
||||
let target_dir = env::var_os("CARGO_TARGET_DIR")
|
||||
.unwrap_or_else(|| r"C:\Users\Meta\.cargo-target-codex".into());
|
||||
PathBuf::from(target_dir)
|
||||
.join("debug")
|
||||
.join(format!("{name}{}", env::consts::EXE_SUFFIX))
|
||||
}
|
||||
|
||||
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)?;
|
||||
}
|
||||
fs::write(path, serde_json::to_vec_pretty(value)?)
|
||||
.with_context(|| format!("failed to write {}", path.display()))
|
||||
}
|
||||
|
||||
fn write_text(path: &Path, value: &str) -> Result<()> {
|
||||
if let Some(parent) = path.parent() {
|
||||
fs::create_dir_all(parent)?;
|
||||
}
|
||||
fs::write(path, value).with_context(|| format!("failed to write {}", path.display()))
|
||||
}
|
||||
|
||||
fn write_bytes(path: &Path, value: &[u8]) -> Result<()> {
|
||||
if let Some(parent) = path.parent() {
|
||||
fs::create_dir_all(parent)?;
|
||||
}
|
||||
fs::write(path, value).with_context(|| format!("failed to write {}", path.display()))
|
||||
}
|
||||
|
||||
fn path_from_value(value: &Value) -> Result<PathBuf> {
|
||||
value
|
||||
.as_str()
|
||||
.map(PathBuf::from)
|
||||
.ok_or_else(|| anyhow!("expected path string, got {value}"))
|
||||
}
|
||||
|
||||
fn sanitize(value: &str) -> String {
|
||||
value
|
||||
.chars()
|
||||
.map(|ch| if ch.is_ascii_alphanumeric() { ch } else { '-' })
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn take_string(args: &mut impl Iterator<Item = String>, name: &str) -> Result<String> {
|
||||
args.next()
|
||||
.ok_or_else(|| anyhow!("{name} requires a value"))
|
||||
}
|
||||
|
||||
fn take_path(args: &mut impl Iterator<Item = String>, name: &str) -> Result<PathBuf> {
|
||||
Ok(PathBuf::from(take_string(args, name)?))
|
||||
}
|
||||
|
|
@ -198,6 +198,54 @@ fn run_smoke() -> Result<Value> {
|
|||
startup_memory_packet.exists(),
|
||||
"startup should write memory packet",
|
||||
)?;
|
||||
let birth_runner = run_birth_runner(
|
||||
&root,
|
||||
&[
|
||||
"--repo",
|
||||
cult_repo.to_str().unwrap_or_default(),
|
||||
"--baseline",
|
||||
baseline.to_str().unwrap_or_default(),
|
||||
"--artifact-dir",
|
||||
artifacts
|
||||
.join("birth-runner-plan")
|
||||
.to_str()
|
||||
.unwrap_or_default(),
|
||||
"--init-store",
|
||||
artifacts
|
||||
.join("birth-runner-plan")
|
||||
.join("repo-initialization.msgpack")
|
||||
.to_str()
|
||||
.unwrap_or_default(),
|
||||
"--agent-store",
|
||||
root.join("state")
|
||||
.join("agents.msgpack")
|
||||
.to_str()
|
||||
.unwrap_or_default(),
|
||||
"--heartbeat-store",
|
||||
root.join("state")
|
||||
.join("agent-heartbeats.msgpack")
|
||||
.to_str()
|
||||
.unwrap_or_default(),
|
||||
"--mode",
|
||||
"plan",
|
||||
],
|
||||
)?;
|
||||
require(
|
||||
birth_runner["schemaVersion"] == "epiphany.repo_birth_runner.v0",
|
||||
"birth runner should return its schema",
|
||||
)?;
|
||||
require(
|
||||
birth_runner["executions"].as_array().map_or(0, Vec::len) == 2,
|
||||
"birth runner plan should expose both startup-only specialist executions",
|
||||
)?;
|
||||
require(
|
||||
birth_runner["executions"]
|
||||
.as_array()
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.all(|execution| execution["heartbeatParticipant"].is_null()),
|
||||
"birth runner executions should not be heartbeat participants",
|
||||
)?;
|
||||
let heartbeat_store = artifacts.join("startup-heartbeats.msgpack");
|
||||
run_heartbeat(
|
||||
&root,
|
||||
|
|
@ -360,6 +408,7 @@ fn run_smoke() -> Result<Value> {
|
|||
"initStore": init_store,
|
||||
"agentStore": agent_store,
|
||||
"heartbeatStore": heartbeat_store,
|
||||
"birthRunnerSummary": artifacts.join("birth-runner-plan").join("birth-runner-summary.json"),
|
||||
"startupPersonalityPacket": startup_personality_packet,
|
||||
"startupMemoryPacket": startup_memory_packet,
|
||||
"startupMemoryResult": memory_result_path,
|
||||
|
|
@ -412,6 +461,29 @@ fn run_personality(root: &Path, args: &[&str]) -> Result<Value> {
|
|||
})
|
||||
}
|
||||
|
||||
fn run_birth_runner(root: &Path, args: &[&str]) -> Result<Value> {
|
||||
let exe = native_birth_runner_exe()?;
|
||||
ensure_built(root, "epiphany-repo-birth-runner", &exe)?;
|
||||
let output = Command::new(exe)
|
||||
.current_dir(root)
|
||||
.args(args)
|
||||
.output()
|
||||
.context("failed to run epiphany-repo-birth-runner")?;
|
||||
require(
|
||||
output.status.success(),
|
||||
&format!(
|
||||
"epiphany-repo-birth-runner failed: {}",
|
||||
String::from_utf8_lossy(&output.stderr)
|
||||
),
|
||||
)?;
|
||||
serde_json::from_slice(&output.stdout).with_context(|| {
|
||||
format!(
|
||||
"epiphany-repo-birth-runner did not return JSON: {}",
|
||||
String::from_utf8_lossy(&output.stdout)
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
fn run_heartbeat(root: &Path, args: &[&str]) -> Result<Value> {
|
||||
let exe = native_heartbeat_exe()?;
|
||||
ensure_built(root, "epiphany-heartbeat-store", &exe)?;
|
||||
|
|
@ -444,6 +516,15 @@ fn native_personality_exe() -> Result<PathBuf> {
|
|||
)))
|
||||
}
|
||||
|
||||
fn native_birth_runner_exe() -> Result<PathBuf> {
|
||||
let target_dir = env::var_os("CARGO_TARGET_DIR")
|
||||
.unwrap_or_else(|| r"C:\Users\Meta\.cargo-target-codex".into());
|
||||
Ok(PathBuf::from(target_dir).join("debug").join(format!(
|
||||
"epiphany-repo-birth-runner{}",
|
||||
env::consts::EXE_SUFFIX
|
||||
)))
|
||||
}
|
||||
|
||||
fn native_heartbeat_exe() -> Result<PathBuf> {
|
||||
let target_dir = env::var_os("CARGO_TARGET_DIR")
|
||||
.unwrap_or_else(|| r"C:\Users\Meta\.cargo-target-codex".into());
|
||||
|
|
|
|||
|
|
@ -36,9 +36,9 @@ remembers doctrine; the branch remembers the blade.
|
|||
- Native `epiphany-mvp-coordinator` is the first auditable fixed-lane coordinator runner. It starts or reads a thread through app-server, opens a native runtime-spine session, follows the harness-native coordinator action, can auto-launch modeling, verification, or reorient-worker jobs, records native runtime job/result receipts for terminal launched work, keeps semantic findings review-gated by default, and writes summary, steps, rendered snapshots, transcript, stderr, runtime-spine status, and final next-action artifacts under `.epiphany-dogfood/coordinator` or a caller-provided artifact directory. It refuses direct backend-completion mutation; full completion smoke needs live workers while execution is being cauterized into CultNet.
|
||||
- Native `epiphany-runtime-spine` is the first Codex-independent runtime vertebra. It owns typed CultCache documents for runtime identity, sessions, jobs, job results, and events; opens/completes native jobs; snapshots jobs/results by runtime job id; projects job-result counts; and can emit a framed CultNet hello message advertising the native document and mutation contract surface. Codex app-server launch/read-back/acceptance is now a typed heartbeat/runtime-spine bridge with no Epiphany job-result dependency on the Codex SQLite runtime.
|
||||
- CultNet APIs are advertised as compatible schemas plus mutation contracts. Hello frames now expose readable document types, allowed operations, mutation authority, typed intent document types, and typed receipt document types; Aquarium should use those contracts to submit state changes and watch receipts rather than growing a little bespoke verb zoo.
|
||||
- Repo personality initialization now has a terrain-reduced plan and native birth surface. `epiphany-repo-personality scout/project/agent-packet/status` scouts local git repos, scores body taxonomy/history temperament/memory doctrine, writes typed CultCache terrain/profile/role-projection MessagePack stores, emits JSON/Markdown inspection exports, and renders a birth-only Repo Personality Distiller specialist prompt packet. `epiphany-repo-personality startup` now checks for accepted personality/memory initialization records, launches packet generation only when absent, and `accept-init` can route reviewed role `selfPatch` candidates into initial role memory plus seed heartbeat physiology from typed role personality projections. The birth specialists are startup-only initialization actuators, not heartbeat lanes; heartbeat receives only the accepted physiology seed. The remaining seams are actual startup-only specialist execution and Aquarium review surfaces. After that, personality drift belongs to heartbeat, mood, rumination, sleep consolidation, lived evidence, and reviewed `selfPatch`, not repeated startup distillation.
|
||||
- Repo personality initialization now has a terrain-reduced plan and native birth surface. `epiphany-repo-personality scout/project/agent-packet/status` scouts local git repos, scores body taxonomy/history temperament/memory doctrine, writes typed CultCache terrain/profile/role-projection MessagePack stores, emits JSON/Markdown inspection exports, and renders a birth-only Repo Personality Distiller specialist prompt packet. `epiphany-repo-personality startup` now checks for accepted personality/memory initialization records, launches packet generation only when absent, and `accept-init` can route reviewed role `selfPatch` candidates into initial role memory plus seed heartbeat physiology from typed role personality projections. The birth specialists are startup-only initialization actuators, not heartbeat lanes; heartbeat receives only the accepted physiology seed. `epiphany-repo-birth-runner` now owns the startup-only execution path: plan mode writes Codex execution prompts/schemas/accept commands, and run mode invokes `codex exec` with the packet schema and captures reviewable `result.json`. The remaining seam is Aquarium review/action surfacing. After accepted birth, personality drift belongs to heartbeat, mood, rumination, sleep consolidation, lived evidence, and reviewed `selfPatch`, not repeated startup distillation.
|
||||
- Repo memory initialization is now split from personality initialization. `epiphany-repo-personality memory-packet` renders a birth-only Repo Memory Distiller packet from the same typed terrain/profile/projection store plus bounded source excerpts. It gives each organ its own mission filter: Self for routing/authority, Face for public surface, Imagination for plans/backlog, Eyes for prior art, Body for architecture, Hands for implementation habits, Soul for evidence, and Life for continuity. The output is still a Self-reviewed petition, not direct memory mutation.
|
||||
- The first birth startup valve is now native. `epiphany-repo-personality startup` checks a typed init store for accepted `repo-personality` and `repo-memory` records, generates missing packets under a startup artifact dir, and returns `reviewInitializationPackets`. Generated birth packets now advertise `birthOnly`, `executionOwner: repo-initialization-startup-runner`, and no heartbeat participant. `accept-init` can process a distiller result, review/apply role `selfPatch` candidates through `state/agents.msgpack`, apply `repo-personality` heartbeat seeds through `state/agent-heartbeats.msgpack`, and seal the reviewed packet as `epiphany.repo_initialization_record.v0`; after both records exist, startup returns `continueStartup` and does not regenerate birth packets. This is the switchboard plus first memory/physiology application path, not the full ritual: actual startup-only specialist execution and Aquarium review UI are still next.
|
||||
- The first birth startup valve is now native. `epiphany-repo-personality startup` checks a typed init store for accepted `repo-personality` and `repo-memory` records, generates missing packets under a startup artifact dir, and returns `reviewInitializationPackets`. Generated birth packets now advertise `birthOnly`, `executionOwner: repo-initialization-startup-runner`, and no heartbeat participant. `epiphany-repo-birth-runner` consumes those packets as startup-only Codex exec jobs and writes prompts, output schemas, stdout/stderr logs, result files, and exact `accept-init` commands. `accept-init` can process a distiller result, review/apply role `selfPatch` candidates through `state/agents.msgpack`, apply `repo-personality` heartbeat seeds through `state/agent-heartbeats.msgpack`, and seal the reviewed packet as `epiphany.repo_initialization_record.v0`; after both records exist, startup returns `continueStartup` and does not regenerate birth packets. The remaining UI wound is Aquarium review/action surfacing.
|
||||
- Native CRRC automation is now landed only at turn-complete safe boundaries. It may submit `Op::Compact` for coordinator-approved `compactRehydrateReorient` or for a successful pre-compaction checkpoint intervention's pending compact handoff, and it may launch the fixed `reorient-worker` for coordinator-approved `launchReorientWorker`. It does not auto-launch Imagination/modeling/verification, accept findings, promote evidence, edit implementation code, or keep going after reviewable semantic output.
|
||||
- Pre-compaction checkpoint intervention is now landed. On token-count events for loaded Epiphany threads, when current context usage reaches 80% of the active auto-compact/context limit, the harness steers the active turn once with a CRRC checkpoint directive so the agent banks working context before compaction/reorientation. Pressure ignores cumulative token spend; cumulative-only telemetry reports unknown instead of yelling. A successful steer now latches a turn-scoped compact handoff that is consumed at clean turn completion, preventing the brake from decaying into another implementation turn. This is still bounded steering plus compaction handoff, not automatic semantic acceptance, a broad scheduler, or implementation continuation.
|
||||
- The old Python dogfood/live-specialist runners were cut because they encoded the obsolete completion path. The replacement must be native Rust/CultCache/CultNet and complete heartbeat-owned runtime-spine job results with auditable artifacts.
|
||||
|
|
@ -70,7 +70,7 @@ remembers doctrine; the branch remembers the blade.
|
|||
- The planning loop is now runtime-backed and operator-visible. Typed captures, backlog items, roadmap streams, Objective Drafts, and GitHub issue source refs live in `EpiphanyThreadState`, validate through revision-gated `thread/epiphany/update`, render into prompts when present, project read-only through `thread/epiphany/planning`, render in the GUI Planning panel, can be synthesized by the fixed Imagination/planning lane, and can be explicitly adopted through the artifacted `adoptObjectiveDraft` GUI action. Chat is deliberation, not an objective pipe; ideas and GitHub Issues remain planning state until explicit human adoption.
|
||||
- The bridge/dashboard slice is now landed far enough to test locally. Native `epiphany-rider-bridge` inspects Rider installation, solution, VCS, changed files, and captures file/selection/symbol context into `.epiphany-gui/rider` artifacts; Aquarium has Inspect Rider and renders Rider audit artifacts in Environment; Aquarium also embeds the adjacent EpiphanyGraph viewer over typed `graphs.architecture`, `graphs.dataflow`, and `graphs.links`.
|
||||
- A first Rider plugin scaffold lives under `integrations/rider`: tool window, Refresh status, and Send Context to Epiphany action. It shells through native `epiphany-rider-bridge` and does not own state. `gradle` is not installed on this machine, so the scaffold is not build-verified yet.
|
||||
- Next real product move: complete the birth route by running generated startup packets through a startup-only specialist execution path and surfacing the review flow in Aquarium. Continue Aquarium UI work in `E:\Projects\EpiphanyAquarium` after that; surface native heartbeat `sleepCycle`, `memoryResonance`, `incubation`, `thoughtLanes`, `bridge`, `candidateInterventions`, `appraisals`, and `reactions`; keep EpiphanyAgent focused on backend contracts, typed state, coordinator policy, bridge tools, heartbeat scheduling, Face guardrails, and the ongoing purification from Python/JSON scaffolding into Rust/CultCache/CultNet organs. Then build-verify/package the Rider plugin scaffold when Gradle/wrapper support is available, install the Aetheria-pinned Unity `6000.1.10f1` editor, and run the next Aetheria dogfood pass through Aquarium/Rider/Unity bridge artifacts. GitHub Issues import is deferred until the backlog source is fresh enough to deserve Imagination's attention.
|
||||
- Next real product move: surface the repo birth runner review flow in Aquarium and then live-dogfood `epiphany-repo-birth-runner --mode run` on a real newborn repo. Continue Aquarium UI work in `E:\Projects\EpiphanyAquarium` after that; surface native heartbeat `sleepCycle`, `memoryResonance`, `incubation`, `thoughtLanes`, `bridge`, `candidateInterventions`, `appraisals`, and `reactions`; keep EpiphanyAgent focused on backend contracts, typed state, coordinator policy, bridge tools, heartbeat scheduling, Face guardrails, and the ongoing purification from Python/JSON scaffolding into Rust/CultCache/CultNet organs. Then build-verify/package the Rider plugin scaffold when Gradle/wrapper support is available, install the Aetheria-pinned Unity `6000.1.10f1` editor, and run the next Aetheria dogfood pass through Aquarium/Rider/Unity bridge artifacts. GitHub Issues import is deferred until the backlog source is fresh enough to deserve Imagination's attention.
|
||||
- The repo is an Epiphany fork of Codex, not a Codex preset.
|
||||
- `vendor/codex` is tracked directly, not a submodule.
|
||||
- `epiphany-core` owns the heavy Epiphany organs where practical.
|
||||
|
|
|
|||
|
|
@ -562,7 +562,10 @@ Smoke coverage lives in
|
|||
tiny git repos, scouts them into a baseline store, projects one repo, and proves
|
||||
the projection store contains one terrain report, one profile, all eight
|
||||
standing role projections, a rendered personality distiller packet plus prompt,
|
||||
and a rendered role-specific memory distiller packet plus prompt.
|
||||
and a rendered role-specific memory distiller packet plus prompt. It also
|
||||
proves `epiphany-repo-birth-runner --mode plan` turns missing birth packets into
|
||||
startup-only Codex execution artifacts and accept commands without creating
|
||||
heartbeat participants.
|
||||
|
||||
## Next Implementation Step
|
||||
|
||||
|
|
@ -592,9 +595,10 @@ hand. A relief, frankly.
|
|||
|
||||
Remaining startup-routing gaps after the first valve:
|
||||
|
||||
1. actual startup-only LLM specialist execution for the generated packets
|
||||
2. Aquarium review/action surfaces for generated birth packets and accepted
|
||||
initialization records
|
||||
1. Aquarium review/action surfaces for generated birth packets, birth runner
|
||||
results, and accepted initialization records
|
||||
2. live `--mode run` dogfood against a real repo initialization once the user is
|
||||
ready to spend the model call
|
||||
|
||||
Clarification: "drift detection" here does not mean rerunning the distiller to
|
||||
keep personality synchronized with repo terrain. It means detecting whether the
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -119,7 +119,7 @@ accepted_design:
|
|||
- Repo personality initialization is now specified as a map-reduce projection, not a hand-written vibe pass: read-only scouts score body taxonomy, history temperament, and memory doctrine across nearby repos, reduce them into normalized variance criteria, and emit reviewable `repoTerrainReport`, `repoPersonalityProfile`, and `rolePersonalityProjection` candidates before touching agent memory.
|
||||
- Native `epiphany-repo-personality` is the first startup-personality scout and birth-only distiller packet renderer: it deterministically inventories local git repos, scores repo terrain/history/state surfaces, writes typed CultCache terrain/profile/role-projection MessagePack stores, emits JSON/Markdown inspection glass, and renders a Repo Personality Distiller specialist prompt packet for Self-reviewed first role-memory petitions. The distiller must run only when a repo/swarm has no accepted personality initialization; after that, personality drift belongs to heartbeat, mood, rumination, sleep consolidation, lived evidence, and reviewed `selfPatch`. Startup routing now checks accepted initialization records, generates missing startup-only packets only once, applies reviewed birth memory and heartbeat physiology seeds, and leaves later drift alone. Birth specialists are not heartbeat lanes; heartbeat receives only accepted seed pressure.
|
||||
- Repo memory initialization is a separate birth-only organ from repo personality initialization. `epiphany-repo-personality memory-packet` uses the typed terrain/profile/projection store plus bounded source excerpts from doctrine, docs, state, research, contracts, verification, runtime, and code surfaces to render a Repo Memory Distiller packet with one mission-specific brief for Self, Face, Imagination, Eyes, Body, Hands, Soul, and Life. It petitions Self with role-specific Ghostlight-shaped memory candidates; it does not mutate memory, set objectives, copy raw dumps, or reset living memory after startup.
|
||||
- The first repo birth startup valve is native: `epiphany-repo-personality startup` checks a typed CultCache init store for accepted `repo-personality` and `repo-memory` records, generates missing birth packets for Self review, marks them as birth-only startup-runner work with no heartbeat participant, and stops with `reviewInitializationPackets`; `accept-init` can review/apply role `selfPatch` candidates from a distiller result through `state/agents.msgpack`, seed `repo-personality` heartbeat physiology through `state/agent-heartbeats.msgpack`, record reviewed packet acceptance as `epiphany.repo_initialization_record.v0`, and later startup returns `continueStartup` without rerunning the birth rites. Actual startup-only LLM specialist execution and Aquarium review UI are still the next routing gaps.
|
||||
- The first repo birth startup valve is native: `epiphany-repo-personality startup` checks a typed CultCache init store for accepted `repo-personality` and `repo-memory` records, generates missing birth packets for Self review, marks them as birth-only startup-runner work with no heartbeat participant, and stops with `reviewInitializationPackets`; `epiphany-repo-birth-runner` now turns those packets into startup-only Codex exec prompts, output schemas, logs, result files, and exact accept commands; `accept-init` can review/apply role `selfPatch` candidates from a distiller result through `state/agents.msgpack`, seed `repo-personality` heartbeat physiology through `state/agent-heartbeats.msgpack`, record reviewed packet acceptance as `epiphany.repo_initialization_record.v0`, and later startup returns `continueStartup` without rerunning the birth rites. Aquarium review UI is still the next routing gap.
|
||||
- Limited native CRRC automation is now wired only at turn-complete safe boundaries: it can submit a compact operation when the read-only coordinator recommends `compactRehydrateReorient` or when a successful pre-compaction checkpoint intervention left a pending compact handoff for the completed turn, and it can launch the fixed `reorient-worker` when the coordinator recommends `launchReorientWorker`. It does not auto-launch modeling or verification, auto-accept findings, promote evidence, edit implementation code, or continue after reviewable semantic results; the rite may carry the stretcher, not declare the patient healed.
|
||||
- Pre-compaction checkpoint intervention is now wired at token-count boundaries: when a loaded Epiphany thread crosses the existing `shouldPrepareCompaction` pressure threshold during an active turn, the harness steers the active agent once for that turn with a bounded CRRC directive to bank scratch/checkpoint/map/evidence before compaction/reorientation. A successful steer marks a turn-scoped pending compact handoff consumed at clean turn completion; this is banking the fire before the dark, not semantic acceptance, broad scheduling, or automatic implementation continuation.
|
||||
- Native `epiphany-mvp-status` is the first dogfood operator view: it starts or reads a thread through app-server and renders scene, planning, pressure, reorient, jobs, role result read-backs, reorient result, CRRC recommendation, heartbeat, Face bubbles, and MVP role lanes as text or machine output without becoming a state store. The old Python status module has been cut; native Rust/CultCache/CultNet surfaces are the product path.
|
||||
|
|
@ -210,7 +210,7 @@ landed_baseline:
|
|||
- Native runtime spine slice: `epiphany-core::EpiphanyRuntimeIdentity`, `EpiphanyRuntimeSession`, `EpiphanyRuntimeJob`, `EpiphanyRuntimeJobResult`, and `EpiphanyRuntimeEvent` plus the native `epiphany-runtime-spine` binary establish a CultCache-backed spine, native job/result lifecycle, status projection, and framed CultNet hello output so the old Codex app-server runtime can be starved down to a temporary evacuation bridge instead of remaining the throne.
|
||||
- Native repo personality scout/birth-distiller packet slice: `epiphany-repo-personality` emits typed terrain reports, repo personality profiles, and all eight role personality projections from deterministic repo inventory and git-history scoring, then renders a birth-only Repo Personality Distiller specialist packet and prompt for review-gated initial personality quirk petitions; `epiphany-repo-personality-smoke` proves scout/project/agent-packet/status over tiny local repos.
|
||||
- Native repo memory scout/birth-distiller packet slice: `epiphany-repo-personality memory-packet` renders a separate Repo Memory Distiller prompt/packet with bounded source excerpts and role-specific distiller briefs, so a newborn swarm can be prefilled with mission-relevant doctrine, maps, research, implementation habits, verification practice, and continuity rules without confusing memory with personality.
|
||||
- Native repo birth startup valve slice: `epiphany-repo-personality startup` and `accept-init` make personality/memory birth packet generation one-shot and review-gated through typed initialization records; generated packets advertise startup-runner ownership rather than heartbeat-lane identity; `accept-init` processes distiller result `selfPatch` candidates through the native agent-memory review/apply path and applies reviewed `repo-personality` heartbeat seeds through the typed heartbeat store; smoke proves first startup emits packets, heartbeat physiology mutates, reviewed memory output mutates a copied role memory store, and post-accept startup continues without regeneration.
|
||||
- Native repo birth startup valve slice: `epiphany-repo-personality startup`, `epiphany-repo-birth-runner`, and `accept-init` make personality/memory birth packet generation, startup-only execution, and acceptance one-shot and review-gated through typed initialization records; generated packets advertise startup-runner ownership rather than heartbeat-lane identity; the birth runner has plan/run modes over `codex exec` and writes prompts, schemas, logs, result files, and accept commands; `accept-init` processes distiller result `selfPatch` candidates through the native agent-memory review/apply path and applies reviewed `repo-personality` heartbeat seeds through the typed heartbeat store; smoke proves first startup emits packets, birth runner plan artifacts exist, heartbeat physiology mutates, reviewed memory output mutates a copied role memory store, and post-accept startup continues without regeneration.
|
||||
guardrails:
|
||||
- Use focused Rust app-server mapper/handler tests plus matching native `epiphany-core` smoke binaries before modifying update, distill, propose, promote, read-projection, or notification behavior. The old Python smoke shims have been cut.
|
||||
- Use `cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-phase6-scene-smoke` before modifying scene projection behavior.
|
||||
|
|
|
|||
Reference in a new issue