Add native repo personality scout

This commit is contained in:
Meta Vens 2026-05-06 21:37:05 +01:00
commit 6cd1f5f6e9
6 changed files with 1851 additions and 8 deletions

View file

@ -0,0 +1,230 @@
use anyhow::Context;
use anyhow::Result;
use anyhow::anyhow;
use serde_json::Value;
use serde_json::json;
use std::env;
use std::fs;
use std::path::{Path, PathBuf};
use std::process::Command;
fn main() -> Result<()> {
let result = run_smoke()?;
println!("{}", serde_json::to_string_pretty(&result)?);
Ok(())
}
fn run_smoke() -> Result<Value> {
let root = env::current_dir().context("failed to resolve current dir")?;
let workspace = root
.join(".epiphany-smoke")
.join("repo-personality-workspace");
let artifacts = root
.join(".epiphany-smoke")
.join("repo-personality-artifacts");
reset_path(&workspace)?;
reset_path(&artifacts)?;
let cult_repo = create_repo(
&workspace.join("CultTiny"),
&[
(
"AGENTS.md",
"Prefer typed schemas and tiny public contracts.\n",
),
("src/lib.rs", "pub fn schema_contract() {}\n"),
(
"tests/contract_smoke.rs",
"#[test] fn contract_smoke() {}\n",
),
("schemas/message.schema.json", "{\"type\":\"object\"}\n"),
],
"Add schema contract smoke",
)?;
let lore_repo = create_repo(
&workspace.join("LoreTiny"),
&[
(
"AGENTS.md",
"Respect canon, source notes, and public voice.\n",
),
("state/map.yaml", "objective: preserve canon\n"),
("notes/fresh-workspace-handoff.md", "Read the map first.\n"),
("Chronicles/City.md", "# City\nCanon material.\n"),
],
"Polish canon handoff",
)?;
let scout = run_personality(
&root,
&[
"scout",
"--root",
workspace.to_str().unwrap_or_default(),
"--artifact-dir",
artifacts.join("scout").to_str().unwrap_or_default(),
],
)?;
require(scout["repoCount"] == 2, "scout should find two git repos")?;
let baseline = path_value(&scout, "store")?;
require(baseline.exists(), "scout should write typed baseline store")?;
let projection = run_personality(
&root,
&[
"project",
"--repo",
cult_repo.to_str().unwrap_or_default(),
"--baseline",
baseline.to_str().unwrap_or_default(),
"--artifact-dir",
artifacts.join("cult-project").to_str().unwrap_or_default(),
],
)?;
require(
projection["profile"]["roleProjectionCount"] == 8,
"project should emit all standing role projections",
)?;
let store = path_value(&projection, "store")?;
require(
store.exists(),
"project should write typed projection store",
)?;
let status = run_personality(
&root,
&["status", "--store", store.to_str().unwrap_or_default()],
)?;
require(
status["reports"] == 1,
"projection store should have one report",
)?;
require(
status["profiles"] == 1,
"projection store should have one profile",
)?;
require(
status["roleProjections"] == 8,
"projection store should have eight role projections",
)?;
Ok(json!({
"workspace": workspace,
"artifactRoot": artifacts,
"cultRepo": cult_repo,
"loreRepo": lore_repo,
"baseline": baseline,
"projectionStore": store,
"repoCount": scout["repoCount"],
"roleProjections": status["roleProjections"],
}))
}
fn create_repo(root: &Path, files: &[(&str, &str)], commit_message: &str) -> Result<PathBuf> {
fs::create_dir_all(root)?;
run_git(root, &["init"])?;
run_git(
root,
&["config", "user.email", "epiphany-smoke@example.invalid"],
)?;
run_git(root, &["config", "user.name", "Epiphany Smoke"])?;
for (path, content) in files {
let path = root.join(path);
if let Some(parent) = path.parent() {
fs::create_dir_all(parent)?;
}
fs::write(path, content)?;
}
run_git(root, &["add", "."])?;
run_git(root, &["commit", "-m", commit_message])?;
Ok(root.to_path_buf())
}
fn run_personality(root: &Path, args: &[&str]) -> Result<Value> {
let exe = native_personality_exe()?;
ensure_built(root, "epiphany-repo-personality", &exe)?;
let output = Command::new(exe)
.current_dir(root)
.args(args)
.output()
.context("failed to run epiphany-repo-personality")?;
require(
output.status.success(),
&format!(
"epiphany-repo-personality failed: {}",
String::from_utf8_lossy(&output.stderr)
),
)?;
serde_json::from_slice(&output.stdout).with_context(|| {
format!(
"epiphany-repo-personality did not return JSON: {}",
String::from_utf8_lossy(&output.stdout)
)
})
}
fn native_personality_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-personality{}",
env::consts::EXE_SUFFIX
)))
}
fn ensure_built(root: &Path, bin: &str, exe: &Path) -> Result<()> {
if exe.exists() {
return Ok(());
}
let status = Command::new("cargo")
.current_dir(root)
.arg("build")
.arg("--manifest-path")
.arg(root.join("epiphany-core").join("Cargo.toml"))
.arg("--bin")
.arg(bin)
.status()
.with_context(|| format!("failed to build {bin}"))?;
require(
status.success() && exe.exists(),
&format!("{bin} executable was not built at {}", exe.display()),
)
}
fn run_git(repo: &Path, args: &[&str]) -> Result<()> {
let output = Command::new("git")
.current_dir(repo)
.args(args)
.output()
.with_context(|| format!("failed to run git {}", args.join(" ")))?;
require(
output.status.success(),
&format!(
"git {} failed: {}",
args.join(" "),
String::from_utf8_lossy(&output.stderr)
),
)
}
fn reset_path(path: &Path) -> Result<()> {
if path.exists() {
fs::remove_dir_all(path).with_context(|| format!("failed to reset {}", path.display()))?;
}
fs::create_dir_all(path).with_context(|| format!("failed to create {}", path.display()))
}
fn path_value(value: &Value, key: &str) -> Result<PathBuf> {
value
.get(key)
.and_then(Value::as_str)
.map(PathBuf::from)
.ok_or_else(|| anyhow!("missing path value {key}"))
}
fn require(condition: bool, message: &str) -> Result<()> {
if condition {
Ok(())
} else {
Err(anyhow!(message.to_string()))
}
}

File diff suppressed because it is too large Load diff

View file

@ -36,7 +36,7 @@ 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 in `notes/repo-personality-projection-layer-plan.md`. The intended first implementation seam is a native `epiphany-repo-personality` binary that scouts local repos, scores body taxonomy/history temperament/memory doctrine, and emits reviewable typed terrain/profile/role-projection artifacts before any Ghostlight-shaped role memory is mutated.
- Repo personality initialization now has a terrain-reduced plan and first native binary. `epiphany-repo-personality scout/project/status` scouts local git repos, scores body taxonomy/history temperament/memory doctrine, writes typed CultCache terrain/profile/role-projection MessagePack stores, and emits JSON/Markdown inspection exports. `epiphany-repo-personality-smoke` creates tiny repos and proves one terrain report, one personality profile, and all eight role projections can round-trip through typed stores. The next seam is startup drift detection plus Self-reviewed application into role memory and heartbeat seeds.
- 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.
@ -67,7 +67,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: implement the native `epiphany-repo-personality` scout/project binary from `notes/repo-personality-projection-layer-plan.md`, because repo initialization needs repeatable personality vectors before it can seed swarm dossiers cleanly. 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: wire `epiphany-repo-personality` into startup protocol with drift detection and review-gated application into role dossiers/heartbeat seeds. 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.

View file

@ -484,15 +484,46 @@ the machine has repeatable bones.
- Do not let high production pressure make Hands bypass Body or Soul.
- Treat low-confidence inferred personality as a candidate, not a soul brand.
## Immediate Next Step
## Landed First Slice
Implement `epiphany-repo-personality` with:
The native `epiphany-repo-personality` binary now exists in
`epiphany-core/src/bin/epiphany-repo-personality.rs`.
It provides:
- `scout --root <path> --artifact-dir <path> [--max-repos <n>]`
- `project --repo <path> --baseline <baseline.msgpack> --artifact-dir <path>`
- `status --store <baseline-or-projection.msgpack>`
The first implementation is intentionally deterministic. It inventories git
repos, instruction/state/test/runtime surfaces, file-extension/body shape,
remote URLs, sampled commit history, path-class churn, commit-message keywords,
and emits typed CultCache MessagePack records:
- `epiphany.repo_terrain_report`
- `epiphany.repo_personality_profile`
- `epiphany.role_personality_projection`
It also writes JSON/Markdown inspection summaries beside the typed stores.
Those exports are operator glass, not the source of truth.
Smoke coverage lives in
`epiphany-core/src/bin/epiphany-repo-personality-smoke.rs`. The smoke creates two
tiny git repos, scouts them into a baseline store, projects one repo, and proves
the projection store contains one terrain report, one profile, and all eight
standing role projections.
## Next Implementation Step
Wire `epiphany-repo-personality` into startup protocol:
1. typed structs for terrain reports, personality profiles, and role projections
2. a read-only `scout` command over local repos
3. a deterministic reducer for the axes above
4. MessagePack artifact output through CultCache-compatible typed records
5. JSON/text rendering only as inspection exports, not the source of truth
2. drift detection against last accepted terrain input hashes
3. Self-reviewed application into role memory through existing `selfPatch`
policy
4. heartbeat seed generation for personality/mood timing
5. Aquarium surface for “repo personality changed” bubbles and profile
inspection
That gets Epiphany from “I feel like this repo is anxious and glittery” to a
repeatable profile that can initialize a swarm without needing the operator to

Binary file not shown.

View file

@ -116,6 +116,7 @@ accepted_design:
- Native `epiphany-runtime-spine` is the first Codex-independent runtime vertebra: it initializes and inspects typed CultCache `epiphany.runtime.identity`, `epiphany.runtime.session`, `epiphany.runtime.job`, `epiphany.runtime.job_result`, and `epiphany.runtime.event` documents, opens/completes native jobs with result records, snapshots jobs by id, and can emit a framed CultNet hello message advertising the native document and mutation contract surface. App-server launch now opens typed runtime jobs; `roleResult` / `reorientResult` read heartbeat-backed typed job results only; and `roleAccept` / `reorientAccept` accept completed heartbeat findings from the typed runtime-spine path without opening the Codex SQLite state runtime.
- CultNet public API shape is schema-first and mutation-contract-first: hello frames advertise readable document types, allowed operations, mutation authority, typed intent document types, and typed receipt document types. Aquarium and swarm clients should submit intents and watch receipts instead of inventing JSON-RPC verbs or blindly replacing authoritative state.
- 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: it deterministically inventories local git repos, scores repo terrain/history/state surfaces, writes typed CultCache terrain/profile/role-projection MessagePack stores, and emits JSON/Markdown inspection glass. The next seam is startup drift detection plus Self-reviewed application into role memory and heartbeat seeds.
- 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.
@ -203,6 +204,7 @@ landed_baseline:
- Phase 6 heartbeat initiative slice: `state/agent-heartbeats.msgpack`, `epiphany-core::EpiphanyHeartbeatStateEntry`, the native `epiphany-heartbeat-store` binary, and heartbeat smoke coverage borrow Ghostlight initiative scheduling so Self, Face, Imagination, Eyes, Body, Hands, Soul, and Life compete for heartbeat slots; idle slots become bounded rumination instead of fake project work, and sleep/dream cycle passes are the intended distillation window for durable self-memory and doctrine. The live state surface now ticks/completes/pumps/applies heartbeat physiology through typed CultCache MessagePack instead of JSON or Python wrapper state. Role personality and current mood/anxiety both shape initiative recovery through personality, mood, and effective cooldown multipliers, so Hands-like work pressure and anxious high-need lanes can recover sooner without waking lanes whose previous turn is still running. Adaptive pump pressure controls tempo and concurrency: calm can launch zero and sleep slow; alarm can fill most active lanes. The same store can now initialize a `ghostlight-scene` profile for character scene turns.
- Phase 6 cognition-lanes/Void routine slice: native `epiphany-heartbeat-store routine` rebuilds VoidBot-style sleep, resonance, incubation, parallel analytic/associative thought lanes, bridge judgment, candidate interventions, Ghostlight-style participant-local thought appraisal, derived reactions, dream maintenance, and mood/anxiety timing inside Epiphany's heartbeat store. It reads typed role dossiers from `state/agents.msgpack`, projects clustered thought state through each role's personality vectors, updates `state/agent-heartbeats.msgpack`, and emits an auditable `epiphany.void_routine.v0` receipt without importing VoidBot or granting speech/project authority. `epiphany-character-loop` also carries the same cognition lane/bridge/appraisal contract for role-local actor turns; reactions may pace, color, draft, or display behavior, but state mutation remains on reviewed `selfPatch` or project-state surfaces.
- 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 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; `epiphany-repo-personality-smoke` proves scout/project/status over tiny local repos.
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.
@ -223,6 +225,7 @@ landed_baseline:
- Use focused app-server/core Rust checks before modifying explicit role launch/read-back/acceptance behavior.
- Use `cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-agent-memory-store -- smoke --store .\state\agents.msgpack` before modifying role self-memory dossiers or `selfPatch` persistence policy.
- Use `cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-heartbeat-store -- smoke --agent-store .\state\agents.msgpack` before modifying heartbeat initiative timing, idle rumination, or role slot selection.
- Use `cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-repo-personality-smoke` before modifying repo personality terrain scoring, role projection, or startup-personality artifact shape.
- Use `cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-face-discord -- smoke` before modifying Face's #aquarium posting/draft guardrails.
- Use `cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-unity-bridge-smoke` before modifying the Unity editor/runtime bridge.
- Use `cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-rider-bridge-smoke` before modifying the Rider source-context bridge.